@solana-program/system 0.1.1 → 0.1.2
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.mjs → index.cjs} +312 -200
- package/dist/src/index.js +199 -311
- package/package.json +2 -1
- /package/dist/src/{index.mjs.map → index.cjs.map} +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var accounts = require('@solana/accounts');
|
|
4
|
+
var addresses = require('@solana/addresses');
|
|
5
|
+
var codecs = require('@solana/codecs');
|
|
6
|
+
var instructions = require('@solana/instructions');
|
|
7
|
+
var signers = require('@solana/signers');
|
|
6
8
|
|
|
7
9
|
// env-shim.ts
|
|
8
10
|
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
@@ -12,13 +14,13 @@ var NonceState = /* @__PURE__ */ ((NonceState3) => {
|
|
|
12
14
|
return NonceState3;
|
|
13
15
|
})(NonceState || {});
|
|
14
16
|
function getNonceStateEncoder() {
|
|
15
|
-
return getScalarEnumEncoder(NonceState, { size: getU32Encoder() });
|
|
17
|
+
return codecs.getScalarEnumEncoder(NonceState, { size: codecs.getU32Encoder() });
|
|
16
18
|
}
|
|
17
19
|
function getNonceStateDecoder() {
|
|
18
|
-
return getScalarEnumDecoder(NonceState, { size: getU32Decoder() });
|
|
20
|
+
return codecs.getScalarEnumDecoder(NonceState, { size: codecs.getU32Decoder() });
|
|
19
21
|
}
|
|
20
22
|
function getNonceStateCodec() {
|
|
21
|
-
return combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
|
|
23
|
+
return codecs.combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
|
|
22
24
|
}
|
|
23
25
|
var NonceVersion = /* @__PURE__ */ ((NonceVersion3) => {
|
|
24
26
|
NonceVersion3[NonceVersion3["Legacy"] = 0] = "Legacy";
|
|
@@ -26,62 +28,62 @@ var NonceVersion = /* @__PURE__ */ ((NonceVersion3) => {
|
|
|
26
28
|
return NonceVersion3;
|
|
27
29
|
})(NonceVersion || {});
|
|
28
30
|
function getNonceVersionEncoder() {
|
|
29
|
-
return getScalarEnumEncoder(NonceVersion, { size: getU32Encoder() });
|
|
31
|
+
return codecs.getScalarEnumEncoder(NonceVersion, { size: codecs.getU32Encoder() });
|
|
30
32
|
}
|
|
31
33
|
function getNonceVersionDecoder() {
|
|
32
|
-
return getScalarEnumDecoder(NonceVersion, { size: getU32Decoder() });
|
|
34
|
+
return codecs.getScalarEnumDecoder(NonceVersion, { size: codecs.getU32Decoder() });
|
|
33
35
|
}
|
|
34
36
|
function getNonceVersionCodec() {
|
|
35
|
-
return combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
|
|
37
|
+
return codecs.combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// src/generated/accounts/nonce.ts
|
|
39
41
|
function getNonceAccountDataEncoder() {
|
|
40
|
-
return getStructEncoder([
|
|
42
|
+
return codecs.getStructEncoder([
|
|
41
43
|
["version", getNonceVersionEncoder()],
|
|
42
44
|
["state", getNonceStateEncoder()],
|
|
43
|
-
["authority", getAddressEncoder()],
|
|
44
|
-
["blockhash", getAddressEncoder()],
|
|
45
|
-
["lamportsPerSignature", getU64Encoder()]
|
|
45
|
+
["authority", addresses.getAddressEncoder()],
|
|
46
|
+
["blockhash", addresses.getAddressEncoder()],
|
|
47
|
+
["lamportsPerSignature", codecs.getU64Encoder()]
|
|
46
48
|
]);
|
|
47
49
|
}
|
|
48
50
|
function getNonceAccountDataDecoder() {
|
|
49
|
-
return getStructDecoder([
|
|
51
|
+
return codecs.getStructDecoder([
|
|
50
52
|
["version", getNonceVersionDecoder()],
|
|
51
53
|
["state", getNonceStateDecoder()],
|
|
52
|
-
["authority", getAddressDecoder()],
|
|
53
|
-
["blockhash", getAddressDecoder()],
|
|
54
|
-
["lamportsPerSignature", getU64Decoder()]
|
|
54
|
+
["authority", addresses.getAddressDecoder()],
|
|
55
|
+
["blockhash", addresses.getAddressDecoder()],
|
|
56
|
+
["lamportsPerSignature", codecs.getU64Decoder()]
|
|
55
57
|
]);
|
|
56
58
|
}
|
|
57
59
|
function getNonceAccountDataCodec() {
|
|
58
|
-
return combineCodec(
|
|
60
|
+
return codecs.combineCodec(
|
|
59
61
|
getNonceAccountDataEncoder(),
|
|
60
62
|
getNonceAccountDataDecoder()
|
|
61
63
|
);
|
|
62
64
|
}
|
|
63
65
|
function decodeNonce(encodedAccount) {
|
|
64
|
-
return decodeAccount(
|
|
66
|
+
return accounts.decodeAccount(
|
|
65
67
|
encodedAccount,
|
|
66
68
|
getNonceAccountDataDecoder()
|
|
67
69
|
);
|
|
68
70
|
}
|
|
69
71
|
async function fetchNonce(rpc, address, config) {
|
|
70
72
|
const maybeAccount = await fetchMaybeNonce(rpc, address, config);
|
|
71
|
-
assertAccountExists(maybeAccount);
|
|
73
|
+
accounts.assertAccountExists(maybeAccount);
|
|
72
74
|
return maybeAccount;
|
|
73
75
|
}
|
|
74
76
|
async function fetchMaybeNonce(rpc, address, config) {
|
|
75
|
-
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
77
|
+
const maybeAccount = await accounts.fetchEncodedAccount(rpc, address, config);
|
|
76
78
|
return decodeNonce(maybeAccount);
|
|
77
79
|
}
|
|
78
80
|
async function fetchAllNonce(rpc, addresses, config) {
|
|
79
81
|
const maybeAccounts = await fetchAllMaybeNonce(rpc, addresses, config);
|
|
80
|
-
assertAccountsExist(maybeAccounts);
|
|
82
|
+
accounts.assertAccountsExist(maybeAccounts);
|
|
81
83
|
return maybeAccounts;
|
|
82
84
|
}
|
|
83
85
|
async function fetchAllMaybeNonce(rpc, addresses, config) {
|
|
84
|
-
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
86
|
+
const maybeAccounts = await accounts.fetchEncodedAccounts(rpc, addresses, config);
|
|
85
87
|
return maybeAccounts.map((maybeAccount) => decodeNonce(maybeAccount));
|
|
86
88
|
}
|
|
87
89
|
function getNonceSize() {
|
|
@@ -186,7 +188,7 @@ function expectAddress(value) {
|
|
|
186
188
|
return value;
|
|
187
189
|
}
|
|
188
190
|
function expectProgramDerivedAddress(value) {
|
|
189
|
-
if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {
|
|
191
|
+
if (!value || !Array.isArray(value) || !addresses.isProgramDerivedAddress(value)) {
|
|
190
192
|
throw new Error("Expected a ProgramDerivedAddress.");
|
|
191
193
|
}
|
|
192
194
|
return value;
|
|
@@ -211,21 +213,21 @@ function getAccountMetasWithSigners(accounts, optionalAccountStrategy, programAd
|
|
|
211
213
|
return;
|
|
212
214
|
accountMetas[key] = {
|
|
213
215
|
address: programAddress,
|
|
214
|
-
role: AccountRole.READONLY
|
|
216
|
+
role: instructions.AccountRole.READONLY
|
|
215
217
|
};
|
|
216
218
|
return;
|
|
217
219
|
}
|
|
218
|
-
const writableRole = account.isWritable ? AccountRole.WRITABLE : AccountRole.READONLY;
|
|
220
|
+
const writableRole = account.isWritable ? instructions.AccountRole.WRITABLE : instructions.AccountRole.READONLY;
|
|
219
221
|
accountMetas[key] = Object.freeze({
|
|
220
222
|
address: expectAddress(account.value),
|
|
221
|
-
role: isTransactionSigner(account.value) ? upgradeRoleToSigner(writableRole) : writableRole,
|
|
223
|
+
role: isTransactionSigner(account.value) ? instructions.upgradeRoleToSigner(writableRole) : writableRole,
|
|
222
224
|
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
223
225
|
});
|
|
224
226
|
});
|
|
225
227
|
return accountMetas;
|
|
226
228
|
}
|
|
227
229
|
function isTransactionSigner(value) {
|
|
228
|
-
return !!value && typeof value === "object" && "address" in value && isTransactionSigner
|
|
230
|
+
return !!value && typeof value === "object" && "address" in value && signers.isTransactionSigner(value);
|
|
229
231
|
}
|
|
230
232
|
function memcmp(data, bytes, offset) {
|
|
231
233
|
const slice = data.slice(offset, offset + bytes.length);
|
|
@@ -236,16 +238,16 @@ function memcmp(data, bytes, offset) {
|
|
|
236
238
|
|
|
237
239
|
// src/generated/instructions/advanceNonceAccount.ts
|
|
238
240
|
function getAdvanceNonceAccountInstructionDataEncoder() {
|
|
239
|
-
return mapEncoder(
|
|
240
|
-
getStructEncoder([["discriminator", getU32Encoder()]]),
|
|
241
|
+
return codecs.mapEncoder(
|
|
242
|
+
codecs.getStructEncoder([["discriminator", codecs.getU32Encoder()]]),
|
|
241
243
|
(value) => ({ ...value, discriminator: 4 })
|
|
242
244
|
);
|
|
243
245
|
}
|
|
244
246
|
function getAdvanceNonceAccountInstructionDataDecoder() {
|
|
245
|
-
return getStructDecoder([["discriminator", getU32Decoder()]]);
|
|
247
|
+
return codecs.getStructDecoder([["discriminator", codecs.getU32Decoder()]]);
|
|
246
248
|
}
|
|
247
249
|
function getAdvanceNonceAccountInstructionDataCodec() {
|
|
248
|
-
return combineCodec(
|
|
250
|
+
return codecs.combineCodec(
|
|
249
251
|
getAdvanceNonceAccountInstructionDataEncoder(),
|
|
250
252
|
getAdvanceNonceAccountInstructionDataDecoder()
|
|
251
253
|
);
|
|
@@ -277,14 +279,14 @@ function getAdvanceNonceAccountInstruction(input) {
|
|
|
277
279
|
function getAdvanceNonceAccountInstructionRaw(accounts, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
278
280
|
return {
|
|
279
281
|
accounts: [
|
|
280
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
282
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
281
283
|
accountMetaWithDefault(
|
|
282
284
|
accounts.recentBlockhashesSysvar ?? "SysvarRecentB1ockHashes11111111111111111111",
|
|
283
|
-
AccountRole.READONLY
|
|
285
|
+
instructions.AccountRole.READONLY
|
|
284
286
|
),
|
|
285
287
|
accountMetaWithDefault(
|
|
286
288
|
accounts.nonceAuthority,
|
|
287
|
-
AccountRole.READONLY_SIGNER
|
|
289
|
+
instructions.AccountRole.READONLY_SIGNER
|
|
288
290
|
),
|
|
289
291
|
...remainingAccounts ?? []
|
|
290
292
|
],
|
|
@@ -315,22 +317,22 @@ function parseAdvanceNonceAccountInstruction(instruction) {
|
|
|
315
317
|
};
|
|
316
318
|
}
|
|
317
319
|
function getAllocateInstructionDataEncoder() {
|
|
318
|
-
return mapEncoder(
|
|
319
|
-
getStructEncoder([
|
|
320
|
-
["discriminator", getU32Encoder()],
|
|
321
|
-
["space", getU64Encoder()]
|
|
320
|
+
return codecs.mapEncoder(
|
|
321
|
+
codecs.getStructEncoder([
|
|
322
|
+
["discriminator", codecs.getU32Encoder()],
|
|
323
|
+
["space", codecs.getU64Encoder()]
|
|
322
324
|
]),
|
|
323
325
|
(value) => ({ ...value, discriminator: 8 })
|
|
324
326
|
);
|
|
325
327
|
}
|
|
326
328
|
function getAllocateInstructionDataDecoder() {
|
|
327
|
-
return getStructDecoder([
|
|
328
|
-
["discriminator", getU32Decoder()],
|
|
329
|
-
["space", getU64Decoder()]
|
|
329
|
+
return codecs.getStructDecoder([
|
|
330
|
+
["discriminator", codecs.getU32Decoder()],
|
|
331
|
+
["space", codecs.getU64Decoder()]
|
|
330
332
|
]);
|
|
331
333
|
}
|
|
332
334
|
function getAllocateInstructionDataCodec() {
|
|
333
|
-
return combineCodec(
|
|
335
|
+
return codecs.combineCodec(
|
|
334
336
|
getAllocateInstructionDataEncoder(),
|
|
335
337
|
getAllocateInstructionDataDecoder()
|
|
336
338
|
);
|
|
@@ -356,7 +358,7 @@ function getAllocateInstruction(input) {
|
|
|
356
358
|
function getAllocateInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
357
359
|
return {
|
|
358
360
|
accounts: [
|
|
359
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE_SIGNER),
|
|
361
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE_SIGNER),
|
|
360
362
|
...remainingAccounts ?? []
|
|
361
363
|
],
|
|
362
364
|
data: getAllocateInstructionDataEncoder().encode(args),
|
|
@@ -382,28 +384,28 @@ function parseAllocateInstruction(instruction) {
|
|
|
382
384
|
};
|
|
383
385
|
}
|
|
384
386
|
function getAllocateWithSeedInstructionDataEncoder() {
|
|
385
|
-
return mapEncoder(
|
|
386
|
-
getStructEncoder([
|
|
387
|
-
["discriminator", getU32Encoder()],
|
|
388
|
-
["base", getAddressEncoder()],
|
|
389
|
-
["seed", getStringEncoder()],
|
|
390
|
-
["space", getU64Encoder()],
|
|
391
|
-
["programAddress", getAddressEncoder()]
|
|
387
|
+
return codecs.mapEncoder(
|
|
388
|
+
codecs.getStructEncoder([
|
|
389
|
+
["discriminator", codecs.getU32Encoder()],
|
|
390
|
+
["base", addresses.getAddressEncoder()],
|
|
391
|
+
["seed", codecs.getStringEncoder()],
|
|
392
|
+
["space", codecs.getU64Encoder()],
|
|
393
|
+
["programAddress", addresses.getAddressEncoder()]
|
|
392
394
|
]),
|
|
393
395
|
(value) => ({ ...value, discriminator: 9 })
|
|
394
396
|
);
|
|
395
397
|
}
|
|
396
398
|
function getAllocateWithSeedInstructionDataDecoder() {
|
|
397
|
-
return getStructDecoder([
|
|
398
|
-
["discriminator", getU32Decoder()],
|
|
399
|
-
["base", getAddressDecoder()],
|
|
400
|
-
["seed", getStringDecoder()],
|
|
401
|
-
["space", getU64Decoder()],
|
|
402
|
-
["programAddress", getAddressDecoder()]
|
|
399
|
+
return codecs.getStructDecoder([
|
|
400
|
+
["discriminator", codecs.getU32Decoder()],
|
|
401
|
+
["base", addresses.getAddressDecoder()],
|
|
402
|
+
["seed", codecs.getStringDecoder()],
|
|
403
|
+
["space", codecs.getU64Decoder()],
|
|
404
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
403
405
|
]);
|
|
404
406
|
}
|
|
405
407
|
function getAllocateWithSeedInstructionDataCodec() {
|
|
406
|
-
return combineCodec(
|
|
408
|
+
return codecs.combineCodec(
|
|
407
409
|
getAllocateWithSeedInstructionDataEncoder(),
|
|
408
410
|
getAllocateWithSeedInstructionDataDecoder()
|
|
409
411
|
);
|
|
@@ -430,8 +432,8 @@ function getAllocateWithSeedInstruction(input) {
|
|
|
430
432
|
function getAllocateWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
431
433
|
return {
|
|
432
434
|
accounts: [
|
|
433
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE),
|
|
434
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
435
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE),
|
|
436
|
+
accountMetaWithDefault(accounts.baseAccount, instructions.AccountRole.READONLY_SIGNER),
|
|
435
437
|
...remainingAccounts ?? []
|
|
436
438
|
],
|
|
437
439
|
data: getAllocateWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -458,22 +460,22 @@ function parseAllocateWithSeedInstruction(instruction) {
|
|
|
458
460
|
};
|
|
459
461
|
}
|
|
460
462
|
function getAssignInstructionDataEncoder() {
|
|
461
|
-
return mapEncoder(
|
|
462
|
-
getStructEncoder([
|
|
463
|
-
["discriminator", getU32Encoder()],
|
|
464
|
-
["programAddress", getAddressEncoder()]
|
|
463
|
+
return codecs.mapEncoder(
|
|
464
|
+
codecs.getStructEncoder([
|
|
465
|
+
["discriminator", codecs.getU32Encoder()],
|
|
466
|
+
["programAddress", addresses.getAddressEncoder()]
|
|
465
467
|
]),
|
|
466
468
|
(value) => ({ ...value, discriminator: 1 })
|
|
467
469
|
);
|
|
468
470
|
}
|
|
469
471
|
function getAssignInstructionDataDecoder() {
|
|
470
|
-
return getStructDecoder([
|
|
471
|
-
["discriminator", getU32Decoder()],
|
|
472
|
-
["programAddress", getAddressDecoder()]
|
|
472
|
+
return codecs.getStructDecoder([
|
|
473
|
+
["discriminator", codecs.getU32Decoder()],
|
|
474
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
473
475
|
]);
|
|
474
476
|
}
|
|
475
477
|
function getAssignInstructionDataCodec() {
|
|
476
|
-
return combineCodec(
|
|
478
|
+
return codecs.combineCodec(
|
|
477
479
|
getAssignInstructionDataEncoder(),
|
|
478
480
|
getAssignInstructionDataDecoder()
|
|
479
481
|
);
|
|
@@ -499,7 +501,7 @@ function getAssignInstruction(input) {
|
|
|
499
501
|
function getAssignInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
500
502
|
return {
|
|
501
503
|
accounts: [
|
|
502
|
-
accountMetaWithDefault(accounts.account, AccountRole.WRITABLE_SIGNER),
|
|
504
|
+
accountMetaWithDefault(accounts.account, instructions.AccountRole.WRITABLE_SIGNER),
|
|
503
505
|
...remainingAccounts ?? []
|
|
504
506
|
],
|
|
505
507
|
data: getAssignInstructionDataEncoder().encode(args),
|
|
@@ -525,26 +527,26 @@ function parseAssignInstruction(instruction) {
|
|
|
525
527
|
};
|
|
526
528
|
}
|
|
527
529
|
function getAssignWithSeedInstructionDataEncoder() {
|
|
528
|
-
return mapEncoder(
|
|
529
|
-
getStructEncoder([
|
|
530
|
-
["discriminator", getU32Encoder()],
|
|
531
|
-
["base", getAddressEncoder()],
|
|
532
|
-
["seed", getStringEncoder()],
|
|
533
|
-
["programAddress", getAddressEncoder()]
|
|
530
|
+
return codecs.mapEncoder(
|
|
531
|
+
codecs.getStructEncoder([
|
|
532
|
+
["discriminator", codecs.getU32Encoder()],
|
|
533
|
+
["base", addresses.getAddressEncoder()],
|
|
534
|
+
["seed", codecs.getStringEncoder()],
|
|
535
|
+
["programAddress", addresses.getAddressEncoder()]
|
|
534
536
|
]),
|
|
535
537
|
(value) => ({ ...value, discriminator: 10 })
|
|
536
538
|
);
|
|
537
539
|
}
|
|
538
540
|
function getAssignWithSeedInstructionDataDecoder() {
|
|
539
|
-
return getStructDecoder([
|
|
540
|
-
["discriminator", getU32Decoder()],
|
|
541
|
-
["base", getAddressDecoder()],
|
|
542
|
-
["seed", getStringDecoder()],
|
|
543
|
-
["programAddress", getAddressDecoder()]
|
|
541
|
+
return codecs.getStructDecoder([
|
|
542
|
+
["discriminator", codecs.getU32Decoder()],
|
|
543
|
+
["base", addresses.getAddressDecoder()],
|
|
544
|
+
["seed", codecs.getStringDecoder()],
|
|
545
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
544
546
|
]);
|
|
545
547
|
}
|
|
546
548
|
function getAssignWithSeedInstructionDataCodec() {
|
|
547
|
-
return combineCodec(
|
|
549
|
+
return codecs.combineCodec(
|
|
548
550
|
getAssignWithSeedInstructionDataEncoder(),
|
|
549
551
|
getAssignWithSeedInstructionDataDecoder()
|
|
550
552
|
);
|
|
@@ -571,8 +573,8 @@ function getAssignWithSeedInstruction(input) {
|
|
|
571
573
|
function getAssignWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
572
574
|
return {
|
|
573
575
|
accounts: [
|
|
574
|
-
accountMetaWithDefault(accounts.account, AccountRole.WRITABLE),
|
|
575
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
576
|
+
accountMetaWithDefault(accounts.account, instructions.AccountRole.WRITABLE),
|
|
577
|
+
accountMetaWithDefault(accounts.baseAccount, instructions.AccountRole.READONLY_SIGNER),
|
|
576
578
|
...remainingAccounts ?? []
|
|
577
579
|
],
|
|
578
580
|
data: getAssignWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -599,22 +601,22 @@ function parseAssignWithSeedInstruction(instruction) {
|
|
|
599
601
|
};
|
|
600
602
|
}
|
|
601
603
|
function getAuthorizeNonceAccountInstructionDataEncoder() {
|
|
602
|
-
return mapEncoder(
|
|
603
|
-
getStructEncoder([
|
|
604
|
-
["discriminator", getU32Encoder()],
|
|
605
|
-
["newNonceAuthority", getAddressEncoder()]
|
|
604
|
+
return codecs.mapEncoder(
|
|
605
|
+
codecs.getStructEncoder([
|
|
606
|
+
["discriminator", codecs.getU32Encoder()],
|
|
607
|
+
["newNonceAuthority", addresses.getAddressEncoder()]
|
|
606
608
|
]),
|
|
607
609
|
(value) => ({ ...value, discriminator: 7 })
|
|
608
610
|
);
|
|
609
611
|
}
|
|
610
612
|
function getAuthorizeNonceAccountInstructionDataDecoder() {
|
|
611
|
-
return getStructDecoder([
|
|
612
|
-
["discriminator", getU32Decoder()],
|
|
613
|
-
["newNonceAuthority", getAddressDecoder()]
|
|
613
|
+
return codecs.getStructDecoder([
|
|
614
|
+
["discriminator", codecs.getU32Decoder()],
|
|
615
|
+
["newNonceAuthority", addresses.getAddressDecoder()]
|
|
614
616
|
]);
|
|
615
617
|
}
|
|
616
618
|
function getAuthorizeNonceAccountInstructionDataCodec() {
|
|
617
|
-
return combineCodec(
|
|
619
|
+
return codecs.combineCodec(
|
|
618
620
|
getAuthorizeNonceAccountInstructionDataEncoder(),
|
|
619
621
|
getAuthorizeNonceAccountInstructionDataDecoder()
|
|
620
622
|
);
|
|
@@ -641,10 +643,10 @@ function getAuthorizeNonceAccountInstruction(input) {
|
|
|
641
643
|
function getAuthorizeNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
642
644
|
return {
|
|
643
645
|
accounts: [
|
|
644
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
646
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
645
647
|
accountMetaWithDefault(
|
|
646
648
|
accounts.nonceAuthority,
|
|
647
|
-
AccountRole.READONLY_SIGNER
|
|
649
|
+
instructions.AccountRole.READONLY_SIGNER
|
|
648
650
|
),
|
|
649
651
|
...remainingAccounts ?? []
|
|
650
652
|
],
|
|
@@ -674,43 +676,43 @@ function parseAuthorizeNonceAccountInstruction(instruction) {
|
|
|
674
676
|
};
|
|
675
677
|
}
|
|
676
678
|
function getCreateAccountInstructionDataEncoder() {
|
|
677
|
-
return mapEncoder(
|
|
678
|
-
getStructEncoder([
|
|
679
|
-
["discriminator", getU32Encoder()],
|
|
680
|
-
["lamports", getU64Encoder()],
|
|
681
|
-
["space", getU64Encoder()],
|
|
682
|
-
["programAddress", getAddressEncoder()]
|
|
679
|
+
return codecs.mapEncoder(
|
|
680
|
+
codecs.getStructEncoder([
|
|
681
|
+
["discriminator", codecs.getU32Encoder()],
|
|
682
|
+
["lamports", codecs.getU64Encoder()],
|
|
683
|
+
["space", codecs.getU64Encoder()],
|
|
684
|
+
["programAddress", addresses.getAddressEncoder()]
|
|
683
685
|
]),
|
|
684
686
|
(value) => ({ ...value, discriminator: 0 })
|
|
685
687
|
);
|
|
686
688
|
}
|
|
687
689
|
function getCreateAccountInstructionDataDecoder() {
|
|
688
|
-
return getStructDecoder([
|
|
689
|
-
["discriminator", getU32Decoder()],
|
|
690
|
-
["lamports", getU64Decoder()],
|
|
691
|
-
["space", getU64Decoder()],
|
|
692
|
-
["programAddress", getAddressDecoder()]
|
|
690
|
+
return codecs.getStructDecoder([
|
|
691
|
+
["discriminator", codecs.getU32Decoder()],
|
|
692
|
+
["lamports", codecs.getU64Decoder()],
|
|
693
|
+
["space", codecs.getU64Decoder()],
|
|
694
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
693
695
|
]);
|
|
694
696
|
}
|
|
695
697
|
function getCreateAccountInstructionDataCodec() {
|
|
696
|
-
return combineCodec(
|
|
698
|
+
return codecs.combineCodec(
|
|
697
699
|
getCreateAccountInstructionDataEncoder(),
|
|
698
700
|
getCreateAccountInstructionDataDecoder()
|
|
699
701
|
);
|
|
700
702
|
}
|
|
701
703
|
function getCreateAccountInstruction(input) {
|
|
702
704
|
const programAddress = "11111111111111111111111111111111";
|
|
703
|
-
const accounts = {
|
|
705
|
+
const accounts$1 = {
|
|
704
706
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
705
707
|
newAccount: { value: input.newAccount ?? null, isWritable: true }
|
|
706
708
|
};
|
|
707
709
|
const args = { ...input };
|
|
708
|
-
const byteDelta = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce(
|
|
710
|
+
const byteDelta = [Number(args.space) + accounts.BASE_ACCOUNT_SIZE].reduce(
|
|
709
711
|
(a, b) => a + b,
|
|
710
712
|
0
|
|
711
713
|
);
|
|
712
714
|
const accountMetas = getAccountMetasWithSigners(
|
|
713
|
-
accounts,
|
|
715
|
+
accounts$1,
|
|
714
716
|
"programId",
|
|
715
717
|
programAddress
|
|
716
718
|
);
|
|
@@ -724,8 +726,8 @@ function getCreateAccountInstruction(input) {
|
|
|
724
726
|
function getCreateAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
725
727
|
return {
|
|
726
728
|
accounts: [
|
|
727
|
-
accountMetaWithDefault(accounts.payer, AccountRole.WRITABLE_SIGNER),
|
|
728
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE_SIGNER),
|
|
729
|
+
accountMetaWithDefault(accounts.payer, instructions.AccountRole.WRITABLE_SIGNER),
|
|
730
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE_SIGNER),
|
|
729
731
|
...remainingAccounts ?? []
|
|
730
732
|
],
|
|
731
733
|
data: getCreateAccountInstructionDataEncoder().encode(args),
|
|
@@ -752,30 +754,30 @@ function parseCreateAccountInstruction(instruction) {
|
|
|
752
754
|
};
|
|
753
755
|
}
|
|
754
756
|
function getCreateAccountWithSeedInstructionDataEncoder() {
|
|
755
|
-
return mapEncoder(
|
|
756
|
-
getStructEncoder([
|
|
757
|
-
["discriminator", getU32Encoder()],
|
|
758
|
-
["base", getAddressEncoder()],
|
|
759
|
-
["seed", getStringEncoder()],
|
|
760
|
-
["amount", getU64Encoder()],
|
|
761
|
-
["space", getU64Encoder()],
|
|
762
|
-
["programAddress", getAddressEncoder()]
|
|
757
|
+
return codecs.mapEncoder(
|
|
758
|
+
codecs.getStructEncoder([
|
|
759
|
+
["discriminator", codecs.getU32Encoder()],
|
|
760
|
+
["base", addresses.getAddressEncoder()],
|
|
761
|
+
["seed", codecs.getStringEncoder()],
|
|
762
|
+
["amount", codecs.getU64Encoder()],
|
|
763
|
+
["space", codecs.getU64Encoder()],
|
|
764
|
+
["programAddress", addresses.getAddressEncoder()]
|
|
763
765
|
]),
|
|
764
766
|
(value) => ({ ...value, discriminator: 3 })
|
|
765
767
|
);
|
|
766
768
|
}
|
|
767
769
|
function getCreateAccountWithSeedInstructionDataDecoder() {
|
|
768
|
-
return getStructDecoder([
|
|
769
|
-
["discriminator", getU32Decoder()],
|
|
770
|
-
["base", getAddressDecoder()],
|
|
771
|
-
["seed", getStringDecoder()],
|
|
772
|
-
["amount", getU64Decoder()],
|
|
773
|
-
["space", getU64Decoder()],
|
|
774
|
-
["programAddress", getAddressDecoder()]
|
|
770
|
+
return codecs.getStructDecoder([
|
|
771
|
+
["discriminator", codecs.getU32Decoder()],
|
|
772
|
+
["base", addresses.getAddressDecoder()],
|
|
773
|
+
["seed", codecs.getStringDecoder()],
|
|
774
|
+
["amount", codecs.getU64Decoder()],
|
|
775
|
+
["space", codecs.getU64Decoder()],
|
|
776
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
775
777
|
]);
|
|
776
778
|
}
|
|
777
779
|
function getCreateAccountWithSeedInstructionDataCodec() {
|
|
778
|
-
return combineCodec(
|
|
780
|
+
return codecs.combineCodec(
|
|
779
781
|
getCreateAccountWithSeedInstructionDataEncoder(),
|
|
780
782
|
getCreateAccountWithSeedInstructionDataDecoder()
|
|
781
783
|
);
|
|
@@ -803,9 +805,9 @@ function getCreateAccountWithSeedInstruction(input) {
|
|
|
803
805
|
function getCreateAccountWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
804
806
|
return {
|
|
805
807
|
accounts: [
|
|
806
|
-
accountMetaWithDefault(accounts.payer, AccountRole.WRITABLE_SIGNER),
|
|
807
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE),
|
|
808
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
808
|
+
accountMetaWithDefault(accounts.payer, instructions.AccountRole.WRITABLE_SIGNER),
|
|
809
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE),
|
|
810
|
+
accountMetaWithDefault(accounts.baseAccount, instructions.AccountRole.READONLY_SIGNER),
|
|
809
811
|
...remainingAccounts ?? []
|
|
810
812
|
],
|
|
811
813
|
data: getCreateAccountWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -835,22 +837,22 @@ function parseCreateAccountWithSeedInstruction(instruction) {
|
|
|
835
837
|
};
|
|
836
838
|
}
|
|
837
839
|
function getInitializeNonceAccountInstructionDataEncoder() {
|
|
838
|
-
return mapEncoder(
|
|
839
|
-
getStructEncoder([
|
|
840
|
-
["discriminator", getU32Encoder()],
|
|
841
|
-
["nonceAuthority", getAddressEncoder()]
|
|
840
|
+
return codecs.mapEncoder(
|
|
841
|
+
codecs.getStructEncoder([
|
|
842
|
+
["discriminator", codecs.getU32Encoder()],
|
|
843
|
+
["nonceAuthority", addresses.getAddressEncoder()]
|
|
842
844
|
]),
|
|
843
845
|
(value) => ({ ...value, discriminator: 6 })
|
|
844
846
|
);
|
|
845
847
|
}
|
|
846
848
|
function getInitializeNonceAccountInstructionDataDecoder() {
|
|
847
|
-
return getStructDecoder([
|
|
848
|
-
["discriminator", getU32Decoder()],
|
|
849
|
-
["nonceAuthority", getAddressDecoder()]
|
|
849
|
+
return codecs.getStructDecoder([
|
|
850
|
+
["discriminator", codecs.getU32Decoder()],
|
|
851
|
+
["nonceAuthority", addresses.getAddressDecoder()]
|
|
850
852
|
]);
|
|
851
853
|
}
|
|
852
854
|
function getInitializeNonceAccountInstructionDataCodec() {
|
|
853
|
-
return combineCodec(
|
|
855
|
+
return codecs.combineCodec(
|
|
854
856
|
getInitializeNonceAccountInstructionDataEncoder(),
|
|
855
857
|
getInitializeNonceAccountInstructionDataDecoder()
|
|
856
858
|
);
|
|
@@ -887,14 +889,14 @@ function getInitializeNonceAccountInstruction(input) {
|
|
|
887
889
|
function getInitializeNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
888
890
|
return {
|
|
889
891
|
accounts: [
|
|
890
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
892
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
891
893
|
accountMetaWithDefault(
|
|
892
894
|
accounts.recentBlockhashesSysvar ?? "SysvarRecentB1ockHashes11111111111111111111",
|
|
893
|
-
AccountRole.READONLY
|
|
895
|
+
instructions.AccountRole.READONLY
|
|
894
896
|
),
|
|
895
897
|
accountMetaWithDefault(
|
|
896
898
|
accounts.rentSysvar ?? "SysvarRent111111111111111111111111111111111",
|
|
897
|
-
AccountRole.READONLY
|
|
899
|
+
instructions.AccountRole.READONLY
|
|
898
900
|
),
|
|
899
901
|
...remainingAccounts ?? []
|
|
900
902
|
],
|
|
@@ -925,22 +927,22 @@ function parseInitializeNonceAccountInstruction(instruction) {
|
|
|
925
927
|
};
|
|
926
928
|
}
|
|
927
929
|
function getTransferSolInstructionDataEncoder() {
|
|
928
|
-
return mapEncoder(
|
|
929
|
-
getStructEncoder([
|
|
930
|
-
["discriminator", getU32Encoder()],
|
|
931
|
-
["amount", getU64Encoder()]
|
|
930
|
+
return codecs.mapEncoder(
|
|
931
|
+
codecs.getStructEncoder([
|
|
932
|
+
["discriminator", codecs.getU32Encoder()],
|
|
933
|
+
["amount", codecs.getU64Encoder()]
|
|
932
934
|
]),
|
|
933
935
|
(value) => ({ ...value, discriminator: 2 })
|
|
934
936
|
);
|
|
935
937
|
}
|
|
936
938
|
function getTransferSolInstructionDataDecoder() {
|
|
937
|
-
return getStructDecoder([
|
|
938
|
-
["discriminator", getU32Decoder()],
|
|
939
|
-
["amount", getU64Decoder()]
|
|
939
|
+
return codecs.getStructDecoder([
|
|
940
|
+
["discriminator", codecs.getU32Decoder()],
|
|
941
|
+
["amount", codecs.getU64Decoder()]
|
|
940
942
|
]);
|
|
941
943
|
}
|
|
942
944
|
function getTransferSolInstructionDataCodec() {
|
|
943
|
-
return combineCodec(
|
|
945
|
+
return codecs.combineCodec(
|
|
944
946
|
getTransferSolInstructionDataEncoder(),
|
|
945
947
|
getTransferSolInstructionDataDecoder()
|
|
946
948
|
);
|
|
@@ -967,8 +969,8 @@ function getTransferSolInstruction(input) {
|
|
|
967
969
|
function getTransferSolInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
968
970
|
return {
|
|
969
971
|
accounts: [
|
|
970
|
-
accountMetaWithDefault(accounts.source, AccountRole.WRITABLE_SIGNER),
|
|
971
|
-
accountMetaWithDefault(accounts.destination, AccountRole.WRITABLE),
|
|
972
|
+
accountMetaWithDefault(accounts.source, instructions.AccountRole.WRITABLE_SIGNER),
|
|
973
|
+
accountMetaWithDefault(accounts.destination, instructions.AccountRole.WRITABLE),
|
|
972
974
|
...remainingAccounts ?? []
|
|
973
975
|
],
|
|
974
976
|
data: getTransferSolInstructionDataEncoder().encode(args),
|
|
@@ -995,26 +997,26 @@ function parseTransferSolInstruction(instruction) {
|
|
|
995
997
|
};
|
|
996
998
|
}
|
|
997
999
|
function getTransferSolWithSeedInstructionDataEncoder() {
|
|
998
|
-
return mapEncoder(
|
|
999
|
-
getStructEncoder([
|
|
1000
|
-
["discriminator", getU32Encoder()],
|
|
1001
|
-
["amount", getU64Encoder()],
|
|
1002
|
-
["fromSeed", getStringEncoder()],
|
|
1003
|
-
["fromOwner", getAddressEncoder()]
|
|
1000
|
+
return codecs.mapEncoder(
|
|
1001
|
+
codecs.getStructEncoder([
|
|
1002
|
+
["discriminator", codecs.getU32Encoder()],
|
|
1003
|
+
["amount", codecs.getU64Encoder()],
|
|
1004
|
+
["fromSeed", codecs.getStringEncoder()],
|
|
1005
|
+
["fromOwner", addresses.getAddressEncoder()]
|
|
1004
1006
|
]),
|
|
1005
1007
|
(value) => ({ ...value, discriminator: 11 })
|
|
1006
1008
|
);
|
|
1007
1009
|
}
|
|
1008
1010
|
function getTransferSolWithSeedInstructionDataDecoder() {
|
|
1009
|
-
return getStructDecoder([
|
|
1010
|
-
["discriminator", getU32Decoder()],
|
|
1011
|
-
["amount", getU64Decoder()],
|
|
1012
|
-
["fromSeed", getStringDecoder()],
|
|
1013
|
-
["fromOwner", getAddressDecoder()]
|
|
1011
|
+
return codecs.getStructDecoder([
|
|
1012
|
+
["discriminator", codecs.getU32Decoder()],
|
|
1013
|
+
["amount", codecs.getU64Decoder()],
|
|
1014
|
+
["fromSeed", codecs.getStringDecoder()],
|
|
1015
|
+
["fromOwner", addresses.getAddressDecoder()]
|
|
1014
1016
|
]);
|
|
1015
1017
|
}
|
|
1016
1018
|
function getTransferSolWithSeedInstructionDataCodec() {
|
|
1017
|
-
return combineCodec(
|
|
1019
|
+
return codecs.combineCodec(
|
|
1018
1020
|
getTransferSolWithSeedInstructionDataEncoder(),
|
|
1019
1021
|
getTransferSolWithSeedInstructionDataDecoder()
|
|
1020
1022
|
);
|
|
@@ -1042,9 +1044,9 @@ function getTransferSolWithSeedInstruction(input) {
|
|
|
1042
1044
|
function getTransferSolWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1043
1045
|
return {
|
|
1044
1046
|
accounts: [
|
|
1045
|
-
accountMetaWithDefault(accounts.source, AccountRole.WRITABLE),
|
|
1046
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
1047
|
-
accountMetaWithDefault(accounts.destination, AccountRole.WRITABLE),
|
|
1047
|
+
accountMetaWithDefault(accounts.source, instructions.AccountRole.WRITABLE),
|
|
1048
|
+
accountMetaWithDefault(accounts.baseAccount, instructions.AccountRole.READONLY_SIGNER),
|
|
1049
|
+
accountMetaWithDefault(accounts.destination, instructions.AccountRole.WRITABLE),
|
|
1048
1050
|
...remainingAccounts ?? []
|
|
1049
1051
|
],
|
|
1050
1052
|
data: getTransferSolWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -1074,16 +1076,16 @@ function parseTransferSolWithSeedInstruction(instruction) {
|
|
|
1074
1076
|
};
|
|
1075
1077
|
}
|
|
1076
1078
|
function getUpgradeNonceAccountInstructionDataEncoder() {
|
|
1077
|
-
return mapEncoder(
|
|
1078
|
-
getStructEncoder([["discriminator", getU32Encoder()]]),
|
|
1079
|
+
return codecs.mapEncoder(
|
|
1080
|
+
codecs.getStructEncoder([["discriminator", codecs.getU32Encoder()]]),
|
|
1079
1081
|
(value) => ({ ...value, discriminator: 12 })
|
|
1080
1082
|
);
|
|
1081
1083
|
}
|
|
1082
1084
|
function getUpgradeNonceAccountInstructionDataDecoder() {
|
|
1083
|
-
return getStructDecoder([["discriminator", getU32Decoder()]]);
|
|
1085
|
+
return codecs.getStructDecoder([["discriminator", codecs.getU32Decoder()]]);
|
|
1084
1086
|
}
|
|
1085
1087
|
function getUpgradeNonceAccountInstructionDataCodec() {
|
|
1086
|
-
return combineCodec(
|
|
1088
|
+
return codecs.combineCodec(
|
|
1087
1089
|
getUpgradeNonceAccountInstructionDataEncoder(),
|
|
1088
1090
|
getUpgradeNonceAccountInstructionDataDecoder()
|
|
1089
1091
|
);
|
|
@@ -1107,7 +1109,7 @@ function getUpgradeNonceAccountInstruction(input) {
|
|
|
1107
1109
|
function getUpgradeNonceAccountInstructionRaw(accounts, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1108
1110
|
return {
|
|
1109
1111
|
accounts: [
|
|
1110
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
1112
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
1111
1113
|
...remainingAccounts ?? []
|
|
1112
1114
|
],
|
|
1113
1115
|
data: getUpgradeNonceAccountInstructionDataEncoder().encode({}),
|
|
@@ -1135,22 +1137,22 @@ function parseUpgradeNonceAccountInstruction(instruction) {
|
|
|
1135
1137
|
};
|
|
1136
1138
|
}
|
|
1137
1139
|
function getWithdrawNonceAccountInstructionDataEncoder() {
|
|
1138
|
-
return mapEncoder(
|
|
1139
|
-
getStructEncoder([
|
|
1140
|
-
["discriminator", getU32Encoder()],
|
|
1141
|
-
["withdrawAmount", getU64Encoder()]
|
|
1140
|
+
return codecs.mapEncoder(
|
|
1141
|
+
codecs.getStructEncoder([
|
|
1142
|
+
["discriminator", codecs.getU32Encoder()],
|
|
1143
|
+
["withdrawAmount", codecs.getU64Encoder()]
|
|
1142
1144
|
]),
|
|
1143
1145
|
(value) => ({ ...value, discriminator: 5 })
|
|
1144
1146
|
);
|
|
1145
1147
|
}
|
|
1146
1148
|
function getWithdrawNonceAccountInstructionDataDecoder() {
|
|
1147
|
-
return getStructDecoder([
|
|
1148
|
-
["discriminator", getU32Decoder()],
|
|
1149
|
-
["withdrawAmount", getU64Decoder()]
|
|
1149
|
+
return codecs.getStructDecoder([
|
|
1150
|
+
["discriminator", codecs.getU32Decoder()],
|
|
1151
|
+
["withdrawAmount", codecs.getU64Decoder()]
|
|
1150
1152
|
]);
|
|
1151
1153
|
}
|
|
1152
1154
|
function getWithdrawNonceAccountInstructionDataCodec() {
|
|
1153
|
-
return combineCodec(
|
|
1155
|
+
return codecs.combineCodec(
|
|
1154
1156
|
getWithdrawNonceAccountInstructionDataEncoder(),
|
|
1155
1157
|
getWithdrawNonceAccountInstructionDataDecoder()
|
|
1156
1158
|
);
|
|
@@ -1192,19 +1194,19 @@ function getWithdrawNonceAccountInstruction(input) {
|
|
|
1192
1194
|
function getWithdrawNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1193
1195
|
return {
|
|
1194
1196
|
accounts: [
|
|
1195
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
1196
|
-
accountMetaWithDefault(accounts.recipientAccount, AccountRole.WRITABLE),
|
|
1197
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
1198
|
+
accountMetaWithDefault(accounts.recipientAccount, instructions.AccountRole.WRITABLE),
|
|
1197
1199
|
accountMetaWithDefault(
|
|
1198
1200
|
accounts.recentBlockhashesSysvar ?? "SysvarRecentB1ockHashes11111111111111111111",
|
|
1199
|
-
AccountRole.READONLY
|
|
1201
|
+
instructions.AccountRole.READONLY
|
|
1200
1202
|
),
|
|
1201
1203
|
accountMetaWithDefault(
|
|
1202
1204
|
accounts.rentSysvar ?? "SysvarRent111111111111111111111111111111111",
|
|
1203
|
-
AccountRole.READONLY
|
|
1205
|
+
instructions.AccountRole.READONLY
|
|
1204
1206
|
),
|
|
1205
1207
|
accountMetaWithDefault(
|
|
1206
1208
|
accounts.nonceAuthority,
|
|
1207
|
-
AccountRole.READONLY_SIGNER
|
|
1209
|
+
instructions.AccountRole.READONLY_SIGNER
|
|
1208
1210
|
),
|
|
1209
1211
|
...remainingAccounts ?? []
|
|
1210
1212
|
],
|
|
@@ -1268,43 +1270,43 @@ var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
|
|
|
1268
1270
|
})(SystemInstruction || {});
|
|
1269
1271
|
function identifySystemInstruction(instruction) {
|
|
1270
1272
|
const data = instruction instanceof Uint8Array ? instruction : instruction.data;
|
|
1271
|
-
if (memcmp(data, getU32Encoder().encode(0), 0)) {
|
|
1273
|
+
if (memcmp(data, codecs.getU32Encoder().encode(0), 0)) {
|
|
1272
1274
|
return 0 /* CreateAccount */;
|
|
1273
1275
|
}
|
|
1274
|
-
if (memcmp(data, getU32Encoder().encode(1), 0)) {
|
|
1276
|
+
if (memcmp(data, codecs.getU32Encoder().encode(1), 0)) {
|
|
1275
1277
|
return 1 /* Assign */;
|
|
1276
1278
|
}
|
|
1277
|
-
if (memcmp(data, getU32Encoder().encode(2), 0)) {
|
|
1279
|
+
if (memcmp(data, codecs.getU32Encoder().encode(2), 0)) {
|
|
1278
1280
|
return 2 /* TransferSol */;
|
|
1279
1281
|
}
|
|
1280
|
-
if (memcmp(data, getU32Encoder().encode(3), 0)) {
|
|
1282
|
+
if (memcmp(data, codecs.getU32Encoder().encode(3), 0)) {
|
|
1281
1283
|
return 3 /* CreateAccountWithSeed */;
|
|
1282
1284
|
}
|
|
1283
|
-
if (memcmp(data, getU32Encoder().encode(4), 0)) {
|
|
1285
|
+
if (memcmp(data, codecs.getU32Encoder().encode(4), 0)) {
|
|
1284
1286
|
return 4 /* AdvanceNonceAccount */;
|
|
1285
1287
|
}
|
|
1286
|
-
if (memcmp(data, getU32Encoder().encode(5), 0)) {
|
|
1288
|
+
if (memcmp(data, codecs.getU32Encoder().encode(5), 0)) {
|
|
1287
1289
|
return 5 /* WithdrawNonceAccount */;
|
|
1288
1290
|
}
|
|
1289
|
-
if (memcmp(data, getU32Encoder().encode(6), 0)) {
|
|
1291
|
+
if (memcmp(data, codecs.getU32Encoder().encode(6), 0)) {
|
|
1290
1292
|
return 6 /* InitializeNonceAccount */;
|
|
1291
1293
|
}
|
|
1292
|
-
if (memcmp(data, getU32Encoder().encode(7), 0)) {
|
|
1294
|
+
if (memcmp(data, codecs.getU32Encoder().encode(7), 0)) {
|
|
1293
1295
|
return 7 /* AuthorizeNonceAccount */;
|
|
1294
1296
|
}
|
|
1295
|
-
if (memcmp(data, getU32Encoder().encode(8), 0)) {
|
|
1297
|
+
if (memcmp(data, codecs.getU32Encoder().encode(8), 0)) {
|
|
1296
1298
|
return 8 /* Allocate */;
|
|
1297
1299
|
}
|
|
1298
|
-
if (memcmp(data, getU32Encoder().encode(9), 0)) {
|
|
1300
|
+
if (memcmp(data, codecs.getU32Encoder().encode(9), 0)) {
|
|
1299
1301
|
return 9 /* AllocateWithSeed */;
|
|
1300
1302
|
}
|
|
1301
|
-
if (memcmp(data, getU32Encoder().encode(10), 0)) {
|
|
1303
|
+
if (memcmp(data, codecs.getU32Encoder().encode(10), 0)) {
|
|
1302
1304
|
return 10 /* AssignWithSeed */;
|
|
1303
1305
|
}
|
|
1304
|
-
if (memcmp(data, getU32Encoder().encode(11), 0)) {
|
|
1306
|
+
if (memcmp(data, codecs.getU32Encoder().encode(11), 0)) {
|
|
1305
1307
|
return 11 /* TransferSolWithSeed */;
|
|
1306
1308
|
}
|
|
1307
|
-
if (memcmp(data, getU32Encoder().encode(12), 0)) {
|
|
1309
|
+
if (memcmp(data, codecs.getU32Encoder().encode(12), 0)) {
|
|
1308
1310
|
return 12 /* UpgradeNonceAccount */;
|
|
1309
1311
|
}
|
|
1310
1312
|
throw new Error(
|
|
@@ -1312,6 +1314,116 @@ function identifySystemInstruction(instruction) {
|
|
|
1312
1314
|
);
|
|
1313
1315
|
}
|
|
1314
1316
|
|
|
1315
|
-
|
|
1317
|
+
exports.NonceState = NonceState;
|
|
1318
|
+
exports.NonceVersion = NonceVersion;
|
|
1319
|
+
exports.SYSTEM_PROGRAM_ADDRESS = SYSTEM_PROGRAM_ADDRESS;
|
|
1320
|
+
exports.SystemAccount = SystemAccount;
|
|
1321
|
+
exports.SystemInstruction = SystemInstruction;
|
|
1322
|
+
exports.SystemProgramError = SystemProgramError;
|
|
1323
|
+
exports.SystemProgramErrorCode = SystemProgramErrorCode;
|
|
1324
|
+
exports.accountMetaWithDefault = accountMetaWithDefault;
|
|
1325
|
+
exports.decodeNonce = decodeNonce;
|
|
1326
|
+
exports.expectAddress = expectAddress;
|
|
1327
|
+
exports.expectProgramDerivedAddress = expectProgramDerivedAddress;
|
|
1328
|
+
exports.expectSome = expectSome;
|
|
1329
|
+
exports.expectTransactionSigner = expectTransactionSigner;
|
|
1330
|
+
exports.fetchAllMaybeNonce = fetchAllMaybeNonce;
|
|
1331
|
+
exports.fetchAllNonce = fetchAllNonce;
|
|
1332
|
+
exports.fetchMaybeNonce = fetchMaybeNonce;
|
|
1333
|
+
exports.fetchNonce = fetchNonce;
|
|
1334
|
+
exports.getAccountMetasWithSigners = getAccountMetasWithSigners;
|
|
1335
|
+
exports.getAdvanceNonceAccountInstruction = getAdvanceNonceAccountInstruction;
|
|
1336
|
+
exports.getAdvanceNonceAccountInstructionDataCodec = getAdvanceNonceAccountInstructionDataCodec;
|
|
1337
|
+
exports.getAdvanceNonceAccountInstructionDataDecoder = getAdvanceNonceAccountInstructionDataDecoder;
|
|
1338
|
+
exports.getAdvanceNonceAccountInstructionDataEncoder = getAdvanceNonceAccountInstructionDataEncoder;
|
|
1339
|
+
exports.getAdvanceNonceAccountInstructionRaw = getAdvanceNonceAccountInstructionRaw;
|
|
1340
|
+
exports.getAllocateInstruction = getAllocateInstruction;
|
|
1341
|
+
exports.getAllocateInstructionDataCodec = getAllocateInstructionDataCodec;
|
|
1342
|
+
exports.getAllocateInstructionDataDecoder = getAllocateInstructionDataDecoder;
|
|
1343
|
+
exports.getAllocateInstructionDataEncoder = getAllocateInstructionDataEncoder;
|
|
1344
|
+
exports.getAllocateInstructionRaw = getAllocateInstructionRaw;
|
|
1345
|
+
exports.getAllocateWithSeedInstruction = getAllocateWithSeedInstruction;
|
|
1346
|
+
exports.getAllocateWithSeedInstructionDataCodec = getAllocateWithSeedInstructionDataCodec;
|
|
1347
|
+
exports.getAllocateWithSeedInstructionDataDecoder = getAllocateWithSeedInstructionDataDecoder;
|
|
1348
|
+
exports.getAllocateWithSeedInstructionDataEncoder = getAllocateWithSeedInstructionDataEncoder;
|
|
1349
|
+
exports.getAllocateWithSeedInstructionRaw = getAllocateWithSeedInstructionRaw;
|
|
1350
|
+
exports.getAssignInstruction = getAssignInstruction;
|
|
1351
|
+
exports.getAssignInstructionDataCodec = getAssignInstructionDataCodec;
|
|
1352
|
+
exports.getAssignInstructionDataDecoder = getAssignInstructionDataDecoder;
|
|
1353
|
+
exports.getAssignInstructionDataEncoder = getAssignInstructionDataEncoder;
|
|
1354
|
+
exports.getAssignInstructionRaw = getAssignInstructionRaw;
|
|
1355
|
+
exports.getAssignWithSeedInstruction = getAssignWithSeedInstruction;
|
|
1356
|
+
exports.getAssignWithSeedInstructionDataCodec = getAssignWithSeedInstructionDataCodec;
|
|
1357
|
+
exports.getAssignWithSeedInstructionDataDecoder = getAssignWithSeedInstructionDataDecoder;
|
|
1358
|
+
exports.getAssignWithSeedInstructionDataEncoder = getAssignWithSeedInstructionDataEncoder;
|
|
1359
|
+
exports.getAssignWithSeedInstructionRaw = getAssignWithSeedInstructionRaw;
|
|
1360
|
+
exports.getAuthorizeNonceAccountInstruction = getAuthorizeNonceAccountInstruction;
|
|
1361
|
+
exports.getAuthorizeNonceAccountInstructionDataCodec = getAuthorizeNonceAccountInstructionDataCodec;
|
|
1362
|
+
exports.getAuthorizeNonceAccountInstructionDataDecoder = getAuthorizeNonceAccountInstructionDataDecoder;
|
|
1363
|
+
exports.getAuthorizeNonceAccountInstructionDataEncoder = getAuthorizeNonceAccountInstructionDataEncoder;
|
|
1364
|
+
exports.getAuthorizeNonceAccountInstructionRaw = getAuthorizeNonceAccountInstructionRaw;
|
|
1365
|
+
exports.getCreateAccountInstruction = getCreateAccountInstruction;
|
|
1366
|
+
exports.getCreateAccountInstructionDataCodec = getCreateAccountInstructionDataCodec;
|
|
1367
|
+
exports.getCreateAccountInstructionDataDecoder = getCreateAccountInstructionDataDecoder;
|
|
1368
|
+
exports.getCreateAccountInstructionDataEncoder = getCreateAccountInstructionDataEncoder;
|
|
1369
|
+
exports.getCreateAccountInstructionRaw = getCreateAccountInstructionRaw;
|
|
1370
|
+
exports.getCreateAccountWithSeedInstruction = getCreateAccountWithSeedInstruction;
|
|
1371
|
+
exports.getCreateAccountWithSeedInstructionDataCodec = getCreateAccountWithSeedInstructionDataCodec;
|
|
1372
|
+
exports.getCreateAccountWithSeedInstructionDataDecoder = getCreateAccountWithSeedInstructionDataDecoder;
|
|
1373
|
+
exports.getCreateAccountWithSeedInstructionDataEncoder = getCreateAccountWithSeedInstructionDataEncoder;
|
|
1374
|
+
exports.getCreateAccountWithSeedInstructionRaw = getCreateAccountWithSeedInstructionRaw;
|
|
1375
|
+
exports.getInitializeNonceAccountInstruction = getInitializeNonceAccountInstruction;
|
|
1376
|
+
exports.getInitializeNonceAccountInstructionDataCodec = getInitializeNonceAccountInstructionDataCodec;
|
|
1377
|
+
exports.getInitializeNonceAccountInstructionDataDecoder = getInitializeNonceAccountInstructionDataDecoder;
|
|
1378
|
+
exports.getInitializeNonceAccountInstructionDataEncoder = getInitializeNonceAccountInstructionDataEncoder;
|
|
1379
|
+
exports.getInitializeNonceAccountInstructionRaw = getInitializeNonceAccountInstructionRaw;
|
|
1380
|
+
exports.getNonceAccountDataCodec = getNonceAccountDataCodec;
|
|
1381
|
+
exports.getNonceAccountDataDecoder = getNonceAccountDataDecoder;
|
|
1382
|
+
exports.getNonceAccountDataEncoder = getNonceAccountDataEncoder;
|
|
1383
|
+
exports.getNonceSize = getNonceSize;
|
|
1384
|
+
exports.getNonceStateCodec = getNonceStateCodec;
|
|
1385
|
+
exports.getNonceStateDecoder = getNonceStateDecoder;
|
|
1386
|
+
exports.getNonceStateEncoder = getNonceStateEncoder;
|
|
1387
|
+
exports.getNonceVersionCodec = getNonceVersionCodec;
|
|
1388
|
+
exports.getNonceVersionDecoder = getNonceVersionDecoder;
|
|
1389
|
+
exports.getNonceVersionEncoder = getNonceVersionEncoder;
|
|
1390
|
+
exports.getSystemProgram = getSystemProgram;
|
|
1391
|
+
exports.getSystemProgramErrorFromCode = getSystemProgramErrorFromCode;
|
|
1392
|
+
exports.getTransferSolInstruction = getTransferSolInstruction;
|
|
1393
|
+
exports.getTransferSolInstructionDataCodec = getTransferSolInstructionDataCodec;
|
|
1394
|
+
exports.getTransferSolInstructionDataDecoder = getTransferSolInstructionDataDecoder;
|
|
1395
|
+
exports.getTransferSolInstructionDataEncoder = getTransferSolInstructionDataEncoder;
|
|
1396
|
+
exports.getTransferSolInstructionRaw = getTransferSolInstructionRaw;
|
|
1397
|
+
exports.getTransferSolWithSeedInstruction = getTransferSolWithSeedInstruction;
|
|
1398
|
+
exports.getTransferSolWithSeedInstructionDataCodec = getTransferSolWithSeedInstructionDataCodec;
|
|
1399
|
+
exports.getTransferSolWithSeedInstructionDataDecoder = getTransferSolWithSeedInstructionDataDecoder;
|
|
1400
|
+
exports.getTransferSolWithSeedInstructionDataEncoder = getTransferSolWithSeedInstructionDataEncoder;
|
|
1401
|
+
exports.getTransferSolWithSeedInstructionRaw = getTransferSolWithSeedInstructionRaw;
|
|
1402
|
+
exports.getUpgradeNonceAccountInstruction = getUpgradeNonceAccountInstruction;
|
|
1403
|
+
exports.getUpgradeNonceAccountInstructionDataCodec = getUpgradeNonceAccountInstructionDataCodec;
|
|
1404
|
+
exports.getUpgradeNonceAccountInstructionDataDecoder = getUpgradeNonceAccountInstructionDataDecoder;
|
|
1405
|
+
exports.getUpgradeNonceAccountInstructionDataEncoder = getUpgradeNonceAccountInstructionDataEncoder;
|
|
1406
|
+
exports.getUpgradeNonceAccountInstructionRaw = getUpgradeNonceAccountInstructionRaw;
|
|
1407
|
+
exports.getWithdrawNonceAccountInstruction = getWithdrawNonceAccountInstruction;
|
|
1408
|
+
exports.getWithdrawNonceAccountInstructionDataCodec = getWithdrawNonceAccountInstructionDataCodec;
|
|
1409
|
+
exports.getWithdrawNonceAccountInstructionDataDecoder = getWithdrawNonceAccountInstructionDataDecoder;
|
|
1410
|
+
exports.getWithdrawNonceAccountInstructionDataEncoder = getWithdrawNonceAccountInstructionDataEncoder;
|
|
1411
|
+
exports.getWithdrawNonceAccountInstructionRaw = getWithdrawNonceAccountInstructionRaw;
|
|
1412
|
+
exports.identifySystemInstruction = identifySystemInstruction;
|
|
1413
|
+
exports.isTransactionSigner = isTransactionSigner;
|
|
1414
|
+
exports.memcmp = memcmp;
|
|
1415
|
+
exports.parseAdvanceNonceAccountInstruction = parseAdvanceNonceAccountInstruction;
|
|
1416
|
+
exports.parseAllocateInstruction = parseAllocateInstruction;
|
|
1417
|
+
exports.parseAllocateWithSeedInstruction = parseAllocateWithSeedInstruction;
|
|
1418
|
+
exports.parseAssignInstruction = parseAssignInstruction;
|
|
1419
|
+
exports.parseAssignWithSeedInstruction = parseAssignWithSeedInstruction;
|
|
1420
|
+
exports.parseAuthorizeNonceAccountInstruction = parseAuthorizeNonceAccountInstruction;
|
|
1421
|
+
exports.parseCreateAccountInstruction = parseCreateAccountInstruction;
|
|
1422
|
+
exports.parseCreateAccountWithSeedInstruction = parseCreateAccountWithSeedInstruction;
|
|
1423
|
+
exports.parseInitializeNonceAccountInstruction = parseInitializeNonceAccountInstruction;
|
|
1424
|
+
exports.parseTransferSolInstruction = parseTransferSolInstruction;
|
|
1425
|
+
exports.parseTransferSolWithSeedInstruction = parseTransferSolWithSeedInstruction;
|
|
1426
|
+
exports.parseUpgradeNonceAccountInstruction = parseUpgradeNonceAccountInstruction;
|
|
1427
|
+
exports.parseWithdrawNonceAccountInstruction = parseWithdrawNonceAccountInstruction;
|
|
1316
1428
|
//# sourceMappingURL=out.js.map
|
|
1317
|
-
//# sourceMappingURL=index.
|
|
1429
|
+
//# sourceMappingURL=index.cjs.map
|