Skip to content

Commit 3fe204d

Browse files
authored
Bump JS client to Kit v4 (#339)
1 parent 179c4f5 commit 3fe204d

28 files changed

+329
-440
lines changed

.changeset/red-heads-leave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solana-program/token-wrap": minor
3+
---
4+
5+
Bump Kit to v4

clients/js/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@
4242
"url": "https://github.com/solana-program/token-wrap/issues"
4343
},
4444
"peerDependencies": {
45-
"@solana/kit": "^3.0.3"
45+
"@solana/kit": "^4.0.0"
4646
},
4747
"dependencies": {
48-
"@solana-program/system": "^0.8.1",
48+
"@solana-program/system": "^0.9.0",
4949
"@solana-program/token": "^0.7.0",
5050
"@solana-program/token-2022": "^0.6.0",
5151
"@solana/accounts": "^4.0.0",
5252
"@solana/rpc-types": "^4.0.0"
5353
},
5454
"devDependencies": {
5555
"@eslint/js": "^9.37.0",
56-
"@solana/kit": "^3.0.3",
56+
"@solana/kit": "^4.0.0",
5757
"@tsconfig/strictest": "^2.0.6",
5858
"@types/node": "^24.7.2",
5959
"eslint": "^9.37.0",

clients/js/src/examples/multisig.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
address,
33
appendTransactionMessageInstructions,
44
assertIsSendableTransaction,
5+
assertIsTransactionWithBlockhashLifetime,
56
createKeyPairSignerFromBytes,
67
createNoopSigner,
78
createSolanaRpc,
@@ -80,6 +81,7 @@ async function main() {
8081
tx => signTransactionMessageWithSigners(tx),
8182
);
8283
assertIsSendableTransaction(createMintTx);
84+
assertIsTransactionWithBlockhashLifetime(createMintTx);
8385
await sendAndConfirm(createMintTx, { commitment: 'confirmed' });
8486
const createMintSignature = getSignatureFromTransaction(createMintTx);
8587

@@ -108,6 +110,7 @@ async function main() {
108110
tx => signTransactionMessageWithSigners(tx),
109111
);
110112
assertIsSendableTransaction(createEscrowTx);
113+
assertIsTransactionWithBlockhashLifetime(createEscrowTx);
111114
await sendAndConfirm(createEscrowTx, { commitment: 'confirmed' });
112115
const createEscrowSignature = getSignatureFromTransaction(createEscrowTx);
113116

@@ -138,6 +141,7 @@ async function main() {
138141
tx => signTransactionMessageWithSigners(tx),
139142
);
140143
assertIsSendableTransaction(recipientTokenAccountTx);
144+
assertIsTransactionWithBlockhashLifetime(recipientTokenAccountTx);
141145
await sendAndConfirm(recipientTokenAccountTx, { commitment: 'confirmed' });
142146

143147
const unwrappedTokenProgram = await getOwnerFromAccount(rpc, UNWRAPPED_TOKEN_ACCOUNT);
@@ -165,6 +169,7 @@ async function main() {
165169
blockhash: wrapBlockhash,
166170
});
167171
const signedWrapTxA = await partiallySignTransactionMessageWithSigners(wrapTxA);
172+
assertIsTransactionWithBlockhashLifetime(signedWrapTxA);
168173

