@solana/web3.js 0.0.0-next → 0.0.0-pr-29130

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 (74) hide show
  1. package/README.md +24 -25
  2. package/lib/index.browser.cjs.js +4583 -4238
  3. package/lib/index.browser.cjs.js.map +1 -1
  4. package/lib/index.browser.esm.js +4565 -4238
  5. package/lib/index.browser.esm.js.map +1 -1
  6. package/lib/index.cjs.js +7072 -3604
  7. package/lib/index.cjs.js.map +1 -1
  8. package/lib/index.d.ts +3516 -2420
  9. package/lib/index.esm.js +7046 -3601
  10. package/lib/index.esm.js.map +1 -1
  11. package/lib/index.iife.js +22171 -27053
  12. package/lib/index.iife.js.map +1 -1
  13. package/lib/index.iife.min.js +8 -33
  14. package/lib/index.iife.min.js.map +1 -1
  15. package/lib/index.native.js +10407 -0
  16. package/lib/index.native.js.map +1 -0
  17. package/package.json +36 -36
  18. package/src/__forks__/browser/fetch-impl.ts +4 -0
  19. package/src/__forks__/react-native/fetch-impl.ts +4 -0
  20. package/src/account-data.ts +39 -0
  21. package/src/account.ts +20 -11
  22. package/src/bpf-loader.ts +2 -2
  23. package/src/connection.ts +2303 -635
  24. package/src/epoch-schedule.ts +1 -1
  25. package/src/errors.ts +41 -0
  26. package/src/fee-calculator.ts +2 -0
  27. package/src/fetch-impl.ts +13 -0
  28. package/src/index.ts +3 -10
  29. package/src/keypair.ts +20 -25
  30. package/src/layout.ts +45 -4
  31. package/src/loader.ts +3 -3
  32. package/src/message/account-keys.ts +79 -0
  33. package/src/message/compiled-keys.ts +165 -0
  34. package/src/message/index.ts +47 -0
  35. package/src/{message.ts → message/legacy.ts} +95 -40
  36. package/src/message/v0.ts +496 -0
  37. package/src/message/versioned.ts +36 -0
  38. package/src/nonce-account.ts +8 -4
  39. package/src/programs/address-lookup-table/index.ts +435 -0
  40. package/src/programs/address-lookup-table/state.ts +84 -0
  41. package/src/programs/compute-budget.ts +281 -0
  42. package/src/{ed25519-program.ts → programs/ed25519.ts} +6 -6
  43. package/src/programs/index.ts +7 -0
  44. package/src/{secp256k1-program.ts → programs/secp256k1.ts} +15 -16
  45. package/src/{stake-program.ts → programs/stake.ts} +7 -7
  46. package/src/{system-program.ts → programs/system.ts} +55 -18
  47. package/src/{vote-program.ts → programs/vote.ts} +137 -9
  48. package/src/publickey.ts +37 -79
  49. package/src/transaction/constants.ts +12 -0
  50. package/src/transaction/expiry-custom-errors.ts +48 -0
  51. package/src/transaction/index.ts +5 -0
  52. package/src/{transaction.ts → transaction/legacy.ts} +162 -67
  53. package/src/transaction/message.ts +140 -0
  54. package/src/transaction/versioned.ts +126 -0
  55. package/src/{util → utils}/assert.ts +0 -0
  56. package/src/utils/bigint.ts +43 -0
  57. package/src/{util → utils}/borsh-schema.ts +0 -0
  58. package/src/{util → utils}/cluster.ts +0 -0
  59. package/src/utils/ed25519.ts +46 -0
  60. package/src/utils/index.ts +5 -0
  61. package/src/utils/makeWebsocketUrl.ts +26 -0
  62. package/src/{util → utils}/promise-timeout.ts +0 -0
  63. package/src/utils/secp256k1.ts +18 -0
  64. package/src/utils/send-and-confirm-raw-transaction.ts +105 -0
  65. package/src/utils/send-and-confirm-transaction.ts +98 -0
  66. package/src/{util → utils}/shortvec-encoding.ts +0 -0
  67. package/src/{util → utils}/sleep.ts +0 -0
  68. package/src/{util → utils}/to-buffer.ts +0 -0
  69. package/src/validator-info.ts +4 -6
  70. package/src/vote-account.ts +1 -1
  71. package/src/agent-manager.ts +0 -44
  72. package/src/util/send-and-confirm-raw-transaction.ts +0 -46
  73. package/src/util/send-and-confirm-transaction.ts +0 -50
  74. package/src/util/url.ts +0 -18
