@fuel-ts/account 0.0.0-rc-2037-20240422095321 → 0.0.0-rc-2130-20240422142413
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/hdwallet/hdwallet.d.ts.map +1 -1
- package/dist/index.global.js +1407 -2588
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +154 -230
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -140
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/predicate/predicate.d.ts +2 -17
- package/dist/predicate/predicate.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 +0 -9
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/index.d.ts +0 -1
- package/dist/providers/transaction-request/index.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +20 -4
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/test-utils/index.d.ts +0 -1
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +1448 -2606
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +149 -203
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +70 -121
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +15 -16
- package/dist/providers/transaction-request/helpers.d.ts +0 -10
- package/dist/providers/transaction-request/helpers.d.ts.map +0 -1
- package/dist/test-utils/resources.d.ts +0 -4
- package/dist/test-utils/resources.d.ts.map +0 -1
- package/dist/test-utils/transactionRequest.d.ts +0 -5
- package/dist/test-utils/transactionRequest.d.ts.map +0 -1
package/dist/test-utils.mjs
CHANGED
@@ -71,7 +71,7 @@ import { Address as Address2 } from "@fuel-ts/address";
|
|
71
71
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
72
72
|
import { BN, bn as bn15, max } from "@fuel-ts/math";
|
73
73
|
import {
|
74
|
-
InputType as
|
74
|
+
InputType as InputType6,
|
75
75
|
TransactionType as TransactionType8,
|
76
76
|
InputMessageCoder,
|
77
77
|
TransactionCoder as TransactionCoder5
|
@@ -79,7 +79,6 @@ import {
|
|
79
79
|
import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
|
80
80
|
import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
|
81
81
|
import { equalBytes } from "@noble/curves/abstract/utils";
|
82
|
-
import { Network } from "ethers";
|
83
82
|
import { GraphQLClient } from "graphql-request";
|
84
83
|
import { clone as clone3 } from "ramda";
|
85
84
|
|
@@ -1168,7 +1167,7 @@ import { bn as bn7 } from "@fuel-ts/math";
|
|
1168
1167
|
import {
|
1169
1168
|
PolicyType,
|
1170
1169
|
TransactionCoder,
|
1171
|
-
InputType as
|
1170
|
+
InputType as InputType2,
|
1172
1171
|
OutputType as OutputType2,
|
1173
1172
|
TransactionType
|
1174
1173
|
} from "@fuel-ts/transactions";
|
@@ -1597,12 +1596,6 @@ var NoWitnessAtIndexError = class extends Error {
|
|
1597
1596
|
name = "NoWitnessAtIndexError";
|
1598
1597
|
};
|
1599
1598
|
|
1600
|
-
// src/providers/transaction-request/helpers.ts
|
1601
|
-
import { InputType as InputType2 } from "@fuel-ts/transactions";
|
1602
|
-
var isRequestInputCoin = (input) => input.type === InputType2.Coin;
|
1603
|
-
var isRequestInputMessage = (input) => input.type === InputType2.Message;
|
1604
|
-
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
1605
|
-
|
1606
1599
|
// src/providers/transaction-request/witness.ts
|
1607
1600
|
import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
|
1608
1601
|
var witnessify = (value) => {
|
@@ -1793,7 +1786,7 @@ var BaseTransactionRequest = class {
|
|
1793
1786
|
*/
|
1794
1787
|
getCoinInputs() {
|
1795
1788
|
return this.inputs.filter(
|
1796
|
-
(input) => input.type ===
|
1789
|
+
(input) => input.type === InputType2.Coin
|
1797
1790
|
);
|
1798
1791
|
}
|
1799
1792
|
/**
|
@@ -1825,9 +1818,9 @@ var BaseTransactionRequest = class {
|
|
1825
1818
|
const ownerAddress = addressify(owner);
|
1826
1819
|
const found = this.inputs.find((input) => {
|
1827
1820
|
switch (input.type) {
|
1828
|
-
case
|
1821
|
+
case InputType2.Coin:
|
1829
1822
|
return hexlify7(input.owner) === ownerAddress.toB256();
|
1830
|
-
case
|
1823
|
+
case InputType2.Message:
|
1831
1824
|
return hexlify7(input.recipient) === ownerAddress.toB256();
|
1832
1825
|
default:
|
1833
1826
|
return false;
|
@@ -1843,8 +1836,8 @@ var BaseTransactionRequest = class {
|
|
1843
1836
|
* @param predicate - Predicate bytes.
|
1844
1837
|
* @param predicateData - Predicate data bytes.
|
1845
1838
|
*/
|
1846
|
-
addCoinInput(coin) {
|
1847
|
-
const { assetId, owner, amount
|
1839
|
+
addCoinInput(coin, predicate) {
|
1840
|
+
const { assetId, owner, amount } = coin;
|
1848
1841
|
let witnessIndex;
|
1849
1842
|
if (predicate) {
|
1850
1843
|
witnessIndex = 0;
|
@@ -1855,14 +1848,14 @@ var BaseTransactionRequest = class {
|
|
1855
1848
|
}
|
1856
1849
|
}
|
1857
1850
|
const input = {
|
1858
|
-
|
1859
|
-
type:
|
1851
|
+
...coin,
|
1852
|
+
type: InputType2.Coin,
|
1860
1853
|
owner: owner.toB256(),
|
1861
1854
|
amount,
|
1862
1855
|
assetId,
|
1863
1856
|
txPointer: "0x00000000000000000000000000000000",
|
1864
1857
|
witnessIndex,
|
1865
|
-
predicate
|
1858
|
+
predicate: predicate?.bytes
|
1866
1859
|
};
|
1867
1860
|
this.pushInput(input);
|
1868
1861
|
this.addChangeOutput(owner, assetId);
|
@@ -1875,8 +1868,8 @@ var BaseTransactionRequest = class {
|
|
1875
1868
|
* @param predicate - Predicate bytes.
|
1876
1869
|
* @param predicateData - Predicate data bytes.
|
1877
1870
|
*/
|
1878
|
-
addMessageInput(message) {
|
1879
|
-
const { recipient, sender, amount
|
1871
|
+
addMessageInput(message, predicate) {
|
1872
|
+
const { recipient, sender, amount } = message;
|
1880
1873
|
const assetId = BaseAssetId2;
|
1881
1874
|
let witnessIndex;
|
1882
1875
|
if (predicate) {
|
@@ -1888,13 +1881,13 @@ var BaseTransactionRequest = class {
|
|
1888
1881
|
}
|
1889
1882
|
}
|
1890
1883
|
const input = {
|
1891
|
-
|
1892
|
-
type:
|
1884
|
+
...message,
|
1885
|
+
type: InputType2.Message,
|
1893
1886
|
sender: sender.toB256(),
|
1894
1887
|
recipient: recipient.toB256(),
|
1895
1888
|
amount,
|
1896
1889
|
witnessIndex,
|
1897
|
-
predicate
|
1890
|
+
predicate: predicate?.bytes
|
1898
1891
|
};
|
1899
1892
|
this.pushInput(input);
|
1900
1893
|
this.addChangeOutput(recipient, assetId);
|
@@ -1925,6 +1918,32 @@ var BaseTransactionRequest = class {
|
|
1925
1918
|
resources.forEach((resource) => this.addResource(resource));
|
1926
1919
|
return this;
|
1927
1920
|
}
|
1921
|
+
/**
|
1922
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
1923
|
+
* outputs from the related assetIds.
|
1924
|
+
*
|
1925
|
+
* @param resources - The resources to add.
|
1926
|
+
* @returns This transaction.
|
1927
|
+
*/
|
1928
|
+
addPredicateResource(resource, predicate) {
|
1929
|
+
if (isCoin(resource)) {
|
1930
|
+
this.addCoinInput(resource, predicate);
|
1931
|
+
} else {
|
1932
|
+
this.addMessageInput(resource, predicate);
|
1933
|
+
}
|
1934
|
+
return this;
|
1935
|
+
}
|
1936
|
+
/**
|
1937
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
1938
|
+
* from the related assetIds.
|
1939
|
+
*
|
1940
|
+
* @param resources - The resources to add.
|
1941
|
+
* @returns This transaction.
|
1942
|
+
*/
|
1943
|
+
addPredicateResources(resources, predicate) {
|
1944
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
1945
|
+
return this;
|
1946
|
+
}
|
1928
1947
|
/**
|
1929
1948
|
* Adds a coin output to the transaction.
|
1930
1949
|
*
|
@@ -2073,20 +2092,16 @@ var BaseTransactionRequest = class {
|
|
2073
2092
|
toJSON() {
|
2074
2093
|
return normalizeJSON(this);
|
2075
2094
|
}
|
2076
|
-
removeWitness(index) {
|
2077
|
-
this.witnesses.splice(index, 1);
|
2078
|
-
this.adjustWitnessIndexes(index);
|
2079
|
-
}
|
2080
2095
|
updatePredicateInputs(inputs) {
|
2081
2096
|
this.inputs.forEach((i) => {
|
2082
2097
|
let correspondingInput;
|
2083
2098
|
switch (i.type) {
|
2084
|
-
case
|
2085
|
-
correspondingInput = inputs.find((x) => x.type ===
|
2099
|
+
case InputType2.Coin:
|
2100
|
+
correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
|
2086
2101
|
break;
|
2087
|
-
case
|
2102
|
+
case InputType2.Message:
|
2088
2103
|
correspondingInput = inputs.find(
|
2089
|
-
(x) => x.type ===
|
2104
|
+
(x) => x.type === InputType2.Message && x.sender === i.sender
|
2090
2105
|
);
|
2091
2106
|
break;
|
2092
2107
|
default:
|
@@ -2099,13 +2114,6 @@ var BaseTransactionRequest = class {
|
|
2099
2114
|
}
|
2100
2115
|
});
|
2101
2116
|
}
|
2102
|
-
adjustWitnessIndexes(removedIndex) {
|
2103
|
-
this.inputs.filter(isRequestInputResource).forEach((input) => {
|
2104
|
-
if (input.witnessIndex > removedIndex) {
|
2105
|
-
input.witnessIndex -= 1;
|
2106
|
-
}
|
2107
|
-
});
|
2108
|
-
}
|
2109
2117
|
};
|
2110
2118
|
|
2111
2119
|
// src/providers/transaction-request/create-transaction-request.ts
|
@@ -2118,7 +2126,7 @@ import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
|
|
2118
2126
|
import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
|
2119
2127
|
import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
|
2120
2128
|
import { bn as bn8 } from "@fuel-ts/math";
|
2121
|
-
import { TransactionType as TransactionType2, InputType as
|
2129
|
+
import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
|
2122
2130
|
import { concat as concat2 } from "@fuel-ts/utils";
|
2123
2131
|
import { clone as clone2 } from "ramda";
|
2124
2132
|
function hashTransaction(transactionRequest, chainId) {
|
@@ -2129,7 +2137,7 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2129
2137
|
transaction.inputs = transaction.inputs.map((input) => {
|
2130
2138
|
const inputClone = clone2(input);
|
2131
2139
|
switch (inputClone.type) {
|
2132
|
-
case
|
2140
|
+
case InputType3.Coin: {
|
2133
2141
|
inputClone.txPointer = {
|
2134
2142
|
blockHeight: 0,
|
2135
2143
|
txIndex: 0
|
@@ -2137,11 +2145,11 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2137
2145
|
inputClone.predicateGasUsed = bn8(0);
|
2138
2146
|
return inputClone;
|
2139
2147
|
}
|
2140
|
-
case
|
2148
|
+
case InputType3.Message: {
|
2141
2149
|
inputClone.predicateGasUsed = bn8(0);
|
2142
2150
|
return inputClone;
|
2143
2151
|
}
|
2144
|
-
case
|
2152
|
+
case InputType3.Contract: {
|
2145
2153
|
inputClone.txPointer = {
|
2146
2154
|
blockHeight: 0,
|
2147
2155
|
txIndex: 0
|
@@ -2307,7 +2315,7 @@ import { Interface } from "@fuel-ts/abi-coder";
|
|
2307
2315
|
import { addressify as addressify2 } from "@fuel-ts/address";
|
2308
2316
|
import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
|
2309
2317
|
import { bn as bn10 } from "@fuel-ts/math";
|
2310
|
-
import { InputType as
|
2318
|
+
import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
|
2311
2319
|
import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
|
2312
2320
|
|
2313
2321
|
// src/providers/transaction-request/scripts.ts
|
@@ -2391,7 +2399,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2391
2399
|
*/
|
2392
2400
|
getContractInputs() {
|
2393
2401
|
return this.inputs.filter(
|
2394
|
-
(input) => input.type ===
|
2402
|
+
(input) => input.type === InputType4.Contract
|
2395
2403
|
);
|
2396
2404
|
}
|
2397
2405
|
/**
|
@@ -2467,7 +2475,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2467
2475
|
return this;
|
2468
2476
|
}
|
2469
2477
|
const inputIndex = super.pushInput({
|
2470
|
-
type:
|
2478
|
+
type: InputType4.Contract,
|
2471
2479
|
contractId: contractAddress.toB256(),
|
2472
2480
|
txPointer: "0x00000000000000000000000000000000"
|
2473
2481
|
});
|
@@ -2662,7 +2670,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2662
2670
|
|
2663
2671
|
// src/providers/transaction-summary/input.ts
|
2664
2672
|
import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2665
|
-
import { InputType as
|
2673
|
+
import { InputType as InputType5 } from "@fuel-ts/transactions";
|
2666
2674
|
function getInputsByTypes(inputs, types) {
|
2667
2675
|
return inputs.filter((i) => types.includes(i.type));
|
2668
2676
|
}
|
@@ -2670,16 +2678,16 @@ function getInputsByType(inputs, type) {
|
|
2670
2678
|
return inputs.filter((i) => i.type === type);
|
2671
2679
|
}
|
2672
2680
|
function getInputsCoin(inputs) {
|
2673
|
-
return getInputsByType(inputs,
|
2681
|
+
return getInputsByType(inputs, InputType5.Coin);
|
2674
2682
|
}
|
2675
2683
|
function getInputsMessage(inputs) {
|
2676
|
-
return getInputsByType(inputs,
|
2684
|
+
return getInputsByType(inputs, InputType5.Message);
|
2677
2685
|
}
|
2678
2686
|
function getInputsCoinAndMessage(inputs) {
|
2679
|
-
return getInputsByTypes(inputs, [
|
2687
|
+
return getInputsByTypes(inputs, [InputType5.Coin, InputType5.Message]);
|
2680
2688
|
}
|
2681
2689
|
function getInputsContract(inputs) {
|
2682
|
-
return getInputsByType(inputs,
|
2690
|
+
return getInputsByType(inputs, InputType5.Contract);
|
2683
2691
|
}
|
2684
2692
|
function getInputFromAssetId(inputs, assetId) {
|
2685
2693
|
const coinInputs = getInputsCoin(inputs);
|
@@ -2698,7 +2706,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2698
2706
|
if (!contractInput) {
|
2699
2707
|
return void 0;
|
2700
2708
|
}
|
2701
|
-
if (contractInput.type !==
|
2709
|
+
if (contractInput.type !== InputType5.Contract) {
|
2702
2710
|
throw new FuelError9(
|
2703
2711
|
ErrorCode9.INVALID_TRANSACTION_INPUT,
|
2704
2712
|
`Contract input should be of type 'contract'.`
|
@@ -2707,10 +2715,10 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2707
2715
|
return contractInput;
|
2708
2716
|
}
|
2709
2717
|
function getInputAccountAddress(input) {
|
2710
|
-
if (input.type ===
|
2718
|
+
if (input.type === InputType5.Coin) {
|
2711
2719
|
return input.owner.toString();
|
2712
2720
|
}
|
2713
|
-
if (input.type ===
|
2721
|
+
if (input.type === InputType5.Message) {
|
2714
2722
|
return input.recipient.toString();
|
2715
2723
|
}
|
2716
2724
|
return "";
|
@@ -3664,21 +3672,6 @@ var _Provider = class {
|
|
3664
3672
|
} = await this.operations.getVersion();
|
3665
3673
|
return nodeVersion;
|
3666
3674
|
}
|
3667
|
-
/**
|
3668
|
-
* @hidden
|
3669
|
-
*
|
3670
|
-
* Returns the network configuration of the connected Fuel node.
|
3671
|
-
*
|
3672
|
-
* @returns A promise that resolves to the network configuration object
|
3673
|
-
*/
|
3674
|
-
async getNetwork() {
|
3675
|
-
const {
|
3676
|
-
name,
|
3677
|
-
consensusParameters: { chainId }
|
3678
|
-
} = await this.getChain();
|
3679
|
-
const network = new Network(name, chainId.toNumber());
|
3680
|
-
return Promise.resolve(network);
|
3681
|
-
}
|
3682
3675
|
/**
|
3683
3676
|
* Returns the block number.
|
3684
3677
|
*
|
@@ -4407,7 +4400,7 @@ cacheInputs_fn = function(inputs) {
|
|
4407
4400
|
return;
|
4408
4401
|
}
|
4409
4402
|
inputs.forEach((input) => {
|
4410
|
-
if (input.type ===
|
4403
|
+
if (input.type === InputType6.Coin) {
|
4411
4404
|
this.cache?.set(input.id);
|
4412
4405
|
}
|
4413
4406
|
});
|
@@ -5243,18 +5236,17 @@ var BaseWalletUnlocked = class extends Account {
|
|
5243
5236
|
__publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
5244
5237
|
|
5245
5238
|
// src/hdwallet/hdwallet.ts
|
5239
|
+
import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
|
5246
5240
|
import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
|
5247
5241
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
5248
5242
|
import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
5249
|
-
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
|
5250
|
-
import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
|
5243
|
+
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
|
5251
5244
|
|
5252
5245
|
// src/mnemonic/mnemonic.ts
|
5253
|
-
import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
|
5246
|
+
import { randomBytes as randomBytes4, pbkdf2, computeHmac } from "@fuel-ts/crypto";
|
5254
5247
|
import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
|
5255
5248
|
import { sha256 as sha2563 } from "@fuel-ts/hasher";
|
5256
|
-
import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
|
5257
|
-
import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
|
5249
|
+
import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58 } from "@fuel-ts/utils";
|
5258
5250
|
|
5259
5251
|
// src/wordlists/words/english.ts
|
5260
5252
|
var english = [
|
@@ -7777,7 +7769,8 @@ var HDWallet = class {
|
|
7777
7769
|
});
|
7778
7770
|
}
|
7779
7771
|
static fromExtendedKey(extendedKey) {
|
7780
|
-
|
7772
|
+
let decoded = toHex(decodeBase58(extendedKey));
|
7773
|
+
decoded = `${decoded.substring(0, 2)}0${decoded.substring(2)}`;
|
7781
7774
|
const bytes = arrayify18(decoded);
|
7782
7775
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
7783
7776
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
@@ -7977,11 +7970,10 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
|
7977
7970
|
|
7978
7971
|
// src/test-utils/seedTestWallet.ts
|
7979
7972
|
import { randomBytes as randomBytes5 } from "@fuel-ts/crypto";
|
7980
|
-
var seedTestWallet = async (wallet, quantities
|
7981
|
-
const toFundAccounts = Array.isArray(wallet) ? wallet : [wallet];
|
7973
|
+
var seedTestWallet = async (wallet, quantities) => {
|
7982
7974
|
const genesisWallet = new WalletUnlocked(
|
7983
7975
|
process.env.GENESIS_SECRET || randomBytes5(32),
|
7984
|
-
|
7976
|
+
wallet.provider
|
7985
7977
|
);
|
7986
7978
|
const resources = await genesisWallet.getResourcesToSpend(quantities);
|
7987
7979
|
const { minGasPrice } = genesisWallet.provider.getGasConfig();
|
@@ -7990,13 +7982,7 @@ var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
|
|
7990
7982
|
gasPrice: minGasPrice
|
7991
7983
|
});
|
7992
7984
|
request.addResources(resources);
|
7993
|
-
quantities.map(coinQuantityfy).forEach(
|
7994
|
-
({ amount, assetId }) => toFundAccounts.forEach(({ address }) => {
|
7995
|
-
for (let i = 0; i < utxosAmount; i++) {
|
7996
|
-
request.addCoinOutput(address, amount.div(utxosAmount), assetId);
|
7997
|
-
}
|
7998
|
-
})
|
7999
|
-
);
|
7985
|
+
quantities.map(coinQuantityfy).forEach(({ amount, assetId }) => request.addCoinOutput(wallet.address, amount, assetId));
|
8000
7986
|
await genesisWallet.sendTransaction(request, { awaitExecution: true });
|
8001
7987
|
};
|
8002
7988
|
|
@@ -8195,44 +8181,7 @@ var launchNodeAndGetWallets = async ({
|
|
8195
8181
|
};
|
8196
8182
|
return { wallets, stop: cleanup, provider };
|
8197
8183
|
};
|
8198
|
-
|
8199
|
-
// src/test-utils/transactionRequest.ts
|
8200
|
-
import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
|
8201
|
-
import { getRandomB256 } from "@fuel-ts/address";
|
8202
|
-
import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
|
8203
|
-
import { randomBytes as randomBytes6 } from "@fuel-ts/crypto";
|
8204
|
-
import { bn as bn19 } from "@fuel-ts/math";
|
8205
|
-
import { InputType as InputType8 } from "@fuel-ts/transactions";
|
8206
|
-
import { hexlify as hexlify19 } from "@fuel-ts/utils";
|
8207
|
-
var generateFakeRequestInputCoin = (partial = {}) => ({
|
8208
|
-
id: hexlify19(randomBytes6(UTXO_ID_LEN3)),
|
8209
|
-
type: InputType8.Coin,
|
8210
|
-
owner: getRandomB256(),
|
8211
|
-
amount: bn19(100),
|
8212
|
-
assetId: ZeroBytes329,
|
8213
|
-
txPointer: "0x00000000000000000000000000000000",
|
8214
|
-
witnessIndex: 0,
|
8215
|
-
...partial
|
8216
|
-
});
|
8217
|
-
var generateFakeRequestInputMessage = (partial = {}) => ({
|
8218
|
-
nonce: getRandomB256(),
|
8219
|
-
type: InputType8.Message,
|
8220
|
-
sender: getRandomB256(),
|
8221
|
-
recipient: getRandomB256(),
|
8222
|
-
amount: bn19(100),
|
8223
|
-
witnessIndex: 0,
|
8224
|
-
...partial
|
8225
|
-
});
|
8226
|
-
var generateFakeRequestInputContract = (partial = {}) => ({
|
8227
|
-
contractId: getRandomB256(),
|
8228
|
-
type: InputType8.Contract,
|
8229
|
-
txPointer: "0x00000000000000000000000000000000",
|
8230
|
-
...partial
|
8231
|
-
});
|
8232
8184
|
export {
|
8233
|
-
generateFakeRequestInputCoin,
|
8234
|
-
generateFakeRequestInputContract,
|
8235
|
-
generateFakeRequestInputMessage,
|
8236
8185
|
generateTestWallet,
|
8237
8186
|
killNode,
|
8238
8187
|
launchNode,
|