@solana/web3.js 1.70.2 → 1.71.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 +8 -5
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +8 -5
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +8 -5
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +14 -8
- package/lib/index.esm.js +8 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +8 -5
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +8 -5
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +12 -11
- package/src/publickey.ts +2 -1
- package/src/transaction/legacy.ts +9 -4
- package/src/utils/send-and-confirm-raw-transaction.ts +5 -8
package/package.json
CHANGED
package/src/connection.ts
CHANGED
|
@@ -349,6 +349,13 @@ export type BaseTransactionConfirmationStrategy = Readonly<{
|
|
|
349
349
|
signature: TransactionSignature;
|
|
350
350
|
}>;
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* This type represents all transaction confirmation strategies
|
|
354
|
+
*/
|
|
355
|
+
export type TransactionConfirmationStrategy =
|
|
356
|
+
| BlockheightBasedTransactionConfirmationStrategy
|
|
357
|
+
| DurableNonceTransactionConfirmationStrategy;
|
|
358
|
+
|
|
352
359
|
/* @internal */
|
|
353
360
|
function assertEndpointUrl(putativeUrl: string) {
|
|
354
361
|
if (/^https?:/.test(putativeUrl) === false) {
|
|
@@ -3603,13 +3610,11 @@ export class Connection {
|
|
|
3603
3610
|
}
|
|
3604
3611
|
|
|
3605
3612
|
confirmTransaction(
|
|
3606
|
-
strategy:
|
|
3607
|
-
| BlockheightBasedTransactionConfirmationStrategy
|
|
3608
|
-
| DurableNonceTransactionConfirmationStrategy,
|
|
3613
|
+
strategy: TransactionConfirmationStrategy,
|
|
3609
3614
|
commitment?: Commitment,
|
|
3610
3615
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
3611
3616
|
|
|
3612
|
-
/** @deprecated Instead, call `confirmTransaction`
|
|
3617
|
+
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
3613
3618
|
// eslint-disable-next-line no-dupe-class-members
|
|
3614
3619
|
confirmTransaction(
|
|
3615
3620
|
strategy: TransactionSignature,
|
|
@@ -3618,10 +3623,7 @@ export class Connection {
|
|
|
3618
3623
|
|
|
3619
3624
|
// eslint-disable-next-line no-dupe-class-members
|
|
3620
3625
|
async confirmTransaction(
|
|
3621
|
-
strategy:
|
|
3622
|
-
| BlockheightBasedTransactionConfirmationStrategy
|
|
3623
|
-
| DurableNonceTransactionConfirmationStrategy
|
|
3624
|
-
| TransactionSignature,
|
|
3626
|
+
strategy: TransactionConfirmationStrategy | TransactionSignature,
|
|
3625
3627
|
commitment?: Commitment,
|
|
3626
3628
|
): Promise<RpcResponseAndContext<SignatureResult>> {
|
|
3627
3629
|
let rawSignature: string;
|
|
@@ -3629,9 +3631,8 @@ export class Connection {
|
|
|
3629
3631
|
if (typeof strategy == 'string') {
|
|
3630
3632
|
rawSignature = strategy;
|
|
3631
3633
|
} else {
|
|
3632
|
-
const config = strategy as
|
|
3633
|
-
|
|
3634
|
-
| DurableNonceTransactionConfirmationStrategy;
|
|
3634
|
+
const config = strategy as TransactionConfirmationStrategy;
|
|
3635
|
+
|
|
3635
3636
|
if (config.abortSignal?.aborted) {
|
|
3636
3637
|
return Promise.reject(config.abortSignal.reason);
|
|
3637
3638
|
}
|
package/src/publickey.ts
CHANGED
|
@@ -112,7 +112,8 @@ export class PublicKey extends Struct {
|
|
|
112
112
|
* Return the byte array representation of the public key in big endian
|
|
113
113
|
*/
|
|
114
114
|
toBytes(): Uint8Array {
|
|
115
|
-
|
|
115
|
+
const buf = this.toBuffer();
|
|
116
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
/**
|
|
@@ -726,10 +726,15 @@ export class Transaction {
|
|
|
726
726
|
}
|
|
727
727
|
|
|
728
728
|
/**
|
|
729
|
-
* Verify signatures of a
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
729
|
+
* Verify signatures of a Transaction
|
|
730
|
+
* Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.
|
|
731
|
+
* If no boolean is provided, we expect a fully signed Transaction by default.
|
|
732
|
+
*/
|
|
733
|
+
verifySignatures(requireAllSignatures?: boolean): boolean {
|
|
734
|
+
return this._verifySignatures(
|
|
735
|
+
this.serializeMessage(),
|
|
736
|
+
requireAllSignatures === undefined ? true : requireAllSignatures,
|
|
737
|
+
);
|
|
733
738
|
}
|
|
734
739
|
|
|
735
740
|
/**
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
BlockheightBasedTransactionConfirmationStrategy,
|
|
5
5
|
Connection,
|
|
6
6
|
DurableNonceTransactionConfirmationStrategy,
|
|
7
|
+
TransactionConfirmationStrategy,
|
|
7
8
|
} from '../connection';
|
|
8
9
|
import type {TransactionSignature} from '../transaction';
|
|
9
10
|
import type {ConfirmOptions} from '../connection';
|
|
@@ -15,14 +16,14 @@ import type {ConfirmOptions} from '../connection';
|
|
|
15
16
|
*
|
|
16
17
|
* @param {Connection} connection
|
|
17
18
|
* @param {Buffer} rawTransaction
|
|
18
|
-
* @param {
|
|
19
|
+
* @param {TransactionConfirmationStrategy} confirmationStrategy
|
|
19
20
|
* @param {ConfirmOptions} [options]
|
|
20
21
|
* @returns {Promise<TransactionSignature>}
|
|
21
22
|
*/
|
|
22
23
|
export async function sendAndConfirmRawTransaction(
|
|
23
24
|
connection: Connection,
|
|
24
25
|
rawTransaction: Buffer,
|
|
25
|
-
confirmationStrategy:
|
|
26
|
+
confirmationStrategy: TransactionConfirmationStrategy,
|
|
26
27
|
options?: ConfirmOptions,
|
|
27
28
|
): Promise<TransactionSignature>;
|
|
28
29
|
|
|
@@ -42,16 +43,12 @@ export async function sendAndConfirmRawTransaction(
|
|
|
42
43
|
connection: Connection,
|
|
43
44
|
rawTransaction: Buffer,
|
|
44
45
|
confirmationStrategyOrConfirmOptions:
|
|
45
|
-
|
|
|
46
|
-
| DurableNonceTransactionConfirmationStrategy
|
|
46
|
+
| TransactionConfirmationStrategy
|
|
47
47
|
| ConfirmOptions
|
|
48
48
|
| undefined,
|
|
49
49
|
maybeConfirmOptions?: ConfirmOptions,
|
|
50
50
|
): Promise<TransactionSignature> {
|
|
51
|
-
let confirmationStrategy:
|
|
52
|
-
| BlockheightBasedTransactionConfirmationStrategy
|
|
53
|
-
| DurableNonceTransactionConfirmationStrategy
|
|
54
|
-
| undefined;
|
|
51
|
+
let confirmationStrategy: TransactionConfirmationStrategy | undefined;
|
|
55
52
|
let options: ConfirmOptions | undefined;
|
|
56
53
|
if (
|
|
57
54
|
confirmationStrategyOrConfirmOptions &&
|