@fuel-ts/account 0.0.0-rc-2152-20240429145747 → 0.0.0-rc-2037-20240430003658
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/README.md +15 -12
- package/dist/index.global.js +1097 -126
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +241 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -39
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +9 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +17 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +17 -1
- 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 +2 -0
- 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 +1104 -136
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +228 -125
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +142 -42
- 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 -15
package/dist/index.mjs
CHANGED
@@ -75,7 +75,7 @@ import { Address as Address2 } from "@fuel-ts/address";
|
|
75
75
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
76
76
|
import { BN, bn as bn16 } from "@fuel-ts/math";
|
77
77
|
import {
|
78
|
-
InputType as
|
78
|
+
InputType as InputType8,
|
79
79
|
TransactionType as TransactionType8,
|
80
80
|
InputMessageCoder,
|
81
81
|
TransactionCoder as TransactionCoder5
|
@@ -83,6 +83,7 @@ import {
|
|
83
83
|
import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
|
84
84
|
import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
|
85
85
|
import { equalBytes } from "@noble/curves/abstract/utils";
|
86
|
+
import { Network } from "ethers";
|
86
87
|
import { GraphQLClient } from "graphql-request";
|
87
88
|
import { clone as clone3 } from "ramda";
|
88
89
|
|
@@ -857,6 +858,13 @@ var ProduceBlocksDocument = gql`
|
|
857
858
|
)
|
858
859
|
}
|
859
860
|
`;
|
861
|
+
var GetMessageByNonceDocument = gql`
|
862
|
+
query getMessageByNonce($nonce: Nonce!) {
|
863
|
+
message(nonce: $nonce) {
|
864
|
+
...messageFragment
|
865
|
+
}
|
866
|
+
}
|
867
|
+
${MessageFragmentFragmentDoc}`;
|
860
868
|
var SubmitAndAwaitDocument = gql`
|
861
869
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
862
870
|
submitAndAwait(tx: $encodedTransaction) {
|
@@ -951,6 +959,9 @@ function getSdk(requester) {
|
|
951
959
|
produceBlocks(variables, options) {
|
952
960
|
return requester(ProduceBlocksDocument, variables, options);
|
953
961
|
},
|
962
|
+
getMessageByNonce(variables, options) {
|
963
|
+
return requester(GetMessageByNonceDocument, variables, options);
|
964
|
+
},
|
954
965
|
submitAndAwait(variables, options) {
|
955
966
|
return requester(SubmitAndAwaitDocument, variables, options);
|
956
967
|
},
|
@@ -1239,7 +1250,7 @@ import { bn as bn7 } from "@fuel-ts/math";
|
|
1239
1250
|
import {
|
1240
1251
|
PolicyType,
|
1241
1252
|
TransactionCoder,
|
1242
|
-
InputType as
|
1253
|
+
InputType as InputType3,
|
1243
1254
|
OutputType as OutputType2,
|
1244
1255
|
TransactionType
|
1245
1256
|
} from "@fuel-ts/transactions";
|
@@ -1763,6 +1774,28 @@ var NoWitnessByOwnerError = class extends Error {
|
|
1763
1774
|
name = "NoWitnessByOwnerError";
|
1764
1775
|
};
|
1765
1776
|
|
1777
|
+
// src/providers/transaction-request/helpers.ts
|
1778
|
+
import { InputType as InputType2 } from "@fuel-ts/transactions";
|
1779
|
+
var isRequestInputCoin = (input) => input.type === InputType2.Coin;
|
1780
|
+
var isRequestInputMessage = (input) => input.type === InputType2.Message;
|
1781
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
1782
|
+
var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
|
1783
|
+
var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
|
1784
|
+
var cacheResources = (resources) => resources.reduce(
|
1785
|
+
(cache2, resource) => {
|
1786
|
+
if (isCoin(resource)) {
|
1787
|
+
cache2.utxos.push(resource.id);
|
1788
|
+
} else {
|
1789
|
+
cache2.messages.push(resource.nonce);
|
1790
|
+
}
|
1791
|
+
return cache2;
|
1792
|
+
},
|
1793
|
+
{
|
1794
|
+
utxos: [],
|
1795
|
+
messages: []
|
1796
|
+
}
|
1797
|
+
);
|
1798
|
+
|
1766
1799
|
// src/providers/transaction-request/witness.ts
|
1767
1800
|
import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
|
1768
1801
|
var witnessify = (value) => {
|
@@ -1953,7 +1986,7 @@ var BaseTransactionRequest = class {
|
|
1953
1986
|
*/
|
1954
1987
|
getCoinInputs() {
|
1955
1988
|
return this.inputs.filter(
|
1956
|
-
(input) => input.type ===
|
1989
|
+
(input) => input.type === InputType3.Coin
|
1957
1990
|
);
|
1958
1991
|
}
|
1959
1992
|
/**
|
@@ -1985,9 +2018,9 @@ var BaseTransactionRequest = class {
|
|
1985
2018
|
const ownerAddress = addressify(owner);
|
1986
2019
|
const found = this.inputs.find((input) => {
|
1987
2020
|
switch (input.type) {
|
1988
|
-
case
|
2021
|
+
case InputType3.Coin:
|
1989
2022
|
return hexlify7(input.owner) === ownerAddress.toB256();
|
1990
|
-
case
|
2023
|
+
case InputType3.Message:
|
1991
2024
|
return hexlify7(input.recipient) === ownerAddress.toB256();
|
1992
2025
|
default:
|
1993
2026
|
return false;
|
@@ -2002,7 +2035,7 @@ var BaseTransactionRequest = class {
|
|
2002
2035
|
* @param coin - Coin resource.
|
2003
2036
|
*/
|
2004
2037
|
addCoinInput(coin) {
|
2005
|
-
const { assetId, owner, amount } = coin;
|
2038
|
+
const { assetId, owner, amount, id, predicate } = coin;
|
2006
2039
|
let witnessIndex;
|
2007
2040
|
if (coin.predicate) {
|
2008
2041
|
witnessIndex = 0;
|
@@ -2013,13 +2046,14 @@ var BaseTransactionRequest = class {
|
|
2013
2046
|
}
|
2014
2047
|
}
|
2015
2048
|
const input = {
|
2016
|
-
|
2017
|
-
type:
|
2049
|
+
id,
|
2050
|
+
type: InputType3.Coin,
|
2018
2051
|
owner: owner.toB256(),
|
2019
2052
|
amount,
|
2020
2053
|
assetId,
|
2021
2054
|
txPointer: "0x00000000000000000000000000000000",
|
2022
|
-
witnessIndex
|
2055
|
+
witnessIndex,
|
2056
|
+
predicate
|
2023
2057
|
};
|
2024
2058
|
this.pushInput(input);
|
2025
2059
|
this.addChangeOutput(owner, assetId);
|
@@ -2031,7 +2065,7 @@ var BaseTransactionRequest = class {
|
|
2031
2065
|
* @param message - Message resource.
|
2032
2066
|
*/
|
2033
2067
|
addMessageInput(message) {
|
2034
|
-
const { recipient, sender, amount, assetId } = message;
|
2068
|
+
const { recipient, sender, amount, predicate, nonce, assetId } = message;
|
2035
2069
|
let witnessIndex;
|
2036
2070
|
if (message.predicate) {
|
2037
2071
|
witnessIndex = 0;
|
@@ -2042,12 +2076,13 @@ var BaseTransactionRequest = class {
|
|
2042
2076
|
}
|
2043
2077
|
}
|
2044
2078
|
const input = {
|
2045
|
-
|
2046
|
-
type:
|
2079
|
+
nonce,
|
2080
|
+
type: InputType3.Message,
|
2047
2081
|
sender: sender.toB256(),
|
2048
2082
|
recipient: recipient.toB256(),
|
2049
2083
|
amount,
|
2050
|
-
witnessIndex
|
2084
|
+
witnessIndex,
|
2085
|
+
predicate
|
2051
2086
|
};
|
2052
2087
|
this.pushInput(input);
|
2053
2088
|
this.addChangeOutput(recipient, assetId);
|
@@ -2231,16 +2266,27 @@ var BaseTransactionRequest = class {
|
|
2231
2266
|
toJSON() {
|
2232
2267
|
return normalizeJSON(this);
|
2233
2268
|
}
|
2269
|
+
removeWitness(index) {
|
2270
|
+
this.witnesses.splice(index, 1);
|
2271
|
+
this.adjustWitnessIndexes(index);
|
2272
|
+
}
|
2273
|
+
adjustWitnessIndexes(removedIndex) {
|
2274
|
+
this.inputs.filter(isRequestInputResource).forEach((input) => {
|
2275
|
+
if (input.witnessIndex > removedIndex) {
|
2276
|
+
input.witnessIndex -= 1;
|
2277
|
+
}
|
2278
|
+
});
|
2279
|
+
}
|
2234
2280
|
updatePredicateGasUsed(inputs) {
|
2235
2281
|
this.inputs.forEach((i) => {
|
2236
2282
|
let correspondingInput;
|
2237
2283
|
switch (i.type) {
|
2238
|
-
case
|
2239
|
-
correspondingInput = inputs.find((x) => x.type ===
|
2284
|
+
case InputType3.Coin:
|
2285
|
+
correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
|
2240
2286
|
break;
|
2241
|
-
case
|
2287
|
+
case InputType3.Message:
|
2242
2288
|
correspondingInput = inputs.find(
|
2243
|
-
(x) => x.type ===
|
2289
|
+
(x) => x.type === InputType3.Message && x.sender === i.sender
|
2244
2290
|
);
|
2245
2291
|
break;
|
2246
2292
|
default:
|
@@ -2274,7 +2320,7 @@ import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
|
|
2274
2320
|
import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
|
2275
2321
|
import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
|
2276
2322
|
import { bn as bn8 } from "@fuel-ts/math";
|
2277
|
-
import { TransactionType as TransactionType2, InputType as
|
2323
|
+
import { TransactionType as TransactionType2, InputType as InputType4, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
|
2278
2324
|
import { concat as concat2 } from "@fuel-ts/utils";
|
2279
2325
|
import { clone as clone2 } from "ramda";
|
2280
2326
|
function hashTransaction(transactionRequest, chainId) {
|
@@ -2285,7 +2331,7 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2285
2331
|
transaction.inputs = transaction.inputs.map((input) => {
|
2286
2332
|
const inputClone = clone2(input);
|
2287
2333
|
switch (inputClone.type) {
|
2288
|
-
case
|
2334
|
+
case InputType4.Coin: {
|
2289
2335
|
inputClone.txPointer = {
|
2290
2336
|
blockHeight: 0,
|
2291
2337
|
txIndex: 0
|
@@ -2293,11 +2339,11 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2293
2339
|
inputClone.predicateGasUsed = bn8(0);
|
2294
2340
|
return inputClone;
|
2295
2341
|
}
|
2296
|
-
case
|
2342
|
+
case InputType4.Message: {
|
2297
2343
|
inputClone.predicateGasUsed = bn8(0);
|
2298
2344
|
return inputClone;
|
2299
2345
|
}
|
2300
|
-
case
|
2346
|
+
case InputType4.Contract: {
|
2301
2347
|
inputClone.txPointer = {
|
2302
2348
|
blockHeight: 0,
|
2303
2349
|
txIndex: 0
|
@@ -2457,7 +2503,7 @@ import { Interface } from "@fuel-ts/abi-coder";
|
|
2457
2503
|
import { addressify as addressify2 } from "@fuel-ts/address";
|
2458
2504
|
import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
|
2459
2505
|
import { bn as bn10 } from "@fuel-ts/math";
|
2460
|
-
import { InputType as
|
2506
|
+
import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
|
2461
2507
|
import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
|
2462
2508
|
|
2463
2509
|
// src/providers/transaction-request/scripts.ts
|
@@ -2541,7 +2587,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2541
2587
|
*/
|
2542
2588
|
getContractInputs() {
|
2543
2589
|
return this.inputs.filter(
|
2544
|
-
(input) => input.type ===
|
2590
|
+
(input) => input.type === InputType5.Contract
|
2545
2591
|
);
|
2546
2592
|
}
|
2547
2593
|
/**
|
@@ -2618,7 +2664,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2618
2664
|
return this;
|
2619
2665
|
}
|
2620
2666
|
const inputIndex = super.pushInput({
|
2621
|
-
type:
|
2667
|
+
type: InputType5.Contract,
|
2622
2668
|
contractId: contractAddress.toB256(),
|
2623
2669
|
txPointer: "0x00000000000000000000000000000000"
|
2624
2670
|
});
|
@@ -2660,7 +2706,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2660
2706
|
|
2661
2707
|
// src/providers/transaction-request/utils.ts
|
2662
2708
|
import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
|
2663
|
-
import { TransactionType as TransactionType5, InputType as
|
2709
|
+
import { TransactionType as TransactionType5, InputType as InputType6 } from "@fuel-ts/transactions";
|
2664
2710
|
var transactionRequestify = (obj) => {
|
2665
2711
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
|
2666
2712
|
return obj;
|
@@ -2680,10 +2726,10 @@ var transactionRequestify = (obj) => {
|
|
2680
2726
|
};
|
2681
2727
|
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
2682
2728
|
(acc, input) => {
|
2683
|
-
if (input.type ===
|
2729
|
+
if (input.type === InputType6.Coin && input.owner === owner) {
|
2684
2730
|
acc.utxos.push(input.id);
|
2685
2731
|
}
|
2686
|
-
if (input.type ===
|
2732
|
+
if (input.type === InputType6.Message && input.recipient === owner) {
|
2687
2733
|
acc.messages.push(input.nonce);
|
2688
2734
|
}
|
2689
2735
|
return acc;
|
@@ -2837,7 +2883,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2837
2883
|
|
2838
2884
|
// src/providers/transaction-summary/input.ts
|
2839
2885
|
import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2840
|
-
import { InputType as
|
2886
|
+
import { InputType as InputType7 } from "@fuel-ts/transactions";
|
2841
2887
|
function getInputsByTypes(inputs, types) {
|
2842
2888
|
return inputs.filter((i) => types.includes(i.type));
|
2843
2889
|
}
|
@@ -2845,16 +2891,16 @@ function getInputsByType(inputs, type) {
|
|
2845
2891
|
return inputs.filter((i) => i.type === type);
|
2846
2892
|
}
|
2847
2893
|
function getInputsCoin(inputs) {
|
2848
|
-
return getInputsByType(inputs,
|
2894
|
+
return getInputsByType(inputs, InputType7.Coin);
|
2849
2895
|
}
|
2850
2896
|
function getInputsMessage(inputs) {
|
2851
|
-
return getInputsByType(inputs,
|
2897
|
+
return getInputsByType(inputs, InputType7.Message);
|
2852
2898
|
}
|
2853
2899
|
function getInputsCoinAndMessage(inputs) {
|
2854
|
-
return getInputsByTypes(inputs, [
|
2900
|
+
return getInputsByTypes(inputs, [InputType7.Coin, InputType7.Message]);
|
2855
2901
|
}
|
2856
2902
|
function getInputsContract(inputs) {
|
2857
|
-
return getInputsByType(inputs,
|
2903
|
+
return getInputsByType(inputs, InputType7.Contract);
|
2858
2904
|
}
|
2859
2905
|
function getInputFromAssetId(inputs, assetId) {
|
2860
2906
|
const coinInputs = getInputsCoin(inputs);
|
@@ -2873,7 +2919,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2873
2919
|
if (!contractInput) {
|
2874
2920
|
return void 0;
|
2875
2921
|
}
|
2876
|
-
if (contractInput.type !==
|
2922
|
+
if (contractInput.type !== InputType7.Contract) {
|
2877
2923
|
throw new FuelError9(
|
2878
2924
|
ErrorCode9.INVALID_TRANSACTION_INPUT,
|
2879
2925
|
`Contract input should be of type 'contract'.`
|
@@ -2882,10 +2928,10 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2882
2928
|
return contractInput;
|
2883
2929
|
}
|
2884
2930
|
function getInputAccountAddress(input) {
|
2885
|
-
if (input.type ===
|
2931
|
+
if (input.type === InputType7.Coin) {
|
2886
2932
|
return input.owner.toString();
|
2887
2933
|
}
|
2888
|
-
if (input.type ===
|
2934
|
+
if (input.type === InputType7.Message) {
|
2889
2935
|
return input.recipient.toString();
|
2890
2936
|
}
|
2891
2937
|
return "";
|
@@ -3896,6 +3942,21 @@ var _Provider = class {
|
|
3896
3942
|
} = await this.operations.getVersion();
|
3897
3943
|
return nodeVersion;
|
3898
3944
|
}
|
3945
|
+
/**
|
3946
|
+
* @hidden
|
3947
|
+
*
|
3948
|
+
* Returns the network configuration of the connected Fuel node.
|
3949
|
+
*
|
3950
|
+
* @returns A promise that resolves to the network configuration object
|
3951
|
+
*/
|
3952
|
+
async getNetwork() {
|
3953
|
+
const {
|
3954
|
+
name,
|
3955
|
+
consensusParameters: { chainId }
|
3956
|
+
} = await this.getChain();
|
3957
|
+
const network = new Network(name, chainId.toNumber());
|
3958
|
+
return Promise.resolve(network);
|
3959
|
+
}
|
3899
3960
|
/**
|
3900
3961
|
* Returns the block number.
|
3901
3962
|
*
|
@@ -4746,6 +4807,19 @@ var _Provider = class {
|
|
4746
4807
|
async getTransactionResponse(transactionId) {
|
4747
4808
|
return new TransactionResponse(transactionId, this);
|
4748
4809
|
}
|
4810
|
+
/**
|
4811
|
+
* Returns Message for given nonce.
|
4812
|
+
*
|
4813
|
+
* @param nonce - The nonce of the message to retrieve.
|
4814
|
+
* @returns A promise that resolves to the Message object.
|
4815
|
+
*/
|
4816
|
+
async getMessageByNonce(nonce) {
|
4817
|
+
const { message } = await this.operations.getMessageByNonce({ nonce });
|
4818
|
+
if (!message) {
|
4819
|
+
return null;
|
4820
|
+
}
|
4821
|
+
return message;
|
4822
|
+
}
|
4749
4823
|
};
|
4750
4824
|
var Provider = _Provider;
|
4751
4825
|
_cacheInputs = new WeakSet();
|
@@ -4754,7 +4828,7 @@ cacheInputs_fn = function(inputs) {
|
|
4754
4828
|
return;
|
4755
4829
|
}
|
4756
4830
|
inputs.forEach((input) => {
|
4757
|
-
if (input.type ===
|
4831
|
+
if (input.type === InputType8.Coin) {
|
4758
4832
|
this.cache?.set(input.id);
|
4759
4833
|
}
|
4760
4834
|
});
|
@@ -8936,7 +9010,7 @@ import {
|
|
8936
9010
|
} from "@fuel-ts/abi-coder";
|
8937
9011
|
import { Address as Address9 } from "@fuel-ts/address";
|
8938
9012
|
import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
|
8939
|
-
import { ByteArrayCoder
|
9013
|
+
import { ByteArrayCoder } from "@fuel-ts/transactions";
|
8940
9014
|
import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
|
8941
9015
|
|
8942
9016
|
// src/predicate/utils/getPredicateRoot.ts
|
@@ -8995,10 +9069,15 @@ var Predicate = class extends Account {
|
|
8995
9069
|
populateTransactionPredicateData(transactionRequestLike) {
|
8996
9070
|
const request = transactionRequestify(transactionRequestLike);
|
8997
9071
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
8998
|
-
|
8999
|
-
|
9072
|
+
const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
|
9073
|
+
if (placeholderIndex !== -1) {
|
9074
|
+
request.removeWitness(placeholderIndex);
|
9075
|
+
}
|
9076
|
+
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
9077
|
+
if (isRequestInputResourceFromOwner(input, this.address)) {
|
9000
9078
|
input.predicate = hexlify19(this.bytes);
|
9001
9079
|
input.predicateData = hexlify19(this.getPredicateData(policies.length));
|
9080
|
+
input.witnessIndex = 0;
|
9002
9081
|
}
|
9003
9082
|
});
|
9004
9083
|
return request;
|
@@ -9121,6 +9200,28 @@ var Predicate = class extends Account {
|
|
9121
9200
|
}
|
9122
9201
|
return mutatedBytes;
|
9123
9202
|
}
|
9203
|
+
/**
|
9204
|
+
* Returns the index of the witness placeholder that was added to this predicate.
|
9205
|
+
* If no witness placeholder was added, it returns -1.
|
9206
|
+
* @param request - The transaction request.
|
9207
|
+
* @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
|
9208
|
+
*/
|
9209
|
+
getIndexFromPlaceholderWitness(request) {
|
9210
|
+
const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
|
9211
|
+
let index = -1;
|
9212
|
+
const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
|
9213
|
+
if (hasEmptyPredicateInputs) {
|
9214
|
+
index = hasEmptyPredicateInputs.witnessIndex;
|
9215
|
+
const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
|
9216
|
+
if (!allInputsAreEmpty) {
|
9217
|
+
const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
|
9218
|
+
if (wasFilledInputAddedFirst) {
|
9219
|
+
index = -1;
|
9220
|
+
}
|
9221
|
+
}
|
9222
|
+
}
|
9223
|
+
return index;
|
9224
|
+
}
|
9124
9225
|
};
|
9125
9226
|
|
9126
9227
|
// src/connectors/fuel.ts
|
@@ -9843,6 +9944,7 @@ export {
|
|
9843
9944
|
assets,
|
9844
9945
|
buildBlockExplorerUrl,
|
9845
9946
|
cacheFor,
|
9947
|
+
cacheResources,
|
9846
9948
|
cacheTxInputsFromOwner,
|
9847
9949
|
calculateGasFee,
|
9848
9950
|
calculateMetadataGasForTxCreate,
|
@@ -9890,6 +9992,7 @@ export {
|
|
9890
9992
|
getReceiptsMessageOut,
|
9891
9993
|
getReceiptsTransferOut,
|
9892
9994
|
getReceiptsWithMissingData,
|
9995
|
+
getRequestInputResourceOwner,
|
9893
9996
|
getTransactionStatusName,
|
9894
9997
|
getTransactionSummary,
|
9895
9998
|
getTransactionSummaryFromRequest,
|
@@ -9903,6 +10006,10 @@ export {
|
|
9903
10006
|
isMessage,
|
9904
10007
|
isRawCoin,
|
9905
10008
|
isRawMessage,
|
10009
|
+
isRequestInputCoin,
|
10010
|
+
isRequestInputMessage,
|
10011
|
+
isRequestInputResource,
|
10012
|
+
isRequestInputResourceFromOwner,
|
9906
10013
|
isType,
|
9907
10014
|
isTypeCreate,
|
9908
10015
|
isTypeMint,
|