@fuel-ts/account 0.0.0-rc-2333-20240521114009 → 0.0.0-rc-1356-20240521154745
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +7 -9
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +115 -125
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -10
- package/dist/index.mjs.map +1 -1
- package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +0 -1
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils/asset-id.d.ts +8 -0
- package/dist/test-utils/asset-id.d.ts.map +1 -0
- package/dist/test-utils/index.d.ts +4 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +8 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts +33 -0
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
- package/dist/test-utils/test-message.d.ts +29 -0
- package/dist/test-utils/test-message.d.ts.map +1 -0
- package/dist/test-utils/wallet-config.d.ts +55 -0
- package/dist/test-utils/wallet-config.d.ts.map +1 -0
- package/dist/test-utils.global.js +395 -67
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +404 -167
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +298 -65
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -15
- package/dist/providers/utils/sleep.d.ts +0 -3
- package/dist/providers/utils/sleep.d.ts.map +0 -1
package/dist/test-utils.js
CHANGED
@@ -48,24 +48,28 @@ var __privateMethod = (obj, member, method) => {
|
|
48
48
|
// src/test-utils/index.ts
|
49
49
|
var test_utils_exports = {};
|
50
50
|
__export(test_utils_exports, {
|
51
|
+
AssetId: () => AssetId,
|
52
|
+
TestMessage: () => TestMessage,
|
53
|
+
WalletConfig: () => WalletConfig,
|
51
54
|
generateTestWallet: () => generateTestWallet,
|
52
55
|
killNode: () => killNode,
|
53
56
|
launchNode: () => launchNode,
|
54
57
|
launchNodeAndGetWallets: () => launchNodeAndGetWallets,
|
55
|
-
seedTestWallet: () => seedTestWallet
|
58
|
+
seedTestWallet: () => seedTestWallet,
|
59
|
+
setupTestProviderAndWallets: () => setupTestProviderAndWallets
|
56
60
|
});
|
57
61
|
module.exports = __toCommonJS(test_utils_exports);
|
58
62
|
|
59
63
|
// src/wallet/base-wallet-unlocked.ts
|
60
64
|
var import_hasher3 = require("@fuel-ts/hasher");
|
61
|
-
var
|
65
|
+
var import_utils32 = require("@fuel-ts/utils");
|
62
66
|
|
63
67
|
// src/account.ts
|
64
68
|
var import_address4 = require("@fuel-ts/address");
|
65
69
|
var import_errors16 = require("@fuel-ts/errors");
|
66
70
|
var import_interfaces = require("@fuel-ts/interfaces");
|
67
71
|
var import_math20 = require("@fuel-ts/math");
|
68
|
-
var
|
72
|
+
var import_utils29 = require("@fuel-ts/utils");
|
69
73
|
var import_ramda4 = require("ramda");
|
70
74
|
|
71
75
|
// src/providers/coin-quantity.ts
|
@@ -108,9 +112,9 @@ var import_address3 = require("@fuel-ts/address");
|
|
108
112
|
var import_errors14 = require("@fuel-ts/errors");
|
109
113
|
var import_math17 = require("@fuel-ts/math");
|
110
114
|
var import_transactions20 = require("@fuel-ts/transactions");
|
111
|
-
var
|
115
|
+
var import_utils23 = require("@fuel-ts/utils");
|
112
116
|
var import_versions = require("@fuel-ts/versions");
|
113
|
-
var
|
117
|
+
var import_utils24 = require("@noble/curves/abstract/utils");
|
114
118
|
var import_graphql_request = require("graphql-request");
|
115
119
|
var import_ramda3 = require("ramda");
|
116
120
|
|
@@ -1669,15 +1673,6 @@ function normalizeJSON(root) {
|
|
1669
1673
|
return normalize((0, import_ramda.clone)(root));
|
1670
1674
|
}
|
1671
1675
|
|
1672
|
-
// src/providers/utils/sleep.ts
|
1673
|
-
function sleep(time) {
|
1674
|
-
return new Promise((resolve) => {
|
1675
|
-
setTimeout(() => {
|
1676
|
-
resolve(true);
|
1677
|
-
}, time);
|
1678
|
-
});
|
1679
|
-
}
|
1680
|
-
|
1681
1676
|
// src/providers/utils/extract-tx-error.ts
|
1682
1677
|
var import_errors7 = require("@fuel-ts/errors");
|
1683
1678
|
var import_math6 = require("@fuel-ts/math");
|
@@ -3618,6 +3613,7 @@ var TransactionResponse = class {
|
|
3618
3613
|
};
|
3619
3614
|
|
3620
3615
|
// src/providers/utils/auto-retry-fetch.ts
|
3616
|
+
var import_utils22 = require("@fuel-ts/utils");
|
3621
3617
|
function getWaitDelay(options, retryAttemptNum) {
|
3622
3618
|
const duration = options.baseDelay ?? 150;
|
3623
3619
|
switch (options.backoff) {
|
@@ -3647,7 +3643,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
|
|
3647
3643
|
throw error;
|
3648
3644
|
}
|
3649
3645
|
const delay = getWaitDelay(options, retryNum);
|
3650
|
-
await sleep(delay);
|
3646
|
+
await (0, import_utils22.sleep)(delay);
|
3651
3647
|
return autoRetryFetch(fetchFn, options, retryNum)(...args);
|
3652
3648
|
}
|
3653
3649
|
};
|
@@ -3987,7 +3983,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3987
3983
|
if (estimateTxDependencies) {
|
3988
3984
|
await this.estimateTxDependencies(transactionRequest);
|
3989
3985
|
}
|
3990
|
-
const encodedTransaction = (0,
|
3986
|
+
const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
|
3991
3987
|
let abis;
|
3992
3988
|
if (transactionRequest.type === import_transactions20.TransactionType.Script) {
|
3993
3989
|
abis = transactionRequest.abis;
|
@@ -4030,7 +4026,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4030
4026
|
if (estimateTxDependencies) {
|
4031
4027
|
return this.estimateTxDependencies(transactionRequest);
|
4032
4028
|
}
|
4033
|
-
const encodedTransaction = (0,
|
4029
|
+
const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
|
4034
4030
|
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4035
4031
|
encodedTransactions: encodedTransaction,
|
4036
4032
|
utxoValidation: utxoValidation || false
|
@@ -4048,13 +4044,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4048
4044
|
async estimatePredicates(transactionRequest) {
|
4049
4045
|
const shouldEstimatePredicates = Boolean(
|
4050
4046
|
transactionRequest.inputs.find(
|
4051
|
-
(input) => "predicate" in input && input.predicate && !(0,
|
4047
|
+
(input) => "predicate" in input && input.predicate && !(0, import_utils24.equalBytes)((0, import_utils23.arrayify)(input.predicate), (0, import_utils23.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
|
4052
4048
|
)
|
4053
4049
|
);
|
4054
4050
|
if (!shouldEstimatePredicates) {
|
4055
4051
|
return transactionRequest;
|
4056
4052
|
}
|
4057
|
-
const encodedTransaction = (0,
|
4053
|
+
const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
|
4058
4054
|
const response = await this.operations.estimatePredicates({
|
4059
4055
|
encodedTransaction
|
4060
4056
|
});
|
@@ -4096,7 +4092,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4096
4092
|
const {
|
4097
4093
|
dryRun: [{ receipts: rawReceipts, status }]
|
4098
4094
|
} = await this.operations.dryRun({
|
4099
|
-
encodedTransactions: [(0,
|
4095
|
+
encodedTransactions: [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())],
|
4100
4096
|
utxoValidation: false
|
4101
4097
|
});
|
4102
4098
|
receipts = rawReceipts.map(processGqlReceipt);
|
@@ -4146,7 +4142,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4146
4142
|
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
4147
4143
|
allRequests.forEach((req, index) => {
|
4148
4144
|
if (req.type === import_transactions20.TransactionType.Script) {
|
4149
|
-
serializedTransactionsMap.set(index, (0,
|
4145
|
+
serializedTransactionsMap.set(index, (0, import_utils23.hexlify)(req.toTransactionBytes()));
|
4150
4146
|
}
|
4151
4147
|
});
|
4152
4148
|
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
@@ -4182,7 +4178,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4182
4178
|
transactionRequest: request
|
4183
4179
|
});
|
4184
4180
|
request.maxFee = maxFee;
|
4185
|
-
serializedTransactionsMap.set(requestIdx, (0,
|
4181
|
+
serializedTransactionsMap.set(requestIdx, (0, import_utils23.hexlify)(request.toTransactionBytes()));
|
4186
4182
|
nextRoundTransactions.push(requestIdx);
|
4187
4183
|
}
|
4188
4184
|
}
|
@@ -4195,7 +4191,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4195
4191
|
if (estimateTxDependencies) {
|
4196
4192
|
return this.estimateMultipleTxDependencies(transactionRequests);
|
4197
4193
|
}
|
4198
|
-
const encodedTransactions = transactionRequests.map((tx) => (0,
|
4194
|
+
const encodedTransactions = transactionRequests.map((tx) => (0, import_utils23.hexlify)(tx.toTransactionBytes()));
|
4199
4195
|
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4200
4196
|
encodedTransactions,
|
4201
4197
|
utxoValidation: utxoValidation || false
|
@@ -4268,7 +4264,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4268
4264
|
if (estimateTxDependencies) {
|
4269
4265
|
return this.estimateTxDependencies(transactionRequest);
|
4270
4266
|
}
|
4271
|
-
const encodedTransactions = [(0,
|
4267
|
+
const encodedTransactions = [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())];
|
4272
4268
|
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4273
4269
|
encodedTransactions,
|
4274
4270
|
utxoValidation: true
|
@@ -4387,7 +4383,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4387
4383
|
const result = await this.operations.getCoins({
|
4388
4384
|
first: 10,
|
4389
4385
|
...paginationArgs,
|
4390
|
-
filter: { owner: ownerAddress.toB256(), assetId: assetId && (0,
|
4386
|
+
filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
|
4391
4387
|
});
|
4392
4388
|
const coins = result.coins.edges.map((edge) => edge.node);
|
4393
4389
|
return coins.map((coin) => ({
|
@@ -4410,19 +4406,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4410
4406
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
4411
4407
|
const ownerAddress = import_address3.Address.fromAddressOrString(owner);
|
4412
4408
|
const excludeInput = {
|
4413
|
-
messages: excludedIds?.messages?.map((nonce) => (0,
|
4414
|
-
utxos: excludedIds?.utxos?.map((id) => (0,
|
4409
|
+
messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
|
4410
|
+
utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
|
4415
4411
|
};
|
4416
4412
|
if (this.cache) {
|
4417
4413
|
const uniqueUtxos = new Set(
|
4418
|
-
excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0,
|
4414
|
+
excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
|
4419
4415
|
);
|
4420
4416
|
excludeInput.utxos = Array.from(uniqueUtxos);
|
4421
4417
|
}
|
4422
4418
|
const coinsQuery = {
|
4423
4419
|
owner: ownerAddress.toB256(),
|
4424
4420
|
queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
|
4425
|
-
assetId: (0,
|
4421
|
+
assetId: (0, import_utils23.hexlify)(assetId),
|
4426
4422
|
amount: amount.toString(10),
|
4427
4423
|
max: maxPerAsset ? maxPerAsset.toString(10) : void 0
|
4428
4424
|
})),
|
@@ -4524,7 +4520,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4524
4520
|
time: block.header.time,
|
4525
4521
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4526
4522
|
transactions: block.transactions.map(
|
4527
|
-
(tx) => new import_transactions20.TransactionCoder().decode((0,
|
4523
|
+
(tx) => new import_transactions20.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
|
4528
4524
|
)
|
4529
4525
|
};
|
4530
4526
|
}
|
@@ -4540,7 +4536,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4540
4536
|
return null;
|
4541
4537
|
}
|
4542
4538
|
return new import_transactions20.TransactionCoder().decode(
|
4543
|
-
(0,
|
4539
|
+
(0, import_utils23.arrayify)(transaction.rawPayload),
|
4544
4540
|
0
|
4545
4541
|
)?.[0];
|
4546
4542
|
}
|
@@ -4567,7 +4563,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4567
4563
|
async getContractBalance(contractId, assetId) {
|
4568
4564
|
const { contractBalance } = await this.operations.getContractBalance({
|
4569
4565
|
contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
|
4570
|
-
asset: (0,
|
4566
|
+
asset: (0, import_utils23.hexlify)(assetId)
|
4571
4567
|
});
|
4572
4568
|
return (0, import_math17.bn)(contractBalance.amount, 10);
|
4573
4569
|
}
|
@@ -4581,7 +4577,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4581
4577
|
async getBalance(owner, assetId) {
|
4582
4578
|
const { balance } = await this.operations.getBalance({
|
4583
4579
|
owner: import_address3.Address.fromAddressOrString(owner).toB256(),
|
4584
|
-
assetId: (0,
|
4580
|
+
assetId: (0, import_utils23.hexlify)(assetId)
|
4585
4581
|
});
|
4586
4582
|
return (0, import_math17.bn)(balance.amount, 10);
|
4587
4583
|
}
|
@@ -4758,7 +4754,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4758
4754
|
async produceBlocks(amount, startTime) {
|
4759
4755
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4760
4756
|
blocksToProduce: (0, import_math17.bn)(amount).toString(10),
|
4761
|
-
startTimestamp: startTime ?
|
4757
|
+
startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4762
4758
|
});
|
4763
4759
|
return (0, import_math17.bn)(latestBlockHeight);
|
4764
4760
|
}
|
@@ -4824,7 +4820,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4824
4820
|
var import_errors15 = require("@fuel-ts/errors");
|
4825
4821
|
var import_math18 = require("@fuel-ts/math");
|
4826
4822
|
var import_transactions21 = require("@fuel-ts/transactions");
|
4827
|
-
var
|
4823
|
+
var import_utils26 = require("@fuel-ts/utils");
|
4828
4824
|
|
4829
4825
|
// src/providers/chains.ts
|
4830
4826
|
var CHAIN_IDS = {
|
@@ -4900,16 +4896,16 @@ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
|
|
4900
4896
|
// src/utils/formatTransferToContractScriptData.ts
|
4901
4897
|
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
4902
4898
|
var import_math19 = require("@fuel-ts/math");
|
4903
|
-
var
|
4899
|
+
var import_utils28 = require("@fuel-ts/utils");
|
4904
4900
|
var asm = __toESM(require("@fuels/vm-asm"));
|
4905
4901
|
var formatTransferToContractScriptData = (params) => {
|
4906
4902
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
4907
4903
|
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
4908
4904
|
const encoded = numberCoder.encode(new import_math19.BN(amountToTransfer).toNumber());
|
4909
4905
|
const scriptData = Uint8Array.from([
|
4910
|
-
...(0,
|
4906
|
+
...(0, import_utils28.arrayify)(hexlifiedContractId),
|
4911
4907
|
...encoded,
|
4912
|
-
...(0,
|
4908
|
+
...(0, import_utils28.arrayify)(assetId)
|
4913
4909
|
]);
|
4914
4910
|
return scriptData;
|
4915
4911
|
};
|
@@ -5310,14 +5306,14 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5310
5306
|
*/
|
5311
5307
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
5312
5308
|
const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
|
5313
|
-
const recipientDataArray = (0,
|
5309
|
+
const recipientDataArray = (0, import_utils29.arrayify)(
|
5314
5310
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5315
5311
|
);
|
5316
|
-
const amountDataArray = (0,
|
5312
|
+
const amountDataArray = (0, import_utils29.arrayify)(
|
5317
5313
|
"0x".concat((0, import_math20.bn)(amount).toHex().substring(2).padStart(16, "0"))
|
5318
5314
|
);
|
5319
5315
|
const script = new Uint8Array([
|
5320
|
-
...(0,
|
5316
|
+
...(0, import_utils29.arrayify)(withdrawScript.bytes),
|
5321
5317
|
...recipientDataArray,
|
5322
5318
|
...amountDataArray
|
5323
5319
|
]);
|
@@ -5423,7 +5419,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5423
5419
|
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
|
5424
5420
|
}) {
|
5425
5421
|
const request = transactionRequestify(transactionRequest);
|
5426
|
-
if (!(0,
|
5422
|
+
if (!(0, import_utils29.isDefined)(setGasLimit)) {
|
5427
5423
|
request.gasLimit = gasUsed;
|
5428
5424
|
} else if (gasUsed.gt(setGasLimit)) {
|
5429
5425
|
throw new import_errors16.FuelError(
|
@@ -5431,7 +5427,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5431
5427
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
5432
5428
|
);
|
5433
5429
|
}
|
5434
|
-
if (!(0,
|
5430
|
+
if (!(0, import_utils29.isDefined)(setMaxFee)) {
|
5435
5431
|
request.maxFee = maxFee;
|
5436
5432
|
} else if (maxFee.gt(setMaxFee)) {
|
5437
5433
|
throw new import_errors16.FuelError(
|
@@ -5448,7 +5444,7 @@ var import_address5 = require("@fuel-ts/address");
|
|
5448
5444
|
var import_crypto2 = require("@fuel-ts/crypto");
|
5449
5445
|
var import_hasher2 = require("@fuel-ts/hasher");
|
5450
5446
|
var import_math21 = require("@fuel-ts/math");
|
5451
|
-
var
|
5447
|
+
var import_utils30 = require("@fuel-ts/utils");
|
5452
5448
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
5453
5449
|
var Signer = class {
|
5454
5450
|
address;
|
@@ -5468,9 +5464,9 @@ var Signer = class {
|
|
5468
5464
|
}
|
5469
5465
|
}
|
5470
5466
|
const privateKeyBytes = (0, import_math21.toBytes)(privateKey, 32);
|
5471
|
-
this.privateKey = (0,
|
5472
|
-
this.publicKey = (0,
|
5473
|
-
this.compressedPublicKey = (0,
|
5467
|
+
this.privateKey = (0, import_utils30.hexlify)(privateKeyBytes);
|
5468
|
+
this.publicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
5469
|
+
this.compressedPublicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
|
5474
5470
|
this.address = import_address5.Address.fromPublicKey(this.publicKey);
|
5475
5471
|
}
|
5476
5472
|
/**
|
@@ -5484,11 +5480,11 @@ var Signer = class {
|
|
5484
5480
|
* @returns hashed signature
|
5485
5481
|
*/
|
5486
5482
|
sign(data) {
|
5487
|
-
const signature = import_secp256k1.secp256k1.sign((0,
|
5483
|
+
const signature = import_secp256k1.secp256k1.sign((0, import_utils30.arrayify)(data), (0, import_utils30.arrayify)(this.privateKey));
|
5488
5484
|
const r = (0, import_math21.toBytes)(`0x${signature.r.toString(16)}`, 32);
|
5489
5485
|
const s = (0, import_math21.toBytes)(`0x${signature.s.toString(16)}`, 32);
|
5490
5486
|
s[0] |= (signature.recovery || 0) << 7;
|
5491
|
-
return (0,
|
5487
|
+
return (0, import_utils30.hexlify)((0, import_utils30.concat)([r, s]));
|
5492
5488
|
}
|
5493
5489
|
/**
|
5494
5490
|
* Add point on the current elliptic curve
|
@@ -5497,8 +5493,8 @@ var Signer = class {
|
|
5497
5493
|
* @returns compressed point on the curve
|
5498
5494
|
*/
|
5499
5495
|
addPoint(point) {
|
5500
|
-
const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5501
|
-
const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5496
|
+
const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(this.compressedPublicKey));
|
5497
|
+
const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(point));
|
5502
5498
|
const result = p0.add(p1);
|
5503
5499
|
return `0x${result.toHex(true)}`;
|
5504
5500
|
}
|
@@ -5510,16 +5506,16 @@ var Signer = class {
|
|
5510
5506
|
* @returns public key from signature from the
|
5511
5507
|
*/
|
5512
5508
|
static recoverPublicKey(data, signature) {
|
5513
|
-
const signedMessageBytes = (0,
|
5509
|
+
const signedMessageBytes = (0, import_utils30.arrayify)(signature);
|
5514
5510
|
const r = signedMessageBytes.slice(0, 32);
|
5515
5511
|
const s = signedMessageBytes.slice(32, 64);
|
5516
5512
|
const recoveryParam = (s[0] & 128) >> 7;
|
5517
5513
|
s[0] &= 127;
|
5518
|
-
const sig = new import_secp256k1.secp256k1.Signature(BigInt((0,
|
5514
|
+
const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils30.hexlify)(r)), BigInt((0, import_utils30.hexlify)(s))).addRecoveryBit(
|
5519
5515
|
recoveryParam
|
5520
5516
|
);
|
5521
|
-
const publicKey = sig.recoverPublicKey((0,
|
5522
|
-
return (0,
|
5517
|
+
const publicKey = sig.recoverPublicKey((0, import_utils30.arrayify)(data)).toRawBytes(false).slice(1);
|
5518
|
+
return (0, import_utils30.hexlify)(publicKey);
|
5523
5519
|
}
|
5524
5520
|
/**
|
5525
5521
|
* Recover the address from a signature performed with [`sign`](#sign).
|
@@ -5538,7 +5534,7 @@ var Signer = class {
|
|
5538
5534
|
* @returns random 32-byte hashed
|
5539
5535
|
*/
|
5540
5536
|
static generatePrivateKey(entropy) {
|
5541
|
-
return entropy ? (0, import_hasher2.hash)((0,
|
5537
|
+
return entropy ? (0, import_hasher2.hash)((0, import_utils30.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils30.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
|
5542
5538
|
}
|
5543
5539
|
/**
|
5544
5540
|
* Extended publicKey from a compact publicKey
|
@@ -5547,8 +5543,8 @@ var Signer = class {
|
|
5547
5543
|
* @returns extended publicKey
|
5548
5544
|
*/
|
5549
5545
|
static extendPublicKey(publicKey) {
|
5550
|
-
const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5551
|
-
return (0,
|
5546
|
+
const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(publicKey));
|
5547
|
+
return (0, import_utils30.hexlify)(point.toRawBytes(false).slice(1));
|
5552
5548
|
}
|
5553
5549
|
};
|
5554
5550
|
|
@@ -5556,7 +5552,7 @@ var Signer = class {
|
|
5556
5552
|
var import_address6 = require("@fuel-ts/address");
|
5557
5553
|
var import_crypto3 = require("@fuel-ts/crypto");
|
5558
5554
|
var import_errors17 = require("@fuel-ts/errors");
|
5559
|
-
var
|
5555
|
+
var import_utils31 = require("@fuel-ts/utils");
|
5560
5556
|
var import_uuid = require("uuid");
|
5561
5557
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
5562
5558
|
var DEFAULT_KDF_PARAMS_R = 8;
|
@@ -5639,7 +5635,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
5639
5635
|
);
|
5640
5636
|
}
|
5641
5637
|
const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
|
5642
|
-
const privateKey = (0,
|
5638
|
+
const privateKey = (0, import_utils31.hexlify)(buffer);
|
5643
5639
|
return privateKey;
|
5644
5640
|
}
|
5645
5641
|
|
@@ -5684,7 +5680,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5684
5680
|
*/
|
5685
5681
|
async signMessage(message) {
|
5686
5682
|
const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
|
5687
|
-
return (0,
|
5683
|
+
return (0, import_utils32.hexlify)(signedMessage);
|
5688
5684
|
}
|
5689
5685
|
/**
|
5690
5686
|
* Signs a transaction with the wallet's private key.
|
@@ -5697,7 +5693,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5697
5693
|
const chainId = this.provider.getChainId();
|
5698
5694
|
const hashedTransaction = transactionRequest.getTransactionId(chainId);
|
5699
5695
|
const signature = await this.signer().sign(hashedTransaction);
|
5700
|
-
return (0,
|
5696
|
+
return (0, import_utils32.hexlify)(signature);
|
5701
5697
|
}
|
5702
5698
|
/**
|
5703
5699
|
* Populates a transaction with the witnesses signature.
|
@@ -5760,13 +5756,13 @@ var import_crypto5 = require("@fuel-ts/crypto");
|
|
5760
5756
|
var import_errors20 = require("@fuel-ts/errors");
|
5761
5757
|
var import_hasher6 = require("@fuel-ts/hasher");
|
5762
5758
|
var import_math22 = require("@fuel-ts/math");
|
5763
|
-
var
|
5759
|
+
var import_utils36 = require("@fuel-ts/utils");
|
5764
5760
|
|
5765
5761
|
// src/mnemonic/mnemonic.ts
|
5766
5762
|
var import_crypto4 = require("@fuel-ts/crypto");
|
5767
5763
|
var import_errors19 = require("@fuel-ts/errors");
|
5768
5764
|
var import_hasher5 = require("@fuel-ts/hasher");
|
5769
|
-
var
|
5765
|
+
var import_utils34 = require("@fuel-ts/utils");
|
5770
5766
|
|
5771
5767
|
// src/wordlists/words/english.ts
|
5772
5768
|
var english = [
|
@@ -7823,7 +7819,7 @@ var english = [
|
|
7823
7819
|
// src/mnemonic/utils.ts
|
7824
7820
|
var import_errors18 = require("@fuel-ts/errors");
|
7825
7821
|
var import_hasher4 = require("@fuel-ts/hasher");
|
7826
|
-
var
|
7822
|
+
var import_utils33 = require("@fuel-ts/utils");
|
7827
7823
|
function getLowerMask(bits) {
|
7828
7824
|
return (1 << bits) - 1;
|
7829
7825
|
}
|
@@ -7858,14 +7854,14 @@ function entropyToMnemonicIndices(entropy) {
|
|
7858
7854
|
}
|
7859
7855
|
}
|
7860
7856
|
const checksumBits = entropy.length / 4;
|
7861
|
-
const checksum = (0,
|
7857
|
+
const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
|
7862
7858
|
indices[indices.length - 1] <<= checksumBits;
|
7863
7859
|
indices[indices.length - 1] |= checksum >> 8 - checksumBits;
|
7864
7860
|
return indices;
|
7865
7861
|
}
|
7866
7862
|
function mnemonicWordsToEntropy(words, wordlist) {
|
7867
7863
|
const size = Math.ceil(11 * words.length / 8);
|
7868
|
-
const entropy = (0,
|
7864
|
+
const entropy = (0, import_utils33.arrayify)(new Uint8Array(size));
|
7869
7865
|
let offset = 0;
|
7870
7866
|
for (let i = 0; i < words.length; i += 1) {
|
7871
7867
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
@@ -7885,7 +7881,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
7885
7881
|
const entropyBits = 32 * words.length / 3;
|
7886
7882
|
const checksumBits = words.length / 3;
|
7887
7883
|
const checksumMask = getUpperMask(checksumBits);
|
7888
|
-
const checksum = (0,
|
7884
|
+
const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
7889
7885
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
7890
7886
|
throw new import_errors18.FuelError(
|
7891
7887
|
import_errors18.ErrorCode.INVALID_CHECKSUM,
|
@@ -7896,7 +7892,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
7896
7892
|
}
|
7897
7893
|
|
7898
7894
|
// src/mnemonic/mnemonic.ts
|
7899
|
-
var MasterSecret = (0,
|
7895
|
+
var MasterSecret = (0, import_utils34.toUtf8Bytes)("Bitcoin seed");
|
7900
7896
|
var MainnetPRV = "0x0488ade4";
|
7901
7897
|
var TestnetPRV = "0x04358394";
|
7902
7898
|
var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
|
@@ -7960,7 +7956,7 @@ var Mnemonic = class {
|
|
7960
7956
|
static mnemonicToEntropy(phrase, wordlist = english) {
|
7961
7957
|
const words = getWords(phrase);
|
7962
7958
|
assertMnemonic(words);
|
7963
|
-
return (0,
|
7959
|
+
return (0, import_utils34.hexlify)(mnemonicWordsToEntropy(words, wordlist));
|
7964
7960
|
}
|
7965
7961
|
/**
|
7966
7962
|
* @param entropy - Entropy source to the mnemonic phrase.
|
@@ -7968,7 +7964,7 @@ var Mnemonic = class {
|
|
7968
7964
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
7969
7965
|
*/
|
7970
7966
|
static entropyToMnemonic(entropy, wordlist = english) {
|
7971
|
-
const entropyBytes = (0,
|
7967
|
+
const entropyBytes = (0, import_utils34.arrayify)(entropy);
|
7972
7968
|
assertWordList(wordlist);
|
7973
7969
|
assertEntropy(entropyBytes);
|
7974
7970
|
return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
|
@@ -7980,8 +7976,8 @@ var Mnemonic = class {
|
|
7980
7976
|
*/
|
7981
7977
|
static mnemonicToSeed(phrase, passphrase = "") {
|
7982
7978
|
assertMnemonic(getWords(phrase));
|
7983
|
-
const phraseBytes = (0,
|
7984
|
-
const salt = (0,
|
7979
|
+
const phraseBytes = (0, import_utils34.toUtf8Bytes)(getPhrase(phrase));
|
7980
|
+
const salt = (0, import_utils34.toUtf8Bytes)(`mnemonic${passphrase}`);
|
7985
7981
|
return (0, import_crypto4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
|
7986
7982
|
}
|
7987
7983
|
/**
|
@@ -8037,14 +8033,14 @@ var Mnemonic = class {
|
|
8037
8033
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
8038
8034
|
*/
|
8039
8035
|
static masterKeysFromSeed(seed) {
|
8040
|
-
const seedArray = (0,
|
8036
|
+
const seedArray = (0, import_utils34.arrayify)(seed);
|
8041
8037
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
8042
8038
|
throw new import_errors19.FuelError(
|
8043
8039
|
import_errors19.ErrorCode.INVALID_SEED,
|
8044
8040
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
8045
8041
|
);
|
8046
8042
|
}
|
8047
|
-
return (0,
|
8043
|
+
return (0, import_utils34.arrayify)((0, import_crypto4.computeHmac)("sha512", MasterSecret, seedArray));
|
8048
8044
|
}
|
8049
8045
|
/**
|
8050
8046
|
* Get the extendKey as defined on BIP-32 from the provided seed
|
@@ -8055,22 +8051,22 @@ var Mnemonic = class {
|
|
8055
8051
|
*/
|
8056
8052
|
static seedToExtendedKey(seed, testnet = false) {
|
8057
8053
|
const masterKey = Mnemonic.masterKeysFromSeed(seed);
|
8058
|
-
const prefix = (0,
|
8054
|
+
const prefix = (0, import_utils34.arrayify)(testnet ? TestnetPRV : MainnetPRV);
|
8059
8055
|
const depth = "0x00";
|
8060
8056
|
const fingerprint = "0x00000000";
|
8061
8057
|
const index = "0x00000000";
|
8062
8058
|
const chainCode = masterKey.slice(32);
|
8063
8059
|
const privateKey = masterKey.slice(0, 32);
|
8064
|
-
const extendedKey = (0,
|
8060
|
+
const extendedKey = (0, import_utils34.concat)([
|
8065
8061
|
prefix,
|
8066
8062
|
depth,
|
8067
8063
|
fingerprint,
|
8068
8064
|
index,
|
8069
8065
|
chainCode,
|
8070
|
-
(0,
|
8066
|
+
(0, import_utils34.concat)(["0x00", privateKey])
|
8071
8067
|
]);
|
8072
|
-
const checksum = (0,
|
8073
|
-
return (0,
|
8068
|
+
const checksum = (0, import_utils34.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
|
8069
|
+
return (0, import_utils34.encodeBase58)((0, import_utils34.concat)([extendedKey, checksum]));
|
8074
8070
|
}
|
8075
8071
|
/**
|
8076
8072
|
* Create a new mnemonic using a randomly generated number as entropy.
|
@@ -8085,7 +8081,7 @@ var Mnemonic = class {
|
|
8085
8081
|
* @returns A randomly generated mnemonic
|
8086
8082
|
*/
|
8087
8083
|
static generate(size = 32, extraEntropy = "") {
|
8088
|
-
const entropy = extraEntropy ? (0, import_hasher5.sha256)((0,
|
8084
|
+
const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils34.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils34.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
|
8089
8085
|
return Mnemonic.entropyToMnemonic(entropy);
|
8090
8086
|
}
|
8091
8087
|
};
|
@@ -8093,12 +8089,12 @@ var mnemonic_default = Mnemonic;
|
|
8093
8089
|
|
8094
8090
|
// src/hdwallet/hdwallet.ts
|
8095
8091
|
var HARDENED_INDEX = 2147483648;
|
8096
|
-
var MainnetPRV2 = (0,
|
8097
|
-
var MainnetPUB = (0,
|
8098
|
-
var TestnetPRV2 = (0,
|
8099
|
-
var TestnetPUB = (0,
|
8092
|
+
var MainnetPRV2 = (0, import_utils36.hexlify)("0x0488ade4");
|
8093
|
+
var MainnetPUB = (0, import_utils36.hexlify)("0x0488b21e");
|
8094
|
+
var TestnetPRV2 = (0, import_utils36.hexlify)("0x04358394");
|
8095
|
+
var TestnetPUB = (0, import_utils36.hexlify)("0x043587cf");
|
8100
8096
|
function base58check(data) {
|
8101
|
-
return (0,
|
8097
|
+
return (0, import_utils36.encodeBase58)((0, import_utils36.concat)([data, (0, import_utils36.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
|
8102
8098
|
}
|
8103
8099
|
function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
8104
8100
|
if (isPublic) {
|
@@ -8107,11 +8103,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
|
8107
8103
|
return testnet ? TestnetPRV2 : MainnetPRV2;
|
8108
8104
|
}
|
8109
8105
|
function isPublicExtendedKey(extendedKey) {
|
8110
|
-
return [MainnetPUB, TestnetPUB].includes((0,
|
8106
|
+
return [MainnetPUB, TestnetPUB].includes((0, import_utils36.hexlify)(extendedKey.slice(0, 4)));
|
8111
8107
|
}
|
8112
8108
|
function isValidExtendedKey(extendedKey) {
|
8113
8109
|
return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
|
8114
|
-
(0,
|
8110
|
+
(0, import_utils36.hexlify)(extendedKey.slice(0, 4))
|
8115
8111
|
);
|
8116
8112
|
}
|
8117
8113
|
function parsePath(path2, depth = 0) {
|
@@ -8129,8 +8125,8 @@ function parsePath(path2, depth = 0) {
|
|
8129
8125
|
var HDWallet = class {
|
8130
8126
|
depth = 0;
|
8131
8127
|
index = 0;
|
8132
|
-
fingerprint = (0,
|
8133
|
-
parentFingerprint = (0,
|
8128
|
+
fingerprint = (0, import_utils36.hexlify)("0x00000000");
|
8129
|
+
parentFingerprint = (0, import_utils36.hexlify)("0x00000000");
|
8134
8130
|
privateKey;
|
8135
8131
|
publicKey;
|
8136
8132
|
chainCode;
|
@@ -8142,8 +8138,8 @@ var HDWallet = class {
|
|
8142
8138
|
constructor(config) {
|
8143
8139
|
if (config.privateKey) {
|
8144
8140
|
const signer = new Signer(config.privateKey);
|
8145
|
-
this.publicKey = (0,
|
8146
|
-
this.privateKey = (0,
|
8141
|
+
this.publicKey = (0, import_utils36.hexlify)(signer.compressedPublicKey);
|
8142
|
+
this.privateKey = (0, import_utils36.hexlify)(config.privateKey);
|
8147
8143
|
} else {
|
8148
8144
|
if (!config.publicKey) {
|
8149
8145
|
throw new import_errors20.FuelError(
|
@@ -8151,10 +8147,10 @@ var HDWallet = class {
|
|
8151
8147
|
"Both public and private Key cannot be missing. At least one should be provided."
|
8152
8148
|
);
|
8153
8149
|
}
|
8154
|
-
this.publicKey = (0,
|
8150
|
+
this.publicKey = (0, import_utils36.hexlify)(config.publicKey);
|
8155
8151
|
}
|
8156
8152
|
this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
|
8157
|
-
this.fingerprint = (0,
|
8153
|
+
this.fingerprint = (0, import_utils36.dataSlice)((0, import_crypto5.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
|
8158
8154
|
this.depth = config.depth || this.depth;
|
8159
8155
|
this.index = config.index || this.index;
|
8160
8156
|
this.chainCode = config.chainCode;
|
@@ -8170,9 +8166,9 @@ var HDWallet = class {
|
|
8170
8166
|
* @returns A new instance of HDWallet on the derived index
|
8171
8167
|
*/
|
8172
8168
|
deriveIndex(index) {
|
8173
|
-
const privateKey = this.privateKey && (0,
|
8174
|
-
const publicKey = (0,
|
8175
|
-
const chainCode = (0,
|
8169
|
+
const privateKey = this.privateKey && (0, import_utils36.arrayify)(this.privateKey);
|
8170
|
+
const publicKey = (0, import_utils36.arrayify)(this.publicKey);
|
8171
|
+
const chainCode = (0, import_utils36.arrayify)(this.chainCode);
|
8176
8172
|
const data = new Uint8Array(37);
|
8177
8173
|
if (index & HARDENED_INDEX) {
|
8178
8174
|
if (!privateKey) {
|
@@ -8183,10 +8179,10 @@ var HDWallet = class {
|
|
8183
8179
|
}
|
8184
8180
|
data.set(privateKey, 1);
|
8185
8181
|
} else {
|
8186
|
-
data.set((0,
|
8182
|
+
data.set((0, import_utils36.arrayify)(this.publicKey));
|
8187
8183
|
}
|
8188
8184
|
data.set((0, import_math22.toBytes)(index, 4), 33);
|
8189
|
-
const bytes = (0,
|
8185
|
+
const bytes = (0, import_utils36.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
|
8190
8186
|
const IL = bytes.slice(0, 32);
|
8191
8187
|
const IR = bytes.slice(32);
|
8192
8188
|
if (privateKey) {
|
@@ -8200,7 +8196,7 @@ var HDWallet = class {
|
|
8200
8196
|
parentFingerprint: this.fingerprint
|
8201
8197
|
});
|
8202
8198
|
}
|
8203
|
-
const signer = new Signer((0,
|
8199
|
+
const signer = new Signer((0, import_utils36.hexlify)(IL));
|
8204
8200
|
const Ki = signer.addPoint(publicKey);
|
8205
8201
|
return new HDWallet({
|
8206
8202
|
publicKey: Ki,
|
@@ -8235,12 +8231,12 @@ var HDWallet = class {
|
|
8235
8231
|
);
|
8236
8232
|
}
|
8237
8233
|
const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
|
8238
|
-
const depth = (0,
|
8234
|
+
const depth = (0, import_utils36.hexlify)(Uint8Array.from([this.depth]));
|
8239
8235
|
const parentFingerprint = this.parentFingerprint;
|
8240
8236
|
const index = (0, import_math22.toHex)(this.index, 4);
|
8241
8237
|
const chainCode = this.chainCode;
|
8242
|
-
const key = this.privateKey != null && !isPublic ? (0,
|
8243
|
-
const extendedKey = (0,
|
8238
|
+
const key = this.privateKey != null && !isPublic ? (0, import_utils36.concat)(["0x00", this.privateKey]) : this.publicKey;
|
8239
|
+
const extendedKey = (0, import_utils36.arrayify)((0, import_utils36.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
|
8244
8240
|
return base58check(extendedKey);
|
8245
8241
|
}
|
8246
8242
|
/**
|
@@ -8252,13 +8248,13 @@ var HDWallet = class {
|
|
8252
8248
|
static fromSeed(seed) {
|
8253
8249
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
8254
8250
|
return new HDWallet({
|
8255
|
-
chainCode: (0,
|
8256
|
-
privateKey: (0,
|
8251
|
+
chainCode: (0, import_utils36.arrayify)(masterKey.slice(32)),
|
8252
|
+
privateKey: (0, import_utils36.arrayify)(masterKey.slice(0, 32))
|
8257
8253
|
});
|
8258
8254
|
}
|
8259
8255
|
static fromExtendedKey(extendedKey) {
|
8260
|
-
const decoded = (0,
|
8261
|
-
const bytes = (0,
|
8256
|
+
const decoded = (0, import_utils36.hexlify)((0, import_math22.toBytes)((0, import_utils36.decodeBase58)(extendedKey)));
|
8257
|
+
const bytes = (0, import_utils36.arrayify)(decoded);
|
8262
8258
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
8263
8259
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
8264
8260
|
throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
@@ -8267,9 +8263,9 @@ var HDWallet = class {
|
|
8267
8263
|
throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
8268
8264
|
}
|
8269
8265
|
const depth = bytes[4];
|
8270
|
-
const parentFingerprint = (0,
|
8271
|
-
const index = parseInt((0,
|
8272
|
-
const chainCode = (0,
|
8266
|
+
const parentFingerprint = (0, import_utils36.hexlify)(bytes.slice(5, 9));
|
8267
|
+
const index = parseInt((0, import_utils36.hexlify)(bytes.slice(9, 13)).substring(2), 16);
|
8268
|
+
const chainCode = (0, import_utils36.hexlify)(bytes.slice(13, 45));
|
8273
8269
|
const key = bytes.slice(45, 78);
|
8274
8270
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
8275
8271
|
throw new import_errors20.FuelError(
|
@@ -8488,7 +8484,7 @@ var generateTestWallet = async (provider, quantities) => {
|
|
8488
8484
|
// src/test-utils/launchNode.ts
|
8489
8485
|
var import_abi_coder7 = require("@fuel-ts/abi-coder");
|
8490
8486
|
var import_crypto7 = require("@fuel-ts/crypto");
|
8491
|
-
var
|
8487
|
+
var import_utils37 = require("@fuel-ts/utils");
|
8492
8488
|
var import_child_process = require("child_process");
|
8493
8489
|
var import_crypto8 = require("crypto");
|
8494
8490
|
var import_fs = require("fs");
|
@@ -8527,6 +8523,40 @@ var killNode = (params) => {
|
|
8527
8523
|
}
|
8528
8524
|
}
|
8529
8525
|
};
|
8526
|
+
function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
|
8527
|
+
const defaultCoins = import_utils37.defaultSnapshotConfigs.stateConfig.coins.map((coin) => ({
|
8528
|
+
...coin,
|
8529
|
+
amount: "18446744073709551615"
|
8530
|
+
}));
|
8531
|
+
const defaultMessages = import_utils37.defaultSnapshotConfigs.stateConfig.messages.map((message) => ({
|
8532
|
+
...message,
|
8533
|
+
amount: "18446744073709551615"
|
8534
|
+
}));
|
8535
|
+
const coins = defaultCoins.concat(stateConfig.coins.map((coin) => ({ ...coin, amount: coin.amount.toString() }))).filter((coin, index, self) => self.findIndex((c) => c.tx_id === coin.tx_id) === index);
|
8536
|
+
const messages = defaultMessages.concat(stateConfig.messages.map((msg) => ({ ...msg, amount: msg.amount.toString() }))).filter((msg, index, self) => self.findIndex((m) => m.nonce === msg.nonce) === index);
|
8537
|
+
if (!process.env.GENESIS_SECRET) {
|
8538
|
+
const pk = Signer.generatePrivateKey();
|
8539
|
+
const signer = new Signer(pk);
|
8540
|
+
process.env.GENESIS_SECRET = (0, import_utils37.hexlify)(pk);
|
8541
|
+
coins.push({
|
8542
|
+
tx_id: (0, import_utils37.hexlify)((0, import_crypto7.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
|
8543
|
+
owner: signer.address.toHexString(),
|
8544
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8545
|
+
amount: "18446744073709551615",
|
8546
|
+
asset_id: chainConfig.consensus_parameters.V1.base_asset_id,
|
8547
|
+
output_index: 0,
|
8548
|
+
tx_pointer_block_height: 0,
|
8549
|
+
tx_pointer_tx_idx: 0
|
8550
|
+
});
|
8551
|
+
}
|
8552
|
+
const json = JSON.stringify({
|
8553
|
+
...stateConfig,
|
8554
|
+
coins,
|
8555
|
+
messages
|
8556
|
+
});
|
8557
|
+
const regexMakeNumber = /("amount":)"(\d+)"/gm;
|
8558
|
+
return json.replace(regexMakeNumber, "$1$2");
|
8559
|
+
}
|
8530
8560
|
var launchNode = async ({
|
8531
8561
|
ip,
|
8532
8562
|
port,
|
@@ -8534,7 +8564,8 @@ var launchNode = async ({
|
|
8534
8564
|
fuelCorePath = process.env.FUEL_CORE_PATH ?? void 0,
|
8535
8565
|
loggingEnabled = true,
|
8536
8566
|
debugEnabled = false,
|
8537
|
-
basePath
|
8567
|
+
basePath,
|
8568
|
+
snapshotConfig = import_utils37.defaultSnapshotConfigs
|
8538
8569
|
}) => (
|
8539
8570
|
// eslint-disable-next-line no-async-promise-executor
|
8540
8571
|
new Promise(async (resolve, reject) => {
|
@@ -8545,7 +8576,7 @@ var launchNode = async ({
|
|
8545
8576
|
"--poa-instant"
|
8546
8577
|
]);
|
8547
8578
|
const snapshotDir = getFlagValueFromArgs(args, "--snapshot");
|
8548
|
-
const consensusKey = getFlagValueFromArgs(args, "--consensus-key") ||
|
8579
|
+
const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils37.defaultConsensusKey;
|
8549
8580
|
const dbTypeFlagValue = getFlagValueFromArgs(args, "--db-type");
|
8550
8581
|
const useInMemoryDb = dbTypeFlagValue === "in-memory" || dbTypeFlagValue === void 0;
|
8551
8582
|
const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
|
@@ -8562,56 +8593,23 @@ var launchNode = async ({
|
|
8562
8593
|
let snapshotDirToUse;
|
8563
8594
|
const prefix = basePath || import_os.default.tmpdir();
|
8564
8595
|
const suffix = basePath ? "" : (0, import_crypto8.randomUUID)();
|
8565
|
-
const
|
8596
|
+
const tempDir = import_path.default.join(prefix, ".fuels", suffix, "snapshotDir");
|
8566
8597
|
if (snapshotDir) {
|
8567
8598
|
snapshotDirToUse = snapshotDir;
|
8568
8599
|
} else {
|
8569
|
-
if (!(0, import_fs.existsSync)(
|
8570
|
-
(0, import_fs.mkdirSync)(
|
8571
|
-
}
|
8572
|
-
let { stateConfigJson } = import_utils36.defaultSnapshotConfigs;
|
8573
|
-
const { chainConfigJson, metadataJson } = import_utils36.defaultSnapshotConfigs;
|
8574
|
-
stateConfigJson = {
|
8575
|
-
...stateConfigJson,
|
8576
|
-
coins: [
|
8577
|
-
...stateConfigJson.coins.map((coin) => ({
|
8578
|
-
...coin,
|
8579
|
-
amount: "18446744073709551615"
|
8580
|
-
}))
|
8581
|
-
],
|
8582
|
-
messages: stateConfigJson.messages.map((message) => ({
|
8583
|
-
...message,
|
8584
|
-
amount: "18446744073709551615"
|
8585
|
-
}))
|
8586
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8587
|
-
};
|
8588
|
-
if (!process.env.GENESIS_SECRET) {
|
8589
|
-
const pk = Signer.generatePrivateKey();
|
8590
|
-
const signer = new Signer(pk);
|
8591
|
-
process.env.GENESIS_SECRET = (0, import_utils36.hexlify)(pk);
|
8592
|
-
stateConfigJson.coins.push({
|
8593
|
-
tx_id: (0, import_utils36.hexlify)((0, import_crypto7.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
|
8594
|
-
owner: signer.address.toHexString(),
|
8595
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8596
|
-
amount: "18446744073709551615",
|
8597
|
-
asset_id: chainConfigJson.consensus_parameters.V1.base_asset_id,
|
8598
|
-
output_index: 0,
|
8599
|
-
tx_pointer_block_height: 0,
|
8600
|
-
tx_pointer_tx_idx: 0
|
8601
|
-
});
|
8600
|
+
if (!(0, import_fs.existsSync)(tempDir)) {
|
8601
|
+
(0, import_fs.mkdirSync)(tempDir, { recursive: true });
|
8602
8602
|
}
|
8603
|
-
|
8604
|
-
const
|
8605
|
-
|
8606
|
-
const
|
8607
|
-
const
|
8608
|
-
|
8609
|
-
|
8610
|
-
(0, import_fs.writeFileSync)(
|
8611
|
-
(0, import_fs.writeFileSync)(
|
8612
|
-
|
8613
|
-
(0, import_fs.writeFileSync)(stateTransitionWritePath, JSON.stringify(""));
|
8614
|
-
snapshotDirToUse = tempDirPath;
|
8603
|
+
const { metadata } = snapshotConfig;
|
8604
|
+
const metadataPath = import_path.default.join(tempDir, "metadata.json");
|
8605
|
+
const chainConfigPath = import_path.default.join(tempDir, metadata.chain_config);
|
8606
|
+
const stateConfigPath = import_path.default.join(tempDir, metadata.table_encoding.Json.filepath);
|
8607
|
+
const stateTransitionPath = import_path.default.join(tempDir, "state_transition_bytecode.wasm");
|
8608
|
+
(0, import_fs.writeFileSync)(chainConfigPath, JSON.stringify(snapshotConfig.chainConfig), "utf8");
|
8609
|
+
(0, import_fs.writeFileSync)(stateConfigPath, getFinalStateConfigJSON(snapshotConfig), "utf8");
|
8610
|
+
(0, import_fs.writeFileSync)(metadataPath, JSON.stringify(metadata), "utf8");
|
8611
|
+
(0, import_fs.writeFileSync)(stateTransitionPath, JSON.stringify(""));
|
8612
|
+
snapshotDirToUse = tempDir;
|
8615
8613
|
}
|
8616
8614
|
const child = (0, import_child_process.spawn)(
|
8617
8615
|
command,
|
@@ -8619,7 +8617,7 @@ var launchNode = async ({
|
|
8619
8617
|
"run",
|
8620
8618
|
["--ip", ipToUse],
|
8621
8619
|
["--port", portToUse],
|
8622
|
-
useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path",
|
8620
|
+
useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path", tempDir],
|
8623
8621
|
["--min-gas-price", "1"],
|
8624
8622
|
poaInstant ? ["--poa-instant", "true"] : [],
|
8625
8623
|
["--consensus-key", consensusKey],
|
@@ -8641,23 +8639,28 @@ var launchNode = async ({
|
|
8641
8639
|
}
|
8642
8640
|
const cleanupConfig = {
|
8643
8641
|
child,
|
8644
|
-
configPath:
|
8642
|
+
configPath: tempDir,
|
8645
8643
|
killFn: import_tree_kill.default,
|
8646
8644
|
state: {
|
8647
8645
|
isDead: false
|
8648
8646
|
}
|
8649
8647
|
};
|
8650
8648
|
child.stderr.on("data", (chunk) => {
|
8651
|
-
|
8649
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString();
|
8650
|
+
if (text.indexOf(graphQLStartSubstring) !== -1) {
|
8651
|
+
const rows = text.split("\n");
|
8652
|
+
const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1);
|
8653
|
+
const [realIp, realPort] = rowWithUrl.split(" ").at(-1).trim().split(":");
|
8652
8654
|
resolve({
|
8653
8655
|
cleanup: () => killNode(cleanupConfig),
|
8654
|
-
ip:
|
8655
|
-
port:
|
8656
|
+
ip: realIp,
|
8657
|
+
port: realPort,
|
8658
|
+
url: `http://${realIp}:${realPort}/v1/graphql`,
|
8656
8659
|
snapshotDir: snapshotDirToUse
|
8657
8660
|
});
|
8658
8661
|
}
|
8659
|
-
if (/error/i.test(
|
8660
|
-
reject(
|
8662
|
+
if (/error/i.test(text)) {
|
8663
|
+
reject(text.toString());
|
8661
8664
|
}
|
8662
8665
|
});
|
8663
8666
|
process.on("exit", () => killNode(cleanupConfig));
|
@@ -8690,12 +8693,246 @@ var launchNodeAndGetWallets = async ({
|
|
8690
8693
|
};
|
8691
8694
|
return { wallets, stop: cleanup, provider };
|
8692
8695
|
};
|
8696
|
+
|
8697
|
+
// src/test-utils/setup-test-provider-and-wallets.ts
|
8698
|
+
var import_utils40 = require("@fuel-ts/utils");
|
8699
|
+
var import_ramda5 = require("ramda");
|
8700
|
+
|
8701
|
+
// src/test-utils/asset-id.ts
|
8702
|
+
var import_crypto9 = require("@fuel-ts/crypto");
|
8703
|
+
var import_utils38 = require("@fuel-ts/utils");
|
8704
|
+
var _AssetId = class {
|
8705
|
+
constructor(value) {
|
8706
|
+
this.value = value;
|
8707
|
+
}
|
8708
|
+
static random(count = 1) {
|
8709
|
+
const assetIds = [];
|
8710
|
+
for (let i = 0; i < count; i++) {
|
8711
|
+
assetIds.push(new _AssetId((0, import_utils38.hexlify)((0, import_crypto9.randomBytes)(32))));
|
8712
|
+
}
|
8713
|
+
return assetIds;
|
8714
|
+
}
|
8715
|
+
};
|
8716
|
+
var AssetId = _AssetId;
|
8717
|
+
__publicField(AssetId, "A", new _AssetId(
|
8718
|
+
"0x0101010101010101010101010101010101010101010101010101010101010101"
|
8719
|
+
));
|
8720
|
+
__publicField(AssetId, "B", new _AssetId(
|
8721
|
+
"0x0202020202020202020202020202020202020202020202020202020202020202"
|
8722
|
+
));
|
8723
|
+
|
8724
|
+
// src/test-utils/wallet-config.ts
|
8725
|
+
var import_crypto10 = require("@fuel-ts/crypto");
|
8726
|
+
var import_errors21 = require("@fuel-ts/errors");
|
8727
|
+
var import_utils39 = require("@fuel-ts/utils");
|
8728
|
+
var WalletConfig = class {
|
8729
|
+
initialState;
|
8730
|
+
options;
|
8731
|
+
wallets;
|
8732
|
+
generateWallets = () => {
|
8733
|
+
const generatedWallets = [];
|
8734
|
+
for (let index = 1; index <= this.options.count; index++) {
|
8735
|
+
generatedWallets.push(new WalletUnlocked((0, import_crypto10.randomBytes)(32)));
|
8736
|
+
}
|
8737
|
+
return generatedWallets;
|
8738
|
+
};
|
8739
|
+
constructor(baseAssetId, config) {
|
8740
|
+
WalletConfig.validate(config);
|
8741
|
+
this.options = config;
|
8742
|
+
const { assets: assets2, coinsPerAsset, amountPerCoin, messages } = this.options;
|
8743
|
+
this.wallets = this.generateWallets();
|
8744
|
+
this.initialState = {
|
8745
|
+
messages: WalletConfig.createMessages(this.wallets, messages),
|
8746
|
+
coins: WalletConfig.createCoins(
|
8747
|
+
this.wallets,
|
8748
|
+
baseAssetId,
|
8749
|
+
assets2,
|
8750
|
+
coinsPerAsset,
|
8751
|
+
amountPerCoin
|
8752
|
+
)
|
8753
|
+
};
|
8754
|
+
}
|
8755
|
+
apply(snapshotConfig) {
|
8756
|
+
return {
|
8757
|
+
...snapshotConfig,
|
8758
|
+
stateConfig: {
|
8759
|
+
...snapshotConfig?.stateConfig ?? import_utils39.defaultSnapshotConfigs.stateConfig,
|
8760
|
+
coins: this.initialState.coins.concat(snapshotConfig?.stateConfig?.coins || []),
|
8761
|
+
messages: this.initialState.messages.concat(snapshotConfig?.stateConfig?.messages ?? [])
|
8762
|
+
}
|
8763
|
+
};
|
8764
|
+
}
|
8765
|
+
/**
|
8766
|
+
* Create messages for the wallets in the format that the chain expects.
|
8767
|
+
*/
|
8768
|
+
static createMessages(wallets, messages) {
|
8769
|
+
return messages.map((msg) => wallets.map((wallet) => msg.toChainMessage(wallet.address))).flatMap((x) => x);
|
8770
|
+
}
|
8771
|
+
/**
|
8772
|
+
* Create coins for the wallets in the format that the chain expects.
|
8773
|
+
*/
|
8774
|
+
static createCoins(wallets, baseAssetId, assets2, coinsPerAsset, amountPerCoin) {
|
8775
|
+
const coins = [];
|
8776
|
+
let assetIds = [baseAssetId];
|
8777
|
+
if (Array.isArray(assets2)) {
|
8778
|
+
assetIds = assetIds.concat(assets2.map((a) => a.value));
|
8779
|
+
} else {
|
8780
|
+
assetIds = assetIds.concat(AssetId.random(assets2).map((a) => a.value));
|
8781
|
+
}
|
8782
|
+
console.log("assetIds", assets2, assetIds);
|
8783
|
+
wallets.map((wallet) => wallet.address.toHexString()).forEach((walletAddress) => {
|
8784
|
+
assetIds.forEach((assetId) => {
|
8785
|
+
for (let index = 0; index < coinsPerAsset; index++) {
|
8786
|
+
coins.push({
|
8787
|
+
amount: amountPerCoin,
|
8788
|
+
asset_id: assetId,
|
8789
|
+
owner: walletAddress,
|
8790
|
+
tx_pointer_block_height: 0,
|
8791
|
+
tx_pointer_tx_idx: 0,
|
8792
|
+
output_index: 0,
|
8793
|
+
tx_id: (0, import_utils39.hexlify)((0, import_crypto10.randomBytes)(32))
|
8794
|
+
});
|
8795
|
+
}
|
8796
|
+
});
|
8797
|
+
});
|
8798
|
+
return coins;
|
8799
|
+
}
|
8800
|
+
static validate({
|
8801
|
+
count: wallets,
|
8802
|
+
assets: assets2,
|
8803
|
+
coinsPerAsset,
|
8804
|
+
amountPerCoin
|
8805
|
+
}) {
|
8806
|
+
if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
|
8807
|
+
throw new import_errors21.FuelError(
|
8808
|
+
import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
8809
|
+
"Number of wallets must be greater than zero."
|
8810
|
+
);
|
8811
|
+
}
|
8812
|
+
if (Array.isArray(assets2) && assets2.length === 0 || typeof assets2 === "number" && assets2 <= 0) {
|
8813
|
+
throw new import_errors21.FuelError(
|
8814
|
+
import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
8815
|
+
"Number of assets per wallet must be greater than zero."
|
8816
|
+
);
|
8817
|
+
}
|
8818
|
+
if (coinsPerAsset <= 0) {
|
8819
|
+
throw new import_errors21.FuelError(
|
8820
|
+
import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
8821
|
+
"Number of coins per asset must be greater than zero."
|
8822
|
+
);
|
8823
|
+
}
|
8824
|
+
if (amountPerCoin <= 0) {
|
8825
|
+
throw new import_errors21.FuelError(
|
8826
|
+
import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
|
8827
|
+
"Amount per coin must be greater than zero."
|
8828
|
+
);
|
8829
|
+
}
|
8830
|
+
}
|
8831
|
+
};
|
8832
|
+
|
8833
|
+
// src/test-utils/setup-test-provider-and-wallets.ts
|
8834
|
+
var defaultWalletConfigOptions = {
|
8835
|
+
count: 2,
|
8836
|
+
assets: [AssetId.A, AssetId.B],
|
8837
|
+
coinsPerAsset: 1,
|
8838
|
+
amountPerCoin: 1e10,
|
8839
|
+
messages: []
|
8840
|
+
};
|
8841
|
+
async function setupTestProviderAndWallets({
|
8842
|
+
walletConfig: walletConfigOptions = {},
|
8843
|
+
providerOptions,
|
8844
|
+
nodeOptions = {}
|
8845
|
+
} = {}) {
|
8846
|
+
Symbol.dispose ??= Symbol("Symbol.dispose");
|
8847
|
+
const walletConfig = new WalletConfig(
|
8848
|
+
nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils40.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
|
8849
|
+
{
|
8850
|
+
...defaultWalletConfigOptions,
|
8851
|
+
...walletConfigOptions
|
8852
|
+
}
|
8853
|
+
);
|
8854
|
+
const { cleanup, url } = await launchNode({
|
8855
|
+
loggingEnabled: false,
|
8856
|
+
...nodeOptions,
|
8857
|
+
snapshotConfig: (0, import_ramda5.mergeDeepRight)(
|
8858
|
+
import_utils40.defaultSnapshotConfigs,
|
8859
|
+
walletConfig.apply(nodeOptions?.snapshotConfig)
|
8860
|
+
),
|
8861
|
+
port: "0"
|
8862
|
+
});
|
8863
|
+
let provider;
|
8864
|
+
try {
|
8865
|
+
provider = await Provider.create(url, providerOptions);
|
8866
|
+
} catch (err) {
|
8867
|
+
cleanup();
|
8868
|
+
throw err;
|
8869
|
+
}
|
8870
|
+
const wallets = walletConfig.wallets;
|
8871
|
+
wallets.forEach((wallet) => {
|
8872
|
+
wallet.connect(provider);
|
8873
|
+
});
|
8874
|
+
return {
|
8875
|
+
provider,
|
8876
|
+
wallets,
|
8877
|
+
cleanup,
|
8878
|
+
[Symbol.dispose]: cleanup
|
8879
|
+
};
|
8880
|
+
}
|
8881
|
+
|
8882
|
+
// src/test-utils/test-message.ts
|
8883
|
+
var import_address7 = require("@fuel-ts/address");
|
8884
|
+
var import_crypto11 = require("@fuel-ts/crypto");
|
8885
|
+
var import_math23 = require("@fuel-ts/math");
|
8886
|
+
var import_utils41 = require("@fuel-ts/utils");
|
8887
|
+
var TestMessage = class {
|
8888
|
+
sender;
|
8889
|
+
recipient;
|
8890
|
+
nonce;
|
8891
|
+
amount;
|
8892
|
+
data;
|
8893
|
+
da_height;
|
8894
|
+
/**
|
8895
|
+
* A helper class to create messages for testing purposes.
|
8896
|
+
*
|
8897
|
+
* Used in tandem with `WalletConfig`.
|
8898
|
+
* It can also be used standalone and passed into the initial state of a chain via the `.toChainMessage` method.
|
8899
|
+
*/
|
8900
|
+
constructor({
|
8901
|
+
sender = import_address7.Address.fromRandom(),
|
8902
|
+
recipient = import_address7.Address.fromRandom(),
|
8903
|
+
nonce = (0, import_utils41.hexlify)((0, import_crypto11.randomBytes)(32)),
|
8904
|
+
amount = 1e6,
|
8905
|
+
data = "02",
|
8906
|
+
da_height = 0
|
8907
|
+
} = {}) {
|
8908
|
+
this.sender = sender;
|
8909
|
+
this.recipient = recipient;
|
8910
|
+
this.nonce = nonce;
|
8911
|
+
this.amount = amount;
|
8912
|
+
this.data = data;
|
8913
|
+
this.da_height = da_height;
|
8914
|
+
}
|
8915
|
+
toChainMessage(recipient) {
|
8916
|
+
return {
|
8917
|
+
sender: this.sender.toB256(),
|
8918
|
+
recipient: recipient?.toB256() ?? this.recipient.toB256(),
|
8919
|
+
nonce: this.nonce,
|
8920
|
+
amount: (0, import_math23.bn)(this.amount).toNumber(),
|
8921
|
+
data: this.data,
|
8922
|
+
da_height: this.da_height
|
8923
|
+
};
|
8924
|
+
}
|
8925
|
+
};
|
8693
8926
|
// Annotate the CommonJS export names for ESM import in node:
|
8694
8927
|
0 && (module.exports = {
|
8928
|
+
AssetId,
|
8929
|
+
TestMessage,
|
8930
|
+
WalletConfig,
|
8695
8931
|
generateTestWallet,
|
8696
8932
|
killNode,
|
8697
8933
|
launchNode,
|
8698
8934
|
launchNodeAndGetWallets,
|
8699
|
-
seedTestWallet
|
8935
|
+
seedTestWallet,
|
8936
|
+
setupTestProviderAndWallets
|
8700
8937
|
});
|
8701
8938
|
//# sourceMappingURL=test-utils.js.map
|