@fuel-ts/account 0.94.9 → 0.95.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/dist/index.global.js +263 -267
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +179 -229
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -230
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +264 -1421
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +10 -9
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +2 -2
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/upload-transaction-request.d.ts +2 -3
- package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -1
- package/dist/test-utils.global.js +263 -267
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +177 -229
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +178 -230
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.global.js
CHANGED
@@ -28920,9 +28920,9 @@ spurious results.`);
|
|
28920
28920
|
// ../versions/dist/index.mjs
|
28921
28921
|
function getBuiltinVersions() {
|
28922
28922
|
return {
|
28923
|
-
FORC: "0.
|
28924
|
-
FUEL_CORE: "0.
|
28925
|
-
FUELS: "0.
|
28923
|
+
FORC: "0.65.2",
|
28924
|
+
FUEL_CORE: "0.38.0",
|
28925
|
+
FUELS: "0.95.0"
|
28926
28926
|
};
|
28927
28927
|
}
|
28928
28928
|
function parseVersion(version) {
|
@@ -29106,21 +29106,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29106
29106
|
var DEFAULT_PRECISION = 9;
|
29107
29107
|
var DEFAULT_MIN_PRECISION = 3;
|
29108
29108
|
var DEFAULT_DECIMAL_UNITS = 9;
|
29109
|
-
function toFixed(value, options) {
|
29110
|
-
const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
|
29111
|
-
const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
|
29112
|
-
const groupRegex = /(\d)(?=(\d{3})+\b)/g;
|
29113
|
-
const units = valueUnits.replace(groupRegex, "$1,");
|
29114
|
-
let decimals = valueDecimals.slice(0, precision);
|
29115
|
-
if (minPrecision < precision) {
|
29116
|
-
const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
|
29117
|
-
const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
|
29118
|
-
const keepChars = Math.max(minPrecision, lastNonZeroIndex);
|
29119
|
-
decimals = decimals.slice(0, keepChars);
|
29120
|
-
}
|
29121
|
-
const decimalPortion = decimals ? `.${decimals}` : "";
|
29122
|
-
return `${units}${decimalPortion}`;
|
29123
|
-
}
|
29124
29109
|
var BN = class extends import_bn.default {
|
29125
29110
|
MAX_U64 = "0xFFFFFFFFFFFFFFFF";
|
29126
29111
|
constructor(value, base, endian) {
|
@@ -29172,28 +29157,53 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29172
29157
|
format(options) {
|
29173
29158
|
const {
|
29174
29159
|
units = DEFAULT_DECIMAL_UNITS,
|
29175
|
-
precision = DEFAULT_PRECISION,
|
29176
|
-
minPrecision = DEFAULT_MIN_PRECISION
|
29160
|
+
precision: initialPrecision = DEFAULT_PRECISION,
|
29161
|
+
minPrecision: initialMinPrecision = DEFAULT_MIN_PRECISION
|
29177
29162
|
} = options || {};
|
29163
|
+
if (units === 0) {
|
29164
|
+
return this.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
29165
|
+
}
|
29166
|
+
const minPrecision = initialMinPrecision > initialPrecision ? initialPrecision : initialMinPrecision;
|
29167
|
+
const precision = initialPrecision > initialMinPrecision ? initialPrecision : initialMinPrecision;
|
29178
29168
|
const formattedUnits = this.formatUnits(units);
|
29179
|
-
const
|
29180
|
-
|
29181
|
-
|
29182
|
-
|
29183
|
-
|
29184
|
-
|
29185
|
-
|
29169
|
+
const [integerPart, fractionalPart = ""] = formattedUnits.split(".");
|
29170
|
+
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
29171
|
+
if (precision === 0) {
|
29172
|
+
return formattedInteger;
|
29173
|
+
}
|
29174
|
+
let formattedFractional = fractionalPart.replace(/0+$/, "");
|
29175
|
+
if (formattedFractional.length > precision) {
|
29176
|
+
if (integerPart === "0") {
|
29177
|
+
const firstNonZeroIndex = formattedFractional.search(/[1-9]/);
|
29178
|
+
if (firstNonZeroIndex >= 0 && firstNonZeroIndex < precision) {
|
29179
|
+
formattedFractional = formattedFractional.slice(0, precision);
|
29180
|
+
} else {
|
29181
|
+
formattedFractional = formattedFractional.slice(0, firstNonZeroIndex + 1);
|
29182
|
+
}
|
29183
|
+
} else {
|
29184
|
+
formattedFractional = formattedFractional.slice(0, precision);
|
29186
29185
|
}
|
29186
|
+
} else {
|
29187
|
+
formattedFractional = formattedFractional.slice(0, precision);
|
29188
|
+
}
|
29189
|
+
if (formattedFractional.length < minPrecision) {
|
29190
|
+
formattedFractional = formattedFractional.padEnd(minPrecision, "0");
|
29187
29191
|
}
|
29188
|
-
|
29192
|
+
if (formattedFractional === "" && minPrecision === 0) {
|
29193
|
+
return formattedInteger;
|
29194
|
+
}
|
29195
|
+
return formattedFractional ? `${formattedInteger}.${formattedFractional}` : formattedInteger;
|
29189
29196
|
}
|
29190
29197
|
formatUnits(units = DEFAULT_DECIMAL_UNITS) {
|
29191
|
-
const
|
29192
|
-
const
|
29193
|
-
|
29194
|
-
|
29195
|
-
|
29196
|
-
|
29198
|
+
const valueString = this.toString();
|
29199
|
+
const valueLength = valueString.length;
|
29200
|
+
if (valueLength <= units) {
|
29201
|
+
const paddedZeros = "0".repeat(units - valueLength);
|
29202
|
+
return `0.${paddedZeros}${valueString}`;
|
29203
|
+
}
|
29204
|
+
const integerPart = valueString.slice(0, valueLength - units);
|
29205
|
+
const fractionalPart = valueString.slice(valueLength - units);
|
29206
|
+
return `${integerPart}.${fractionalPart}`;
|
29197
29207
|
}
|
29198
29208
|
// END ANCHOR: HELPERS
|
29199
29209
|
// ANCHOR: OVERRIDES to accept better inputs
|
@@ -32038,6 +32048,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32038
32048
|
);
|
32039
32049
|
}
|
32040
32050
|
}
|
32051
|
+
/**
|
32052
|
+
* Takes an B256 Address and returns back an checksum address.
|
32053
|
+
* The implementation follows the ERC-55 https://github.com/ethereum/ercs/blob/master/ERCS/erc-55.md.
|
32054
|
+
*
|
32055
|
+
* @returns A new `ChecksumAddress` instance
|
32056
|
+
*/
|
32057
|
+
toChecksum() {
|
32058
|
+
return Address.toChecksum(this.toB256());
|
32059
|
+
}
|
32041
32060
|
/**
|
32042
32061
|
* Returns the `bech32Address` property
|
32043
32062
|
*
|
@@ -32071,12 +32090,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32071
32090
|
return this.toB256();
|
32072
32091
|
}
|
32073
32092
|
/**
|
32074
|
-
*
|
32093
|
+
* returns the address `checksum` as a string
|
32075
32094
|
*
|
32076
32095
|
* @returns The `bech32Address` property as a string
|
32077
32096
|
*/
|
32078
32097
|
toString() {
|
32079
|
-
return this.
|
32098
|
+
return this.toChecksum();
|
32080
32099
|
}
|
32081
32100
|
/**
|
32082
32101
|
* Converts and returns the `bech32Address` property as a string
|
@@ -32108,12 +32127,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32108
32127
|
};
|
32109
32128
|
}
|
32110
32129
|
/**
|
32111
|
-
*
|
32130
|
+
* returns the address `checksum` as a string
|
32112
32131
|
*
|
32113
32132
|
* @returns The value of `bech32Address` property
|
32114
32133
|
*/
|
32115
32134
|
valueOf() {
|
32116
|
-
return this.
|
32135
|
+
return this.toChecksum();
|
32117
32136
|
}
|
32118
32137
|
/**
|
32119
32138
|
* Compares this the `bech32Address` property to another for direct equality
|
@@ -32220,6 +32239,35 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32220
32239
|
const paddedAddress = padFirst12BytesOfEvmAddress(evmAddress);
|
32221
32240
|
return new Address(toBech32(paddedAddress));
|
32222
32241
|
}
|
32242
|
+
/**
|
32243
|
+
* Takes an ChecksumAddress and validates if it is a valid checksum address.
|
32244
|
+
*
|
32245
|
+
* @returns A `boolean` instance indicating if the address is valid.
|
32246
|
+
*/
|
32247
|
+
static isChecksumValid(address) {
|
32248
|
+
let addressParsed = address;
|
32249
|
+
if (!address.startsWith("0x")) {
|
32250
|
+
addressParsed = `0x${address}`;
|
32251
|
+
}
|
32252
|
+
if (addressParsed.trim().length !== 66) {
|
32253
|
+
return false;
|
32254
|
+
}
|
32255
|
+
return Address.toChecksum(hexlify(addressParsed)) === addressParsed;
|
32256
|
+
}
|
32257
|
+
/** @hidden */
|
32258
|
+
static toChecksum(address) {
|
32259
|
+
const addressHex = hexlify(address).toLowerCase().slice(2);
|
32260
|
+
const checksum = sha256(address);
|
32261
|
+
let ret2 = "0x";
|
32262
|
+
for (let i = 0; i < 32; ++i) {
|
32263
|
+
const byte = checksum[i];
|
32264
|
+
const ha = addressHex.charAt(i * 2);
|
32265
|
+
const hb = addressHex.charAt(i * 2 + 1);
|
32266
|
+
ret2 += (byte & 240) >= 128 ? ha.toUpperCase() : ha;
|
32267
|
+
ret2 += (byte & 15) >= 8 ? hb.toUpperCase() : hb;
|
32268
|
+
}
|
32269
|
+
return ret2;
|
32270
|
+
}
|
32223
32271
|
};
|
32224
32272
|
|
32225
32273
|
// ../transactions/dist/index.mjs
|
@@ -37289,6 +37337,26 @@ ${DryRunSuccessStatusFragmentDoc}`;
|
|
37289
37337
|
}
|
37290
37338
|
${DryRunTransactionStatusFragmentDoc}
|
37291
37339
|
${ReceiptFragmentDoc}`;
|
37340
|
+
var BlockFragmentDoc = lib_default2`
|
37341
|
+
fragment blockFragment on Block {
|
37342
|
+
id
|
37343
|
+
height
|
37344
|
+
header {
|
37345
|
+
time
|
37346
|
+
daHeight
|
37347
|
+
stateTransitionBytecodeVersion
|
37348
|
+
transactionsCount
|
37349
|
+
transactionsRoot
|
37350
|
+
messageOutboxRoot
|
37351
|
+
eventInboxRoot
|
37352
|
+
prevRoot
|
37353
|
+
applicationHash
|
37354
|
+
}
|
37355
|
+
transactions {
|
37356
|
+
id
|
37357
|
+
}
|
37358
|
+
}
|
37359
|
+
`;
|
37292
37360
|
var CoinFragmentDoc = lib_default2`
|
37293
37361
|
fragment coinFragment on Coin {
|
37294
37362
|
type: __typename
|
@@ -37368,33 +37436,6 @@ ${ReceiptFragmentDoc}`;
|
|
37368
37436
|
nonce
|
37369
37437
|
amount
|
37370
37438
|
data
|
37371
|
-
}
|
37372
|
-
`;
|
37373
|
-
var BalanceFragmentDoc = lib_default2`
|
37374
|
-
fragment balanceFragment on Balance {
|
37375
|
-
owner
|
37376
|
-
amount
|
37377
|
-
assetId
|
37378
|
-
}
|
37379
|
-
`;
|
37380
|
-
var BlockFragmentDoc = lib_default2`
|
37381
|
-
fragment blockFragment on Block {
|
37382
|
-
id
|
37383
|
-
height
|
37384
|
-
header {
|
37385
|
-
time
|
37386
|
-
daHeight
|
37387
|
-
stateTransitionBytecodeVersion
|
37388
|
-
transactionsCount
|
37389
|
-
transactionsRoot
|
37390
|
-
messageOutboxRoot
|
37391
|
-
eventInboxRoot
|
37392
|
-
prevRoot
|
37393
|
-
applicationHash
|
37394
|
-
}
|
37395
|
-
transactions {
|
37396
|
-
id
|
37397
|
-
}
|
37398
37439
|
}
|
37399
37440
|
`;
|
37400
37441
|
var TxParametersFragmentDoc = lib_default2`
|
@@ -37454,167 +37495,6 @@ ${ReceiptFragmentDoc}`;
|
|
37454
37495
|
`;
|
37455
37496
|
var GasCostsFragmentDoc = lib_default2`
|
37456
37497
|
fragment GasCostsFragment on GasCosts {
|
37457
|
-
version
|
37458
|
-
add
|
37459
|
-
addi
|
37460
|
-
aloc
|
37461
|
-
and
|
37462
|
-
andi
|
37463
|
-
bal
|
37464
|
-
bhei
|
37465
|
-
bhsh
|
37466
|
-
burn
|
37467
|
-
cb
|
37468
|
-
cfei
|
37469
|
-
cfsi
|
37470
|
-
div
|
37471
|
-
divi
|
37472
|
-
ecr1
|
37473
|
-
eck1
|
37474
|
-
ed19
|
37475
|
-
eq
|
37476
|
-
exp
|
37477
|
-
expi
|
37478
|
-
flag
|
37479
|
-
gm
|
37480
|
-
gt
|
37481
|
-
gtf
|
37482
|
-
ji
|
37483
|
-
jmp
|
37484
|
-
jne
|
37485
|
-
jnei
|
37486
|
-
jnzi
|
37487
|
-
jmpf
|
37488
|
-
jmpb
|
37489
|
-
jnzf
|
37490
|
-
jnzb
|
37491
|
-
jnef
|
37492
|
-
jneb
|
37493
|
-
lb
|
37494
|
-
log
|
37495
|
-
lt
|
37496
|
-
lw
|
37497
|
-
mint
|
37498
|
-
mlog
|
37499
|
-
modOp
|
37500
|
-
modi
|
37501
|
-
moveOp
|
37502
|
-
movi
|
37503
|
-
mroo
|
37504
|
-
mul
|
37505
|
-
muli
|
37506
|
-
mldv
|
37507
|
-
noop
|
37508
|
-
not
|
37509
|
-
or
|
37510
|
-
ori
|
37511
|
-
poph
|
37512
|
-
popl
|
37513
|
-
pshh
|
37514
|
-
pshl
|
37515
|
-
ret
|
37516
|
-
rvrt
|
37517
|
-
sb
|
37518
|
-
sll
|
37519
|
-
slli
|
37520
|
-
srl
|
37521
|
-
srli
|
37522
|
-
srw
|
37523
|
-
sub
|
37524
|
-
subi
|
37525
|
-
sw
|
37526
|
-
sww
|
37527
|
-
time
|
37528
|
-
tr
|
37529
|
-
tro
|
37530
|
-
wdcm
|
37531
|
-
wqcm
|
37532
|
-
wdop
|
37533
|
-
wqop
|
37534
|
-
wdml
|
37535
|
-
wqml
|
37536
|
-
wddv
|
37537
|
-
wqdv
|
37538
|
-
wdmd
|
37539
|
-
wqmd
|
37540
|
-
wdam
|
37541
|
-
wqam
|
37542
|
-
wdmm
|
37543
|
-
wqmm
|
37544
|
-
xor
|
37545
|
-
xori
|
37546
|
-
alocDependentCost {
|
37547
|
-
...DependentCostFragment
|
37548
|
-
}
|
37549
|
-
bldd {
|
37550
|
-
...DependentCostFragment
|
37551
|
-
}
|
37552
|
-
bsiz {
|
37553
|
-
...DependentCostFragment
|
37554
|
-
}
|
37555
|
-
cfe {
|
37556
|
-
...DependentCostFragment
|
37557
|
-
}
|
37558
|
-
cfeiDependentCost {
|
37559
|
-
...DependentCostFragment
|
37560
|
-
}
|
37561
|
-
call {
|
37562
|
-
...DependentCostFragment
|
37563
|
-
}
|
37564
|
-
ccp {
|
37565
|
-
...DependentCostFragment
|
37566
|
-
}
|
37567
|
-
croo {
|
37568
|
-
...DependentCostFragment
|
37569
|
-
}
|
37570
|
-
csiz {
|
37571
|
-
...DependentCostFragment
|
37572
|
-
}
|
37573
|
-
ed19DependentCost {
|
37574
|
-
...DependentCostFragment
|
37575
|
-
}
|
37576
|
-
k256 {
|
37577
|
-
...DependentCostFragment
|
37578
|
-
}
|
37579
|
-
ldc {
|
37580
|
-
...DependentCostFragment
|
37581
|
-
}
|
37582
|
-
logd {
|
37583
|
-
...DependentCostFragment
|
37584
|
-
}
|
37585
|
-
mcl {
|
37586
|
-
...DependentCostFragment
|
37587
|
-
}
|
37588
|
-
mcli {
|
37589
|
-
...DependentCostFragment
|
37590
|
-
}
|
37591
|
-
mcp {
|
37592
|
-
...DependentCostFragment
|
37593
|
-
}
|
37594
|
-
mcpi {
|
37595
|
-
...DependentCostFragment
|
37596
|
-
}
|
37597
|
-
meq {
|
37598
|
-
...DependentCostFragment
|
37599
|
-
}
|
37600
|
-
retd {
|
37601
|
-
...DependentCostFragment
|
37602
|
-
}
|
37603
|
-
s256 {
|
37604
|
-
...DependentCostFragment
|
37605
|
-
}
|
37606
|
-
scwq {
|
37607
|
-
...DependentCostFragment
|
37608
|
-
}
|
37609
|
-
smo {
|
37610
|
-
...DependentCostFragment
|
37611
|
-
}
|
37612
|
-
srwq {
|
37613
|
-
...DependentCostFragment
|
37614
|
-
}
|
37615
|
-
swwq {
|
37616
|
-
...DependentCostFragment
|
37617
|
-
}
|
37618
37498
|
contractRoot {
|
37619
37499
|
...DependentCostFragment
|
37620
37500
|
}
|
@@ -37624,6 +37504,10 @@ ${ReceiptFragmentDoc}`;
|
|
37624
37504
|
vmInitialization {
|
37625
37505
|
...DependentCostFragment
|
37626
37506
|
}
|
37507
|
+
s256 {
|
37508
|
+
...DependentCostFragment
|
37509
|
+
}
|
37510
|
+
ecr1
|
37627
37511
|
newStoragePerByte
|
37628
37512
|
}
|
37629
37513
|
${DependentCostFragmentDoc}`;
|
@@ -37660,16 +37544,12 @@ ${GasCostsFragmentDoc}`;
|
|
37660
37544
|
var ChainInfoFragmentDoc = lib_default2`
|
37661
37545
|
fragment chainInfoFragment on ChainInfo {
|
37662
37546
|
name
|
37663
|
-
latestBlock {
|
37664
|
-
...blockFragment
|
37665
|
-
}
|
37666
37547
|
daHeight
|
37667
37548
|
consensusParameters {
|
37668
37549
|
...consensusParametersFragment
|
37669
37550
|
}
|
37670
37551
|
}
|
37671
|
-
${
|
37672
|
-
${ConsensusParametersFragmentDoc}`;
|
37552
|
+
${ConsensusParametersFragmentDoc}`;
|
37673
37553
|
var ContractBalanceFragmentDoc = lib_default2`
|
37674
37554
|
fragment contractBalanceFragment on ContractBalance {
|
37675
37555
|
contract
|
@@ -37700,6 +37580,12 @@ ${ConsensusParametersFragmentDoc}`;
|
|
37700
37580
|
blockHeight
|
37701
37581
|
failure
|
37702
37582
|
}
|
37583
|
+
}
|
37584
|
+
`;
|
37585
|
+
var TransactionRawPayloadFragmentDoc = lib_default2`
|
37586
|
+
fragment transactionRawPayload on Transaction {
|
37587
|
+
id
|
37588
|
+
rawPayload
|
37703
37589
|
}
|
37704
37590
|
`;
|
37705
37591
|
var GetVersionDocument = lib_default2`
|
@@ -37723,6 +37609,17 @@ ${ConsensusParametersFragmentDoc}`;
|
|
37723
37609
|
}
|
37724
37610
|
}
|
37725
37611
|
${ChainInfoFragmentDoc}`;
|
37612
|
+
var GetChainAndNodeInfoDocument = lib_default2`
|
37613
|
+
query getChainAndNodeInfo {
|
37614
|
+
chain {
|
37615
|
+
...chainInfoFragment
|
37616
|
+
}
|
37617
|
+
nodeInfo {
|
37618
|
+
...nodeInfoFragment
|
37619
|
+
}
|
37620
|
+
}
|
37621
|
+
${ChainInfoFragmentDoc}
|
37622
|
+
${NodeInfoFragmentDoc}`;
|
37726
37623
|
var GetTransactionDocument = lib_default2`
|
37727
37624
|
query getTransaction($transactionId: TransactionId!) {
|
37728
37625
|
transaction(id: $transactionId) {
|
@@ -37780,6 +37677,24 @@ ${TransactionFragmentDoc}`;
|
|
37780
37677
|
}
|
37781
37678
|
}
|
37782
37679
|
${TransactionEstimatePredicatesFragmentDoc}`;
|
37680
|
+
var GetLatestBlockDocument = lib_default2`
|
37681
|
+
query getLatestBlock {
|
37682
|
+
chain {
|
37683
|
+
latestBlock {
|
37684
|
+
...blockFragment
|
37685
|
+
}
|
37686
|
+
}
|
37687
|
+
}
|
37688
|
+
${BlockFragmentDoc}`;
|
37689
|
+
var GetLatestBlockHeightDocument = lib_default2`
|
37690
|
+
query getLatestBlockHeight {
|
37691
|
+
chain {
|
37692
|
+
latestBlock {
|
37693
|
+
height
|
37694
|
+
}
|
37695
|
+
}
|
37696
|
+
}
|
37697
|
+
`;
|
37783
37698
|
var GetBlockDocument = lib_default2`
|
37784
37699
|
query getBlock($blockId: BlockId, $height: U32) {
|
37785
37700
|
block(id: $blockId, height: $height) {
|
@@ -37792,12 +37707,12 @@ ${TransactionFragmentDoc}`;
|
|
37792
37707
|
block(id: $blockId, height: $blockHeight) {
|
37793
37708
|
...blockFragment
|
37794
37709
|
transactions {
|
37795
|
-
...
|
37710
|
+
...transactionRawPayload
|
37796
37711
|
}
|
37797
37712
|
}
|
37798
37713
|
}
|
37799
37714
|
${BlockFragmentDoc}
|
37800
|
-
${
|
37715
|
+
${TransactionRawPayloadFragmentDoc}`;
|
37801
37716
|
var GetBlocksDocument = lib_default2`
|
37802
37717
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
37803
37718
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
@@ -37872,10 +37787,10 @@ ${MessageCoinFragmentDoc}`;
|
|
37872
37787
|
var GetBalanceDocument = lib_default2`
|
37873
37788
|
query getBalance($owner: Address!, $assetId: AssetId!) {
|
37874
37789
|
balance(owner: $owner, assetId: $assetId) {
|
37875
|
-
|
37790
|
+
amount
|
37876
37791
|
}
|
37877
37792
|
}
|
37878
|
-
|
37793
|
+
`;
|
37879
37794
|
var GetLatestGasPriceDocument = lib_default2`
|
37880
37795
|
query getLatestGasPrice {
|
37881
37796
|
latestGasPrice {
|
@@ -37904,13 +37819,13 @@ ${MessageCoinFragmentDoc}`;
|
|
37904
37819
|
}
|
37905
37820
|
edges {
|
37906
37821
|
node {
|
37907
|
-
|
37822
|
+
assetId
|
37823
|
+
amount
|
37908
37824
|
}
|
37909
37825
|
}
|
37910
37826
|
}
|
37911
37827
|
}
|
37912
|
-
${PageInfoFragmentDoc}
|
37913
|
-
${BalanceFragmentDoc}`;
|
37828
|
+
${PageInfoFragmentDoc}`;
|
37914
37829
|
var GetMessagesDocument = lib_default2`
|
37915
37830
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
37916
37831
|
messages(
|
@@ -37991,6 +37906,19 @@ ${MessageFragmentDoc}`;
|
|
37991
37906
|
}
|
37992
37907
|
}
|
37993
37908
|
${MessageFragmentDoc}`;
|
37909
|
+
var IsUserAccountDocument = lib_default2`
|
37910
|
+
query isUserAccount($blobId: BlobId!, $contractId: ContractId!, $transactionId: TransactionId!) {
|
37911
|
+
blob(id: $blobId) {
|
37912
|
+
id
|
37913
|
+
}
|
37914
|
+
contract(id: $contractId) {
|
37915
|
+
id
|
37916
|
+
}
|
37917
|
+
transaction(id: $transactionId) {
|
37918
|
+
id
|
37919
|
+
}
|
37920
|
+
}
|
37921
|
+
`;
|
37994
37922
|
var SubmitAndAwaitDocument = lib_default2`
|
37995
37923
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
37996
37924
|
submitAndAwait(tx: $encodedTransaction) {
|
@@ -38023,6 +37951,9 @@ ${MessageFragmentDoc}`;
|
|
38023
37951
|
getChain(variables, options) {
|
38024
37952
|
return requester(GetChainDocument, variables, options);
|
38025
37953
|
},
|
37954
|
+
getChainAndNodeInfo(variables, options) {
|
37955
|
+
return requester(GetChainAndNodeInfoDocument, variables, options);
|
37956
|
+
},
|
38026
37957
|
getTransaction(variables, options) {
|
38027
37958
|
return requester(GetTransactionDocument, variables, options);
|
38028
37959
|
},
|
@@ -38038,6 +37969,12 @@ ${MessageFragmentDoc}`;
|
|
38038
37969
|
estimatePredicates(variables, options) {
|
38039
37970
|
return requester(EstimatePredicatesDocument, variables, options);
|
38040
37971
|
},
|
37972
|
+
getLatestBlock(variables, options) {
|
37973
|
+
return requester(GetLatestBlockDocument, variables, options);
|
37974
|
+
},
|
37975
|
+
getLatestBlockHeight(variables, options) {
|
37976
|
+
return requester(GetLatestBlockHeightDocument, variables, options);
|
37977
|
+
},
|
38041
37978
|
getBlock(variables, options) {
|
38042
37979
|
return requester(GetBlockDocument, variables, options);
|
38043
37980
|
},
|
@@ -38098,6 +38035,9 @@ ${MessageFragmentDoc}`;
|
|
38098
38035
|
getMessageByNonce(variables, options) {
|
38099
38036
|
return requester(GetMessageByNonceDocument, variables, options);
|
38100
38037
|
},
|
38038
|
+
isUserAccount(variables, options) {
|
38039
|
+
return requester(IsUserAccountDocument, variables, options);
|
38040
|
+
},
|
38101
38041
|
submitAndAwait(variables, options) {
|
38102
38042
|
return requester(SubmitAndAwaitDocument, variables, options);
|
38103
38043
|
},
|
@@ -41385,10 +41325,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41385
41325
|
// src/providers/provider.ts
|
41386
41326
|
var MAX_RETRIES = 10;
|
41387
41327
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
41328
|
+
var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
|
41388
41329
|
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
41389
41330
|
var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
|
41390
41331
|
var processGqlChain = (chain) => {
|
41391
|
-
const { name, daHeight, consensusParameters
|
41332
|
+
const { name, daHeight, consensusParameters } = chain;
|
41392
41333
|
const {
|
41393
41334
|
contractParams,
|
41394
41335
|
feeParams,
|
@@ -41439,14 +41380,6 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41439
41380
|
maxScriptDataLength: bn(scriptParams.maxScriptDataLength)
|
41440
41381
|
},
|
41441
41382
|
gasCosts
|
41442
|
-
},
|
41443
|
-
latestBlock: {
|
41444
|
-
id: latestBlock.id,
|
41445
|
-
height: bn(latestBlock.height),
|
41446
|
-
time: latestBlock.header.time,
|
41447
|
-
transactions: latestBlock.transactions.map((i) => ({
|
41448
|
-
id: i.id
|
41449
|
-
}))
|
41450
41383
|
}
|
41451
41384
|
};
|
41452
41385
|
};
|
@@ -41477,14 +41410,17 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41477
41410
|
retryOptions: void 0,
|
41478
41411
|
headers: void 0
|
41479
41412
|
});
|
41480
|
-
const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
|
41413
|
+
const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
|
41481
41414
|
this.url = rawUrl;
|
41482
41415
|
this.urlWithoutAuth = urlWithoutAuth;
|
41483
|
-
this.options = { ...this.options, ...options };
|
41484
41416
|
this.url = url;
|
41485
|
-
|
41486
|
-
|
41487
|
-
|
41417
|
+
const { FUELS } = versions;
|
41418
|
+
const headers = { ...authHeaders, ...options.headers, Source: `ts-sdk-${FUELS}` };
|
41419
|
+
this.options = {
|
41420
|
+
...this.options,
|
41421
|
+
...options,
|
41422
|
+
headers
|
41423
|
+
};
|
41488
41424
|
this.operations = this.createOperations();
|
41489
41425
|
const { resourceCacheTTL } = this.options;
|
41490
41426
|
if (isDefined(resourceCacheTTL)) {
|
@@ -41623,9 +41559,25 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41623
41559
|
* @returns A promise that resolves to the Chain and NodeInfo.
|
41624
41560
|
*/
|
41625
41561
|
async fetchChainAndNodeInfo() {
|
41626
|
-
|
41627
|
-
|
41628
|
-
|
41562
|
+
let nodeInfo;
|
41563
|
+
let chain;
|
41564
|
+
try {
|
41565
|
+
nodeInfo = this.getNode();
|
41566
|
+
chain = this.getChain();
|
41567
|
+
} catch (error) {
|
41568
|
+
const data = await this.operations.getChainAndNodeInfo();
|
41569
|
+
nodeInfo = {
|
41570
|
+
maxDepth: bn(data.nodeInfo.maxDepth),
|
41571
|
+
maxTx: bn(data.nodeInfo.maxTx),
|
41572
|
+
nodeVersion: data.nodeInfo.nodeVersion,
|
41573
|
+
utxoValidation: data.nodeInfo.utxoValidation,
|
41574
|
+
vmBacktrace: data.nodeInfo.vmBacktrace
|
41575
|
+
};
|
41576
|
+
_Provider.ensureClientVersionIsSupported(nodeInfo);
|
41577
|
+
chain = processGqlChain(data.chain);
|
41578
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
41579
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
41580
|
+
}
|
41629
41581
|
return {
|
41630
41582
|
chain,
|
41631
41583
|
nodeInfo
|
@@ -41717,8 +41669,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41717
41669
|
* @returns A promise that resolves to the latest block number.
|
41718
41670
|
*/
|
41719
41671
|
async getBlockNumber() {
|
41720
|
-
const {
|
41721
|
-
|
41672
|
+
const {
|
41673
|
+
chain: {
|
41674
|
+
latestBlock: { height }
|
41675
|
+
}
|
41676
|
+
} = await this.operations.getLatestBlockHeight();
|
41677
|
+
return bn(height);
|
41722
41678
|
}
|
41723
41679
|
/**
|
41724
41680
|
* Returns the node information for the current provider network.
|
@@ -42265,17 +42221,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42265
42221
|
* @returns A promise that resolves to the block or null.
|
42266
42222
|
*/
|
42267
42223
|
async getBlock(idOrHeight) {
|
42268
|
-
let
|
42269
|
-
if (
|
42270
|
-
|
42271
|
-
|
42272
|
-
|
42273
|
-
|
42274
|
-
variables = { blockId: idOrHeight };
|
42224
|
+
let block2;
|
42225
|
+
if (idOrHeight === "latest") {
|
42226
|
+
const {
|
42227
|
+
chain: { latestBlock }
|
42228
|
+
} = await this.operations.getLatestBlock();
|
42229
|
+
block2 = latestBlock;
|
42275
42230
|
} else {
|
42276
|
-
|
42231
|
+
const isblockId = typeof idOrHeight === "string" && idOrHeight.length === 66;
|
42232
|
+
const variables = isblockId ? { blockId: idOrHeight } : { height: bn(idOrHeight).toString(10) };
|
42233
|
+
const response = await this.operations.getBlock(variables);
|
42234
|
+
block2 = response.block;
|
42277
42235
|
}
|
42278
|
-
const { block: block2 } = await this.operations.getBlock(variables);
|
42279
42236
|
if (!block2) {
|
42280
42237
|
return null;
|
42281
42238
|
}
|
@@ -42401,7 +42358,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42401
42358
|
async getTransactions(paginationArgs) {
|
42402
42359
|
const {
|
42403
42360
|
transactions: { edges, pageInfo }
|
42404
|
-
} = await this.operations.getTransactions(
|
42361
|
+
} = await this.operations.getTransactions({
|
42362
|
+
...this.validatePaginationArgs({
|
42363
|
+
inputArgs: paginationArgs,
|
42364
|
+
paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
|
42365
|
+
})
|
42366
|
+
});
|
42405
42367
|
const coder = new TransactionCoder();
|
42406
42368
|
const transactions = edges.map(({ node: { rawPayload } }) => {
|
42407
42369
|
try {
|
@@ -42657,6 +42619,40 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42657
42619
|
});
|
42658
42620
|
return bn(latestBlockHeight);
|
42659
42621
|
}
|
42622
|
+
/**
|
42623
|
+
* Check if the given ID is an account.
|
42624
|
+
*
|
42625
|
+
* @param id - The ID to check.
|
42626
|
+
* @returns A promise that resolves to the result of the check.
|
42627
|
+
*/
|
42628
|
+
async isUserAccount(id) {
|
42629
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
42630
|
+
blobId: id,
|
42631
|
+
contractId: id,
|
42632
|
+
transactionId: id
|
42633
|
+
});
|
42634
|
+
if (contract || blob || transaction) {
|
42635
|
+
return false;
|
42636
|
+
}
|
42637
|
+
return true;
|
42638
|
+
}
|
42639
|
+
async getAddressType(id) {
|
42640
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
42641
|
+
blobId: id,
|
42642
|
+
contractId: id,
|
42643
|
+
transactionId: id
|
42644
|
+
});
|
42645
|
+
if (contract) {
|
42646
|
+
return "Contract";
|
42647
|
+
}
|
42648
|
+
if (blob) {
|
42649
|
+
return "Blob";
|
42650
|
+
}
|
42651
|
+
if (transaction) {
|
42652
|
+
return "Transaction";
|
42653
|
+
}
|
42654
|
+
return "Account";
|
42655
|
+
}
|
42660
42656
|
/**
|
42661
42657
|
* Get the transaction response for the given transaction ID.
|
42662
42658
|
*
|