@fuel-ts/account 0.0.0-rc-1976-20240424110729 → 0.0.0-rc-2143-20240424111047
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 +42 -64
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +80 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -62
- package/dist/index.mjs.map +1 -1
- 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/provider.d.ts +0 -7
- 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 +2 -5
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +3 -2
- 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 +45 -69
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +82 -104
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +44 -66
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/account.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO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GAAG,eAAe;IACnC,2BAA2B;IAC3B,MAAM,EAAE,YAAY;IACpB,gBAAgB;IAChB,QAAQ,GAAE,YAAiB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAyCzB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOnD;;;;;OAKG;IACG,eAAe,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUtF;;;;;OAKG;IACG,eAAe,CACnB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,cAAc,EAAE,GAAE,oBAAyB,GAC3E,OAAO,CAAC,mBAAmB,CAAC;IAgB/B;;;;;OAKG;IACG,mBAAmB,CACvB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,GAAE,yBAA8B,GAChE,OAAO,CAAC,UAAU,CAAC;IAQtB,OAAO,CAAC,WAAW;CAyBpB"}
|
package/dist/index.global.js
CHANGED
@@ -31272,6 +31272,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31272
31272
|
}
|
31273
31273
|
};
|
31274
31274
|
|
31275
|
+
// ../address/dist/configs.mjs
|
31276
|
+
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
31277
|
+
var BaseAssetId = ZeroBytes32;
|
31278
|
+
|
31275
31279
|
// ../math/dist/index.mjs
|
31276
31280
|
var import_bn = __toESM(require_bn(), 1);
|
31277
31281
|
var DEFAULT_PRECISION = 9;
|
@@ -31502,11 +31506,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31502
31506
|
let max2;
|
31503
31507
|
if (Array.isArray(coinQuantityLike)) {
|
31504
31508
|
amount = coinQuantityLike[0];
|
31505
|
-
assetId = coinQuantityLike[1];
|
31506
|
-
max2 = coinQuantityLike[2];
|
31509
|
+
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31510
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31507
31511
|
} else {
|
31508
31512
|
amount = coinQuantityLike.amount;
|
31509
|
-
assetId = coinQuantityLike.assetId;
|
31513
|
+
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31510
31514
|
max2 = coinQuantityLike.max ?? void 0;
|
31511
31515
|
}
|
31512
31516
|
const bnAmount = bn(amount);
|
@@ -38886,9 +38890,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38886
38890
|
}
|
38887
38891
|
};
|
38888
38892
|
|
38889
|
-
// ../address/dist/configs.mjs
|
38890
|
-
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
38891
|
-
|
38892
38893
|
// src/providers/transaction-request/input.ts
|
38893
38894
|
var inputify = (value) => {
|
38894
38895
|
const { type: type3 } = value;
|
@@ -39565,8 +39566,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39565
39566
|
outputs = [];
|
39566
39567
|
/** List of witnesses */
|
39567
39568
|
witnesses = [];
|
39568
|
-
/** Base asset ID - should be fetched from the chain */
|
39569
|
-
baseAssetId;
|
39570
39569
|
/**
|
39571
39570
|
* Constructor for initializing a base transaction request.
|
39572
39571
|
*
|
@@ -39579,9 +39578,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39579
39578
|
witnessLimit,
|
39580
39579
|
inputs,
|
39581
39580
|
outputs,
|
39582
|
-
witnesses
|
39583
|
-
|
39584
|
-
}) {
|
39581
|
+
witnesses
|
39582
|
+
} = {}) {
|
39585
39583
|
this.gasPrice = bn(gasPrice);
|
39586
39584
|
this.maturity = maturity ?? 0;
|
39587
39585
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
@@ -39589,7 +39587,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39589
39587
|
this.inputs = inputs ?? [];
|
39590
39588
|
this.outputs = outputs ?? [];
|
39591
39589
|
this.witnesses = witnesses ?? [];
|
39592
|
-
this.baseAssetId = baseAssetId;
|
39593
39590
|
}
|
39594
39591
|
static getPolicyMeta(req) {
|
39595
39592
|
let policyTypes = 0;
|
@@ -39813,9 +39810,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39813
39810
|
*
|
39814
39811
|
* @param message - Message resource.
|
39815
39812
|
* @param predicate - Predicate bytes.
|
39813
|
+
* @param predicateData - Predicate data bytes.
|
39816
39814
|
*/
|
39817
39815
|
addMessageInput(message, predicate) {
|
39818
39816
|
const { recipient, sender, amount } = message;
|
39817
|
+
const assetId = BaseAssetId;
|
39819
39818
|
let witnessIndex;
|
39820
39819
|
if (predicate) {
|
39821
39820
|
witnessIndex = 0;
|
@@ -39835,7 +39834,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39835
39834
|
predicate: predicate?.bytes
|
39836
39835
|
};
|
39837
39836
|
this.pushInput(input);
|
39838
|
-
this.addChangeOutput(recipient,
|
39837
|
+
this.addChangeOutput(recipient, assetId);
|
39839
39838
|
}
|
39840
39839
|
/**
|
39841
39840
|
* Adds a single resource to the transaction by adding a coin/message input and a
|
@@ -39896,12 +39895,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39896
39895
|
* @param amount - Amount of coin.
|
39897
39896
|
* @param assetId - Asset ID of coin.
|
39898
39897
|
*/
|
39899
|
-
addCoinOutput(to, amount, assetId) {
|
39898
|
+
addCoinOutput(to, amount, assetId = BaseAssetId) {
|
39900
39899
|
this.pushOutput({
|
39901
39900
|
type: OutputType.Coin,
|
39902
39901
|
to: addressify(to).toB256(),
|
39903
39902
|
amount,
|
39904
|
-
assetId
|
39903
|
+
assetId
|
39905
39904
|
});
|
39906
39905
|
return this;
|
39907
39906
|
}
|
@@ -39928,7 +39927,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39928
39927
|
* @param to - Address of the owner.
|
39929
39928
|
* @param assetId - Asset ID of coin.
|
39930
39929
|
*/
|
39931
|
-
addChangeOutput(to, assetId) {
|
39930
|
+
addChangeOutput(to, assetId = BaseAssetId) {
|
39932
39931
|
const changeOutput = this.getChangeOutputs().find(
|
39933
39932
|
(output3) => hexlify(output3.assetId) === assetId
|
39934
39933
|
);
|
@@ -39936,7 +39935,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39936
39935
|
this.pushOutput({
|
39937
39936
|
type: OutputType.Change,
|
39938
39937
|
to: addressify(to).toB256(),
|
39939
|
-
assetId
|
39938
|
+
assetId
|
39940
39939
|
});
|
39941
39940
|
}
|
39942
39941
|
}
|
@@ -40012,7 +40011,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40012
40011
|
]);
|
40013
40012
|
}
|
40014
40013
|
};
|
40015
|
-
updateAssetInput(
|
40014
|
+
updateAssetInput(BaseAssetId, bn(1e11));
|
40016
40015
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
40017
40016
|
}
|
40018
40017
|
/**
|
@@ -40169,7 +40168,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40169
40168
|
*
|
40170
40169
|
* @param createTransactionRequestLike - The initial values for the instance
|
40171
40170
|
*/
|
40172
|
-
constructor({
|
40171
|
+
constructor({
|
40172
|
+
bytecodeWitnessIndex,
|
40173
|
+
salt,
|
40174
|
+
storageSlots,
|
40175
|
+
...rest
|
40176
|
+
} = {}) {
|
40173
40177
|
super(rest);
|
40174
40178
|
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
40175
40179
|
this.salt = hexlify(salt ?? ZeroBytes32);
|
@@ -40284,7 +40288,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40284
40288
|
*
|
40285
40289
|
* @param scriptTransactionRequestLike - The initial values for the instance.
|
40286
40290
|
*/
|
40287
|
-
constructor({ script, scriptData, gasLimit, ...rest }) {
|
40291
|
+
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
40288
40292
|
super(rest);
|
40289
40293
|
this.gasLimit = bn(gasLimit);
|
40290
40294
|
this.script = arrayify(script ?? returnZeroScript.bytes);
|
@@ -41430,7 +41434,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41430
41434
|
gasPerByte: bn(feeParams.gasPerByte),
|
41431
41435
|
maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
|
41432
41436
|
chainId: bn(consensusParameters.chainId),
|
41433
|
-
baseAssetId: consensusParameters.baseAssetId,
|
41434
41437
|
gasCosts
|
41435
41438
|
},
|
41436
41439
|
gasCosts,
|
@@ -41673,17 +41676,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41673
41676
|
} = this.getChain();
|
41674
41677
|
return chainId.toNumber();
|
41675
41678
|
}
|
41676
|
-
/**
|
41677
|
-
* Returns the base asset ID
|
41678
|
-
*
|
41679
|
-
* @returns A promise that resolves to the base asset ID
|
41680
|
-
*/
|
41681
|
-
getBaseAssetId() {
|
41682
|
-
const {
|
41683
|
-
consensusParameters: { baseAssetId }
|
41684
|
-
} = this.getChain();
|
41685
|
-
return baseAssetId;
|
41686
|
-
}
|
41687
41679
|
/**
|
41688
41680
|
* Submits a transaction to the chain to be executed.
|
41689
41681
|
*
|
@@ -42740,9 +42732,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42740
42732
|
* @param assetId - The asset ID to check the balance for.
|
42741
42733
|
* @returns A promise that resolves to the balance amount.
|
42742
42734
|
*/
|
42743
|
-
async getBalance(assetId) {
|
42744
|
-
const
|
42745
|
-
const amount = await this.provider.getBalance(this.address, assetIdToFetch);
|
42735
|
+
async getBalance(assetId = BaseAssetId) {
|
42736
|
+
const amount = await this.provider.getBalance(this.address, assetId);
|
42746
42737
|
return amount;
|
42747
42738
|
}
|
42748
42739
|
/**
|
@@ -42780,10 +42771,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42780
42771
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42781
42772
|
*/
|
42782
42773
|
async fund(request, coinQuantities, fee) {
|
42783
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42784
42774
|
const updatedQuantities = addAmountToAsset({
|
42785
42775
|
amount: bn(fee),
|
42786
|
-
assetId:
|
42776
|
+
assetId: BaseAssetId,
|
42787
42777
|
coinQuantities
|
42788
42778
|
});
|
42789
42779
|
const quantitiesDict = {};
|
@@ -42807,8 +42797,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42807
42797
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42808
42798
|
cachedUtxos.push(input.id);
|
42809
42799
|
}
|
42810
|
-
} else if (input.recipient === owner && input.amount && quantitiesDict[
|
42811
|
-
quantitiesDict[
|
42800
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
42801
|
+
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42812
42802
|
cachedMessages.push(input.nonce);
|
42813
42803
|
}
|
42814
42804
|
}
|
@@ -42840,13 +42830,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42840
42830
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42841
42831
|
* @returns A promise that resolves to the prepared transaction request.
|
42842
42832
|
*/
|
42843
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
42833
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42844
42834
|
const { minGasPrice } = this.provider.getGasConfig();
|
42845
|
-
const
|
42846
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42847
|
-
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
42835
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42848
42836
|
const request = new ScriptTransactionRequest(params);
|
42849
|
-
request.addCoinOutput(Address.fromAddressOrString(destination), amount,
|
42837
|
+
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
42850
42838
|
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
42851
42839
|
estimateTxDependencies: true,
|
42852
42840
|
resourcesOwner: this
|
@@ -42872,15 +42860,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42872
42860
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42873
42861
|
* @returns A promise that resolves to the transaction response.
|
42874
42862
|
*/
|
42875
|
-
async transfer(destination, amount, assetId, txParams = {}) {
|
42863
|
+
async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42876
42864
|
if (bn(amount).lte(0)) {
|
42877
42865
|
throw new FuelError(
|
42878
42866
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
42879
42867
|
"Transfer amount must be a positive number."
|
42880
42868
|
);
|
42881
42869
|
}
|
42882
|
-
const
|
42883
|
-
const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
42870
|
+
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
42884
42871
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
42885
42872
|
}
|
42886
42873
|
/**
|
@@ -42892,7 +42879,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42892
42879
|
* @param txParams - The optional transaction parameters.
|
42893
42880
|
* @returns A promise that resolves to the transaction response.
|
42894
42881
|
*/
|
42895
|
-
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
42882
|
+
async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
|
42896
42883
|
if (bn(amount).lte(0)) {
|
42897
42884
|
throw new FuelError(
|
42898
42885
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
@@ -42901,13 +42888,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42901
42888
|
}
|
42902
42889
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42903
42890
|
const { minGasPrice } = this.provider.getGasConfig();
|
42904
|
-
const
|
42905
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42906
|
-
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
42891
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42907
42892
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42908
42893
|
hexlifiedContractId: contractAddress.toB256(),
|
42909
42894
|
amountToTransfer: bn(amount),
|
42910
|
-
assetId
|
42895
|
+
assetId
|
42911
42896
|
});
|
42912
42897
|
const request = new ScriptTransactionRequest({
|
42913
42898
|
...params,
|
@@ -42917,7 +42902,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42917
42902
|
request.addContractInputAndOutput(contractAddress);
|
42918
42903
|
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42919
42904
|
request,
|
42920
|
-
[{ amount: bn(amount), assetId: String(
|
42905
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42921
42906
|
);
|
42922
42907
|
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42923
42908
|
this.validateGas({
|
@@ -42939,7 +42924,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42939
42924
|
*/
|
42940
42925
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42941
42926
|
const { minGasPrice } = this.provider.getGasConfig();
|
42942
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42943
42927
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42944
42928
|
const recipientDataArray = arrayify(
|
42945
42929
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42952,14 +42936,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42952
42936
|
...recipientDataArray,
|
42953
42937
|
...amountDataArray
|
42954
42938
|
]);
|
42955
|
-
const params = {
|
42956
|
-
script,
|
42957
|
-
gasPrice: minGasPrice,
|
42958
|
-
baseAssetId,
|
42959
|
-
...txParams
|
42960
|
-
};
|
42939
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
42961
42940
|
const request = new ScriptTransactionRequest(params);
|
42962
|
-
const forwardingQuantities = [{ amount: bn(amount), assetId:
|
42941
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42963
42942
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42964
42943
|
request,
|
42965
42944
|
forwardingQuantities
|
@@ -47922,9 +47901,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47922
47901
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
47923
47902
|
* @returns A promise that resolves to the prepared transaction request.
|
47924
47903
|
*/
|
47925
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
47926
|
-
const
|
47927
|
-
const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
47904
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
47905
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
47928
47906
|
return this.populateTransactionPredicateData(request);
|
47929
47907
|
}
|
47930
47908
|
/**
|