@solana-program/system 0.1.0 → 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 -203
- package/dist/src/index.cjs.map +1 -0
- package/dist/src/index.js +199 -314
- package/dist/src/index.js.map +1 -1
- package/dist/types/src/generated/accounts/nonce.d.ts +1 -1
- package/dist/types/src/generated/accounts/nonce.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts +1 -1
- package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/allocate.d.ts +1 -1
- package/dist/types/src/generated/instructions/allocate.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/allocateWithSeed.d.ts +1 -1
- package/dist/types/src/generated/instructions/allocateWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/assign.d.ts +1 -1
- package/dist/types/src/generated/instructions/assign.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/assignWithSeed.d.ts +1 -1
- package/dist/types/src/generated/instructions/assignWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts +1 -1
- package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/createAccount.d.ts +1 -1
- package/dist/types/src/generated/instructions/createAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts +1 -1
- package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts +1 -1
- package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transferSol.d.ts +1 -1
- package/dist/types/src/generated/instructions/transferSol.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts +1 -1
- package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts +1 -1
- package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts +1 -1
- package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/types/nonceState.d.ts +1 -1
- package/dist/types/src/generated/types/nonceState.d.ts.map +1 -1
- package/dist/types/src/generated/types/nonceVersion.d.ts +1 -1
- package/dist/types/src/generated/types/nonceVersion.d.ts.map +1 -1
- package/dist/types/test/_setup.d.ts +1 -0
- package/dist/types/test/_setup.d.ts.map +1 -1
- package/dist/types/test/advanceNonceAccount.test.d.ts +2 -0
- package/dist/types/test/advanceNonceAccount.test.d.ts.map +1 -0
- package/dist/types/test/createAccount.test.d.ts +2 -0
- package/dist/types/test/createAccount.test.d.ts.map +1 -0
- package/package.json +8 -13
- package/dist/src/index.mjs.map +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { getStringEncoder, getStringDecoder } from '@solana/codecs-strings';
|
|
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');
|
|
9
8
|
|
|
10
9
|
// env-shim.ts
|
|
11
10
|
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
@@ -15,13 +14,13 @@ var NonceState = /* @__PURE__ */ ((NonceState3) => {
|
|
|
15
14
|
return NonceState3;
|
|
16
15
|
})(NonceState || {});
|
|
17
16
|
function getNonceStateEncoder() {
|
|
18
|
-
return getScalarEnumEncoder(NonceState, { size: getU32Encoder() });
|
|
17
|
+
return codecs.getScalarEnumEncoder(NonceState, { size: codecs.getU32Encoder() });
|
|
19
18
|
}
|
|
20
19
|
function getNonceStateDecoder() {
|
|
21
|
-
return getScalarEnumDecoder(NonceState, { size: getU32Decoder() });
|
|
20
|
+
return codecs.getScalarEnumDecoder(NonceState, { size: codecs.getU32Decoder() });
|
|
22
21
|
}
|
|
23
22
|
function getNonceStateCodec() {
|
|
24
|
-
return combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
|
|
23
|
+
return codecs.combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
|
|
25
24
|
}
|
|
26
25
|
var NonceVersion = /* @__PURE__ */ ((NonceVersion3) => {
|
|
27
26
|
NonceVersion3[NonceVersion3["Legacy"] = 0] = "Legacy";
|
|
@@ -29,62 +28,62 @@ var NonceVersion = /* @__PURE__ */ ((NonceVersion3) => {
|
|
|
29
28
|
return NonceVersion3;
|
|
30
29
|
})(NonceVersion || {});
|
|
31
30
|
function getNonceVersionEncoder() {
|
|
32
|
-
return getScalarEnumEncoder(NonceVersion, { size: getU32Encoder() });
|
|
31
|
+
return codecs.getScalarEnumEncoder(NonceVersion, { size: codecs.getU32Encoder() });
|
|
33
32
|
}
|
|
34
33
|
function getNonceVersionDecoder() {
|
|
35
|
-
return getScalarEnumDecoder(NonceVersion, { size: getU32Decoder() });
|
|
34
|
+
return codecs.getScalarEnumDecoder(NonceVersion, { size: codecs.getU32Decoder() });
|
|
36
35
|
}
|
|
37
36
|
function getNonceVersionCodec() {
|
|
38
|
-
return combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
|
|
37
|
+
return codecs.combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
// src/generated/accounts/nonce.ts
|
|
42
41
|
function getNonceAccountDataEncoder() {
|
|
43
|
-
return getStructEncoder([
|
|
42
|
+
return codecs.getStructEncoder([
|
|
44
43
|
["version", getNonceVersionEncoder()],
|
|
45
44
|
["state", getNonceStateEncoder()],
|
|
46
|
-
["authority", getAddressEncoder()],
|
|
47
|
-
["blockhash", getAddressEncoder()],
|
|
48
|
-
["lamportsPerSignature", getU64Encoder()]
|
|
45
|
+
["authority", addresses.getAddressEncoder()],
|
|
46
|
+
["blockhash", addresses.getAddressEncoder()],
|
|
47
|
+
["lamportsPerSignature", codecs.getU64Encoder()]
|
|
49
48
|
]);
|
|
50
49
|
}
|
|
51
50
|
function getNonceAccountDataDecoder() {
|
|
52
|
-
return getStructDecoder([
|
|
51
|
+
return codecs.getStructDecoder([
|
|
53
52
|
["version", getNonceVersionDecoder()],
|
|
54
53
|
["state", getNonceStateDecoder()],
|
|
55
|
-
["authority", getAddressDecoder()],
|
|
56
|
-
["blockhash", getAddressDecoder()],
|
|
57
|
-
["lamportsPerSignature", getU64Decoder()]
|
|
54
|
+
["authority", addresses.getAddressDecoder()],
|
|
55
|
+
["blockhash", addresses.getAddressDecoder()],
|
|
56
|
+
["lamportsPerSignature", codecs.getU64Decoder()]
|
|
58
57
|
]);
|
|
59
58
|
}
|
|
60
59
|
function getNonceAccountDataCodec() {
|
|
61
|
-
return combineCodec(
|
|
60
|
+
return codecs.combineCodec(
|
|
62
61
|
getNonceAccountDataEncoder(),
|
|
63
62
|
getNonceAccountDataDecoder()
|
|
64
63
|
);
|
|
65
64
|
}
|
|
66
65
|
function decodeNonce(encodedAccount) {
|
|
67
|
-
return decodeAccount(
|
|
66
|
+
return accounts.decodeAccount(
|
|
68
67
|
encodedAccount,
|
|
69
68
|
getNonceAccountDataDecoder()
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
async function fetchNonce(rpc, address, config) {
|
|
73
72
|
const maybeAccount = await fetchMaybeNonce(rpc, address, config);
|
|
74
|
-
assertAccountExists(maybeAccount);
|
|
73
|
+
accounts.assertAccountExists(maybeAccount);
|
|
75
74
|
return maybeAccount;
|
|
76
75
|
}
|
|
77
76
|
async function fetchMaybeNonce(rpc, address, config) {
|
|
78
|
-
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
77
|
+
const maybeAccount = await accounts.fetchEncodedAccount(rpc, address, config);
|
|
79
78
|
return decodeNonce(maybeAccount);
|
|
80
79
|
}
|
|
81
80
|
async function fetchAllNonce(rpc, addresses, config) {
|
|
82
81
|
const maybeAccounts = await fetchAllMaybeNonce(rpc, addresses, config);
|
|
83
|
-
assertAccountsExist(maybeAccounts);
|
|
82
|
+
accounts.assertAccountsExist(maybeAccounts);
|
|
84
83
|
return maybeAccounts;
|
|
85
84
|
}
|
|
86
85
|
async function fetchAllMaybeNonce(rpc, addresses, config) {
|
|
87
|
-
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
86
|
+
const maybeAccounts = await accounts.fetchEncodedAccounts(rpc, addresses, config);
|
|
88
87
|
return maybeAccounts.map((maybeAccount) => decodeNonce(maybeAccount));
|
|
89
88
|
}
|
|
90
89
|
function getNonceSize() {
|
|
@@ -189,7 +188,7 @@ function expectAddress(value) {
|
|
|
189
188
|
return value;
|
|
190
189
|
}
|
|
191
190
|
function expectProgramDerivedAddress(value) {
|
|
192
|
-
if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {
|
|
191
|
+
if (!value || !Array.isArray(value) || !addresses.isProgramDerivedAddress(value)) {
|
|
193
192
|
throw new Error("Expected a ProgramDerivedAddress.");
|
|
194
193
|
}
|
|
195
194
|
return value;
|
|
@@ -214,21 +213,21 @@ function getAccountMetasWithSigners(accounts, optionalAccountStrategy, programAd
|
|
|
214
213
|
return;
|
|
215
214
|
accountMetas[key] = {
|
|
216
215
|
address: programAddress,
|
|
217
|
-
role: AccountRole.READONLY
|
|
216
|
+
role: instructions.AccountRole.READONLY
|
|
218
217
|
};
|
|
219
218
|
return;
|
|
220
219
|
}
|
|
221
|
-
const writableRole = account.isWritable ? AccountRole.WRITABLE : AccountRole.READONLY;
|
|
220
|
+
const writableRole = account.isWritable ? instructions.AccountRole.WRITABLE : instructions.AccountRole.READONLY;
|
|
222
221
|
accountMetas[key] = Object.freeze({
|
|
223
222
|
address: expectAddress(account.value),
|
|
224
|
-
role: isTransactionSigner(account.value) ? upgradeRoleToSigner(writableRole) : writableRole,
|
|
223
|
+
role: isTransactionSigner(account.value) ? instructions.upgradeRoleToSigner(writableRole) : writableRole,
|
|
225
224
|
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
226
225
|
});
|
|
227
226
|
});
|
|
228
227
|
return accountMetas;
|
|
229
228
|
}
|
|
230
229
|
function isTransactionSigner(value) {
|
|
231
|
-
return !!value && typeof value === "object" && "address" in value && isTransactionSigner
|
|
230
|
+
return !!value && typeof value === "object" && "address" in value && signers.isTransactionSigner(value);
|
|
232
231
|
}
|
|
233
232
|
function memcmp(data, bytes, offset) {
|
|
234
233
|
const slice = data.slice(offset, offset + bytes.length);
|
|
@@ -239,16 +238,16 @@ function memcmp(data, bytes, offset) {
|
|
|
239
238
|
|
|
240
239
|
// src/generated/instructions/advanceNonceAccount.ts
|
|
241
240
|
function getAdvanceNonceAccountInstructionDataEncoder() {
|
|
242
|
-
return mapEncoder(
|
|
243
|
-
getStructEncoder([["discriminator", getU32Encoder()]]),
|
|
241
|
+
return codecs.mapEncoder(
|
|
242
|
+
codecs.getStructEncoder([["discriminator", codecs.getU32Encoder()]]),
|
|
244
243
|
(value) => ({ ...value, discriminator: 4 })
|
|
245
244
|
);
|
|
246
245
|
}
|
|
247
246
|
function getAdvanceNonceAccountInstructionDataDecoder() {
|
|
248
|
-
return getStructDecoder([["discriminator", getU32Decoder()]]);
|
|
247
|
+
return codecs.getStructDecoder([["discriminator", codecs.getU32Decoder()]]);
|
|
249
248
|
}
|
|
250
249
|
function getAdvanceNonceAccountInstructionDataCodec() {
|
|
251
|
-
return combineCodec(
|
|
250
|
+
return codecs.combineCodec(
|
|
252
251
|
getAdvanceNonceAccountInstructionDataEncoder(),
|
|
253
252
|
getAdvanceNonceAccountInstructionDataDecoder()
|
|
254
253
|
);
|
|
@@ -280,14 +279,14 @@ function getAdvanceNonceAccountInstruction(input) {
|
|
|
280
279
|
function getAdvanceNonceAccountInstructionRaw(accounts, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
281
280
|
return {
|
|
282
281
|
accounts: [
|
|
283
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
282
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
284
283
|
accountMetaWithDefault(
|
|
285
284
|
accounts.recentBlockhashesSysvar ?? "SysvarRecentB1ockHashes11111111111111111111",
|
|
286
|
-
AccountRole.READONLY
|
|
285
|
+
instructions.AccountRole.READONLY
|
|
287
286
|
),
|
|
288
287
|
accountMetaWithDefault(
|
|
289
288
|
accounts.nonceAuthority,
|
|
290
|
-
AccountRole.READONLY_SIGNER
|
|
289
|
+
instructions.AccountRole.READONLY_SIGNER
|
|
291
290
|
),
|
|
292
291
|
...remainingAccounts ?? []
|
|
293
292
|
],
|
|
@@ -318,22 +317,22 @@ function parseAdvanceNonceAccountInstruction(instruction) {
|
|
|
318
317
|
};
|
|
319
318
|
}
|
|
320
319
|
function getAllocateInstructionDataEncoder() {
|
|
321
|
-
return mapEncoder(
|
|
322
|
-
getStructEncoder([
|
|
323
|
-
["discriminator", getU32Encoder()],
|
|
324
|
-
["space", getU64Encoder()]
|
|
320
|
+
return codecs.mapEncoder(
|
|
321
|
+
codecs.getStructEncoder([
|
|
322
|
+
["discriminator", codecs.getU32Encoder()],
|
|
323
|
+
["space", codecs.getU64Encoder()]
|
|
325
324
|
]),
|
|
326
325
|
(value) => ({ ...value, discriminator: 8 })
|
|
327
326
|
);
|
|
328
327
|
}
|
|
329
328
|
function getAllocateInstructionDataDecoder() {
|
|
330
|
-
return getStructDecoder([
|
|
331
|
-
["discriminator", getU32Decoder()],
|
|
332
|
-
["space", getU64Decoder()]
|
|
329
|
+
return codecs.getStructDecoder([
|
|
330
|
+
["discriminator", codecs.getU32Decoder()],
|
|
331
|
+
["space", codecs.getU64Decoder()]
|
|
333
332
|
]);
|
|
334
333
|
}
|
|
335
334
|
function getAllocateInstructionDataCodec() {
|
|
336
|
-
return combineCodec(
|
|
335
|
+
return codecs.combineCodec(
|
|
337
336
|
getAllocateInstructionDataEncoder(),
|
|
338
337
|
getAllocateInstructionDataDecoder()
|
|
339
338
|
);
|
|
@@ -359,7 +358,7 @@ function getAllocateInstruction(input) {
|
|
|
359
358
|
function getAllocateInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
360
359
|
return {
|
|
361
360
|
accounts: [
|
|
362
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE_SIGNER),
|
|
361
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE_SIGNER),
|
|
363
362
|
...remainingAccounts ?? []
|
|
364
363
|
],
|
|
365
364
|
data: getAllocateInstructionDataEncoder().encode(args),
|
|
@@ -385,28 +384,28 @@ function parseAllocateInstruction(instruction) {
|
|
|
385
384
|
};
|
|
386
385
|
}
|
|
387
386
|
function getAllocateWithSeedInstructionDataEncoder() {
|
|
388
|
-
return mapEncoder(
|
|
389
|
-
getStructEncoder([
|
|
390
|
-
["discriminator", getU32Encoder()],
|
|
391
|
-
["base", getAddressEncoder()],
|
|
392
|
-
["seed", getStringEncoder()],
|
|
393
|
-
["space", getU64Encoder()],
|
|
394
|
-
["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()]
|
|
395
394
|
]),
|
|
396
395
|
(value) => ({ ...value, discriminator: 9 })
|
|
397
396
|
);
|
|
398
397
|
}
|
|
399
398
|
function getAllocateWithSeedInstructionDataDecoder() {
|
|
400
|
-
return getStructDecoder([
|
|
401
|
-
["discriminator", getU32Decoder()],
|
|
402
|
-
["base", getAddressDecoder()],
|
|
403
|
-
["seed", getStringDecoder()],
|
|
404
|
-
["space", getU64Decoder()],
|
|
405
|
-
["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()]
|
|
406
405
|
]);
|
|
407
406
|
}
|
|
408
407
|
function getAllocateWithSeedInstructionDataCodec() {
|
|
409
|
-
return combineCodec(
|
|
408
|
+
return codecs.combineCodec(
|
|
410
409
|
getAllocateWithSeedInstructionDataEncoder(),
|
|
411
410
|
getAllocateWithSeedInstructionDataDecoder()
|
|
412
411
|
);
|
|
@@ -433,8 +432,8 @@ function getAllocateWithSeedInstruction(input) {
|
|
|
433
432
|
function getAllocateWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
434
433
|
return {
|
|
435
434
|
accounts: [
|
|
436
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE),
|
|
437
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
435
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE),
|
|
436
|
+
accountMetaWithDefault(accounts.baseAccount, instructions.AccountRole.READONLY_SIGNER),
|
|
438
437
|
...remainingAccounts ?? []
|
|
439
438
|
],
|
|
440
439
|
data: getAllocateWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -461,22 +460,22 @@ function parseAllocateWithSeedInstruction(instruction) {
|
|
|
461
460
|
};
|
|
462
461
|
}
|
|
463
462
|
function getAssignInstructionDataEncoder() {
|
|
464
|
-
return mapEncoder(
|
|
465
|
-
getStructEncoder([
|
|
466
|
-
["discriminator", getU32Encoder()],
|
|
467
|
-
["programAddress", getAddressEncoder()]
|
|
463
|
+
return codecs.mapEncoder(
|
|
464
|
+
codecs.getStructEncoder([
|
|
465
|
+
["discriminator", codecs.getU32Encoder()],
|
|
466
|
+
["programAddress", addresses.getAddressEncoder()]
|
|
468
467
|
]),
|
|
469
468
|
(value) => ({ ...value, discriminator: 1 })
|
|
470
469
|
);
|
|
471
470
|
}
|
|
472
471
|
function getAssignInstructionDataDecoder() {
|
|
473
|
-
return getStructDecoder([
|
|
474
|
-
["discriminator", getU32Decoder()],
|
|
475
|
-
["programAddress", getAddressDecoder()]
|
|
472
|
+
return codecs.getStructDecoder([
|
|
473
|
+
["discriminator", codecs.getU32Decoder()],
|
|
474
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
476
475
|
]);
|
|
477
476
|
}
|
|
478
477
|
function getAssignInstructionDataCodec() {
|
|
479
|
-
return combineCodec(
|
|
478
|
+
return codecs.combineCodec(
|
|
480
479
|
getAssignInstructionDataEncoder(),
|
|
481
480
|
getAssignInstructionDataDecoder()
|
|
482
481
|
);
|
|
@@ -502,7 +501,7 @@ function getAssignInstruction(input) {
|
|
|
502
501
|
function getAssignInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
503
502
|
return {
|
|
504
503
|
accounts: [
|
|
505
|
-
accountMetaWithDefault(accounts.account, AccountRole.WRITABLE_SIGNER),
|
|
504
|
+
accountMetaWithDefault(accounts.account, instructions.AccountRole.WRITABLE_SIGNER),
|
|
506
505
|
...remainingAccounts ?? []
|
|
507
506
|
],
|
|
508
507
|
data: getAssignInstructionDataEncoder().encode(args),
|
|
@@ -528,26 +527,26 @@ function parseAssignInstruction(instruction) {
|
|
|
528
527
|
};
|
|
529
528
|
}
|
|
530
529
|
function getAssignWithSeedInstructionDataEncoder() {
|
|
531
|
-
return mapEncoder(
|
|
532
|
-
getStructEncoder([
|
|
533
|
-
["discriminator", getU32Encoder()],
|
|
534
|
-
["base", getAddressEncoder()],
|
|
535
|
-
["seed", getStringEncoder()],
|
|
536
|
-
["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()]
|
|
537
536
|
]),
|
|
538
537
|
(value) => ({ ...value, discriminator: 10 })
|
|
539
538
|
);
|
|
540
539
|
}
|
|
541
540
|
function getAssignWithSeedInstructionDataDecoder() {
|
|
542
|
-
return getStructDecoder([
|
|
543
|
-
["discriminator", getU32Decoder()],
|
|
544
|
-
["base", getAddressDecoder()],
|
|
545
|
-
["seed", getStringDecoder()],
|
|
546
|
-
["programAddress", getAddressDecoder()]
|
|
541
|
+
return codecs.getStructDecoder([
|
|
542
|
+
["discriminator", codecs.getU32Decoder()],
|
|
543
|
+
["base", addresses.getAddressDecoder()],
|
|
544
|
+
["seed", codecs.getStringDecoder()],
|
|
545
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
547
546
|
]);
|
|
548
547
|
}
|
|
549
548
|
function getAssignWithSeedInstructionDataCodec() {
|
|
550
|
-
return combineCodec(
|
|
549
|
+
return codecs.combineCodec(
|
|
551
550
|
getAssignWithSeedInstructionDataEncoder(),
|
|
552
551
|
getAssignWithSeedInstructionDataDecoder()
|
|
553
552
|
);
|
|
@@ -574,8 +573,8 @@ function getAssignWithSeedInstruction(input) {
|
|
|
574
573
|
function getAssignWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
575
574
|
return {
|
|
576
575
|
accounts: [
|
|
577
|
-
accountMetaWithDefault(accounts.account, AccountRole.WRITABLE),
|
|
578
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
576
|
+
accountMetaWithDefault(accounts.account, instructions.AccountRole.WRITABLE),
|
|
577
|
+
accountMetaWithDefault(accounts.baseAccount, instructions.AccountRole.READONLY_SIGNER),
|
|
579
578
|
...remainingAccounts ?? []
|
|
580
579
|
],
|
|
581
580
|
data: getAssignWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -602,22 +601,22 @@ function parseAssignWithSeedInstruction(instruction) {
|
|
|
602
601
|
};
|
|
603
602
|
}
|
|
604
603
|
function getAuthorizeNonceAccountInstructionDataEncoder() {
|
|
605
|
-
return mapEncoder(
|
|
606
|
-
getStructEncoder([
|
|
607
|
-
["discriminator", getU32Encoder()],
|
|
608
|
-
["newNonceAuthority", getAddressEncoder()]
|
|
604
|
+
return codecs.mapEncoder(
|
|
605
|
+
codecs.getStructEncoder([
|
|
606
|
+
["discriminator", codecs.getU32Encoder()],
|
|
607
|
+
["newNonceAuthority", addresses.getAddressEncoder()]
|
|
609
608
|
]),
|
|
610
609
|
(value) => ({ ...value, discriminator: 7 })
|
|
611
610
|
);
|
|
612
611
|
}
|
|
613
612
|
function getAuthorizeNonceAccountInstructionDataDecoder() {
|
|
614
|
-
return getStructDecoder([
|
|
615
|
-
["discriminator", getU32Decoder()],
|
|
616
|
-
["newNonceAuthority", getAddressDecoder()]
|
|
613
|
+
return codecs.getStructDecoder([
|
|
614
|
+
["discriminator", codecs.getU32Decoder()],
|
|
615
|
+
["newNonceAuthority", addresses.getAddressDecoder()]
|
|
617
616
|
]);
|
|
618
617
|
}
|
|
619
618
|
function getAuthorizeNonceAccountInstructionDataCodec() {
|
|
620
|
-
return combineCodec(
|
|
619
|
+
return codecs.combineCodec(
|
|
621
620
|
getAuthorizeNonceAccountInstructionDataEncoder(),
|
|
622
621
|
getAuthorizeNonceAccountInstructionDataDecoder()
|
|
623
622
|
);
|
|
@@ -644,10 +643,10 @@ function getAuthorizeNonceAccountInstruction(input) {
|
|
|
644
643
|
function getAuthorizeNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
645
644
|
return {
|
|
646
645
|
accounts: [
|
|
647
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
646
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
648
647
|
accountMetaWithDefault(
|
|
649
648
|
accounts.nonceAuthority,
|
|
650
|
-
AccountRole.READONLY_SIGNER
|
|
649
|
+
instructions.AccountRole.READONLY_SIGNER
|
|
651
650
|
),
|
|
652
651
|
...remainingAccounts ?? []
|
|
653
652
|
],
|
|
@@ -677,43 +676,43 @@ function parseAuthorizeNonceAccountInstruction(instruction) {
|
|
|
677
676
|
};
|
|
678
677
|
}
|
|
679
678
|
function getCreateAccountInstructionDataEncoder() {
|
|
680
|
-
return mapEncoder(
|
|
681
|
-
getStructEncoder([
|
|
682
|
-
["discriminator", getU32Encoder()],
|
|
683
|
-
["lamports", getU64Encoder()],
|
|
684
|
-
["space", getU64Encoder()],
|
|
685
|
-
["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()]
|
|
686
685
|
]),
|
|
687
686
|
(value) => ({ ...value, discriminator: 0 })
|
|
688
687
|
);
|
|
689
688
|
}
|
|
690
689
|
function getCreateAccountInstructionDataDecoder() {
|
|
691
|
-
return getStructDecoder([
|
|
692
|
-
["discriminator", getU32Decoder()],
|
|
693
|
-
["lamports", getU64Decoder()],
|
|
694
|
-
["space", getU64Decoder()],
|
|
695
|
-
["programAddress", getAddressDecoder()]
|
|
690
|
+
return codecs.getStructDecoder([
|
|
691
|
+
["discriminator", codecs.getU32Decoder()],
|
|
692
|
+
["lamports", codecs.getU64Decoder()],
|
|
693
|
+
["space", codecs.getU64Decoder()],
|
|
694
|
+
["programAddress", addresses.getAddressDecoder()]
|
|
696
695
|
]);
|
|
697
696
|
}
|
|
698
697
|
function getCreateAccountInstructionDataCodec() {
|
|
699
|
-
return combineCodec(
|
|
698
|
+
return codecs.combineCodec(
|
|
700
699
|
getCreateAccountInstructionDataEncoder(),
|
|
701
700
|
getCreateAccountInstructionDataDecoder()
|
|
702
701
|
);
|
|
703
702
|
}
|
|
704
703
|
function getCreateAccountInstruction(input) {
|
|
705
704
|
const programAddress = "11111111111111111111111111111111";
|
|
706
|
-
const accounts = {
|
|
705
|
+
const accounts$1 = {
|
|
707
706
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
708
707
|
newAccount: { value: input.newAccount ?? null, isWritable: true }
|
|
709
708
|
};
|
|
710
709
|
const args = { ...input };
|
|
711
|
-
const byteDelta = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce(
|
|
710
|
+
const byteDelta = [Number(args.space) + accounts.BASE_ACCOUNT_SIZE].reduce(
|
|
712
711
|
(a, b) => a + b,
|
|
713
712
|
0
|
|
714
713
|
);
|
|
715
714
|
const accountMetas = getAccountMetasWithSigners(
|
|
716
|
-
accounts,
|
|
715
|
+
accounts$1,
|
|
717
716
|
"programId",
|
|
718
717
|
programAddress
|
|
719
718
|
);
|
|
@@ -727,8 +726,8 @@ function getCreateAccountInstruction(input) {
|
|
|
727
726
|
function getCreateAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
728
727
|
return {
|
|
729
728
|
accounts: [
|
|
730
|
-
accountMetaWithDefault(accounts.payer, AccountRole.WRITABLE_SIGNER),
|
|
731
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE_SIGNER),
|
|
729
|
+
accountMetaWithDefault(accounts.payer, instructions.AccountRole.WRITABLE_SIGNER),
|
|
730
|
+
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE_SIGNER),
|
|
732
731
|
...remainingAccounts ?? []
|
|
733
732
|
],
|
|
734
733
|
data: getCreateAccountInstructionDataEncoder().encode(args),
|
|
@@ -755,30 +754,30 @@ function parseCreateAccountInstruction(instruction) {
|
|
|
755
754
|
};
|
|
756
755
|
}
|
|
757
756
|
function getCreateAccountWithSeedInstructionDataEncoder() {
|
|
758
|
-
return mapEncoder(
|
|
759
|
-
getStructEncoder([
|
|
760
|
-
["discriminator", getU32Encoder()],
|
|
761
|
-
["base", getAddressEncoder()],
|
|
762
|
-
["seed", getStringEncoder()],
|
|
763
|
-
["amount", getU64Encoder()],
|
|
764
|
-
["space", getU64Encoder()],
|
|
765
|
-
["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()]
|
|
766
765
|
]),
|
|
767
766
|
(value) => ({ ...value, discriminator: 3 })
|
|
768
767
|
);
|
|
769
768
|
}
|
|
770
769
|
function getCreateAccountWithSeedInstructionDataDecoder() {
|
|
771
|
-
return getStructDecoder([
|
|
772
|
-
["discriminator", getU32Decoder()],
|
|
773
|
-
["base", getAddressDecoder()],
|
|
774
|
-
["seed", getStringDecoder()],
|
|
775
|
-
["amount", getU64Decoder()],
|
|
776
|
-
["space", getU64Decoder()],
|
|
777
|
-
["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()]
|
|
778
777
|
]);
|
|
779
778
|
}
|
|
780
779
|
function getCreateAccountWithSeedInstructionDataCodec() {
|
|
781
|
-
return combineCodec(
|
|
780
|
+
return codecs.combineCodec(
|
|
782
781
|
getCreateAccountWithSeedInstructionDataEncoder(),
|
|
783
782
|
getCreateAccountWithSeedInstructionDataDecoder()
|
|
784
783
|
);
|
|
@@ -806,9 +805,9 @@ function getCreateAccountWithSeedInstruction(input) {
|
|
|
806
805
|
function getCreateAccountWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
807
806
|
return {
|
|
808
807
|
accounts: [
|
|
809
|
-
accountMetaWithDefault(accounts.payer, AccountRole.WRITABLE_SIGNER),
|
|
810
|
-
accountMetaWithDefault(accounts.newAccount, AccountRole.WRITABLE),
|
|
811
|
-
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),
|
|
812
811
|
...remainingAccounts ?? []
|
|
813
812
|
],
|
|
814
813
|
data: getCreateAccountWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -838,22 +837,22 @@ function parseCreateAccountWithSeedInstruction(instruction) {
|
|
|
838
837
|
};
|
|
839
838
|
}
|
|
840
839
|
function getInitializeNonceAccountInstructionDataEncoder() {
|
|
841
|
-
return mapEncoder(
|
|
842
|
-
getStructEncoder([
|
|
843
|
-
["discriminator", getU32Encoder()],
|
|
844
|
-
["nonceAuthority", getAddressEncoder()]
|
|
840
|
+
return codecs.mapEncoder(
|
|
841
|
+
codecs.getStructEncoder([
|
|
842
|
+
["discriminator", codecs.getU32Encoder()],
|
|
843
|
+
["nonceAuthority", addresses.getAddressEncoder()]
|
|
845
844
|
]),
|
|
846
845
|
(value) => ({ ...value, discriminator: 6 })
|
|
847
846
|
);
|
|
848
847
|
}
|
|
849
848
|
function getInitializeNonceAccountInstructionDataDecoder() {
|
|
850
|
-
return getStructDecoder([
|
|
851
|
-
["discriminator", getU32Decoder()],
|
|
852
|
-
["nonceAuthority", getAddressDecoder()]
|
|
849
|
+
return codecs.getStructDecoder([
|
|
850
|
+
["discriminator", codecs.getU32Decoder()],
|
|
851
|
+
["nonceAuthority", addresses.getAddressDecoder()]
|
|
853
852
|
]);
|
|
854
853
|
}
|
|
855
854
|
function getInitializeNonceAccountInstructionDataCodec() {
|
|
856
|
-
return combineCodec(
|
|
855
|
+
return codecs.combineCodec(
|
|
857
856
|
getInitializeNonceAccountInstructionDataEncoder(),
|
|
858
857
|
getInitializeNonceAccountInstructionDataDecoder()
|
|
859
858
|
);
|
|
@@ -890,14 +889,14 @@ function getInitializeNonceAccountInstruction(input) {
|
|
|
890
889
|
function getInitializeNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
891
890
|
return {
|
|
892
891
|
accounts: [
|
|
893
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
892
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
894
893
|
accountMetaWithDefault(
|
|
895
894
|
accounts.recentBlockhashesSysvar ?? "SysvarRecentB1ockHashes11111111111111111111",
|
|
896
|
-
AccountRole.READONLY
|
|
895
|
+
instructions.AccountRole.READONLY
|
|
897
896
|
),
|
|
898
897
|
accountMetaWithDefault(
|
|
899
898
|
accounts.rentSysvar ?? "SysvarRent111111111111111111111111111111111",
|
|
900
|
-
AccountRole.READONLY
|
|
899
|
+
instructions.AccountRole.READONLY
|
|
901
900
|
),
|
|
902
901
|
...remainingAccounts ?? []
|
|
903
902
|
],
|
|
@@ -928,22 +927,22 @@ function parseInitializeNonceAccountInstruction(instruction) {
|
|
|
928
927
|
};
|
|
929
928
|
}
|
|
930
929
|
function getTransferSolInstructionDataEncoder() {
|
|
931
|
-
return mapEncoder(
|
|
932
|
-
getStructEncoder([
|
|
933
|
-
["discriminator", getU32Encoder()],
|
|
934
|
-
["amount", getU64Encoder()]
|
|
930
|
+
return codecs.mapEncoder(
|
|
931
|
+
codecs.getStructEncoder([
|
|
932
|
+
["discriminator", codecs.getU32Encoder()],
|
|
933
|
+
["amount", codecs.getU64Encoder()]
|
|
935
934
|
]),
|
|
936
935
|
(value) => ({ ...value, discriminator: 2 })
|
|
937
936
|
);
|
|
938
937
|
}
|
|
939
938
|
function getTransferSolInstructionDataDecoder() {
|
|
940
|
-
return getStructDecoder([
|
|
941
|
-
["discriminator", getU32Decoder()],
|
|
942
|
-
["amount", getU64Decoder()]
|
|
939
|
+
return codecs.getStructDecoder([
|
|
940
|
+
["discriminator", codecs.getU32Decoder()],
|
|
941
|
+
["amount", codecs.getU64Decoder()]
|
|
943
942
|
]);
|
|
944
943
|
}
|
|
945
944
|
function getTransferSolInstructionDataCodec() {
|
|
946
|
-
return combineCodec(
|
|
945
|
+
return codecs.combineCodec(
|
|
947
946
|
getTransferSolInstructionDataEncoder(),
|
|
948
947
|
getTransferSolInstructionDataDecoder()
|
|
949
948
|
);
|
|
@@ -970,8 +969,8 @@ function getTransferSolInstruction(input) {
|
|
|
970
969
|
function getTransferSolInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
971
970
|
return {
|
|
972
971
|
accounts: [
|
|
973
|
-
accountMetaWithDefault(accounts.source, AccountRole.WRITABLE_SIGNER),
|
|
974
|
-
accountMetaWithDefault(accounts.destination, AccountRole.WRITABLE),
|
|
972
|
+
accountMetaWithDefault(accounts.source, instructions.AccountRole.WRITABLE_SIGNER),
|
|
973
|
+
accountMetaWithDefault(accounts.destination, instructions.AccountRole.WRITABLE),
|
|
975
974
|
...remainingAccounts ?? []
|
|
976
975
|
],
|
|
977
976
|
data: getTransferSolInstructionDataEncoder().encode(args),
|
|
@@ -998,26 +997,26 @@ function parseTransferSolInstruction(instruction) {
|
|
|
998
997
|
};
|
|
999
998
|
}
|
|
1000
999
|
function getTransferSolWithSeedInstructionDataEncoder() {
|
|
1001
|
-
return mapEncoder(
|
|
1002
|
-
getStructEncoder([
|
|
1003
|
-
["discriminator", getU32Encoder()],
|
|
1004
|
-
["amount", getU64Encoder()],
|
|
1005
|
-
["fromSeed", getStringEncoder()],
|
|
1006
|
-
["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()]
|
|
1007
1006
|
]),
|
|
1008
1007
|
(value) => ({ ...value, discriminator: 11 })
|
|
1009
1008
|
);
|
|
1010
1009
|
}
|
|
1011
1010
|
function getTransferSolWithSeedInstructionDataDecoder() {
|
|
1012
|
-
return getStructDecoder([
|
|
1013
|
-
["discriminator", getU32Decoder()],
|
|
1014
|
-
["amount", getU64Decoder()],
|
|
1015
|
-
["fromSeed", getStringDecoder()],
|
|
1016
|
-
["fromOwner", getAddressDecoder()]
|
|
1011
|
+
return codecs.getStructDecoder([
|
|
1012
|
+
["discriminator", codecs.getU32Decoder()],
|
|
1013
|
+
["amount", codecs.getU64Decoder()],
|
|
1014
|
+
["fromSeed", codecs.getStringDecoder()],
|
|
1015
|
+
["fromOwner", addresses.getAddressDecoder()]
|
|
1017
1016
|
]);
|
|
1018
1017
|
}
|
|
1019
1018
|
function getTransferSolWithSeedInstructionDataCodec() {
|
|
1020
|
-
return combineCodec(
|
|
1019
|
+
return codecs.combineCodec(
|
|
1021
1020
|
getTransferSolWithSeedInstructionDataEncoder(),
|
|
1022
1021
|
getTransferSolWithSeedInstructionDataDecoder()
|
|
1023
1022
|
);
|
|
@@ -1045,9 +1044,9 @@ function getTransferSolWithSeedInstruction(input) {
|
|
|
1045
1044
|
function getTransferSolWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1046
1045
|
return {
|
|
1047
1046
|
accounts: [
|
|
1048
|
-
accountMetaWithDefault(accounts.source, AccountRole.WRITABLE),
|
|
1049
|
-
accountMetaWithDefault(accounts.baseAccount, AccountRole.READONLY_SIGNER),
|
|
1050
|
-
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),
|
|
1051
1050
|
...remainingAccounts ?? []
|
|
1052
1051
|
],
|
|
1053
1052
|
data: getTransferSolWithSeedInstructionDataEncoder().encode(args),
|
|
@@ -1077,16 +1076,16 @@ function parseTransferSolWithSeedInstruction(instruction) {
|
|
|
1077
1076
|
};
|
|
1078
1077
|
}
|
|
1079
1078
|
function getUpgradeNonceAccountInstructionDataEncoder() {
|
|
1080
|
-
return mapEncoder(
|
|
1081
|
-
getStructEncoder([["discriminator", getU32Encoder()]]),
|
|
1079
|
+
return codecs.mapEncoder(
|
|
1080
|
+
codecs.getStructEncoder([["discriminator", codecs.getU32Encoder()]]),
|
|
1082
1081
|
(value) => ({ ...value, discriminator: 12 })
|
|
1083
1082
|
);
|
|
1084
1083
|
}
|
|
1085
1084
|
function getUpgradeNonceAccountInstructionDataDecoder() {
|
|
1086
|
-
return getStructDecoder([["discriminator", getU32Decoder()]]);
|
|
1085
|
+
return codecs.getStructDecoder([["discriminator", codecs.getU32Decoder()]]);
|
|
1087
1086
|
}
|
|
1088
1087
|
function getUpgradeNonceAccountInstructionDataCodec() {
|
|
1089
|
-
return combineCodec(
|
|
1088
|
+
return codecs.combineCodec(
|
|
1090
1089
|
getUpgradeNonceAccountInstructionDataEncoder(),
|
|
1091
1090
|
getUpgradeNonceAccountInstructionDataDecoder()
|
|
1092
1091
|
);
|
|
@@ -1110,7 +1109,7 @@ function getUpgradeNonceAccountInstruction(input) {
|
|
|
1110
1109
|
function getUpgradeNonceAccountInstructionRaw(accounts, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1111
1110
|
return {
|
|
1112
1111
|
accounts: [
|
|
1113
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
1112
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
1114
1113
|
...remainingAccounts ?? []
|
|
1115
1114
|
],
|
|
1116
1115
|
data: getUpgradeNonceAccountInstructionDataEncoder().encode({}),
|
|
@@ -1138,22 +1137,22 @@ function parseUpgradeNonceAccountInstruction(instruction) {
|
|
|
1138
1137
|
};
|
|
1139
1138
|
}
|
|
1140
1139
|
function getWithdrawNonceAccountInstructionDataEncoder() {
|
|
1141
|
-
return mapEncoder(
|
|
1142
|
-
getStructEncoder([
|
|
1143
|
-
["discriminator", getU32Encoder()],
|
|
1144
|
-
["withdrawAmount", getU64Encoder()]
|
|
1140
|
+
return codecs.mapEncoder(
|
|
1141
|
+
codecs.getStructEncoder([
|
|
1142
|
+
["discriminator", codecs.getU32Encoder()],
|
|
1143
|
+
["withdrawAmount", codecs.getU64Encoder()]
|
|
1145
1144
|
]),
|
|
1146
1145
|
(value) => ({ ...value, discriminator: 5 })
|
|
1147
1146
|
);
|
|
1148
1147
|
}
|
|
1149
1148
|
function getWithdrawNonceAccountInstructionDataDecoder() {
|
|
1150
|
-
return getStructDecoder([
|
|
1151
|
-
["discriminator", getU32Decoder()],
|
|
1152
|
-
["withdrawAmount", getU64Decoder()]
|
|
1149
|
+
return codecs.getStructDecoder([
|
|
1150
|
+
["discriminator", codecs.getU32Decoder()],
|
|
1151
|
+
["withdrawAmount", codecs.getU64Decoder()]
|
|
1153
1152
|
]);
|
|
1154
1153
|
}
|
|
1155
1154
|
function getWithdrawNonceAccountInstructionDataCodec() {
|
|
1156
|
-
return combineCodec(
|
|
1155
|
+
return codecs.combineCodec(
|
|
1157
1156
|
getWithdrawNonceAccountInstructionDataEncoder(),
|
|
1158
1157
|
getWithdrawNonceAccountInstructionDataDecoder()
|
|
1159
1158
|
);
|
|
@@ -1195,19 +1194,19 @@ function getWithdrawNonceAccountInstruction(input) {
|
|
|
1195
1194
|
function getWithdrawNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1196
1195
|
return {
|
|
1197
1196
|
accounts: [
|
|
1198
|
-
accountMetaWithDefault(accounts.nonceAccount, AccountRole.WRITABLE),
|
|
1199
|
-
accountMetaWithDefault(accounts.recipientAccount, AccountRole.WRITABLE),
|
|
1197
|
+
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
1198
|
+
accountMetaWithDefault(accounts.recipientAccount, instructions.AccountRole.WRITABLE),
|
|
1200
1199
|
accountMetaWithDefault(
|
|
1201
1200
|
accounts.recentBlockhashesSysvar ?? "SysvarRecentB1ockHashes11111111111111111111",
|
|
1202
|
-
AccountRole.READONLY
|
|
1201
|
+
instructions.AccountRole.READONLY
|
|
1203
1202
|
),
|
|
1204
1203
|
accountMetaWithDefault(
|
|
1205
1204
|
accounts.rentSysvar ?? "SysvarRent111111111111111111111111111111111",
|
|
1206
|
-
AccountRole.READONLY
|
|
1205
|
+
instructions.AccountRole.READONLY
|
|
1207
1206
|
),
|
|
1208
1207
|
accountMetaWithDefault(
|
|
1209
1208
|
accounts.nonceAuthority,
|
|
1210
|
-
AccountRole.READONLY_SIGNER
|
|
1209
|
+
instructions.AccountRole.READONLY_SIGNER
|
|
1211
1210
|
),
|
|
1212
1211
|
...remainingAccounts ?? []
|
|
1213
1212
|
],
|
|
@@ -1271,43 +1270,43 @@ var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
|
|
|
1271
1270
|
})(SystemInstruction || {});
|
|
1272
1271
|
function identifySystemInstruction(instruction) {
|
|
1273
1272
|
const data = instruction instanceof Uint8Array ? instruction : instruction.data;
|
|
1274
|
-
if (memcmp(data, getU32Encoder().encode(0), 0)) {
|
|
1273
|
+
if (memcmp(data, codecs.getU32Encoder().encode(0), 0)) {
|
|
1275
1274
|
return 0 /* CreateAccount */;
|
|
1276
1275
|
}
|
|
1277
|
-
if (memcmp(data, getU32Encoder().encode(1), 0)) {
|
|
1276
|
+
if (memcmp(data, codecs.getU32Encoder().encode(1), 0)) {
|
|
1278
1277
|
return 1 /* Assign */;
|
|
1279
1278
|
}
|
|
1280
|
-
if (memcmp(data, getU32Encoder().encode(2), 0)) {
|
|
1279
|
+
if (memcmp(data, codecs.getU32Encoder().encode(2), 0)) {
|
|
1281
1280
|
return 2 /* TransferSol */;
|
|
1282
1281
|
}
|
|
1283
|
-
if (memcmp(data, getU32Encoder().encode(3), 0)) {
|
|
1282
|
+
if (memcmp(data, codecs.getU32Encoder().encode(3), 0)) {
|
|
1284
1283
|
return 3 /* CreateAccountWithSeed */;
|
|
1285
1284
|
}
|
|
1286
|
-
if (memcmp(data, getU32Encoder().encode(4), 0)) {
|
|
1285
|
+
if (memcmp(data, codecs.getU32Encoder().encode(4), 0)) {
|
|
1287
1286
|
return 4 /* AdvanceNonceAccount */;
|
|
1288
1287
|
}
|
|
1289
|
-
if (memcmp(data, getU32Encoder().encode(5), 0)) {
|
|
1288
|
+
if (memcmp(data, codecs.getU32Encoder().encode(5), 0)) {
|
|
1290
1289
|
return 5 /* WithdrawNonceAccount */;
|
|
1291
1290
|
}
|
|
1292
|
-
if (memcmp(data, getU32Encoder().encode(6), 0)) {
|
|
1291
|
+
if (memcmp(data, codecs.getU32Encoder().encode(6), 0)) {
|
|
1293
1292
|
return 6 /* InitializeNonceAccount */;
|
|
1294
1293
|
}
|
|
1295
|
-
if (memcmp(data, getU32Encoder().encode(7), 0)) {
|
|
1294
|
+
if (memcmp(data, codecs.getU32Encoder().encode(7), 0)) {
|
|
1296
1295
|
return 7 /* AuthorizeNonceAccount */;
|
|
1297
1296
|
}
|
|
1298
|
-
if (memcmp(data, getU32Encoder().encode(8), 0)) {
|
|
1297
|
+
if (memcmp(data, codecs.getU32Encoder().encode(8), 0)) {
|
|
1299
1298
|
return 8 /* Allocate */;
|
|
1300
1299
|
}
|
|
1301
|
-
if (memcmp(data, getU32Encoder().encode(9), 0)) {
|
|
1300
|
+
if (memcmp(data, codecs.getU32Encoder().encode(9), 0)) {
|
|
1302
1301
|
return 9 /* AllocateWithSeed */;
|
|
1303
1302
|
}
|
|
1304
|
-
if (memcmp(data, getU32Encoder().encode(10), 0)) {
|
|
1303
|
+
if (memcmp(data, codecs.getU32Encoder().encode(10), 0)) {
|
|
1305
1304
|
return 10 /* AssignWithSeed */;
|
|
1306
1305
|
}
|
|
1307
|
-
if (memcmp(data, getU32Encoder().encode(11), 0)) {
|
|
1306
|
+
if (memcmp(data, codecs.getU32Encoder().encode(11), 0)) {
|
|
1308
1307
|
return 11 /* TransferSolWithSeed */;
|
|
1309
1308
|
}
|
|
1310
|
-
if (memcmp(data, getU32Encoder().encode(12), 0)) {
|
|
1309
|
+
if (memcmp(data, codecs.getU32Encoder().encode(12), 0)) {
|
|
1311
1310
|
return 12 /* UpgradeNonceAccount */;
|
|
1312
1311
|
}
|
|
1313
1312
|
throw new Error(
|
|
@@ -1315,6 +1314,116 @@ function identifySystemInstruction(instruction) {
|
|
|
1315
1314
|
);
|
|
1316
1315
|
}
|
|
1317
1316
|
|
|
1318
|
-
|
|
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;
|
|
1319
1428
|
//# sourceMappingURL=out.js.map
|
|
1320
|
-
//# sourceMappingURL=index.
|
|
1429
|
+
//# sourceMappingURL=index.cjs.map
|