@solana/web3.js 1.37.2 → 1.39.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/README.md +4 -3
- package/lib/index.browser.cjs.js +64 -4
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +64 -4
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +67 -7
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.esm.js +64 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +64 -4
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +2 -7
- package/src/connection.ts +10 -1
- package/src/transaction.ts +85 -0
- package/module.flow.js +0 -4412
package/lib/index.browser.esm.js
CHANGED
|
@@ -2359,6 +2359,26 @@ class TransactionInstruction {
|
|
|
2359
2359
|
this.data = opts.data;
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
|
+
/**
|
|
2363
|
+
* @internal
|
|
2364
|
+
*/
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
toJSON() {
|
|
2368
|
+
return {
|
|
2369
|
+
keys: this.keys.map(({
|
|
2370
|
+
pubkey,
|
|
2371
|
+
isSigner,
|
|
2372
|
+
isWritable
|
|
2373
|
+
}) => ({
|
|
2374
|
+
pubkey: pubkey.toJSON(),
|
|
2375
|
+
isSigner,
|
|
2376
|
+
isWritable
|
|
2377
|
+
})),
|
|
2378
|
+
programId: this.programId.toJSON(),
|
|
2379
|
+
data: [...this.data]
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2362
2382
|
|
|
2363
2383
|
}
|
|
2364
2384
|
/**
|
|
@@ -2398,8 +2418,33 @@ class Transaction {
|
|
|
2398
2418
|
this.instructions = [];
|
|
2399
2419
|
this.recentBlockhash = void 0;
|
|
2400
2420
|
this.nonceInfo = void 0;
|
|
2421
|
+
this._message = void 0;
|
|
2422
|
+
this._json = void 0;
|
|
2401
2423
|
opts && Object.assign(this, opts);
|
|
2402
2424
|
}
|
|
2425
|
+
/**
|
|
2426
|
+
* @internal
|
|
2427
|
+
*/
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
toJSON() {
|
|
2431
|
+
return {
|
|
2432
|
+
recentBlockhash: this.recentBlockhash || null,
|
|
2433
|
+
feePayer: this.feePayer ? this.feePayer.toJSON() : null,
|
|
2434
|
+
nonceInfo: this.nonceInfo ? {
|
|
2435
|
+
nonce: this.nonceInfo.nonce,
|
|
2436
|
+
nonceInstruction: this.nonceInfo.nonceInstruction.toJSON()
|
|
2437
|
+
} : null,
|
|
2438
|
+
instructions: this.instructions.map(instruction => instruction.toJSON()),
|
|
2439
|
+
signatures: this.signatures.map(({
|
|
2440
|
+
publicKey,
|
|
2441
|
+
signature
|
|
2442
|
+
}) => ({
|
|
2443
|
+
publicKey: publicKey.toJSON(),
|
|
2444
|
+
signature: signature ? [...signature] : null
|
|
2445
|
+
}))
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2403
2448
|
/**
|
|
2404
2449
|
* Add one or more instructions to this Transaction
|
|
2405
2450
|
*/
|
|
@@ -2427,6 +2472,14 @@ class Transaction {
|
|
|
2427
2472
|
|
|
2428
2473
|
|
|
2429
2474
|
compileMessage() {
|
|
2475
|
+
if (this._message) {
|
|
2476
|
+
if (JSON.stringify(this.toJSON()) !== JSON.stringify(this._json)) {
|
|
2477
|
+
throw new Error('Transaction mutated after being populated from Message');
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
return this._message;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2430
2483
|
const {
|
|
2431
2484
|
nonceInfo
|
|
2432
2485
|
} = this;
|
|
@@ -2948,6 +3001,8 @@ class Transaction {
|
|
|
2948
3001
|
data: bs58.decode(instruction.data)
|
|
2949
3002
|
}));
|
|
2950
3003
|
});
|
|
3004
|
+
transaction._message = message;
|
|
3005
|
+
transaction._json = transaction.toJSON();
|
|
2951
3006
|
return transaction;
|
|
2952
3007
|
}
|
|
2953
3008
|
|
|
@@ -4557,7 +4612,7 @@ exports.Response = ctx.Response;
|
|
|
4557
4612
|
module.exports = exports;
|
|
4558
4613
|
}(browserPonyfill, browserPonyfill.exports));
|
|
4559
4614
|
|
|
4560
|
-
var
|
|
4615
|
+
var crossFetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
|
|
4561
4616
|
|
|
4562
4617
|
const MINIMUM_SLOT_PER_EPOCH = 32; // Returns the number of trailing zeros in the binary representation of self.
|
|
4563
4618
|
|
|
@@ -4894,7 +4949,8 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(type({
|
|
|
4894
4949
|
* A performance sample
|
|
4895
4950
|
*/
|
|
4896
4951
|
|
|
4897
|
-
function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRetryOnRateLimit) {
|
|
4952
|
+
function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
|
|
4953
|
+
const fetch = customFetch ? customFetch : crossFetch;
|
|
4898
4954
|
|
|
4899
4955
|
let fetchWithMiddleware;
|
|
4900
4956
|
|
|
@@ -5696,6 +5752,7 @@ class Connection {
|
|
|
5696
5752
|
const useHttps = url.protocol === 'https:';
|
|
5697
5753
|
let wsEndpoint;
|
|
5698
5754
|
let httpHeaders;
|
|
5755
|
+
let fetch;
|
|
5699
5756
|
let fetchMiddleware;
|
|
5700
5757
|
let disableRetryOnRateLimit;
|
|
5701
5758
|
|
|
@@ -5706,13 +5763,14 @@ class Connection {
|
|
|
5706
5763
|
this._confirmTransactionInitialTimeout = commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
5707
5764
|
wsEndpoint = commitmentOrConfig.wsEndpoint;
|
|
5708
5765
|
httpHeaders = commitmentOrConfig.httpHeaders;
|
|
5766
|
+
fetch = commitmentOrConfig.fetch;
|
|
5709
5767
|
fetchMiddleware = commitmentOrConfig.fetchMiddleware;
|
|
5710
5768
|
disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
|
|
5711
5769
|
}
|
|
5712
5770
|
|
|
5713
5771
|
this._rpcEndpoint = endpoint;
|
|
5714
5772
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
5715
|
-
this._rpcClient = createRpcClient(url.toString(), useHttps, httpHeaders, fetchMiddleware, disableRetryOnRateLimit);
|
|
5773
|
+
this._rpcClient = createRpcClient(url.toString(), useHttps, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit);
|
|
5716
5774
|
this._rpcRequest = createRpcRequest(this._rpcClient);
|
|
5717
5775
|
this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
|
|
5718
5776
|
this._rpcWebSocket = new Client(this._rpcWsEndpoint, {
|
|
@@ -7227,7 +7285,9 @@ class Connection {
|
|
|
7227
7285
|
});
|
|
7228
7286
|
transaction.instructions = transactionOrMessage.instructions;
|
|
7229
7287
|
} else {
|
|
7230
|
-
transaction = Transaction.populate(transactionOrMessage);
|
|
7288
|
+
transaction = Transaction.populate(transactionOrMessage); // HACK: this function relies on mutating the populated transaction
|
|
7289
|
+
|
|
7290
|
+
transaction._message = transaction._json = undefined;
|
|
7231
7291
|
}
|
|
7232
7292
|
|
|
7233
7293
|
if (transaction.nonceInfo && signers) {
|