@solana-program/system 0.2.0 → 0.3.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.
Files changed (47) hide show
  1. package/dist/src/index.cjs +244 -338
  2. package/dist/src/index.cjs.map +1 -1
  3. package/dist/src/index.js +112 -205
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/types/src/generated/accounts/nonce.d.ts +12 -16
  6. package/dist/types/src/generated/accounts/nonce.d.ts.map +1 -1
  7. package/dist/types/src/generated/errors/system.d.ts +20 -27
  8. package/dist/types/src/generated/errors/system.d.ts.map +1 -1
  9. package/dist/types/src/generated/index.d.ts +0 -1
  10. package/dist/types/src/generated/index.d.ts.map +1 -1
  11. package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts +1 -4
  12. package/dist/types/src/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
  13. package/dist/types/src/generated/instructions/allocate.d.ts +1 -4
  14. package/dist/types/src/generated/instructions/allocate.d.ts.map +1 -1
  15. package/dist/types/src/generated/instructions/allocateWithSeed.d.ts +1 -4
  16. package/dist/types/src/generated/instructions/allocateWithSeed.d.ts.map +1 -1
  17. package/dist/types/src/generated/instructions/assign.d.ts +1 -4
  18. package/dist/types/src/generated/instructions/assign.d.ts.map +1 -1
  19. package/dist/types/src/generated/instructions/assignWithSeed.d.ts +1 -4
  20. package/dist/types/src/generated/instructions/assignWithSeed.d.ts.map +1 -1
  21. package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts +1 -4
  22. package/dist/types/src/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
  23. package/dist/types/src/generated/instructions/createAccount.d.ts +1 -4
  24. package/dist/types/src/generated/instructions/createAccount.d.ts.map +1 -1
  25. package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts +1 -4
  26. package/dist/types/src/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
  27. package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts +1 -3
  28. package/dist/types/src/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
  29. package/dist/types/src/generated/instructions/transferSol.d.ts +1 -4
  30. package/dist/types/src/generated/instructions/transferSol.d.ts.map +1 -1
  31. package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts +1 -4
  32. package/dist/types/src/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
  33. package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts +1 -3
  34. package/dist/types/src/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
  35. package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts +1 -4
  36. package/dist/types/src/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
  37. package/dist/types/src/generated/programs/system.d.ts +1 -5
  38. package/dist/types/src/generated/programs/system.d.ts.map +1 -1
  39. package/dist/types/src/generated/shared/index.d.ts +1 -4
  40. package/dist/types/src/generated/shared/index.d.ts.map +1 -1
  41. package/dist/types/src/generated/types/nonceState.d.ts +1 -1
  42. package/dist/types/src/generated/types/nonceState.d.ts.map +1 -1
  43. package/dist/types/src/generated/types/nonceVersion.d.ts +1 -1
  44. package/dist/types/src/generated/types/nonceVersion.d.ts.map +1 -1
  45. package/dist/types/test/_setup.d.ts +5 -5
  46. package/dist/types/test/_setup.d.ts.map +1 -1
  47. package/package.json +5 -10
@@ -1,10 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var accounts = require('@solana/accounts');
4
- var addresses = require('@solana/addresses');
5
- var codecs = require('@solana/codecs');
6
- var instructions = require('@solana/instructions');
7
- var signers = require('@solana/signers');
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 codecs.getScalarEnumEncoder(NonceState, { size: codecs.getU32Encoder() });
13
+ return web3_js.getEnumEncoder(NonceState, { size: web3_js.getU32Encoder() });
18
14
  }
19
15
  function getNonceStateDecoder() {
20
- return codecs.getScalarEnumDecoder(NonceState, { size: codecs.getU32Decoder() });
16
+ return web3_js.getEnumDecoder(NonceState, { size: web3_js.getU32Decoder() });
21
17
  }
22
18
  function getNonceStateCodec() {
23
- return codecs.combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
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 codecs.getScalarEnumEncoder(NonceVersion, { size: codecs.getU32Encoder() });
27
+ return web3_js.getEnumEncoder(NonceVersion, { size: web3_js.getU32Encoder() });
32
28
  }
33
29
  function getNonceVersionDecoder() {
34
- return codecs.getScalarEnumDecoder(NonceVersion, { size: codecs.getU32Decoder() });
30
+ return web3_js.getEnumDecoder(NonceVersion, { size: web3_js.getU32Decoder() });
35
31
  }
36
32
  function getNonceVersionCodec() {
37
- return codecs.combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
33
+ return web3_js.combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
38
34
  }
39
35
 
40
36
  // src/generated/accounts/nonce.ts
