@solana/web3.js 1.57.0 → 1.59.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/lib/index.browser.cjs.js +460 -121
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +460 -121
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +460 -121
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +105 -1
- package/lib/index.esm.js +460 -121
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +726 -831
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +5 -13
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +460 -121
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -2
- package/src/connection.ts +106 -2
- package/src/layout.ts +22 -0
- package/src/message/legacy.ts +34 -2
- package/src/message/v0.ts +90 -0
- package/src/programs/secp256k1.ts +5 -7
- package/src/programs/vote.ts +109 -2
- package/src/transaction/index.ts +1 -0
- package/src/transaction/message.ts +138 -0
package/lib/index.d.ts
CHANGED
|
@@ -352,12 +352,17 @@ declare module '@solana/web3.js' {
|
|
|
352
352
|
/** The message header, identifying signed and read-only `accountKeys` */
|
|
353
353
|
header: MessageHeader;
|
|
354
354
|
/** All the account keys used by this transaction */
|
|
355
|
-
accountKeys: string[];
|
|
355
|
+
accountKeys: string[] | PublicKey[];
|
|
356
356
|
/** The hash of a recent ledger block */
|
|
357
357
|
recentBlockhash: Blockhash;
|
|
358
358
|
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
|
|
359
359
|
instructions: CompiledInstruction[];
|
|
360
360
|
};
|
|
361
|
+
export type CompileLegacyArgs = {
|
|
362
|
+
payerKey: PublicKey;
|
|
363
|
+
instructions: Array<TransactionInstruction>;
|
|
364
|
+
recentBlockhash: Blockhash;
|
|
365
|
+
};
|
|
361
366
|
/**
|
|
362
367
|
* List of instructions to be processed atomically
|
|
363
368
|
*/
|
|
@@ -372,6 +377,8 @@ declare module '@solana/web3.js' {
|
|
|
372
377
|
get staticAccountKeys(): Array<PublicKey>;
|
|
373
378
|
get compiledInstructions(): Array<MessageCompiledInstruction>;
|
|
374
379
|
get addressTableLookups(): Array<MessageAddressTableLookup>;
|
|
380
|
+
getAccountKeys(): MessageAccountKeys;
|
|
381
|
+
static compile(args: CompileLegacyArgs): Message;
|
|
375
382
|
isAccountSigner(index: number): boolean;
|
|
376
383
|
isAccountWritable(index: number): boolean;
|
|
377
384
|
isProgramId(index: number): boolean;
|
|
@@ -1395,6 +1402,17 @@ declare module '@solana/web3.js' {
|
|
|
1395
1402
|
newAuthorizedPubkey: PublicKey;
|
|
1396
1403
|
voteAuthorizationType: VoteAuthorizationType;
|
|
1397
1404
|
};
|
|
1405
|
+
/**
|
|
1406
|
+
* AuthorizeWithSeed instruction params
|
|
1407
|
+
*/
|
|
1408
|
+
export type AuthorizeVoteWithSeedParams = {
|
|
1409
|
+
currentAuthorityDerivedKeyBasePubkey: PublicKey;
|
|
1410
|
+
currentAuthorityDerivedKeyOwnerPubkey: PublicKey;
|
|
1411
|
+
currentAuthorityDerivedKeySeed: string;
|
|
1412
|
+
newAuthorizedPubkey: PublicKey;
|
|
1413
|
+
voteAuthorizationType: VoteAuthorizationType;
|
|
1414
|
+
votePubkey: PublicKey;
|
|
1415
|
+
};
|
|
1398
1416
|
/**
|
|
1399
1417
|
* Withdraw from vote account transaction params
|
|
1400
1418
|
*/
|
|
@@ -1426,6 +1444,12 @@ declare module '@solana/web3.js' {
|
|
|
1426
1444
|
static decodeAuthorize(
|
|
1427
1445
|
instruction: TransactionInstruction,
|
|
1428
1446
|
): AuthorizeVoteParams;
|
|
1447
|
+
/**
|
|
1448
|
+
* Decode an authorize instruction and retrieve the instruction params.
|
|
1449
|
+
*/
|
|
1450
|
+
static decodeAuthorizeWithSeed(
|
|
1451
|
+
instruction: TransactionInstruction,
|
|
1452
|
+
): AuthorizeVoteWithSeedParams;
|
|
1429
1453
|
/**
|
|
1430
1454
|
* Decode a withdraw instruction and retrieve the instruction params.
|
|
1431
1455
|
*/
|
|
@@ -1438,6 +1462,7 @@ declare module '@solana/web3.js' {
|
|
|
1438
1462
|
*/
|
|
1439
1463
|
export type VoteInstructionType =
|
|
1440
1464
|
| 'Authorize'
|
|
1465
|
+
| 'AuthorizeWithSeed'
|
|
1441
1466
|
| 'InitializeAccount'
|
|
1442
1467
|
| 'Withdraw';
|
|
1443
1468
|
/**
|
|
@@ -1488,6 +1513,11 @@ declare module '@solana/web3.js' {
|
|
|
1488
1513
|
* Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
|
|
1489
1514
|
*/
|
|
1490
1515
|
static authorize(params: AuthorizeVoteParams): Transaction;
|
|
1516
|
+
/**
|
|
1517
|
+
* Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account
|
|
1518
|
+
* where the current Voter or Withdrawer authority is a derived key.
|
|
1519
|
+
*/
|
|
1520
|
+
static authorizeWithSeed(params: AuthorizeVoteWithSeedParams): Transaction;
|
|
1491
1521
|
/**
|
|
1492
1522
|
* Generate a transaction to withdraw from a Vote account.
|
|
1493
1523
|
*/
|
|
@@ -1528,6 +1558,13 @@ declare module '@solana/web3.js' {
|
|
|
1528
1558
|
recentBlockhash: Blockhash;
|
|
1529
1559
|
addressLookupTableAccounts?: Array<AddressLookupTableAccount>;
|
|
1530
1560
|
};
|
|
1561
|
+
export type GetAccountKeysArgs =
|
|
1562
|
+
| {
|
|
1563
|
+
accountKeysFromLookups: AccountKeysFromLookups;
|
|
1564
|
+
}
|
|
1565
|
+
| {
|
|
1566
|
+
addressLookupTableAccounts: AddressLookupTableAccount[];
|
|
1567
|
+
};
|
|
1531
1568
|
export class MessageV0 {
|
|
1532
1569
|
header: MessageHeader;
|
|
1533
1570
|
staticAccountKeys: Array<PublicKey>;
|
|
@@ -1536,6 +1573,11 @@ declare module '@solana/web3.js' {
|
|
|
1536
1573
|
addressTableLookups: Array<MessageAddressTableLookup>;
|
|
1537
1574
|
constructor(args: MessageV0Args);
|
|
1538
1575
|
get version(): 0;
|
|
1576
|
+
get numAccountKeysFromLookups(): number;
|
|
1577
|
+
getAccountKeys(args?: GetAccountKeysArgs): MessageAccountKeys;
|
|
1578
|
+
resolveAddressTableLookups(
|
|
1579
|
+
addressLookupTableAccounts: AddressLookupTableAccount[],
|
|
1580
|
+
): AccountKeysFromLookups;
|
|
1539
1581
|
static compile(args: CompileV0Args): MessageV0;
|
|
1540
1582
|
serialize(): Uint8Array;
|
|
1541
1583
|
private serializeInstructions;
|
|
@@ -1804,6 +1846,33 @@ declare module '@solana/web3.js' {
|
|
|
1804
1846
|
static populate(message: Message, signatures?: Array<string>): Transaction;
|
|
1805
1847
|
}
|
|
1806
1848
|
|
|
1849
|
+
export type TransactionMessageArgs = {
|
|
1850
|
+
payerKey: PublicKey;
|
|
1851
|
+
instructions: Array<TransactionInstruction>;
|
|
1852
|
+
recentBlockhash: Blockhash;
|
|
1853
|
+
};
|
|
1854
|
+
export type DecompileArgs =
|
|
1855
|
+
| {
|
|
1856
|
+
accountKeysFromLookups: AccountKeysFromLookups;
|
|
1857
|
+
}
|
|
1858
|
+
| {
|
|
1859
|
+
addressLookupTableAccounts: AddressLookupTableAccount[];
|
|
1860
|
+
};
|
|
1861
|
+
export class TransactionMessage {
|
|
1862
|
+
payerKey: PublicKey;
|
|
1863
|
+
instructions: Array<TransactionInstruction>;
|
|
1864
|
+
recentBlockhash: Blockhash;
|
|
1865
|
+
constructor(args: TransactionMessageArgs);
|
|
1866
|
+
static decompile(
|
|
1867
|
+
message: VersionedMessage,
|
|
1868
|
+
args?: DecompileArgs,
|
|
1869
|
+
): TransactionMessage;
|
|
1870
|
+
compileToLegacyMessage(): Message;
|
|
1871
|
+
compileToV0Message(
|
|
1872
|
+
addressLookupTableAccounts?: AddressLookupTableAccount[],
|
|
1873
|
+
): MessageV0;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1807
1876
|
export type TransactionVersion = 'legacy' | 0;
|
|
1808
1877
|
/**
|
|
1809
1878
|
* Versioned transaction class
|
|
@@ -2190,6 +2259,21 @@ declare module '@solana/web3.js' {
|
|
|
2190
2259
|
programId: string;
|
|
2191
2260
|
data: [string, TransactionReturnDataEncoding];
|
|
2192
2261
|
};
|
|
2262
|
+
export type SimulateTransactionConfig = {
|
|
2263
|
+
/** Optional parameter used to enable signature verification before simulation */
|
|
2264
|
+
sigVerify?: boolean;
|
|
2265
|
+
/** Optional parameter used to replace the simulated transaction's recent blockhash with the latest blockhash */
|
|
2266
|
+
replaceRecentBlockhash?: boolean;
|
|
2267
|
+
/** Optional parameter used to set the commitment level when selecting the latest block */
|
|
2268
|
+
commitment?: Commitment;
|
|
2269
|
+
/** Optional parameter used to specify a list of account addresses to return post simulation state for */
|
|
2270
|
+
accounts?: {
|
|
2271
|
+
encoding: 'base64';
|
|
2272
|
+
addresses: string[];
|
|
2273
|
+
};
|
|
2274
|
+
/** Optional parameter used to specify the minimum block slot that can be used for simulation */
|
|
2275
|
+
minContextSlot?: number;
|
|
2276
|
+
};
|
|
2193
2277
|
export type SimulatedTransactionResponse = {
|
|
2194
2278
|
err: TransactionError | string | null;
|
|
2195
2279
|
logs: Array<string> | null;
|
|
@@ -3568,20 +3652,40 @@ declare module '@solana/web3.js' {
|
|
|
3568
3652
|
): Promise<RpcResponseAndContext<number>>;
|
|
3569
3653
|
/**
|
|
3570
3654
|
* Simulate a transaction
|
|
3655
|
+
*
|
|
3656
|
+
* @deprecated Instead, call {@link simulateTransaction} with {@link
|
|
3657
|
+
* VersionedTransaction} and {@link SimulateTransactionConfig} parameters
|
|
3571
3658
|
*/
|
|
3572
3659
|
simulateTransaction(
|
|
3573
3660
|
transactionOrMessage: Transaction | Message,
|
|
3574
3661
|
signers?: Array<Signer>,
|
|
3575
3662
|
includeAccounts?: boolean | Array<PublicKey>,
|
|
3576
3663
|
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
|
|
3664
|
+
/**
|
|
3665
|
+
* Simulate a transaction
|
|
3666
|
+
*/
|
|
3667
|
+
simulateTransaction(
|
|
3668
|
+
transaction: VersionedTransaction,
|
|
3669
|
+
config?: SimulateTransactionConfig,
|
|
3670
|
+
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
|
|
3577
3671
|
/**
|
|
3578
3672
|
* Sign and send a transaction
|
|
3673
|
+
*
|
|
3674
|
+
* @deprecated Instead, call {@link sendTransaction} with a {@link
|
|
3675
|
+
* VersionedTransaction}
|
|
3579
3676
|
*/
|
|
3580
3677
|
sendTransaction(
|
|
3581
3678
|
transaction: Transaction,
|
|
3582
3679
|
signers: Array<Signer>,
|
|
3583
3680
|
options?: SendOptions,
|
|
3584
3681
|
): Promise<TransactionSignature>;
|
|
3682
|
+
/**
|
|
3683
|
+
* Send a signed transaction
|
|
3684
|
+
*/
|
|
3685
|
+
sendTransaction(
|
|
3686
|
+
transaction: VersionedTransaction,
|
|
3687
|
+
options?: SendOptions,
|
|
3688
|
+
): Promise<TransactionSignature>;
|
|
3585
3689
|
/**
|
|
3586
3690
|
* Send a transaction that has already been signed and serialized into the
|
|
3587
3691
|
* wire format
|