@solana-program/system 0.2.0 → 0.3.1
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 +244 -338
- package/dist/src/index.cjs.map +1 -1
- package/dist/src/index.js +112 -205
- package/dist/src/index.js.map +1 -1
- package/dist/types/src/generated/accounts/nonce.d.ts +12 -16
- package/dist/types/src/generated/accounts/nonce.d.ts.map +1 -1
- package/dist/types/src/generated/errors/system.d.ts +20 -27
- package/dist/types/src/generated/errors/system.d.ts.map +1 -1
- package/dist/types/src/generated/index.d.ts +0 -1
- package/dist/types/src/generated/index.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts +1 -4
- package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/allocate.d.ts +1 -4
- package/dist/types/src/generated/instructions/allocate.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/allocateWithSeed.d.ts +1 -4
- package/dist/types/src/generated/instructions/allocateWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/assign.d.ts +1 -4
- package/dist/types/src/generated/instructions/assign.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/assignWithSeed.d.ts +1 -4
- package/dist/types/src/generated/instructions/assignWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts +1 -4
- package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/createAccount.d.ts +1 -4
- package/dist/types/src/generated/instructions/createAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts +1 -4
- package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts +1 -3
- package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transferSol.d.ts +1 -4
- package/dist/types/src/generated/instructions/transferSol.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts +1 -4
- package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts +1 -3
- package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts +1 -4
- package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
- package/dist/types/src/generated/programs/system.d.ts +1 -5
- package/dist/types/src/generated/programs/system.d.ts.map +1 -1
- package/dist/types/src/generated/shared/index.d.ts +1 -4
- package/dist/types/src/generated/shared/index.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 +5 -5
- package/dist/types/test/_setup.d.ts.map +1 -1
- package/package.json +5 -10
package/dist/src/index.cjs
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var addresses = require('@solana/addresses');
|
|
5
|
-
var codecs = require('@solana/codecs');
|
|
6
|
-
var instructions = require('@solana/instructions');
|
|
7
|
-
var signers = require('@solana/signers');
|
|
3
|
+
var web3_js = require('@solana/web3.js');
|
|
8
4
|
|
|
9
5
|
// env-shim.ts
|
|
10
6
|
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
@@ -14,13 +10,13 @@ var NonceState = /* @__PURE__ */ ((NonceState3) => {
|
|
|
14
10
|
return NonceState3;
|
|
15
11
|
})(NonceState || {});
|
|
16
12
|
function getNonceStateEncoder() {
|
|
17
|
-
return
|
|
13
|
+
return web3_js.getEnumEncoder(NonceState, { size: web3_js.getU32Encoder() });
|
|
18
14
|
}
|
|
19
15
|
function getNonceStateDecoder() {
|
|
20
|
-
return
|
|
16
|
+
return web3_js.getEnumDecoder(NonceState, { size: web3_js.getU32Decoder() });
|
|
21
17
|
}
|
|
22
18
|
function getNonceStateCodec() {
|
|
23
|
-
return
|
|
19
|
+
return web3_js.combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
|
|
24
20
|
}
|
|
25
21
|
var NonceVersion = /* @__PURE__ */ ((NonceVersion3) => {
|
|
26
22
|
NonceVersion3[NonceVersion3["Legacy"] = 0] = "Legacy";
|
|
@@ -28,62 +24,59 @@ var NonceVersion = /* @__PURE__ */ ((NonceVersion3) => {
|
|
|
28
24
|
return NonceVersion3;
|
|
29
25
|
})(NonceVersion || {});
|
|
30
26
|
function getNonceVersionEncoder() {
|
|
31
|
-
return
|
|
27
|
+
return web3_js.getEnumEncoder(NonceVersion, { size: web3_js.getU32Encoder() });
|
|
32
28
|
}
|
|
33
29
|
function getNonceVersionDecoder() {
|
|
34
|
-
return
|
|
30
|
+
return web3_js.getEnumDecoder(NonceVersion, { size: web3_js.getU32Decoder() });
|
|
35
31
|
}
|
|
36
32
|
function getNonceVersionCodec() {
|
|
37
|
-
return
|
|
33
|
+
return web3_js.combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
// src/generated/accounts/nonce.ts
|
|
41
|
-
function
|
|
42
|
-
return
|
|
37
|
+
function getNonceEncoder() {
|
|
38
|
+
return web3_js.getStructEncoder([
|
|
43
39
|
["version", getNonceVersionEncoder()],
|
|
44
40
|
["state", getNonceStateEncoder()],
|
|
45
|
-
["authority",
|
|
46
|
-
["blockhash",
|
|
47
|
-
["lamportsPerSignature",
|
|
41
|
+
["authority", web3_js.getAddressEncoder()],
|
|
42
|
+
["blockhash", web3_js.getAddressEncoder()],
|
|
43
|
+
["lamportsPerSignature", web3_js.getU64Encoder()]
|
|
48
44
|
]);
|
|
49
45
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
46
|
+
function getNonceDecoder() {
|
|
47
|
+
return web3_js.getStructDecoder([
|
|
52
48
|
["version", getNonceVersionDecoder()],
|
|
53
49
|
["state", getNonceStateDecoder()],
|
|
54
|
-
["authority",
|
|
55
|
-
["blockhash",
|
|
56
|
-
["lamportsPerSignature",
|
|
50
|
+
["authority", web3_js.getAddressDecoder()],
|
|
51
|
+
["blockhash", web3_js.getAddressDecoder()],
|
|
52
|
+
["lamportsPerSignature", web3_js.getU64Decoder()]
|
|
57
53
|
]);
|
|
58
54
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
61
|
-
getNonceAccountDataEncoder(),
|
|
62
|
-
getNonceAccountDataDecoder()
|
|
63
|
-
);
|
|
55
|
+
function getNonceCodec() {
|
|
56
|
+
return web3_js.combineCodec(getNonceEncoder(), getNonceDecoder());
|
|
64
57
|
}
|
|
65
58
|
function decodeNonce(encodedAccount) {
|
|
66
|
-
return
|
|
59
|
+
return web3_js.decodeAccount(
|
|
67
60
|
encodedAccount,
|
|
68
|
-
|
|
61
|
+
getNonceDecoder()
|
|
69
62
|
);
|
|
70
63
|
}
|
|
71
64
|
async function fetchNonce(rpc, address, config) {
|
|
72
65
|
const maybeAccount = await fetchMaybeNonce(rpc, address, config);
|
|
73
|
-
|
|
66
|
+
web3_js.assertAccountExists(maybeAccount);
|
|
74
67
|
return maybeAccount;
|
|
75
68
|
}
|
|
76
69
|
async function fetchMaybeNonce(rpc, address, config) {
|
|
77
|
-
const maybeAccount = await
|
|
70
|
+
const maybeAccount = await web3_js.fetchEncodedAccount(rpc, address, config);
|
|
78
71
|
return decodeNonce(maybeAccount);
|
|
79
72
|
}
|
|
80
73
|
async function fetchAllNonce(rpc, addresses, config) {
|
|
81
74
|
const maybeAccounts = await fetchAllMaybeNonce(rpc, addresses, config);
|
|
82
|
-
|
|
75
|
+
web3_js.assertAccountsExist(maybeAccounts);
|
|
83
76
|
return maybeAccounts;
|
|
84
77
|
}
|
|
85
78
|
async function fetchAllMaybeNonce(rpc, addresses, config) {
|
|
86
|
-
const maybeAccounts = await
|
|
79
|
+
const maybeAccounts = await web3_js.fetchEncodedAccounts(rpc, addresses, config);
|
|
87
80
|
return maybeAccounts.map((maybeAccount) => decodeNonce(maybeAccount));
|
|
88
81
|
}
|
|
89
82
|
function getNonceSize() {
|
|
@@ -91,153 +84,36 @@ function getNonceSize() {
|
|
|
91
84
|
}
|
|
92
85
|
|
|
93
86
|
// src/generated/errors/system.ts
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return SystemProgramErrorCode3;
|
|
105
|
-
})(SystemProgramErrorCode || {});
|
|
106
|
-
var SystemProgramError = class extends Error {
|
|
107
|
-
name = "SystemProgramError";
|
|
108
|
-
code;
|
|
109
|
-
cause;
|
|
110
|
-
constructor(code, name, message, cause) {
|
|
111
|
-
super(`${name} (${code}): ${message}`);
|
|
112
|
-
this.code = code;
|
|
113
|
-
this.cause = cause;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
var systemProgramErrorCodeMap;
|
|
87
|
+
var SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE = 0;
|
|
88
|
+
var SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS = 1;
|
|
89
|
+
var SYSTEM_ERROR__INVALID_PROGRAM_ID = 2;
|
|
90
|
+
var SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH = 3;
|
|
91
|
+
var SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4;
|
|
92
|
+
var SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH = 5;
|
|
93
|
+
var SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES = 6;
|
|
94
|
+
var SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED = 7;
|
|
95
|
+
var SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE = 8;
|
|
96
|
+
var systemErrorMessages;
|
|
117
97
|
if (__DEV__) {
|
|
118
|
-
|
|
119
|
-
[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
]
|
|
123
|
-
[
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
]
|
|
127
|
-
[
|
|
128
|
-
"InvalidProgramId",
|
|
129
|
-
`cannot assign account to this program id`
|
|
130
|
-
],
|
|
131
|
-
[3 /* INVALID_ACCOUNT_DATA_LENGTH */]: [
|
|
132
|
-
"InvalidAccountDataLength",
|
|
133
|
-
`cannot allocate account data of this length`
|
|
134
|
-
],
|
|
135
|
-
[4 /* MAX_SEED_LENGTH_EXCEEDED */]: [
|
|
136
|
-
"MaxSeedLengthExceeded",
|
|
137
|
-
`length of requested seed is too long`
|
|
138
|
-
],
|
|
139
|
-
[5 /* ADDRESS_WITH_SEED_MISMATCH */]: [
|
|
140
|
-
"AddressWithSeedMismatch",
|
|
141
|
-
`provided address does not match addressed derived from seed`
|
|
142
|
-
],
|
|
143
|
-
[6 /* NONCE_NO_RECENT_BLOCKHASHES */]: [
|
|
144
|
-
"NonceNoRecentBlockhashes",
|
|
145
|
-
`advancing stored nonce requires a populated RecentBlockhashes sysvar`
|
|
146
|
-
],
|
|
147
|
-
[7 /* NONCE_BLOCKHASH_NOT_EXPIRED */]: [
|
|
148
|
-
"NonceBlockhashNotExpired",
|
|
149
|
-
`stored nonce is still in recent_blockhashes`
|
|
150
|
-
],
|
|
151
|
-
[8 /* NONCE_UNEXPECTED_BLOCKHASH_VALUE */]: [
|
|
152
|
-
"NonceUnexpectedBlockhashValue",
|
|
153
|
-
`specified nonce does not match stored nonce`
|
|
154
|
-
]
|
|
98
|
+
systemErrorMessages = {
|
|
99
|
+
[SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE]: `an account with the same address already exists`,
|
|
100
|
+
[SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH]: `provided address does not match addressed derived from seed`,
|
|
101
|
+
[SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH]: `cannot allocate account data of this length`,
|
|
102
|
+
[SYSTEM_ERROR__INVALID_PROGRAM_ID]: `cannot assign account to this program id`,
|
|
103
|
+
[SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED]: `length of requested seed is too long`,
|
|
104
|
+
[SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED]: `stored nonce is still in recent_blockhashes`,
|
|
105
|
+
[SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES]: `advancing stored nonce requires a populated RecentBlockhashes sysvar`,
|
|
106
|
+
[SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE]: `specified nonce does not match stored nonce`,
|
|
107
|
+
[SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS]: `account does not have enough SOL to perform the operation`
|
|
155
108
|
};
|
|
156
109
|
}
|
|
157
|
-
function
|
|
110
|
+
function getSystemErrorMessage(code) {
|
|
158
111
|
if (__DEV__) {
|
|
159
|
-
return
|
|
160
|
-
code,
|
|
161
|
-
...systemProgramErrorCodeMap[code],
|
|
162
|
-
cause
|
|
163
|
-
);
|
|
112
|
+
return systemErrorMessages[code];
|
|
164
113
|
}
|
|
165
|
-
return
|
|
166
|
-
code,
|
|
167
|
-
"Unknown",
|
|
168
|
-
"Error message not available in production bundles. Compile with __DEV__ set to true to see more information.",
|
|
169
|
-
cause
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
function expectSome(value) {
|
|
173
|
-
if (value == null) {
|
|
174
|
-
throw new Error("Expected a value but received null or undefined.");
|
|
175
|
-
}
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
function expectAddress(value) {
|
|
179
|
-
if (!value) {
|
|
180
|
-
throw new Error("Expected a Address.");
|
|
181
|
-
}
|
|
182
|
-
if (typeof value === "object" && "address" in value) {
|
|
183
|
-
return value.address;
|
|
184
|
-
}
|
|
185
|
-
if (Array.isArray(value)) {
|
|
186
|
-
return value[0];
|
|
187
|
-
}
|
|
188
|
-
return value;
|
|
189
|
-
}
|
|
190
|
-
function expectProgramDerivedAddress(value) {
|
|
191
|
-
if (!value || !Array.isArray(value) || !addresses.isProgramDerivedAddress(value)) {
|
|
192
|
-
throw new Error("Expected a ProgramDerivedAddress.");
|
|
193
|
-
}
|
|
194
|
-
return value;
|
|
195
|
-
}
|
|
196
|
-
function expectTransactionSigner(value) {
|
|
197
|
-
if (!value || !isTransactionSigner(value)) {
|
|
198
|
-
throw new Error("Expected a TransactionSigner.");
|
|
199
|
-
}
|
|
200
|
-
return value;
|
|
201
|
-
}
|
|
202
|
-
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
203
|
-
return (account) => {
|
|
204
|
-
if (!account.value) {
|
|
205
|
-
if (optionalAccountStrategy === "omitted")
|
|
206
|
-
return;
|
|
207
|
-
return Object.freeze({
|
|
208
|
-
address: programAddress,
|
|
209
|
-
role: instructions.AccountRole.READONLY
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
const writableRole = account.isWritable ? instructions.AccountRole.WRITABLE : instructions.AccountRole.READONLY;
|
|
213
|
-
return Object.freeze({
|
|
214
|
-
address: expectAddress(account.value),
|
|
215
|
-
role: isTransactionSigner(account.value) ? instructions.upgradeRoleToSigner(writableRole) : writableRole,
|
|
216
|
-
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
217
|
-
});
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
function isTransactionSigner(value) {
|
|
221
|
-
return !!value && typeof value === "object" && "address" in value && signers.isTransactionSigner(value);
|
|
114
|
+
return "Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.";
|
|
222
115
|
}
|
|
223
|
-
function memcmp(data, bytes, offset) {
|
|
224
|
-
const slice = data.slice(offset, offset + bytes.length);
|
|
225
|
-
if (slice.length !== bytes.length)
|
|
226
|
-
return false;
|
|
227
|
-
return bytes.every((b, i) => b === slice[i]);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// src/generated/programs/system.ts
|
|
231
116
|
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
117
|
var SystemAccount = /* @__PURE__ */ ((SystemAccount2) => {
|
|
242
118
|
SystemAccount2[SystemAccount2["Nonce"] = 0] = "Nonce";
|
|
243
119
|
return SystemAccount2;
|
|
@@ -260,62 +136,93 @@ var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
|
|
|
260
136
|
})(SystemInstruction || {});
|
|
261
137
|
function identifySystemInstruction(instruction) {
|
|
262
138
|
const data = instruction instanceof Uint8Array ? instruction : instruction.data;
|
|
263
|
-
if (
|
|
139
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(0), 0)) {
|
|
264
140
|
return 0 /* CreateAccount */;
|
|
265
141
|
}
|
|
266
|
-
if (
|
|
142
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(1), 0)) {
|
|
267
143
|
return 1 /* Assign */;
|
|
268
144
|
}
|
|
269
|
-
if (
|
|
145
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(2), 0)) {
|
|
270
146
|
return 2 /* TransferSol */;
|
|
271
147
|
}
|
|
272
|
-
if (
|
|
148
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(3), 0)) {
|
|
273
149
|
return 3 /* CreateAccountWithSeed */;
|
|
274
150
|
}
|
|
275
|
-
if (
|
|
151
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(4), 0)) {
|
|
276
152
|
return 4 /* AdvanceNonceAccount */;
|
|
277
153
|
}
|
|
278
|
-
if (
|
|
154
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(5), 0)) {
|
|
279
155
|
return 5 /* WithdrawNonceAccount */;
|
|
280
156
|
}
|
|
281
|
-
if (
|
|
157
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(6), 0)) {
|
|
282
158
|
return 6 /* InitializeNonceAccount */;
|
|
283
159
|
}
|
|
284
|
-
if (
|
|
160
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(7), 0)) {
|
|
285
161
|
return 7 /* AuthorizeNonceAccount */;
|
|
286
162
|
}
|
|
287
|
-
if (
|
|
163
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(8), 0)) {
|
|
288
164
|
return 8 /* Allocate */;
|
|
289
165
|
}
|
|
290
|
-
if (
|
|
166
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(9), 0)) {
|
|
291
167
|
return 9 /* AllocateWithSeed */;
|
|
292
168
|
}
|
|
293
|
-
if (
|
|
169
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(10), 0)) {
|
|
294
170
|
return 10 /* AssignWithSeed */;
|
|
295
171
|
}
|
|
296
|
-
if (
|
|
172
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(11), 0)) {
|
|
297
173
|
return 11 /* TransferSolWithSeed */;
|
|
298
174
|
}
|
|
299
|
-
if (
|
|
175
|
+
if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(12), 0)) {
|
|
300
176
|
return 12 /* UpgradeNonceAccount */;
|
|
301
177
|
}
|
|
302
178
|
throw new Error(
|
|
303
179
|
"The provided instruction could not be identified as a system instruction."
|
|
304
180
|
);
|
|
305
181
|
}
|
|
182
|
+
function expectAddress(value) {
|
|
183
|
+
if (!value) {
|
|
184
|
+
throw new Error("Expected a Address.");
|
|
185
|
+
}
|
|
186
|
+
if (typeof value === "object" && "address" in value) {
|
|
187
|
+
return value.address;
|
|
188
|
+
}
|
|
189
|
+
if (Array.isArray(value)) {
|
|
190
|
+
return value[0];
|
|
191
|
+
}
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
195
|
+
return (account) => {
|
|
196
|
+
if (!account.value) {
|
|
197
|
+
return Object.freeze({
|
|
198
|
+
address: programAddress,
|
|
199
|
+
role: web3_js.AccountRole.READONLY
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
const writableRole = account.isWritable ? web3_js.AccountRole.WRITABLE : web3_js.AccountRole.READONLY;
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
address: expectAddress(account.value),
|
|
205
|
+
role: isTransactionSigner(account.value) ? web3_js.upgradeRoleToSigner(writableRole) : writableRole,
|
|
206
|
+
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function isTransactionSigner(value) {
|
|
211
|
+
return !!value && typeof value === "object" && "address" in value && web3_js.isTransactionSigner(value);
|
|
212
|
+
}
|
|
306
213
|
|
|
307
214
|
// src/generated/instructions/advanceNonceAccount.ts
|
|
308
215
|
function getAdvanceNonceAccountInstructionDataEncoder() {
|
|
309
|
-
return
|
|
310
|
-
|
|
216
|
+
return web3_js.transformEncoder(
|
|
217
|
+
web3_js.getStructEncoder([["discriminator", web3_js.getU32Encoder()]]),
|
|
311
218
|
(value) => ({ ...value, discriminator: 4 })
|
|
312
219
|
);
|
|
313
220
|
}
|
|
314
221
|
function getAdvanceNonceAccountInstructionDataDecoder() {
|
|
315
|
-
return
|
|
222
|
+
return web3_js.getStructDecoder([["discriminator", web3_js.getU32Decoder()]]);
|
|
316
223
|
}
|
|
317
224
|
function getAdvanceNonceAccountInstructionDataCodec() {
|
|
318
|
-
return
|
|
225
|
+
return web3_js.combineCodec(
|
|
319
226
|
getAdvanceNonceAccountInstructionDataEncoder(),
|
|
320
227
|
getAdvanceNonceAccountInstructionDataDecoder()
|
|
321
228
|
);
|
|
@@ -334,7 +241,7 @@ function getAdvanceNonceAccountInstruction(input) {
|
|
|
334
241
|
if (!accounts.recentBlockhashesSysvar.value) {
|
|
335
242
|
accounts.recentBlockhashesSysvar.value = "SysvarRecentB1ockHashes11111111111111111111";
|
|
336
243
|
}
|
|
337
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
244
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
338
245
|
const instruction = {
|
|
339
246
|
accounts: [
|
|
340
247
|
getAccountMeta(accounts.nonceAccount),
|
|
@@ -369,22 +276,22 @@ function parseAdvanceNonceAccountInstruction(instruction) {
|
|
|
369
276
|
};
|
|
370
277
|
}
|
|
371
278
|
function getAllocateInstructionDataEncoder() {
|
|
372
|
-
return
|
|
373
|
-
|
|
374
|
-
["discriminator",
|
|
375
|
-
["space",
|
|
279
|
+
return web3_js.transformEncoder(
|
|
280
|
+
web3_js.getStructEncoder([
|
|
281
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
282
|
+
["space", web3_js.getU64Encoder()]
|
|
376
283
|
]),
|
|
377
284
|
(value) => ({ ...value, discriminator: 8 })
|
|
378
285
|
);
|
|
379
286
|
}
|
|
380
287
|
function getAllocateInstructionDataDecoder() {
|
|
381
|
-
return
|
|
382
|
-
["discriminator",
|
|
383
|
-
["space",
|
|
288
|
+
return web3_js.getStructDecoder([
|
|
289
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
290
|
+
["space", web3_js.getU64Decoder()]
|
|
384
291
|
]);
|
|
385
292
|
}
|
|
386
293
|
function getAllocateInstructionDataCodec() {
|
|
387
|
-
return
|
|
294
|
+
return web3_js.combineCodec(
|
|
388
295
|
getAllocateInstructionDataEncoder(),
|
|
389
296
|
getAllocateInstructionDataDecoder()
|
|
390
297
|
);
|
|
@@ -396,7 +303,7 @@ function getAllocateInstruction(input) {
|
|
|
396
303
|
};
|
|
397
304
|
const accounts = originalAccounts;
|
|
398
305
|
const args = { ...input };
|
|
399
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
306
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
400
307
|
const instruction = {
|
|
401
308
|
accounts: [getAccountMeta(accounts.newAccount)],
|
|
402
309
|
programAddress,
|
|
@@ -425,28 +332,28 @@ function parseAllocateInstruction(instruction) {
|
|
|
425
332
|
};
|
|
426
333
|
}
|
|
427
334
|
function getAllocateWithSeedInstructionDataEncoder() {
|
|
428
|
-
return
|
|
429
|
-
|
|
430
|
-
["discriminator",
|
|
431
|
-
["base",
|
|
432
|
-
["seed",
|
|
433
|
-
["space",
|
|
434
|
-
["programAddress",
|
|
335
|
+
return web3_js.transformEncoder(
|
|
336
|
+
web3_js.getStructEncoder([
|
|
337
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
338
|
+
["base", web3_js.getAddressEncoder()],
|
|
339
|
+
["seed", web3_js.addEncoderSizePrefix(web3_js.getUtf8Encoder(), web3_js.getU32Encoder())],
|
|
340
|
+
["space", web3_js.getU64Encoder()],
|
|
341
|
+
["programAddress", web3_js.getAddressEncoder()]
|
|
435
342
|
]),
|
|
436
343
|
(value) => ({ ...value, discriminator: 9 })
|
|
437
344
|
);
|
|
438
345
|
}
|
|
439
346
|
function getAllocateWithSeedInstructionDataDecoder() {
|
|
440
|
-
return
|
|
441
|
-
["discriminator",
|
|
442
|
-
["base",
|
|
443
|
-
["seed",
|
|
444
|
-
["space",
|
|
445
|
-
["programAddress",
|
|
347
|
+
return web3_js.getStructDecoder([
|
|
348
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
349
|
+
["base", web3_js.getAddressDecoder()],
|
|
350
|
+
["seed", web3_js.addDecoderSizePrefix(web3_js.getUtf8Decoder(), web3_js.getU32Decoder())],
|
|
351
|
+
["space", web3_js.getU64Decoder()],
|
|
352
|
+
["programAddress", web3_js.getAddressDecoder()]
|
|
446
353
|
]);
|
|
447
354
|
}
|
|
448
355
|
function getAllocateWithSeedInstructionDataCodec() {
|
|
449
|
-
return
|
|
356
|
+
return web3_js.combineCodec(
|
|
450
357
|
getAllocateWithSeedInstructionDataEncoder(),
|
|
451
358
|
getAllocateWithSeedInstructionDataDecoder()
|
|
452
359
|
);
|
|
@@ -459,7 +366,7 @@ function getAllocateWithSeedInstruction(input) {
|
|
|
459
366
|
};
|
|
460
367
|
const accounts = originalAccounts;
|
|
461
368
|
const args = { ...input };
|
|
462
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
369
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
463
370
|
const instruction = {
|
|
464
371
|
accounts: [
|
|
465
372
|
getAccountMeta(accounts.newAccount),
|
|
@@ -492,22 +399,22 @@ function parseAllocateWithSeedInstruction(instruction) {
|
|
|
492
399
|
};
|
|
493
400
|
}
|
|
494
401
|
function getAssignInstructionDataEncoder() {
|
|
495
|
-
return
|
|
496
|
-
|
|
497
|
-
["discriminator",
|
|
498
|
-
["programAddress",
|
|
402
|
+
return web3_js.transformEncoder(
|
|
403
|
+
web3_js.getStructEncoder([
|
|
404
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
405
|
+
["programAddress", web3_js.getAddressEncoder()]
|
|
499
406
|
]),
|
|
500
407
|
(value) => ({ ...value, discriminator: 1 })
|
|
501
408
|
);
|
|
502
409
|
}
|
|
503
410
|
function getAssignInstructionDataDecoder() {
|
|
504
|
-
return
|
|
505
|
-
["discriminator",
|
|
506
|
-
["programAddress",
|
|
411
|
+
return web3_js.getStructDecoder([
|
|
412
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
413
|
+
["programAddress", web3_js.getAddressDecoder()]
|
|
507
414
|
]);
|
|
508
415
|
}
|
|
509
416
|
function getAssignInstructionDataCodec() {
|
|
510
|
-
return
|
|
417
|
+
return web3_js.combineCodec(
|
|
511
418
|
getAssignInstructionDataEncoder(),
|
|
512
419
|
getAssignInstructionDataDecoder()
|
|
513
420
|
);
|
|
@@ -519,7 +426,7 @@ function getAssignInstruction(input) {
|
|
|
519
426
|
};
|
|
520
427
|
const accounts = originalAccounts;
|
|
521
428
|
const args = { ...input };
|
|
522
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
429
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
523
430
|
const instruction = {
|
|
524
431
|
accounts: [getAccountMeta(accounts.account)],
|
|
525
432
|
programAddress,
|
|
@@ -548,26 +455,26 @@ function parseAssignInstruction(instruction) {
|
|
|
548
455
|
};
|
|
549
456
|
}
|
|
550
457
|
function getAssignWithSeedInstructionDataEncoder() {
|
|
551
|
-
return
|
|
552
|
-
|
|
553
|
-
["discriminator",
|
|
554
|
-
["base",
|
|
555
|
-
["seed",
|
|
556
|
-
["programAddress",
|
|
458
|
+
return web3_js.transformEncoder(
|
|
459
|
+
web3_js.getStructEncoder([
|
|
460
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
461
|
+
["base", web3_js.getAddressEncoder()],
|
|
462
|
+
["seed", web3_js.addEncoderSizePrefix(web3_js.getUtf8Encoder(), web3_js.getU32Encoder())],
|
|
463
|
+
["programAddress", web3_js.getAddressEncoder()]
|
|
557
464
|
]),
|
|
558
465
|
(value) => ({ ...value, discriminator: 10 })
|
|
559
466
|
);
|
|
560
467
|
}
|
|
561
468
|
function getAssignWithSeedInstructionDataDecoder() {
|
|
562
|
-
return
|
|
563
|
-
["discriminator",
|
|
564
|
-
["base",
|
|
565
|
-
["seed",
|
|
566
|
-
["programAddress",
|
|
469
|
+
return web3_js.getStructDecoder([
|
|
470
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
471
|
+
["base", web3_js.getAddressDecoder()],
|
|
472
|
+
["seed", web3_js.addDecoderSizePrefix(web3_js.getUtf8Decoder(), web3_js.getU32Decoder())],
|
|
473
|
+
["programAddress", web3_js.getAddressDecoder()]
|
|
567
474
|
]);
|
|
568
475
|
}
|
|
569
476
|
function getAssignWithSeedInstructionDataCodec() {
|
|
570
|
-
return
|
|
477
|
+
return web3_js.combineCodec(
|
|
571
478
|
getAssignWithSeedInstructionDataEncoder(),
|
|
572
479
|
getAssignWithSeedInstructionDataDecoder()
|
|
573
480
|
);
|
|
@@ -580,7 +487,7 @@ function getAssignWithSeedInstruction(input) {
|
|
|
580
487
|
};
|
|
581
488
|
const accounts = originalAccounts;
|
|
582
489
|
const args = { ...input };
|
|
583
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
490
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
584
491
|
const instruction = {
|
|
585
492
|
accounts: [
|
|
586
493
|
getAccountMeta(accounts.account),
|
|
@@ -613,22 +520,22 @@ function parseAssignWithSeedInstruction(instruction) {
|
|
|
613
520
|
};
|
|
614
521
|
}
|
|
615
522
|
function getAuthorizeNonceAccountInstructionDataEncoder() {
|
|
616
|
-
return
|
|
617
|
-
|
|
618
|
-
["discriminator",
|
|
619
|
-
["newNonceAuthority",
|
|
523
|
+
return web3_js.transformEncoder(
|
|
524
|
+
web3_js.getStructEncoder([
|
|
525
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
526
|
+
["newNonceAuthority", web3_js.getAddressEncoder()]
|
|
620
527
|
]),
|
|
621
528
|
(value) => ({ ...value, discriminator: 7 })
|
|
622
529
|
);
|
|
623
530
|
}
|
|
624
531
|
function getAuthorizeNonceAccountInstructionDataDecoder() {
|
|
625
|
-
return
|
|
626
|
-
["discriminator",
|
|
627
|
-
["newNonceAuthority",
|
|
532
|
+
return web3_js.getStructDecoder([
|
|
533
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
534
|
+
["newNonceAuthority", web3_js.getAddressDecoder()]
|
|
628
535
|
]);
|
|
629
536
|
}
|
|
630
537
|
function getAuthorizeNonceAccountInstructionDataCodec() {
|
|
631
|
-
return
|
|
538
|
+
return web3_js.combineCodec(
|
|
632
539
|
getAuthorizeNonceAccountInstructionDataEncoder(),
|
|
633
540
|
getAuthorizeNonceAccountInstructionDataDecoder()
|
|
634
541
|
);
|
|
@@ -641,7 +548,7 @@ function getAuthorizeNonceAccountInstruction(input) {
|
|
|
641
548
|
};
|
|
642
549
|
const accounts = originalAccounts;
|
|
643
550
|
const args = { ...input };
|
|
644
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
551
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
645
552
|
const instruction = {
|
|
646
553
|
accounts: [
|
|
647
554
|
getAccountMeta(accounts.nonceAccount),
|
|
@@ -676,26 +583,26 @@ function parseAuthorizeNonceAccountInstruction(instruction) {
|
|
|
676
583
|
};
|
|
677
584
|
}
|
|
678
585
|
function getCreateAccountInstructionDataEncoder() {
|
|
679
|
-
return
|
|
680
|
-
|
|
681
|
-
["discriminator",
|
|
682
|
-
["lamports",
|
|
683
|
-
["space",
|
|
684
|
-
["programAddress",
|
|
586
|
+
return web3_js.transformEncoder(
|
|
587
|
+
web3_js.getStructEncoder([
|
|
588
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
589
|
+
["lamports", web3_js.getU64Encoder()],
|
|
590
|
+
["space", web3_js.getU64Encoder()],
|
|
591
|
+
["programAddress", web3_js.getAddressEncoder()]
|
|
685
592
|
]),
|
|
686
593
|
(value) => ({ ...value, discriminator: 0 })
|
|
687
594
|
);
|
|
688
595
|
}
|
|
689
596
|
function getCreateAccountInstructionDataDecoder() {
|
|
690
|
-
return
|
|
691
|
-
["discriminator",
|
|
692
|
-
["lamports",
|
|
693
|
-
["space",
|
|
694
|
-
["programAddress",
|
|
597
|
+
return web3_js.getStructDecoder([
|
|
598
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
599
|
+
["lamports", web3_js.getU64Decoder()],
|
|
600
|
+
["space", web3_js.getU64Decoder()],
|
|
601
|
+
["programAddress", web3_js.getAddressDecoder()]
|
|
695
602
|
]);
|
|
696
603
|
}
|
|
697
604
|
function getCreateAccountInstructionDataCodec() {
|
|
698
|
-
return
|
|
605
|
+
return web3_js.combineCodec(
|
|
699
606
|
getCreateAccountInstructionDataEncoder(),
|
|
700
607
|
getCreateAccountInstructionDataDecoder()
|
|
701
608
|
);
|
|
@@ -706,17 +613,17 @@ function getCreateAccountInstruction(input) {
|
|
|
706
613
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
707
614
|
newAccount: { value: input.newAccount ?? null, isWritable: true }
|
|
708
615
|
};
|
|
709
|
-
const accounts
|
|
616
|
+
const accounts = originalAccounts;
|
|
710
617
|
const args = { ...input };
|
|
711
|
-
const byteDelta = [Number(args.space) +
|
|
618
|
+
const byteDelta = [Number(args.space) + web3_js.BASE_ACCOUNT_SIZE].reduce(
|
|
712
619
|
(a, b) => a + b,
|
|
713
620
|
0
|
|
714
621
|
);
|
|
715
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
622
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
716
623
|
const instruction = {
|
|
717
624
|
accounts: [
|
|
718
|
-
getAccountMeta(accounts
|
|
719
|
-
getAccountMeta(accounts
|
|
625
|
+
getAccountMeta(accounts.payer),
|
|
626
|
+
getAccountMeta(accounts.newAccount)
|
|
720
627
|
],
|
|
721
628
|
programAddress,
|
|
722
629
|
data: getCreateAccountInstructionDataEncoder().encode(
|
|
@@ -745,30 +652,30 @@ function parseCreateAccountInstruction(instruction) {
|
|
|
745
652
|
};
|
|
746
653
|
}
|
|
747
654
|
function getCreateAccountWithSeedInstructionDataEncoder() {
|
|
748
|
-
return
|
|
749
|
-
|
|
750
|
-
["discriminator",
|
|
751
|
-
["base",
|
|
752
|
-
["seed",
|
|
753
|
-
["amount",
|
|
754
|
-
["space",
|
|
755
|
-
["programAddress",
|
|
655
|
+
return web3_js.transformEncoder(
|
|
656
|
+
web3_js.getStructEncoder([
|
|
657
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
658
|
+
["base", web3_js.getAddressEncoder()],
|
|
659
|
+
["seed", web3_js.addEncoderSizePrefix(web3_js.getUtf8Encoder(), web3_js.getU32Encoder())],
|
|
660
|
+
["amount", web3_js.getU64Encoder()],
|
|
661
|
+
["space", web3_js.getU64Encoder()],
|
|
662
|
+
["programAddress", web3_js.getAddressEncoder()]
|
|
756
663
|
]),
|
|
757
664
|
(value) => ({ ...value, discriminator: 3 })
|
|
758
665
|
);
|
|
759
666
|
}
|
|
760
667
|
function getCreateAccountWithSeedInstructionDataDecoder() {
|
|
761
|
-
return
|
|
762
|
-
["discriminator",
|
|
763
|
-
["base",
|
|
764
|
-
["seed",
|
|
765
|
-
["amount",
|
|
766
|
-
["space",
|
|
767
|
-
["programAddress",
|
|
668
|
+
return web3_js.getStructDecoder([
|
|
669
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
670
|
+
["base", web3_js.getAddressDecoder()],
|
|
671
|
+
["seed", web3_js.addDecoderSizePrefix(web3_js.getUtf8Decoder(), web3_js.getU32Decoder())],
|
|
672
|
+
["amount", web3_js.getU64Decoder()],
|
|
673
|
+
["space", web3_js.getU64Decoder()],
|
|
674
|
+
["programAddress", web3_js.getAddressDecoder()]
|
|
768
675
|
]);
|
|
769
676
|
}
|
|
770
677
|
function getCreateAccountWithSeedInstructionDataCodec() {
|
|
771
|
-
return
|
|
678
|
+
return web3_js.combineCodec(
|
|
772
679
|
getCreateAccountWithSeedInstructionDataEncoder(),
|
|
773
680
|
getCreateAccountWithSeedInstructionDataDecoder()
|
|
774
681
|
);
|
|
@@ -782,7 +689,7 @@ function getCreateAccountWithSeedInstruction(input) {
|
|
|
782
689
|
};
|
|
783
690
|
const accounts = originalAccounts;
|
|
784
691
|
const args = { ...input };
|
|
785
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
692
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
786
693
|
const instruction = {
|
|
787
694
|
accounts: [
|
|
788
695
|
getAccountMeta(accounts.payer),
|
|
@@ -819,22 +726,22 @@ function parseCreateAccountWithSeedInstruction(instruction) {
|
|
|
819
726
|
};
|
|
820
727
|
}
|
|
821
728
|
function getInitializeNonceAccountInstructionDataEncoder() {
|
|
822
|
-
return
|
|
823
|
-
|
|
824
|
-
["discriminator",
|
|
825
|
-
["nonceAuthority",
|
|
729
|
+
return web3_js.transformEncoder(
|
|
730
|
+
web3_js.getStructEncoder([
|
|
731
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
732
|
+
["nonceAuthority", web3_js.getAddressEncoder()]
|
|
826
733
|
]),
|
|
827
734
|
(value) => ({ ...value, discriminator: 6 })
|
|
828
735
|
);
|
|
829
736
|
}
|
|
830
737
|
function getInitializeNonceAccountInstructionDataDecoder() {
|
|
831
|
-
return
|
|
832
|
-
["discriminator",
|
|
833
|
-
["nonceAuthority",
|
|
738
|
+
return web3_js.getStructDecoder([
|
|
739
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
740
|
+
["nonceAuthority", web3_js.getAddressDecoder()]
|
|
834
741
|
]);
|
|
835
742
|
}
|
|
836
743
|
function getInitializeNonceAccountInstructionDataCodec() {
|
|
837
|
-
return
|
|
744
|
+
return web3_js.combineCodec(
|
|
838
745
|
getInitializeNonceAccountInstructionDataEncoder(),
|
|
839
746
|
getInitializeNonceAccountInstructionDataDecoder()
|
|
840
747
|
);
|
|
@@ -857,7 +764,7 @@ function getInitializeNonceAccountInstruction(input) {
|
|
|
857
764
|
if (!accounts.rentSysvar.value) {
|
|
858
765
|
accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
|
|
859
766
|
}
|
|
860
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
767
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
861
768
|
const instruction = {
|
|
862
769
|
accounts: [
|
|
863
770
|
getAccountMeta(accounts.nonceAccount),
|
|
@@ -894,22 +801,22 @@ function parseInitializeNonceAccountInstruction(instruction) {
|
|
|
894
801
|
};
|
|
895
802
|
}
|
|
896
803
|
function getTransferSolInstructionDataEncoder() {
|
|
897
|
-
return
|
|
898
|
-
|
|
899
|
-
["discriminator",
|
|
900
|
-
["amount",
|
|
804
|
+
return web3_js.transformEncoder(
|
|
805
|
+
web3_js.getStructEncoder([
|
|
806
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
807
|
+
["amount", web3_js.getU64Encoder()]
|
|
901
808
|
]),
|
|
902
809
|
(value) => ({ ...value, discriminator: 2 })
|
|
903
810
|
);
|
|
904
811
|
}
|
|
905
812
|
function getTransferSolInstructionDataDecoder() {
|
|
906
|
-
return
|
|
907
|
-
["discriminator",
|
|
908
|
-
["amount",
|
|
813
|
+
return web3_js.getStructDecoder([
|
|
814
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
815
|
+
["amount", web3_js.getU64Decoder()]
|
|
909
816
|
]);
|
|
910
817
|
}
|
|
911
818
|
function getTransferSolInstructionDataCodec() {
|
|
912
|
-
return
|
|
819
|
+
return web3_js.combineCodec(
|
|
913
820
|
getTransferSolInstructionDataEncoder(),
|
|
914
821
|
getTransferSolInstructionDataDecoder()
|
|
915
822
|
);
|
|
@@ -922,7 +829,7 @@ function getTransferSolInstruction(input) {
|
|
|
922
829
|
};
|
|
923
830
|
const accounts = originalAccounts;
|
|
924
831
|
const args = { ...input };
|
|
925
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
832
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
926
833
|
const instruction = {
|
|
927
834
|
accounts: [
|
|
928
835
|
getAccountMeta(accounts.source),
|
|
@@ -955,26 +862,26 @@ function parseTransferSolInstruction(instruction) {
|
|
|
955
862
|
};
|
|
956
863
|
}
|
|
957
864
|
function getTransferSolWithSeedInstructionDataEncoder() {
|
|
958
|
-
return
|
|
959
|
-
|
|
960
|
-
["discriminator",
|
|
961
|
-
["amount",
|
|
962
|
-
["fromSeed",
|
|
963
|
-
["fromOwner",
|
|
865
|
+
return web3_js.transformEncoder(
|
|
866
|
+
web3_js.getStructEncoder([
|
|
867
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
868
|
+
["amount", web3_js.getU64Encoder()],
|
|
869
|
+
["fromSeed", web3_js.addEncoderSizePrefix(web3_js.getUtf8Encoder(), web3_js.getU32Encoder())],
|
|
870
|
+
["fromOwner", web3_js.getAddressEncoder()]
|
|
964
871
|
]),
|
|
965
872
|
(value) => ({ ...value, discriminator: 11 })
|
|
966
873
|
);
|
|
967
874
|
}
|
|
968
875
|
function getTransferSolWithSeedInstructionDataDecoder() {
|
|
969
|
-
return
|
|
970
|
-
["discriminator",
|
|
971
|
-
["amount",
|
|
972
|
-
["fromSeed",
|
|
973
|
-
["fromOwner",
|
|
876
|
+
return web3_js.getStructDecoder([
|
|
877
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
878
|
+
["amount", web3_js.getU64Decoder()],
|
|
879
|
+
["fromSeed", web3_js.addDecoderSizePrefix(web3_js.getUtf8Decoder(), web3_js.getU32Decoder())],
|
|
880
|
+
["fromOwner", web3_js.getAddressDecoder()]
|
|
974
881
|
]);
|
|
975
882
|
}
|
|
976
883
|
function getTransferSolWithSeedInstructionDataCodec() {
|
|
977
|
-
return
|
|
884
|
+
return web3_js.combineCodec(
|
|
978
885
|
getTransferSolWithSeedInstructionDataEncoder(),
|
|
979
886
|
getTransferSolWithSeedInstructionDataDecoder()
|
|
980
887
|
);
|
|
@@ -988,7 +895,7 @@ function getTransferSolWithSeedInstruction(input) {
|
|
|
988
895
|
};
|
|
989
896
|
const accounts = originalAccounts;
|
|
990
897
|
const args = { ...input };
|
|
991
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
898
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
992
899
|
const instruction = {
|
|
993
900
|
accounts: [
|
|
994
901
|
getAccountMeta(accounts.source),
|
|
@@ -1025,16 +932,16 @@ function parseTransferSolWithSeedInstruction(instruction) {
|
|
|
1025
932
|
};
|
|
1026
933
|
}
|
|
1027
934
|
function getUpgradeNonceAccountInstructionDataEncoder() {
|
|
1028
|
-
return
|
|
1029
|
-
|
|
935
|
+
return web3_js.transformEncoder(
|
|
936
|
+
web3_js.getStructEncoder([["discriminator", web3_js.getU32Encoder()]]),
|
|
1030
937
|
(value) => ({ ...value, discriminator: 12 })
|
|
1031
938
|
);
|
|
1032
939
|
}
|
|
1033
940
|
function getUpgradeNonceAccountInstructionDataDecoder() {
|
|
1034
|
-
return
|
|
941
|
+
return web3_js.getStructDecoder([["discriminator", web3_js.getU32Decoder()]]);
|
|
1035
942
|
}
|
|
1036
943
|
function getUpgradeNonceAccountInstructionDataCodec() {
|
|
1037
|
-
return
|
|
944
|
+
return web3_js.combineCodec(
|
|
1038
945
|
getUpgradeNonceAccountInstructionDataEncoder(),
|
|
1039
946
|
getUpgradeNonceAccountInstructionDataDecoder()
|
|
1040
947
|
);
|
|
@@ -1045,7 +952,7 @@ function getUpgradeNonceAccountInstruction(input) {
|
|
|
1045
952
|
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true }
|
|
1046
953
|
};
|
|
1047
954
|
const accounts = originalAccounts;
|
|
1048
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
955
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1049
956
|
const instruction = {
|
|
1050
957
|
accounts: [getAccountMeta(accounts.nonceAccount)],
|
|
1051
958
|
programAddress,
|
|
@@ -1074,22 +981,22 @@ function parseUpgradeNonceAccountInstruction(instruction) {
|
|
|
1074
981
|
};
|
|
1075
982
|
}
|
|
1076
983
|
function getWithdrawNonceAccountInstructionDataEncoder() {
|
|
1077
|
-
return
|
|
1078
|
-
|
|
1079
|
-
["discriminator",
|
|
1080
|
-
["withdrawAmount",
|
|
984
|
+
return web3_js.transformEncoder(
|
|
985
|
+
web3_js.getStructEncoder([
|
|
986
|
+
["discriminator", web3_js.getU32Encoder()],
|
|
987
|
+
["withdrawAmount", web3_js.getU64Encoder()]
|
|
1081
988
|
]),
|
|
1082
989
|
(value) => ({ ...value, discriminator: 5 })
|
|
1083
990
|
);
|
|
1084
991
|
}
|
|
1085
992
|
function getWithdrawNonceAccountInstructionDataDecoder() {
|
|
1086
|
-
return
|
|
1087
|
-
["discriminator",
|
|
1088
|
-
["withdrawAmount",
|
|
993
|
+
return web3_js.getStructDecoder([
|
|
994
|
+
["discriminator", web3_js.getU32Decoder()],
|
|
995
|
+
["withdrawAmount", web3_js.getU64Decoder()]
|
|
1089
996
|
]);
|
|
1090
997
|
}
|
|
1091
998
|
function getWithdrawNonceAccountInstructionDataCodec() {
|
|
1092
|
-
return
|
|
999
|
+
return web3_js.combineCodec(
|
|
1093
1000
|
getWithdrawNonceAccountInstructionDataEncoder(),
|
|
1094
1001
|
getWithdrawNonceAccountInstructionDataDecoder()
|
|
1095
1002
|
);
|
|
@@ -1117,7 +1024,7 @@ function getWithdrawNonceAccountInstruction(input) {
|
|
|
1117
1024
|
if (!accounts.rentSysvar.value) {
|
|
1118
1025
|
accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
|
|
1119
1026
|
}
|
|
1120
|
-
const getAccountMeta = getAccountMetaFactory(programAddress
|
|
1027
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1121
1028
|
const instruction = {
|
|
1122
1029
|
accounts: [
|
|
1123
1030
|
getAccountMeta(accounts.nonceAccount),
|
|
@@ -1160,21 +1067,23 @@ function parseWithdrawNonceAccountInstruction(instruction) {
|
|
|
1160
1067
|
|
|
1161
1068
|
exports.NonceState = NonceState;
|
|
1162
1069
|
exports.NonceVersion = NonceVersion;
|
|
1070
|
+
exports.SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE = SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE;
|
|
1071
|
+
exports.SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH = SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH;
|
|
1072
|
+
exports.SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH = SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH;
|
|
1073
|
+
exports.SYSTEM_ERROR__INVALID_PROGRAM_ID = SYSTEM_ERROR__INVALID_PROGRAM_ID;
|
|
1074
|
+
exports.SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED = SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED;
|
|
1075
|
+
exports.SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED = SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED;
|
|
1076
|
+
exports.SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES = SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES;
|
|
1077
|
+
exports.SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE = SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE;
|
|
1078
|
+
exports.SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS = SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS;
|
|
1163
1079
|
exports.SYSTEM_PROGRAM_ADDRESS = SYSTEM_PROGRAM_ADDRESS;
|
|
1164
1080
|
exports.SystemAccount = SystemAccount;
|
|
1165
1081
|
exports.SystemInstruction = SystemInstruction;
|
|
1166
|
-
exports.SystemProgramError = SystemProgramError;
|
|
1167
|
-
exports.SystemProgramErrorCode = SystemProgramErrorCode;
|
|
1168
1082
|
exports.decodeNonce = decodeNonce;
|
|
1169
|
-
exports.expectAddress = expectAddress;
|
|
1170
|
-
exports.expectProgramDerivedAddress = expectProgramDerivedAddress;
|
|
1171
|
-
exports.expectSome = expectSome;
|
|
1172
|
-
exports.expectTransactionSigner = expectTransactionSigner;
|
|
1173
1083
|
exports.fetchAllMaybeNonce = fetchAllMaybeNonce;
|
|
1174
1084
|
exports.fetchAllNonce = fetchAllNonce;
|
|
1175
1085
|
exports.fetchMaybeNonce = fetchMaybeNonce;
|
|
1176
1086
|
exports.fetchNonce = fetchNonce;
|
|
1177
|
-
exports.getAccountMetaFactory = getAccountMetaFactory;
|
|
1178
1087
|
exports.getAdvanceNonceAccountInstruction = getAdvanceNonceAccountInstruction;
|
|
1179
1088
|
exports.getAdvanceNonceAccountInstructionDataCodec = getAdvanceNonceAccountInstructionDataCodec;
|
|
1180
1089
|
exports.getAdvanceNonceAccountInstructionDataDecoder = getAdvanceNonceAccountInstructionDataDecoder;
|
|
@@ -1211,9 +1120,9 @@ exports.getInitializeNonceAccountInstruction = getInitializeNonceAccountInstruct
|
|
|
1211
1120
|
exports.getInitializeNonceAccountInstructionDataCodec = getInitializeNonceAccountInstructionDataCodec;
|
|
1212
1121
|
exports.getInitializeNonceAccountInstructionDataDecoder = getInitializeNonceAccountInstructionDataDecoder;
|
|
1213
1122
|
exports.getInitializeNonceAccountInstructionDataEncoder = getInitializeNonceAccountInstructionDataEncoder;
|
|
1214
|
-
exports.
|
|
1215
|
-
exports.
|
|
1216
|
-
exports.
|
|
1123
|
+
exports.getNonceCodec = getNonceCodec;
|
|
1124
|
+
exports.getNonceDecoder = getNonceDecoder;
|
|
1125
|
+
exports.getNonceEncoder = getNonceEncoder;
|
|
1217
1126
|
exports.getNonceSize = getNonceSize;
|
|
1218
1127
|
exports.getNonceStateCodec = getNonceStateCodec;
|
|
1219
1128
|
exports.getNonceStateDecoder = getNonceStateDecoder;
|
|
@@ -1221,8 +1130,7 @@ exports.getNonceStateEncoder = getNonceStateEncoder;
|
|
|
1221
1130
|
exports.getNonceVersionCodec = getNonceVersionCodec;
|
|
1222
1131
|
exports.getNonceVersionDecoder = getNonceVersionDecoder;
|
|
1223
1132
|
exports.getNonceVersionEncoder = getNonceVersionEncoder;
|
|
1224
|
-
exports.
|
|
1225
|
-
exports.getSystemProgramErrorFromCode = getSystemProgramErrorFromCode;
|
|
1133
|
+
exports.getSystemErrorMessage = getSystemErrorMessage;
|
|
1226
1134
|
exports.getTransferSolInstruction = getTransferSolInstruction;
|
|
1227
1135
|
exports.getTransferSolInstructionDataCodec = getTransferSolInstructionDataCodec;
|
|
1228
1136
|
exports.getTransferSolInstructionDataDecoder = getTransferSolInstructionDataDecoder;
|
|
@@ -1240,8 +1148,6 @@ exports.getWithdrawNonceAccountInstructionDataCodec = getWithdrawNonceAccountIns
|
|
|
1240
1148
|
exports.getWithdrawNonceAccountInstructionDataDecoder = getWithdrawNonceAccountInstructionDataDecoder;
|
|
1241
1149
|
exports.getWithdrawNonceAccountInstructionDataEncoder = getWithdrawNonceAccountInstructionDataEncoder;
|
|
1242
1150
|
exports.identifySystemInstruction = identifySystemInstruction;
|
|
1243
|
-
exports.isTransactionSigner = isTransactionSigner;
|
|
1244
|
-
exports.memcmp = memcmp;
|
|
1245
1151
|
exports.parseAdvanceNonceAccountInstruction = parseAdvanceNonceAccountInstruction;
|
|
1246
1152
|
exports.parseAllocateInstruction = parseAllocateInstruction;
|
|
1247
1153
|
exports.parseAllocateWithSeedInstruction = parseAllocateWithSeedInstruction;
|