@fuel-ts/account 0.0.0-rc-2037-20240412171107 → 0.0.0-rc-1976-20240415100843
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/account.d.ts.map +1 -1
- package/dist/index.global.js +98 -65
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +134 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -65
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +1 -9
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +2 -2
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +1 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +0 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +7 -0
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +25 -4
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +102 -51
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +137 -88
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +99 -50
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/test-utils.mjs
CHANGED
@@ -24,14 +24,12 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
|
|
24
24
|
|
25
25
|
// src/account.ts
|
26
26
|
import { Address as Address3 } from "@fuel-ts/address";
|
27
|
-
import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
|
28
27
|
import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
|
29
28
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
30
29
|
import { bn as bn17 } from "@fuel-ts/math";
|
31
30
|
import { arrayify as arrayify14 } from "@fuel-ts/utils";
|
32
31
|
|
33
32
|
// src/providers/coin-quantity.ts
|
34
|
-
import { BaseAssetId } from "@fuel-ts/address/configs";
|
35
33
|
import { bn } from "@fuel-ts/math";
|
36
34
|
import { hexlify } from "@fuel-ts/utils";
|
37
35
|
var coinQuantityfy = (coinQuantityLike) => {
|
@@ -40,11 +38,11 @@ var coinQuantityfy = (coinQuantityLike) => {
|
|
40
38
|
let max2;
|
41
39
|
if (Array.isArray(coinQuantityLike)) {
|
42
40
|
amount = coinQuantityLike[0];
|
43
|
-
assetId = coinQuantityLike[1]
|
44
|
-
max2 = coinQuantityLike[2]
|
41
|
+
assetId = coinQuantityLike[1];
|
42
|
+
max2 = coinQuantityLike[2];
|
45
43
|
} else {
|
46
44
|
amount = coinQuantityLike.amount;
|
47
|
-
assetId = coinQuantityLike.assetId
|
45
|
+
assetId = coinQuantityLike.assetId;
|
48
46
|
max2 = coinQuantityLike.max ?? void 0;
|
49
47
|
}
|
50
48
|
const bnAmount = bn(amount);
|
@@ -1153,7 +1151,7 @@ var outputify = (value) => {
|
|
1153
1151
|
// src/providers/transaction-request/transaction-request.ts
|
1154
1152
|
import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
|
1155
1153
|
import { Address, addressify } from "@fuel-ts/address";
|
1156
|
-
import {
|
1154
|
+
import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
|
1157
1155
|
import { randomBytes } from "@fuel-ts/crypto";
|
1158
1156
|
import { bn as bn7 } from "@fuel-ts/math";
|
1159
1157
|
import {
|
@@ -1614,6 +1612,8 @@ var BaseTransactionRequest = class {
|
|
1614
1612
|
outputs = [];
|
1615
1613
|
/** List of witnesses */
|
1616
1614
|
witnesses = [];
|
1615
|
+
/** Base asset ID - should be fetched from the chain */
|
1616
|
+
baseAssetId;
|
1617
1617
|
/**
|
1618
1618
|
* Constructor for initializing a base transaction request.
|
1619
1619
|
*
|
@@ -1626,8 +1626,9 @@ var BaseTransactionRequest = class {
|
|
1626
1626
|
witnessLimit,
|
1627
1627
|
inputs,
|
1628
1628
|
outputs,
|
1629
|
-
witnesses
|
1630
|
-
|
1629
|
+
witnesses,
|
1630
|
+
baseAssetId
|
1631
|
+
}) {
|
1631
1632
|
this.gasPrice = bn7(gasPrice);
|
1632
1633
|
this.maturity = maturity ?? 0;
|
1633
1634
|
this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
|
@@ -1635,6 +1636,7 @@ var BaseTransactionRequest = class {
|
|
1635
1636
|
this.inputs = inputs ?? [];
|
1636
1637
|
this.outputs = outputs ?? [];
|
1637
1638
|
this.witnesses = witnesses ?? [];
|
1639
|
+
this.baseAssetId = baseAssetId;
|
1638
1640
|
}
|
1639
1641
|
static getPolicyMeta(req) {
|
1640
1642
|
let policyTypes = 0;
|
@@ -1828,8 +1830,8 @@ var BaseTransactionRequest = class {
|
|
1828
1830
|
* @param predicate - Predicate bytes.
|
1829
1831
|
* @param predicateData - Predicate data bytes.
|
1830
1832
|
*/
|
1831
|
-
addCoinInput(coin) {
|
1832
|
-
const { assetId, owner, amount
|
1833
|
+
addCoinInput(coin, predicate) {
|
1834
|
+
const { assetId, owner, amount } = coin;
|
1833
1835
|
let witnessIndex;
|
1834
1836
|
if (predicate) {
|
1835
1837
|
witnessIndex = 0;
|
@@ -1840,14 +1842,14 @@ var BaseTransactionRequest = class {
|
|
1840
1842
|
}
|
1841
1843
|
}
|
1842
1844
|
const input = {
|
1843
|
-
|
1845
|
+
...coin,
|
1844
1846
|
type: InputType2.Coin,
|
1845
1847
|
owner: owner.toB256(),
|
1846
1848
|
amount,
|
1847
1849
|
assetId,
|
1848
1850
|
txPointer: "0x00000000000000000000000000000000",
|
1849
1851
|
witnessIndex,
|
1850
|
-
predicate
|
1852
|
+
predicate: predicate?.bytes
|
1851
1853
|
};
|
1852
1854
|
this.pushInput(input);
|
1853
1855
|
this.addChangeOutput(owner, assetId);
|
@@ -1858,11 +1860,9 @@ var BaseTransactionRequest = class {
|
|
1858
1860
|
*
|
1859
1861
|
* @param message - Message resource.
|
1860
1862
|
* @param predicate - Predicate bytes.
|
1861
|
-
* @param predicateData - Predicate data bytes.
|
1862
1863
|
*/
|
1863
|
-
addMessageInput(message) {
|
1864
|
-
const { recipient, sender, amount
|
1865
|
-
const assetId = BaseAssetId2;
|
1864
|
+
addMessageInput(message, predicate) {
|
1865
|
+
const { recipient, sender, amount } = message;
|
1866
1866
|
let witnessIndex;
|
1867
1867
|
if (predicate) {
|
1868
1868
|
witnessIndex = 0;
|
@@ -1873,16 +1873,16 @@ var BaseTransactionRequest = class {
|
|
1873
1873
|
}
|
1874
1874
|
}
|
1875
1875
|
const input = {
|
1876
|
-
|
1876
|
+
...message,
|
1877
1877
|
type: InputType2.Message,
|
1878
1878
|
sender: sender.toB256(),
|
1879
1879
|
recipient: recipient.toB256(),
|
1880
1880
|
amount,
|
1881
1881
|
witnessIndex,
|
1882
|
-
predicate
|
1882
|
+
predicate: predicate?.bytes
|
1883
1883
|
};
|
1884
1884
|
this.pushInput(input);
|
1885
|
-
this.addChangeOutput(recipient,
|
1885
|
+
this.addChangeOutput(recipient, this.baseAssetId);
|
1886
1886
|
}
|
1887
1887
|
/**
|
1888
1888
|
* Adds a single resource to the transaction by adding a coin/message input and a
|
@@ -1910,6 +1910,32 @@ var BaseTransactionRequest = class {
|
|
1910
1910
|
resources.forEach((resource) => this.addResource(resource));
|
1911
1911
|
return this;
|
1912
1912
|
}
|
1913
|
+
/**
|
1914
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
1915
|
+
* outputs from the related assetIds.
|
1916
|
+
*
|
1917
|
+
* @param resources - The resources to add.
|
1918
|
+
* @returns This transaction.
|
1919
|
+
*/
|
1920
|
+
addPredicateResource(resource, predicate) {
|
1921
|
+
if (isCoin(resource)) {
|
1922
|
+
this.addCoinInput(resource, predicate);
|
1923
|
+
} else {
|
1924
|
+
this.addMessageInput(resource, predicate);
|
1925
|
+
}
|
1926
|
+
return this;
|
1927
|
+
}
|
1928
|
+
/**
|
1929
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
1930
|
+
* from the related assetIds.
|
1931
|
+
*
|
1932
|
+
* @param resources - The resources to add.
|
1933
|
+
* @returns This transaction.
|
1934
|
+
*/
|
1935
|
+
addPredicateResources(resources, predicate) {
|
1936
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
1937
|
+
return this;
|
1938
|
+
}
|
1913
1939
|
/**
|
1914
1940
|
* Adds a coin output to the transaction.
|
1915
1941
|
*
|
@@ -1917,12 +1943,12 @@ var BaseTransactionRequest = class {
|
|
1917
1943
|
* @param amount - Amount of coin.
|
1918
1944
|
* @param assetId - Asset ID of coin.
|
1919
1945
|
*/
|
1920
|
-
addCoinOutput(to, amount, assetId
|
1946
|
+
addCoinOutput(to, amount, assetId) {
|
1921
1947
|
this.pushOutput({
|
1922
1948
|
type: OutputType2.Coin,
|
1923
1949
|
to: addressify(to).toB256(),
|
1924
1950
|
amount,
|
1925
|
-
assetId
|
1951
|
+
assetId: assetId ?? this.baseAssetId
|
1926
1952
|
});
|
1927
1953
|
return this;
|
1928
1954
|
}
|
@@ -1949,7 +1975,7 @@ var BaseTransactionRequest = class {
|
|
1949
1975
|
* @param to - Address of the owner.
|
1950
1976
|
* @param assetId - Asset ID of coin.
|
1951
1977
|
*/
|
1952
|
-
addChangeOutput(to, assetId
|
1978
|
+
addChangeOutput(to, assetId) {
|
1953
1979
|
const changeOutput = this.getChangeOutputs().find(
|
1954
1980
|
(output) => hexlify7(output.assetId) === assetId
|
1955
1981
|
);
|
@@ -1957,7 +1983,7 @@ var BaseTransactionRequest = class {
|
|
1957
1983
|
this.pushOutput({
|
1958
1984
|
type: OutputType2.Change,
|
1959
1985
|
to: addressify(to).toB256(),
|
1960
|
-
assetId
|
1986
|
+
assetId: assetId ?? this.baseAssetId
|
1961
1987
|
});
|
1962
1988
|
}
|
1963
1989
|
}
|
@@ -2033,7 +2059,7 @@ var BaseTransactionRequest = class {
|
|
2033
2059
|
]);
|
2034
2060
|
}
|
2035
2061
|
};
|
2036
|
-
updateAssetInput(
|
2062
|
+
updateAssetInput(this.baseAssetId, bn7(1e11));
|
2037
2063
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
2038
2064
|
}
|
2039
2065
|
/**
|
@@ -2203,12 +2229,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2203
2229
|
*
|
2204
2230
|
* @param createTransactionRequestLike - The initial values for the instance
|
2205
2231
|
*/
|
2206
|
-
constructor({
|
2207
|
-
bytecodeWitnessIndex,
|
2208
|
-
salt,
|
2209
|
-
storageSlots,
|
2210
|
-
...rest
|
2211
|
-
} = {}) {
|
2232
|
+
constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
|
2212
2233
|
super(rest);
|
2213
2234
|
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
2214
2235
|
this.salt = hexlify9(salt ?? ZeroBytes326);
|
@@ -2332,7 +2353,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2332
2353
|
*
|
2333
2354
|
* @param scriptTransactionRequestLike - The initial values for the instance.
|
2334
2355
|
*/
|
2335
|
-
constructor({ script, scriptData, gasLimit, ...rest }
|
2356
|
+
constructor({ script, scriptData, gasLimit, ...rest }) {
|
2336
2357
|
super(rest);
|
2337
2358
|
this.gasLimit = bn10(gasLimit);
|
2338
2359
|
this.script = arrayify8(script ?? returnZeroScript.bytes);
|
@@ -3460,6 +3481,7 @@ var processGqlChain = (chain) => {
|
|
3460
3481
|
gasPerByte: bn15(feeParams.gasPerByte),
|
3461
3482
|
maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
|
3462
3483
|
chainId: bn15(consensusParameters.chainId),
|
3484
|
+
baseAssetId: consensusParameters.baseAssetId,
|
3463
3485
|
gasCosts
|
3464
3486
|
},
|
3465
3487
|
gasCosts,
|
@@ -3702,6 +3724,17 @@ var _Provider = class {
|
|
3702
3724
|
} = this.getChain();
|
3703
3725
|
return chainId.toNumber();
|
3704
3726
|
}
|
3727
|
+
/**
|
3728
|
+
* Returns the base asset ID
|
3729
|
+
*
|
3730
|
+
* @returns A promise that resolves to the base asset ID
|
3731
|
+
*/
|
3732
|
+
getBaseAssetId() {
|
3733
|
+
const {
|
3734
|
+
consensusParameters: { baseAssetId }
|
3735
|
+
} = this.getChain();
|
3736
|
+
return baseAssetId;
|
3737
|
+
}
|
3705
3738
|
/**
|
3706
3739
|
* Submits a transaction to the chain to be executed.
|
3707
3740
|
*
|
@@ -4599,8 +4632,9 @@ var Account = class extends AbstractAccount {
|
|
4599
4632
|
* @param assetId - The asset ID to check the balance for.
|
4600
4633
|
* @returns A promise that resolves to the balance amount.
|
4601
4634
|
*/
|
4602
|
-
async getBalance(assetId
|
4603
|
-
const
|
4635
|
+
async getBalance(assetId) {
|
4636
|
+
const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
|
4637
|
+
const amount = await this.provider.getBalance(this.address, assetIdToFetch);
|
4604
4638
|
return amount;
|
4605
4639
|
}
|
4606
4640
|
/**
|
@@ -4638,9 +4672,10 @@ var Account = class extends AbstractAccount {
|
|
4638
4672
|
* @returns A promise that resolves when the resources are added to the transaction.
|
4639
4673
|
*/
|
4640
4674
|
async fund(request, coinQuantities, fee) {
|
4675
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
4641
4676
|
const updatedQuantities = addAmountToAsset({
|
4642
4677
|
amount: bn17(fee),
|
4643
|
-
assetId:
|
4678
|
+
assetId: baseAssetId,
|
4644
4679
|
coinQuantities
|
4645
4680
|
});
|
4646
4681
|
const quantitiesDict = {};
|
@@ -4664,8 +4699,8 @@ var Account = class extends AbstractAccount {
|
|
4664
4699
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
4665
4700
|
cachedUtxos.push(input.id);
|
4666
4701
|
}
|
4667
|
-
} else if (input.recipient === owner && input.amount && quantitiesDict[
|
4668
|
-
quantitiesDict[
|
4702
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
|
4703
|
+
quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
|
4669
4704
|
cachedMessages.push(input.nonce);
|
4670
4705
|
}
|
4671
4706
|
}
|
@@ -4697,11 +4732,13 @@ var Account = class extends AbstractAccount {
|
|
4697
4732
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
4698
4733
|
* @returns A promise that resolves to the prepared transaction request.
|
4699
4734
|
*/
|
4700
|
-
async createTransfer(destination, amount, assetId
|
4735
|
+
async createTransfer(destination, amount, assetId, txParams = {}) {
|
4701
4736
|
const { minGasPrice } = this.provider.getGasConfig();
|
4702
|
-
const
|
4737
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
4738
|
+
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
4739
|
+
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
4703
4740
|
const request = new ScriptTransactionRequest(params);
|
4704
|
-
request.addCoinOutput(Address3.fromAddressOrString(destination), amount,
|
4741
|
+
request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetIdToTransfer);
|
4705
4742
|
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
4706
4743
|
estimateTxDependencies: true,
|
4707
4744
|
resourcesOwner: this
|
@@ -4727,14 +4764,15 @@ var Account = class extends AbstractAccount {
|
|
4727
4764
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
4728
4765
|
* @returns A promise that resolves to the transaction response.
|
4729
4766
|
*/
|
4730
|
-
async transfer(destination, amount, assetId
|
4767
|
+
async transfer(destination, amount, assetId, txParams = {}) {
|
4731
4768
|
if (bn17(amount).lte(0)) {
|
4732
4769
|
throw new FuelError15(
|
4733
4770
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
4734
4771
|
"Transfer amount must be a positive number."
|
4735
4772
|
);
|
4736
4773
|
}
|
4737
|
-
const
|
4774
|
+
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
4775
|
+
const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
4738
4776
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
4739
4777
|
}
|
4740
4778
|
/**
|
@@ -4746,7 +4784,7 @@ var Account = class extends AbstractAccount {
|
|
4746
4784
|
* @param txParams - The optional transaction parameters.
|
4747
4785
|
* @returns A promise that resolves to the transaction response.
|
4748
4786
|
*/
|
4749
|
-
async transferToContract(contractId, amount, assetId
|
4787
|
+
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
4750
4788
|
if (bn17(amount).lte(0)) {
|
4751
4789
|
throw new FuelError15(
|
4752
4790
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
@@ -4755,11 +4793,13 @@ var Account = class extends AbstractAccount {
|
|
4755
4793
|
}
|
4756
4794
|
const contractAddress = Address3.fromAddressOrString(contractId);
|
4757
4795
|
const { minGasPrice } = this.provider.getGasConfig();
|
4758
|
-
const
|
4796
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
4797
|
+
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
4798
|
+
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
4759
4799
|
const { script, scriptData } = await assembleTransferToContractScript({
|
4760
4800
|
hexlifiedContractId: contractAddress.toB256(),
|
4761
4801
|
amountToTransfer: bn17(amount),
|
4762
|
-
assetId
|
4802
|
+
assetId: assetIdToTransfer
|
4763
4803
|
});
|
4764
4804
|
const request = new ScriptTransactionRequest({
|
4765
4805
|
...params,
|
@@ -4769,7 +4809,7 @@ var Account = class extends AbstractAccount {
|
|
4769
4809
|
request.addContractInputAndOutput(contractAddress);
|
4770
4810
|
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
4771
4811
|
request,
|
4772
|
-
[{ amount: bn17(amount), assetId: String(
|
4812
|
+
[{ amount: bn17(amount), assetId: String(assetIdToTransfer) }]
|
4773
4813
|
);
|
4774
4814
|
request.gasLimit = bn17(params.gasLimit ?? gasUsed);
|
4775
4815
|
this.validateGas({
|
@@ -4791,6 +4831,7 @@ var Account = class extends AbstractAccount {
|
|
4791
4831
|
*/
|
4792
4832
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
4793
4833
|
const { minGasPrice } = this.provider.getGasConfig();
|
4834
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
4794
4835
|
const recipientAddress = Address3.fromAddressOrString(recipient);
|
4795
4836
|
const recipientDataArray = arrayify14(
|
4796
4837
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -4803,9 +4844,14 @@ var Account = class extends AbstractAccount {
|
|
4803
4844
|
...recipientDataArray,
|
4804
4845
|
...amountDataArray
|
4805
4846
|
]);
|
4806
|
-
const params = {
|
4847
|
+
const params = {
|
4848
|
+
script,
|
4849
|
+
gasPrice: minGasPrice,
|
4850
|
+
baseAssetId,
|
4851
|
+
...txParams
|
4852
|
+
};
|
4807
4853
|
const request = new ScriptTransactionRequest(params);
|
4808
|
-
const forwardingQuantities = [{ amount: bn17(amount), assetId:
|
4854
|
+
const forwardingQuantities = [{ amount: bn17(amount), assetId: baseAssetId }];
|
4809
4855
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
4810
4856
|
request,
|
4811
4857
|
forwardingQuantities
|
@@ -7958,7 +8004,9 @@ var seedTestWallet = async (wallet, quantities) => {
|
|
7958
8004
|
);
|
7959
8005
|
const resources = await genesisWallet.getResourcesToSpend(quantities);
|
7960
8006
|
const { minGasPrice } = genesisWallet.provider.getGasConfig();
|
8007
|
+
const baseAssetId = genesisWallet.provider.getBaseAssetId();
|
7961
8008
|
const request = new ScriptTransactionRequest({
|
8009
|
+
baseAssetId,
|
7962
8010
|
gasLimit: 1e4,
|
7963
8011
|
gasPrice: minGasPrice
|
7964
8012
|
});
|
@@ -7977,7 +8025,7 @@ var generateTestWallet = async (provider, quantities) => {
|
|
7977
8025
|
};
|
7978
8026
|
|
7979
8027
|
// src/test-utils/launchNode.ts
|
7980
|
-
import {
|
8028
|
+
import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
|
7981
8029
|
import { toHex as toHex2 } from "@fuel-ts/math";
|
7982
8030
|
import { defaultChainConfig, defaultConsensusKey, hexlify as hexlify18 } from "@fuel-ts/utils";
|
7983
8031
|
import { findBinPath } from "@fuel-ts/utils/cli-utils";
|
@@ -8077,7 +8125,7 @@ var launchNode = async ({
|
|
8077
8125
|
{
|
8078
8126
|
owner: signer.address.toHexString(),
|
8079
8127
|
amount: toHex2(1e9),
|
8080
|
-
asset_id:
|
8128
|
+
asset_id: defaultChainConfig?.consensus_parameters?.base_asset_id ?? ZeroBytes329
|
8081
8129
|
}
|
8082
8130
|
]
|
8083
8131
|
}
|
@@ -8143,9 +8191,10 @@ var launchNode = async ({
|
|
8143
8191
|
})
|
8144
8192
|
);
|
8145
8193
|
var generateWallets = async (count, provider) => {
|
8194
|
+
const baseAssetId = provider.getBaseAssetId();
|
8146
8195
|
const wallets = [];
|
8147
8196
|
for (let i = 0; i < count; i += 1) {
|
8148
|
-
const wallet = await generateTestWallet(provider, [[1e3,
|
8197
|
+
const wallet = await generateTestWallet(provider, [[1e3, baseAssetId]]);
|
8149
8198
|
wallets.push(wallet);
|
8150
8199
|
}
|
8151
8200
|
return wallets;
|