41
- function getNonceAccountDataEncoder() {
42
- return codecs.getStructEncoder([
37
+ function getNonceEncoder() {
38
+ return web3_js.getStructEncoder([
43
39
  ["version", getNonceVersionEncoder()],
44
40
  ["state", getNonceStateEncoder()],
45
- ["authority", addresses.getAddressEncoder()],
46
- ["blockhash", addresses.getAddressEncoder()],
47
- ["lamportsPerSignature", codecs.getU64Encoder()]
41
+ ["authority", web3_js.getAddressEncoder()],
42
+ ["blockhash", web3_js.getAddressEncoder()],
43
+ ["lamportsPerSignature", web3_js.getU64Encoder()]
48
44
  ]);
49
45
  }
50
- function getNonceAccountDataDecoder() {
51
- return codecs.getStructDecoder([
46
+ function getNonceDecoder() {
47
+ return web3_js.getStructDecoder([
52
48
  ["version", getNonceVersionDecoder()],
53
49
  ["state", getNonceStateDecoder()],
54
- ["authority", addresses.getAddressDecoder()],
55
- ["blockhash", addresses.getAddressDecoder()],
56
- ["lamportsPerSignature", codecs.getU64Decoder()]
50
+ ["authority", web3_js.getAddressDecoder()],
51
+ ["blockhash", web3_js.getAddressDecoder()],
52
+ ["lamportsPerSignature", web3_js.getU64Decoder()]
57
53
  ]);
58
54
  }
59
- function getNonceAccountDataCodec() {
60
- return codecs.combineCodec(
61
- getNonceAccountDataEncoder(),
62
- getNonceAccountDataDecoder()
63
- );
55
+ function getNonceCodec() {
56
+ return web3_js.combineCodec(getNonceEncoder(), getNonceDecoder());
64
57
  }
65
58
  function decodeNonce(encodedAccount) {
66
- return accounts.decodeAccount(
59
+ return web3_js.decodeAccount(
67
60
  encodedAccount,
68
- getNonceAccountDataDecoder()
61
+ getNonceDecoder()
69
62
  );
70
63
  }
71
64
  async function fetchNonce(rpc, address, config) {
72
65
  const maybeAccount = await fetchMaybeNonce(rpc, address, config);
73
- accounts.assertAccountExists(maybeAccount);
66
+ web3_js.assertAccountExists(maybeAccount);
74
67
  return maybeAccount;
75
68
  }
76
69
  async function fetchMaybeNonce(rpc, address, config) {
77
- const maybeAccount = await accounts.fetchEncodedAccount(rpc, address, config);
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
- accounts.assertAccountsExist(maybeAccounts);
75
+ web3_js.assertAccountsExist(maybeAccounts);
83
76
  return maybeAccounts;
84
77
  }
85
78
  async function fetchAllMaybeNonce(rpc, addresses, config) {
86
- const maybeAccounts = await accounts.fetchEncodedAccounts(rpc, addresses, config);
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 SystemProgramErrorCode = /* @__PURE__ */ ((SystemProgramErrorCode3) => {
95
- SystemProgramErrorCode3[SystemProgramErrorCode3["ACCOUNT_ALREADY_IN_USE"] = 0] = "ACCOUNT_ALREADY_IN_USE";
96
- SystemProgramErrorCode3[SystemProgramErrorCode3["RESULT_WITH_NEGATIVE_LAMPORTS"] = 1] = "RESULT_WITH_NEGATIVE_LAMPORTS";
97
- SystemProgramErrorCode3[SystemProgramErrorCode3["INVALID_PROGRAM_ID"] = 2] = "INVALID_PROGRAM_ID";
98
- SystemProgramErrorCode3[SystemProgramErrorCode3["INVALID_ACCOUNT_DATA_LENGTH"] = 3] = "INVALID_ACCOUNT_DATA_LENGTH";
99
- SystemProgramErrorCode3[SystemProgramErrorCode3["MAX_SEED_LENGTH_EXCEEDED"] = 4] = "MAX_SEED_LENGTH_EXCEEDED";
100
- SystemProgramErrorCode3[SystemProgramErrorCode3["ADDRESS_WITH_SEED_MISMATCH"] = 5] = "ADDRESS_WITH_SEED_MISMATCH";
101
- SystemProgramErrorCode3[SystemProgramErrorCode3["NONCE_NO_RECENT_BLOCKHASHES"] = 6] = "NONCE_NO_RECENT_BLOCKHASHES";
102
- SystemProgramErrorCode3[SystemProgramErrorCode3["NONCE_BLOCKHASH_NOT_EXPIRED"] = 7] = "NONCE_BLOCKHASH_NOT_EXPIRED";
103
- SystemProgramErrorCode3[SystemProgramErrorCode3["NONCE_UNEXPECTED_BLOCKHASH_VALUE"] = 8] = "NONCE_UNEXPECTED_BLOCKHASH_VALUE";
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
- systemProgramErrorCodeMap = {
119
- [0 /* ACCOUNT_ALREADY_IN_USE */]: [
120
- "AccountAlreadyInUse",
121
- `an account with the same address already exists`
122
- ],
123
- [1 /* RESULT_WITH_NEGATIVE_LAMPORTS */]: [
124
- "ResultWithNegativeLamports",
125
- `account does not have enough SOL to perform the operation`
126
- ],
127
- [2 /* INVALID_PROGRAM_ID */]: [
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 getSystemProgramErrorFromCode(code, cause) {
110
+ function getSystemErrorMessage(code) {
158
111
  if (__DEV__) {
159
- return new SystemProgramError(
160
- code,
161
- ...systemProgramErrorCodeMap[code],
162
- cause
163
- );
112
+ return systemErrorMessages[code];
164
113
  }
165
- return new SystemProgramError(
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 (memcmp(data, codecs.getU32Encoder().encode(0), 0)) {
139
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(0), 0)) {
264
140
  return 0 /* CreateAccount */;
265
141
  }
266
- if (memcmp(data, codecs.getU32Encoder().encode(1), 0)) {
142
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(1), 0)) {
267
143
  return 1 /* Assign */;
268
144
  }
269
- if (memcmp(data, codecs.getU32Encoder().encode(2), 0)) {
145
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(2), 0)) {
270
146
  return 2 /* TransferSol */;
271
147
  }
272
- if (memcmp(data, codecs.getU32Encoder().encode(3), 0)) {
148
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(3), 0)) {
273
149
  return 3 /* CreateAccountWithSeed */;
274
150
  }
275
- if (memcmp(data, codecs.getU32Encoder().encode(4), 0)) {
151
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(4), 0)) {
276
152
  return 4 /* AdvanceNonceAccount */;
277
153
  }
278
- if (memcmp(data, codecs.getU32Encoder().encode(5), 0)) {
154
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(5), 0)) {
279
155
  return 5 /* WithdrawNonceAccount */;
280
156
  }
281
- if (memcmp(data, codecs.getU32Encoder().encode(6), 0)) {
157
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(6), 0)) {
282
158
  return 6 /* InitializeNonceAccount */;
283
159
  }
284
- if (memcmp(data, codecs.getU32Encoder().encode(7), 0)) {
160
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(7), 0)) {
285
161
  return 7 /* AuthorizeNonceAccount */;
286
162
  }
287
- if (memcmp(data, codecs.getU32Encoder().encode(8), 0)) {
163
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(8), 0)) {
288
164
  return 8 /* Allocate */;
289
165
  }
290
- if (memcmp(data, codecs.getU32Encoder().encode(9), 0)) {
166
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(9), 0)) {
291
167
  return 9 /* AllocateWithSeed */;
292
168
  }
293
- if (memcmp(data, codecs.getU32Encoder().encode(10), 0)) {
169
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(10), 0)) {
294
170
  return 10 /* AssignWithSeed */;
295
171
  }
296
- if (memcmp(data, codecs.getU32Encoder().encode(11), 0)) {
172
+ if (web3_js.containsBytes(data, web3_js.getU32Encoder().encode(11), 0)) {
297
173
  return 11 /* TransferSolWithSeed */;
298
174
  }
299
- if (memcmp(data, codecs.getU32Encoder().encode(12), 0)) {
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 codecs.mapEncoder(
310
- codecs.getStructEncoder([["discriminator", codecs.getU32Encoder()]]),
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 codecs.getStructDecoder([["discriminator", codecs.getU32Decoder()]]);
222
+ return web3_js.getStructDecoder([["discriminator", web3_js.getU32Decoder()]]);
316
223
  }
317
224
  function getAdvanceNonceAccountInstructionDataCodec() {
318
- return codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
373
- codecs.getStructEncoder([
374
- ["discriminator", codecs.getU32Encoder()],
375
- ["space", codecs.getU64Encoder()]
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 codecs.getStructDecoder([
382
- ["discriminator", codecs.getU32Decoder()],
383
- ["space", codecs.getU64Decoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
429
- codecs.getStructEncoder([
430
- ["discriminator", codecs.getU32Encoder()],
431
- ["base", addresses.getAddressEncoder()],
432
- ["seed", codecs.getStringEncoder()],
433
- ["space", codecs.getU64Encoder()],
434
- ["programAddress", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
441
- ["discriminator", codecs.getU32Decoder()],
442
- ["base", addresses.getAddressDecoder()],
443
- ["seed", codecs.getStringDecoder()],
444
- ["space", codecs.getU64Decoder()],
445
- ["programAddress", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
496
- codecs.getStructEncoder([
497
- ["discriminator", codecs.getU32Encoder()],
498
- ["programAddress", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
505
- ["discriminator", codecs.getU32Decoder()],
506
- ["programAddress", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
552
- codecs.getStructEncoder([
553
- ["discriminator", codecs.getU32Encoder()],
554
- ["base", addresses.getAddressEncoder()],
555
- ["seed", codecs.getStringEncoder()],
556
- ["programAddress", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
563
- ["discriminator", codecs.getU32Decoder()],
564
- ["base", addresses.getAddressDecoder()],
565
- ["seed", codecs.getStringDecoder()],
566
- ["programAddress", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
617
- codecs.getStructEncoder([
618
- ["discriminator", codecs.getU32Encoder()],
619
- ["newNonceAuthority", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
626
- ["discriminator", codecs.getU32Decoder()],
627
- ["newNonceAuthority", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
680
- codecs.getStructEncoder([
681
- ["discriminator", codecs.getU32Encoder()],
682
- ["lamports", codecs.getU64Encoder()],
683
- ["space", codecs.getU64Encoder()],
684
- ["programAddress", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
691
- ["discriminator", codecs.getU32Decoder()],
692
- ["lamports", codecs.getU64Decoder()],
693
- ["space", codecs.getU64Decoder()],
694
- ["programAddress", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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$1 = originalAccounts;
616
+ const accounts = originalAccounts;
710
617
  const args = { ...input };
711
- const byteDelta = [Number(args.space) + accounts.BASE_ACCOUNT_SIZE].reduce(
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, "programId");
622
+ const getAccountMeta = getAccountMetaFactory(programAddress);
716
623
  const instruction = {
717
624
  accounts: [
718
- getAccountMeta(accounts$1.payer),
719
- getAccountMeta(accounts$1.newAccount)
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 codecs.mapEncoder(
749
- codecs.getStructEncoder([
750
- ["discriminator", codecs.getU32Encoder()],
751
- ["base", addresses.getAddressEncoder()],
752
- ["seed", codecs.getStringEncoder()],
753
- ["amount", codecs.getU64Encoder()],
754
- ["space", codecs.getU64Encoder()],
755
- ["programAddress", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
762
- ["discriminator", codecs.getU32Decoder()],
763
- ["base", addresses.getAddressDecoder()],
764
- ["seed", codecs.getStringDecoder()],
765
- ["amount", codecs.getU64Decoder()],
766
- ["space", codecs.getU64Decoder()],
767
- ["programAddress", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
823
- codecs.getStructEncoder([
824
- ["discriminator", codecs.getU32Encoder()],
825
- ["nonceAuthority", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
832
- ["discriminator", codecs.getU32Decoder()],
833
- ["nonceAuthority", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
898
- codecs.getStructEncoder([
899
- ["discriminator", codecs.getU32Encoder()],
900
- ["amount", codecs.getU64Encoder()]
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 codecs.getStructDecoder([
907
- ["discriminator", codecs.getU32Decoder()],
908
- ["amount", codecs.getU64Decoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
959
- codecs.getStructEncoder([
960
- ["discriminator", codecs.getU32Encoder()],
961
- ["amount", codecs.getU64Encoder()],
962
- ["fromSeed", codecs.getStringEncoder()],
963
- ["fromOwner", addresses.getAddressEncoder()]
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 codecs.getStructDecoder([
970
- ["discriminator", codecs.getU32Decoder()],
971
- ["amount", codecs.getU64Decoder()],
972
- ["fromSeed", codecs.getStringDecoder()],
973
- ["fromOwner", addresses.getAddressDecoder()]
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 codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
1029
- codecs.getStructEncoder([["discriminator", codecs.getU32Encoder()]]),
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 codecs.getStructDecoder([["discriminator", codecs.getU32Decoder()]]);
941
+ return web3_js.getStructDecoder([["discriminator", web3_js.getU32Decoder()]]);
1035
942
  }
1036
943
  function getUpgradeNonceAccountInstructionDataCodec() {
1037
- return codecs.combineCodec(
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, "programId");
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 codecs.mapEncoder(
1078
- codecs.getStructEncoder([
1079
- ["discriminator", codecs.getU32Encoder()],
1080
- ["withdrawAmount", codecs.getU64Encoder()]
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 codecs.getStructDecoder([
1087
- ["discriminator", codecs.getU32Decoder()],
1088
- ["withdrawAmount", codecs.getU64Decoder()]
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 codecs.combineCodec(
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, "programId");
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.getNonceAccountDataCodec = getNonceAccountDataCodec;
1215
- exports.getNonceAccountDataDecoder = getNonceAccountDataDecoder;
1216
- exports.getNonceAccountDataEncoder = getNonceAccountDataEncoder;
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.getSystemProgram = getSystemProgram;
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;