169174
const wrapTxB = await multisigOfflineSignWrap({
170175
payer: createNoopSigner(payer.address),
@@ -181,6 +186,7 @@ async function main() {
181186
blockhash: wrapBlockhash,
182187
});
183188
const signedWrapTxB = await partiallySignTransactionMessageWithSigners(wrapTxB);
189+
assertIsTransactionWithBlockhashLifetime(signedWrapTxB);
184190

185191
const wrapTxC = await multisigOfflineSignWrap({
186192
payer,
@@ -197,6 +203,7 @@ async function main() {
197203
blockhash: wrapBlockhash,
198204
});
199205
const signedWrapTxC = await partiallySignTransactionMessageWithSigners(wrapTxC);
206+
assertIsTransactionWithBlockhashLifetime(signedWrapTxC);
200207

201208
// Lastly, all signatures are combined together and broadcast
202209

@@ -235,6 +242,7 @@ async function main() {
235242
blockhash: unwrapBlockhash,
236243
});
237244
const signedUnwrapTxA = await partiallySignTransactionMessageWithSigners(unwrapTxA);
245+
assertIsTransactionWithBlockhashLifetime(signedUnwrapTxA);
238246

239247
const unwrapTxB = await multisigOfflineSignUnwrap({
240248
payer: createNoopSigner(payer.address),
@@ -251,6 +259,7 @@ async function main() {
251259
blockhash: unwrapBlockhash,
252260
});
253261
const signedUnwrapTxB = await partiallySignTransactionMessageWithSigners(unwrapTxB);
262+
assertIsTransactionWithBlockhashLifetime(signedUnwrapTxB);
254263

255264
const unwrapTxC = await multisigOfflineSignUnwrap({
256265
payer: payer,
@@ -267,6 +276,7 @@ async function main() {
267276
blockhash: unwrapBlockhash,
268277
});
269278
const signedUnwrapTxC = await partiallySignTransactionMessageWithSigners(unwrapTxC);
279+
assertIsTransactionWithBlockhashLifetime(signedUnwrapTxC);
270280

271281
const combinedUnwrapTx = combinedMultisigTx({
272282
signedTxs: [signedUnwrapTxA, signedUnwrapTxB, signedUnwrapTxC],

clients/js/src/examples/single-signer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
address,
33
appendTransactionMessageInstructions,
44
assertIsSendableTransaction,
5+
assertIsTransactionWithBlockhashLifetime,
56
createKeyPairSignerFromBytes,
67
createSolanaRpc,
78
createSolanaRpcSubscriptions,
@@ -58,6 +59,7 @@ async function main() {
5859
tx => signTransactionMessageWithSigners(tx),
5960
);
6061
assertIsSendableTransaction(createMintTx);
62+
assertIsTransactionWithBlockhashLifetime(createMintTx);
6163
await sendAndConfirm(createMintTx, { commitment: 'confirmed' });
6264
const createMintSignature = getSignatureFromTransaction(createMintTx);
6365

@@ -86,6 +88,7 @@ async function main() {
8688
tx => signTransactionMessageWithSigners(tx),
8789
);
8890
assertIsSendableTransaction(createEscrowTx);
91+
assertIsTransactionWithBlockhashLifetime(createEscrowTx);
8992
await sendAndConfirm(createEscrowTx, { commitment: 'confirmed' });
9093
const createEscrowSignature = getSignatureFromTransaction(createEscrowTx);
9194

@@ -116,6 +119,7 @@ async function main() {
116119
tx => signTransactionMessageWithSigners(tx),
117120
);
118121
assertIsSendableTransaction(recipientTokenAccountTx);
122+
assertIsTransactionWithBlockhashLifetime(recipientTokenAccountTx);
119123
await sendAndConfirm(recipientTokenAccountTx, { commitment: 'confirmed' });
120124

121125
// Execute wrap
@@ -137,6 +141,7 @@ async function main() {
137141
tx => signTransactionMessageWithSigners(tx),
138142
);
139143
assertIsSendableTransaction(wrapTx);
144+
assertIsTransactionWithBlockhashLifetime(wrapTx);
140145
await sendAndConfirm(wrapTx, { commitment: 'confirmed' });
141146
const wrapSignature = getSignatureFromTransaction(wrapTx);
142147

@@ -164,6 +169,7 @@ async function main() {
164169
tx => signTransactionMessageWithSigners(tx),
165170
);
166171
assertIsSendableTransaction(unwrapTx);
172+
assertIsTransactionWithBlockhashLifetime(unwrapTx);
167173
await sendAndConfirm(unwrapTx, { commitment: 'confirmed' });
168174
const unwrapSignature = getSignatureFromTransaction(unwrapTx);
169175

clients/js/src/examples/sync-spl-to-token2022.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
address,
33
appendTransactionMessageInstructions,
44
assertIsSendableTransaction,
5+
assertIsTransactionWithBlockhashLifetime,
56
createKeyPairSignerFromBytes,
67
createSolanaRpc,
78
createSolanaRpcSubscriptions,
@@ -89,6 +90,7 @@ async function main() {
8990
tx => signTransactionMessageWithSigners(tx),
9091
);
9192
assertIsSendableTransaction(transaction);
93+
assertIsTransactionWithBlockhashLifetime(transaction);
9294
const signature = getSignatureFromTransaction(transaction);
9395
await sendAndConfirm(transaction, { commitment: 'confirmed' });
9496

clients/js/src/examples/sync-token2022-to-spl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
address,
33
appendTransactionMessageInstructions,
44
assertIsSendableTransaction,
5+
assertIsTransactionWithBlockhashLifetime,
56
createKeyPairSignerFromBytes,
67
createSolanaRpc,
78
createSolanaRpcSubscriptions,
@@ -94,6 +95,7 @@ async function main() {
9495
tx => signTransactionMessageWithSigners(tx),
9596
);
9697
assertIsSendableTransaction(transaction);
98+
assertIsTransactionWithBlockhashLifetime(transaction);
9799
const signature = getSignatureFromTransaction(transaction);
98100
await sendAndConfirm(transaction, { commitment: 'confirmed' });
99101

clients/js/src/generated/accounts/backpointer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* This code was AUTOGENERATED using the codama library.
2+
* This code was AUTOGENERATED using the Codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun codama to update it.
4+
* to add features, then rerun Codama to update it.
55
*
66
* @see https://github.com/codama-idl/codama
77
*/

clients/js/src/generated/accounts/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* This code was AUTOGENERATED using the codama library.
2+
* This code was AUTOGENERATED using the Codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun codama to update it.
4+
* to add features, then rerun Codama to update it.
55
*
66
* @see https://github.com/codama-idl/codama
77
*/

clients/js/src/generated/errors/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* This code was AUTOGENERATED using the codama library.
2+
* This code was AUTOGENERATED using the Codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun codama to update it.
4+
* to add features, then rerun Codama to update it.
55
*
66
* @see https://github.com/codama-idl/codama
77
*/

clients/js/src/generated/errors/tokenWrap.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* This code was AUTOGENERATED using the codama library.
2+
* This code was AUTOGENERATED using the Codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun codama to update it.
4+
* to add features, then rerun Codama to update it.
55
*
66
* @see https://github.com/codama-idl/codama
77
*/
@@ -15,35 +15,20 @@ import {
1515
import { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';
1616

1717
export const TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH = 0x0; // 0
18-
1918
export const TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH = 0x1; // 1
20-
2119
export const TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT = 0x2; // 2
22-
2320
export const TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH = 0x3; // 3
24-
2521
export const TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH = 0x4; // 4
26-
2722
export const TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER = 0x5; // 5
28-
2923
export const TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER = 0x6; // 6
30-
3124
export const TOKEN_WRAP_ERROR__ESCROW_MISMATCH = 0x7; // 7
32-
3325
export const TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE = 0x8; // 8
34-
3526
export const TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA = 0x9; // 9
36-
3727
export const TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH = 0xa; // 10
38-
3928
export const TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING = 0xb; // 11
40-
4129
export const TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET = 0xc; // 12
42-
4330
export const TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH = 0xd; // 13
44-
4531
export const TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA = 0xe; // 14
46-
4732
export const TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022 = 0xf; // 15
4833

4934
export type TokenWrapError =

0 commit comments

Comments
 (0)