@solana/web3.js 1.66.5 → 1.67.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 +341 -72
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +341 -73
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +341 -72
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +87 -7
- package/lib/index.esm.js +341 -73
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +341 -72
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +341 -72
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -3
- package/src/account.ts +1 -1
- package/src/connection.ts +320 -76
- package/src/message/legacy.ts +4 -4
- package/src/nonce-account.ts +7 -3
- package/src/publickey.ts +6 -2
- package/src/transaction/expiry-custom-errors.ts +13 -0
- package/src/transaction/legacy.ts +39 -3
- package/src/transaction/message.ts +3 -1
- package/src/utils/send-and-confirm-raw-transaction.ts +13 -0
- package/src/utils/send-and-confirm-transaction.ts +39 -18
package/lib/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ declare module '@solana/web3.js' {
|
|
|
46
46
|
*/
|
|
47
47
|
constructor(value: PublicKeyInitData);
|
|
48
48
|
/**
|
|
49
|
-
* Returns a unique PublicKey for tests and benchmarks using
|
|
49
|
+
* Returns a unique PublicKey for tests and benchmarks using a counter
|
|
50
50
|
*/
|
|
51
51
|
static unique(): PublicKey;
|
|
52
52
|
/**
|
|
@@ -95,6 +95,8 @@ declare module '@solana/web3.js' {
|
|
|
95
95
|
/**
|
|
96
96
|
* Async version of createProgramAddressSync
|
|
97
97
|
* For backwards compatibility
|
|
98
|
+
*
|
|
99
|
+
* @deprecated Use {@link createProgramAddressSync} instead
|
|
98
100
|
*/
|
|
99
101
|
static createProgramAddress(
|
|
100
102
|
seeds: Array<Buffer | Uint8Array>,
|
|
@@ -114,6 +116,8 @@ declare module '@solana/web3.js' {
|
|
|
114
116
|
/**
|
|
115
117
|
* Async version of findProgramAddressSync
|
|
116
118
|
* For backwards compatibility
|
|
119
|
+
*
|
|
120
|
+
* @deprecated Use {@link findProgramAddressSync} instead
|
|
117
121
|
*/
|
|
118
122
|
static findProgramAddress(
|
|
119
123
|
seeds: Array<Buffer | Uint8Array>,
|
|
@@ -139,7 +143,7 @@ declare module '@solana/web3.js' {
|
|
|
139
143
|
*
|
|
140
144
|
* @param secretKey Secret key for the account
|
|
141
145
|
*/
|
|
142
|
-
constructor(secretKey?:
|
|
146
|
+
constructor(secretKey?: Uint8Array | Array<number>);
|
|
143
147
|
/**
|
|
144
148
|
* The public key for this account
|
|
145
149
|
*/
|
|
@@ -205,12 +209,16 @@ declare module '@solana/web3.js' {
|
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
export const NONCE_ACCOUNT_LENGTH: number;
|
|
212
|
+
/**
|
|
213
|
+
* A durable nonce is a 32 byte value encoded as a base58 string.
|
|
214
|
+
*/
|
|
215
|
+
export type DurableNonce = string;
|
|
208
216
|
/**
|
|
209
217
|
* NonceAccount class
|
|
210
218
|
*/
|
|
211
219
|
export class NonceAccount {
|
|
212
220
|
authorizedPubkey: PublicKey;
|
|
213
|
-
nonce:
|
|
221
|
+
nonce: DurableNonce;
|
|
214
222
|
feeCalculator: FeeCalculator;
|
|
215
223
|
/**
|
|
216
224
|
* Deserialize NonceAccount from the account data.
|
|
@@ -313,6 +321,10 @@ declare module '@solana/web3.js' {
|
|
|
313
321
|
signature: string;
|
|
314
322
|
constructor(signature: string, timeoutSeconds: number);
|
|
315
323
|
}
|
|
324
|
+
export class TransactionExpiredNonceInvalidError extends Error {
|
|
325
|
+
signature: string;
|
|
326
|
+
constructor(signature: string);
|
|
327
|
+
}
|
|
316
328
|
|
|
317
329
|
export type AccountKeysFromLookups = LoadedAddresses;
|
|
318
330
|
export class MessageAccountKeys {
|
|
@@ -1642,6 +1654,7 @@ declare module '@solana/web3.js' {
|
|
|
1642
1654
|
BLOCKHEIGHT_EXCEEDED = 0,
|
|
1643
1655
|
PROCESSED = 1,
|
|
1644
1656
|
TIMED_OUT = 2,
|
|
1657
|
+
NONCE_INVALID = 3,
|
|
1645
1658
|
}
|
|
1646
1659
|
/**
|
|
1647
1660
|
* Account metadata used to define instructions
|
|
@@ -1712,7 +1725,9 @@ declare module '@solana/web3.js' {
|
|
|
1712
1725
|
};
|
|
1713
1726
|
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
1714
1727
|
/**
|
|
1715
|
-
*
|
|
1728
|
+
* Blockhash-based transactions have a lifetime that are defined by
|
|
1729
|
+
* the blockhash they include. Any transaction whose blockhash is
|
|
1730
|
+
* too old will be rejected.
|
|
1716
1731
|
*/
|
|
1717
1732
|
export type TransactionBlockhashCtor = {
|
|
1718
1733
|
/** The transaction fee payer */
|
|
@@ -1724,6 +1739,17 @@ declare module '@solana/web3.js' {
|
|
|
1724
1739
|
/** the last block chain can advance to before tx is exportd expired */
|
|
1725
1740
|
lastValidBlockHeight: number;
|
|
1726
1741
|
};
|
|
1742
|
+
/**
|
|
1743
|
+
* Use these options to construct a durable nonce transaction.
|
|
1744
|
+
*/
|
|
1745
|
+
export type TransactionNonceCtor = {
|
|
1746
|
+
/** The transaction fee payer */
|
|
1747
|
+
feePayer?: PublicKey | null;
|
|
1748
|
+
minContextSlot: number;
|
|
1749
|
+
nonceInfo: NonceInformation;
|
|
1750
|
+
/** One or more signatures */
|
|
1751
|
+
signatures?: Array<SignaturePubkeyPair>;
|
|
1752
|
+
};
|
|
1727
1753
|
/**
|
|
1728
1754
|
* Nonce information to be used to build an offline Transaction.
|
|
1729
1755
|
*/
|
|
@@ -1767,7 +1793,16 @@ declare module '@solana/web3.js' {
|
|
|
1767
1793
|
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
|
|
1768
1794
|
*/
|
|
1769
1795
|
nonceInfo?: NonceInformation;
|
|
1796
|
+
/**
|
|
1797
|
+
* If this is a nonce transaction this represents the minimum slot from which
|
|
1798
|
+
* to evaluate if the nonce has advanced when attempting to confirm the
|
|
1799
|
+
* transaction. This protects against a case where the transaction confirmation
|
|
1800
|
+
* logic loads the nonce account from an old slot and assumes the mismatch in
|
|
1801
|
+
* nonce value implies that the nonce has been advanced.
|
|
1802
|
+
*/
|
|
1803
|
+
minNonceContextSlot?: number;
|
|
1770
1804
|
constructor(opts?: TransactionBlockhashCtor);
|
|
1805
|
+
constructor(opts?: TransactionNonceCtor);
|
|
1771
1806
|
/**
|
|
1772
1807
|
* @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
|
|
1773
1808
|
* Please supply a `TransactionBlockhashCtor` instead.
|
|
@@ -1985,6 +2020,27 @@ declare module '@solana/web3.js' {
|
|
|
1985
2020
|
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
1986
2021
|
signature: TransactionSignature;
|
|
1987
2022
|
} & BlockhashWithExpiryBlockHeight;
|
|
2023
|
+
/**
|
|
2024
|
+
* A strategy for confirming durable nonce transactions.
|
|
2025
|
+
*/
|
|
2026
|
+
export type DurableNonceTransactionConfirmationStrategy = {
|
|
2027
|
+
/**
|
|
2028
|
+
* The lowest slot at which to fetch the nonce value from the
|
|
2029
|
+
* nonce account. This should be no lower than the slot at
|
|
2030
|
+
* which the last-known value of the nonce was fetched.
|
|
2031
|
+
*/
|
|
2032
|
+
minContextSlot: number;
|
|
2033
|
+
/**
|
|
2034
|
+
* The account where the current value of the nonce is stored.
|
|
2035
|
+
*/
|
|
2036
|
+
nonceAccountPubkey: PublicKey;
|
|
2037
|
+
/**
|
|
2038
|
+
* The nonce value that was used to sign the transaction
|
|
2039
|
+
* for which confirmation is being sought.
|
|
2040
|
+
*/
|
|
2041
|
+
nonceValue: DurableNonce;
|
|
2042
|
+
signature: TransactionSignature;
|
|
2043
|
+
};
|
|
1988
2044
|
/**
|
|
1989
2045
|
* The level of commitment desired when querying state
|
|
1990
2046
|
* <pre>
|
|
@@ -2941,6 +2997,24 @@ declare module '@solana/web3.js' {
|
|
|
2941
2997
|
/** The minimum slot that the request can be evaluated at */
|
|
2942
2998
|
minContextSlot?: number;
|
|
2943
2999
|
};
|
|
3000
|
+
/**
|
|
3001
|
+
* Configuration object for `getNonce`
|
|
3002
|
+
*/
|
|
3003
|
+
export type GetNonceConfig = {
|
|
3004
|
+
/** Optional commitment level */
|
|
3005
|
+
commitment?: Commitment;
|
|
3006
|
+
/** The minimum slot that the request can be evaluated at */
|
|
3007
|
+
minContextSlot?: number;
|
|
3008
|
+
};
|
|
3009
|
+
/**
|
|
3010
|
+
* Configuration object for `getNonceAndContext`
|
|
3011
|
+
*/
|
|
3012
|
+
export type GetNonceAndContextConfig = {
|
|
3013
|
+
/** Optional commitment level */
|
|
3014
|
+
commitment?: Commitment;
|
|
3015
|
+
/** The minimum slot that the request can be evaluated at */
|
|
3016
|
+
minContextSlot?: number;
|
|
3017
|
+
};
|
|
2944
3018
|
/**
|
|
2945
3019
|
* Information describing an account
|
|
2946
3020
|
*/
|
|
@@ -3330,7 +3404,9 @@ declare module '@solana/web3.js' {
|
|
|
3330
3404
|
}>
|
|
3331
3405
|
>;
|
|
3332
3406
|
confirmTransaction(
|
|
3333
|
-
strategy:
|
|
3407
|
+
strategy:
|
|
3408
|
+
| BlockheightBasedTransactionConfirmationStrategy
|
|
3409
|
+
| DurableNonceTransactionConfirmationStrategy,
|
|
3334
3410
|
commitment?: Commitment,
|
|
3335
3411
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
3336
3412
|
/** @deprecated Instead, call `confirmTransaction` using a `TransactionConfirmationConfig` */
|
|
@@ -3338,6 +3414,10 @@ declare module '@solana/web3.js' {
|
|
|
3338
3414
|
strategy: TransactionSignature,
|
|
3339
3415
|
commitment?: Commitment,
|
|
3340
3416
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
3417
|
+
private getTransactionConfirmationPromise;
|
|
3418
|
+
private confirmTransactionUsingBlockHeightExceedanceStrategy;
|
|
3419
|
+
private confirmTransactionUsingDurableNonceStrategy;
|
|
3420
|
+
private confirmTransactionUsingLegacyTimeoutStrategy;
|
|
3341
3421
|
/**
|
|
3342
3422
|
* Return the list of nodes that are currently participating in the cluster
|
|
3343
3423
|
*/
|
|
@@ -3683,14 +3763,14 @@ declare module '@solana/web3.js' {
|
|
|
3683
3763
|
*/
|
|
3684
3764
|
getNonceAndContext(
|
|
3685
3765
|
nonceAccount: PublicKey,
|
|
3686
|
-
|
|
3766
|
+
commitmentOrConfig?: Commitment | GetNonceAndContextConfig,
|
|
3687
3767
|
): Promise<RpcResponseAndContext<NonceAccount | null>>;
|
|
3688
3768
|
/**
|
|
3689
3769
|
* Fetch the contents of a Nonce account from the cluster
|
|
3690
3770
|
*/
|
|
3691
3771
|
getNonce(
|
|
3692
3772
|
nonceAccount: PublicKey,
|
|
3693
|
-
|
|
3773
|
+
commitmentOrConfig?: Commitment | GetNonceConfig,
|
|
3694
3774
|
): Promise<NonceAccount | null>;
|
|
3695
3775
|
/**
|
|
3696
3776
|
* Request an allocation of lamports to the specified address
|