Skip to content

Commit fbd8a96

Browse files
author
tilo-14
committed
feat: complete Kit SDK instruction builders and fix build pipeline
Implement the 5 missing instruction builders (transfer2, create-token-account, mint-action, claim, withdraw-funding-pool) and their codec, fixing the token-sdk build pipeline end-to-end. Changes: - Fix Codama IDL: add prefixedCountNode for array types, update renderVisitor import - Fix CI workflow: add Codama generation step before token-sdk build - Implement transfer2.ts with Path A/B/C routing and compression factory helpers - Implement create-token-account.ts with compressible/non-compressible modes - Implement mint-action.ts with full account layout - Implement claim.ts for rent recovery - Implement withdraw-funding-pool.ts for pool withdrawals - Implement codecs/mint-action.ts with full Borsh encoding - Add legacy SDK devDeps to token-client for e2e test setup - Add .gitignore for Codama-generated code (build artifact) All 350 unit tests pass (286 token-sdk + 64 token-client). Refs: #2280, #2289
1 parent 2a7ed11 commit fbd8a96

12 files changed

Lines changed: 1350 additions & 10 deletions

File tree

.github/workflows/token-kit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ jobs:
5656
- name: Install dependencies
5757
run: pnpm install --frozen-lockfile
5858

59+
- name: Generate token-sdk clients from IDL
60+
run: cd js/token-idl && pnpm run generate
61+
5962
- name: Build token-sdk
6063
run: cd js/token-sdk && pnpm build
6164

js/token-client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
"@solana/instructions": "^2.1.0"
3333
},
3434
"devDependencies": {
35+
"@lightprotocol/stateless.js": "workspace:*",
36+
"@lightprotocol/compressed-token": "workspace:*",
3537
"typescript": "^5.7.3",
3638
"vitest": "^2.1.8"
3739
},

js/token-idl/scripts/generate-clients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { createFromRoot } from 'codama';
6-
import { renderJavaScriptVisitor } from '@codama/renderers-js';
6+
import { renderVisitor } from '@codama/renderers-js';
77
import { setInstructionAccountDefaultValuesVisitor } from '@codama/visitors';
88
import { publicKeyValueNode } from 'codama';
99
import path from 'path';
@@ -45,7 +45,7 @@ codama.update(
4545
// Generate TypeScript client
4646
console.log(`Generating TypeScript client to ${typescriptOutputDir}...`);
4747
codama.accept(
48-
renderJavaScriptVisitor(typescriptOutputDir, {
48+
renderVisitor(typescriptOutputDir, {
4949
formatCode: true,
5050
dependencyMap: {
5151
// Map codama codecs to @solana/codecs

js/token-idl/src/idl.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
structFieldTypeNode,
3131
arrayTypeNode,
3232
fixedSizeTypeNode,
33+
prefixedCountNode,
3334
} from 'codama';
3435

3536
// ============================================================================
@@ -167,7 +168,7 @@ const compressibleExtensionDataType = structTypeNode([
167168
}),
168169
structFieldTypeNode({
169170
name: 'seeds',
170-
type: arrayTypeNode(bytesTypeNode()),
171+
type: arrayTypeNode(bytesTypeNode(), prefixedCountNode(numberTypeNode('u32'))),
171172
}),
172173
]),
173174
),
@@ -1097,7 +1098,7 @@ export const lightTokenIdl = rootNode(
10971098
instructionArgumentNode({
10981099
name: 'compressions',
10991100
type: optionTypeNode(
1100-
arrayTypeNode(compressionStructType),
1101+
arrayTypeNode(compressionStructType, prefixedCountNode(numberTypeNode('u32'))),
11011102
),
11021103
}),
11031104
// Note: proof, inTokenData, outTokenData, inLamports, outLamports, inTlv, outTlv

0 commit comments

Comments
 (0)