@solana-program/system 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.js +137 -83
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +138 -85
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/allocate.d.ts.map +1 -1
- package/dist/types/generated/instructions/allocateWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/assign.d.ts.map +1 -1
- package/dist/types/generated/instructions/assignWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/createAccount.d.ts +1 -1
- package/dist/types/generated/instructions/createAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/transferSol.d.ts.map +1 -1
- package/dist/types/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/programs/system.d.ts +32 -2
- package/dist/types/generated/programs/system.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/types/generated/shared/index.d.ts +0 -50
- package/dist/types/generated/shared/index.d.ts.map +0 -1
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var kit = require('@solana/kit');
|
|
4
|
+
var programClientCore = require('@solana/kit/program-client-core');
|
|
4
5
|
|
|
5
6
|
// src/generated/accounts/nonce.ts
|
|
6
7
|
var NonceState = /* @__PURE__ */ ((NonceState2) => {
|
|
@@ -78,36 +79,6 @@ async function fetchAllMaybeNonce(rpc, addresses, config) {
|
|
|
78
79
|
function getNonceSize() {
|
|
79
80
|
return 80;
|
|
80
81
|
}
|
|
81
|
-
function expectAddress(value) {
|
|
82
|
-
if (!value) {
|
|
83
|
-
throw new Error("Expected a Address.");
|
|
84
|
-
}
|
|
85
|
-
if (typeof value === "object" && "address" in value) {
|
|
86
|
-
return value.address;
|
|
87
|
-
}
|
|
88
|
-
if (Array.isArray(value)) {
|
|
89
|
-
return value[0];
|
|
90
|
-
}
|
|
91
|
-
return value;
|
|
92
|
-
}
|
|
93
|
-
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
94
|
-
return (account) => {
|
|
95
|
-
if (!account.value) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const writableRole = account.isWritable ? kit.AccountRole.WRITABLE : kit.AccountRole.READONLY;
|
|
99
|
-
return Object.freeze({
|
|
100
|
-
address: expectAddress(account.value),
|
|
101
|
-
role: isTransactionSigner(account.value) ? kit.upgradeRoleToSigner(writableRole) : writableRole,
|
|
102
|
-
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function isTransactionSigner(value) {
|
|
107
|
-
return !!value && typeof value === "object" && "address" in value && kit.isTransactionSigner(value);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// src/generated/instructions/advanceNonceAccount.ts
|
|
111
82
|
var ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR = 4;
|
|
112
83
|
function getAdvanceNonceAccountDiscriminatorBytes() {
|
|
113
84
|
return kit.getU32Encoder().encode(ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR);
|
|
@@ -135,12 +106,12 @@ function getAdvanceNonceAccountInstruction(input, config) {
|
|
|
135
106
|
if (!accounts.recentBlockhashesSysvar.value) {
|
|
136
107
|
accounts.recentBlockhashesSysvar.value = "SysvarRecentB1ockHashes11111111111111111111";
|
|
137
108
|
}
|
|
138
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
109
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
139
110
|
return Object.freeze({
|
|
140
111
|
accounts: [
|
|
141
|
-
getAccountMeta(accounts.nonceAccount),
|
|
142
|
-
getAccountMeta(accounts.recentBlockhashesSysvar),
|
|
143
|
-
getAccountMeta(accounts.nonceAuthority)
|
|
112
|
+
getAccountMeta("nonceAccount", accounts.nonceAccount),
|
|
113
|
+
getAccountMeta("recentBlockhashesSysvar", accounts.recentBlockhashesSysvar),
|
|
114
|
+
getAccountMeta("nonceAuthority", accounts.nonceAuthority)
|
|
144
115
|
],
|
|
145
116
|
data: getAdvanceNonceAccountInstructionDataEncoder().encode({}),
|
|
146
117
|
programAddress
|
|
@@ -148,7 +119,10 @@ function getAdvanceNonceAccountInstruction(input, config) {
|
|
|
148
119
|
}
|
|
149
120
|
function parseAdvanceNonceAccountInstruction(instruction) {
|
|
150
121
|
if (instruction.accounts.length < 3) {
|
|
151
|
-
throw new
|
|
122
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
123
|
+
actualAccountMetas: instruction.accounts.length,
|
|
124
|
+
expectedAccountMetas: 3
|
|
125
|
+
});
|
|
152
126
|
}
|
|
153
127
|
let accountIndex = 0;
|
|
154
128
|
const getNextAccount = () => {
|
|
@@ -193,16 +167,19 @@ function getAllocateInstruction(input, config) {
|
|
|
193
167
|
const originalAccounts = { newAccount: { value: input.newAccount ?? null, isWritable: true } };
|
|
194
168
|
const accounts = originalAccounts;
|
|
195
169
|
const args = { ...input };
|
|
196
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
170
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
197
171
|
return Object.freeze({
|
|
198
|
-
accounts: [getAccountMeta(accounts.newAccount)],
|
|
172
|
+
accounts: [getAccountMeta("newAccount", accounts.newAccount)],
|
|
199
173
|
data: getAllocateInstructionDataEncoder().encode(args),
|
|
200
174
|
programAddress
|
|
201
175
|
});
|
|
202
176
|
}
|
|
203
177
|
function parseAllocateInstruction(instruction) {
|
|
204
178
|
if (instruction.accounts.length < 1) {
|
|
205
|
-
throw new
|
|
179
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
180
|
+
actualAccountMetas: instruction.accounts.length,
|
|
181
|
+
expectedAccountMetas: 1
|
|
182
|
+
});
|
|
206
183
|
}
|
|
207
184
|
let accountIndex = 0;
|
|
208
185
|
const getNextAccount = () => {
|
|
@@ -252,16 +229,22 @@ function getAllocateWithSeedInstruction(input, config) {
|
|
|
252
229
|
};
|
|
253
230
|
const accounts = originalAccounts;
|
|
254
231
|
const args = { ...input };
|
|
255
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
232
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
256
233
|
return Object.freeze({
|
|
257
|
-
accounts: [
|
|
234
|
+
accounts: [
|
|
235
|
+
getAccountMeta("newAccount", accounts.newAccount),
|
|
236
|
+
getAccountMeta("baseAccount", accounts.baseAccount)
|
|
237
|
+
],
|
|
258
238
|
data: getAllocateWithSeedInstructionDataEncoder().encode(args),
|
|
259
239
|
programAddress
|
|
260
240
|
});
|
|
261
241
|
}
|
|
262
242
|
function parseAllocateWithSeedInstruction(instruction) {
|
|
263
243
|
if (instruction.accounts.length < 2) {
|
|
264
|
-
throw new
|
|
244
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
245
|
+
actualAccountMetas: instruction.accounts.length,
|
|
246
|
+
expectedAccountMetas: 2
|
|
247
|
+
});
|
|
265
248
|
}
|
|
266
249
|
let accountIndex = 0;
|
|
267
250
|
const getNextAccount = () => {
|
|
@@ -302,16 +285,19 @@ function getAssignInstruction(input, config) {
|
|
|
302
285
|
const originalAccounts = { account: { value: input.account ?? null, isWritable: true } };
|
|
303
286
|
const accounts = originalAccounts;
|
|
304
287
|
const args = { ...input };
|
|
305
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
288
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
306
289
|
return Object.freeze({
|
|
307
|
-
accounts: [getAccountMeta(accounts.account)],
|
|
290
|
+
accounts: [getAccountMeta("account", accounts.account)],
|
|
308
291
|
data: getAssignInstructionDataEncoder().encode(args),
|
|
309
292
|
programAddress
|
|
310
293
|
});
|
|
311
294
|
}
|
|
312
295
|
function parseAssignInstruction(instruction) {
|
|
313
296
|
if (instruction.accounts.length < 1) {
|
|
314
|
-
throw new
|
|
297
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
298
|
+
actualAccountMetas: instruction.accounts.length,
|
|
299
|
+
expectedAccountMetas: 1
|
|
300
|
+
});
|
|
315
301
|
}
|
|
316
302
|
let accountIndex = 0;
|
|
317
303
|
const getNextAccount = () => {
|
|
@@ -359,16 +345,19 @@ function getAssignWithSeedInstruction(input, config) {
|
|
|
359
345
|
};
|
|
360
346
|
const accounts = originalAccounts;
|
|
361
347
|
const args = { ...input };
|
|
362
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
348
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
363
349
|
return Object.freeze({
|
|
364
|
-
accounts: [getAccountMeta(accounts.account), getAccountMeta(accounts.baseAccount)],
|
|
350
|
+
accounts: [getAccountMeta("account", accounts.account), getAccountMeta("baseAccount", accounts.baseAccount)],
|
|
365
351
|
data: getAssignWithSeedInstructionDataEncoder().encode(args),
|
|
366
352
|
programAddress
|
|
367
353
|
});
|
|
368
354
|
}
|
|
369
355
|
function parseAssignWithSeedInstruction(instruction) {
|
|
370
356
|
if (instruction.accounts.length < 2) {
|
|
371
|
-
throw new
|
|
357
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
358
|
+
actualAccountMetas: instruction.accounts.length,
|
|
359
|
+
expectedAccountMetas: 2
|
|
360
|
+
});
|
|
372
361
|
}
|
|
373
362
|
let accountIndex = 0;
|
|
374
363
|
const getNextAccount = () => {
|
|
@@ -415,16 +404,22 @@ function getAuthorizeNonceAccountInstruction(input, config) {
|
|
|
415
404
|
};
|
|
416
405
|
const accounts = originalAccounts;
|
|
417
406
|
const args = { ...input };
|
|
418
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
407
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
419
408
|
return Object.freeze({
|
|
420
|
-
accounts: [
|
|
409
|
+
accounts: [
|
|
410
|
+
getAccountMeta("nonceAccount", accounts.nonceAccount),
|
|
411
|
+
getAccountMeta("nonceAuthority", accounts.nonceAuthority)
|
|
412
|
+
],
|
|
421
413
|
data: getAuthorizeNonceAccountInstructionDataEncoder().encode(args),
|
|
422
414
|
programAddress
|
|
423
415
|
});
|
|
424
416
|
}
|
|
425
417
|
function parseAuthorizeNonceAccountInstruction(instruction) {
|
|
426
418
|
if (instruction.accounts.length < 2) {
|
|
427
|
-
throw new
|
|
419
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
420
|
+
actualAccountMetas: instruction.accounts.length,
|
|
421
|
+
expectedAccountMetas: 2
|
|
422
|
+
});
|
|
428
423
|
}
|
|
429
424
|
let accountIndex = 0;
|
|
430
425
|
const getNextAccount = () => {
|
|
@@ -473,9 +468,9 @@ function getCreateAccountInstruction(input, config) {
|
|
|
473
468
|
const accounts = originalAccounts;
|
|
474
469
|
const args = { ...input };
|
|
475
470
|
const byteDelta = [Number(args.space) + kit.BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
|
|
476
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
471
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
477
472
|
return Object.freeze({
|
|
478
|
-
accounts: [getAccountMeta(accounts.payer), getAccountMeta(accounts.newAccount)],
|
|
473
|
+
accounts: [getAccountMeta("payer", accounts.payer), getAccountMeta("newAccount", accounts.newAccount)],
|
|
479
474
|
byteDelta,
|
|
480
475
|
data: getCreateAccountInstructionDataEncoder().encode(args),
|
|
481
476
|
programAddress
|
|
@@ -483,7 +478,10 @@ function getCreateAccountInstruction(input, config) {
|
|
|
483
478
|
}
|
|
484
479
|
function parseCreateAccountInstruction(instruction) {
|
|
485
480
|
if (instruction.accounts.length < 2) {
|
|
486
|
-
throw new
|
|
481
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
482
|
+
actualAccountMetas: instruction.accounts.length,
|
|
483
|
+
expectedAccountMetas: 2
|
|
484
|
+
});
|
|
487
485
|
}
|
|
488
486
|
let accountIndex = 0;
|
|
489
487
|
const getNextAccount = () => {
|
|
@@ -539,12 +537,12 @@ function getCreateAccountWithSeedInstruction(input, config) {
|
|
|
539
537
|
};
|
|
540
538
|
const accounts = originalAccounts;
|
|
541
539
|
const args = { ...input };
|
|
542
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
540
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
543
541
|
return Object.freeze({
|
|
544
542
|
accounts: [
|
|
545
|
-
getAccountMeta(accounts.payer),
|
|
546
|
-
getAccountMeta(accounts.newAccount),
|
|
547
|
-
getAccountMeta(accounts.baseAccount)
|
|
543
|
+
getAccountMeta("payer", accounts.payer),
|
|
544
|
+
getAccountMeta("newAccount", accounts.newAccount),
|
|
545
|
+
getAccountMeta("baseAccount", accounts.baseAccount)
|
|
548
546
|
].filter((x) => x !== void 0),
|
|
549
547
|
data: getCreateAccountWithSeedInstructionDataEncoder().encode(args),
|
|
550
548
|
programAddress
|
|
@@ -552,7 +550,10 @@ function getCreateAccountWithSeedInstruction(input, config) {
|
|
|
552
550
|
}
|
|
553
551
|
function parseCreateAccountWithSeedInstruction(instruction) {
|
|
554
552
|
if (instruction.accounts.length < 2) {
|
|
555
|
-
throw new
|
|
553
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
554
|
+
actualAccountMetas: instruction.accounts.length,
|
|
555
|
+
expectedAccountMetas: 2
|
|
556
|
+
});
|
|
556
557
|
}
|
|
557
558
|
let accountIndex = 0;
|
|
558
559
|
const getNextAccount = () => {
|
|
@@ -612,12 +613,12 @@ function getInitializeNonceAccountInstruction(input, config) {
|
|
|
612
613
|
if (!accounts.rentSysvar.value) {
|
|
613
614
|
accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
|
|
614
615
|
}
|
|
615
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
616
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
616
617
|
return Object.freeze({
|
|
617
618
|
accounts: [
|
|
618
|
-
getAccountMeta(accounts.nonceAccount),
|
|
619
|
-
getAccountMeta(accounts.recentBlockhashesSysvar),
|
|
620
|
-
getAccountMeta(accounts.rentSysvar)
|
|
619
|
+
getAccountMeta("nonceAccount", accounts.nonceAccount),
|
|
620
|
+
getAccountMeta("recentBlockhashesSysvar", accounts.recentBlockhashesSysvar),
|
|
621
|
+
getAccountMeta("rentSysvar", accounts.rentSysvar)
|
|
621
622
|
],
|
|
622
623
|
data: getInitializeNonceAccountInstructionDataEncoder().encode(
|
|
623
624
|
args
|
|
@@ -627,7 +628,10 @@ function getInitializeNonceAccountInstruction(input, config) {
|
|
|
627
628
|
}
|
|
628
629
|
function parseInitializeNonceAccountInstruction(instruction) {
|
|
629
630
|
if (instruction.accounts.length < 3) {
|
|
630
|
-
throw new
|
|
631
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
632
|
+
actualAccountMetas: instruction.accounts.length,
|
|
633
|
+
expectedAccountMetas: 3
|
|
634
|
+
});
|
|
631
635
|
}
|
|
632
636
|
let accountIndex = 0;
|
|
633
637
|
const getNextAccount = () => {
|
|
@@ -675,16 +679,19 @@ function getTransferSolInstruction(input, config) {
|
|
|
675
679
|
};
|
|
676
680
|
const accounts = originalAccounts;
|
|
677
681
|
const args = { ...input };
|
|
678
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
682
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
679
683
|
return Object.freeze({
|
|
680
|
-
accounts: [getAccountMeta(accounts.source), getAccountMeta(accounts.destination)],
|
|
684
|
+
accounts: [getAccountMeta("source", accounts.source), getAccountMeta("destination", accounts.destination)],
|
|
681
685
|
data: getTransferSolInstructionDataEncoder().encode(args),
|
|
682
686
|
programAddress
|
|
683
687
|
});
|
|
684
688
|
}
|
|
685
689
|
function parseTransferSolInstruction(instruction) {
|
|
686
690
|
if (instruction.accounts.length < 2) {
|
|
687
|
-
throw new
|
|
691
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
692
|
+
actualAccountMetas: instruction.accounts.length,
|
|
693
|
+
expectedAccountMetas: 2
|
|
694
|
+
});
|
|
688
695
|
}
|
|
689
696
|
let accountIndex = 0;
|
|
690
697
|
const getNextAccount = () => {
|
|
@@ -733,12 +740,12 @@ function getTransferSolWithSeedInstruction(input, config) {
|
|
|
733
740
|
};
|
|
734
741
|
const accounts = originalAccounts;
|
|
735
742
|
const args = { ...input };
|
|
736
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
743
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
737
744
|
return Object.freeze({
|
|
738
745
|
accounts: [
|
|
739
|
-
getAccountMeta(accounts.source),
|
|
740
|
-
getAccountMeta(accounts.baseAccount),
|
|
741
|
-
getAccountMeta(accounts.destination)
|
|
746
|
+
getAccountMeta("source", accounts.source),
|
|
747
|
+
getAccountMeta("baseAccount", accounts.baseAccount),
|
|
748
|
+
getAccountMeta("destination", accounts.destination)
|
|
742
749
|
],
|
|
743
750
|
data: getTransferSolWithSeedInstructionDataEncoder().encode(args),
|
|
744
751
|
programAddress
|
|
@@ -746,7 +753,10 @@ function getTransferSolWithSeedInstruction(input, config) {
|
|
|
746
753
|
}
|
|
747
754
|
function parseTransferSolWithSeedInstruction(instruction) {
|
|
748
755
|
if (instruction.accounts.length < 3) {
|
|
749
|
-
throw new
|
|
756
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
757
|
+
actualAccountMetas: instruction.accounts.length,
|
|
758
|
+
expectedAccountMetas: 3
|
|
759
|
+
});
|
|
750
760
|
}
|
|
751
761
|
let accountIndex = 0;
|
|
752
762
|
const getNextAccount = () => {
|
|
@@ -780,16 +790,19 @@ function getUpgradeNonceAccountInstruction(input, config) {
|
|
|
780
790
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
781
791
|
const originalAccounts = { nonceAccount: { value: input.nonceAccount ?? null, isWritable: true } };
|
|
782
792
|
const accounts = originalAccounts;
|
|
783
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
793
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
784
794
|
return Object.freeze({
|
|
785
|
-
accounts: [getAccountMeta(accounts.nonceAccount)],
|
|
795
|
+
accounts: [getAccountMeta("nonceAccount", accounts.nonceAccount)],
|
|
786
796
|
data: getUpgradeNonceAccountInstructionDataEncoder().encode({}),
|
|
787
797
|
programAddress
|
|
788
798
|
});
|
|
789
799
|
}
|
|
790
800
|
function parseUpgradeNonceAccountInstruction(instruction) {
|
|
791
801
|
if (instruction.accounts.length < 1) {
|
|
792
|
-
throw new
|
|
802
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
803
|
+
actualAccountMetas: instruction.accounts.length,
|
|
804
|
+
expectedAccountMetas: 1
|
|
805
|
+
});
|
|
793
806
|
}
|
|
794
807
|
let accountIndex = 0;
|
|
795
808
|
const getNextAccount = () => {
|
|
@@ -845,14 +858,14 @@ function getWithdrawNonceAccountInstruction(input, config) {
|
|
|
845
858
|
if (!accounts.rentSysvar.value) {
|
|
846
859
|
accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
|
|
847
860
|
}
|
|
848
|
-
const getAccountMeta = getAccountMetaFactory();
|
|
861
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
849
862
|
return Object.freeze({
|
|
850
863
|
accounts: [
|
|
851
|
-
getAccountMeta(accounts.nonceAccount),
|
|
852
|
-
getAccountMeta(accounts.recipientAccount),
|
|
853
|
-
getAccountMeta(accounts.recentBlockhashesSysvar),
|
|
854
|
-
getAccountMeta(accounts.rentSysvar),
|
|
855
|
-
getAccountMeta(accounts.nonceAuthority)
|
|
864
|
+
getAccountMeta("nonceAccount", accounts.nonceAccount),
|
|
865
|
+
getAccountMeta("recipientAccount", accounts.recipientAccount),
|
|
866
|
+
getAccountMeta("recentBlockhashesSysvar", accounts.recentBlockhashesSysvar),
|
|
867
|
+
getAccountMeta("rentSysvar", accounts.rentSysvar),
|
|
868
|
+
getAccountMeta("nonceAuthority", accounts.nonceAuthority)
|
|
856
869
|
],
|
|
857
870
|
data: getWithdrawNonceAccountInstructionDataEncoder().encode(args),
|
|
858
871
|
programAddress
|
|
@@ -860,7 +873,10 @@ function getWithdrawNonceAccountInstruction(input, config) {
|
|
|
860
873
|
}
|
|
861
874
|
function parseWithdrawNonceAccountInstruction(instruction) {
|
|
862
875
|
if (instruction.accounts.length < 5) {
|
|
863
|
-
throw new
|
|
876
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
877
|
+
actualAccountMetas: instruction.accounts.length,
|
|
878
|
+
expectedAccountMetas: 5
|
|
879
|
+
});
|
|
864
880
|
}
|
|
865
881
|
let accountIndex = 0;
|
|
866
882
|
const getNextAccount = () => {
|
|
@@ -944,7 +960,10 @@ function identifySystemInstruction(instruction) {
|
|
|
944
960
|
if (kit.containsBytes(data, kit.getU32Encoder().encode(12), 0)) {
|
|
945
961
|
return 12 /* UpgradeNonceAccount */;
|
|
946
962
|
}
|
|
947
|
-
throw new
|
|
963
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
964
|
+
instructionData: data,
|
|
965
|
+
programName: "system"
|
|
966
|
+
});
|
|
948
967
|
}
|
|
949
968
|
function parseSystemInstruction(instruction) {
|
|
950
969
|
const instructionType = identifySystemInstruction(instruction);
|
|
@@ -1029,9 +1048,43 @@ function parseSystemInstruction(instruction) {
|
|
|
1029
1048
|
};
|
|
1030
1049
|
}
|
|
1031
1050
|
default:
|
|
1032
|
-
throw new
|
|
1051
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
1052
|
+
instructionType,
|
|
1053
|
+
programName: "system"
|
|
1054
|
+
});
|
|
1033
1055
|
}
|
|
1034
1056
|
}
|
|
1057
|
+
function systemProgram() {
|
|
1058
|
+
return (client) => {
|
|
1059
|
+
return {
|
|
1060
|
+
...client,
|
|
1061
|
+
system: {
|
|
1062
|
+
accounts: { nonce: programClientCore.addSelfFetchFunctions(client, getNonceCodec()) },
|
|
1063
|
+
instructions: {
|
|
1064
|
+
createAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
1065
|
+
client,
|
|
1066
|
+
getCreateAccountInstruction({ ...input, payer: input.payer ?? client.payer })
|
|
1067
|
+
),
|
|
1068
|
+
assign: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAssignInstruction(input)),
|
|
1069
|
+
transferSol: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getTransferSolInstruction(input)),
|
|
1070
|
+
createAccountWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
1071
|
+
client,
|
|
1072
|
+
getCreateAccountWithSeedInstruction({ ...input, payer: input.payer ?? client.payer })
|
|
1073
|
+
),
|
|
1074
|
+
advanceNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAdvanceNonceAccountInstruction(input)),
|
|
1075
|
+
withdrawNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getWithdrawNonceAccountInstruction(input)),
|
|
1076
|
+
initializeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getInitializeNonceAccountInstruction(input)),
|
|
1077
|
+
authorizeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAuthorizeNonceAccountInstruction(input)),
|
|
1078
|
+
allocate: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAllocateInstruction(input)),
|
|
1079
|
+
allocateWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAllocateWithSeedInstruction(input)),
|
|
1080
|
+
assignWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAssignWithSeedInstruction(input)),
|
|
1081
|
+
transferSolWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getTransferSolWithSeedInstruction(input)),
|
|
1082
|
+
upgradeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getUpgradeNonceAccountInstruction(input))
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1035
1088
|
|
|
1036
1089
|
// src/generated/errors/system.ts
|
|
1037
1090
|
var SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE = 0;
|
|
@@ -1191,5 +1244,6 @@ exports.parseTransferSolInstruction = parseTransferSolInstruction;
|
|
|
1191
1244
|
exports.parseTransferSolWithSeedInstruction = parseTransferSolWithSeedInstruction;
|
|
1192
1245
|
exports.parseUpgradeNonceAccountInstruction = parseUpgradeNonceAccountInstruction;
|
|
1193
1246
|
exports.parseWithdrawNonceAccountInstruction = parseWithdrawNonceAccountInstruction;
|
|
1247
|
+
exports.systemProgram = systemProgram;
|
|
1194
1248
|
//# sourceMappingURL=index.js.map
|
|
1195
1249
|
//# sourceMappingURL=index.js.map
|