feat(sdk): add createKitKoraClient for plugin-based gasless transactions#388
feat(sdk): add createKitKoraClient for plugin-based gasless transactions#388amilz merged 4 commits intorelease/2.2.0from
Conversation
Port the Kit client from main to the release branch, adapting it to the release SDK's reCAPTCHA, userId, and optional fee_in_token fields. Also adds `just test-ts` to run all TypeScript tests in one command.
…nner Port the typescript_free test phase from main: add ComputeBudget to the free test config's allowed programs, wire up the test runner mapping, add FREE_PRICING env guards to fee assertions, and add kit client free pricing integration tests. Skip bundle tests in free pricing mode since bundles are disabled in that config.
📊 TypeScript Coverage ReportCoverage: 38.8% View detailed reportCoverage artifacts have been uploaded to this workflow run. |
Greptile SummaryThis PR ports The overall design is sound and aligns well with the existing plugin architecture in the SDK. Key observations:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant F as createKitKoraClient
participant K1 as KoraClient (internal)
participant K2 as KoraClient (koraPlugin)
participant SR as Solana RPC
participant KS as Kora Server
U->>F: createKitKoraClient(config)
F->>K1: new KoraClient(endpoint)
F->>K2: koraPlugin → new KoraClient(endpoint)
K1->>KS: getPayerSigner()
KS-->>K1: {signer_address, payment_address}
F->>SR: estimateComputeUnitLimitFactory(rpc)
F-->>U: KoraKitClient {payer, planner, executor, kora}
U->>U: client.sendTransaction([ix])
Note over U: transactionPlannerPlugin
U->>U: createKoraTransactionPlanner
Note over U: Injects CU budget IXs + placeholder payment IX (amount=0)
Note over U: createKoraTransactionPlanExecutor
U->>KS: getBlockhash()
KS-->>U: {blockhash}
U->>SR: simulateTransaction (CU estimation)
SR-->>U: {unitsConsumed}
U->>U: partiallySignTransactionMessageWithSigners (pre-payment)
alt payment path (payment_address truthy)
U->>K1: estimateTransactionFee(feeToken, prePaymentTx)
K1->>KS: estimateTransactionFee
KS-->>K1: {fee_in_token}
alt fee_in_token > 0
U->>U: updatePaymentInstructionAmount(amount=fee_in_token)
else fee_in_token == 0 or undefined
U->>U: removePaymentInstruction
end
U->>U: rebuild resolvedMsg with finalIxs
end
U->>K1: signAndSendTransaction(finalTx, userId)
K1->>KS: signAndSendTransaction
KS-->>K1: {signature, signed_transaction}
K1-->>U: signature
|
Summary
createKitKoraClientfrom main to release/2.2.0, adapted for release SDK's reCAPTCHA,userId, optionalfee_in_token, and existing plugin structuretypescript_freeintegration test phase with kit client free pricing testsjust test-tscommand to run all TypeScript tests (unit + basic + auth + free) in one shot@solana/kitpeer dep to^6.1.0for kit-plugin compatibilityNew files
sdks/ts/src/kit/payment.ts— placeholder payment instruction builder/updatersdks/ts/src/kit/planner.ts— compute budget + transaction plannersdks/ts/src/kit/executor.ts— plan executor with optionalfee_in_tokenhandling +userIdpassthroughsdks/ts/src/kit/index.ts—createKitKoraClientfactory composing Kit pluginssdks/ts/test/kit-client.test.ts— 19 unit tests including reCAPTCHA passthroughModified files
sdks/ts/package.json— kit-plugin peer/dev deps,test:integration:freescriptsdks/ts/src/types/index.ts—KoraKitClientConfiginterfacesdks/ts/src/index.ts— exportcreateKitKoraClient+KoraKitClientsdks/ts/test/integration.test.ts—FREE_PRICINGguards, kit client free pricing teststests/src/test_runner/commands.rs—typescript_freemappingtests/src/test_runner/test_cases.toml—[test.typescript_free]phasetests/src/common/fixtures/kora-free-test.toml— add ComputeBudget to allowed programsjustfile—test-tsrecipeTest plan
pnpm run build— compiles cleanpnpm run lint— no errorspnpm run test:unit— 37 unit tests passpnpm test kit-client.test.ts— 19 kit client tests passjust test-ts— all 4 phases pass (unit, typescript_basic, typescript_auth, typescript_free)Closes DEV-222
📊 Unit Test Coverage
Unit Test Coverage: 83.4%
View Detailed Coverage Report