@fuel-ts/account 0.98.0 → 0.99.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/account.d.ts +4 -4
- package/dist/account.d.ts.map +1 -1
- package/dist/assets/asset-api.d.ts +69 -0
- package/dist/assets/asset-api.d.ts.map +1 -0
- package/dist/assets/assets.d.ts.map +1 -0
- package/dist/{providers/assets → assets}/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/assets/types.d.ts.map +1 -0
- package/dist/assets/utils/fuelAssetsBaseUrl.d.ts +2 -0
- package/dist/assets/utils/fuelAssetsBaseUrl.d.ts.map +1 -0
- package/dist/assets/utils/index.d.ts.map +1 -0
- package/dist/{providers/assets → assets}/utils/network.d.ts +6 -6
- package/dist/assets/utils/network.d.ts.map +1 -0
- package/dist/assets/utils/resolveIconPaths.d.ts.map +1 -0
- package/dist/assets/utils/url.d.ts.map +1 -0
- package/dist/configs.d.ts +2 -2
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs.map +1 -1
- package/dist/connectors/fuel-connector.d.ts +1 -1
- package/dist/connectors/fuel-connector.d.ts.map +1 -1
- package/dist/connectors/types/events.d.ts +1 -1
- package/dist/connectors/types/events.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.global.js +14564 -14439
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +6423 -6303
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6461 -6347
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +28 -6
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts +1 -0
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +43 -13
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/handle-gql-error-message.d.ts +5 -1
- package/dist/providers/utils/handle-gql-error-message.d.ts.map +1 -1
- package/dist/test-utils/wallet-config.d.ts +2 -1
- package/dist/test-utils/wallet-config.d.ts.map +1 -1
- package/dist/test-utils.global.js +205 -740
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +270 -822
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +195 -747
- package/dist/test-utils.mjs.map +1 -1
- package/dist/utils/deployScriptOrPredicate.d.ts.map +1 -1
- package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
- package/dist/utils/predicate-script-loader-instructions.d.ts +36 -1
- package/dist/utils/predicate-script-loader-instructions.d.ts.map +1 -1
- package/dist/wallet/keystore-wallet.d.ts +2 -2
- package/dist/wallet/keystore-wallet.d.ts.map +1 -1
- package/dist/wallet-manager/vaults/mnemonic-vault.d.ts +3 -2
- package/dist/wallet-manager/vaults/mnemonic-vault.d.ts.map +1 -1
- package/dist/wallet-manager/vaults/privatekey-vault.d.ts +2 -1
- package/dist/wallet-manager/vaults/privatekey-vault.d.ts.map +1 -1
- package/dist/wallet-manager/wallet-manager.d.ts +3 -3
- package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
- package/package.json +15 -16
- package/dist/providers/assets/assets.d.ts.map +0 -1
- package/dist/providers/assets/index.d.ts.map +0 -1
- package/dist/providers/assets/types.d.ts.map +0 -1
- package/dist/providers/assets/utils/fuelAssetsBaseUrl.d.ts +0 -2
- package/dist/providers/assets/utils/fuelAssetsBaseUrl.d.ts.map +0 -1
- package/dist/providers/assets/utils/index.d.ts.map +0 -1
- package/dist/providers/assets/utils/network.d.ts.map +0 -1
- package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +0 -1
- package/dist/providers/assets/utils/url.d.ts.map +0 -1
- /package/dist/{providers/assets → assets}/assets.d.ts +0 -0
- /package/dist/{providers/assets → assets}/types.d.ts +0 -0
- /package/dist/{providers/assets → assets}/utils/index.d.ts +0 -0
- /package/dist/{providers/assets → assets}/utils/resolveIconPaths.d.ts +0 -0
- /package/dist/{providers/assets → assets}/utils/url.d.ts +0 -0
package/dist/test-utils.mjs
CHANGED
@@ -55,7 +55,7 @@ var Signer = class {
|
|
55
55
|
this.privateKey = hexlify(privateKeyBytes);
|
56
56
|
this.publicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
57
57
|
this.compressedPublicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, true));
|
58
|
-
this.address = Address
|
58
|
+
this.address = new Address(this.publicKey);
|
59
59
|
}
|
60
60
|
/**
|
61
61
|
* Sign data using the Signer instance
|
@@ -113,7 +113,7 @@ var Signer = class {
|
|
113
113
|
* @returns Address from signature
|
114
114
|
*/
|
115
115
|
static recoverAddress(data, signature) {
|
116
|
-
return Address
|
116
|
+
return new Address(Signer.recoverPublicKey(data, signature));
|
117
117
|
}
|
118
118
|
/**
|
119
119
|
* Generate a random privateKey
|
@@ -1173,9 +1173,6 @@ var GetBalancesDocument = gql`
|
|
1173
1173
|
first: $first
|
1174
1174
|
last: $last
|
1175
1175
|
) {
|
1176
|
-
pageInfo {
|
1177
|
-
...pageInfoFragment
|
1178
|
-
}
|
1179
1176
|
edges {
|
1180
1177
|
node {
|
1181
1178
|
assetId
|
@@ -1184,7 +1181,7 @@ var GetBalancesDocument = gql`
|
|
1184
1181
|
}
|
1185
1182
|
}
|
1186
1183
|
}
|
1187
|
-
|
1184
|
+
`;
|
1188
1185
|
var GetMessagesDocument = gql`
|
1189
1186
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
1190
1187
|
messages(
|
@@ -1206,6 +1203,13 @@ var GetMessagesDocument = gql`
|
|
1206
1203
|
}
|
1207
1204
|
${PageInfoFragmentDoc}
|
1208
1205
|
${GetMessageFragmentDoc}`;
|
1206
|
+
var DaCompressedBlockDocument = gql`
|
1207
|
+
query daCompressedBlock($height: U32!) {
|
1208
|
+
daCompressedBlock(height: $height) {
|
1209
|
+
bytes
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
`;
|
1209
1213
|
var GetMessageProofDocument = gql`
|
1210
1214
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
1211
1215
|
messageProof(
|
@@ -1377,6 +1381,9 @@ function getSdk(requester) {
|
|
1377
1381
|
getMessages(variables, options) {
|
1378
1382
|
return requester(GetMessagesDocument, variables, options);
|
1379
1383
|
},
|
1384
|
+
daCompressedBlock(variables, options) {
|
1385
|
+
return requester(DaCompressedBlockDocument, variables, options);
|
1386
|
+
},
|
1380
1387
|
getMessageProof(variables, options) {
|
1381
1388
|
return requester(GetMessageProofDocument, variables, options);
|
1382
1389
|
},
|
@@ -1414,8 +1421,60 @@ function getSdk(requester) {
|
|
1414
1421
|
}
|
1415
1422
|
|
1416
1423
|
// src/providers/fuel-graphql-subscriber.ts
|
1417
|
-
import { ErrorCode, FuelError as
|
1424
|
+
import { ErrorCode as ErrorCode2, FuelError as FuelError3 } from "@fuel-ts/errors";
|
1418
1425
|
import { print } from "graphql";
|
1426
|
+
|
1427
|
+
// src/providers/utils/handle-gql-error-message.ts
|
1428
|
+
import { ErrorCode, FuelError as FuelError2 } from "@fuel-ts/errors";
|
1429
|
+
var mapGqlErrorMessage = (error) => {
|
1430
|
+
switch (error.message) {
|
1431
|
+
case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
|
1432
|
+
return new FuelError2(
|
1433
|
+
ErrorCode.NOT_ENOUGH_FUNDS,
|
1434
|
+
`The account(s) sending the transaction don't have enough funds to cover the transaction.`,
|
1435
|
+
{},
|
1436
|
+
error
|
1437
|
+
);
|
1438
|
+
case "max number of coins is reached while trying to fit the target" /* MAX_COINS_REACHED */:
|
1439
|
+
return new FuelError2(
|
1440
|
+
ErrorCode.MAX_COINS_REACHED,
|
1441
|
+
"The account retrieving coins has exceeded the maximum number of coins per asset. Please consider combining your coins into a single UTXO.",
|
1442
|
+
{},
|
1443
|
+
error
|
1444
|
+
);
|
1445
|
+
default:
|
1446
|
+
return new FuelError2(ErrorCode.INVALID_REQUEST, error.message, {}, error);
|
1447
|
+
}
|
1448
|
+
};
|
1449
|
+
var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
|
1450
|
+
if (!incompatibleNodeVersionMessage) {
|
1451
|
+
return error;
|
1452
|
+
}
|
1453
|
+
return new FuelError2(
|
1454
|
+
error.code,
|
1455
|
+
`${error.message}
|
1456
|
+
|
1457
|
+
${incompatibleNodeVersionMessage}`,
|
1458
|
+
error.metadata,
|
1459
|
+
error.rawError
|
1460
|
+
);
|
1461
|
+
};
|
1462
|
+
var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = false) => {
|
1463
|
+
if (!Array.isArray(errors)) {
|
1464
|
+
return;
|
1465
|
+
}
|
1466
|
+
const mappedErrors = errors.map(mapGqlErrorMessage);
|
1467
|
+
if (mappedErrors.length === 1) {
|
1468
|
+
throw mapGqlErrorWithIncompatibleNodeVersion(mappedErrors[0], incompatibleNodeVersionMessage);
|
1469
|
+
}
|
1470
|
+
const errorMessage = mappedErrors.map((err) => err.message).join("\n");
|
1471
|
+
throw mapGqlErrorWithIncompatibleNodeVersion(
|
1472
|
+
new FuelError2(ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
|
1473
|
+
incompatibleNodeVersionMessage
|
1474
|
+
);
|
1475
|
+
};
|
1476
|
+
|
1477
|
+
// src/providers/fuel-graphql-subscriber.ts
|
1419
1478
|
var _FuelGraphqlSubscriber = class {
|
1420
1479
|
constructor(stream) {
|
1421
1480
|
this.stream = stream;
|
@@ -1443,12 +1502,7 @@ var _FuelGraphqlSubscriber = class {
|
|
1443
1502
|
while (true) {
|
1444
1503
|
if (this.events.length > 0) {
|
1445
1504
|
const { data, errors } = this.events.shift();
|
1446
|
-
|
1447
|
-
throw new FuelError2(
|
1448
|
-
FuelError2.CODES.INVALID_REQUEST,
|
1449
|
-
errors.map((err) => err.message).join("\n\n")
|
1450
|
-
);
|
1451
|
-
}
|
1505
|
+
assertGqlResponseHasNoErrors(errors, _FuelGraphqlSubscriber.incompatibleNodeVersionMessage);
|
1452
1506
|
return { value: data, done: false };
|
1453
1507
|
}
|
1454
1508
|
const { value, done } = await this.stream.read();
|
@@ -1466,8 +1520,8 @@ var _FuelGraphqlSubscriber = class {
|
|
1466
1520
|
try {
|
1467
1521
|
this.events.push(JSON.parse(match.replace(/^data:/, "")));
|
1468
1522
|
} catch (e) {
|
1469
|
-
throw new
|
1470
|
-
|
1523
|
+
throw new FuelError3(
|
1524
|
+
ErrorCode2.STREAM_PARSING_ERROR,
|
1471
1525
|
`Error while parsing stream data response: ${text}`
|
1472
1526
|
);
|
1473
1527
|
}
|
@@ -1486,10 +1540,11 @@ var _FuelGraphqlSubscriber = class {
|
|
1486
1540
|
}
|
1487
1541
|
};
|
1488
1542
|
var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
|
1543
|
+
__publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
|
1489
1544
|
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
1490
1545
|
|
1491
1546
|
// src/providers/resource-cache.ts
|
1492
|
-
import { ErrorCode as
|
1547
|
+
import { ErrorCode as ErrorCode3, FuelError as FuelError4 } from "@fuel-ts/errors";
|
1493
1548
|
import { hexlify as hexlify4 } from "@fuel-ts/utils";
|
1494
1549
|
var cache = /* @__PURE__ */ new Map();
|
1495
1550
|
var ResourceCache = class {
|
@@ -1497,8 +1552,8 @@ var ResourceCache = class {
|
|
1497
1552
|
constructor(ttl) {
|
1498
1553
|
this.ttl = ttl;
|
1499
1554
|
if (typeof ttl !== "number" || this.ttl <= 0) {
|
1500
|
-
throw new
|
1501
|
-
|
1555
|
+
throw new FuelError4(
|
1556
|
+
ErrorCode3.INVALID_TTL,
|
1502
1557
|
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
1503
1558
|
);
|
1504
1559
|
}
|
@@ -1553,7 +1608,7 @@ var ResourceCache = class {
|
|
1553
1608
|
// src/providers/transaction-request/input.ts
|
1554
1609
|
import { BYTES_32 as BYTES_322, UTXO_ID_LEN } from "@fuel-ts/abi-coder";
|
1555
1610
|
import { ZeroBytes32 } from "@fuel-ts/address/configs";
|
1556
|
-
import { ErrorCode as
|
1611
|
+
import { ErrorCode as ErrorCode4, FuelError as FuelError5 } from "@fuel-ts/errors";
|
1557
1612
|
import { bn as bn2, toNumber } from "@fuel-ts/math";
|
1558
1613
|
import { InputType } from "@fuel-ts/transactions";
|
1559
1614
|
import { arrayify as arrayify2, hexlify as hexlify5 } from "@fuel-ts/utils";
|
@@ -1617,8 +1672,8 @@ var inputify = (value) => {
|
|
1617
1672
|
};
|
1618
1673
|
}
|
1619
1674
|
default: {
|
1620
|
-
throw new
|
1621
|
-
|
1675
|
+
throw new FuelError5(
|
1676
|
+
ErrorCode4.INVALID_TRANSACTION_INPUT,
|
1622
1677
|
`Invalid transaction input type: ${type}.`
|
1623
1678
|
);
|
1624
1679
|
}
|
@@ -1627,7 +1682,7 @@ var inputify = (value) => {
|
|
1627
1682
|
|
1628
1683
|
// src/providers/transaction-request/output.ts
|
1629
1684
|
import { ZeroBytes32 as ZeroBytes322 } from "@fuel-ts/address/configs";
|
1630
|
-
import { ErrorCode as
|
1685
|
+
import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/errors";
|
1631
1686
|
import { bn as bn3 } from "@fuel-ts/math";
|
1632
1687
|
import { OutputType } from "@fuel-ts/transactions";
|
1633
1688
|
import { hexlify as hexlify6 } from "@fuel-ts/utils";
|
@@ -1674,8 +1729,8 @@ var outputify = (value) => {
|
|
1674
1729
|
};
|
1675
1730
|
}
|
1676
1731
|
default: {
|
1677
|
-
throw new
|
1678
|
-
|
1732
|
+
throw new FuelError6(
|
1733
|
+
ErrorCode5.INVALID_TRANSACTION_INPUT,
|
1679
1734
|
`Invalid transaction output type: ${type}.`
|
1680
1735
|
);
|
1681
1736
|
}
|
@@ -1687,7 +1742,7 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
|
|
1687
1742
|
import { Address as Address2, addressify } from "@fuel-ts/address";
|
1688
1743
|
import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
|
1689
1744
|
import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
|
1690
|
-
import { FuelError as
|
1745
|
+
import { FuelError as FuelError11 } from "@fuel-ts/errors";
|
1691
1746
|
import { bn as bn8 } from "@fuel-ts/math";
|
1692
1747
|
import {
|
1693
1748
|
PolicyType,
|
@@ -1706,7 +1761,7 @@ var isCoin = (resource) => "id" in resource;
|
|
1706
1761
|
|
1707
1762
|
// src/providers/utils/receipts.ts
|
1708
1763
|
import { ZeroBytes32 as ZeroBytes323 } from "@fuel-ts/address/configs";
|
1709
|
-
import { ErrorCode as
|
1764
|
+
import { ErrorCode as ErrorCode6, FuelError as FuelError7 } from "@fuel-ts/errors";
|
1710
1765
|
import { bn as bn4 } from "@fuel-ts/math";
|
1711
1766
|
import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
|
1712
1767
|
import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs";
|
@@ -1919,12 +1974,12 @@ function assembleReceiptByType(receipt) {
|
|
1919
1974
|
return burnReceipt;
|
1920
1975
|
}
|
1921
1976
|
default:
|
1922
|
-
throw new
|
1977
|
+
throw new FuelError7(ErrorCode6.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
|
1923
1978
|
}
|
1924
1979
|
}
|
1925
1980
|
|
1926
1981
|
// src/providers/utils/block-explorer.ts
|
1927
|
-
import { ErrorCode as
|
1982
|
+
import { ErrorCode as ErrorCode7, FuelError as FuelError8 } from "@fuel-ts/errors";
|
1928
1983
|
|
1929
1984
|
// src/providers/utils/gas.ts
|
1930
1985
|
import { bn as bn5 } from "@fuel-ts/math";
|
@@ -2096,7 +2151,7 @@ function normalizeJSON(root) {
|
|
2096
2151
|
}
|
2097
2152
|
|
2098
2153
|
// src/providers/utils/extract-tx-error.ts
|
2099
|
-
import { ErrorCode as
|
2154
|
+
import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2100
2155
|
import { bn as bn6 } from "@fuel-ts/math";
|
2101
2156
|
import { ReceiptType as ReceiptType3 } from "@fuel-ts/transactions";
|
2102
2157
|
import {
|
@@ -2117,7 +2172,7 @@ You can read more about this error at:
|
|
2117
2172
|
|
2118
2173
|
${PANIC_DOC_URL}#variant.${statusReason}`;
|
2119
2174
|
}
|
2120
|
-
return new
|
2175
|
+
return new FuelError9(ErrorCode8.SCRIPT_REVERTED, errorMessage, {
|
2121
2176
|
...metadata,
|
2122
2177
|
reason: statusReason
|
2123
2178
|
});
|
@@ -2158,8 +2213,8 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2158
2213
|
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
2159
2214
|
break;
|
2160
2215
|
default:
|
2161
|
-
throw new
|
2162
|
-
|
2216
|
+
throw new FuelError9(
|
2217
|
+
ErrorCode8.UNKNOWN,
|
2163
2218
|
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
2164
2219
|
{
|
2165
2220
|
...metadata,
|
@@ -2168,7 +2223,7 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2168
2223
|
);
|
2169
2224
|
}
|
2170
2225
|
}
|
2171
|
-
return new
|
2226
|
+
return new FuelError9(ErrorCode8.SCRIPT_REVERTED, errorMessage, {
|
2172
2227
|
...metadata,
|
2173
2228
|
reason
|
2174
2229
|
});
|
@@ -2201,7 +2256,7 @@ var NoWitnessAtIndexError = class extends Error {
|
|
2201
2256
|
};
|
2202
2257
|
|
2203
2258
|
// src/providers/transaction-request/helpers.ts
|
2204
|
-
import { ErrorCode as
|
2259
|
+
import { ErrorCode as ErrorCode9, FuelError as FuelError10 } from "@fuel-ts/errors";
|
2205
2260
|
import { bn as bn7 } from "@fuel-ts/math";
|
2206
2261
|
import { InputType as InputType2, OutputType as OutputType2 } from "@fuel-ts/transactions";
|
2207
2262
|
var isRequestInputCoin = (input) => input.type === InputType2.Coin;
|
@@ -2258,7 +2313,7 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
|
|
2258
2313
|
"Add the relevant change outputs to the transaction to avoid burning assets.",
|
2259
2314
|
"Or enable asset burn, upon sending the transaction."
|
2260
2315
|
].join("\n");
|
2261
|
-
throw new
|
2316
|
+
throw new FuelError10(ErrorCode9.ASSET_BURN_DETECTED, message);
|
2262
2317
|
};
|
2263
2318
|
|
2264
2319
|
// src/providers/transaction-request/witness.ts
|
@@ -2409,7 +2464,7 @@ var BaseTransactionRequest = class {
|
|
2409
2464
|
* @param signature - The signature to update the witness with.
|
2410
2465
|
*/
|
2411
2466
|
updateWitnessByOwner(address, signature) {
|
2412
|
-
const ownerAddress = Address2
|
2467
|
+
const ownerAddress = new Address2(address);
|
2413
2468
|
const witnessIndex = this.getCoinInputWitnessIndexByOwner(ownerAddress);
|
2414
2469
|
if (typeof witnessIndex === "number") {
|
2415
2470
|
this.updateWitness(witnessIndex, signature);
|
@@ -2643,7 +2698,7 @@ var BaseTransactionRequest = class {
|
|
2643
2698
|
* @hidden
|
2644
2699
|
*/
|
2645
2700
|
metadataGas(_gasCosts) {
|
2646
|
-
throw new
|
2701
|
+
throw new FuelError11(FuelError11.CODES.NOT_IMPLEMENTED, "Not implemented");
|
2647
2702
|
}
|
2648
2703
|
/**
|
2649
2704
|
* @hidden
|
@@ -2760,7 +2815,7 @@ var BaseTransactionRequest = class {
|
|
2760
2815
|
this.inputs.filter(isRequestInputResource).forEach((i) => {
|
2761
2816
|
const owner = getRequestInputResourceOwner(i);
|
2762
2817
|
const correspondingInput = inputsToExtractGasUsed.find(
|
2763
|
-
(x) => isRequestInputResourceFromOwner(x, Address2
|
2818
|
+
(x) => isRequestInputResourceFromOwner(x, new Address2(String(owner)))
|
2764
2819
|
);
|
2765
2820
|
if (correspondingInput && "predicateGasUsed" in correspondingInput && bn8(correspondingInput.predicateGasUsed).gt(0)) {
|
2766
2821
|
i.predicateGasUsed = correspondingInput.predicateGasUsed;
|
@@ -3251,7 +3306,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3251
3306
|
};
|
3252
3307
|
|
3253
3308
|
// src/providers/transaction-request/upgrade-transaction-request.ts
|
3254
|
-
import { FuelError as
|
3309
|
+
import { FuelError as FuelError12 } from "@fuel-ts/errors";
|
3255
3310
|
import { hash as hash2 } from "@fuel-ts/hasher";
|
3256
3311
|
import {
|
3257
3312
|
TransactionType as TransactionType5,
|
@@ -3358,7 +3413,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
3358
3413
|
}
|
3359
3414
|
};
|
3360
3415
|
} else {
|
3361
|
-
throw new
|
3416
|
+
throw new FuelError12(FuelError12.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
3362
3417
|
}
|
3363
3418
|
return {
|
3364
3419
|
type: TransactionType5.Upgrade,
|
@@ -3400,7 +3455,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
3400
3455
|
txBytesSize
|
3401
3456
|
});
|
3402
3457
|
}
|
3403
|
-
throw new
|
3458
|
+
throw new FuelError12(FuelError12.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
3404
3459
|
}
|
3405
3460
|
};
|
3406
3461
|
|
@@ -3511,7 +3566,7 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
|
|
3511
3566
|
};
|
3512
3567
|
|
3513
3568
|
// src/providers/transaction-request/utils.ts
|
3514
|
-
import { ErrorCode as
|
3569
|
+
import { ErrorCode as ErrorCode10, FuelError as FuelError13 } from "@fuel-ts/errors";
|
3515
3570
|
import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
|
3516
3571
|
var transactionRequestify = (obj) => {
|
3517
3572
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
|
@@ -3535,8 +3590,8 @@ var transactionRequestify = (obj) => {
|
|
3535
3590
|
return UploadTransactionRequest.from(obj);
|
3536
3591
|
}
|
3537
3592
|
default: {
|
3538
|
-
throw new
|
3539
|
-
|
3593
|
+
throw new FuelError13(
|
3594
|
+
ErrorCode10.UNSUPPORTED_TRANSACTION_TYPE,
|
3540
3595
|
`Unsupported transaction type: ${type}.`
|
3541
3596
|
);
|
3542
3597
|
}
|
@@ -3546,7 +3601,7 @@ var isTransactionTypeScript = (request) => request.type === TransactionType7.Scr
|
|
3546
3601
|
var isTransactionTypeCreate = (request) => request.type === TransactionType7.Create;
|
3547
3602
|
|
3548
3603
|
// src/providers/transaction-response/transaction-response.ts
|
3549
|
-
import { ErrorCode as
|
3604
|
+
import { ErrorCode as ErrorCode14, FuelError as FuelError17 } from "@fuel-ts/errors";
|
3550
3605
|
import { bn as bn16 } from "@fuel-ts/math";
|
3551
3606
|
import { OutputType as OutputType8, TransactionCoder as TransactionCoder4, TxPointerCoder } from "@fuel-ts/transactions";
|
3552
3607
|
import { arrayify as arrayify12, assertUnreachable } from "@fuel-ts/utils";
|
@@ -3624,7 +3679,7 @@ var calculateTXFeeForSummary = (params) => {
|
|
3624
3679
|
|
3625
3680
|
// src/providers/transaction-summary/operations.ts
|
3626
3681
|
import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
|
3627
|
-
import { ErrorCode as
|
3682
|
+
import { ErrorCode as ErrorCode12, FuelError as FuelError15 } from "@fuel-ts/errors";
|
3628
3683
|
import { bn as bn13 } from "@fuel-ts/math";
|
3629
3684
|
import { ReceiptType as ReceiptType4, TransactionType as TransactionType9 } from "@fuel-ts/transactions";
|
3630
3685
|
|
@@ -3662,7 +3717,7 @@ var getFunctionCall = ({ abi, receipt }) => {
|
|
3662
3717
|
};
|
3663
3718
|
|
3664
3719
|
// src/providers/transaction-summary/input.ts
|
3665
|
-
import { ErrorCode as
|
3720
|
+
import { ErrorCode as ErrorCode11, FuelError as FuelError14 } from "@fuel-ts/errors";
|
3666
3721
|
import { BN } from "@fuel-ts/math";
|
3667
3722
|
import { InputType as InputType6 } from "@fuel-ts/transactions";
|
3668
3723
|
function getInputsByTypes(inputs, types) {
|
@@ -3731,8 +3786,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
3731
3786
|
return void 0;
|
3732
3787
|
}
|
3733
3788
|
if (contractInput.type !== InputType6.Contract) {
|
3734
|
-
throw new
|
3735
|
-
|
3789
|
+
throw new FuelError14(
|
3790
|
+
ErrorCode11.INVALID_TRANSACTION_INPUT,
|
3736
3791
|
`Contract input should be of type 'contract'.`
|
3737
3792
|
);
|
3738
3793
|
}
|
@@ -3785,8 +3840,8 @@ function getTransactionTypeName(transactionType) {
|
|
3785
3840
|
case TransactionType9.Upload:
|
3786
3841
|
return "Upload" /* Upload */;
|
3787
3842
|
default:
|
3788
|
-
throw new
|
3789
|
-
|
3843
|
+
throw new FuelError15(
|
3844
|
+
ErrorCode12.UNSUPPORTED_TRANSACTION_TYPE,
|
3790
3845
|
`Unsupported transaction type: ${transactionType}.`
|
3791
3846
|
);
|
3792
3847
|
}
|
@@ -4166,7 +4221,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
4166
4221
|
};
|
4167
4222
|
|
4168
4223
|
// src/providers/transaction-summary/status.ts
|
4169
|
-
import { ErrorCode as
|
4224
|
+
import { ErrorCode as ErrorCode13, FuelError as FuelError16 } from "@fuel-ts/errors";
|
4170
4225
|
import { bn as bn14 } from "@fuel-ts/math";
|
4171
4226
|
var getTransactionStatusName = (gqlStatus) => {
|
4172
4227
|
switch (gqlStatus) {
|
@@ -4179,8 +4234,8 @@ var getTransactionStatusName = (gqlStatus) => {
|
|
4179
4234
|
case "SqueezedOutStatus":
|
4180
4235
|
return "squeezedout" /* squeezedout */;
|
4181
4236
|
default:
|
4182
|
-
throw new
|
4183
|
-
|
4237
|
+
throw new FuelError16(
|
4238
|
+
ErrorCode13.INVALID_TRANSACTION_STATUS,
|
4184
4239
|
`Invalid transaction status: ${gqlStatus}.`
|
4185
4240
|
);
|
4186
4241
|
}
|
@@ -4370,6 +4425,7 @@ var TransactionResponse = class {
|
|
4370
4425
|
this.provider = provider;
|
4371
4426
|
this.abis = abis;
|
4372
4427
|
this.request = typeof tx === "string" ? void 0 : tx;
|
4428
|
+
this.waitForResult = this.waitForResult.bind(this);
|
4373
4429
|
}
|
4374
4430
|
/** Transaction ID */
|
4375
4431
|
id;
|
@@ -4524,8 +4580,8 @@ var TransactionResponse = class {
|
|
4524
4580
|
this.status = statusChange;
|
4525
4581
|
if (statusChange.type === "SqueezedOutStatus") {
|
4526
4582
|
this.unsetResourceCache();
|
4527
|
-
throw new
|
4528
|
-
|
4583
|
+
throw new FuelError17(
|
4584
|
+
ErrorCode14.TRANSACTION_SQUEEZED_OUT,
|
4529
4585
|
`Transaction Squeezed Out with reason: ${statusChange.reason}`
|
4530
4586
|
);
|
4531
4587
|
}
|
@@ -4632,29 +4688,6 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
|
|
4632
4688
|
};
|
4633
4689
|
}
|
4634
4690
|
|
4635
|
-
// src/providers/utils/handle-gql-error-message.ts
|
4636
|
-
import { ErrorCode as ErrorCode14, FuelError as FuelError17 } from "@fuel-ts/errors";
|
4637
|
-
var handleGqlErrorMessage = (errorMessage, rawError) => {
|
4638
|
-
switch (errorMessage) {
|
4639
|
-
case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
|
4640
|
-
throw new FuelError17(
|
4641
|
-
ErrorCode14.NOT_ENOUGH_FUNDS,
|
4642
|
-
`The account(s) sending the transaction don't have enough funds to cover the transaction.`,
|
4643
|
-
{},
|
4644
|
-
rawError
|
4645
|
-
);
|
4646
|
-
case "max number of coins is reached while trying to fit the target" /* MAX_COINS_REACHED */:
|
4647
|
-
throw new FuelError17(
|
4648
|
-
ErrorCode14.MAX_COINS_REACHED,
|
4649
|
-
"The account retrieving coins has exceeded the maximum number of coins per asset. Please consider combining your coins into a single UTXO.",
|
4650
|
-
{},
|
4651
|
-
rawError
|
4652
|
-
);
|
4653
|
-
default:
|
4654
|
-
throw new FuelError17(ErrorCode14.INVALID_REQUEST, errorMessage);
|
4655
|
-
}
|
4656
|
-
};
|
4657
|
-
|
4658
4691
|
// src/providers/utils/validate-pagination-args.ts
|
4659
4692
|
import { FuelError as FuelError18, ErrorCode as ErrorCode15 } from "@fuel-ts/errors";
|
4660
4693
|
var validatePaginationArgs = (params) => {
|
@@ -4930,7 +4963,7 @@ var _Provider = class {
|
|
4930
4963
|
utxoValidation: data.nodeInfo.utxoValidation,
|
4931
4964
|
vmBacktrace: data.nodeInfo.vmBacktrace
|
4932
4965
|
};
|
4933
|
-
_Provider.
|
4966
|
+
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
4934
4967
|
chain = processGqlChain(data.chain);
|
4935
4968
|
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
4936
4969
|
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
@@ -4944,15 +4977,15 @@ var _Provider = class {
|
|
4944
4977
|
/**
|
4945
4978
|
* @hidden
|
4946
4979
|
*/
|
4947
|
-
static
|
4980
|
+
static setIncompatibleNodeVersionMessage(nodeInfo) {
|
4948
4981
|
const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
|
4949
4982
|
if (!isMajorSupported || !isMinorSupported) {
|
4950
|
-
|
4951
|
-
`The Fuel Node that you are trying to connect to is using fuel-core version ${nodeInfo.nodeVersion}
|
4952
|
-
|
4953
|
-
Things may not work as expected
|
4954
|
-
|
4955
|
-
|
4983
|
+
_Provider.incompatibleNodeVersionMessage = [
|
4984
|
+
`The Fuel Node that you are trying to connect to is using fuel-core version ${nodeInfo.nodeVersion}.`,
|
4985
|
+
`The TS SDK currently supports fuel-core version ${supportedVersion}.`,
|
4986
|
+
`Things may not work as expected.`
|
4987
|
+
].join("\n");
|
4988
|
+
FuelGraphqlSubscriber.incompatibleNodeVersionMessage = _Provider.incompatibleNodeVersionMessage;
|
4956
4989
|
}
|
4957
4990
|
}
|
4958
4991
|
/**
|
@@ -4968,11 +5001,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4968
5001
|
responseMiddleware: (response) => {
|
4969
5002
|
if ("response" in response) {
|
4970
5003
|
const graphQlResponse = response.response;
|
4971
|
-
|
4972
|
-
|
4973
|
-
|
4974
|
-
|
4975
|
-
}
|
5004
|
+
assertGqlResponseHasNoErrors(
|
5005
|
+
graphQlResponse.errors,
|
5006
|
+
_Provider.incompatibleNodeVersionMessage
|
5007
|
+
);
|
4976
5008
|
}
|
4977
5009
|
}
|
4978
5010
|
});
|
@@ -5202,9 +5234,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5202
5234
|
* `addVariableOutputs` is called on the transaction.
|
5203
5235
|
*
|
5204
5236
|
* @param transactionRequest - The transaction request object.
|
5237
|
+
* @param gasPrice - The gas price to use for the transaction, if not provided it will be fetched.
|
5205
5238
|
* @returns A promise that resolves to the estimate transaction dependencies.
|
5206
5239
|
*/
|
5207
|
-
async estimateTxDependencies(transactionRequest) {
|
5240
|
+
async estimateTxDependencies(transactionRequest, { gasPrice: gasPriceParam } = {}) {
|
5208
5241
|
if (isTransactionTypeCreate(transactionRequest)) {
|
5209
5242
|
return {
|
5210
5243
|
receipts: [],
|
@@ -5217,13 +5250,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5217
5250
|
let outputVariables = 0;
|
5218
5251
|
let dryRunStatus;
|
5219
5252
|
await this.validateTransaction(transactionRequest);
|
5253
|
+
const gasPrice = gasPriceParam ?? await this.estimateGasPrice(10);
|
5220
5254
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
5221
5255
|
const {
|
5222
5256
|
dryRun: [{ receipts: rawReceipts, status }]
|
5223
5257
|
} = await this.operations.dryRun({
|
5224
5258
|
encodedTransactions: [hexlify17(transactionRequest.toTransactionBytes())],
|
5225
5259
|
utxoValidation: false,
|
5226
|
-
gasPrice:
|
5260
|
+
gasPrice: gasPrice.toString()
|
5227
5261
|
});
|
5228
5262
|
receipts = rawReceipts.map(processGqlReceipt);
|
5229
5263
|
dryRunStatus = status;
|
@@ -5233,12 +5267,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5233
5267
|
outputVariables += missingOutputVariables.length;
|
5234
5268
|
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
5235
5269
|
missingOutputContractIds.forEach(({ contractId }) => {
|
5236
|
-
transactionRequest.addContractInputAndOutput(Address3
|
5270
|
+
transactionRequest.addContractInputAndOutput(new Address3(contractId));
|
5237
5271
|
missingContractIds.push(contractId);
|
5238
5272
|
});
|
5239
5273
|
const { maxFee } = await this.estimateTxGasAndFee({
|
5240
5274
|
transactionRequest,
|
5241
|
-
gasPrice
|
5275
|
+
gasPrice
|
5242
5276
|
});
|
5243
5277
|
transactionRequest.maxFee = maxFee;
|
5244
5278
|
} else {
|
@@ -5302,7 +5336,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5302
5336
|
result.outputVariables += missingOutputVariables.length;
|
5303
5337
|
request.addVariableOutputs(missingOutputVariables.length);
|
5304
5338
|
missingOutputContractIds.forEach(({ contractId }) => {
|
5305
|
-
request.addContractInputAndOutput(Address3
|
5339
|
+
request.addContractInputAndOutput(new Address3(contractId));
|
5306
5340
|
result.missingContractIds.push(contractId);
|
5307
5341
|
});
|
5308
5342
|
const { maxFee } = await this.estimateTxGasAndFee({
|
@@ -5368,12 +5402,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5368
5402
|
}
|
5369
5403
|
/**
|
5370
5404
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
5371
|
-
* @param
|
5405
|
+
* @param params - The parameters for estimating the transaction gas and fee.
|
5372
5406
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
5373
5407
|
*/
|
5374
5408
|
async estimateTxGasAndFee(params) {
|
5375
|
-
const { transactionRequest } = params;
|
5376
|
-
let
|
5409
|
+
const { transactionRequest, gasPrice: gasPriceParam } = params;
|
5410
|
+
let gasPrice = gasPriceParam;
|
5377
5411
|
await this.autoRefetchConfigs();
|
5378
5412
|
const chainInfo = await this.getChain();
|
5379
5413
|
const { gasPriceFactor, maxGasPerTx } = await this.getGasConfig();
|
@@ -5454,7 +5488,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5454
5488
|
*
|
5455
5489
|
* @returns A promise that resolves to the transaction cost object.
|
5456
5490
|
*/
|
5457
|
-
async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
|
5491
|
+
async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
|
5458
5492
|
const txRequestClone = clone8(transactionRequestify(transactionRequestLike));
|
5459
5493
|
const updateMaxFee = txRequestClone.maxFee.eq(0);
|
5460
5494
|
const isScriptTransaction = isTransactionTypeScript(txRequestClone);
|
@@ -5470,8 +5504,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5470
5504
|
}
|
5471
5505
|
await this.estimatePredicates(signedRequest);
|
5472
5506
|
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
5473
|
-
|
5474
|
-
|
5507
|
+
const gasPrice = gasPriceParam ?? await this.estimateGasPrice(10);
|
5508
|
+
let { maxFee, maxGas, minFee, minGas, gasLimit } = await this.estimateTxGasAndFee({
|
5509
|
+
// Fetches and returns a gas price
|
5510
|
+
transactionRequest: signedRequest,
|
5511
|
+
gasPrice
|
5475
5512
|
});
|
5476
5513
|
let receipts = [];
|
5477
5514
|
let dryRunStatus;
|
@@ -5484,7 +5521,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5484
5521
|
if (signatureCallback) {
|
5485
5522
|
await signatureCallback(txRequestClone);
|
5486
5523
|
}
|
5487
|
-
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
|
5524
|
+
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone, { gasPrice }));
|
5488
5525
|
if (dryRunStatus && "reason" in dryRunStatus) {
|
5489
5526
|
throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
|
5490
5527
|
}
|
@@ -5492,7 +5529,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5492
5529
|
const pristineGasUsed = getGasUsedFromReceipts(receipts);
|
5493
5530
|
gasUsed = bn17(pristineGasUsed.muln(GAS_USED_MODIFIER)).max(maxGasPerTx.sub(minGas));
|
5494
5531
|
txRequestClone.gasLimit = gasUsed;
|
5495
|
-
({ maxFee, maxGas, minFee, minGas
|
5532
|
+
({ maxFee, maxGas, minFee, minGas } = await this.estimateTxGasAndFee({
|
5496
5533
|
transactionRequest: txRequestClone,
|
5497
5534
|
gasPrice
|
5498
5535
|
}));
|
@@ -5523,7 +5560,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5523
5560
|
* @returns A promise that resolves to the coins.
|
5524
5561
|
*/
|
5525
5562
|
async getCoins(owner, assetId, paginationArgs) {
|
5526
|
-
const ownerAddress = Address3
|
5563
|
+
const ownerAddress = new Address3(owner);
|
5527
5564
|
const {
|
5528
5565
|
coins: { edges, pageInfo }
|
5529
5566
|
} = await this.operations.getCoins({
|
@@ -5555,7 +5592,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5555
5592
|
* @returns A promise that resolves to the resources.
|
5556
5593
|
*/
|
5557
5594
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
5558
|
-
const ownerAddress = Address3
|
5595
|
+
const ownerAddress = new Address3(owner);
|
5559
5596
|
const excludeInput = {
|
5560
5597
|
messages: excludedIds?.messages?.map((nonce) => hexlify17(nonce)) || [],
|
5561
5598
|
utxos: excludedIds?.utxos?.map((id) => hexlify17(id)) || []
|
@@ -5582,8 +5619,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5582
5619
|
amount: bn17(coin.amount),
|
5583
5620
|
assetId: coin.assetId,
|
5584
5621
|
daHeight: bn17(coin.daHeight),
|
5585
|
-
sender: Address3
|
5586
|
-
recipient: Address3
|
5622
|
+
sender: new Address3(coin.sender),
|
5623
|
+
recipient: new Address3(coin.recipient),
|
5587
5624
|
nonce: coin.nonce
|
5588
5625
|
};
|
5589
5626
|
case "Coin":
|
@@ -5780,6 +5817,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5780
5817
|
}).filter((tx) => tx !== null);
|
5781
5818
|
return { transactions, pageInfo };
|
5782
5819
|
}
|
5820
|
+
/**
|
5821
|
+
* Fetches a compressed block at the specified height.
|
5822
|
+
*
|
5823
|
+
* @param height - The height of the block to fetch.
|
5824
|
+
* @returns The compressed block if available, otherwise `null`.
|
5825
|
+
*/
|
5826
|
+
async daCompressedBlock(height) {
|
5827
|
+
const { daCompressedBlock } = await this.operations.daCompressedBlock({
|
5828
|
+
height
|
5829
|
+
});
|
5830
|
+
if (!daCompressedBlock) {
|
5831
|
+
return null;
|
5832
|
+
}
|
5833
|
+
return daCompressedBlock;
|
5834
|
+
}
|
5783
5835
|
/**
|
5784
5836
|
* Get deployed contract with the given ID.
|
5785
5837
|
*
|
@@ -5802,7 +5854,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5802
5854
|
*/
|
5803
5855
|
async getContractBalance(contractId, assetId) {
|
5804
5856
|
const { contractBalance } = await this.operations.getContractBalance({
|
5805
|
-
contract: Address3
|
5857
|
+
contract: new Address3(contractId).toB256(),
|
5806
5858
|
asset: hexlify17(assetId)
|
5807
5859
|
});
|
5808
5860
|
return bn17(contractBalance.amount, 10);
|
@@ -5816,7 +5868,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5816
5868
|
*/
|
5817
5869
|
async getBalance(owner, assetId) {
|
5818
5870
|
const { balance } = await this.operations.getBalance({
|
5819
|
-
owner: Address3
|
5871
|
+
owner: new Address3(owner).toB256(),
|
5820
5872
|
assetId: hexlify17(assetId)
|
5821
5873
|
});
|
5822
5874
|
return bn17(balance.amount, 10);
|
@@ -5837,7 +5889,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5837
5889
|
* but the current Fuel-Core implementation does not support pagination yet.
|
5838
5890
|
*/
|
5839
5891
|
first: 1e4,
|
5840
|
-
filter: { owner: Address3
|
5892
|
+
filter: { owner: new Address3(owner).toB256() }
|
5841
5893
|
});
|
5842
5894
|
const balances = edges.map(({ node }) => ({
|
5843
5895
|
assetId: node.assetId,
|
@@ -5860,7 +5912,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5860
5912
|
inputArgs: paginationArgs,
|
5861
5913
|
paginationLimit: RESOURCES_PAGE_SIZE_LIMIT
|
5862
5914
|
}),
|
5863
|
-
owner: Address3
|
5915
|
+
owner: new Address3(address).toB256()
|
5864
5916
|
});
|
5865
5917
|
const messages = edges.map(({ node }) => ({
|
5866
5918
|
messageId: InputMessageCoder2.getMessageId({
|
@@ -5870,8 +5922,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5870
5922
|
amount: bn17(node.amount),
|
5871
5923
|
data: node.data
|
5872
5924
|
}),
|
5873
|
-
sender: Address3
|
5874
|
-
recipient: Address3
|
5925
|
+
sender: new Address3(node.sender),
|
5926
|
+
recipient: new Address3(node.recipient),
|
5875
5927
|
nonce: node.nonce,
|
5876
5928
|
amount: bn17(node.amount),
|
5877
5929
|
data: InputMessageCoder2.decodeData(node.data),
|
@@ -5969,8 +6021,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5969
6021
|
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
5970
6022
|
stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
|
5971
6023
|
},
|
5972
|
-
sender: Address3
|
5973
|
-
recipient: Address3
|
6024
|
+
sender: new Address3(sender),
|
6025
|
+
recipient: new Address3(recipient),
|
5974
6026
|
nonce,
|
5975
6027
|
amount: bn17(amount),
|
5976
6028
|
data
|
@@ -6084,8 +6136,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
6084
6136
|
amount: bn17(rawMessage.amount),
|
6085
6137
|
data: rawMessage.data
|
6086
6138
|
}),
|
6087
|
-
sender: Address3
|
6088
|
-
recipient: Address3
|
6139
|
+
sender: new Address3(rawMessage.sender),
|
6140
|
+
recipient: new Address3(rawMessage.recipient),
|
6089
6141
|
nonce,
|
6090
6142
|
amount: bn17(rawMessage.amount),
|
6091
6143
|
data: InputMessageCoder2.decodeData(rawMessage.data),
|
@@ -6151,6 +6203,8 @@ cacheInputs_fn = function(inputs, transactionId) {
|
|
6151
6203
|
__publicField(Provider, "chainInfoCache", {});
|
6152
6204
|
/** @hidden */
|
6153
6205
|
__publicField(Provider, "nodeInfoCache", {});
|
6206
|
+
/** @hidden */
|
6207
|
+
__publicField(Provider, "incompatibleNodeVersionMessage", "");
|
6154
6208
|
|
6155
6209
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
6156
6210
|
import { ErrorCode as ErrorCode17, FuelError as FuelError20 } from "@fuel-ts/errors";
|
@@ -6158,610 +6212,6 @@ import { bn as bn18 } from "@fuel-ts/math";
|
|
6158
6212
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
6159
6213
|
import { arrayify as arrayify14 } from "@fuel-ts/utils";
|
6160
6214
|
|
6161
|
-
// src/providers/chains.ts
|
6162
|
-
var CHAIN_IDS = {
|
6163
|
-
eth: {
|
6164
|
-
mainnet: 1,
|
6165
|
-
sepolia: 11155111,
|
6166
|
-
foundry: 31337
|
6167
|
-
},
|
6168
|
-
fuel: {
|
6169
|
-
devnet: 0,
|
6170
|
-
testnet: 0,
|
6171
|
-
mainnet: 9889
|
6172
|
-
}
|
6173
|
-
};
|
6174
|
-
|
6175
|
-
// src/providers/assets/utils/url.ts
|
6176
|
-
var DELIMITER_PATH = "/";
|
6177
|
-
var trimRegex = /^\/|\/$/g;
|
6178
|
-
var trimPath = (path2 = "") => path2.replace(trimRegex, "");
|
6179
|
-
function urlJoin(baseUrl, ...paths) {
|
6180
|
-
const hasBaseUrl = baseUrl !== null && baseUrl !== void 0;
|
6181
|
-
const rootPath = baseUrl?.[0] === "/" && baseUrl.length > 1;
|
6182
|
-
const allPaths = [baseUrl, ...paths].filter(Boolean).map(trimPath);
|
6183
|
-
if (rootPath && hasBaseUrl) {
|
6184
|
-
allPaths.unshift("");
|
6185
|
-
}
|
6186
|
-
return allPaths.join(DELIMITER_PATH);
|
6187
|
-
}
|
6188
|
-
|
6189
|
-
// src/providers/assets/utils/resolveIconPaths.ts
|
6190
|
-
function resolveIconPaths(assets2, basePath = "./") {
|
6191
|
-
return assets2.map((asset) => ({
|
6192
|
-
...asset,
|
6193
|
-
icon: urlJoin(basePath, asset.icon)
|
6194
|
-
}));
|
6195
|
-
}
|
6196
|
-
|
6197
|
-
// src/providers/assets/utils/fuelAssetsBaseUrl.ts
|
6198
|
-
var fuelAssetsBaseUrl = "https://cdn.fuel.network/assets/";
|
6199
|
-
|
6200
|
-
// src/providers/assets/assets.ts
|
6201
|
-
var rawAssets = [
|
6202
|
-
{
|
6203
|
-
name: "Ethereum",
|
6204
|
-
symbol: "ETH",
|
6205
|
-
icon: "eth.svg",
|
6206
|
-
networks: [
|
6207
|
-
{
|
6208
|
-
type: "ethereum",
|
6209
|
-
chainId: CHAIN_IDS.eth.sepolia,
|
6210
|
-
decimals: 18
|
6211
|
-
},
|
6212
|
-
{
|
6213
|
-
type: "ethereum",
|
6214
|
-
chainId: CHAIN_IDS.eth.foundry,
|
6215
|
-
decimals: 18
|
6216
|
-
},
|
6217
|
-
{
|
6218
|
-
type: "ethereum",
|
6219
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6220
|
-
decimals: 18
|
6221
|
-
},
|
6222
|
-
{
|
6223
|
-
type: "fuel",
|
6224
|
-
chainId: CHAIN_IDS.fuel.devnet,
|
6225
|
-
decimals: 9,
|
6226
|
-
assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
|
6227
|
-
},
|
6228
|
-
{
|
6229
|
-
type: "fuel",
|
6230
|
-
chainId: CHAIN_IDS.fuel.testnet,
|
6231
|
-
decimals: 9,
|
6232
|
-
assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
|
6233
|
-
},
|
6234
|
-
{
|
6235
|
-
type: "fuel",
|
6236
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6237
|
-
decimals: 9,
|
6238
|
-
assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
|
6239
|
-
}
|
6240
|
-
]
|
6241
|
-
},
|
6242
|
-
{
|
6243
|
-
name: "WETH",
|
6244
|
-
symbol: "WETH",
|
6245
|
-
icon: "weth.svg",
|
6246
|
-
networks: [
|
6247
|
-
{
|
6248
|
-
type: "ethereum",
|
6249
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6250
|
-
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
6251
|
-
decimals: 18
|
6252
|
-
},
|
6253
|
-
{
|
6254
|
-
type: "fuel",
|
6255
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6256
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6257
|
-
assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
|
6258
|
-
decimals: 9
|
6259
|
-
}
|
6260
|
-
]
|
6261
|
-
},
|
6262
|
-
{
|
6263
|
-
name: "weETH",
|
6264
|
-
symbol: "weETH",
|
6265
|
-
icon: "weETH.webp",
|
6266
|
-
networks: [
|
6267
|
-
{
|
6268
|
-
type: "ethereum",
|
6269
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6270
|
-
address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
|
6271
|
-
decimals: 18
|
6272
|
-
},
|
6273
|
-
{
|
6274
|
-
type: "fuel",
|
6275
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6276
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6277
|
-
assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
|
6278
|
-
decimals: 9
|
6279
|
-
}
|
6280
|
-
]
|
6281
|
-
},
|
6282
|
-
{
|
6283
|
-
name: "rsETH",
|
6284
|
-
symbol: "rsETH",
|
6285
|
-
icon: "rsETH.webp",
|
6286
|
-
networks: [
|
6287
|
-
{
|
6288
|
-
type: "ethereum",
|
6289
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6290
|
-
address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
|
6291
|
-
decimals: 18
|
6292
|
-
},
|
6293
|
-
{
|
6294
|
-
type: "fuel",
|
6295
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6296
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6297
|
-
assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
|
6298
|
-
decimals: 9
|
6299
|
-
}
|
6300
|
-
]
|
6301
|
-
},
|
6302
|
-
{
|
6303
|
-
name: "rETH",
|
6304
|
-
symbol: "rETH",
|
6305
|
-
icon: "reth.svg",
|
6306
|
-
networks: [
|
6307
|
-
{
|
6308
|
-
type: "ethereum",
|
6309
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6310
|
-
address: "0xae78736cd615f374d3085123a210448e74fc6393",
|
6311
|
-
decimals: 18
|
6312
|
-
},
|
6313
|
-
{
|
6314
|
-
type: "fuel",
|
6315
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6316
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6317
|
-
assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
|
6318
|
-
decimals: 9
|
6319
|
-
}
|
6320
|
-
]
|
6321
|
-
},
|
6322
|
-
{
|
6323
|
-
name: "wbETH",
|
6324
|
-
symbol: "wbETH",
|
6325
|
-
icon: "wbeth.png",
|
6326
|
-
networks: [
|
6327
|
-
{
|
6328
|
-
type: "ethereum",
|
6329
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6330
|
-
address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
|
6331
|
-
decimals: 18
|
6332
|
-
},
|
6333
|
-
{
|
6334
|
-
type: "fuel",
|
6335
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6336
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6337
|
-
assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
|
6338
|
-
decimals: 9
|
6339
|
-
}
|
6340
|
-
]
|
6341
|
-
},
|
6342
|
-
{
|
6343
|
-
name: "rstETH",
|
6344
|
-
symbol: "rstETH",
|
6345
|
-
icon: "rstETH.webp",
|
6346
|
-
networks: [
|
6347
|
-
{
|
6348
|
-
type: "ethereum",
|
6349
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6350
|
-
address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
6351
|
-
decimals: 18
|
6352
|
-
},
|
6353
|
-
{
|
6354
|
-
type: "fuel",
|
6355
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6356
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6357
|
-
assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
|
6358
|
-
decimals: 9
|
6359
|
-
}
|
6360
|
-
]
|
6361
|
-
},
|
6362
|
-
{
|
6363
|
-
name: "amphrETH",
|
6364
|
-
symbol: "amphrETH",
|
6365
|
-
icon: "amphrETH.png",
|
6366
|
-
networks: [
|
6367
|
-
{
|
6368
|
-
type: "ethereum",
|
6369
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6370
|
-
address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
|
6371
|
-
decimals: 18
|
6372
|
-
},
|
6373
|
-
{
|
6374
|
-
type: "fuel",
|
6375
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6376
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6377
|
-
assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
|
6378
|
-
decimals: 9
|
6379
|
-
}
|
6380
|
-
]
|
6381
|
-
},
|
6382
|
-
{
|
6383
|
-
name: "Manta mBTC",
|
6384
|
-
symbol: "Manta mBTC",
|
6385
|
-
icon: "manta-mbtc.svg",
|
6386
|
-
networks: [
|
6387
|
-
{
|
6388
|
-
type: "ethereum",
|
6389
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6390
|
-
address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
|
6391
|
-
decimals: 18
|
6392
|
-
},
|
6393
|
-
{
|
6394
|
-
type: "fuel",
|
6395
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6396
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6397
|
-
assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
|
6398
|
-
decimals: 9
|
6399
|
-
}
|
6400
|
-
]
|
6401
|
-
},
|
6402
|
-
{
|
6403
|
-
name: "Manta mETH",
|
6404
|
-
symbol: "Manta mETH",
|
6405
|
-
icon: "manta-meth.svg",
|
6406
|
-
networks: [
|
6407
|
-
{
|
6408
|
-
type: "ethereum",
|
6409
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6410
|
-
address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
|
6411
|
-
decimals: 18
|
6412
|
-
},
|
6413
|
-
{
|
6414
|
-
type: "fuel",
|
6415
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6416
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6417
|
-
assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
|
6418
|
-
decimals: 9
|
6419
|
-
}
|
6420
|
-
]
|
6421
|
-
},
|
6422
|
-
{
|
6423
|
-
name: "Manta mUSD",
|
6424
|
-
symbol: "Manta mUSD",
|
6425
|
-
icon: "manta-musd.svg",
|
6426
|
-
networks: [
|
6427
|
-
{
|
6428
|
-
type: "ethereum",
|
6429
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6430
|
-
address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
|
6431
|
-
decimals: 18
|
6432
|
-
},
|
6433
|
-
{
|
6434
|
-
type: "fuel",
|
6435
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6436
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6437
|
-
assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
|
6438
|
-
decimals: 9
|
6439
|
-
}
|
6440
|
-
]
|
6441
|
-
},
|
6442
|
-
{
|
6443
|
-
name: "pumpBTC",
|
6444
|
-
symbol: "pumpBTC",
|
6445
|
-
icon: "pumpbtc.webp",
|
6446
|
-
networks: [
|
6447
|
-
{
|
6448
|
-
type: "ethereum",
|
6449
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6450
|
-
address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
|
6451
|
-
decimals: 8
|
6452
|
-
},
|
6453
|
-
{
|
6454
|
-
type: "fuel",
|
6455
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6456
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6457
|
-
assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
|
6458
|
-
decimals: 8
|
6459
|
-
}
|
6460
|
-
]
|
6461
|
-
},
|
6462
|
-
{
|
6463
|
-
name: "FBTC",
|
6464
|
-
symbol: "FBTC",
|
6465
|
-
icon: "fbtc.svg",
|
6466
|
-
networks: [
|
6467
|
-
{
|
6468
|
-
type: "ethereum",
|
6469
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6470
|
-
address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
|
6471
|
-
decimals: 8
|
6472
|
-
},
|
6473
|
-
{
|
6474
|
-
type: "fuel",
|
6475
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6476
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6477
|
-
assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
|
6478
|
-
decimals: 8
|
6479
|
-
}
|
6480
|
-
]
|
6481
|
-
},
|
6482
|
-
{
|
6483
|
-
name: "SolvBTC",
|
6484
|
-
symbol: "SolvBTC",
|
6485
|
-
icon: "solvBTC.webp",
|
6486
|
-
networks: [
|
6487
|
-
{
|
6488
|
-
type: "ethereum",
|
6489
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6490
|
-
address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
|
6491
|
-
decimals: 18
|
6492
|
-
},
|
6493
|
-
{
|
6494
|
-
type: "fuel",
|
6495
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6496
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6497
|
-
assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
|
6498
|
-
decimals: 9
|
6499
|
-
}
|
6500
|
-
]
|
6501
|
-
},
|
6502
|
-
{
|
6503
|
-
name: "SolvBTC.BBN",
|
6504
|
-
symbol: "SolvBTC.BBN",
|
6505
|
-
icon: "SolvBTC.BBN.png",
|
6506
|
-
networks: [
|
6507
|
-
{
|
6508
|
-
type: "ethereum",
|
6509
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6510
|
-
address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
|
6511
|
-
decimals: 18
|
6512
|
-
},
|
6513
|
-
{
|
6514
|
-
type: "fuel",
|
6515
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6516
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6517
|
-
assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
|
6518
|
-
decimals: 9
|
6519
|
-
}
|
6520
|
-
]
|
6521
|
-
},
|
6522
|
-
{
|
6523
|
-
name: "Mantle mETH",
|
6524
|
-
symbol: "Mantle mETH",
|
6525
|
-
icon: "mantle-meth.svg",
|
6526
|
-
networks: [
|
6527
|
-
{
|
6528
|
-
type: "ethereum",
|
6529
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6530
|
-
address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
|
6531
|
-
decimals: 18
|
6532
|
-
},
|
6533
|
-
{
|
6534
|
-
type: "fuel",
|
6535
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6536
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6537
|
-
assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
|
6538
|
-
decimals: 9
|
6539
|
-
}
|
6540
|
-
]
|
6541
|
-
},
|
6542
|
-
{
|
6543
|
-
name: "sDAI",
|
6544
|
-
symbol: "sDAI",
|
6545
|
-
icon: "sdai.svg",
|
6546
|
-
networks: [
|
6547
|
-
{
|
6548
|
-
type: "ethereum",
|
6549
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6550
|
-
address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
|
6551
|
-
decimals: 18
|
6552
|
-
},
|
6553
|
-
{
|
6554
|
-
type: "fuel",
|
6555
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6556
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6557
|
-
assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
|
6558
|
-
decimals: 9
|
6559
|
-
}
|
6560
|
-
]
|
6561
|
-
},
|
6562
|
-
{
|
6563
|
-
name: "USDT",
|
6564
|
-
symbol: "USDT",
|
6565
|
-
icon: "usdt.svg",
|
6566
|
-
networks: [
|
6567
|
-
{
|
6568
|
-
type: "ethereum",
|
6569
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6570
|
-
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
6571
|
-
decimals: 6
|
6572
|
-
},
|
6573
|
-
{
|
6574
|
-
type: "fuel",
|
6575
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6576
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6577
|
-
assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
|
6578
|
-
decimals: 6
|
6579
|
-
}
|
6580
|
-
]
|
6581
|
-
},
|
6582
|
-
{
|
6583
|
-
name: "USDC",
|
6584
|
-
symbol: "USDC",
|
6585
|
-
icon: "usdc.svg",
|
6586
|
-
networks: [
|
6587
|
-
{
|
6588
|
-
type: "ethereum",
|
6589
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6590
|
-
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
6591
|
-
decimals: 6
|
6592
|
-
},
|
6593
|
-
{
|
6594
|
-
type: "fuel",
|
6595
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6596
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6597
|
-
assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
|
6598
|
-
decimals: 6
|
6599
|
-
}
|
6600
|
-
]
|
6601
|
-
},
|
6602
|
-
{
|
6603
|
-
name: "USDe",
|
6604
|
-
symbol: "USDe",
|
6605
|
-
icon: "USDe.svg",
|
6606
|
-
networks: [
|
6607
|
-
{
|
6608
|
-
type: "ethereum",
|
6609
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6610
|
-
address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
|
6611
|
-
decimals: 18
|
6612
|
-
},
|
6613
|
-
{
|
6614
|
-
type: "fuel",
|
6615
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6616
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6617
|
-
assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
|
6618
|
-
decimals: 9
|
6619
|
-
}
|
6620
|
-
]
|
6621
|
-
},
|
6622
|
-
{
|
6623
|
-
name: "sUSDe",
|
6624
|
-
symbol: "sUSDe",
|
6625
|
-
icon: "sUSDe.webp",
|
6626
|
-
networks: [
|
6627
|
-
{
|
6628
|
-
type: "ethereum",
|
6629
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6630
|
-
address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
|
6631
|
-
decimals: 18
|
6632
|
-
},
|
6633
|
-
{
|
6634
|
-
type: "fuel",
|
6635
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6636
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6637
|
-
assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
|
6638
|
-
decimals: 9
|
6639
|
-
}
|
6640
|
-
]
|
6641
|
-
},
|
6642
|
-
{
|
6643
|
-
name: "rsUSDe",
|
6644
|
-
symbol: "rsUSDe",
|
6645
|
-
icon: "rsUSDe.svg",
|
6646
|
-
networks: [
|
6647
|
-
{
|
6648
|
-
type: "ethereum",
|
6649
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6650
|
-
address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
|
6651
|
-
decimals: 18
|
6652
|
-
},
|
6653
|
-
{
|
6654
|
-
type: "fuel",
|
6655
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6656
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6657
|
-
assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
|
6658
|
-
decimals: 9
|
6659
|
-
}
|
6660
|
-
]
|
6661
|
-
},
|
6662
|
-
{
|
6663
|
-
name: "wstETH",
|
6664
|
-
symbol: "wstETH",
|
6665
|
-
icon: "wsteth.svg",
|
6666
|
-
networks: [
|
6667
|
-
{
|
6668
|
-
type: "ethereum",
|
6669
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6670
|
-
address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
|
6671
|
-
decimals: 18
|
6672
|
-
},
|
6673
|
-
{
|
6674
|
-
type: "fuel",
|
6675
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6676
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6677
|
-
assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
|
6678
|
-
decimals: 9
|
6679
|
-
}
|
6680
|
-
]
|
6681
|
-
},
|
6682
|
-
{
|
6683
|
-
name: "ezETH",
|
6684
|
-
symbol: "ezETH",
|
6685
|
-
icon: "ezeth.webp",
|
6686
|
-
networks: [
|
6687
|
-
{
|
6688
|
-
type: "ethereum",
|
6689
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6690
|
-
address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
|
6691
|
-
decimals: 18
|
6692
|
-
},
|
6693
|
-
{
|
6694
|
-
type: "fuel",
|
6695
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6696
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6697
|
-
assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
|
6698
|
-
decimals: 9
|
6699
|
-
}
|
6700
|
-
]
|
6701
|
-
},
|
6702
|
-
{
|
6703
|
-
name: "pzETH",
|
6704
|
-
symbol: "pzETH",
|
6705
|
-
icon: "pzETH.webp",
|
6706
|
-
networks: [
|
6707
|
-
{
|
6708
|
-
type: "ethereum",
|
6709
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6710
|
-
address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
|
6711
|
-
decimals: 18
|
6712
|
-
},
|
6713
|
-
{
|
6714
|
-
type: "fuel",
|
6715
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6716
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6717
|
-
assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
|
6718
|
-
decimals: 9
|
6719
|
-
}
|
6720
|
-
]
|
6721
|
-
},
|
6722
|
-
{
|
6723
|
-
name: "Re7LRT",
|
6724
|
-
symbol: "Re7LRT",
|
6725
|
-
icon: "Re7LRT.png",
|
6726
|
-
networks: [
|
6727
|
-
{
|
6728
|
-
type: "ethereum",
|
6729
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6730
|
-
address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
|
6731
|
-
decimals: 18
|
6732
|
-
},
|
6733
|
-
{
|
6734
|
-
type: "fuel",
|
6735
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6736
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6737
|
-
assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
|
6738
|
-
decimals: 9
|
6739
|
-
}
|
6740
|
-
]
|
6741
|
-
},
|
6742
|
-
{
|
6743
|
-
name: "steakLRT",
|
6744
|
-
symbol: "steakLRT",
|
6745
|
-
icon: "steakLRT.png",
|
6746
|
-
networks: [
|
6747
|
-
{
|
6748
|
-
type: "ethereum",
|
6749
|
-
chainId: CHAIN_IDS.eth.mainnet,
|
6750
|
-
address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
|
6751
|
-
decimals: 18
|
6752
|
-
},
|
6753
|
-
{
|
6754
|
-
type: "fuel",
|
6755
|
-
chainId: CHAIN_IDS.fuel.mainnet,
|
6756
|
-
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
6757
|
-
assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
|
6758
|
-
decimals: 9
|
6759
|
-
}
|
6760
|
-
]
|
6761
|
-
}
|
6762
|
-
];
|
6763
|
-
var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
|
6764
|
-
|
6765
6215
|
// src/test-utils/test-asset-id.ts
|
6766
6216
|
import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
|
6767
6217
|
import { hexlify as hexlify18 } from "@fuel-ts/utils";
|
@@ -6788,6 +6238,7 @@ __publicField(TestAssetId, "B", new _TestAssetId(
|
|
6788
6238
|
// src/test-utils/wallet-config.ts
|
6789
6239
|
import { randomBytes as randomBytes8 } from "@fuel-ts/crypto";
|
6790
6240
|
import { FuelError as FuelError26 } from "@fuel-ts/errors";
|
6241
|
+
import { bn as bn21 } from "@fuel-ts/math";
|
6791
6242
|
import { defaultSnapshotConfigs as defaultSnapshotConfigs2, hexlify as hexlify24 } from "@fuel-ts/utils";
|
6792
6243
|
|
6793
6244
|
// src/wallet/base-wallet-unlocked.ts
|
@@ -6832,11 +6283,7 @@ var formatTransferToContractScriptData = (transferParams) => {
|
|
6832
6283
|
return transferParams.reduce((acc, transferParam) => {
|
6833
6284
|
const { assetId, amount, contractId } = transferParam;
|
6834
6285
|
const encoded = numberCoder.encode(amount);
|
6835
|
-
const scriptData = concat4([
|
6836
|
-
Address4.fromAddressOrString(contractId).toBytes(),
|
6837
|
-
encoded,
|
6838
|
-
arrayify15(assetId)
|
6839
|
-
]);
|
6286
|
+
const scriptData = concat4([new Address4(contractId).toBytes(), encoded, arrayify15(assetId)]);
|
6840
6287
|
return concat4([acc, scriptData]);
|
6841
6288
|
}, new Uint8Array());
|
6842
6289
|
};
|
@@ -6892,7 +6339,7 @@ var Account = class extends AbstractAccount {
|
|
6892
6339
|
super();
|
6893
6340
|
this._provider = provider;
|
6894
6341
|
this._connector = connector;
|
6895
|
-
this.address = Address5
|
6342
|
+
this.address = new Address5(address);
|
6896
6343
|
}
|
6897
6344
|
/**
|
6898
6345
|
* The provider used to interact with the network.
|
@@ -7130,7 +6577,7 @@ var Account = class extends AbstractAccount {
|
|
7130
6577
|
addTransfer(request, transferParams) {
|
7131
6578
|
const { destination, amount, assetId } = transferParams;
|
7132
6579
|
this.validateTransferAmount(amount);
|
7133
|
-
request.addCoinOutput(Address5
|
6580
|
+
request.addCoinOutput(new Address5(destination), amount, assetId);
|
7134
6581
|
return request;
|
7135
6582
|
}
|
7136
6583
|
/**
|
@@ -7170,7 +6617,7 @@ var Account = class extends AbstractAccount {
|
|
7170
6617
|
const defaultAssetId = await this.provider.getBaseAssetId();
|
7171
6618
|
const transferParams = contractTransferParams.map((transferParam) => {
|
7172
6619
|
const amount = bn19(transferParam.amount);
|
7173
|
-
const contractAddress = Address5
|
6620
|
+
const contractAddress = new Address5(transferParam.contractId);
|
7174
6621
|
const assetId = transferParam.assetId ? hexlify19(transferParam.assetId) : defaultAssetId;
|
7175
6622
|
if (amount.lte(0)) {
|
7176
6623
|
throw new FuelError21(
|
@@ -7201,7 +6648,7 @@ var Account = class extends AbstractAccount {
|
|
7201
6648
|
* @returns A promise that resolves to the transaction response.
|
7202
6649
|
*/
|
7203
6650
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
7204
|
-
const recipientAddress = Address5
|
6651
|
+
const recipientAddress = new Address5(recipient);
|
7205
6652
|
const recipientDataArray = arrayify16(
|
7206
6653
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
7207
6654
|
);
|
@@ -7237,7 +6684,7 @@ var Account = class extends AbstractAccount {
|
|
7237
6684
|
*
|
7238
6685
|
* @returns A promise that resolves to the transaction cost object.
|
7239
6686
|
*/
|
7240
|
-
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
|
6687
|
+
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
|
7241
6688
|
const txRequestClone = clone9(transactionRequestify(transactionRequestLike));
|
7242
6689
|
const baseAssetId = await this.provider.getBaseAssetId();
|
7243
6690
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
@@ -7272,7 +6719,8 @@ var Account = class extends AbstractAccount {
|
|
7272
6719
|
({ amount, assetId }) => updateAssetInput(assetId, amount)
|
7273
6720
|
);
|
7274
6721
|
const txCost = await this.provider.getTransactionCost(txRequestClone, {
|
7275
|
-
signatureCallback
|
6722
|
+
signatureCallback,
|
6723
|
+
gasPrice
|
7276
6724
|
});
|
7277
6725
|
return {
|
7278
6726
|
...txCost,
|
@@ -7438,7 +6886,7 @@ var removeHexPrefix = (hexString) => {
|
|
7438
6886
|
};
|
7439
6887
|
async function encryptKeystoreWallet(privateKey, address, password) {
|
7440
6888
|
const privateKeyBuffer = bufferFromString(removeHexPrefix(privateKey), "hex");
|
7441
|
-
const ownerAddress = Address6
|
6889
|
+
const ownerAddress = new Address6(address);
|
7442
6890
|
const salt = randomBytes6(DEFAULT_KEY_SIZE);
|
7443
6891
|
const key = scrypt({
|
7444
6892
|
password: bufferFromString(password),
|
@@ -10349,14 +9797,14 @@ var WalletsConfig = class {
|
|
10349
9797
|
constructor(baseAssetId, config) {
|
10350
9798
|
WalletsConfig.validate(config);
|
10351
9799
|
this.options = config;
|
10352
|
-
const { assets
|
9800
|
+
const { assets, coinsPerAsset, amountPerCoin, messages } = this.options;
|
10353
9801
|
this.wallets = this.generateWallets();
|
10354
9802
|
this.initialState = {
|
10355
9803
|
messages: WalletsConfig.createMessages(this.wallets, messages),
|
10356
9804
|
coins: WalletsConfig.createCoins(
|
10357
9805
|
this.wallets,
|
10358
9806
|
baseAssetId,
|
10359
|
-
|
9807
|
+
assets,
|
10360
9808
|
coinsPerAsset,
|
10361
9809
|
amountPerCoin
|
10362
9810
|
)
|
@@ -10381,19 +9829,19 @@ var WalletsConfig = class {
|
|
10381
9829
|
/**
|
10382
9830
|
* Create coins for the wallets in the format that the chain expects.
|
10383
9831
|
*/
|
10384
|
-
static createCoins(wallets, baseAssetId,
|
9832
|
+
static createCoins(wallets, baseAssetId, assets, coinsPerAsset, amountPerCoin) {
|
10385
9833
|
const coins = [];
|
10386
9834
|
let assetIds = [baseAssetId];
|
10387
|
-
if (Array.isArray(
|
10388
|
-
assetIds = assetIds.concat(
|
9835
|
+
if (Array.isArray(assets)) {
|
9836
|
+
assetIds = assetIds.concat(assets.map((a) => a.value));
|
10389
9837
|
} else {
|
10390
|
-
assetIds = assetIds.concat(TestAssetId.random(
|
9838
|
+
assetIds = assetIds.concat(TestAssetId.random(assets - 1).map((a) => a.value));
|
10391
9839
|
}
|
10392
9840
|
wallets.map((wallet) => wallet.address.toHexString()).forEach((walletAddress) => {
|
10393
9841
|
assetIds.forEach((assetId) => {
|
10394
9842
|
for (let index = 0; index < coinsPerAsset; index++) {
|
10395
9843
|
coins.push({
|
10396
|
-
amount: amountPerCoin,
|
9844
|
+
amount: bn21(amountPerCoin).toString(),
|
10397
9845
|
asset_id: assetId,
|
10398
9846
|
owner: walletAddress,
|
10399
9847
|
tx_pointer_block_height: 0,
|
@@ -10408,7 +9856,7 @@ var WalletsConfig = class {
|
|
10408
9856
|
}
|
10409
9857
|
static validate({
|
10410
9858
|
count: wallets,
|
10411
|
-
assets
|
9859
|
+
assets,
|
10412
9860
|
coinsPerAsset,
|
10413
9861
|
amountPerCoin
|
10414
9862
|
}) {
|
@@ -10418,7 +9866,7 @@ var WalletsConfig = class {
|
|
10418
9866
|
"Number of wallets must be greater than zero."
|
10419
9867
|
);
|
10420
9868
|
}
|
10421
|
-
if (Array.isArray(
|
9869
|
+
if (Array.isArray(assets) && assets.length === 0 || typeof assets === "number" && assets <= 0) {
|
10422
9870
|
throw new FuelError26(
|
10423
9871
|
FuelError26.CODES.INVALID_INPUT_PARAMETERS,
|
10424
9872
|
"Number of assets per wallet must be greater than zero."
|
@@ -10430,7 +9878,7 @@ var WalletsConfig = class {
|
|
10430
9878
|
"Number of coins per asset must be greater than zero."
|
10431
9879
|
);
|
10432
9880
|
}
|
10433
|
-
if (amountPerCoin
|
9881
|
+
if (bn21(amountPerCoin).lt(0)) {
|
10434
9882
|
throw new FuelError26(
|
10435
9883
|
FuelError26.CODES.INVALID_INPUT_PARAMETERS,
|
10436
9884
|
"Amount per coin must be greater than or equal to zero."
|
@@ -10506,7 +9954,7 @@ async function setupTestProviderAndWallets({
|
|
10506
9954
|
// src/test-utils/test-message.ts
|
10507
9955
|
import { Address as Address7 } from "@fuel-ts/address";
|
10508
9956
|
import { randomBytes as randomBytes9 } from "@fuel-ts/crypto";
|
10509
|
-
import { bn as
|
9957
|
+
import { bn as bn22 } from "@fuel-ts/math";
|
10510
9958
|
import { hexlify as hexlify25 } from "@fuel-ts/utils";
|
10511
9959
|
var TestMessage = class {
|
10512
9960
|
sender;
|
@@ -10543,7 +9991,7 @@ var TestMessage = class {
|
|
10543
9991
|
sender: this.sender.toB256(),
|
10544
9992
|
recipient: recipient?.toB256() ?? this.recipient.toB256(),
|
10545
9993
|
nonce: this.nonce,
|
10546
|
-
amount:
|
9994
|
+
amount: bn22(this.amount).toNumber(),
|
10547
9995
|
data,
|
10548
9996
|
da_height: this.da_height
|
10549
9997
|
};
|