@solana/web3.js 1.2.8 → 1.3.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.esm.js +88 -13
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +88 -13
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +23 -0
- package/lib/index.esm.js +88 -13
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +88 -13
- 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/module.flow.js +40 -0
- package/package.json +1 -1
- package/src/connection.ts +109 -20
package/lib/index.iife.js
CHANGED
|
@@ -17222,11 +17222,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
17222
17222
|
active: number(),
|
|
17223
17223
|
inactive: number()
|
|
17224
17224
|
});
|
|
17225
|
-
/**
|
|
17226
|
-
* Expected JSON RPC response for the "getConfirmedSignaturesForAddress" message
|
|
17227
|
-
*/
|
|
17228
|
-
|
|
17229
|
-
const GetConfirmedSignaturesForAddressRpcResult = jsonRpcResult(array(string()));
|
|
17230
17225
|
/**
|
|
17231
17226
|
* Expected JSON RPC response for the "getConfirmedSignaturesForAddress2" message
|
|
17232
17227
|
*/
|
|
@@ -17471,6 +17466,17 @@ var solanaWeb3 = (function (exports) {
|
|
|
17471
17466
|
}))),
|
|
17472
17467
|
blockTime: nullable(number())
|
|
17473
17468
|
})));
|
|
17469
|
+
/**
|
|
17470
|
+
* Expected JSON RPC response for the "getConfirmedBlockSignatures" message
|
|
17471
|
+
*/
|
|
17472
|
+
|
|
17473
|
+
const GetConfirmedBlockSignaturesRpcResult = jsonRpcResult(nullable(type({
|
|
17474
|
+
blockhash: string(),
|
|
17475
|
+
previousBlockhash: string(),
|
|
17476
|
+
parentSlot: number(),
|
|
17477
|
+
signatures: array(string()),
|
|
17478
|
+
blockTime: nullable(number())
|
|
17479
|
+
})));
|
|
17474
17480
|
/**
|
|
17475
17481
|
* Expected JSON RPC response for the "getConfirmedTransaction" message
|
|
17476
17482
|
*/
|
|
@@ -18233,20 +18239,21 @@ var solanaWeb3 = (function (exports) {
|
|
|
18233
18239
|
}
|
|
18234
18240
|
/**
|
|
18235
18241
|
* Fetch the current total currency supply of the cluster in lamports
|
|
18242
|
+
* @deprecated Deprecated since v1.2.8. Use `Connection.getSupply()` instead.
|
|
18236
18243
|
*/
|
|
18237
18244
|
|
|
18238
18245
|
|
|
18239
18246
|
async getTotalSupply(commitment) {
|
|
18240
18247
|
const args = this._buildArgs([], commitment);
|
|
18241
18248
|
|
|
18242
|
-
const unsafeRes = await this._rpcRequest('
|
|
18243
|
-
const res = create(unsafeRes,
|
|
18249
|
+
const unsafeRes = await this._rpcRequest('getSupply', args);
|
|
18250
|
+
const res = create(unsafeRes, GetSupplyRpcResult);
|
|
18244
18251
|
|
|
18245
18252
|
if ('error' in res) {
|
|
18246
18253
|
throw new Error('failed to get total supply: ' + res.error.message);
|
|
18247
18254
|
}
|
|
18248
18255
|
|
|
18249
|
-
return res.result;
|
|
18256
|
+
return res.result.value.total;
|
|
18250
18257
|
}
|
|
18251
18258
|
/**
|
|
18252
18259
|
* Fetch the cluster InflationGovernor parameters
|
|
@@ -18443,6 +18450,30 @@ var solanaWeb3 = (function (exports) {
|
|
|
18443
18450
|
|
|
18444
18451
|
return result;
|
|
18445
18452
|
}
|
|
18453
|
+
/**
|
|
18454
|
+
* Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
|
|
18455
|
+
*/
|
|
18456
|
+
|
|
18457
|
+
|
|
18458
|
+
async getConfirmedBlockSignatures(slot) {
|
|
18459
|
+
const unsafeRes = await this._rpcRequest('getConfirmedBlock', [slot, {
|
|
18460
|
+
transactionDetails: 'signatures',
|
|
18461
|
+
rewards: false
|
|
18462
|
+
}]);
|
|
18463
|
+
const res = create(unsafeRes, GetConfirmedBlockSignaturesRpcResult);
|
|
18464
|
+
|
|
18465
|
+
if ('error' in res) {
|
|
18466
|
+
throw new Error('failed to get confirmed block: ' + res.error.message);
|
|
18467
|
+
}
|
|
18468
|
+
|
|
18469
|
+
const result = res.result;
|
|
18470
|
+
|
|
18471
|
+
if (!result) {
|
|
18472
|
+
throw new Error('Confirmed block ' + slot + ' not found');
|
|
18473
|
+
}
|
|
18474
|
+
|
|
18475
|
+
return result;
|
|
18476
|
+
}
|
|
18446
18477
|
/**
|
|
18447
18478
|
* Fetch a transaction details for a confirmed transaction
|
|
18448
18479
|
*/
|
|
@@ -18500,6 +18531,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18500
18531
|
/**
|
|
18501
18532
|
* Fetch a list of all the confirmed signatures for transactions involving an address
|
|
18502
18533
|
* within a specified slot range. Max range allowed is 10,000 slots.
|
|
18534
|
+
* @deprecated Deprecated since v1.3. Use `Connection.getConfirmedSignaturesForAddress2()` instead.
|
|
18503
18535
|
*
|
|
18504
18536
|
* @param address queried address
|
|
18505
18537
|
* @param startSlot start slot, inclusive
|
|
@@ -18508,14 +18540,57 @@ var solanaWeb3 = (function (exports) {
|
|
|
18508
18540
|
|
|
18509
18541
|
|
|
18510
18542
|
async getConfirmedSignaturesForAddress(address, startSlot, endSlot) {
|
|
18511
|
-
|
|
18512
|
-
|
|
18543
|
+
let options = {};
|
|
18544
|
+
let firstAvailableBlock = await this.getFirstAvailableBlock();
|
|
18513
18545
|
|
|
18514
|
-
|
|
18515
|
-
|
|
18546
|
+
while (!('until' in options)) {
|
|
18547
|
+
startSlot--;
|
|
18548
|
+
|
|
18549
|
+
if (startSlot <= 0 || startSlot < firstAvailableBlock) {
|
|
18550
|
+
break;
|
|
18551
|
+
}
|
|
18552
|
+
|
|
18553
|
+
try {
|
|
18554
|
+
const block = await this.getConfirmedBlockSignatures(startSlot);
|
|
18555
|
+
|
|
18556
|
+
if (block.signatures.length > 0) {
|
|
18557
|
+
options.until = block.signatures[block.signatures.length - 1].toString();
|
|
18558
|
+
}
|
|
18559
|
+
} catch (err) {
|
|
18560
|
+
if (err.message.includes('skipped')) {
|
|
18561
|
+
continue;
|
|
18562
|
+
} else {
|
|
18563
|
+
throw err;
|
|
18564
|
+
}
|
|
18565
|
+
}
|
|
18516
18566
|
}
|
|
18517
18567
|
|
|
18518
|
-
|
|
18568
|
+
let highestConfirmedRoot = await this.getSlot('finalized');
|
|
18569
|
+
|
|
18570
|
+
while (!('before' in options)) {
|
|
18571
|
+
endSlot++;
|
|
18572
|
+
|
|
18573
|
+
if (endSlot > highestConfirmedRoot) {
|
|
18574
|
+
break;
|
|
18575
|
+
}
|
|
18576
|
+
|
|
18577
|
+
try {
|
|
18578
|
+
const block = await this.getConfirmedBlockSignatures(endSlot);
|
|
18579
|
+
|
|
18580
|
+
if (block.signatures.length > 0) {
|
|
18581
|
+
options.before = block.signatures[block.signatures.length - 1].toString();
|
|
18582
|
+
}
|
|
18583
|
+
} catch (err) {
|
|
18584
|
+
if (err.message.includes('skipped')) {
|
|
18585
|
+
continue;
|
|
18586
|
+
} else {
|
|
18587
|
+
throw err;
|
|
18588
|
+
}
|
|
18589
|
+
}
|
|
18590
|
+
}
|
|
18591
|
+
|
|
18592
|
+
const confirmedSignatureInfo = await this.getConfirmedSignaturesForAddress2(address, options);
|
|
18593
|
+
return confirmedSignatureInfo.map(info => info.signature);
|
|
18519
18594
|
}
|
|
18520
18595
|
/**
|
|
18521
18596
|
* Returns confirmed signatures for transactions involving an
|