@solana/web3.js 1.41.1 → 1.41.4
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/lib/index.browser.cjs.js +593 -375
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +639 -422
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +610 -378
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +77 -26
- package/lib/index.esm.js +657 -426
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +12157 -12148
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -24
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +9 -5
- package/src/connection.ts +657 -486
- package/src/index.ts +1 -0
- package/src/system-program.ts +39 -10
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './stake-program';
|
|
|
16
16
|
export * from './system-program';
|
|
17
17
|
export * from './secp256k1-program';
|
|
18
18
|
export * from './transaction';
|
|
19
|
+
export * from './transaction-constants';
|
|
19
20
|
export * from './validator-info';
|
|
20
21
|
export * from './vote-account';
|
|
21
22
|
export * from './vote-program';
|
package/src/system-program.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
2
|
+
import {u64} from '@solana/buffer-layout-utils';
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
encodeData,
|
|
@@ -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(
|
|
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
|
-
):
|
|
321
|
+
): DecodedTransferWithSeedInstruction {
|
|
293
322
|
this.checkProgramId(instruction.programId);
|
|
294
323
|
this.checkKeyLength(instruction.keys, 3);
|
|
295
324
|
|
|
@@ -577,10 +606,10 @@ type SystemInstructionInputData = {
|
|
|
577
606
|
authorized: Uint8Array;
|
|
578
607
|
};
|
|
579
608
|
Transfer: IInstructionInputData & {
|
|
580
|
-
lamports:
|
|
609
|
+
lamports: bigint;
|
|
581
610
|
};
|
|
582
611
|
TransferWithSeed: IInstructionInputData & {
|
|
583
|
-
lamports:
|
|
612
|
+
lamports: bigint;
|
|
584
613
|
programId: Uint8Array;
|
|
585
614
|
seed: string;
|
|
586
615
|
};
|
|
@@ -618,7 +647,7 @@ export const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze<{
|
|
|
618
647
|
index: 2,
|
|
619
648
|
layout: BufferLayout.struct<SystemInstructionInputData['Transfer']>([
|
|
620
649
|
BufferLayout.u32('instruction'),
|
|
621
|
-
|
|
650
|
+
u64('lamports'),
|
|
622
651
|
]),
|
|
623
652
|
},
|
|
624
653
|
CreateWithSeed: {
|
|
@@ -689,7 +718,7 @@ export const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze<{
|
|
|
689
718
|
layout: BufferLayout.struct<SystemInstructionInputData['TransferWithSeed']>(
|
|
690
719
|
[
|
|
691
720
|
BufferLayout.u32('instruction'),
|
|
692
|
-
|
|
721
|
+
u64('lamports'),
|
|
693
722
|
Layout.rustString('seed'),
|
|
694
723
|
Layout.publicKey('programId'),
|
|
695
724
|
],
|
|
@@ -745,7 +774,7 @@ export class SystemProgram {
|
|
|
745
774
|
if ('basePubkey' in params) {
|
|
746
775
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed;
|
|
747
776
|
data = encodeData(type, {
|
|
748
|
-
lamports: params.lamports,
|
|
777
|
+
lamports: BigInt(params.lamports),
|
|
749
778
|
seed: params.seed,
|
|
750
779
|
programId: toBuffer(params.programId.toBuffer()),
|
|
751
780
|
});
|
|
@@ -756,7 +785,7 @@ export class SystemProgram {
|
|
|
756
785
|
];
|
|
757
786
|
} else {
|
|
758
787
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.Transfer;
|
|
759
|
-
data = encodeData(type, {lamports: params.lamports});
|
|
788
|
+
data = encodeData(type, {lamports: BigInt(params.lamports)});
|
|
760
789
|
keys = [
|
|
761
790
|
{pubkey: params.fromPubkey, isSigner: true, isWritable: true},
|
|
762
791
|
{pubkey: params.toPubkey, isSigner: false, isWritable: true},
|