@@ -0,0 +1,281 @@
1
+ import * as BufferLayout from '@solana/buffer-layout';
2
+
3
+ import {
4
+ encodeData,
5
+ decodeData,
6
+ InstructionType,
7
+ IInstructionInputData,
8
+ } from '../instruction';
9
+ import {PublicKey} from '../publickey';
10
+ import {TransactionInstruction} from '../transaction';
11
+ import {u64} from '../utils/bigint';
12
+
13
+ /**
14
+ * Compute Budget Instruction class
15
+ */
16
+ export class ComputeBudgetInstruction {
17
+ /**
18
+ * @internal
19
+ */
20
+ constructor() {}
21
+
22
+ /**
23
+ * Decode a compute budget instruction and retrieve the instruction type.
24
+ */
25
+ static decodeInstructionType(
26
+ instruction: TransactionInstruction,
27
+ ): ComputeBudgetInstructionType {
28
+ this.checkProgramId(instruction.programId);
29
+
30
+ const instructionTypeLayout = BufferLayout.u8('instruction');
31
+ const typeIndex = instructionTypeLayout.decode(instruction.data);
32
+
33
+ let type: ComputeBudgetInstructionType | undefined;
34
+ for (const [ixType, layout] of Object.entries(
35
+ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS,
36
+ )) {
37
+ if (layout.index == typeIndex) {
38
+ type = ixType as ComputeBudgetInstructionType;
39
+ break;
40
+ }
41
+ }
42
+
43
+ if (!type) {
44
+ throw new Error(
45
+ 'Instruction type incorrect; not a ComputeBudgetInstruction',
46
+ );
47
+ }
48
+
49
+ return type;
50
+ }
51
+
52
+ /**
53
+ * Decode request units compute budget instruction and retrieve the instruction params.
54
+ */
55
+ static decodeRequestUnits(
56
+ instruction: TransactionInstruction,
57
+ ): RequestUnitsParams {
58
+ this.checkProgramId(instruction.programId);
59
+ const {units, additionalFee} = decodeData(
60
+ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits,
61
+ instruction.data,
62
+ );
63
+ return {units, additionalFee};
64
+ }
65
+
66
+ /**
67
+ * Decode request heap frame compute budget instruction and retrieve the instruction params.
68
+ */
69
+ static decodeRequestHeapFrame(
70
+ instruction: TransactionInstruction,
71
+ ): RequestHeapFrameParams {
72
+ this.checkProgramId(instruction.programId);
73
+ const {bytes} = decodeData(
74
+ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame,
75
+ instruction.data,
76
+ );
77
+ return {bytes};
78
+ }
79
+
80
+ /**
81
+ * Decode set compute unit limit compute budget instruction and retrieve the instruction params.
82
+ */
83
+ static decodeSetComputeUnitLimit(
84
+ instruction: TransactionInstruction,
85
+ ): SetComputeUnitLimitParams {
86
+ this.checkProgramId(instruction.programId);
87
+ const {units} = decodeData(
88
+ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,
89
+ instruction.data,
90
+ );
91
+ return {units};
92
+ }
93
+
94
+ /**
95
+ * Decode set compute unit price compute budget instruction and retrieve the instruction params.
96
+ */
97
+ static decodeSetComputeUnitPrice(
98
+ instruction: TransactionInstruction,
99
+ ): SetComputeUnitPriceParams {
100
+ this.checkProgramId(instruction.programId);
101
+ const {microLamports} = decodeData(
102
+ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,
103
+ instruction.data,
104
+ );
105
+ return {microLamports};
106
+ }
107
+
108
+ /**
109
+ * @internal
110
+ */
111
+ static checkProgramId(programId: PublicKey) {
112
+ if (!programId.equals(ComputeBudgetProgram.programId)) {
113
+ throw new Error(
114
+ 'invalid instruction; programId is not ComputeBudgetProgram',
115
+ );
116
+ }
117
+ }
118
+ }
119
+
120
+ /**
121
+ * An enumeration of valid ComputeBudgetInstructionType's
122
+ */
123
+ export type ComputeBudgetInstructionType =
124
+ // FIXME
125
+ // It would be preferable for this type to be `keyof ComputeBudgetInstructionInputData`
126
+ // but Typedoc does not transpile `keyof` expressions.
127
+ // See https://github.com/TypeStrong/typedoc/issues/1894
128
+ | 'RequestUnits'
129
+ | 'RequestHeapFrame'
130
+ | 'SetComputeUnitLimit'
131
+ | 'SetComputeUnitPrice';
132
+
133
+ type ComputeBudgetInstructionInputData = {
134
+ RequestUnits: IInstructionInputData & Readonly<RequestUnitsParams>;
135
+ RequestHeapFrame: IInstructionInputData & Readonly<RequestHeapFrameParams>;
136
+ SetComputeUnitLimit: IInstructionInputData &
137
+ Readonly<SetComputeUnitLimitParams>;
138
+ SetComputeUnitPrice: IInstructionInputData &
139
+ Readonly<SetComputeUnitPriceParams>;
140
+ };
141
+
142
+ /**
143
+ * Request units instruction params
144
+ */
145
+ export interface RequestUnitsParams {
146
+ /** Units to request for transaction-wide compute */
147
+ units: number;
148
+ /** Prioritization fee lamports */
149
+ additionalFee: number;
150
+ }
151
+
152
+ /**
153
+ * Request heap frame instruction params
154
+ */
155
+ export type RequestHeapFrameParams = {
156
+ /** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
157
+ bytes: number;
158
+ };
159
+
160
+ /**
161
+ * Set compute unit limit instruction params
162
+ */
163
+ export interface SetComputeUnitLimitParams {
164
+ /** Transaction-wide compute unit limit */
165
+ units: number;
166
+ }
167
+
168
+ /**
169
+ * Set compute unit price instruction params
170
+ */
171
+ export interface SetComputeUnitPriceParams {
172
+ /** Transaction compute unit price used for prioritization fees */
173
+ microLamports: number | bigint;
174
+ }
175
+
176
+ /**
177
+ * An enumeration of valid ComputeBudget InstructionType's
178
+ * @internal
179
+ */
180
+ export const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze<{
181
+ [Instruction in ComputeBudgetInstructionType]: InstructionType<
182
+ ComputeBudgetInstructionInputData[Instruction]
183
+ >;
184
+ }>({
185
+ RequestUnits: {
186
+ index: 0,
187
+ layout: BufferLayout.struct<
188
+ ComputeBudgetInstructionInputData['RequestUnits']
189
+ >([
190
+ BufferLayout.u8('instruction'),
191
+ BufferLayout.u32('units'),
192
+ BufferLayout.u32('additionalFee'),
193
+ ]),
194
+ },
195
+ RequestHeapFrame: {
196
+ index: 1,
197
+ layout: BufferLayout.struct<
198
+ ComputeBudgetInstructionInputData['RequestHeapFrame']
199
+ >([BufferLayout.u8('instruction'), BufferLayout.u32('bytes')]),
200
+ },
201
+ SetComputeUnitLimit: {
202
+ index: 2,
203
+ layout: BufferLayout.struct<
204
+ ComputeBudgetInstructionInputData['SetComputeUnitLimit']
205
+ >([BufferLayout.u8('instruction'), BufferLayout.u32('units')]),
206
+ },
207
+ SetComputeUnitPrice: {
208
+ index: 3,
209
+ layout: BufferLayout.struct<
210
+ ComputeBudgetInstructionInputData['SetComputeUnitPrice']
211
+ >([BufferLayout.u8('instruction'), u64('microLamports')]),
212
+ },
213
+ });
214
+
215
+ /**
216
+ * Factory class for transaction instructions to interact with the Compute Budget program
217
+ */
218
+ export class ComputeBudgetProgram {
219
+ /**
220
+ * @internal
221
+ */
222
+ constructor() {}
223
+
224
+ /**
225
+ * Public key that identifies the Compute Budget program
226
+ */
227
+ static programId: PublicKey = new PublicKey(
228
+ 'ComputeBudget111111111111111111111111111111',
229
+ );
230
+
231
+ /**
232
+ * @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
233
+ */
234
+ static requestUnits(params: RequestUnitsParams): TransactionInstruction {
235
+ const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
236
+ const data = encodeData(type, params);
237
+ return new TransactionInstruction({
238
+ keys: [],
239
+ programId: this.programId,
240
+ data,
241
+ });
242
+ }
243
+
244
+ static requestHeapFrame(
245
+ params: RequestHeapFrameParams,
246
+ ): TransactionInstruction {
247
+ const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;
248
+ const data = encodeData(type, params);
249
+ return new TransactionInstruction({
250
+ keys: [],
251
+ programId: this.programId,
252
+ data,
253
+ });
254
+ }
255
+
256
+ static setComputeUnitLimit(
257
+ params: SetComputeUnitLimitParams,
258
+ ): TransactionInstruction {
259
+ const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
260
+ const data = encodeData(type, params);
261
+ return new TransactionInstruction({
262
+ keys: [],
263
+ programId: this.programId,
264
+ data,
265
+ });
266
+ }
267
+
268
+ static setComputeUnitPrice(
269
+ params: SetComputeUnitPriceParams,
270
+ ): TransactionInstruction {
271
+ const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice;
272
+ const data = encodeData(type, {
273
+ microLamports: BigInt(params.microLamports),
274
+ });
275
+ return new TransactionInstruction({
276
+ keys: [],
277
+ programId: this.programId,
278
+ data,
279
+ });
280
+ }
281
+ }
@@ -1,11 +1,11 @@
1
1
  import {Buffer} from 'buffer';
2
2
  import * as BufferLayout from '@solana/buffer-layout';
3
- import nacl from 'tweetnacl';
4
3
 
5
- import {Keypair} from './keypair';
6
- import {PublicKey} from './publickey';
7
- import {TransactionInstruction} from './transaction';
8
- import assert from './util/assert';
4
+ import {Keypair} from '../keypair';
5
+ import {PublicKey} from '../publickey';
6
+ import {TransactionInstruction} from '../transaction';
7
+ import assert from '../utils/assert';
8
+ import {sign} from '../utils/ed25519';
9
9
 
10
10
  const PRIVATE_KEY_BYTES = 64;
11
11
  const PUBLIC_KEY_BYTES = 32;
@@ -142,7 +142,7 @@ export class Ed25519Program {
142
142
  try {
143
143
  const keypair = Keypair.fromSecretKey(privateKey);
144
144
  const publicKey = keypair.publicKey.toBytes();
145
- const signature = nacl.sign.detached(message, keypair.secretKey);
145
+ const signature = sign(message, keypair.secretKey);
146
146
 
147
147
  return this.createInstructionWithPublicKey({
148
148
  publicKey,
@@ -0,0 +1,7 @@
1
+ export * from './address-lookup-table';
2
+ export * from './compute-budget';
3
+ export * from './ed25519';
4
+ export * from './secp256k1';
5
+ export * from './stake';
6
+ export * from './system';
7
+ export * from './vote';
@@ -1,14 +1,12 @@
1
1
  import {Buffer} from 'buffer';
2
2
  import * as BufferLayout from '@solana/buffer-layout';
3
- import secp256k1 from 'secp256k1';
4
- import sha3 from 'js-sha3';
3
+ import {keccak_256} from '@noble/hashes/sha3';
5
4
 
6
- import {PublicKey} from './publickey';
7
- import {TransactionInstruction} from './transaction';
8
- import assert from './util/assert';
9
- import {toBuffer} from './util/to-buffer';
10
-
11
- const {publicKeyCreate, ecdsaSign} = secp256k1;
5
+ import {PublicKey} from '../publickey';
6
+ import {TransactionInstruction} from '../transaction';
7
+ import assert from '../utils/assert';
8
+ import {publicKeyCreate, ecdsaSign} from '../utils/secp256k1';
9
+ import {toBuffer} from '../utils/to-buffer';
12
10
 
13
11
  const PRIVATE_KEY_BYTES = 32;
14
12
  const ETHEREUM_ADDRESS_BYTES = 20;
@@ -100,9 +98,9 @@ export class Secp256k1Program {
100
98
  );
101
99
 
102
100
  try {
103
- return Buffer.from(
104
- sha3.keccak_256.update(toBuffer(publicKey)).digest(),
105
- ).slice(-ETHEREUM_ADDRESS_BYTES);
101
+ return Buffer.from(keccak_256(toBuffer(publicKey))).slice(
102
+ -ETHEREUM_ADDRESS_BYTES,
103
+ );
106
104
  } catch (error) {
107
105
  throw new Error(`Error constructing Ethereum address: ${error}`);
108
106
  }
@@ -209,11 +207,12 @@ export class Secp256k1Program {
209
207
 
210
208
  try {
211
209
  const privateKey = toBuffer(pkey);
212
- const publicKey = publicKeyCreate(privateKey, false).slice(1); // throw away leading byte
213
- const messageHash = Buffer.from(
214
- sha3.keccak_256.update(toBuffer(message)).digest(),
215
- );
216
- const {signature, recid: recoveryId} = ecdsaSign(messageHash, privateKey);
210
+ const publicKey = publicKeyCreate(
211
+ privateKey,
212
+ false /* isCompressed */,
213
+ ).slice(1); // throw away leading byte
214
+ const messageHash = Buffer.from(keccak_256(toBuffer(message)));
215
+ const [signature, recoveryId] = ecdsaSign(messageHash, privateKey);
217
216
 
218
217
  return this.createInstructionWithPublicKey({
219
218
  publicKey,
@@ -5,17 +5,17 @@ import {
5
5
  decodeData,
6
6
  InstructionType,
7
7
  IInstructionInputData,
8
- } from './instruction';
9
- import * as Layout from './layout';
10
- import {PublicKey} from './publickey';
11
- import {SystemProgram} from './system-program';
8
+ } from '../instruction';
9
+ import * as Layout from '../layout';
10
+ import {PublicKey} from '../publickey';
11
+ import {SystemProgram} from './system';
12
12
  import {
13
13
  SYSVAR_CLOCK_PUBKEY,
14
14
  SYSVAR_RENT_PUBKEY,
15
15
  SYSVAR_STAKE_HISTORY_PUBKEY,
16
- } from './sysvar';
17
- import {Transaction, TransactionInstruction} from './transaction';
18
- import {toBuffer} from './util/to-buffer';
16
+ } from '../sysvar';
17
+ import {Transaction, TransactionInstruction} from '../transaction';
18
+ import {toBuffer} from '../utils/to-buffer';
19
19
 
20
20
  /**
21
21
  * Address of the stake config account which configures the rate
@@ -5,13 +5,14 @@ import {
5
5
  decodeData,
6
6
  InstructionType,
7
7
  IInstructionInputData,
8
- } from './instruction';
9
- import * as Layout from './layout';
10
- import {NONCE_ACCOUNT_LENGTH} from './nonce-account';
11
- import {PublicKey} from './publickey';
12
- import {SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY} from './sysvar';
13
- import {Transaction, TransactionInstruction} from './transaction';
14
- import {toBuffer} from './util/to-buffer';
8
+ } from '../instruction';
9
+ import * as Layout from '../layout';
10
+ import {NONCE_ACCOUNT_LENGTH} from '../nonce-account';
11
+ import {PublicKey} from '../publickey';
12
+ import {SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY} from '../sysvar';
13
+ import {Transaction, TransactionInstruction} from '../transaction';
14
+ import {toBuffer} from '../utils/to-buffer';
15
+ import {u64} from '../utils/bigint';
15
16
 
16
17
  /**
17
18
  * Create account system transaction params
@@ -38,7 +39,7 @@ export type TransferParams = {
38
39
  /** Account that will receive transferred lamports */
39
40
  toPubkey: PublicKey;
40
41
  /** Amount of lamports to transfer */
41
- lamports: number;
42
+ lamports: number | bigint;
42
43
  };
43
44
 
44
45
  /**
@@ -200,7 +201,33 @@ export type TransferWithSeedParams = {
200
201
  /** Account that will receive transferred lamports */
201
202
  toPubkey: PublicKey;
202
203
  /** Amount of lamports to transfer */
203
- lamports: number;
204
+ lamports: number | bigint;
205
+ /** Seed to use to derive the funding account address */
206
+ seed: string;
207
+ /** Program id to use to derive the funding account address */
208
+ programId: PublicKey;
209
+ };
210
+
211
+ /** Decoded transfer system transaction instruction */
212
+ export type DecodedTransferInstruction = {
213
+ /** Account that will transfer lamports */
214
+ fromPubkey: PublicKey;
215
+ /** Account that will receive transferred lamports */
216
+ toPubkey: PublicKey;
217
+ /** Amount of lamports to transfer */
218
+ lamports: bigint;
219
+ };
220
+
221
+ /** Decoded transferWithSeed system transaction instruction */
222
+ export type DecodedTransferWithSeedInstruction = {
223
+ /** Account that will transfer lamports */
224
+ fromPubkey: PublicKey;
225
+ /** Base public key to use to derive the funding account address */
226
+ basePubkey: PublicKey;
227
+ /** Account that will receive transferred lamports */
228
+ toPubkey: PublicKey;
229
+ /** Amount of lamports to transfer */
230
+ lamports: bigint;
204
231
  /** Seed to use to derive the funding account address */
205
232
  seed: string;
206
233
  /** Program id to use to derive the funding account address */
@@ -268,7 +295,9 @@ export class SystemInstruction {
268
295
  /**
269
296
  * Decode a transfer system instruction and retrieve the instruction params.
270
297
  */
271
- static decodeTransfer(instruction: TransactionInstruction): TransferParams {
298
+ static decodeTransfer(
299
+ instruction: TransactionInstruction,
300
+ ): DecodedTransferInstruction {
272
301
  this.checkProgramId(instruction.programId);
273
302
  this.checkKeyLength(instruction.keys, 2);
274
303
 
@@ -289,7 +318,7 @@ export class SystemInstruction {
289
318
  */
290
319
  static decodeTransferWithSeed(
291
320
  instruction: TransactionInstruction,
292
- ): TransferWithSeedParams {
321
+ ): DecodedTransferWithSeedInstruction {
293
322
  this.checkProgramId(instruction.programId);
294
323
  this.checkKeyLength(instruction.keys, 3);
295
324
 
@@ -537,7 +566,8 @@ export type SystemInstructionType =
537
566
  | 'InitializeNonceAccount'
538
567
  | 'Transfer'
539
568
  | 'TransferWithSeed'
540
- | 'WithdrawNonceAccount';
569
+ | 'WithdrawNonceAccount'
570
+ | 'UpgradeNonceAccount';
541
571
 
542
572
  type SystemInstructionInputData = {
543
573
  AdvanceNonceAccount: IInstructionInputData;
@@ -577,16 +607,17 @@ type SystemInstructionInputData = {
577
607
  authorized: Uint8Array;
578
608
  };
579
609
  Transfer: IInstructionInputData & {
580
- lamports: number;
610
+ lamports: bigint;
581
611
  };
582
612
  TransferWithSeed: IInstructionInputData & {
583
- lamports: number;
613
+ lamports: bigint;
584
614
  programId: Uint8Array;
585
615
  seed: string;
586
616
  };
587
617
  WithdrawNonceAccount: IInstructionInputData & {
588
618
  lamports: number;
589
619
  };
620
+ UpgradeNonceAccount: IInstructionInputData;
590
621
  };
591
622
 
592
623
  /**
@@ -618,7 +649,7 @@ export const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze<{
618
649
  index: 2,
619
650
  layout: BufferLayout.struct<SystemInstructionInputData['Transfer']>([
620
651
  BufferLayout.u32('instruction'),
621
- BufferLayout.ns64('lamports'),
652
+ u64('lamports'),
622
653
  ]),
623
654
  },
624
655
  CreateWithSeed: {
@@ -689,12 +720,18 @@ export const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze<{
689
720
  layout: BufferLayout.struct<SystemInstructionInputData['TransferWithSeed']>(
690
721
  [
691
722
  BufferLayout.u32('instruction'),
692
- BufferLayout.ns64('lamports'),
723
+ u64('lamports'),
693
724
  Layout.rustString('seed'),
694
725
  Layout.publicKey('programId'),
695
726
  ],
696
727
  ),
697
728
  },
729
+ UpgradeNonceAccount: {
730
+ index: 12,
731
+ layout: BufferLayout.struct<
732
+ SystemInstructionInputData['UpgradeNonceAccount']
733
+ >([BufferLayout.u32('instruction')]),
734
+ },
698
735
  });
699
736
 
700
737
  /**
@@ -745,7 +782,7 @@ export class SystemProgram {
745
782
  if ('basePubkey' in params) {
746
783
  const type = SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed;
747
784
  data = encodeData(type, {
748
- lamports: params.lamports,
785
+ lamports: BigInt(params.lamports),
749
786
  seed: params.seed,
750
787
  programId: toBuffer(params.programId.toBuffer()),
751
788
  });
@@ -756,7 +793,7 @@ export class SystemProgram {
756
793
  ];
757
794
  } else {
758
795
  const type = SYSTEM_INSTRUCTION_LAYOUTS.Transfer;
759
- data = encodeData(type, {lamports: params.lamports});
796
+ data = encodeData(type, {lamports: BigInt(params.lamports)});
760
797
  keys = [
761
798
  {pubkey: params.fromPubkey, isSigner: true, isWritable: true},
762
799
  {pubkey: params.toPubkey, isSigner: false, isWritable: true},