@fuel-ts/account 0.0.0-rc-1976-20240423111125 → 0.0.0-rc-2045-20240423120113
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 +63 -69
- 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.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +64 -73
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +80 -103
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +42 -65
- 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,KAAK,EAAE,eAAe,EAAE,SAAS,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B,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
@@ -28952,7 +28952,7 @@ spurious results.`);
|
|
28952
28952
|
// ../versions/dist/index.mjs
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
|
-
FORC: "0.
|
28955
|
+
FORC: "0.55.0",
|
28956
28956
|
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.81.0"
|
28958
28958
|
};
|
@@ -31144,7 +31144,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31144
31144
|
toEvmAddress() {
|
31145
31145
|
const b256Address = toB256(this.bech32Address);
|
31146
31146
|
return {
|
31147
|
-
|
31147
|
+
bits: clearFirst12BytesFromB256(b256Address)
|
31148
31148
|
};
|
31149
31149
|
}
|
31150
31150
|
/**
|
@@ -31154,7 +31154,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31154
31154
|
*/
|
31155
31155
|
toAssetId() {
|
31156
31156
|
return {
|
31157
|
-
|
31157
|
+
bits: this.toB256()
|
31158
31158
|
};
|
31159
31159
|
}
|
31160
31160
|
/**
|
@@ -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);
|
@@ -32338,6 +32342,20 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32338
32342
|
];
|
32339
32343
|
}
|
32340
32344
|
};
|
32345
|
+
var getEncodingVersion = (encoding) => {
|
32346
|
+
switch (encoding) {
|
32347
|
+
case void 0:
|
32348
|
+
case ENCODING_V0:
|
32349
|
+
return ENCODING_V0;
|
32350
|
+
case ENCODING_V1:
|
32351
|
+
return ENCODING_V1;
|
32352
|
+
default:
|
32353
|
+
throw new FuelError(
|
32354
|
+
ErrorCode.UNSUPPORTED_ENCODING_VERSION,
|
32355
|
+
`Encoding version '${encoding}' is unsupported.`
|
32356
|
+
);
|
32357
|
+
}
|
32358
|
+
};
|
32341
32359
|
var findFunctionByName = (abi, name) => {
|
32342
32360
|
const fn = abi.functions.find((f2) => f2.name === name);
|
32343
32361
|
if (!fn) {
|
@@ -33102,7 +33120,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33102
33120
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
33103
33121
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
33104
33122
|
this.selectorBytes = new StdStringCoder2().encode(name);
|
33105
|
-
this.encoding =
|
33123
|
+
this.encoding = getEncodingVersion(jsonAbi.encoding);
|
33106
33124
|
this.isInputDataPointer = this.#isInputDataPointer();
|
33107
33125
|
this.outputMetadata = {
|
33108
33126
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -33240,8 +33258,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33240
33258
|
functions;
|
33241
33259
|
configurables;
|
33242
33260
|
jsonAbi;
|
33261
|
+
encoding;
|
33243
33262
|
constructor(jsonAbi) {
|
33244
33263
|
this.jsonAbi = jsonAbi;
|
33264
|
+
this.encoding = getEncodingVersion(jsonAbi.encoding);
|
33245
33265
|
this.functions = Object.fromEntries(
|
33246
33266
|
this.jsonAbi.functions.map((x) => [x.name, new FunctionFragment(this.jsonAbi, x.name)])
|
33247
33267
|
);
|
@@ -33285,7 +33305,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33285
33305
|
);
|
33286
33306
|
}
|
33287
33307
|
return AbiCoder.decode(this.jsonAbi, loggedType.loggedType, arrayify(data), 0, {
|
33288
|
-
encoding: this.
|
33308
|
+
encoding: this.encoding
|
33289
33309
|
});
|
33290
33310
|
}
|
33291
33311
|
encodeConfigurable(name, value) {
|
@@ -38870,9 +38890,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38870
38890
|
}
|
38871
38891
|
};
|
38872
38892
|
|
38873
|
-
// ../address/dist/configs.mjs
|
38874
|
-
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
38875
|
-
|
38876
38893
|
// src/providers/transaction-request/input.ts
|
38877
38894
|
var inputify = (value) => {
|
38878
38895
|
const { type: type3 } = value;
|
@@ -39549,8 +39566,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39549
39566
|
outputs = [];
|
39550
39567
|
/** List of witnesses */
|
39551
39568
|
witnesses = [];
|
39552
|
-
/** Base asset ID - should be fetched from the chain */
|
39553
|
-
baseAssetId;
|
39554
39569
|
/**
|
39555
39570
|
* Constructor for initializing a base transaction request.
|
39556
39571
|
*
|
@@ -39563,9 +39578,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39563
39578
|
witnessLimit,
|
39564
39579
|
inputs,
|
39565
39580
|
outputs,
|
39566
|
-
witnesses
|
39567
|
-
|
39568
|
-
}) {
|
39581
|
+
witnesses
|
39582
|
+
} = {}) {
|
39569
39583
|
this.gasPrice = bn(gasPrice);
|
39570
39584
|
this.maturity = maturity ?? 0;
|
39571
39585
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
@@ -39573,7 +39587,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39573
39587
|
this.inputs = inputs ?? [];
|
39574
39588
|
this.outputs = outputs ?? [];
|
39575
39589
|
this.witnesses = witnesses ?? [];
|
39576
|
-
this.baseAssetId = baseAssetId;
|
39577
39590
|
}
|
39578
39591
|
static getPolicyMeta(req) {
|
39579
39592
|
let policyTypes = 0;
|
@@ -39797,9 +39810,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39797
39810
|
*
|
39798
39811
|
* @param message - Message resource.
|
39799
39812
|
* @param predicate - Predicate bytes.
|
39813
|
+
* @param predicateData - Predicate data bytes.
|
39800
39814
|
*/
|
39801
39815
|
addMessageInput(message, predicate) {
|
39802
39816
|
const { recipient, sender, amount } = message;
|
39817
|
+
const assetId = BaseAssetId;
|
39803
39818
|
let witnessIndex;
|
39804
39819
|
if (predicate) {
|
39805
39820
|
witnessIndex = 0;
|
@@ -39819,7 +39834,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39819
39834
|
predicate: predicate?.bytes
|
39820
39835
|
};
|
39821
39836
|
this.pushInput(input);
|
39822
|
-
this.addChangeOutput(recipient,
|
39837
|
+
this.addChangeOutput(recipient, assetId);
|
39823
39838
|
}
|
39824
39839
|
/**
|
39825
39840
|
* Adds a single resource to the transaction by adding a coin/message input and a
|
@@ -39880,12 +39895,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39880
39895
|
* @param amount - Amount of coin.
|
39881
39896
|
* @param assetId - Asset ID of coin.
|
39882
39897
|
*/
|
39883
|
-
addCoinOutput(to, amount, assetId) {
|
39898
|
+
addCoinOutput(to, amount, assetId = BaseAssetId) {
|
39884
39899
|
this.pushOutput({
|
39885
39900
|
type: OutputType.Coin,
|
39886
39901
|
to: addressify(to).toB256(),
|
39887
39902
|
amount,
|
39888
|
-
assetId
|
39903
|
+
assetId
|
39889
39904
|
});
|
39890
39905
|
return this;
|
39891
39906
|
}
|
@@ -39912,7 +39927,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39912
39927
|
* @param to - Address of the owner.
|
39913
39928
|
* @param assetId - Asset ID of coin.
|
39914
39929
|
*/
|
39915
|
-
addChangeOutput(to, assetId) {
|
39930
|
+
addChangeOutput(to, assetId = BaseAssetId) {
|
39916
39931
|
const changeOutput = this.getChangeOutputs().find(
|
39917
39932
|
(output3) => hexlify(output3.assetId) === assetId
|
39918
39933
|
);
|
@@ -39920,7 +39935,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39920
39935
|
this.pushOutput({
|
39921
39936
|
type: OutputType.Change,
|
39922
39937
|
to: addressify(to).toB256(),
|
39923
|
-
assetId
|
39938
|
+
assetId
|
39924
39939
|
});
|
39925
39940
|
}
|
39926
39941
|
}
|
@@ -39996,7 +40011,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39996
40011
|
]);
|
39997
40012
|
}
|
39998
40013
|
};
|
39999
|
-
updateAssetInput(
|
40014
|
+
updateAssetInput(BaseAssetId, bn(1e11));
|
40000
40015
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
40001
40016
|
}
|
40002
40017
|
/**
|
@@ -40153,7 +40168,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40153
40168
|
*
|
40154
40169
|
* @param createTransactionRequestLike - The initial values for the instance
|
40155
40170
|
*/
|
40156
|
-
constructor({
|
40171
|
+
constructor({
|
40172
|
+
bytecodeWitnessIndex,
|
40173
|
+
salt,
|
40174
|
+
storageSlots,
|
40175
|
+
...rest
|
40176
|
+
} = {}) {
|
40157
40177
|
super(rest);
|
40158
40178
|
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
40159
40179
|
this.salt = hexlify(salt ?? ZeroBytes32);
|
@@ -40268,7 +40288,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40268
40288
|
*
|
40269
40289
|
* @param scriptTransactionRequestLike - The initial values for the instance.
|
40270
40290
|
*/
|
40271
|
-
constructor({ script, scriptData, gasLimit, ...rest }) {
|
40291
|
+
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
40272
40292
|
super(rest);
|
40273
40293
|
this.gasLimit = bn(gasLimit);
|
40274
40294
|
this.script = arrayify(script ?? returnZeroScript.bytes);
|
@@ -41414,7 +41434,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41414
41434
|
gasPerByte: bn(feeParams.gasPerByte),
|
41415
41435
|
maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
|
41416
41436
|
chainId: bn(consensusParameters.chainId),
|
41417
|
-
baseAssetId: consensusParameters.baseAssetId,
|
41418
41437
|
gasCosts
|
41419
41438
|
},
|
41420
41439
|
gasCosts,
|
@@ -41657,17 +41676,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41657
41676
|
} = this.getChain();
|
41658
41677
|
return chainId.toNumber();
|
41659
41678
|
}
|
41660
|
-
/**
|
41661
|
-
* Returns the base asset ID
|
41662
|
-
*
|
41663
|
-
* @returns A promise that resolves to the base asset ID
|
41664
|
-
*/
|
41665
|
-
getBaseAssetId() {
|
41666
|
-
const {
|
41667
|
-
consensusParameters: { baseAssetId }
|
41668
|
-
} = this.getChain();
|
41669
|
-
return baseAssetId;
|
41670
|
-
}
|
41671
41679
|
/**
|
41672
41680
|
* Submits a transaction to the chain to be executed.
|
41673
41681
|
*
|
@@ -42724,9 +42732,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42724
42732
|
* @param assetId - The asset ID to check the balance for.
|
42725
42733
|
* @returns A promise that resolves to the balance amount.
|
42726
42734
|
*/
|
42727
|
-
async getBalance(assetId) {
|
42728
|
-
const
|
42729
|
-
const amount = await this.provider.getBalance(this.address, assetIdToFetch);
|
42735
|
+
async getBalance(assetId = BaseAssetId) {
|
42736
|
+
const amount = await this.provider.getBalance(this.address, assetId);
|
42730
42737
|
return amount;
|
42731
42738
|
}
|
42732
42739
|
/**
|
@@ -42764,10 +42771,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42764
42771
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42765
42772
|
*/
|
42766
42773
|
async fund(request, coinQuantities, fee) {
|
42767
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42768
42774
|
const updatedQuantities = addAmountToAsset({
|
42769
42775
|
amount: bn(fee),
|
42770
|
-
assetId:
|
42776
|
+
assetId: BaseAssetId,
|
42771
42777
|
coinQuantities
|
42772
42778
|
});
|
42773
42779
|
const quantitiesDict = {};
|
@@ -42791,8 +42797,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42791
42797
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42792
42798
|
cachedUtxos.push(input.id);
|
42793
42799
|
}
|
42794
|
-
} else if (input.recipient === owner && input.amount && quantitiesDict[
|
42795
|
-
quantitiesDict[
|
42800
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
42801
|
+
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42796
42802
|
cachedMessages.push(input.nonce);
|
42797
42803
|
}
|
42798
42804
|
}
|
@@ -42824,13 +42830,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42824
42830
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42825
42831
|
* @returns A promise that resolves to the prepared transaction request.
|
42826
42832
|
*/
|
42827
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
42833
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42828
42834
|
const { minGasPrice } = this.provider.getGasConfig();
|
42829
|
-
const
|
42830
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42831
|
-
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
42835
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42832
42836
|
const request = new ScriptTransactionRequest(params);
|
42833
|
-
request.addCoinOutput(Address.fromAddressOrString(destination), amount,
|
42837
|
+
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
42834
42838
|
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
42835
42839
|
estimateTxDependencies: true,
|
42836
42840
|
resourcesOwner: this
|
@@ -42856,15 +42860,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42856
42860
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42857
42861
|
* @returns A promise that resolves to the transaction response.
|
42858
42862
|
*/
|
42859
|
-
async transfer(destination, amount, assetId, txParams = {}) {
|
42863
|
+
async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42860
42864
|
if (bn(amount).lte(0)) {
|
42861
42865
|
throw new FuelError(
|
42862
42866
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
42863
42867
|
"Transfer amount must be a positive number."
|
42864
42868
|
);
|
42865
42869
|
}
|
42866
|
-
const
|
42867
|
-
const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
42870
|
+
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
42868
42871
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
42869
42872
|
}
|
42870
42873
|
/**
|
@@ -42876,7 +42879,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42876
42879
|
* @param txParams - The optional transaction parameters.
|
42877
42880
|
* @returns A promise that resolves to the transaction response.
|
42878
42881
|
*/
|
42879
|
-
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
42882
|
+
async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
|
42880
42883
|
if (bn(amount).lte(0)) {
|
42881
42884
|
throw new FuelError(
|
42882
42885
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
@@ -42885,13 +42888,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42885
42888
|
}
|
42886
42889
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42887
42890
|
const { minGasPrice } = this.provider.getGasConfig();
|
42888
|
-
const
|
42889
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42890
|
-
const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
|
42891
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42891
42892
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42892
42893
|
hexlifiedContractId: contractAddress.toB256(),
|
42893
42894
|
amountToTransfer: bn(amount),
|
42894
|
-
assetId
|
42895
|
+
assetId
|
42895
42896
|
});
|
42896
42897
|
const request = new ScriptTransactionRequest({
|
42897
42898
|
...params,
|
@@ -42901,7 +42902,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42901
42902
|
request.addContractInputAndOutput(contractAddress);
|
42902
42903
|
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42903
42904
|
request,
|
42904
|
-
[{ amount: bn(amount), assetId: String(
|
42905
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42905
42906
|
);
|
42906
42907
|
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42907
42908
|
this.validateGas({
|
@@ -42923,7 +42924,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42923
42924
|
*/
|
42924
42925
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42925
42926
|
const { minGasPrice } = this.provider.getGasConfig();
|
42926
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42927
42927
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42928
42928
|
const recipientDataArray = arrayify(
|
42929
42929
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42936,14 +42936,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42936
42936
|
...recipientDataArray,
|
42937
42937
|
...amountDataArray
|
42938
42938
|
]);
|
42939
|
-
const params = {
|
42940
|
-
script,
|
42941
|
-
gasPrice: minGasPrice,
|
42942
|
-
baseAssetId,
|
42943
|
-
...txParams
|
42944
|
-
};
|
42939
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
42945
42940
|
const request = new ScriptTransactionRequest(params);
|
42946
|
-
const forwardingQuantities = [{ amount: bn(amount), assetId:
|
42941
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42947
42942
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42948
42943
|
request,
|
42949
42944
|
forwardingQuantities
|
@@ -47906,9 +47901,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47906
47901
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
47907
47902
|
* @returns A promise that resolves to the prepared transaction request.
|
47908
47903
|
*/
|
47909
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
47910
|
-
const
|
47911
|
-
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);
|
47912
47906
|
return this.populateTransactionPredicateData(request);
|
47913
47907
|
}
|
47914
47908
|
/**
|