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