@solana/web3.js 1.66.5 → 1.67.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.
- package/lib/index.browser.cjs.js +334 -69
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +334 -70
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +334 -69
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +81 -5
- package/lib/index.esm.js +334 -70
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +334 -69
- 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 +334 -69
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +320 -76
- package/src/nonce-account.ts +7 -3
- package/src/transaction/expiry-custom-errors.ts +13 -0
- package/src/transaction/legacy.ts +39 -3
- package/src/utils/send-and-confirm-raw-transaction.ts +13 -0
- package/src/utils/send-and-confirm-transaction.ts +39 -18
|
@@ -3,6 +3,7 @@ import type {Buffer} from 'buffer';
|
|
|
3
3
|
import {
|
|
4
4
|
BlockheightBasedTransactionConfirmationStrategy,
|
|
5
5
|
Connection,
|
|
6
|
+
DurableNonceTransactionConfirmationStrategy,
|
|
6
7
|
} from '../connection';
|
|
7
8
|
import type {TransactionSignature} from '../transaction';
|
|
8
9
|
import type {ConfirmOptions} from '../connection';
|
|
@@ -42,12 +43,14 @@ export async function sendAndConfirmRawTransaction(
|
|
|
42
43
|
rawTransaction: Buffer,
|
|
43
44
|
confirmationStrategyOrConfirmOptions:
|
|
44
45
|
| BlockheightBasedTransactionConfirmationStrategy
|
|
46
|
+
| DurableNonceTransactionConfirmationStrategy
|
|
45
47
|
| ConfirmOptions
|
|
46
48
|
| undefined,
|
|
47
49
|
maybeConfirmOptions?: ConfirmOptions,
|
|
48
50
|
): Promise<TransactionSignature> {
|
|
49
51
|
let confirmationStrategy:
|
|
50
52
|
| BlockheightBasedTransactionConfirmationStrategy
|
|
53
|
+
| DurableNonceTransactionConfirmationStrategy
|
|
51
54
|
| undefined;
|
|
52
55
|
let options: ConfirmOptions | undefined;
|
|
53
56
|
if (
|
|
@@ -60,6 +63,16 @@ export async function sendAndConfirmRawTransaction(
|
|
|
60
63
|
confirmationStrategy =
|
|
61
64
|
confirmationStrategyOrConfirmOptions as BlockheightBasedTransactionConfirmationStrategy;
|
|
62
65
|
options = maybeConfirmOptions;
|
|
66
|
+
} else if (
|
|
67
|
+
confirmationStrategyOrConfirmOptions &&
|
|
68
|
+
Object.prototype.hasOwnProperty.call(
|
|
69
|
+
confirmationStrategyOrConfirmOptions,
|
|
70
|
+
'nonceValue',
|
|
71
|
+
)
|
|
72
|
+
) {
|
|
73
|
+
confirmationStrategy =
|
|
74
|
+
confirmationStrategyOrConfirmOptions as DurableNonceTransactionConfirmationStrategy;
|
|
75
|
+
options = maybeConfirmOptions;
|
|
63
76
|
} else {
|
|
64
77
|
options = confirmationStrategyOrConfirmOptions as
|
|
65
78
|
| ConfirmOptions
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Connection} from '../connection';
|
|
1
|
+
import {Connection, SignatureResult} from '../connection';
|
|
2
2
|
import {Transaction} from '../transaction';
|
|
3
3
|
import type {ConfirmOptions} from '../connection';
|
|
4
4
|
import type {Signer} from '../keypair';
|
|
@@ -34,25 +34,46 @@ export async function sendAndConfirmTransaction(
|
|
|
34
34
|
sendOptions,
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
let status: SignatureResult;
|
|
38
|
+
if (
|
|
38
39
|
transaction.recentBlockhash != null &&
|
|
39
40
|
transaction.lastValidBlockHeight != null
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
) {
|
|
42
|
+
status = (
|
|
43
|
+
await connection.confirmTransaction(
|
|
44
|
+
{
|
|
45
|
+
signature: signature,
|
|
46
|
+
blockhash: transaction.recentBlockhash,
|
|
47
|
+
lastValidBlockHeight: transaction.lastValidBlockHeight,
|
|
48
|
+
},
|
|
49
|
+
options && options.commitment,
|
|
50
|
+
)
|
|
51
|
+
).value;
|
|
52
|
+
} else if (
|
|
53
|
+
transaction.minNonceContextSlot != null &&
|
|
54
|
+
transaction.nonceInfo != null
|
|
55
|
+
) {
|
|
56
|
+
const {nonceInstruction} = transaction.nonceInfo;
|
|
57
|
+
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
58
|
+
status = (
|
|
59
|
+
await connection.confirmTransaction(
|
|
60
|
+
{
|
|
61
|
+
minContextSlot: transaction.minNonceContextSlot,
|
|
62
|
+
nonceAccountPubkey,
|
|
63
|
+
nonceValue: transaction.nonceInfo.nonce,
|
|
64
|
+
signature,
|
|
65
|
+
},
|
|
66
|
+
options && options.commitment,
|
|
67
|
+
)
|
|
68
|
+
).value;
|
|
69
|
+
} else {
|
|
70
|
+
status = (
|
|
71
|
+
await connection.confirmTransaction(
|
|
72
|
+
signature,
|
|
73
|
+
options && options.commitment,
|
|
74
|
+
)
|
|
75
|
+
).value;
|
|
76
|
+
}
|
|
56
77
|
|
|
57
78
|
if (status.err) {
|
|
58
79
|
throw new Error(
|