@solana-program/system 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.cjs +240 -410
- package/dist/src/index.cjs.map +1 -1
- package/dist/src/index.js +240 -396
- package/dist/src/index.js.map +1 -1
- package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts +5 -21
- package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/allocate.d.ts +5 -16
- package/dist/types/src/generated/instructions/allocate.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/allocateWithSeed.d.ts +5 -22
- package/dist/types/src/generated/instructions/allocateWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/assign.d.ts +5 -16
- package/dist/types/src/generated/instructions/assign.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/assignWithSeed.d.ts +5 -21
- package/dist/types/src/generated/instructions/assignWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts +5 -19
- package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/createAccount.d.ts +5 -21
- package/dist/types/src/generated/instructions/createAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts +5 -26
- package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts +5 -22
- package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transferSol.d.ts +5 -19
- package/dist/types/src/generated/instructions/transferSol.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts +5 -24
- package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts +5 -15
- package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts +5 -28
- package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/shared/index.d.ts +2 -10
- package/dist/types/src/generated/shared/index.d.ts.map +1 -1
- package/package.json +13 -17
package/dist/src/index.cjs
CHANGED
|
@@ -199,32 +199,23 @@ function expectTransactionSigner(value) {
|
|
|
199
199
|
}
|
|
200
200
|
return value;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
|
|
204
|
-
return void 0;
|
|
205
|
-
return typeof account === "string" ? { address: account, role } : account;
|
|
206
|
-
}
|
|
207
|
-
function getAccountMetasWithSigners(accounts, optionalAccountStrategy, programAddress) {
|
|
208
|
-
const accountMetas = {};
|
|
209
|
-
Object.keys(accounts).forEach((key) => {
|
|
210
|
-
const account = accounts[key];
|
|
202
|
+
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
203
|
+
return (account) => {
|
|
211
204
|
if (!account.value) {
|
|
212
205
|
if (optionalAccountStrategy === "omitted")
|
|
213
206
|
return;
|
|
214
|
-
|
|
207
|
+
return Object.freeze({
|
|
215
208
|
address: programAddress,
|
|
216
209
|
role: instructions.AccountRole.READONLY
|
|
217
|
-
};
|
|
218
|
-
return;
|
|
210
|
+
});
|
|
219
211
|
}
|
|
220
212
|
const writableRole = account.isWritable ? instructions.AccountRole.WRITABLE : instructions.AccountRole.READONLY;
|
|
221
|
-
|
|
213
|
+
return Object.freeze({
|
|
222
214
|
address: expectAddress(account.value),
|
|
223
215
|
role: isTransactionSigner(account.value) ? instructions.upgradeRoleToSigner(writableRole) : writableRole,
|
|
224
216
|
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
225
217
|
});
|
|
226
|
-
}
|
|
227
|
-
return accountMetas;
|
|
218
|
+
};
|
|
228
219
|
}
|
|
229
220
|
function isTransactionSigner(value) {
|
|
230
221
|
return !!value && typeof value === "object" && "address" in value && signers.isTransactionSigner(value);
|
|
@@ -236,6 +227,83 @@ function memcmp(data, bytes, offset) {
|
|
|
236
227
|
return bytes.every((b, i) => b === slice[i]);
|
|
237
228
|
}
|
|
238
229
|
|
|
230
|
+
// src/generated/programs/system.ts
|
|
231
|
+
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
232
|
+
function getSystemProgram() {
|
|
233
|
+
return {
|
|
234
|
+
name: "system",
|
|
235
|
+
address: SYSTEM_PROGRAM_ADDRESS,
|
|
236
|
+
getErrorFromCode(code, cause) {
|
|
237
|
+
return getSystemProgramErrorFromCode(code, cause);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
var SystemAccount = /* @__PURE__ */ ((SystemAccount2) => {
|
|
242
|
+
SystemAccount2[SystemAccount2["Nonce"] = 0] = "Nonce";
|
|
243
|
+
return SystemAccount2;
|
|
244
|
+
})(SystemAccount || {});
|
|
245
|
+
var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
|
|
246
|
+
SystemInstruction2[SystemInstruction2["CreateAccount"] = 0] = "CreateAccount";
|
|
247
|
+
SystemInstruction2[SystemInstruction2["Assign"] = 1] = "Assign";
|
|
248
|
+
SystemInstruction2[SystemInstruction2["TransferSol"] = 2] = "TransferSol";
|
|
249
|
+
SystemInstruction2[SystemInstruction2["CreateAccountWithSeed"] = 3] = "CreateAccountWithSeed";
|
|
250
|
+
SystemInstruction2[SystemInstruction2["AdvanceNonceAccount"] = 4] = "AdvanceNonceAccount";
|
|
251
|
+
SystemInstruction2[SystemInstruction2["WithdrawNonceAccount"] = 5] = "WithdrawNonceAccount";
|
|
252
|
+
SystemInstruction2[SystemInstruction2["InitializeNonceAccount"] = 6] = "InitializeNonceAccount";
|
|
253
|
+
SystemInstruction2[SystemInstruction2["AuthorizeNonceAccount"] = 7] = "AuthorizeNonceAccount";
|
|
254
|
+
SystemInstruction2[SystemInstruction2["Allocate"] = 8] = "Allocate";
|
|
255
|
+
SystemInstruction2[SystemInstruction2["AllocateWithSeed"] = 9] = "AllocateWithSeed";
|
|
256
|
+
SystemInstruction2[SystemInstruction2["AssignWithSeed"] = 10] = "AssignWithSeed";
|
|
257
|
+
SystemInstruction2[SystemInstruction2["TransferSolWithSeed"] = 11] = "TransferSolWithSeed";
|
|
258
|
+
SystemInstruction2[SystemInstruction2["UpgradeNonceAccount"] = 12] = "UpgradeNonceAccount";
|
|
259
|
+
return SystemInstruction2;
|
|
260
|
+
})(SystemInstruction || {});
|
|
261
|
+
function identifySystemInstruction(instruction) {
|
|
262
|
+
const data = instruction instanceof Uint8Array ? instruction : instruction.data;
|
|
263
|
+
if (memcmp(data, codecs.getU32Encoder().encode(0), 0)) {
|
|
264
|
+
return 0 /* CreateAccount */;
|
|
265
|
+
}
|
|
266
|
+
if (memcmp(data, codecs.getU32Encoder().encode(1), 0)) {
|
|
267
|
+
return 1 /* Assign */;
|
|
268
|
+
}
|
|
269
|
+
if (memcmp(data, codecs.getU32Encoder().encode(2), 0)) {
|
|
270
|
+
return 2 /* TransferSol */;
|
|
271
|
+
}
|
|
272
|
+
if (memcmp(data, codecs.getU32Encoder().encode(3), 0)) {
|
|
273
|
+
return 3 /* CreateAccountWithSeed */;
|
|
274
|
+
}
|
|
275
|
+
if (memcmp(data, codecs.getU32Encoder().encode(4), 0)) {
|
|
276
|
+
return 4 /* AdvanceNonceAccount */;
|
|
277
|
+
}
|
|
278
|
+
if (memcmp(data, codecs.getU32Encoder().encode(5), 0)) {
|
|
279
|
+
return 5 /* WithdrawNonceAccount */;
|
|
280
|
+
}
|
|
281
|
+
if (memcmp(data, codecs.getU32Encoder().encode(6), 0)) {
|
|
282
|
+
return 6 /* InitializeNonceAccount */;
|
|
283
|
+
}
|
|
284
|
+
if (memcmp(data, codecs.getU32Encoder().encode(7), 0)) {
|
|
285
|
+
return 7 /* AuthorizeNonceAccount */;
|
|
286
|
+
}
|
|
287
|
+
if (memcmp(data, codecs.getU32Encoder().encode(8), 0)) {
|
|
288
|
+
return 8 /* Allocate */;
|
|
289
|
+
}
|
|
290
|
+
if (memcmp(data, codecs.getU32Encoder().encode(9), 0)) {
|
|
291
|
+
return 9 /* AllocateWithSeed */;
|
|
292
|
+
}
|
|
293
|
+
if (memcmp(data, codecs.getU32Encoder().encode(10), 0)) {
|
|
294
|
+
return 10 /* AssignWithSeed */;
|
|
295
|
+
}
|
|
296
|
+
if (memcmp(data, codecs.getU32Encoder().encode(11), 0)) {
|
|
297
|
+
return 11 /* TransferSolWithSeed */;
|
|
298
|
+
}
|
|
299
|
+
if (memcmp(data, codecs.getU32Encoder().encode(12), 0)) {
|
|
300
|
+
return 12 /* UpgradeNonceAccount */;
|
|
301
|
+
}
|
|
302
|
+
throw new Error(
|
|
303
|
+
"The provided instruction could not be identified as a system instruction."
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
239
307
|
// src/generated/instructions/advanceNonceAccount.ts
|
|
240
308
|
function getAdvanceNonceAccountInstructionDataEncoder() {
|
|
241
309
|
return codecs.mapEncoder(
|
|
@@ -253,8 +321,8 @@ function getAdvanceNonceAccountInstructionDataCodec() {
|
|
|
253
321
|
);
|
|
254
322
|
}
|
|
255
323
|
function getAdvanceNonceAccountInstruction(input) {
|
|
256
|
-
const programAddress =
|
|
257
|
-
const
|
|
324
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
325
|
+
const originalAccounts = {
|
|
258
326
|
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
|
|
259
327
|
recentBlockhashesSysvar: {
|
|
260
328
|
value: input.recentBlockhashesSysvar ?? null,
|
|
@@ -262,37 +330,21 @@ function getAdvanceNonceAccountInstruction(input) {
|
|
|
262
330
|
},
|
|
263
331
|
nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
|
|
264
332
|
};
|
|
333
|
+
const accounts = originalAccounts;
|
|
265
334
|
if (!accounts.recentBlockhashesSysvar.value) {
|
|
266
335
|
accounts.recentBlockhashesSysvar.value = "SysvarRecentB1ockHashes11111111111111111111";
|
|
267
336
|
}
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
"programId",
|
|
271
|
-
programAddress
|
|
272
|
-
);
|
|
273
|
-
const instruction = getAdvanceNonceAccountInstructionRaw(
|
|
274
|
-
accountMetas,
|
|
275
|
-
programAddress
|
|
276
|
-
);
|
|
277
|
-
return instruction;
|
|
278
|
-
}
|
|
279
|
-
function getAdvanceNonceAccountInstructionRaw(accounts, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
280
|
-
return {
|
|
337
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
338
|
+
const instruction = {
|
|
281
339
|
accounts: [
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
instructions.AccountRole.READONLY
|
|
286
|
-
),
|
|
287
|
-
accountMetaWithDefault(
|
|
288
|
-
accounts.nonceAuthority,
|
|
289
|
-
instructions.AccountRole.READONLY_SIGNER
|
|
290
|
-
),
|
|
291
|
-
...remainingAccounts ?? []
|
|
340
|
+
getAccountMeta(accounts.nonceAccount),
|
|
341
|
+
getAccountMeta(accounts.recentBlockhashesSysvar),
|
|
342
|
+
getAccountMeta(accounts.nonceAuthority)
|
|
292
343
|
],
|
|
293
|
-
|
|
294
|
-
|
|
344
|
+
programAddress,
|
|
345
|
+
data: getAdvanceNonceAccountInstructionDataEncoder().encode({})
|
|
295
346
|
};
|
|
347
|
+
return instruction;
|
|
296
348
|
}
|
|
297
349
|
function parseAdvanceNonceAccountInstruction(instruction) {
|
|
298
350
|
if (instruction.accounts.length < 3) {
|
|
@@ -338,32 +390,21 @@ function getAllocateInstructionDataCodec() {
|
|
|
338
390
|
);
|
|
339
391
|
}
|
|
340
392
|
function getAllocateInstruction(input) {
|
|
341
|
-
const programAddress =
|
|
342
|
-
const
|
|
393
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
394
|
+
const originalAccounts = {
|
|
343
395
|
newAccount: { value: input.newAccount ?? null, isWritable: true }
|
|
344
396
|
};
|
|
397
|
+
const accounts = originalAccounts;
|
|
345
398
|
const args = { ...input };
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
programAddress
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
args,
|
|
354
|
-
programAddress
|
|
355
|
-
);
|
|
356
|
-
return instruction;
|
|
357
|
-
}
|
|
358
|
-
function getAllocateInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
359
|
-
return {
|
|
360
|
-
accounts: [
|
|
361
|
-
accountMetaWithDefault(accounts.newAccount, instructions.AccountRole.WRITABLE_SIGNER),
|
|
362
|
-
...remainingAccounts ?? []
|
|
363
|
-
],
|
|
364
|
-
data: getAllocateInstructionDataEncoder().encode(args),
|
|
365
|
-
programAddress
|
|
399
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
400
|
+
const instruction = {
|
|
401
|
+
accounts: [getAccountMeta(accounts.newAccount)],
|
|
402
|
+
programAddress,
|
|
403
|
+
data: getAllocateInstructionDataEncoder().encode(
|
|
404
|
+
args
|
|
405
|
+
)
|
|
366
406
|
};
|
|
407
|
+
return instruction;
|
|
367
408
|
}
|
|
368
409
|
function parseAllocateInstruction(instruction) {
|
|
369
410
|
if (instruction.accounts.length < 1) {
|
|
@@ -411,34 +452,25 @@ function getAllocateWithSeedInstructionDataCodec() {
|
|
|
411
452
|
);
|
|
412
453
|
}
|
|
413
454
|
function getAllocateWithSeedInstruction(input) {
|
|
414
|
-
const programAddress =
|
|
415
|
-
const
|
|
455
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
456
|
+
const originalAccounts = {
|
|
416
457
|
newAccount: { value: input.newAccount ?? null, isWritable: true },
|
|
417
458
|
baseAccount: { value: input.baseAccount ?? null, isWritable: false }
|
|
418
459
|
};
|
|
460
|
+
const accounts = originalAccounts;
|
|
419
461
|
const args = { ...input };
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
"programId",
|
|
423
|
-
programAddress
|
|
424
|
-
);
|
|
425
|
-
const instruction = getAllocateWithSeedInstructionRaw(
|
|
426
|
-
accountMetas,
|
|
427
|
-
args,
|
|
428
|
-
programAddress
|
|
429
|
-
);
|
|
430
|
-
return instruction;
|
|
431
|
-
}
|
|
432
|
-
function getAllocateWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
433
|
-
return {
|
|
462
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
463
|
+
const instruction = {
|
|
434
464
|
accounts: [
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
...remainingAccounts ?? []
|
|
465
|
+
getAccountMeta(accounts.newAccount),
|
|
466
|
+
getAccountMeta(accounts.baseAccount)
|
|
438
467
|
],
|
|
439
|
-
|
|
440
|
-
|
|
468
|
+
programAddress,
|
|
469
|
+
data: getAllocateWithSeedInstructionDataEncoder().encode(
|
|
470
|
+
args
|
|
471
|
+
)
|
|
441
472
|
};
|
|
473
|
+
return instruction;
|
|
442
474
|
}
|
|
443
475
|
function parseAllocateWithSeedInstruction(instruction) {
|
|
444
476
|
if (instruction.accounts.length < 2) {
|
|
@@ -481,32 +513,21 @@ function getAssignInstructionDataCodec() {
|
|
|
481
513
|
);
|
|
482
514
|
}
|
|
483
515
|
function getAssignInstruction(input) {
|
|
484
|
-
const programAddress =
|
|
485
|
-
const
|
|
516
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
517
|
+
const originalAccounts = {
|
|
486
518
|
account: { value: input.account ?? null, isWritable: true }
|
|
487
519
|
};
|
|
520
|
+
const accounts = originalAccounts;
|
|
488
521
|
const args = { ...input };
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
programAddress
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
args,
|
|
497
|
-
programAddress
|
|
498
|
-
);
|
|
499
|
-
return instruction;
|
|
500
|
-
}
|
|
501
|
-
function getAssignInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
502
|
-
return {
|
|
503
|
-
accounts: [
|
|
504
|
-
accountMetaWithDefault(accounts.account, instructions.AccountRole.WRITABLE_SIGNER),
|
|
505
|
-
...remainingAccounts ?? []
|
|
506
|
-
],
|
|
507
|
-
data: getAssignInstructionDataEncoder().encode(args),
|
|
508
|
-
programAddress
|
|
522
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
523
|
+
const instruction = {
|
|
524
|
+
accounts: [getAccountMeta(accounts.account)],
|
|
525
|
+
programAddress,
|
|
526
|
+
data: getAssignInstructionDataEncoder().encode(
|
|
527
|
+
args
|
|
528
|
+
)
|
|
509
529
|
};
|
|
530
|
+
return instruction;
|
|
510
531
|
}
|
|
511
532
|
function parseAssignInstruction(instruction) {
|
|
512
533
|
if (instruction.accounts.length < 1) {
|
|
@@ -552,34 +573,25 @@ function getAssignWithSeedInstructionDataCodec() {
|
|
|
552
573
|
);
|
|
553
574
|
}
|
|
554
575
|
function getAssignWithSeedInstruction(input) {
|
|
555
|
-
const programAddress =
|
|
556
|
-
const
|
|
576
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
577
|
+
const originalAccounts = {
|
|
557
578
|
account: { value: input.account ?? null, isWritable: true },
|
|
558
579
|
baseAccount: { value: input.baseAccount ?? null, isWritable: false }
|
|
559
580
|
};
|
|
581
|
+
const accounts = originalAccounts;
|
|
560
582
|
const args = { ...input };
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
"programId",
|
|
564
|
-
programAddress
|
|
565
|
-
);
|
|
566
|
-
const instruction = getAssignWithSeedInstructionRaw(
|
|
567
|
-
accountMetas,
|
|
568
|
-
args,
|
|
569
|
-
programAddress
|
|
570
|
-
);
|
|
571
|
-
return instruction;
|
|
572
|
-
}
|
|
573
|
-
function getAssignWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
574
|
-
return {
|
|
583
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
584
|
+
const instruction = {
|
|
575
585
|
accounts: [
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
...remainingAccounts ?? []
|
|
586
|
+
getAccountMeta(accounts.account),
|
|
587
|
+
getAccountMeta(accounts.baseAccount)
|
|
579
588
|
],
|
|
580
|
-
|
|
581
|
-
|
|
589
|
+
programAddress,
|
|
590
|
+
data: getAssignWithSeedInstructionDataEncoder().encode(
|
|
591
|
+
args
|
|
592
|
+
)
|
|
582
593
|
};
|
|
594
|
+
return instruction;
|
|
583
595
|
}
|
|
584
596
|
function parseAssignWithSeedInstruction(instruction) {
|
|
585
597
|
if (instruction.accounts.length < 2) {
|
|
@@ -622,37 +634,25 @@ function getAuthorizeNonceAccountInstructionDataCodec() {
|
|
|
622
634
|
);
|
|
623
635
|
}
|
|
624
636
|
function getAuthorizeNonceAccountInstruction(input) {
|
|
625
|
-
const programAddress =
|
|
626
|
-
const
|
|
637
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
638
|
+
const originalAccounts = {
|
|
627
639
|
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
|
|
628
640
|
nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
|
|
629
641
|
};
|
|
642
|
+
const accounts = originalAccounts;
|
|
630
643
|
const args = { ...input };
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
"programId",
|
|
634
|
-
programAddress
|
|
635
|
-
);
|
|
636
|
-
const instruction = getAuthorizeNonceAccountInstructionRaw(
|
|
637
|
-
accountMetas,
|
|
638
|
-
args,
|
|
639
|
-
programAddress
|
|
640
|
-
);
|
|
641
|
-
return instruction;
|
|
642
|
-
}
|
|
643
|
-
function getAuthorizeNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
644
|
-
return {
|
|
644
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
645
|
+
const instruction = {
|
|
645
646
|
accounts: [
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
accounts.nonceAuthority,
|
|
649
|
-
instructions.AccountRole.READONLY_SIGNER
|
|
650
|
-
),
|
|
651
|
-
...remainingAccounts ?? []
|
|
647
|
+
getAccountMeta(accounts.nonceAccount),
|
|
648
|
+
getAccountMeta(accounts.nonceAuthority)
|
|
652
649
|
],
|
|
653
|
-
|
|
654
|
-
|
|
650
|
+
programAddress,
|
|
651
|
+
data: getAuthorizeNonceAccountInstructionDataEncoder().encode(
|
|
652
|
+
args
|
|
653
|
+
)
|
|
655
654
|
};
|
|
655
|
+
return instruction;
|
|
656
656
|
}
|
|
657
657
|
function parseAuthorizeNonceAccountInstruction(instruction) {
|
|
658
658
|
if (instruction.accounts.length < 2) {
|
|
@@ -701,38 +701,29 @@ function getCreateAccountInstructionDataCodec() {
|
|
|
701
701
|
);
|
|
702
702
|
}
|
|
703
703
|
function getCreateAccountInstruction(input) {
|
|
704
|
-
const programAddress =
|
|
705
|
-
const
|
|
704
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
705
|
+
const originalAccounts = {
|
|
706
706
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
707
707
|
newAccount: { value: input.newAccount ?? null, isWritable: true }
|
|
708
708
|
};
|
|
709
|
+
const accounts$1 = originalAccounts;
|
|
709
710
|
const args = { ...input };
|
|
710
711
|
const byteDelta = [Number(args.space) + accounts.BASE_ACCOUNT_SIZE].reduce(
|
|
711
712
|
(a, b) => a + b,
|
|
712
713
|
0
|
|
713
714
|
);
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
"programId",
|
|
717
|
-
programAddress
|
|
718
|
-
);
|
|
719
|
-
const instruction = getCreateAccountInstructionRaw(
|
|
720
|
-
accountMetas,
|
|
721
|
-
args,
|
|
722
|
-
programAddress
|
|
723
|
-
);
|
|
724
|
-
return Object.freeze({ ...instruction, byteDelta });
|
|
725
|
-
}
|
|
726
|
-
function getCreateAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
727
|
-
return {
|
|
715
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
716
|
+
const instruction = {
|
|
728
717
|
accounts: [
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
...remainingAccounts ?? []
|
|
718
|
+
getAccountMeta(accounts$1.payer),
|
|
719
|
+
getAccountMeta(accounts$1.newAccount)
|
|
732
720
|
],
|
|
733
|
-
|
|
734
|
-
|
|
721
|
+
programAddress,
|
|
722
|
+
data: getCreateAccountInstructionDataEncoder().encode(
|
|
723
|
+
args
|
|
724
|
+
)
|
|
735
725
|
};
|
|
726
|
+
return Object.freeze({ ...instruction, byteDelta });
|
|
736
727
|
}
|
|
737
728
|
function parseCreateAccountInstruction(instruction) {
|
|
738
729
|
if (instruction.accounts.length < 2) {
|
|
@@ -783,36 +774,27 @@ function getCreateAccountWithSeedInstructionDataCodec() {
|
|
|
783
774
|
);
|
|
784
775
|
}
|
|
785
776
|
function getCreateAccountWithSeedInstruction(input) {
|
|
786
|
-
const programAddress =
|
|
787
|
-
const
|
|
777
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
778
|
+
const originalAccounts = {
|
|
788
779
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
789
780
|
newAccount: { value: input.newAccount ?? null, isWritable: true },
|
|
790
781
|
baseAccount: { value: input.baseAccount ?? null, isWritable: false }
|
|
791
782
|
};
|
|
783
|
+
const accounts = originalAccounts;
|
|
792
784
|
const args = { ...input };
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
"programId",
|
|
796
|
-
programAddress
|
|
797
|
-
);
|
|
798
|
-
const instruction = getCreateAccountWithSeedInstructionRaw(
|
|
799
|
-
accountMetas,
|
|
800
|
-
args,
|
|
801
|
-
programAddress
|
|
802
|
-
);
|
|
803
|
-
return instruction;
|
|
804
|
-
}
|
|
805
|
-
function getCreateAccountWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
806
|
-
return {
|
|
785
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
786
|
+
const instruction = {
|
|
807
787
|
accounts: [
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
...remainingAccounts ?? []
|
|
788
|
+
getAccountMeta(accounts.payer),
|
|
789
|
+
getAccountMeta(accounts.newAccount),
|
|
790
|
+
getAccountMeta(accounts.baseAccount)
|
|
812
791
|
],
|
|
813
|
-
|
|
814
|
-
|
|
792
|
+
programAddress,
|
|
793
|
+
data: getCreateAccountWithSeedInstructionDataEncoder().encode(
|
|
794
|
+
args
|
|
795
|
+
)
|
|
815
796
|
};
|
|
797
|
+
return instruction;
|
|
816
798
|
}
|
|
817
799
|
function parseCreateAccountWithSeedInstruction(instruction) {
|
|
818
800
|
if (instruction.accounts.length < 3) {
|
|
@@ -858,8 +840,8 @@ function getInitializeNonceAccountInstructionDataCodec() {
|
|
|
858
840
|
);
|
|
859
841
|
}
|
|
860
842
|
function getInitializeNonceAccountInstruction(input) {
|
|
861
|
-
const programAddress =
|
|
862
|
-
const
|
|
843
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
844
|
+
const originalAccounts = {
|
|
863
845
|
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
|
|
864
846
|
recentBlockhashesSysvar: {
|
|
865
847
|
value: input.recentBlockhashesSysvar ?? null,
|
|
@@ -867,6 +849,7 @@ function getInitializeNonceAccountInstruction(input) {
|
|
|
867
849
|
},
|
|
868
850
|
rentSysvar: { value: input.rentSysvar ?? null, isWritable: false }
|
|
869
851
|
};
|
|
852
|
+
const accounts = originalAccounts;
|
|
870
853
|
const args = { ...input };
|
|
871
854
|
if (!accounts.recentBlockhashesSysvar.value) {
|
|
872
855
|
accounts.recentBlockhashesSysvar.value = "SysvarRecentB1ockHashes11111111111111111111";
|
|
@@ -874,35 +857,19 @@ function getInitializeNonceAccountInstruction(input) {
|
|
|
874
857
|
if (!accounts.rentSysvar.value) {
|
|
875
858
|
accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
|
|
876
859
|
}
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
"programId",
|
|
880
|
-
programAddress
|
|
881
|
-
);
|
|
882
|
-
const instruction = getInitializeNonceAccountInstructionRaw(
|
|
883
|
-
accountMetas,
|
|
884
|
-
args,
|
|
885
|
-
programAddress
|
|
886
|
-
);
|
|
887
|
-
return instruction;
|
|
888
|
-
}
|
|
889
|
-
function getInitializeNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
890
|
-
return {
|
|
860
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
861
|
+
const instruction = {
|
|
891
862
|
accounts: [
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
instructions.AccountRole.READONLY
|
|
896
|
-
),
|
|
897
|
-
accountMetaWithDefault(
|
|
898
|
-
accounts.rentSysvar ?? "SysvarRent111111111111111111111111111111111",
|
|
899
|
-
instructions.AccountRole.READONLY
|
|
900
|
-
),
|
|
901
|
-
...remainingAccounts ?? []
|
|
863
|
+
getAccountMeta(accounts.nonceAccount),
|
|
864
|
+
getAccountMeta(accounts.recentBlockhashesSysvar),
|
|
865
|
+
getAccountMeta(accounts.rentSysvar)
|
|
902
866
|
],
|
|
903
|
-
|
|
904
|
-
|
|
867
|
+
programAddress,
|
|
868
|
+
data: getInitializeNonceAccountInstructionDataEncoder().encode(
|
|
869
|
+
args
|
|
870
|
+
)
|
|
905
871
|
};
|
|
872
|
+
return instruction;
|
|
906
873
|
}
|
|
907
874
|
function parseInitializeNonceAccountInstruction(instruction) {
|
|
908
875
|
if (instruction.accounts.length < 3) {
|
|
@@ -948,34 +915,25 @@ function getTransferSolInstructionDataCodec() {
|
|
|
948
915
|
);
|
|
949
916
|
}
|
|
950
917
|
function getTransferSolInstruction(input) {
|
|
951
|
-
const programAddress =
|
|
952
|
-
const
|
|
918
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
919
|
+
const originalAccounts = {
|
|
953
920
|
source: { value: input.source ?? null, isWritable: true },
|
|
954
921
|
destination: { value: input.destination ?? null, isWritable: true }
|
|
955
922
|
};
|
|
923
|
+
const accounts = originalAccounts;
|
|
956
924
|
const args = { ...input };
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
-
"programId",
|
|
960
|
-
programAddress
|
|
961
|
-
);
|
|
962
|
-
const instruction = getTransferSolInstructionRaw(
|
|
963
|
-
accountMetas,
|
|
964
|
-
args,
|
|
965
|
-
programAddress
|
|
966
|
-
);
|
|
967
|
-
return instruction;
|
|
968
|
-
}
|
|
969
|
-
function getTransferSolInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
970
|
-
return {
|
|
925
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
926
|
+
const instruction = {
|
|
971
927
|
accounts: [
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
...remainingAccounts ?? []
|
|
928
|
+
getAccountMeta(accounts.source),
|
|
929
|
+
getAccountMeta(accounts.destination)
|
|
975
930
|
],
|
|
976
|
-
|
|
977
|
-
|
|
931
|
+
programAddress,
|
|
932
|
+
data: getTransferSolInstructionDataEncoder().encode(
|
|
933
|
+
args
|
|
934
|
+
)
|
|
978
935
|
};
|
|
936
|
+
return instruction;
|
|
979
937
|
}
|
|
980
938
|
function parseTransferSolInstruction(instruction) {
|
|
981
939
|
if (instruction.accounts.length < 2) {
|
|
@@ -1022,36 +980,27 @@ function getTransferSolWithSeedInstructionDataCodec() {
|
|
|
1022
980
|
);
|
|
1023
981
|
}
|
|
1024
982
|
function getTransferSolWithSeedInstruction(input) {
|
|
1025
|
-
const programAddress =
|
|
1026
|
-
const
|
|
983
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
984
|
+
const originalAccounts = {
|
|
1027
985
|
source: { value: input.source ?? null, isWritable: true },
|
|
1028
986
|
baseAccount: { value: input.baseAccount ?? null, isWritable: false },
|
|
1029
987
|
destination: { value: input.destination ?? null, isWritable: true }
|
|
1030
988
|
};
|
|
989
|
+
const accounts = originalAccounts;
|
|
1031
990
|
const args = { ...input };
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1034
|
-
"programId",
|
|
1035
|
-
programAddress
|
|
1036
|
-
);
|
|
1037
|
-
const instruction = getTransferSolWithSeedInstructionRaw(
|
|
1038
|
-
accountMetas,
|
|
1039
|
-
args,
|
|
1040
|
-
programAddress
|
|
1041
|
-
);
|
|
1042
|
-
return instruction;
|
|
1043
|
-
}
|
|
1044
|
-
function getTransferSolWithSeedInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1045
|
-
return {
|
|
991
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
992
|
+
const instruction = {
|
|
1046
993
|
accounts: [
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
...remainingAccounts ?? []
|
|
994
|
+
getAccountMeta(accounts.source),
|
|
995
|
+
getAccountMeta(accounts.baseAccount),
|
|
996
|
+
getAccountMeta(accounts.destination)
|
|
1051
997
|
],
|
|
1052
|
-
|
|
1053
|
-
|
|
998
|
+
programAddress,
|
|
999
|
+
data: getTransferSolWithSeedInstructionDataEncoder().encode(
|
|
1000
|
+
args
|
|
1001
|
+
)
|
|
1054
1002
|
};
|
|
1003
|
+
return instruction;
|
|
1055
1004
|
}
|
|
1056
1005
|
function parseTransferSolWithSeedInstruction(instruction) {
|
|
1057
1006
|
if (instruction.accounts.length < 3) {
|
|
@@ -1091,30 +1040,18 @@ function getUpgradeNonceAccountInstructionDataCodec() {
|
|
|
1091
1040
|
);
|
|
1092
1041
|
}
|
|
1093
1042
|
function getUpgradeNonceAccountInstruction(input) {
|
|
1094
|
-
const programAddress =
|
|
1095
|
-
const
|
|
1043
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
1044
|
+
const originalAccounts = {
|
|
1096
1045
|
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true }
|
|
1097
1046
|
};
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
accountMetas,
|
|
1105
|
-
programAddress
|
|
1106
|
-
);
|
|
1107
|
-
return instruction;
|
|
1108
|
-
}
|
|
1109
|
-
function getUpgradeNonceAccountInstructionRaw(accounts, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1110
|
-
return {
|
|
1111
|
-
accounts: [
|
|
1112
|
-
accountMetaWithDefault(accounts.nonceAccount, instructions.AccountRole.WRITABLE),
|
|
1113
|
-
...remainingAccounts ?? []
|
|
1114
|
-
],
|
|
1115
|
-
data: getUpgradeNonceAccountInstructionDataEncoder().encode({}),
|
|
1116
|
-
programAddress
|
|
1047
|
+
const accounts = originalAccounts;
|
|
1048
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1049
|
+
const instruction = {
|
|
1050
|
+
accounts: [getAccountMeta(accounts.nonceAccount)],
|
|
1051
|
+
programAddress,
|
|
1052
|
+
data: getUpgradeNonceAccountInstructionDataEncoder().encode({})
|
|
1117
1053
|
};
|
|
1054
|
+
return instruction;
|
|
1118
1055
|
}
|
|
1119
1056
|
function parseUpgradeNonceAccountInstruction(instruction) {
|
|
1120
1057
|
if (instruction.accounts.length < 1) {
|
|
@@ -1158,8 +1095,8 @@ function getWithdrawNonceAccountInstructionDataCodec() {
|
|
|
1158
1095
|
);
|
|
1159
1096
|
}
|
|
1160
1097
|
function getWithdrawNonceAccountInstruction(input) {
|
|
1161
|
-
const programAddress =
|
|
1162
|
-
const
|
|
1098
|
+
const programAddress = SYSTEM_PROGRAM_ADDRESS;
|
|
1099
|
+
const originalAccounts = {
|
|
1163
1100
|
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
|
|
1164
1101
|
recipientAccount: {
|
|
1165
1102
|
value: input.recipientAccount ?? null,
|
|
@@ -1172,6 +1109,7 @@ function getWithdrawNonceAccountInstruction(input) {
|
|
|
1172
1109
|
rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },
|
|
1173
1110
|
nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
|
|
1174
1111
|
};
|
|
1112
|
+
const accounts = originalAccounts;
|
|
1175
1113
|
const args = { ...input };
|
|
1176
1114
|
if (!accounts.recentBlockhashesSysvar.value) {
|
|
1177
1115
|
accounts.recentBlockhashesSysvar.value = "SysvarRecentB1ockHashes11111111111111111111";
|
|
@@ -1179,40 +1117,21 @@ function getWithdrawNonceAccountInstruction(input) {
|
|
|
1179
1117
|
if (!accounts.rentSysvar.value) {
|
|
1180
1118
|
accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
|
|
1181
1119
|
}
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
"programId",
|
|
1185
|
-
programAddress
|
|
1186
|
-
);
|
|
1187
|
-
const instruction = getWithdrawNonceAccountInstructionRaw(
|
|
1188
|
-
accountMetas,
|
|
1189
|
-
args,
|
|
1190
|
-
programAddress
|
|
1191
|
-
);
|
|
1192
|
-
return instruction;
|
|
1193
|
-
}
|
|
1194
|
-
function getWithdrawNonceAccountInstructionRaw(accounts, args, programAddress = "11111111111111111111111111111111", remainingAccounts) {
|
|
1195
|
-
return {
|
|
1120
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1121
|
+
const instruction = {
|
|
1196
1122
|
accounts: [
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
),
|
|
1203
|
-
accountMetaWithDefault(
|
|
1204
|
-
accounts.rentSysvar ?? "SysvarRent111111111111111111111111111111111",
|
|
1205
|
-
instructions.AccountRole.READONLY
|
|
1206
|
-
),
|
|
1207
|
-
accountMetaWithDefault(
|
|
1208
|
-
accounts.nonceAuthority,
|
|
1209
|
-
instructions.AccountRole.READONLY_SIGNER
|
|
1210
|
-
),
|
|
1211
|
-
...remainingAccounts ?? []
|
|
1123
|
+
getAccountMeta(accounts.nonceAccount),
|
|
1124
|
+
getAccountMeta(accounts.recipientAccount),
|
|
1125
|
+
getAccountMeta(accounts.recentBlockhashesSysvar),
|
|
1126
|
+
getAccountMeta(accounts.rentSysvar),
|
|
1127
|
+
getAccountMeta(accounts.nonceAuthority)
|
|
1212
1128
|
],
|
|
1213
|
-
|
|
1214
|
-
|
|
1129
|
+
programAddress,
|
|
1130
|
+
data: getWithdrawNonceAccountInstructionDataEncoder().encode(
|
|
1131
|
+
args
|
|
1132
|
+
)
|
|
1215
1133
|
};
|
|
1134
|
+
return instruction;
|
|
1216
1135
|
}
|
|
1217
1136
|
function parseWithdrawNonceAccountInstruction(instruction) {
|
|
1218
1137
|
if (instruction.accounts.length < 5) {
|
|
@@ -1238,81 +1157,6 @@ function parseWithdrawNonceAccountInstruction(instruction) {
|
|
|
1238
1157
|
)
|
|
1239
1158
|
};
|
|
1240
1159
|
}
|
|
1241
|
-
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
1242
|
-
function getSystemProgram() {
|
|
1243
|
-
return {
|
|
1244
|
-
name: "system",
|
|
1245
|
-
address: SYSTEM_PROGRAM_ADDRESS,
|
|
1246
|
-
getErrorFromCode(code, cause) {
|
|
1247
|
-
return getSystemProgramErrorFromCode(code, cause);
|
|
1248
|
-
}
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
var SystemAccount = /* @__PURE__ */ ((SystemAccount2) => {
|
|
1252
|
-
SystemAccount2[SystemAccount2["Nonce"] = 0] = "Nonce";
|
|
1253
|
-
return SystemAccount2;
|
|
1254
|
-
})(SystemAccount || {});
|
|
1255
|
-
var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
|
|
1256
|
-
SystemInstruction2[SystemInstruction2["CreateAccount"] = 0] = "CreateAccount";
|
|
1257
|
-
SystemInstruction2[SystemInstruction2["Assign"] = 1] = "Assign";
|
|
1258
|
-
SystemInstruction2[SystemInstruction2["TransferSol"] = 2] = "TransferSol";
|
|
1259
|
-
SystemInstruction2[SystemInstruction2["CreateAccountWithSeed"] = 3] = "CreateAccountWithSeed";
|
|
1260
|
-
SystemInstruction2[SystemInstruction2["AdvanceNonceAccount"] = 4] = "AdvanceNonceAccount";
|
|
1261
|
-
SystemInstruction2[SystemInstruction2["WithdrawNonceAccount"] = 5] = "WithdrawNonceAccount";
|
|
1262
|
-
SystemInstruction2[SystemInstruction2["InitializeNonceAccount"] = 6] = "InitializeNonceAccount";
|
|
1263
|
-
SystemInstruction2[SystemInstruction2["AuthorizeNonceAccount"] = 7] = "AuthorizeNonceAccount";
|
|
1264
|
-
SystemInstruction2[SystemInstruction2["Allocate"] = 8] = "Allocate";
|
|
1265
|
-
SystemInstruction2[SystemInstruction2["AllocateWithSeed"] = 9] = "AllocateWithSeed";
|
|
1266
|
-
SystemInstruction2[SystemInstruction2["AssignWithSeed"] = 10] = "AssignWithSeed";
|
|
1267
|
-
SystemInstruction2[SystemInstruction2["TransferSolWithSeed"] = 11] = "TransferSolWithSeed";
|
|
1268
|
-
SystemInstruction2[SystemInstruction2["UpgradeNonceAccount"] = 12] = "UpgradeNonceAccount";
|
|
1269
|
-
return SystemInstruction2;
|
|
1270
|
-
})(SystemInstruction || {});
|
|
1271
|
-
function identifySystemInstruction(instruction) {
|
|
1272
|
-
const data = instruction instanceof Uint8Array ? instruction : instruction.data;
|
|
1273
|
-
if (memcmp(data, codecs.getU32Encoder().encode(0), 0)) {
|
|
1274
|
-
return 0 /* CreateAccount */;
|
|
1275
|
-
}
|
|
1276
|
-
if (memcmp(data, codecs.getU32Encoder().encode(1), 0)) {
|
|
1277
|
-
return 1 /* Assign */;
|
|
1278
|
-
}
|
|
1279
|
-
if (memcmp(data, codecs.getU32Encoder().encode(2), 0)) {
|
|
1280
|
-
return 2 /* TransferSol */;
|
|
1281
|
-
}
|
|
1282
|
-
if (memcmp(data, codecs.getU32Encoder().encode(3), 0)) {
|
|
1283
|
-
return 3 /* CreateAccountWithSeed */;
|
|
1284
|
-
}
|
|
1285
|
-
if (memcmp(data, codecs.getU32Encoder().encode(4), 0)) {
|
|
1286
|
-
return 4 /* AdvanceNonceAccount */;
|
|
1287
|
-
}
|
|
1288
|
-
if (memcmp(data, codecs.getU32Encoder().encode(5), 0)) {
|
|
1289
|
-
return 5 /* WithdrawNonceAccount */;
|
|
1290
|
-
}
|
|
1291
|
-
if (memcmp(data, codecs.getU32Encoder().encode(6), 0)) {
|
|
1292
|
-
return 6 /* InitializeNonceAccount */;
|
|
1293
|
-
}
|
|
1294
|
-
if (memcmp(data, codecs.getU32Encoder().encode(7), 0)) {
|
|
1295
|
-
return 7 /* AuthorizeNonceAccount */;
|
|
1296
|
-
}
|
|
1297
|
-
if (memcmp(data, codecs.getU32Encoder().encode(8), 0)) {
|
|
1298
|
-
return 8 /* Allocate */;
|
|
1299
|
-
}
|
|
1300
|
-
if (memcmp(data, codecs.getU32Encoder().encode(9), 0)) {
|
|
1301
|
-
return 9 /* AllocateWithSeed */;
|
|
1302
|
-
}
|
|
1303
|
-
if (memcmp(data, codecs.getU32Encoder().encode(10), 0)) {
|
|
1304
|
-
return 10 /* AssignWithSeed */;
|
|
1305
|
-
}
|
|
1306
|
-
if (memcmp(data, codecs.getU32Encoder().encode(11), 0)) {
|
|
1307
|
-
return 11 /* TransferSolWithSeed */;
|
|
1308
|
-
}
|
|
1309
|
-
if (memcmp(data, codecs.getU32Encoder().encode(12), 0)) {
|
|
1310
|
-
return 12 /* UpgradeNonceAccount */;
|
|
1311
|
-
}
|
|
1312
|
-
throw new Error(
|
|
1313
|
-
"The provided instruction could not be identified as a system instruction."
|
|
1314
|
-
);
|
|
1315
|
-
}
|
|
1316
1160
|
|
|
1317
1161
|
exports.NonceState = NonceState;
|
|
1318
1162
|
exports.NonceVersion = NonceVersion;
|
|
@@ -1321,7 +1165,6 @@ exports.SystemAccount = SystemAccount;
|
|
|
1321
1165
|
exports.SystemInstruction = SystemInstruction;
|
|
1322
1166
|
exports.SystemProgramError = SystemProgramError;
|
|
1323
1167
|
exports.SystemProgramErrorCode = SystemProgramErrorCode;
|
|
1324
|
-
exports.accountMetaWithDefault = accountMetaWithDefault;
|
|
1325
1168
|
exports.decodeNonce = decodeNonce;
|
|
1326
1169
|
exports.expectAddress = expectAddress;
|
|
1327
1170
|
exports.expectProgramDerivedAddress = expectProgramDerivedAddress;
|
|
@@ -1331,52 +1174,43 @@ exports.fetchAllMaybeNonce = fetchAllMaybeNonce;
|
|
|
1331
1174
|
exports.fetchAllNonce = fetchAllNonce;
|
|
1332
1175
|
exports.fetchMaybeNonce = fetchMaybeNonce;
|
|
1333
1176
|
exports.fetchNonce = fetchNonce;
|
|
1334
|
-
exports.
|
|
1177
|
+
exports.getAccountMetaFactory = getAccountMetaFactory;
|
|
1335
1178
|
exports.getAdvanceNonceAccountInstruction = getAdvanceNonceAccountInstruction;
|
|
1336
1179
|
exports.getAdvanceNonceAccountInstructionDataCodec = getAdvanceNonceAccountInstructionDataCodec;
|
|
1337
1180
|
exports.getAdvanceNonceAccountInstructionDataDecoder = getAdvanceNonceAccountInstructionDataDecoder;
|
|
1338
1181
|
exports.getAdvanceNonceAccountInstructionDataEncoder = getAdvanceNonceAccountInstructionDataEncoder;
|
|
1339
|
-
exports.getAdvanceNonceAccountInstructionRaw = getAdvanceNonceAccountInstructionRaw;
|
|
1340
1182
|
exports.getAllocateInstruction = getAllocateInstruction;
|
|
1341
1183
|
exports.getAllocateInstructionDataCodec = getAllocateInstructionDataCodec;
|
|
1342
1184
|
exports.getAllocateInstructionDataDecoder = getAllocateInstructionDataDecoder;
|
|
1343
1185
|
exports.getAllocateInstructionDataEncoder = getAllocateInstructionDataEncoder;
|
|
1344
|
-
exports.getAllocateInstructionRaw = getAllocateInstructionRaw;
|
|
1345
1186
|
exports.getAllocateWithSeedInstruction = getAllocateWithSeedInstruction;
|
|
1346
1187
|
exports.getAllocateWithSeedInstructionDataCodec = getAllocateWithSeedInstructionDataCodec;
|
|
1347
1188
|
exports.getAllocateWithSeedInstructionDataDecoder = getAllocateWithSeedInstructionDataDecoder;
|
|
1348
1189
|
exports.getAllocateWithSeedInstructionDataEncoder = getAllocateWithSeedInstructionDataEncoder;
|
|
1349
|
-
exports.getAllocateWithSeedInstructionRaw = getAllocateWithSeedInstructionRaw;
|
|
1350
1190
|
exports.getAssignInstruction = getAssignInstruction;
|
|
1351
1191
|
exports.getAssignInstructionDataCodec = getAssignInstructionDataCodec;
|
|
1352
1192
|
exports.getAssignInstructionDataDecoder = getAssignInstructionDataDecoder;
|
|
1353
1193
|
exports.getAssignInstructionDataEncoder = getAssignInstructionDataEncoder;
|
|
1354
|
-
exports.getAssignInstructionRaw = getAssignInstructionRaw;
|
|
1355
1194
|
exports.getAssignWithSeedInstruction = getAssignWithSeedInstruction;
|
|
1356
1195
|
exports.getAssignWithSeedInstructionDataCodec = getAssignWithSeedInstructionDataCodec;
|
|
1357
1196
|
exports.getAssignWithSeedInstructionDataDecoder = getAssignWithSeedInstructionDataDecoder;
|
|
1358
1197
|
exports.getAssignWithSeedInstructionDataEncoder = getAssignWithSeedInstructionDataEncoder;
|
|
1359
|
-
exports.getAssignWithSeedInstructionRaw = getAssignWithSeedInstructionRaw;
|
|
1360
1198
|
exports.getAuthorizeNonceAccountInstruction = getAuthorizeNonceAccountInstruction;
|
|
1361
1199
|
exports.getAuthorizeNonceAccountInstructionDataCodec = getAuthorizeNonceAccountInstructionDataCodec;
|
|
1362
1200
|
exports.getAuthorizeNonceAccountInstructionDataDecoder = getAuthorizeNonceAccountInstructionDataDecoder;
|
|
1363
1201
|
exports.getAuthorizeNonceAccountInstructionDataEncoder = getAuthorizeNonceAccountInstructionDataEncoder;
|
|
1364
|
-
exports.getAuthorizeNonceAccountInstructionRaw = getAuthorizeNonceAccountInstructionRaw;
|
|
1365
1202
|
exports.getCreateAccountInstruction = getCreateAccountInstruction;
|
|
1366
1203
|
exports.getCreateAccountInstructionDataCodec = getCreateAccountInstructionDataCodec;
|
|
1367
1204
|
exports.getCreateAccountInstructionDataDecoder = getCreateAccountInstructionDataDecoder;
|
|
1368
1205
|
exports.getCreateAccountInstructionDataEncoder = getCreateAccountInstructionDataEncoder;
|
|
1369
|
-
exports.getCreateAccountInstructionRaw = getCreateAccountInstructionRaw;
|
|
1370
1206
|
exports.getCreateAccountWithSeedInstruction = getCreateAccountWithSeedInstruction;
|
|
1371
1207
|
exports.getCreateAccountWithSeedInstructionDataCodec = getCreateAccountWithSeedInstructionDataCodec;
|
|
1372
1208
|
exports.getCreateAccountWithSeedInstructionDataDecoder = getCreateAccountWithSeedInstructionDataDecoder;
|
|
1373
1209
|
exports.getCreateAccountWithSeedInstructionDataEncoder = getCreateAccountWithSeedInstructionDataEncoder;
|
|
1374
|
-
exports.getCreateAccountWithSeedInstructionRaw = getCreateAccountWithSeedInstructionRaw;
|
|
1375
1210
|
exports.getInitializeNonceAccountInstruction = getInitializeNonceAccountInstruction;
|
|
1376
1211
|
exports.getInitializeNonceAccountInstructionDataCodec = getInitializeNonceAccountInstructionDataCodec;
|
|
1377
1212
|
exports.getInitializeNonceAccountInstructionDataDecoder = getInitializeNonceAccountInstructionDataDecoder;
|
|
1378
1213
|
exports.getInitializeNonceAccountInstructionDataEncoder = getInitializeNonceAccountInstructionDataEncoder;
|
|
1379
|
-
exports.getInitializeNonceAccountInstructionRaw = getInitializeNonceAccountInstructionRaw;
|
|
1380
1214
|
exports.getNonceAccountDataCodec = getNonceAccountDataCodec;
|
|
1381
1215
|
exports.getNonceAccountDataDecoder = getNonceAccountDataDecoder;
|
|
1382
1216
|
exports.getNonceAccountDataEncoder = getNonceAccountDataEncoder;
|
|
@@ -1393,22 +1227,18 @@ exports.getTransferSolInstruction = getTransferSolInstruction;
|
|
|
1393
1227
|
exports.getTransferSolInstructionDataCodec = getTransferSolInstructionDataCodec;
|
|
1394
1228
|
exports.getTransferSolInstructionDataDecoder = getTransferSolInstructionDataDecoder;
|
|
1395
1229
|
exports.getTransferSolInstructionDataEncoder = getTransferSolInstructionDataEncoder;
|
|
1396
|
-
exports.getTransferSolInstructionRaw = getTransferSolInstructionRaw;
|
|
1397
1230
|
exports.getTransferSolWithSeedInstruction = getTransferSolWithSeedInstruction;
|
|
1398
1231
|
exports.getTransferSolWithSeedInstructionDataCodec = getTransferSolWithSeedInstructionDataCodec;
|
|
1399
1232
|
exports.getTransferSolWithSeedInstructionDataDecoder = getTransferSolWithSeedInstructionDataDecoder;
|
|
1400
1233
|
exports.getTransferSolWithSeedInstructionDataEncoder = getTransferSolWithSeedInstructionDataEncoder;
|
|
1401
|
-
exports.getTransferSolWithSeedInstructionRaw = getTransferSolWithSeedInstructionRaw;
|
|
1402
1234
|
exports.getUpgradeNonceAccountInstruction = getUpgradeNonceAccountInstruction;
|
|
1403
1235
|
exports.getUpgradeNonceAccountInstructionDataCodec = getUpgradeNonceAccountInstructionDataCodec;
|
|
1404
1236
|
exports.getUpgradeNonceAccountInstructionDataDecoder = getUpgradeNonceAccountInstructionDataDecoder;
|
|
1405
1237
|
exports.getUpgradeNonceAccountInstructionDataEncoder = getUpgradeNonceAccountInstructionDataEncoder;
|
|
1406
|
-
exports.getUpgradeNonceAccountInstructionRaw = getUpgradeNonceAccountInstructionRaw;
|
|
1407
1238
|
exports.getWithdrawNonceAccountInstruction = getWithdrawNonceAccountInstruction;
|
|
1408
1239
|
exports.getWithdrawNonceAccountInstructionDataCodec = getWithdrawNonceAccountInstructionDataCodec;
|
|
1409
1240
|
exports.getWithdrawNonceAccountInstructionDataDecoder = getWithdrawNonceAccountInstructionDataDecoder;
|
|
1410
1241
|
exports.getWithdrawNonceAccountInstructionDataEncoder = getWithdrawNonceAccountInstructionDataEncoder;
|
|
1411
|
-
exports.getWithdrawNonceAccountInstructionRaw = getWithdrawNonceAccountInstructionRaw;
|
|
1412
1242
|
exports.identifySystemInstruction = identifySystemInstruction;
|
|
1413
1243
|
exports.isTransactionSigner = isTransactionSigner;
|
|
1414
1244
|
exports.memcmp = memcmp;
|