@solana-program/token-wrap 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.js +185 -255
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +186 -257
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/{generated → src/generated}/accounts/backpointer.d.ts +4 -0
- package/dist/types/{generated → src/generated}/instructions/closeStuckEscrow.d.ts +1 -1
- package/dist/types/{generated → src/generated}/instructions/createMint.d.ts +1 -1
- package/dist/types/{generated → src/generated}/instructions/syncMetadataToSplToken.d.ts +1 -1
- package/dist/types/{generated → src/generated}/instructions/syncMetadataToToken2022.d.ts +1 -1
- package/dist/types/{generated → src/generated}/instructions/unwrap.d.ts +1 -1
- package/dist/types/{generated → src/generated}/instructions/wrap.d.ts +1 -1
- package/dist/types/{generated → src/generated}/programs/tokenWrap.d.ts +2 -1
- package/dist/types/{unwrap.d.ts → src/unwrap.d.ts} +1 -2
- package/dist/types/{utilities.d.ts → src/utilities.d.ts} +1 -3
- package/dist/types/{wrap.d.ts → src/wrap.d.ts} +1 -2
- package/dist/types/tsup.config.d.ts +3 -0
- package/package.json +15 -17
- /package/dist/types/{create-mint.d.ts → src/create-mint.d.ts} +0 -0
- /package/dist/types/{examples → src/examples}/multisig.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/single-signer.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/sync-spl-to-token2022.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/sync-token2022-to-spl.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/accounts/index.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/errors/index.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/errors/tokenWrap.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/index.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/instructions/index.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/pdas/backpointer.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/pdas/index.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/pdas/wrappedMint.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/pdas/wrappedMintAuthority.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/programs/index.d.ts +0 -0
- /package/dist/types/{generated → src/generated}/shared/index.d.ts +0 -0
- /package/dist/types/{index.d.ts → src/index.d.ts} +0 -0
package/dist/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getProgramDerivedAddress, getUtf8Encoder, getAddressEncoder, getStructEncoder, getStructDecoder, getAddressDecoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts,
|
|
1
|
+
import { getProgramDerivedAddress, getUtf8Encoder, getAddressEncoder, getStructEncoder, getStructDecoder, getAddressDecoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, getU8Encoder, transformEncoder, getU8Decoder, getBooleanEncoder, getBooleanDecoder, getU64Encoder, getU64Decoder, AccountRole, containsBytes, assertIsInstructionWithAccounts, isProgramError, assertIsFullySignedTransaction, assertIsSendableTransaction, pipe, createTransactionMessage, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions, upgradeRoleToSigner, isTransactionSigner as isTransactionSigner$1 } from '@solana/kit';
|
|
2
2
|
import { extension, getMintSize, TOKEN_2022_PROGRAM_ADDRESS, findAssociatedTokenPda, fetchMaybeToken, getCreateAssociatedTokenInstruction, getTokenDecoder } from '@solana-program/token-2022';
|
|
3
3
|
import { getTransferSolInstruction } from '@solana-program/system';
|
|
4
4
|
import '@solana-program/token';
|
|
@@ -10,10 +10,7 @@ async function findBackpointerPda(seeds, config = {}) {
|
|
|
10
10
|
} = config;
|
|
11
11
|
return await getProgramDerivedAddress({
|
|
12
12
|
programAddress,
|
|
13
|
-
seeds: [
|
|
14
|
-
getUtf8Encoder().encode("backpointer"),
|
|
15
|
-
getAddressEncoder().encode(seeds.wrappedMint)
|
|
16
|
-
]
|
|
13
|
+
seeds: [getUtf8Encoder().encode("backpointer"), getAddressEncoder().encode(seeds.wrappedMint)]
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
16
|
async function findWrappedMintPda(seeds, config = {}) {
|
|
@@ -35,10 +32,7 @@ async function findWrappedMintAuthorityPda(seeds, config = {}) {
|
|
|
35
32
|
} = config;
|
|
36
33
|
return await getProgramDerivedAddress({
|
|
37
34
|
programAddress,
|
|
38
|
-
seeds: [
|
|
39
|
-
getUtf8Encoder().encode("authority"),
|
|
40
|
-
getAddressEncoder().encode(seeds.wrappedMint)
|
|
41
|
-
]
|
|
35
|
+
seeds: [getUtf8Encoder().encode("authority"), getAddressEncoder().encode(seeds.wrappedMint)]
|
|
42
36
|
});
|
|
43
37
|
}
|
|
44
38
|
|
|
@@ -53,10 +47,7 @@ function getBackpointerCodec() {
|
|
|
53
47
|
return combineCodec(getBackpointerEncoder(), getBackpointerDecoder());
|
|
54
48
|
}
|
|
55
49
|
function decodeBackpointer(encodedAccount) {
|
|
56
|
-
return decodeAccount(
|
|
57
|
-
encodedAccount,
|
|
58
|
-
getBackpointerDecoder()
|
|
59
|
-
);
|
|
50
|
+
return decodeAccount(encodedAccount, getBackpointerDecoder());
|
|
60
51
|
}
|
|
61
52
|
async function fetchBackpointer(rpc, address, config) {
|
|
62
53
|
const maybeAccount = await fetchMaybeBackpointer(rpc, address, config);
|
|
@@ -89,97 +80,6 @@ async function fetchMaybeBackpointerFromSeeds(rpc, seeds, config = {}) {
|
|
|
89
80
|
const [address] = await findBackpointerPda(seeds, { programAddress });
|
|
90
81
|
return await fetchMaybeBackpointer(rpc, address, fetchConfig);
|
|
91
82
|
}
|
|
92
|
-
var TOKEN_WRAP_PROGRAM_ADDRESS = "TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR";
|
|
93
|
-
var TokenWrapAccount = /* @__PURE__ */ ((TokenWrapAccount2) => {
|
|
94
|
-
TokenWrapAccount2[TokenWrapAccount2["Backpointer"] = 0] = "Backpointer";
|
|
95
|
-
return TokenWrapAccount2;
|
|
96
|
-
})(TokenWrapAccount || {});
|
|
97
|
-
var TokenWrapInstruction = /* @__PURE__ */ ((TokenWrapInstruction2) => {
|
|
98
|
-
TokenWrapInstruction2[TokenWrapInstruction2["CreateMint"] = 0] = "CreateMint";
|
|
99
|
-
TokenWrapInstruction2[TokenWrapInstruction2["Wrap"] = 1] = "Wrap";
|
|
100
|
-
TokenWrapInstruction2[TokenWrapInstruction2["Unwrap"] = 2] = "Unwrap";
|
|
101
|
-
TokenWrapInstruction2[TokenWrapInstruction2["CloseStuckEscrow"] = 3] = "CloseStuckEscrow";
|
|
102
|
-
TokenWrapInstruction2[TokenWrapInstruction2["SyncMetadataToToken2022"] = 4] = "SyncMetadataToToken2022";
|
|
103
|
-
TokenWrapInstruction2[TokenWrapInstruction2["SyncMetadataToSplToken"] = 5] = "SyncMetadataToSplToken";
|
|
104
|
-
return TokenWrapInstruction2;
|
|
105
|
-
})(TokenWrapInstruction || {});
|
|
106
|
-
function identifyTokenWrapInstruction(instruction) {
|
|
107
|
-
const data = "data" in instruction ? instruction.data : instruction;
|
|
108
|
-
if (containsBytes(data, getU8Encoder().encode(0), 0)) {
|
|
109
|
-
return 0 /* CreateMint */;
|
|
110
|
-
}
|
|
111
|
-
if (containsBytes(data, getU8Encoder().encode(1), 0)) {
|
|
112
|
-
return 1 /* Wrap */;
|
|
113
|
-
}
|
|
114
|
-
if (containsBytes(data, getU8Encoder().encode(2), 0)) {
|
|
115
|
-
return 2 /* Unwrap */;
|
|
116
|
-
}
|
|
117
|
-
if (containsBytes(data, getU8Encoder().encode(3), 0)) {
|
|
118
|
-
return 3 /* CloseStuckEscrow */;
|
|
119
|
-
}
|
|
120
|
-
if (containsBytes(data, getU8Encoder().encode(4), 0)) {
|
|
121
|
-
return 4 /* SyncMetadataToToken2022 */;
|
|
122
|
-
}
|
|
123
|
-
if (containsBytes(data, getU8Encoder().encode(5), 0)) {
|
|
124
|
-
return 5 /* SyncMetadataToSplToken */;
|
|
125
|
-
}
|
|
126
|
-
throw new Error(
|
|
127
|
-
"The provided instruction could not be identified as a tokenWrap instruction."
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/generated/errors/tokenWrap.ts
|
|
132
|
-
var TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH = 0;
|
|
133
|
-
var TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH = 1;
|
|
134
|
-
var TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT = 2;
|
|
135
|
-
var TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH = 3;
|
|
136
|
-
var TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH = 4;
|
|
137
|
-
var TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER = 5;
|
|
138
|
-
var TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER = 6;
|
|
139
|
-
var TOKEN_WRAP_ERROR__ESCROW_MISMATCH = 7;
|
|
140
|
-
var TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE = 8;
|
|
141
|
-
var TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA = 9;
|
|
142
|
-
var TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH = 10;
|
|
143
|
-
var TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING = 11;
|
|
144
|
-
var TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET = 12;
|
|
145
|
-
var TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH = 13;
|
|
146
|
-
var TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA = 14;
|
|
147
|
-
var TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022 = 15;
|
|
148
|
-
var tokenWrapErrorMessages;
|
|
149
|
-
if (process.env.NODE_ENV !== "production") {
|
|
150
|
-
tokenWrapErrorMessages = {
|
|
151
|
-
[TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH]: `Wrapped backpointer account address does not match expected PDA`,
|
|
152
|
-
[TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE]: `The escrow account is in a good state and cannot be recreated`,
|
|
153
|
-
[TOKEN_WRAP_ERROR__ESCROW_MISMATCH]: `Escrow account address does not match expected ATA`,
|
|
154
|
-
[TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH]: `Unwrapped escrow token owner is not set to expected PDA`,
|
|
155
|
-
[TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA]: `External metadata program returned no data`,
|
|
156
|
-
[TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER]: `Wrapped backpointer account owner is not the expected token wrap program`,
|
|
157
|
-
[TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER]: `Wrapped mint account owner is not the expected token program`,
|
|
158
|
-
[TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH]: `Provided source metadata account does not match pointer`,
|
|
159
|
-
[TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING]: `Metadata pointer extension missing on mint`,
|
|
160
|
-
[TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET]: `Metadata pointer is unset (None)`,
|
|
161
|
-
[TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH]: `Metaplex metadata account address does not match expected PDA`,
|
|
162
|
-
[TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH]: `Wrapped mint authority does not match expected PDA`,
|
|
163
|
-
[TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022]: `Instruction can only be used with spl-token wrapped mints`,
|
|
164
|
-
[TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA]: `Unwrapped mint does not have the TokenMetadata extension`,
|
|
165
|
-
[TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH]: `Wrapped mint account address does not match expected PDA`,
|
|
166
|
-
[TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT]: `Wrap amount should be positive`
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function getTokenWrapErrorMessage(code) {
|
|
170
|
-
if (process.env.NODE_ENV !== "production") {
|
|
171
|
-
return tokenWrapErrorMessages[code];
|
|
172
|
-
}
|
|
173
|
-
return "Error message not available in production bundles.";
|
|
174
|
-
}
|
|
175
|
-
function isTokenWrapError(error, transactionMessage, code) {
|
|
176
|
-
return isProgramError(
|
|
177
|
-
error,
|
|
178
|
-
transactionMessage,
|
|
179
|
-
TOKEN_WRAP_PROGRAM_ADDRESS,
|
|
180
|
-
code
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
83
|
function expectAddress(value) {
|
|
184
84
|
if (!value) {
|
|
185
85
|
throw new Error("Expected a Address.");
|
|
@@ -195,10 +95,7 @@ function expectAddress(value) {
|
|
|
195
95
|
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
196
96
|
return (account) => {
|
|
197
97
|
if (!account.value) {
|
|
198
|
-
return Object.freeze({
|
|
199
|
-
address: programAddress,
|
|
200
|
-
role: AccountRole.READONLY
|
|
201
|
-
});
|
|
98
|
+
return Object.freeze({ address: programAddress, role: AccountRole.READONLY });
|
|
202
99
|
}
|
|
203
100
|
const writableRole = account.isWritable ? AccountRole.WRITABLE : AccountRole.READONLY;
|
|
204
101
|
return Object.freeze({
|
|
@@ -218,19 +115,16 @@ function getCloseStuckEscrowDiscriminatorBytes() {
|
|
|
218
115
|
return getU8Encoder().encode(CLOSE_STUCK_ESCROW_DISCRIMINATOR);
|
|
219
116
|
}
|
|
220
117
|
function getCloseStuckEscrowInstructionDataEncoder() {
|
|
221
|
-
return transformEncoder(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
);
|
|
118
|
+
return transformEncoder(getStructEncoder([["discriminator", getU8Encoder()]]), (value) => ({
|
|
119
|
+
...value,
|
|
120
|
+
discriminator: CLOSE_STUCK_ESCROW_DISCRIMINATOR
|
|
121
|
+
}));
|
|
225
122
|
}
|
|
226
123
|
function getCloseStuckEscrowInstructionDataDecoder() {
|
|
227
124
|
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
228
125
|
}
|
|
229
126
|
function getCloseStuckEscrowInstructionDataCodec() {
|
|
230
|
-
return combineCodec(
|
|
231
|
-
getCloseStuckEscrowInstructionDataEncoder(),
|
|
232
|
-
getCloseStuckEscrowInstructionDataDecoder()
|
|
233
|
-
);
|
|
127
|
+
return combineCodec(getCloseStuckEscrowInstructionDataEncoder(), getCloseStuckEscrowInstructionDataDecoder());
|
|
234
128
|
}
|
|
235
129
|
function getCloseStuckEscrowInstruction(input, config) {
|
|
236
130
|
const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;
|
|
@@ -239,14 +133,8 @@ function getCloseStuckEscrowInstruction(input, config) {
|
|
|
239
133
|
destination: { value: input.destination ?? null, isWritable: true },
|
|
240
134
|
unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },
|
|
241
135
|
wrappedMint: { value: input.wrappedMint ?? null, isWritable: false },
|
|
242
|
-
wrappedMintAuthority: {
|
|
243
|
-
|
|
244
|
-
isWritable: false
|
|
245
|
-
},
|
|
246
|
-
token2022Program: {
|
|
247
|
-
value: input.token2022Program ?? null,
|
|
248
|
-
isWritable: false
|
|
249
|
-
}
|
|
136
|
+
wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },
|
|
137
|
+
token2022Program: { value: input.token2022Program ?? null, isWritable: false }
|
|
250
138
|
};
|
|
251
139
|
const accounts = originalAccounts;
|
|
252
140
|
if (!accounts.token2022Program.value) {
|
|
@@ -303,11 +191,7 @@ function getCreateMintInstructionDataEncoder() {
|
|
|
303
191
|
["discriminator", getU8Encoder()],
|
|
304
192
|
["idempotent", getBooleanEncoder()]
|
|
305
193
|
]),
|
|
306
|
-
(value) => ({
|
|
307
|
-
...value,
|
|
308
|
-
discriminator: CREATE_MINT_DISCRIMINATOR,
|
|
309
|
-
idempotent: value.idempotent ?? false
|
|
310
|
-
})
|
|
194
|
+
(value) => ({ ...value, discriminator: CREATE_MINT_DISCRIMINATOR, idempotent: value.idempotent ?? false })
|
|
311
195
|
);
|
|
312
196
|
}
|
|
313
197
|
function getCreateMintInstructionDataDecoder() {
|
|
@@ -317,10 +201,7 @@ function getCreateMintInstructionDataDecoder() {
|
|
|
317
201
|
]);
|
|
318
202
|
}
|
|
319
203
|
function getCreateMintInstructionDataCodec() {
|
|
320
|
-
return combineCodec(
|
|
321
|
-
getCreateMintInstructionDataEncoder(),
|
|
322
|
-
getCreateMintInstructionDataDecoder()
|
|
323
|
-
);
|
|
204
|
+
return combineCodec(getCreateMintInstructionDataEncoder(), getCreateMintInstructionDataDecoder());
|
|
324
205
|
}
|
|
325
206
|
function getCreateMintInstruction(input, config) {
|
|
326
207
|
const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;
|
|
@@ -329,10 +210,7 @@ function getCreateMintInstruction(input, config) {
|
|
|
329
210
|
backpointer: { value: input.backpointer ?? null, isWritable: true },
|
|
330
211
|
unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },
|
|
331
212
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
332
|
-
wrappedTokenProgram: {
|
|
333
|
-
value: input.wrappedTokenProgram ?? null,
|
|
334
|
-
isWritable: false
|
|
335
|
-
}
|
|
213
|
+
wrappedTokenProgram: { value: input.wrappedTokenProgram ?? null, isWritable: false }
|
|
336
214
|
};
|
|
337
215
|
const accounts = originalAccounts;
|
|
338
216
|
const args = { ...input };
|
|
@@ -348,9 +226,7 @@ function getCreateMintInstruction(input, config) {
|
|
|
348
226
|
getAccountMeta(accounts.systemProgram),
|
|
349
227
|
getAccountMeta(accounts.wrappedTokenProgram)
|
|
350
228
|
],
|
|
351
|
-
data: getCreateMintInstructionDataEncoder().encode(
|
|
352
|
-
args
|
|
353
|
-
),
|
|
229
|
+
data: getCreateMintInstructionDataEncoder().encode(args),
|
|
354
230
|
programAddress
|
|
355
231
|
});
|
|
356
232
|
}
|
|
@@ -385,13 +261,10 @@ function getSyncMetadataToSplTokenDiscriminatorBytes() {
|
|
|
385
261
|
return getU8Encoder().encode(SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR);
|
|
386
262
|
}
|
|
387
263
|
function getSyncMetadataToSplTokenInstructionDataEncoder() {
|
|
388
|
-
return transformEncoder(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
discriminator: SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR
|
|
393
|
-
})
|
|
394
|
-
);
|
|
264
|
+
return transformEncoder(getStructEncoder([["discriminator", getU8Encoder()]]), (value) => ({
|
|
265
|
+
...value,
|
|
266
|
+
discriminator: SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR
|
|
267
|
+
}));
|
|
395
268
|
}
|
|
396
269
|
function getSyncMetadataToSplTokenInstructionDataDecoder() {
|
|
397
270
|
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
@@ -405,20 +278,11 @@ function getSyncMetadataToSplTokenInstructionDataCodec() {
|
|
|
405
278
|
function getSyncMetadataToSplTokenInstruction(input, config) {
|
|
406
279
|
const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;
|
|
407
280
|
const originalAccounts = {
|
|
408
|
-
metaplexMetadata: {
|
|
409
|
-
|
|
410
|
-
isWritable: true
|
|
411
|
-
},
|
|
412
|
-
wrappedMintAuthority: {
|
|
413
|
-
value: input.wrappedMintAuthority ?? null,
|
|
414
|
-
isWritable: true
|
|
415
|
-
},
|
|
281
|
+
metaplexMetadata: { value: input.metaplexMetadata ?? null, isWritable: true },
|
|
282
|
+
wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: true },
|
|
416
283
|
wrappedMint: { value: input.wrappedMint ?? null, isWritable: false },
|
|
417
284
|
unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },
|
|
418
|
-
metaplexProgram: {
|
|
419
|
-
value: input.metaplexProgram ?? null,
|
|
420
|
-
isWritable: false
|
|
421
|
-
},
|
|
285
|
+
metaplexProgram: { value: input.metaplexProgram ?? null, isWritable: false },
|
|
422
286
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
423
287
|
rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },
|
|
424
288
|
sourceMetadata: { value: input.sourceMetadata ?? null, isWritable: false },
|
|
@@ -478,9 +342,7 @@ function parseSyncMetadataToSplTokenInstruction(instruction) {
|
|
|
478
342
|
sourceMetadata: getNextOptionalAccount(),
|
|
479
343
|
ownerProgram: getNextOptionalAccount()
|
|
480
344
|
},
|
|
481
|
-
data: getSyncMetadataToSplTokenInstructionDataDecoder().decode(
|
|
482
|
-
instruction.data
|
|
483
|
-
)
|
|
345
|
+
data: getSyncMetadataToSplTokenInstructionDataDecoder().decode(instruction.data)
|
|
484
346
|
};
|
|
485
347
|
}
|
|
486
348
|
var SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR = 4;
|
|
@@ -488,13 +350,10 @@ function getSyncMetadataToToken2022DiscriminatorBytes() {
|
|
|
488
350
|
return getU8Encoder().encode(SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR);
|
|
489
351
|
}
|
|
490
352
|
function getSyncMetadataToToken2022InstructionDataEncoder() {
|
|
491
|
-
return transformEncoder(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
discriminator: SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR
|
|
496
|
-
})
|
|
497
|
-
);
|
|
353
|
+
return transformEncoder(getStructEncoder([["discriminator", getU8Encoder()]]), (value) => ({
|
|
354
|
+
...value,
|
|
355
|
+
discriminator: SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR
|
|
356
|
+
}));
|
|
498
357
|
}
|
|
499
358
|
function getSyncMetadataToToken2022InstructionDataDecoder() {
|
|
500
359
|
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
@@ -509,15 +368,9 @@ function getSyncMetadataToToken2022Instruction(input, config) {
|
|
|
509
368
|
const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;
|
|
510
369
|
const originalAccounts = {
|
|
511
370
|
wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },
|
|
512
|
-
wrappedMintAuthority: {
|
|
513
|
-
value: input.wrappedMintAuthority ?? null,
|
|
514
|
-
isWritable: false
|
|
515
|
-
},
|
|
371
|
+
wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },
|
|
516
372
|
unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },
|
|
517
|
-
token2022Program: {
|
|
518
|
-
value: input.token2022Program ?? null,
|
|
519
|
-
isWritable: false
|
|
520
|
-
},
|
|
373
|
+
token2022Program: { value: input.token2022Program ?? null, isWritable: false },
|
|
521
374
|
sourceMetadata: { value: input.sourceMetadata ?? null, isWritable: false },
|
|
522
375
|
ownerProgram: { value: input.ownerProgram ?? null, isWritable: false }
|
|
523
376
|
};
|
|
@@ -563,9 +416,7 @@ function parseSyncMetadataToToken2022Instruction(instruction) {
|
|
|
563
416
|
sourceMetadata: getNextOptionalAccount(),
|
|
564
417
|
ownerProgram: getNextOptionalAccount()
|
|
565
418
|
},
|
|
566
|
-
data: getSyncMetadataToToken2022InstructionDataDecoder().decode(
|
|
567
|
-
instruction.data
|
|
568
|
-
)
|
|
419
|
+
data: getSyncMetadataToToken2022InstructionDataDecoder().decode(instruction.data)
|
|
569
420
|
};
|
|
570
421
|
}
|
|
571
422
|
var UNWRAP_DISCRIMINATOR = 2;
|
|
@@ -588,51 +439,28 @@ function getUnwrapInstructionDataDecoder() {
|
|
|
588
439
|
]);
|
|
589
440
|
}
|
|
590
441
|
function getUnwrapInstructionDataCodec() {
|
|
591
|
-
return combineCodec(
|
|
592
|
-
getUnwrapInstructionDataEncoder(),
|
|
593
|
-
getUnwrapInstructionDataDecoder()
|
|
594
|
-
);
|
|
442
|
+
return combineCodec(getUnwrapInstructionDataEncoder(), getUnwrapInstructionDataDecoder());
|
|
595
443
|
}
|
|
596
444
|
function getUnwrapInstruction(input, config) {
|
|
597
445
|
const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;
|
|
598
446
|
const originalAccounts = {
|
|
599
447
|
unwrappedEscrow: { value: input.unwrappedEscrow ?? null, isWritable: true },
|
|
600
|
-
recipientUnwrappedToken: {
|
|
601
|
-
|
|
602
|
-
isWritable: true
|
|
603
|
-
},
|
|
604
|
-
wrappedMintAuthority: {
|
|
605
|
-
value: input.wrappedMintAuthority ?? null,
|
|
606
|
-
isWritable: false
|
|
607
|
-
},
|
|
448
|
+
recipientUnwrappedToken: { value: input.recipientUnwrappedToken ?? null, isWritable: true },
|
|
449
|
+
wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },
|
|
608
450
|
unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },
|
|
609
|
-
wrappedTokenProgram: {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
},
|
|
613
|
-
unwrappedTokenProgram: {
|
|
614
|
-
value: input.unwrappedTokenProgram ?? null,
|
|
615
|
-
isWritable: false
|
|
616
|
-
},
|
|
617
|
-
wrappedTokenAccount: {
|
|
618
|
-
value: input.wrappedTokenAccount ?? null,
|
|
619
|
-
isWritable: true
|
|
620
|
-
},
|
|
451
|
+
wrappedTokenProgram: { value: input.wrappedTokenProgram ?? null, isWritable: false },
|
|
452
|
+
unwrappedTokenProgram: { value: input.unwrappedTokenProgram ?? null, isWritable: false },
|
|
453
|
+
wrappedTokenAccount: { value: input.wrappedTokenAccount ?? null, isWritable: true },
|
|
621
454
|
wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },
|
|
622
|
-
transferAuthority: {
|
|
623
|
-
value: input.transferAuthority ?? null,
|
|
624
|
-
isWritable: false
|
|
625
|
-
}
|
|
455
|
+
transferAuthority: { value: input.transferAuthority ?? null, isWritable: false }
|
|
626
456
|
};
|
|
627
457
|
const accounts = originalAccounts;
|
|
628
458
|
const args = { ...input };
|
|
629
|
-
const remainingAccounts = (args.multiSigners ?? []).map(
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
})
|
|
635
|
-
);
|
|
459
|
+
const remainingAccounts = (args.multiSigners ?? []).map((signer) => ({
|
|
460
|
+
address: signer.address,
|
|
461
|
+
role: AccountRole.READONLY_SIGNER,
|
|
462
|
+
signer
|
|
463
|
+
}));
|
|
636
464
|
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
637
465
|
return Object.freeze({
|
|
638
466
|
accounts: [
|
|
@@ -647,9 +475,7 @@ function getUnwrapInstruction(input, config) {
|
|
|
647
475
|
getAccountMeta(accounts.transferAuthority),
|
|
648
476
|
...remainingAccounts
|
|
649
477
|
],
|
|
650
|
-
data: getUnwrapInstructionDataEncoder().encode(
|
|
651
|
-
args
|
|
652
|
-
),
|
|
478
|
+
data: getUnwrapInstructionDataEncoder().encode(args),
|
|
653
479
|
programAddress
|
|
654
480
|
});
|
|
655
481
|
}
|
|
@@ -699,51 +525,28 @@ function getWrapInstructionDataDecoder() {
|
|
|
699
525
|
]);
|
|
700
526
|
}
|
|
701
527
|
function getWrapInstructionDataCodec() {
|
|
702
|
-
return combineCodec(
|
|
703
|
-
getWrapInstructionDataEncoder(),
|
|
704
|
-
getWrapInstructionDataDecoder()
|
|
705
|
-
);
|
|
528
|
+
return combineCodec(getWrapInstructionDataEncoder(), getWrapInstructionDataDecoder());
|
|
706
529
|
}
|
|
707
530
|
function getWrapInstruction(input, config) {
|
|
708
531
|
const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;
|
|
709
532
|
const originalAccounts = {
|
|
710
|
-
recipientWrappedTokenAccount: {
|
|
711
|
-
value: input.recipientWrappedTokenAccount ?? null,
|
|
712
|
-
isWritable: true
|
|
713
|
-
},
|
|
533
|
+
recipientWrappedTokenAccount: { value: input.recipientWrappedTokenAccount ?? null, isWritable: true },
|
|
714
534
|
wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },
|
|
715
|
-
wrappedMintAuthority: {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
},
|
|
719
|
-
unwrappedTokenProgram: {
|
|
720
|
-
value: input.unwrappedTokenProgram ?? null,
|
|
721
|
-
isWritable: false
|
|
722
|
-
},
|
|
723
|
-
wrappedTokenProgram: {
|
|
724
|
-
value: input.wrappedTokenProgram ?? null,
|
|
725
|
-
isWritable: false
|
|
726
|
-
},
|
|
727
|
-
unwrappedTokenAccount: {
|
|
728
|
-
value: input.unwrappedTokenAccount ?? null,
|
|
729
|
-
isWritable: true
|
|
730
|
-
},
|
|
535
|
+
wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },
|
|
536
|
+
unwrappedTokenProgram: { value: input.unwrappedTokenProgram ?? null, isWritable: false },
|
|
537
|
+
wrappedTokenProgram: { value: input.wrappedTokenProgram ?? null, isWritable: false },
|
|
538
|
+
unwrappedTokenAccount: { value: input.unwrappedTokenAccount ?? null, isWritable: true },
|
|
731
539
|
unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },
|
|
732
540
|
unwrappedEscrow: { value: input.unwrappedEscrow ?? null, isWritable: true },
|
|
733
|
-
transferAuthority: {
|
|
734
|
-
value: input.transferAuthority ?? null,
|
|
735
|
-
isWritable: false
|
|
736
|
-
}
|
|
541
|
+
transferAuthority: { value: input.transferAuthority ?? null, isWritable: false }
|
|
737
542
|
};
|
|
738
543
|
const accounts = originalAccounts;
|
|
739
544
|
const args = { ...input };
|
|
740
|
-
const remainingAccounts = (args.multiSigners ?? []).map(
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
})
|
|
746
|
-
);
|
|
545
|
+
const remainingAccounts = (args.multiSigners ?? []).map((signer) => ({
|
|
546
|
+
address: signer.address,
|
|
547
|
+
role: AccountRole.READONLY_SIGNER,
|
|
548
|
+
signer
|
|
549
|
+
}));
|
|
747
550
|
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
748
551
|
return Object.freeze({
|
|
749
552
|
accounts: [
|
|
@@ -758,9 +561,7 @@ function getWrapInstruction(input, config) {
|
|
|
758
561
|
getAccountMeta(accounts.transferAuthority),
|
|
759
562
|
...remainingAccounts
|
|
760
563
|
],
|
|
761
|
-
data: getWrapInstructionDataEncoder().encode(
|
|
762
|
-
args
|
|
763
|
-
),
|
|
564
|
+
data: getWrapInstructionDataEncoder().encode(args),
|
|
764
565
|
programAddress
|
|
765
566
|
});
|
|
766
567
|
}
|
|
@@ -790,6 +591,132 @@ function parseWrapInstruction(instruction) {
|
|
|
790
591
|
data: getWrapInstructionDataDecoder().decode(instruction.data)
|
|
791
592
|
};
|
|
792
593
|
}
|
|
594
|
+
|
|
595
|
+
// src/generated/programs/tokenWrap.ts
|
|
596
|
+
var TOKEN_WRAP_PROGRAM_ADDRESS = "TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR";
|
|
597
|
+
var TokenWrapAccount = /* @__PURE__ */ ((TokenWrapAccount2) => {
|
|
598
|
+
TokenWrapAccount2[TokenWrapAccount2["Backpointer"] = 0] = "Backpointer";
|
|
599
|
+
return TokenWrapAccount2;
|
|
600
|
+
})(TokenWrapAccount || {});
|
|
601
|
+
var TokenWrapInstruction = /* @__PURE__ */ ((TokenWrapInstruction2) => {
|
|
602
|
+
TokenWrapInstruction2[TokenWrapInstruction2["CreateMint"] = 0] = "CreateMint";
|
|
603
|
+
TokenWrapInstruction2[TokenWrapInstruction2["Wrap"] = 1] = "Wrap";
|
|
604
|
+
TokenWrapInstruction2[TokenWrapInstruction2["Unwrap"] = 2] = "Unwrap";
|
|
605
|
+
TokenWrapInstruction2[TokenWrapInstruction2["CloseStuckEscrow"] = 3] = "CloseStuckEscrow";
|
|
606
|
+
TokenWrapInstruction2[TokenWrapInstruction2["SyncMetadataToToken2022"] = 4] = "SyncMetadataToToken2022";
|
|
607
|
+
TokenWrapInstruction2[TokenWrapInstruction2["SyncMetadataToSplToken"] = 5] = "SyncMetadataToSplToken";
|
|
608
|
+
return TokenWrapInstruction2;
|
|
609
|
+
})(TokenWrapInstruction || {});
|
|
610
|
+
function identifyTokenWrapInstruction(instruction) {
|
|
611
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
612
|
+
if (containsBytes(data, getU8Encoder().encode(0), 0)) {
|
|
613
|
+
return 0 /* CreateMint */;
|
|
614
|
+
}
|
|
615
|
+
if (containsBytes(data, getU8Encoder().encode(1), 0)) {
|
|
616
|
+
return 1 /* Wrap */;
|
|
617
|
+
}
|
|
618
|
+
if (containsBytes(data, getU8Encoder().encode(2), 0)) {
|
|
619
|
+
return 2 /* Unwrap */;
|
|
620
|
+
}
|
|
621
|
+
if (containsBytes(data, getU8Encoder().encode(3), 0)) {
|
|
622
|
+
return 3 /* CloseStuckEscrow */;
|
|
623
|
+
}
|
|
624
|
+
if (containsBytes(data, getU8Encoder().encode(4), 0)) {
|
|
625
|
+
return 4 /* SyncMetadataToToken2022 */;
|
|
626
|
+
}
|
|
627
|
+
if (containsBytes(data, getU8Encoder().encode(5), 0)) {
|
|
628
|
+
return 5 /* SyncMetadataToSplToken */;
|
|
629
|
+
}
|
|
630
|
+
throw new Error("The provided instruction could not be identified as a tokenWrap instruction.");
|
|
631
|
+
}
|
|
632
|
+
function parseTokenWrapInstruction(instruction) {
|
|
633
|
+
const instructionType = identifyTokenWrapInstruction(instruction);
|
|
634
|
+
switch (instructionType) {
|
|
635
|
+
case 0 /* CreateMint */: {
|
|
636
|
+
assertIsInstructionWithAccounts(instruction);
|
|
637
|
+
return { instructionType: 0 /* CreateMint */, ...parseCreateMintInstruction(instruction) };
|
|
638
|
+
}
|
|
639
|
+
case 1 /* Wrap */: {
|
|
640
|
+
assertIsInstructionWithAccounts(instruction);
|
|
641
|
+
return { instructionType: 1 /* Wrap */, ...parseWrapInstruction(instruction) };
|
|
642
|
+
}
|
|
643
|
+
case 2 /* Unwrap */: {
|
|
644
|
+
assertIsInstructionWithAccounts(instruction);
|
|
645
|
+
return { instructionType: 2 /* Unwrap */, ...parseUnwrapInstruction(instruction) };
|
|
646
|
+
}
|
|
647
|
+
case 3 /* CloseStuckEscrow */: {
|
|
648
|
+
assertIsInstructionWithAccounts(instruction);
|
|
649
|
+
return {
|
|
650
|
+
instructionType: 3 /* CloseStuckEscrow */,
|
|
651
|
+
...parseCloseStuckEscrowInstruction(instruction)
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
case 4 /* SyncMetadataToToken2022 */: {
|
|
655
|
+
assertIsInstructionWithAccounts(instruction);
|
|
656
|
+
return {
|
|
657
|
+
instructionType: 4 /* SyncMetadataToToken2022 */,
|
|
658
|
+
...parseSyncMetadataToToken2022Instruction(instruction)
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
case 5 /* SyncMetadataToSplToken */: {
|
|
662
|
+
assertIsInstructionWithAccounts(instruction);
|
|
663
|
+
return {
|
|
664
|
+
instructionType: 5 /* SyncMetadataToSplToken */,
|
|
665
|
+
...parseSyncMetadataToSplTokenInstruction(instruction)
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
default:
|
|
669
|
+
throw new Error(`Unrecognized instruction type: ${instructionType}`);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// src/generated/errors/tokenWrap.ts
|
|
674
|
+
var TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH = 0;
|
|
675
|
+
var TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH = 1;
|
|
676
|
+
var TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT = 2;
|
|
677
|
+
var TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH = 3;
|
|
678
|
+
var TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH = 4;
|
|
679
|
+
var TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER = 5;
|
|
680
|
+
var TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER = 6;
|
|
681
|
+
var TOKEN_WRAP_ERROR__ESCROW_MISMATCH = 7;
|
|
682
|
+
var TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE = 8;
|
|
683
|
+
var TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA = 9;
|
|
684
|
+
var TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH = 10;
|
|
685
|
+
var TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING = 11;
|
|
686
|
+
var TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET = 12;
|
|
687
|
+
var TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH = 13;
|
|
688
|
+
var TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA = 14;
|
|
689
|
+
var TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022 = 15;
|
|
690
|
+
var tokenWrapErrorMessages;
|
|
691
|
+
if (process.env.NODE_ENV !== "production") {
|
|
692
|
+
tokenWrapErrorMessages = {
|
|
693
|
+
[TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH]: `Wrapped backpointer account address does not match expected PDA`,
|
|
694
|
+
[TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE]: `The escrow account is in a good state and cannot be recreated`,
|
|
695
|
+
[TOKEN_WRAP_ERROR__ESCROW_MISMATCH]: `Escrow account address does not match expected ATA`,
|
|
696
|
+
[TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH]: `Unwrapped escrow token owner is not set to expected PDA`,
|
|
697
|
+
[TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA]: `External metadata program returned no data`,
|
|
698
|
+
[TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER]: `Wrapped backpointer account owner is not the expected token wrap program`,
|
|
699
|
+
[TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER]: `Wrapped mint account owner is not the expected token program`,
|
|
700
|
+
[TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH]: `Provided source metadata account does not match pointer`,
|
|
701
|
+
[TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING]: `Metadata pointer extension missing on mint`,
|
|
702
|
+
[TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET]: `Metadata pointer is unset (None)`,
|
|
703
|
+
[TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH]: `Metaplex metadata account address does not match expected PDA`,
|
|
704
|
+
[TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH]: `Wrapped mint authority does not match expected PDA`,
|
|
705
|
+
[TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022]: `Instruction can only be used with spl-token wrapped mints`,
|
|
706
|
+
[TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA]: `Unwrapped mint does not have the TokenMetadata extension`,
|
|
707
|
+
[TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH]: `Wrapped mint account address does not match expected PDA`,
|
|
708
|
+
[TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT]: `Wrap amount should be positive`
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
function getTokenWrapErrorMessage(code) {
|
|
712
|
+
if (process.env.NODE_ENV !== "production") {
|
|
713
|
+
return tokenWrapErrorMessages[code];
|
|
714
|
+
}
|
|
715
|
+
return "Error message not available in production bundles.";
|
|
716
|
+
}
|
|
717
|
+
function isTokenWrapError(error, transactionMessage, code) {
|
|
718
|
+
return isProgramError(error, transactionMessage, TOKEN_WRAP_PROGRAM_ADDRESS, code);
|
|
719
|
+
}
|
|
793
720
|
var DEFAULT_EXTENSIONS = [
|
|
794
721
|
extension("ConfidentialTransferMint", {
|
|
795
722
|
autoApproveNewAccounts: true,
|
|
@@ -962,6 +889,8 @@ function combinedMultisigTx({
|
|
|
962
889
|
assertIsSendableTransaction(tx);
|
|
963
890
|
return tx;
|
|
964
891
|
}
|
|
892
|
+
|
|
893
|
+
// src/wrap.ts
|
|
965
894
|
async function multisigOfflineSignWrap(args) {
|
|
966
895
|
const wrapIx = await buildWrapIx(args);
|
|
967
896
|
return pipe(
|
|
@@ -1201,6 +1130,6 @@ async function multisigOfflineSignUnwrap(args) {
|
|
|
1201
1130
|
);
|
|
1202
1131
|
}
|
|
1203
1132
|
|
|
1204
|
-
export { CLOSE_STUCK_ESCROW_DISCRIMINATOR, CREATE_MINT_DISCRIMINATOR, SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR, SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR, TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH, TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE, TOKEN_WRAP_ERROR__ESCROW_MISMATCH, TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH, TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA, TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER, TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER, TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH, TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING, TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET, TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH, TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH, TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022, TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA, TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH, TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT, TOKEN_WRAP_PROGRAM_ADDRESS, TokenWrapAccount, TokenWrapInstruction, UNWRAP_DISCRIMINATOR, WRAP_DISCRIMINATOR, combinedMultisigTx, createEscrowAccount, createMint, decodeBackpointer, fetchAllBackpointer, fetchAllMaybeBackpointer, fetchBackpointer, fetchBackpointerFromSeeds, fetchMaybeBackpointer, fetchMaybeBackpointerFromSeeds, findBackpointerPda, findWrappedMintAuthorityPda, findWrappedMintPda, getBackpointerCodec, getBackpointerDecoder, getBackpointerEncoder, getBackpointerSize, getCloseStuckEscrowDiscriminatorBytes, getCloseStuckEscrowInstruction, getCloseStuckEscrowInstructionDataCodec, getCloseStuckEscrowInstructionDataDecoder, getCloseStuckEscrowInstructionDataEncoder, getCreateMintDiscriminatorBytes, getCreateMintInstruction, getCreateMintInstructionDataCodec, getCreateMintInstructionDataDecoder, getCreateMintInstructionDataEncoder, getSyncMetadataToSplTokenDiscriminatorBytes, getSyncMetadataToSplTokenInstruction, getSyncMetadataToSplTokenInstructionDataCodec, getSyncMetadataToSplTokenInstructionDataDecoder, getSyncMetadataToSplTokenInstructionDataEncoder, getSyncMetadataToToken2022DiscriminatorBytes, getSyncMetadataToToken2022Instruction, getSyncMetadataToToken2022InstructionDataCodec, getSyncMetadataToToken2022InstructionDataDecoder, getSyncMetadataToToken2022InstructionDataEncoder, getTokenWrapErrorMessage, getUnwrapDiscriminatorBytes, getUnwrapInstruction, getUnwrapInstructionDataCodec, getUnwrapInstructionDataDecoder, getUnwrapInstructionDataEncoder, getWrapDiscriminatorBytes, getWrapInstruction, getWrapInstructionDataCodec, getWrapInstructionDataDecoder, getWrapInstructionDataEncoder, identifyTokenWrapInstruction, isTokenWrapError, multisigOfflineSignUnwrap, multisigOfflineSignWrap, parseCloseStuckEscrowInstruction, parseCreateMintInstruction, parseSyncMetadataToSplTokenInstruction, parseSyncMetadataToToken2022Instruction, parseUnwrapInstruction, parseWrapInstruction, singleSignerUnwrap, singleSignerWrap };
|
|
1133
|
+
export { CLOSE_STUCK_ESCROW_DISCRIMINATOR, CREATE_MINT_DISCRIMINATOR, SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR, SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR, TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH, TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE, TOKEN_WRAP_ERROR__ESCROW_MISMATCH, TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH, TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA, TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER, TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER, TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH, TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING, TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET, TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH, TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH, TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022, TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA, TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH, TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT, TOKEN_WRAP_PROGRAM_ADDRESS, TokenWrapAccount, TokenWrapInstruction, UNWRAP_DISCRIMINATOR, WRAP_DISCRIMINATOR, combinedMultisigTx, createEscrowAccount, createMint, decodeBackpointer, fetchAllBackpointer, fetchAllMaybeBackpointer, fetchBackpointer, fetchBackpointerFromSeeds, fetchMaybeBackpointer, fetchMaybeBackpointerFromSeeds, findBackpointerPda, findWrappedMintAuthorityPda, findWrappedMintPda, getBackpointerCodec, getBackpointerDecoder, getBackpointerEncoder, getBackpointerSize, getCloseStuckEscrowDiscriminatorBytes, getCloseStuckEscrowInstruction, getCloseStuckEscrowInstructionDataCodec, getCloseStuckEscrowInstructionDataDecoder, getCloseStuckEscrowInstructionDataEncoder, getCreateMintDiscriminatorBytes, getCreateMintInstruction, getCreateMintInstructionDataCodec, getCreateMintInstructionDataDecoder, getCreateMintInstructionDataEncoder, getSyncMetadataToSplTokenDiscriminatorBytes, getSyncMetadataToSplTokenInstruction, getSyncMetadataToSplTokenInstructionDataCodec, getSyncMetadataToSplTokenInstructionDataDecoder, getSyncMetadataToSplTokenInstructionDataEncoder, getSyncMetadataToToken2022DiscriminatorBytes, getSyncMetadataToToken2022Instruction, getSyncMetadataToToken2022InstructionDataCodec, getSyncMetadataToToken2022InstructionDataDecoder, getSyncMetadataToToken2022InstructionDataEncoder, getTokenWrapErrorMessage, getUnwrapDiscriminatorBytes, getUnwrapInstruction, getUnwrapInstructionDataCodec, getUnwrapInstructionDataDecoder, getUnwrapInstructionDataEncoder, getWrapDiscriminatorBytes, getWrapInstruction, getWrapInstructionDataCodec, getWrapInstructionDataDecoder, getWrapInstructionDataEncoder, identifyTokenWrapInstruction, isTokenWrapError, multisigOfflineSignUnwrap, multisigOfflineSignWrap, parseCloseStuckEscrowInstruction, parseCreateMintInstruction, parseSyncMetadataToSplTokenInstruction, parseSyncMetadataToToken2022Instruction, parseTokenWrapInstruction, parseUnwrapInstruction, parseWrapInstruction, singleSignerUnwrap, singleSignerWrap };
|
|
1205
1134
|
//# sourceMappingURL=index.mjs.map
|
|
1206
1135
|
//# sourceMappingURL=index.mjs.map
|