@fuel-ts/account 0.0.0-rc-2040-20240415161844 → 0.0.0-rc-2021-20240415193305
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 +1 -1
- package/dist/account.d.ts +5 -4
- package/dist/account.d.ts.map +1 -1
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +1 -1
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +1 -1
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +1 -1
- package/dist/configs.mjs.map +1 -1
- package/dist/index.global.js +833 -560
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +834 -555
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +684 -406
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +10 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +906 -324
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +4 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/message.d.ts +7 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +48 -27
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +2 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +8 -25
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +3 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +8 -2
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +1579 -1068
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +809 -548
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +678 -417
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +17 -17
package/dist/index.global.js
CHANGED
@@ -5113,7 +5113,7 @@
|
|
5113
5113
|
function isBlob(obj) {
|
5114
5114
|
return typeof obj === "object" && typeof obj.arrayBuffer === "function" && typeof obj.type === "string" && typeof obj.stream === "function" && typeof obj.constructor === "function" && typeof obj.constructor.name === "string" && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
|
5115
5115
|
}
|
5116
|
-
function
|
5116
|
+
function clone3(instance) {
|
5117
5117
|
let p1, p2;
|
5118
5118
|
let body = instance.body;
|
5119
5119
|
if (instance.bodyUsed) {
|
@@ -6047,7 +6047,7 @@
|
|
6047
6047
|
* @return Response
|
6048
6048
|
*/
|
6049
6049
|
clone() {
|
6050
|
-
return new Response2(
|
6050
|
+
return new Response2(clone3(this), {
|
6051
6051
|
url: this.url,
|
6052
6052
|
status: this.status,
|
6053
6053
|
statusText: this.statusText,
|
@@ -6097,7 +6097,7 @@
|
|
6097
6097
|
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
6098
6098
|
throw new TypeError("Request with GET/HEAD method cannot have body");
|
6099
6099
|
}
|
6100
|
-
let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ?
|
6100
|
+
let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone3(input) : null;
|
6101
6101
|
Body.call(this, inputBody, {
|
6102
6102
|
timeout: init.timeout || input.timeout || 0,
|
6103
6103
|
size: init.size || input.size || 0
|
@@ -28952,9 +28952,9 @@ spurious results.`);
|
|
28952
28952
|
// ../versions/dist/index.mjs
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
|
-
FORC: "0.
|
28956
|
-
FUEL_CORE: "0.
|
28957
|
-
FUELS: "0.
|
28955
|
+
FORC: "0.51.1",
|
28956
|
+
FUEL_CORE: "0.24.2",
|
28957
|
+
FUELS: "0.80.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
28960
28960
|
function parseVersion(version2) {
|
@@ -31495,10 +31495,160 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31495
31495
|
function toBytes3(value, bytesPadding) {
|
31496
31496
|
return bn(value).toBytes(bytesPadding);
|
31497
31497
|
}
|
31498
|
-
|
31499
|
-
|
31498
|
+
|
31499
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
31500
|
+
function _isPlaceholder(a) {
|
31501
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31502
|
+
}
|
31503
|
+
|
31504
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31505
|
+
function _curry1(fn) {
|
31506
|
+
return function f1(a) {
|
31507
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31508
|
+
return f1;
|
31509
|
+
} else {
|
31510
|
+
return fn.apply(this, arguments);
|
31511
|
+
}
|
31512
|
+
};
|
31500
31513
|
}
|
31501
31514
|
|
31515
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31516
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
31517
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31518
|
+
};
|
31519
|
+
|
31520
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31521
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31522
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31523
|
+
});
|
31524
|
+
var type_default = type;
|
31525
|
+
|
31526
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31527
|
+
var pad = function pad2(n) {
|
31528
|
+
return (n < 10 ? "0" : "") + n;
|
31529
|
+
};
|
31530
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31531
|
+
return d.toISOString();
|
31532
|
+
} : function _toISOString3(d) {
|
31533
|
+
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
31534
|
+
};
|
31535
|
+
|
31536
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31537
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31538
|
+
return n << 0 === n;
|
31539
|
+
};
|
31540
|
+
|
31541
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31542
|
+
function _cloneRegExp(pattern) {
|
31543
|
+
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
31544
|
+
}
|
31545
|
+
|
31546
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31547
|
+
function _clone(value, deep, map) {
|
31548
|
+
map || (map = new _ObjectMap());
|
31549
|
+
if (_isPrimitive(value)) {
|
31550
|
+
return value;
|
31551
|
+
}
|
31552
|
+
var copy = function copy2(copiedValue) {
|
31553
|
+
var cachedCopy = map.get(value);
|
31554
|
+
if (cachedCopy) {
|
31555
|
+
return cachedCopy;
|
31556
|
+
}
|
31557
|
+
map.set(value, copiedValue);
|
31558
|
+
for (var key in value) {
|
31559
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31560
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31561
|
+
}
|
31562
|
+
}
|
31563
|
+
return copiedValue;
|
31564
|
+
};
|
31565
|
+
switch (type_default(value)) {
|
31566
|
+
case "Object":
|
31567
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
31568
|
+
case "Array":
|
31569
|
+
return copy([]);
|
31570
|
+
case "Date":
|
31571
|
+
return new Date(value.valueOf());
|
31572
|
+
case "RegExp":
|
31573
|
+
return _cloneRegExp(value);
|
31574
|
+
case "Int8Array":
|
31575
|
+
case "Uint8Array":
|
31576
|
+
case "Uint8ClampedArray":
|
31577
|
+
case "Int16Array":
|
31578
|
+
case "Uint16Array":
|
31579
|
+
case "Int32Array":
|
31580
|
+
case "Uint32Array":
|
31581
|
+
case "Float32Array":
|
31582
|
+
case "Float64Array":
|
31583
|
+
case "BigInt64Array":
|
31584
|
+
case "BigUint64Array":
|
31585
|
+
return value.slice();
|
31586
|
+
default:
|
31587
|
+
return value;
|
31588
|
+
}
|
31589
|
+
}
|
31590
|
+
function _isPrimitive(param) {
|
31591
|
+
var type3 = typeof param;
|
31592
|
+
return param == null || type3 != "object" && type3 != "function";
|
31593
|
+
}
|
31594
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
31595
|
+
function _ObjectMap2() {
|
31596
|
+
this.map = {};
|
31597
|
+
this.length = 0;
|
31598
|
+
}
|
31599
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
31600
|
+
const hashedKey = this.hash(key);
|
31601
|
+
let bucket = this.map[hashedKey];
|
31602
|
+
if (!bucket) {
|
31603
|
+
this.map[hashedKey] = bucket = [];
|
31604
|
+
}
|
31605
|
+
bucket.push([key, value]);
|
31606
|
+
this.length += 1;
|
31607
|
+
};
|
31608
|
+
_ObjectMap2.prototype.hash = function(key) {
|
31609
|
+
let hashedKey = [];
|
31610
|
+
for (var value in key) {
|
31611
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31612
|
+
}
|
31613
|
+
return hashedKey.join();
|
31614
|
+
};
|
31615
|
+
_ObjectMap2.prototype.get = function(key) {
|
31616
|
+
if (this.length <= 180) {
|
31617
|
+
for (const p in this.map) {
|
31618
|
+
const bucket2 = this.map[p];
|
31619
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
31620
|
+
const element = bucket2[i];
|
31621
|
+
if (element[0] === key) {
|
31622
|
+
return element[1];
|
31623
|
+
}
|
31624
|
+
}
|
31625
|
+
}
|
31626
|
+
return;
|
31627
|
+
}
|
31628
|
+
const hashedKey = this.hash(key);
|
31629
|
+
const bucket = this.map[hashedKey];
|
31630
|
+
if (!bucket) {
|
31631
|
+
return;
|
31632
|
+
}
|
31633
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
31634
|
+
const element = bucket[i];
|
31635
|
+
if (element[0] === key) {
|
31636
|
+
return element[1];
|
31637
|
+
}
|
31638
|
+
}
|
31639
|
+
};
|
31640
|
+
return _ObjectMap2;
|
31641
|
+
}();
|
31642
|
+
|
31643
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31644
|
+
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31645
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31646
|
+
});
|
31647
|
+
var clone_default = clone;
|
31648
|
+
|
31649
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31650
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31651
|
+
|
31502
31652
|
// src/providers/coin-quantity.ts
|
31503
31653
|
var coinQuantityfy = (coinQuantityLike) => {
|
31504
31654
|
let assetId;
|
@@ -31520,7 +31670,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31520
31670
|
max: max2 ? bn(max2) : void 0
|
31521
31671
|
};
|
31522
31672
|
};
|
31523
|
-
var
|
31673
|
+
var addAmountToCoinQuantities = (params) => {
|
31524
31674
|
const { amount, assetId } = params;
|
31525
31675
|
const coinQuantities = [...params.coinQuantities];
|
31526
31676
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31605,6 +31755,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31605
31755
|
var ENCODING_V1 = "1";
|
31606
31756
|
var WORD_SIZE = 8;
|
31607
31757
|
var BYTES_32 = 32;
|
31758
|
+
var UTXO_ID_LEN = BYTES_32 + 2;
|
31608
31759
|
var ASSET_ID_LEN = BYTES_32;
|
31609
31760
|
var ADDRESS_LEN = BYTES_32;
|
31610
31761
|
var NONCE_LEN = BYTES_32;
|
@@ -31612,9 +31763,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31612
31763
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31613
31764
|
var MAX_BYTES = 2 ** 32 - 1;
|
31614
31765
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31615
|
-
|
31766
|
+
ASSET_ID_LEN + // Base asset ID
|
31616
31767
|
// Asset ID/Balance coin input pairs
|
31617
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31768
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
|
31618
31769
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31619
31770
|
WORD_SIZE + // Gas limit
|
31620
31771
|
WORD_SIZE + // Script size
|
@@ -31632,7 +31783,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31632
31783
|
ASSET_ID_LEN + // Asset id
|
31633
31784
|
TX_POINTER_LEN + // TxPointer
|
31634
31785
|
WORD_SIZE + // Witnesses index
|
31635
|
-
WORD_SIZE + // Maturity
|
31636
31786
|
WORD_SIZE + // Predicate size
|
31637
31787
|
WORD_SIZE + // Predicate data size
|
31638
31788
|
WORD_SIZE;
|
@@ -33370,18 +33520,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33370
33520
|
encode(value) {
|
33371
33521
|
const parts = [];
|
33372
33522
|
parts.push(new B256Coder().encode(value.txID));
|
33373
|
-
parts.push(new NumberCoder("
|
33523
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
33374
33524
|
parts.push(new B256Coder().encode(value.owner));
|
33375
33525
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33376
33526
|
parts.push(new B256Coder().encode(value.assetId));
|
33377
33527
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33378
|
-
parts.push(new NumberCoder("
|
33379
|
-
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33528
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
33380
33529
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33381
|
-
parts.push(new
|
33382
|
-
parts.push(new
|
33383
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33384
|
-
parts.push(
|
33530
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33531
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33532
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33533
|
+
parts.push(
|
33534
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33535
|
+
);
|
33385
33536
|
return concat(parts);
|
33386
33537
|
}
|
33387
33538
|
decode(data, offset) {
|
@@ -33389,7 +33540,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33389
33540
|
let o = offset;
|
33390
33541
|
[decoded, o] = new B256Coder().decode(data, o);
|
33391
33542
|
const txID = decoded;
|
33392
|
-
[decoded, o] = new NumberCoder("
|
33543
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33393
33544
|
const outputIndex = decoded;
|
33394
33545
|
[decoded, o] = new B256Coder().decode(data, o);
|
33395
33546
|
const owner = decoded;
|
@@ -33399,19 +33550,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33399
33550
|
const assetId = decoded;
|
33400
33551
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33401
33552
|
const txPointer = decoded;
|
33402
|
-
[decoded, o] = new NumberCoder("
|
33553
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33403
33554
|
const witnessIndex = Number(decoded);
|
33404
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33405
|
-
const maturity = decoded;
|
33406
33555
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33407
33556
|
const predicateGasUsed = decoded;
|
33408
|
-
[decoded, o] = new
|
33557
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33409
33558
|
const predicateLength = decoded;
|
33410
|
-
[decoded, o] = new
|
33559
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33411
33560
|
const predicateDataLength = decoded;
|
33412
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33561
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33413
33562
|
const predicate = decoded;
|
33414
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33563
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
33415
33564
|
const predicateData = decoded;
|
33416
33565
|
return [
|
33417
33566
|
{
|
@@ -33423,7 +33572,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33423
33572
|
assetId,
|
33424
33573
|
txPointer,
|
33425
33574
|
witnessIndex,
|
33426
|
-
maturity,
|
33427
33575
|
predicateGasUsed,
|
33428
33576
|
predicateLength,
|
33429
33577
|
predicateDataLength,
|
@@ -33441,7 +33589,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33441
33589
|
encode(value) {
|
33442
33590
|
const parts = [];
|
33443
33591
|
parts.push(new B256Coder().encode(value.txID));
|
33444
|
-
parts.push(new NumberCoder("
|
33592
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
33445
33593
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33446
33594
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33447
33595
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33453,7 +33601,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33453
33601
|
let o = offset;
|
33454
33602
|
[decoded, o] = new B256Coder().decode(data, o);
|
33455
33603
|
const txID = decoded;
|
33456
|
-
[decoded, o] = new NumberCoder("
|
33604
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33457
33605
|
const outputIndex = decoded;
|
33458
33606
|
[decoded, o] = new B256Coder().decode(data, o);
|
33459
33607
|
const balanceRoot = decoded;
|
@@ -33502,14 +33650,16 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33502
33650
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33503
33651
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33504
33652
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33505
|
-
parts.push(new NumberCoder("
|
33653
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
33506
33654
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33507
|
-
parts.push(new
|
33508
|
-
parts.push(new
|
33509
|
-
parts.push(new
|
33655
|
+
parts.push(new BigNumberCoder("u64").encode(data.length));
|
33656
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33657
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33510
33658
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33511
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33512
|
-
parts.push(
|
33659
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33660
|
+
parts.push(
|
33661
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33662
|
+
);
|
33513
33663
|
return concat(parts);
|
33514
33664
|
}
|
33515
33665
|
static decodeData(messageData) {
|
@@ -33529,21 +33679,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33529
33679
|
const amount = decoded;
|
33530
33680
|
[decoded, o] = new B256Coder().decode(data, o);
|
33531
33681
|
const nonce = decoded;
|
33532
|
-
[decoded, o] = new NumberCoder("
|
33682
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33533
33683
|
const witnessIndex = Number(decoded);
|
33534
33684
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33535
33685
|
const predicateGasUsed = decoded;
|
33536
33686
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33537
33687
|
const dataLength2 = decoded;
|
33538
|
-
[decoded, o] = new
|
33688
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33539
33689
|
const predicateLength = decoded;
|
33540
|
-
[decoded, o] = new
|
33690
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33541
33691
|
const predicateDataLength = decoded;
|
33542
33692
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33543
33693
|
const messageData = decoded;
|
33544
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33694
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33545
33695
|
const predicate = decoded;
|
33546
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33696
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
33547
33697
|
const predicateData = decoded;
|
33548
33698
|
return [
|
33549
33699
|
{
|
@@ -33855,7 +34005,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33855
34005
|
}
|
33856
34006
|
};
|
33857
34007
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
33858
|
-
PolicyType2[PolicyType2["
|
34008
|
+
PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
|
33859
34009
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
33860
34010
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
33861
34011
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -33903,9 +34053,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33903
34053
|
let o = offset;
|
33904
34054
|
const policies = [];
|
33905
34055
|
if (policyTypes & 1) {
|
33906
|
-
const [
|
34056
|
+
const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
33907
34057
|
o = nextOffset;
|
33908
|
-
policies.push({ type: 1, data:
|
34058
|
+
policies.push({ type: 1, data: tip });
|
33909
34059
|
}
|
33910
34060
|
if (policyTypes & 2) {
|
33911
34061
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34137,15 +34287,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34137
34287
|
encode(value) {
|
34138
34288
|
const parts = [];
|
34139
34289
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34140
|
-
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34141
|
-
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34142
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34143
|
-
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34144
|
-
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34145
|
-
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34146
34290
|
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34147
|
-
parts.push(new
|
34148
|
-
parts.push(new
|
34291
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
|
34292
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34293
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34294
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34295
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34296
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34297
|
+
parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
|
34298
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
|
34149
34299
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34150
34300
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34151
34301
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34157,23 +34307,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34157
34307
|
let o = offset;
|
34158
34308
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34159
34309
|
const scriptGasLimit = decoded;
|
34160
|
-
[decoded, o] = new
|
34310
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34311
|
+
const receiptsRoot = decoded;
|
34312
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34161
34313
|
const scriptLength = decoded;
|
34162
|
-
[decoded, o] = new
|
34314
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34163
34315
|
const scriptDataLength = decoded;
|
34164
34316
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34165
34317
|
const policyTypes = decoded;
|
34166
|
-
[decoded, o] = new NumberCoder("
|
34318
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34167
34319
|
const inputsCount = decoded;
|
34168
|
-
[decoded, o] = new NumberCoder("
|
34320
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34169
34321
|
const outputsCount = decoded;
|
34170
|
-
[decoded, o] = new NumberCoder("
|
34322
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34171
34323
|
const witnessesCount = decoded;
|
34172
|
-
[decoded, o] = new
|
34173
|
-
const receiptsRoot = decoded;
|
34174
|
-
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34324
|
+
[decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
|
34175
34325
|
const script = decoded;
|
34176
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34326
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
|
34177
34327
|
const scriptData = decoded;
|
34178
34328
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34179
34329
|
const policies = decoded;
|
@@ -34211,18 +34361,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34211
34361
|
}
|
34212
34362
|
encode(value) {
|
34213
34363
|
const parts = [];
|
34214
|
-
parts.push(new NumberCoder("
|
34215
|
-
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34216
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34217
|
-
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
34218
|
-
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34219
|
-
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34220
|
-
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34364
|
+
parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
|
34221
34365
|
parts.push(new B256Coder().encode(value.salt));
|
34222
|
-
parts.push(new
|
34366
|
+
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34367
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34368
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34369
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34370
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34223
34371
|
parts.push(
|
34224
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(
|
34372
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
|
34373
|
+
value.storageSlots
|
34374
|
+
)
|
34225
34375
|
);
|
34376
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34226
34377
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34227
34378
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34228
34379
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34231,26 +34382,27 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34231
34382
|
decode(data, offset) {
|
34232
34383
|
let decoded;
|
34233
34384
|
let o = offset;
|
34234
|
-
[decoded, o] = new NumberCoder("
|
34235
|
-
const bytecodeLength = decoded;
|
34236
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34385
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34237
34386
|
const bytecodeWitnessIndex = decoded;
|
34387
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34388
|
+
const salt = decoded;
|
34389
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34390
|
+
const storageSlotsCount = decoded;
|
34238
34391
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34239
34392
|
const policyTypes = decoded;
|
34240
34393
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34241
|
-
const storageSlotsCount = decoded;
|
34242
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34243
34394
|
const inputsCount = decoded;
|
34244
|
-
[decoded, o] = new NumberCoder("
|
34395
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34245
34396
|
const outputsCount = decoded;
|
34246
|
-
[decoded, o] = new NumberCoder("
|
34397
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34247
34398
|
const witnessesCount = decoded;
|
34248
|
-
[decoded, o] = new
|
34249
|
-
|
34399
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
|
34400
|
+
data,
|
34401
|
+
o
|
34402
|
+
);
|
34403
|
+
const storageSlots = decoded;
|
34250
34404
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34251
34405
|
const policies = decoded;
|
34252
|
-
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34253
|
-
const storageSlots = decoded;
|
34254
34406
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34255
34407
|
const inputs = decoded;
|
34256
34408
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34260,7 +34412,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34260
34412
|
return [
|
34261
34413
|
{
|
34262
34414
|
type: 1,
|
34263
|
-
bytecodeLength,
|
34264
34415
|
bytecodeWitnessIndex,
|
34265
34416
|
policyTypes,
|
34266
34417
|
storageSlotsCount,
|
@@ -34289,6 +34440,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34289
34440
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34290
34441
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34291
34442
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34443
|
+
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34292
34444
|
return concat(parts);
|
34293
34445
|
}
|
34294
34446
|
decode(data, offset) {
|
@@ -34304,6 +34456,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34304
34456
|
const mintAmount = decoded;
|
34305
34457
|
[decoded, o] = new B256Coder().decode(data, o);
|
34306
34458
|
const mintAssetId = decoded;
|
34459
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34460
|
+
const gasPrice = decoded;
|
34307
34461
|
return [
|
34308
34462
|
{
|
34309
34463
|
type: 2,
|
@@ -34311,7 +34465,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34311
34465
|
inputContract,
|
34312
34466
|
outputContract,
|
34313
34467
|
mintAmount,
|
34314
|
-
mintAssetId
|
34468
|
+
mintAssetId,
|
34469
|
+
gasPrice
|
34315
34470
|
},
|
34316
34471
|
o
|
34317
34472
|
];
|
@@ -34618,159 +34773,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34618
34773
|
// src/providers/provider.ts
|
34619
34774
|
var import_graphql_request = __toESM(require_dist2());
|
34620
34775
|
|
34621
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34622
|
-
function _isPlaceholder(a) {
|
34623
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34624
|
-
}
|
34625
|
-
|
34626
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34627
|
-
function _curry1(fn) {
|
34628
|
-
return function f1(a) {
|
34629
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34630
|
-
return f1;
|
34631
|
-
} else {
|
34632
|
-
return fn.apply(this, arguments);
|
34633
|
-
}
|
34634
|
-
};
|
34635
|
-
}
|
34636
|
-
|
34637
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34638
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
34639
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34640
|
-
};
|
34641
|
-
|
34642
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34643
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34644
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34645
|
-
});
|
34646
|
-
var type_default = type;
|
34647
|
-
|
34648
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34649
|
-
var pad = function pad2(n) {
|
34650
|
-
return (n < 10 ? "0" : "") + n;
|
34651
|
-
};
|
34652
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34653
|
-
return d.toISOString();
|
34654
|
-
} : function _toISOString3(d) {
|
34655
|
-
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
34656
|
-
};
|
34657
|
-
|
34658
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34659
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34660
|
-
return n << 0 === n;
|
34661
|
-
};
|
34662
|
-
|
34663
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34664
|
-
function _cloneRegExp(pattern) {
|
34665
|
-
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
34666
|
-
}
|
34667
|
-
|
34668
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34669
|
-
function _clone(value, deep, map) {
|
34670
|
-
map || (map = new _ObjectMap());
|
34671
|
-
if (_isPrimitive(value)) {
|
34672
|
-
return value;
|
34673
|
-
}
|
34674
|
-
var copy = function copy2(copiedValue) {
|
34675
|
-
var cachedCopy = map.get(value);
|
34676
|
-
if (cachedCopy) {
|
34677
|
-
return cachedCopy;
|
34678
|
-
}
|
34679
|
-
map.set(value, copiedValue);
|
34680
|
-
for (var key in value) {
|
34681
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34682
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34683
|
-
}
|
34684
|
-
}
|
34685
|
-
return copiedValue;
|
34686
|
-
};
|
34687
|
-
switch (type_default(value)) {
|
34688
|
-
case "Object":
|
34689
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
34690
|
-
case "Array":
|
34691
|
-
return copy([]);
|
34692
|
-
case "Date":
|
34693
|
-
return new Date(value.valueOf());
|
34694
|
-
case "RegExp":
|
34695
|
-
return _cloneRegExp(value);
|
34696
|
-
case "Int8Array":
|
34697
|
-
case "Uint8Array":
|
34698
|
-
case "Uint8ClampedArray":
|
34699
|
-
case "Int16Array":
|
34700
|
-
case "Uint16Array":
|
34701
|
-
case "Int32Array":
|
34702
|
-
case "Uint32Array":
|
34703
|
-
case "Float32Array":
|
34704
|
-
case "Float64Array":
|
34705
|
-
case "BigInt64Array":
|
34706
|
-
case "BigUint64Array":
|
34707
|
-
return value.slice();
|
34708
|
-
default:
|
34709
|
-
return value;
|
34710
|
-
}
|
34711
|
-
}
|
34712
|
-
function _isPrimitive(param) {
|
34713
|
-
var type3 = typeof param;
|
34714
|
-
return param == null || type3 != "object" && type3 != "function";
|
34715
|
-
}
|
34716
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
34717
|
-
function _ObjectMap2() {
|
34718
|
-
this.map = {};
|
34719
|
-
this.length = 0;
|
34720
|
-
}
|
34721
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
34722
|
-
const hashedKey = this.hash(key);
|
34723
|
-
let bucket = this.map[hashedKey];
|
34724
|
-
if (!bucket) {
|
34725
|
-
this.map[hashedKey] = bucket = [];
|
34726
|
-
}
|
34727
|
-
bucket.push([key, value]);
|
34728
|
-
this.length += 1;
|
34729
|
-
};
|
34730
|
-
_ObjectMap2.prototype.hash = function(key) {
|
34731
|
-
let hashedKey = [];
|
34732
|
-
for (var value in key) {
|
34733
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34734
|
-
}
|
34735
|
-
return hashedKey.join();
|
34736
|
-
};
|
34737
|
-
_ObjectMap2.prototype.get = function(key) {
|
34738
|
-
if (this.length <= 180) {
|
34739
|
-
for (const p in this.map) {
|
34740
|
-
const bucket2 = this.map[p];
|
34741
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
34742
|
-
const element = bucket2[i];
|
34743
|
-
if (element[0] === key) {
|
34744
|
-
return element[1];
|
34745
|
-
}
|
34746
|
-
}
|
34747
|
-
}
|
34748
|
-
return;
|
34749
|
-
}
|
34750
|
-
const hashedKey = this.hash(key);
|
34751
|
-
const bucket = this.map[hashedKey];
|
34752
|
-
if (!bucket) {
|
34753
|
-
return;
|
34754
|
-
}
|
34755
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
34756
|
-
const element = bucket[i];
|
34757
|
-
if (element[0] === key) {
|
34758
|
-
return element[1];
|
34759
|
-
}
|
34760
|
-
}
|
34761
|
-
};
|
34762
|
-
return _ObjectMap2;
|
34763
|
-
}();
|
34764
|
-
|
34765
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34766
|
-
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34767
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34768
|
-
});
|
34769
|
-
var clone_default = clone2;
|
34770
|
-
|
34771
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34772
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34773
|
-
|
34774
34776
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34775
34777
|
var __assign = function() {
|
34776
34778
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37938,14 +37940,10 @@ spurious results.`);
|
|
37938
37940
|
// src/providers/__generated__/operations.ts
|
37939
37941
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37940
37942
|
fragment receiptFragment on Receipt {
|
37941
|
-
|
37942
|
-
id
|
37943
|
-
}
|
37943
|
+
id
|
37944
37944
|
pc
|
37945
37945
|
is
|
37946
|
-
to
|
37947
|
-
id
|
37948
|
-
}
|
37946
|
+
to
|
37949
37947
|
toAddress
|
37950
37948
|
amount
|
37951
37949
|
assetId
|
@@ -37983,10 +37981,16 @@ spurious results.`);
|
|
37983
37981
|
id
|
37984
37982
|
}
|
37985
37983
|
time
|
37984
|
+
receipts {
|
37985
|
+
...receiptFragment
|
37986
|
+
}
|
37986
37987
|
programState {
|
37987
37988
|
returnType
|
37988
37989
|
data
|
37989
37990
|
}
|
37991
|
+
receipts {
|
37992
|
+
...receiptFragment
|
37993
|
+
}
|
37990
37994
|
}
|
37991
37995
|
... on FailureStatus {
|
37992
37996
|
block {
|
@@ -37994,26 +37998,24 @@ spurious results.`);
|
|
37994
37998
|
}
|
37995
37999
|
time
|
37996
38000
|
reason
|
38001
|
+
receipts {
|
38002
|
+
...receiptFragment
|
38003
|
+
}
|
37997
38004
|
}
|
37998
38005
|
... on SqueezedOutStatus {
|
37999
38006
|
reason
|
38000
38007
|
}
|
38001
38008
|
}
|
38002
|
-
`;
|
38009
|
+
${ReceiptFragmentFragmentDoc}`;
|
38003
38010
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38004
38011
|
fragment transactionFragment on Transaction {
|
38005
38012
|
id
|
38006
38013
|
rawPayload
|
38007
|
-
gasPrice
|
38008
|
-
receipts {
|
38009
|
-
...receiptFragment
|
38010
|
-
}
|
38011
38014
|
status {
|
38012
38015
|
...transactionStatusFragment
|
38013
38016
|
}
|
38014
38017
|
}
|
38015
|
-
${
|
38016
|
-
${TransactionStatusFragmentFragmentDoc}`;
|
38018
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38017
38019
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38018
38020
|
fragment inputEstimatePredicatesFragment on Input {
|
38019
38021
|
... on InputCoin {
|
@@ -38031,6 +38033,46 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38031
38033
|
}
|
38032
38034
|
}
|
38033
38035
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38036
|
+
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38037
|
+
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38038
|
+
reason
|
38039
|
+
programState {
|
38040
|
+
returnType
|
38041
|
+
data
|
38042
|
+
}
|
38043
|
+
}
|
38044
|
+
`;
|
38045
|
+
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38046
|
+
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38047
|
+
programState {
|
38048
|
+
returnType
|
38049
|
+
data
|
38050
|
+
}
|
38051
|
+
}
|
38052
|
+
`;
|
38053
|
+
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38054
|
+
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38055
|
+
... on DryRunFailureStatus {
|
38056
|
+
...dryRunFailureStatusFragment
|
38057
|
+
}
|
38058
|
+
... on DryRunSuccessStatus {
|
38059
|
+
...dryRunSuccessStatusFragment
|
38060
|
+
}
|
38061
|
+
}
|
38062
|
+
${DryRunFailureStatusFragmentFragmentDoc}
|
38063
|
+
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38064
|
+
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38065
|
+
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38066
|
+
id
|
38067
|
+
status {
|
38068
|
+
...dryRunTransactionStatusFragment
|
38069
|
+
}
|
38070
|
+
receipts {
|
38071
|
+
...receiptFragment
|
38072
|
+
}
|
38073
|
+
}
|
38074
|
+
${DryRunTransactionStatusFragmentFragmentDoc}
|
38075
|
+
${ReceiptFragmentFragmentDoc}`;
|
38034
38076
|
var CoinFragmentFragmentDoc = lib_default2`
|
38035
38077
|
fragment coinFragment on Coin {
|
38036
38078
|
__typename
|
@@ -38038,7 +38080,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38038
38080
|
owner
|
38039
38081
|
amount
|
38040
38082
|
assetId
|
38041
|
-
maturity
|
38042
38083
|
blockCreated
|
38043
38084
|
txCreatedIdx
|
38044
38085
|
}
|
@@ -38077,26 +38118,32 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38077
38118
|
messageBlockHeader {
|
38078
38119
|
id
|
38079
38120
|
daHeight
|
38121
|
+
consensusParametersVersion
|
38122
|
+
stateTransitionBytecodeVersion
|
38080
38123
|
transactionsCount
|
38124
|
+
messageReceiptCount
|
38081
38125
|
transactionsRoot
|
38126
|
+
messageOutboxRoot
|
38127
|
+
eventInboxRoot
|
38082
38128
|
height
|
38083
38129
|
prevRoot
|
38084
38130
|
time
|
38085
38131
|
applicationHash
|
38086
|
-
messageReceiptRoot
|
38087
|
-
messageReceiptCount
|
38088
38132
|
}
|
38089
38133
|
commitBlockHeader {
|
38090
38134
|
id
|
38091
38135
|
daHeight
|
38136
|
+
consensusParametersVersion
|
38137
|
+
stateTransitionBytecodeVersion
|
38092
38138
|
transactionsCount
|
38139
|
+
messageReceiptCount
|
38093
38140
|
transactionsRoot
|
38141
|
+
messageOutboxRoot
|
38142
|
+
eventInboxRoot
|
38094
38143
|
height
|
38095
38144
|
prevRoot
|
38096
38145
|
time
|
38097
38146
|
applicationHash
|
38098
|
-
messageReceiptRoot
|
38099
|
-
messageReceiptCount
|
38100
38147
|
}
|
38101
38148
|
sender
|
38102
38149
|
recipient
|
@@ -38115,8 +38162,8 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38115
38162
|
var BlockFragmentFragmentDoc = lib_default2`
|
38116
38163
|
fragment blockFragment on Block {
|
38117
38164
|
id
|
38165
|
+
height
|
38118
38166
|
header {
|
38119
|
-
height
|
38120
38167
|
time
|
38121
38168
|
}
|
38122
38169
|
transactions {
|
@@ -38174,6 +38221,11 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38174
38221
|
`;
|
38175
38222
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38176
38223
|
fragment GasCostsFragment on GasCosts {
|
38224
|
+
version {
|
38225
|
+
... on Version {
|
38226
|
+
value
|
38227
|
+
}
|
38228
|
+
}
|
38177
38229
|
add
|
38178
38230
|
addi
|
38179
38231
|
aloc
|
@@ -38186,7 +38238,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38186
38238
|
cb
|
38187
38239
|
cfei
|
38188
38240
|
cfsi
|
38189
|
-
croo
|
38190
38241
|
div
|
38191
38242
|
divi
|
38192
38243
|
ecr1
|
@@ -38269,6 +38320,9 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38269
38320
|
ccp {
|
38270
38321
|
...DependentCostFragment
|
38271
38322
|
}
|
38323
|
+
croo {
|
38324
|
+
...DependentCostFragment
|
38325
|
+
}
|
38272
38326
|
csiz {
|
38273
38327
|
...DependentCostFragment
|
38274
38328
|
}
|
@@ -38328,6 +38382,11 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38328
38382
|
${DependentCostFragmentFragmentDoc}`;
|
38329
38383
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38330
38384
|
fragment consensusParametersFragment on ConsensusParameters {
|
38385
|
+
version {
|
38386
|
+
... on Version {
|
38387
|
+
value
|
38388
|
+
}
|
38389
|
+
}
|
38331
38390
|
txParams {
|
38332
38391
|
...TxParametersFragment
|
38333
38392
|
}
|
@@ -38387,18 +38446,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38387
38446
|
fragment nodeInfoFragment on NodeInfo {
|
38388
38447
|
utxoValidation
|
38389
38448
|
vmBacktrace
|
38390
|
-
minGasPrice
|
38391
38449
|
maxTx
|
38392
38450
|
maxDepth
|
38393
38451
|
nodeVersion
|
38394
|
-
peers {
|
38395
|
-
id
|
38396
|
-
addresses
|
38397
|
-
clientVersion
|
38398
|
-
blockHeight
|
38399
|
-
lastHeartbeatMs
|
38400
|
-
appScore
|
38401
|
-
}
|
38402
38452
|
}
|
38403
38453
|
`;
|
38404
38454
|
var GetVersionDocument = lib_default2`
|
@@ -38433,13 +38483,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38433
38483
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38434
38484
|
transaction(id: $transactionId) {
|
38435
38485
|
...transactionFragment
|
38436
|
-
receipts {
|
38437
|
-
...receiptFragment
|
38438
|
-
}
|
38439
38486
|
}
|
38440
38487
|
}
|
38441
|
-
${TransactionFragmentFragmentDoc}
|
38442
|
-
${ReceiptFragmentFragmentDoc}`;
|
38488
|
+
${TransactionFragmentFragmentDoc}`;
|
38443
38489
|
var GetTransactionsDocument = lib_default2`
|
38444
38490
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38445
38491
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38567,6 +38613,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38567
38613
|
}
|
38568
38614
|
}
|
38569
38615
|
${BalanceFragmentFragmentDoc}`;
|
38616
|
+
var GetLatestGasPriceDocument = lib_default2`
|
38617
|
+
query getLatestGasPrice {
|
38618
|
+
latestGasPrice {
|
38619
|
+
gasPrice
|
38620
|
+
}
|
38621
|
+
}
|
38622
|
+
`;
|
38623
|
+
var EstimateGasPriceDocument = lib_default2`
|
38624
|
+
query estimateGasPrice($blockHorizon: U32!) {
|
38625
|
+
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38626
|
+
gasPrice
|
38627
|
+
}
|
38628
|
+
}
|
38629
|
+
`;
|
38570
38630
|
var GetBalancesDocument = lib_default2`
|
38571
38631
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38572
38632
|
balances(
|
@@ -38621,12 +38681,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38621
38681
|
}
|
38622
38682
|
`;
|
38623
38683
|
var DryRunDocument = lib_default2`
|
38624
|
-
mutation dryRun($
|
38625
|
-
dryRun(
|
38626
|
-
...
|
38684
|
+
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
38685
|
+
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
38686
|
+
...dryRunTransactionExecutionStatusFragment
|
38627
38687
|
}
|
38628
38688
|
}
|
38629
|
-
${
|
38689
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
38630
38690
|
var SubmitDocument = lib_default2`
|
38631
38691
|
mutation submit($encodedTransaction: HexString!) {
|
38632
38692
|
submit(tx: $encodedTransaction) {
|
@@ -38709,6 +38769,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38709
38769
|
getBalance(variables, options) {
|
38710
38770
|
return requester(GetBalanceDocument, variables, options);
|
38711
38771
|
},
|
38772
|
+
getLatestGasPrice(variables, options) {
|
38773
|
+
return requester(GetLatestGasPriceDocument, variables, options);
|
38774
|
+
},
|
38775
|
+
estimateGasPrice(variables, options) {
|
38776
|
+
return requester(EstimateGasPriceDocument, variables, options);
|
38777
|
+
},
|
38712
38778
|
getBalances(variables, options) {
|
38713
38779
|
return requester(GetBalancesDocument, variables, options);
|
38714
38780
|
},
|
@@ -38776,11 +38842,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38776
38842
|
let data;
|
38777
38843
|
let errors;
|
38778
38844
|
try {
|
38779
|
-
|
38845
|
+
const sanitizedText = text.replace(/\s/g, "");
|
38846
|
+
({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
|
38780
38847
|
} catch (e) {
|
38781
38848
|
throw new FuelError(
|
38782
38849
|
ErrorCode.STREAM_PARSING_ERROR,
|
38783
|
-
`Error while parsing stream data response: ${text}
|
38850
|
+
`Error while parsing stream data response: ${text}
|
38851
|
+
|
38852
|
+
Thrown error: ${e}`
|
38784
38853
|
);
|
38785
38854
|
}
|
38786
38855
|
if (Array.isArray(errors)) {
|
@@ -38873,8 +38942,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38873
38942
|
const predicateData = arrayify(value.predicateData ?? "0x");
|
38874
38943
|
return {
|
38875
38944
|
type: InputType.Coin,
|
38876
|
-
txID: hexlify(arrayify(value.id).slice(0,
|
38877
|
-
outputIndex: arrayify(value.id)
|
38945
|
+
txID: hexlify(arrayify(value.id).slice(0, BYTES_32)),
|
38946
|
+
outputIndex: toNumber2(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
|
38878
38947
|
owner: hexlify(value.owner),
|
38879
38948
|
amount: bn(value.amount),
|
38880
38949
|
assetId: hexlify(value.assetId),
|
@@ -38883,10 +38952,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38883
38952
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38884
38953
|
},
|
38885
38954
|
witnessIndex: value.witnessIndex,
|
38886
|
-
maturity: value.maturity ?? 0,
|
38887
38955
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38888
|
-
predicateLength: predicate.length,
|
38889
|
-
predicateDataLength: predicateData.length,
|
38956
|
+
predicateLength: bn(predicate.length),
|
38957
|
+
predicateDataLength: bn(predicateData.length),
|
38890
38958
|
predicate: hexlify(predicate),
|
38891
38959
|
predicateData: hexlify(predicateData)
|
38892
38960
|
};
|
@@ -38917,8 +38985,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38917
38985
|
nonce: hexlify(value.nonce),
|
38918
38986
|
witnessIndex: value.witnessIndex,
|
38919
38987
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38920
|
-
predicateLength: predicate.length,
|
38921
|
-
predicateDataLength: predicateData.length,
|
38988
|
+
predicateLength: bn(predicate.length),
|
38989
|
+
predicateDataLength: bn(predicateData.length),
|
38922
38990
|
predicate: hexlify(predicate),
|
38923
38991
|
predicateData: hexlify(predicateData),
|
38924
38992
|
data: hexlify(data),
|
@@ -39078,8 +39146,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39078
39146
|
case "CALL" /* Call */: {
|
39079
39147
|
const callReceipt = {
|
39080
39148
|
type: ReceiptType.Call,
|
39081
|
-
from: hexOrZero(receipt.
|
39082
|
-
to: hexOrZero(receipt?.to
|
39149
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39150
|
+
to: hexOrZero(receipt?.to),
|
39083
39151
|
amount: bn(receipt.amount),
|
39084
39152
|
assetId: hexOrZero(receipt.assetId),
|
39085
39153
|
gas: bn(receipt.gas),
|
@@ -39093,7 +39161,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39093
39161
|
case "RETURN" /* Return */: {
|
39094
39162
|
const returnReceipt = {
|
39095
39163
|
type: ReceiptType.Return,
|
39096
|
-
id: hexOrZero(receipt.
|
39164
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39097
39165
|
val: bn(receipt.val),
|
39098
39166
|
pc: bn(receipt.pc),
|
39099
39167
|
is: bn(receipt.is)
|
@@ -39103,7 +39171,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39103
39171
|
case "RETURN_DATA" /* ReturnData */: {
|
39104
39172
|
const returnDataReceipt = {
|
39105
39173
|
type: ReceiptType.ReturnData,
|
39106
|
-
id: hexOrZero(receipt.
|
39174
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39107
39175
|
ptr: bn(receipt.ptr),
|
39108
39176
|
len: bn(receipt.len),
|
39109
39177
|
digest: hexOrZero(receipt.digest),
|
@@ -39115,7 +39183,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39115
39183
|
case "PANIC" /* Panic */: {
|
39116
39184
|
const panicReceipt = {
|
39117
39185
|
type: ReceiptType.Panic,
|
39118
|
-
id: hexOrZero(receipt.
|
39186
|
+
id: hexOrZero(receipt.id),
|
39119
39187
|
reason: bn(receipt.reason),
|
39120
39188
|
pc: bn(receipt.pc),
|
39121
39189
|
is: bn(receipt.is),
|
@@ -39126,7 +39194,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39126
39194
|
case "REVERT" /* Revert */: {
|
39127
39195
|
const revertReceipt = {
|
39128
39196
|
type: ReceiptType.Revert,
|
39129
|
-
id: hexOrZero(receipt.
|
39197
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39130
39198
|
val: bn(receipt.ra),
|
39131
39199
|
pc: bn(receipt.pc),
|
39132
39200
|
is: bn(receipt.is)
|
@@ -39136,7 +39204,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39136
39204
|
case "LOG" /* Log */: {
|
39137
39205
|
const logReceipt = {
|
39138
39206
|
type: ReceiptType.Log,
|
39139
|
-
id: hexOrZero(receipt.
|
39207
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39140
39208
|
val0: bn(receipt.ra),
|
39141
39209
|
val1: bn(receipt.rb),
|
39142
39210
|
val2: bn(receipt.rc),
|
@@ -39149,7 +39217,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39149
39217
|
case "LOG_DATA" /* LogData */: {
|
39150
39218
|
const logDataReceipt = {
|
39151
39219
|
type: ReceiptType.LogData,
|
39152
|
-
id: hexOrZero(receipt.
|
39220
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39153
39221
|
val0: bn(receipt.ra),
|
39154
39222
|
val1: bn(receipt.rb),
|
39155
39223
|
ptr: bn(receipt.ptr),
|
@@ -39163,8 +39231,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39163
39231
|
case "TRANSFER" /* Transfer */: {
|
39164
39232
|
const transferReceipt = {
|
39165
39233
|
type: ReceiptType.Transfer,
|
39166
|
-
from: hexOrZero(receipt.
|
39167
|
-
to: hexOrZero(receipt.toAddress || receipt?.to
|
39234
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39235
|
+
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39168
39236
|
amount: bn(receipt.amount),
|
39169
39237
|
assetId: hexOrZero(receipt.assetId),
|
39170
39238
|
pc: bn(receipt.pc),
|
@@ -39175,8 +39243,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39175
39243
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39176
39244
|
const transferOutReceipt = {
|
39177
39245
|
type: ReceiptType.TransferOut,
|
39178
|
-
from: hexOrZero(receipt.
|
39179
|
-
to: hexOrZero(receipt.toAddress || receipt.to
|
39246
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39247
|
+
to: hexOrZero(receipt.toAddress || receipt.to),
|
39180
39248
|
amount: bn(receipt.amount),
|
39181
39249
|
assetId: hexOrZero(receipt.assetId),
|
39182
39250
|
pc: bn(receipt.pc),
|
@@ -39219,7 +39287,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39219
39287
|
return receiptMessageOut;
|
39220
39288
|
}
|
39221
39289
|
case "MINT" /* Mint */: {
|
39222
|
-
const contractId = hexOrZero(receipt.
|
39290
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39223
39291
|
const subId = hexOrZero(receipt.subId);
|
39224
39292
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39225
39293
|
const mintReceipt = {
|
@@ -39234,7 +39302,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39234
39302
|
return mintReceipt;
|
39235
39303
|
}
|
39236
39304
|
case "BURN" /* Burn */: {
|
39237
|
-
const contractId = hexOrZero(receipt.
|
39305
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39238
39306
|
const subId = hexOrZero(receipt.subId);
|
39239
39307
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39240
39308
|
const burnReceipt = {
|
@@ -39315,7 +39383,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39315
39383
|
};
|
39316
39384
|
|
39317
39385
|
// src/providers/utils/gas.ts
|
39318
|
-
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39319
39386
|
var getGasUsedFromReceipts = (receipts) => {
|
39320
39387
|
const scriptResult = receipts.filter(
|
39321
39388
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39336,18 +39403,28 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39336
39403
|
}
|
39337
39404
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39338
39405
|
const witnessCache = [];
|
39339
|
-
const
|
39406
|
+
const chargeableInputs = inputs.filter((input) => {
|
39407
|
+
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39408
|
+
if (isCoinOrMessage) {
|
39409
|
+
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39410
|
+
return true;
|
39411
|
+
}
|
39412
|
+
if (!witnessCache.includes(input.witnessIndex)) {
|
39413
|
+
witnessCache.push(input.witnessIndex);
|
39414
|
+
return true;
|
39415
|
+
}
|
39416
|
+
}
|
39417
|
+
return false;
|
39418
|
+
});
|
39419
|
+
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39420
|
+
const totalGas = chargeableInputs.reduce((total, input) => {
|
39340
39421
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39341
39422
|
return total.add(
|
39342
|
-
|
39423
|
+
vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39343
39424
|
);
|
39344
39425
|
}
|
39345
|
-
|
39346
|
-
|
39347
|
-
return total.add(gasCosts.ecr1);
|
39348
|
-
}
|
39349
|
-
return total;
|
39350
|
-
}, bn());
|
39426
|
+
return total.add(gasCosts.ecr1);
|
39427
|
+
}, bn(0));
|
39351
39428
|
return totalGas;
|
39352
39429
|
}
|
39353
39430
|
function getMinGas(params) {
|
@@ -39359,12 +39436,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39359
39436
|
return minGas;
|
39360
39437
|
}
|
39361
39438
|
function getMaxGas(params) {
|
39362
|
-
const {
|
39439
|
+
const {
|
39440
|
+
gasPerByte,
|
39441
|
+
witnessesLength,
|
39442
|
+
witnessLimit,
|
39443
|
+
minGas,
|
39444
|
+
gasLimit = bn(0),
|
39445
|
+
maxGasPerTx
|
39446
|
+
} = params;
|
39363
39447
|
let remainingAllowedWitnessGas = bn(0);
|
39364
39448
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39365
39449
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39366
39450
|
}
|
39367
|
-
|
39451
|
+
const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39452
|
+
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39368
39453
|
}
|
39369
39454
|
function calculateMetadataGasForTxCreate({
|
39370
39455
|
gasCosts,
|
@@ -39386,6 +39471,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39386
39471
|
}) {
|
39387
39472
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39388
39473
|
}
|
39474
|
+
var calculateGasFee = (params) => {
|
39475
|
+
const { gas, gasPrice, priceFactor, tip } = params;
|
39476
|
+
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39477
|
+
};
|
39389
39478
|
|
39390
39479
|
// src/providers/utils/json.ts
|
39391
39480
|
function normalize2(object) {
|
@@ -39527,7 +39616,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39527
39616
|
// src/providers/transaction-request/transaction-request.ts
|
39528
39617
|
var BaseTransactionRequest = class {
|
39529
39618
|
/** Gas price for transaction */
|
39530
|
-
|
39619
|
+
tip;
|
39531
39620
|
/** Block until which tx cannot be included */
|
39532
39621
|
maturity;
|
39533
39622
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39546,7 +39635,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39546
39635
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39547
39636
|
*/
|
39548
39637
|
constructor({
|
39549
|
-
|
39638
|
+
tip,
|
39550
39639
|
maturity,
|
39551
39640
|
maxFee,
|
39552
39641
|
witnessLimit,
|
@@ -39554,7 +39643,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39554
39643
|
outputs,
|
39555
39644
|
witnesses
|
39556
39645
|
} = {}) {
|
39557
|
-
this.
|
39646
|
+
this.tip = bn(tip);
|
39558
39647
|
this.maturity = maturity ?? 0;
|
39559
39648
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39560
39649
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39565,9 +39654,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39565
39654
|
static getPolicyMeta(req) {
|
39566
39655
|
let policyTypes = 0;
|
39567
39656
|
const policies = [];
|
39568
|
-
if (req.
|
39569
|
-
policyTypes += PolicyType.
|
39570
|
-
policies.push({ data: req.
|
39657
|
+
if (req.tip) {
|
39658
|
+
policyTypes += PolicyType.Tip;
|
39659
|
+
policies.push({ data: req.tip, type: PolicyType.Tip });
|
39571
39660
|
}
|
39572
39661
|
if (req.witnessLimit) {
|
39573
39662
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39754,10 +39843,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39754
39843
|
* @param predicate - Predicate bytes.
|
39755
39844
|
* @param predicateData - Predicate data bytes.
|
39756
39845
|
*/
|
39757
|
-
addCoinInput(coin
|
39846
|
+
addCoinInput(coin) {
|
39758
39847
|
const { assetId, owner, amount } = coin;
|
39759
39848
|
let witnessIndex;
|
39760
|
-
if (predicate) {
|
39849
|
+
if (coin.predicate) {
|
39761
39850
|
witnessIndex = 0;
|
39762
39851
|
} else {
|
39763
39852
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39772,8 +39861,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39772
39861
|
amount,
|
39773
39862
|
assetId,
|
39774
39863
|
txPointer: "0x00000000000000000000000000000000",
|
39775
|
-
witnessIndex
|
39776
|
-
predicate: predicate?.bytes
|
39864
|
+
witnessIndex
|
39777
39865
|
};
|
39778
39866
|
this.pushInput(input);
|
39779
39867
|
this.addChangeOutput(owner, assetId);
|
@@ -39786,11 +39874,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39786
39874
|
* @param predicate - Predicate bytes.
|
39787
39875
|
* @param predicateData - Predicate data bytes.
|
39788
39876
|
*/
|
39789
|
-
addMessageInput(message
|
39877
|
+
addMessageInput(message) {
|
39790
39878
|
const { recipient, sender, amount } = message;
|
39791
39879
|
const assetId = BaseAssetId;
|
39792
39880
|
let witnessIndex;
|
39793
|
-
if (predicate) {
|
39881
|
+
if (message.predicate) {
|
39794
39882
|
witnessIndex = 0;
|
39795
39883
|
} else {
|
39796
39884
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39804,8 +39892,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39804
39892
|
sender: sender.toB256(),
|
39805
39893
|
recipient: recipient.toB256(),
|
39806
39894
|
amount,
|
39807
|
-
witnessIndex
|
39808
|
-
predicate: predicate?.bytes
|
39895
|
+
witnessIndex
|
39809
39896
|
};
|
39810
39897
|
this.pushInput(input);
|
39811
39898
|
this.addChangeOutput(recipient, assetId);
|
@@ -39836,32 +39923,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39836
39923
|
resources.forEach((resource) => this.addResource(resource));
|
39837
39924
|
return this;
|
39838
39925
|
}
|
39839
|
-
/**
|
39840
|
-
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
39841
|
-
* outputs from the related assetIds.
|
39842
|
-
*
|
39843
|
-
* @param resources - The resources to add.
|
39844
|
-
* @returns This transaction.
|
39845
|
-
*/
|
39846
|
-
addPredicateResource(resource, predicate) {
|
39847
|
-
if (isCoin(resource)) {
|
39848
|
-
this.addCoinInput(resource, predicate);
|
39849
|
-
} else {
|
39850
|
-
this.addMessageInput(resource, predicate);
|
39851
|
-
}
|
39852
|
-
return this;
|
39853
|
-
}
|
39854
|
-
/**
|
39855
|
-
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
39856
|
-
* from the related assetIds.
|
39857
|
-
*
|
39858
|
-
* @param resources - The resources to add.
|
39859
|
-
* @returns This transaction.
|
39860
|
-
*/
|
39861
|
-
addPredicateResources(resources, predicate) {
|
39862
|
-
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
39863
|
-
return this;
|
39864
|
-
}
|
39865
39926
|
/**
|
39866
39927
|
* Adds a coin output to the transaction.
|
39867
39928
|
*
|
@@ -39941,7 +40002,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39941
40002
|
}
|
39942
40003
|
calculateMaxGas(chainInfo, minGas) {
|
39943
40004
|
const { consensusParameters } = chainInfo;
|
39944
|
-
const { gasPerByte } = consensusParameters;
|
40005
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
39945
40006
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
39946
40007
|
(acc, wit) => acc + wit.dataLength,
|
39947
40008
|
0
|
@@ -39950,7 +40011,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39950
40011
|
gasPerByte,
|
39951
40012
|
minGas,
|
39952
40013
|
witnessesLength,
|
39953
|
-
witnessLimit: this.witnessLimit
|
40014
|
+
witnessLimit: this.witnessLimit,
|
40015
|
+
maxGasPerTx
|
39954
40016
|
});
|
39955
40017
|
}
|
39956
40018
|
/**
|
@@ -39960,12 +40022,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39960
40022
|
* @param quantities - CoinQuantity Array.
|
39961
40023
|
*/
|
39962
40024
|
fundWithFakeUtxos(quantities, resourcesOwner) {
|
39963
|
-
let idCounter = 0;
|
39964
|
-
const generateId = () => {
|
39965
|
-
const counterString = String(idCounter++);
|
39966
|
-
const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString);
|
39967
|
-
return id;
|
39968
|
-
};
|
39969
40025
|
const findAssetInput = (assetId) => this.inputs.find((input) => {
|
39970
40026
|
if ("assetId" in input) {
|
39971
40027
|
return input.assetId === assetId;
|
@@ -39974,17 +40030,20 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39974
40030
|
});
|
39975
40031
|
const updateAssetInput = (assetId, quantity) => {
|
39976
40032
|
const assetInput = findAssetInput(assetId);
|
40033
|
+
let usedQuantity = quantity;
|
40034
|
+
if (assetId === BaseAssetId) {
|
40035
|
+
usedQuantity = bn("1000000000000000000");
|
40036
|
+
}
|
39977
40037
|
if (assetInput && "assetId" in assetInput) {
|
39978
|
-
assetInput.id =
|
39979
|
-
assetInput.amount =
|
40038
|
+
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
40039
|
+
assetInput.amount = usedQuantity;
|
39980
40040
|
} else {
|
39981
40041
|
this.addResources([
|
39982
40042
|
{
|
39983
|
-
id:
|
39984
|
-
amount:
|
40043
|
+
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
40044
|
+
amount: usedQuantity,
|
39985
40045
|
assetId,
|
39986
40046
|
owner: resourcesOwner || Address.fromRandom(),
|
39987
|
-
maturity: 0,
|
39988
40047
|
blockCreated: bn(1),
|
39989
40048
|
txCreatedIdx: bn(1)
|
39990
40049
|
}
|
@@ -40016,7 +40075,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40016
40075
|
toJSON() {
|
40017
40076
|
return normalizeJSON(this);
|
40018
40077
|
}
|
40019
|
-
|
40078
|
+
updatePredicateGasUsed(inputs) {
|
40020
40079
|
this.inputs.forEach((i) => {
|
40021
40080
|
let correspondingInput;
|
40022
40081
|
switch (i.type) {
|
@@ -40038,6 +40097,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40038
40097
|
}
|
40039
40098
|
});
|
40040
40099
|
}
|
40100
|
+
shiftPredicateData() {
|
40101
|
+
this.inputs.forEach((input) => {
|
40102
|
+
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
40103
|
+
input.predicateData = input.paddPredicateData(
|
40104
|
+
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40105
|
+
);
|
40106
|
+
}
|
40107
|
+
});
|
40108
|
+
}
|
40041
40109
|
};
|
40042
40110
|
|
40043
40111
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40171,9 +40239,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40171
40239
|
return {
|
40172
40240
|
type: TransactionType.Create,
|
40173
40241
|
...baseTransaction,
|
40174
|
-
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40175
40242
|
bytecodeWitnessIndex,
|
40176
|
-
storageSlotsCount: storageSlots.length,
|
40243
|
+
storageSlotsCount: bn(storageSlots.length),
|
40177
40244
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40178
40245
|
storageSlots
|
40179
40246
|
};
|
@@ -40287,8 +40354,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40287
40354
|
type: TransactionType.Script,
|
40288
40355
|
scriptGasLimit: this.gasLimit,
|
40289
40356
|
...super.getBaseTransaction(),
|
40290
|
-
scriptLength: script.length,
|
40291
|
-
scriptDataLength: scriptData.length,
|
40357
|
+
scriptLength: bn(script.length),
|
40358
|
+
scriptDataLength: bn(scriptData.length),
|
40292
40359
|
receiptsRoot: ZeroBytes32,
|
40293
40360
|
script: hexlify(script),
|
40294
40361
|
scriptData: hexlify(scriptData)
|
@@ -40352,7 +40419,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40352
40419
|
}
|
40353
40420
|
calculateMaxGas(chainInfo, minGas) {
|
40354
40421
|
const { consensusParameters } = chainInfo;
|
40355
|
-
const { gasPerByte } = consensusParameters;
|
40422
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
40356
40423
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40357
40424
|
(acc, wit) => acc + wit.dataLength,
|
40358
40425
|
0
|
@@ -40362,7 +40429,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40362
40429
|
minGas,
|
40363
40430
|
witnessesLength,
|
40364
40431
|
witnessLimit: this.witnessLimit,
|
40365
|
-
gasLimit: this.gasLimit
|
40432
|
+
gasLimit: this.gasLimit,
|
40433
|
+
maxGasPerTx
|
40366
40434
|
});
|
40367
40435
|
}
|
40368
40436
|
/**
|
@@ -40435,13 +40503,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40435
40503
|
}
|
40436
40504
|
}
|
40437
40505
|
};
|
40506
|
+
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40507
|
+
(acc, input) => {
|
40508
|
+
if (input.type === InputType.Coin && input.owner === owner) {
|
40509
|
+
acc.utxos.push(input.id);
|
40510
|
+
}
|
40511
|
+
if (input.type === InputType.Message && input.recipient === owner) {
|
40512
|
+
acc.messages.push(input.nonce);
|
40513
|
+
}
|
40514
|
+
return acc;
|
40515
|
+
},
|
40516
|
+
{
|
40517
|
+
utxos: [],
|
40518
|
+
messages: []
|
40519
|
+
}
|
40520
|
+
);
|
40438
40521
|
|
40439
40522
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40440
40523
|
var calculateTransactionFee = (params) => {
|
40441
40524
|
const {
|
40442
|
-
|
40525
|
+
gasPrice,
|
40443
40526
|
rawPayload,
|
40444
|
-
|
40527
|
+
tip,
|
40528
|
+
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40445
40529
|
} = params;
|
40446
40530
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40447
40531
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40451,8 +40535,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40451
40535
|
return {
|
40452
40536
|
fee: bn(0),
|
40453
40537
|
minFee: bn(0),
|
40454
|
-
maxFee: bn(0)
|
40455
|
-
feeFromGasUsed: bn(0)
|
40538
|
+
maxFee: bn(0)
|
40456
40539
|
};
|
40457
40540
|
}
|
40458
40541
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40484,7 +40567,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40484
40567
|
metadataGas,
|
40485
40568
|
txBytesSize: transactionBytes.length
|
40486
40569
|
});
|
40487
|
-
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40488
40570
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40489
40571
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40490
40572
|
const maxGas = getMaxGas({
|
@@ -40492,17 +40574,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40492
40574
|
minGas,
|
40493
40575
|
witnessesLength,
|
40494
40576
|
gasLimit,
|
40495
|
-
witnessLimit
|
40577
|
+
witnessLimit,
|
40578
|
+
maxGasPerTx
|
40579
|
+
});
|
40580
|
+
const minFee = calculateGasFee({
|
40581
|
+
gasPrice,
|
40582
|
+
gas: minGas,
|
40583
|
+
priceFactor: gasPriceFactor,
|
40584
|
+
tip
|
40585
|
+
});
|
40586
|
+
const maxFee = calculateGasFee({
|
40587
|
+
gasPrice,
|
40588
|
+
gas: maxGas,
|
40589
|
+
priceFactor: gasPriceFactor,
|
40590
|
+
tip
|
40496
40591
|
});
|
40497
|
-
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40498
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40499
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40500
|
-
const fee = minFee.add(feeFromGasUsed);
|
40501
40592
|
return {
|
40502
|
-
fee,
|
40503
40593
|
minFee,
|
40504
40594
|
maxFee,
|
40505
|
-
|
40595
|
+
fee: maxFee
|
40506
40596
|
};
|
40507
40597
|
};
|
40508
40598
|
|
@@ -41103,7 +41193,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41103
41193
|
gqlTransactionStatus,
|
41104
41194
|
abiMap = {},
|
41105
41195
|
maxInputs,
|
41106
|
-
gasCosts
|
41196
|
+
gasCosts,
|
41197
|
+
maxGasPerTx,
|
41198
|
+
gasPrice
|
41107
41199
|
} = params;
|
41108
41200
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41109
41201
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41117,11 +41209,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41117
41209
|
maxInputs
|
41118
41210
|
});
|
41119
41211
|
const typeName = getTransactionTypeName(transaction.type);
|
41212
|
+
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41120
41213
|
const { fee } = calculateTransactionFee({
|
41121
|
-
|
41214
|
+
gasPrice,
|
41122
41215
|
rawPayload,
|
41216
|
+
tip,
|
41123
41217
|
consensusParameters: {
|
41124
41218
|
gasCosts,
|
41219
|
+
maxGasPerTx,
|
41125
41220
|
feeParams: {
|
41126
41221
|
gasPerByte,
|
41127
41222
|
gasPriceFactor
|
@@ -41257,8 +41352,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41257
41352
|
const decodedTransaction = this.decodeTransaction(
|
41258
41353
|
transaction
|
41259
41354
|
);
|
41260
|
-
|
41261
|
-
|
41355
|
+
let txReceipts = [];
|
41356
|
+
if (transaction?.status && "receipts" in transaction.status) {
|
41357
|
+
txReceipts = transaction.status.receipts;
|
41358
|
+
}
|
41359
|
+
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41360
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41361
|
+
const gasPrice = await this.provider.getLatestGasPrice();
|
41262
41362
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41263
41363
|
const transactionSummary = assembleTransactionSummary({
|
41264
41364
|
id: this.id,
|
@@ -41270,7 +41370,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41270
41370
|
gasPriceFactor,
|
41271
41371
|
abiMap: contractsAbiMap,
|
41272
41372
|
maxInputs,
|
41273
|
-
gasCosts
|
41373
|
+
gasCosts,
|
41374
|
+
maxGasPerTx,
|
41375
|
+
gasPrice
|
41274
41376
|
});
|
41275
41377
|
return transactionSummary;
|
41276
41378
|
}
|
@@ -41419,7 +41521,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41419
41521
|
gasCosts,
|
41420
41522
|
latestBlock: {
|
41421
41523
|
id: latestBlock.id,
|
41422
|
-
height: bn(latestBlock.
|
41524
|
+
height: bn(latestBlock.height),
|
41423
41525
|
time: latestBlock.header.time,
|
41424
41526
|
transactions: latestBlock.transactions.map((i) => ({
|
41425
41527
|
id: i.id
|
@@ -41513,10 +41615,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41513
41615
|
* Returns some helpful parameters related to gas fees.
|
41514
41616
|
*/
|
41515
41617
|
getGasConfig() {
|
41516
|
-
const { minGasPrice } = this.getNode();
|
41517
41618
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41518
41619
|
return {
|
41519
|
-
minGasPrice,
|
41520
41620
|
maxGasPerTx,
|
41521
41621
|
maxGasPerPredicate,
|
41522
41622
|
gasPriceFactor,
|
@@ -41614,7 +41714,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41614
41714
|
*/
|
41615
41715
|
async getBlockNumber() {
|
41616
41716
|
const { chain } = await this.operations.getChain();
|
41617
|
-
return bn(chain.latestBlock.
|
41717
|
+
return bn(chain.latestBlock.height, 10);
|
41618
41718
|
}
|
41619
41719
|
/**
|
41620
41720
|
* Returns the chain information.
|
@@ -41626,11 +41726,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41626
41726
|
const processedNodeInfo = {
|
41627
41727
|
maxDepth: bn(nodeInfo.maxDepth),
|
41628
41728
|
maxTx: bn(nodeInfo.maxTx),
|
41629
|
-
minGasPrice: bn(nodeInfo.minGasPrice),
|
41630
41729
|
nodeVersion: nodeInfo.nodeVersion,
|
41631
41730
|
utxoValidation: nodeInfo.utxoValidation,
|
41632
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41633
|
-
peers: nodeInfo.peers
|
41731
|
+
vmBacktrace: nodeInfo.vmBacktrace
|
41634
41732
|
};
|
41635
41733
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41636
41734
|
return processedNodeInfo;
|
@@ -41716,14 +41814,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41716
41814
|
return this.estimateTxDependencies(transactionRequest);
|
41717
41815
|
}
|
41718
41816
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41719
|
-
const { dryRun:
|
41720
|
-
encodedTransaction,
|
41817
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41818
|
+
encodedTransactions: encodedTransaction,
|
41721
41819
|
utxoValidation: utxoValidation || false
|
41722
41820
|
});
|
41723
|
-
const receipts =
|
41724
|
-
|
41725
|
-
|
41726
|
-
};
|
41821
|
+
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
41822
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41823
|
+
return { receipts, dryrunStatus: status };
|
41727
41824
|
}
|
41728
41825
|
/**
|
41729
41826
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41762,9 +41859,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41762
41859
|
* If there are missing variable outputs,
|
41763
41860
|
* `addVariableOutputs` is called on the transaction.
|
41764
41861
|
*
|
41765
|
-
* @privateRemarks
|
41766
|
-
* TODO: Investigate support for missing contract IDs
|
41767
|
-
* TODO: Add support for missing output messages
|
41768
41862
|
*
|
41769
41863
|
* @param transactionRequest - The transaction request object.
|
41770
41864
|
* @returns A promise.
|
@@ -41777,16 +41871,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41777
41871
|
missingContractIds: []
|
41778
41872
|
};
|
41779
41873
|
}
|
41780
|
-
await this.estimatePredicates(transactionRequest);
|
41781
41874
|
let receipts = [];
|
41782
41875
|
const missingContractIds = [];
|
41783
41876
|
let outputVariables = 0;
|
41877
|
+
let dryrunStatus;
|
41784
41878
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41785
|
-
const {
|
41786
|
-
|
41879
|
+
const {
|
41880
|
+
dryRun: [{ receipts: rawReceipts, status }]
|
41881
|
+
} = await this.operations.dryRun({
|
41882
|
+
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41787
41883
|
utxoValidation: false
|
41788
41884
|
});
|
41789
|
-
receipts =
|
41885
|
+
receipts = rawReceipts.map(processGqlReceipt);
|
41886
|
+
dryrunStatus = status;
|
41790
41887
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41791
41888
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41792
41889
|
if (hasMissingOutputs) {
|
@@ -41796,6 +41893,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41796
41893
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41797
41894
|
missingContractIds.push(contractId);
|
41798
41895
|
});
|
41896
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41897
|
+
transactionRequest
|
41898
|
+
});
|
41899
|
+
transactionRequest.maxFee = maxFee;
|
41799
41900
|
} else {
|
41800
41901
|
break;
|
41801
41902
|
}
|
@@ -41803,7 +41904,139 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41803
41904
|
return {
|
41804
41905
|
receipts,
|
41805
41906
|
outputVariables,
|
41806
|
-
missingContractIds
|
41907
|
+
missingContractIds,
|
41908
|
+
dryrunStatus
|
41909
|
+
};
|
41910
|
+
}
|
41911
|
+
/**
|
41912
|
+
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41913
|
+
*
|
41914
|
+
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41915
|
+
* further modifications are identified. The method iteratively updates these transactions
|
41916
|
+
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41917
|
+
*
|
41918
|
+
* @param transactionRequests - Array of transaction request objects.
|
41919
|
+
* @returns A promise that resolves to an array of results for each transaction.
|
41920
|
+
*/
|
41921
|
+
async estimateMultipleTxDependencies(transactionRequests) {
|
41922
|
+
const results = transactionRequests.map(() => ({
|
41923
|
+
receipts: [],
|
41924
|
+
outputVariables: 0,
|
41925
|
+
missingContractIds: [],
|
41926
|
+
dryrunStatus: void 0
|
41927
|
+
}));
|
41928
|
+
const allRequests = clone_default(transactionRequests);
|
41929
|
+
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41930
|
+
allRequests.forEach((req, index) => {
|
41931
|
+
if (req.type === TransactionType.Script) {
|
41932
|
+
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41933
|
+
}
|
41934
|
+
});
|
41935
|
+
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41936
|
+
let attempt = 0;
|
41937
|
+
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41938
|
+
const encodedTransactions = transactionsToProcess.map(
|
41939
|
+
(index) => serializedTransactionsMap.get(index)
|
41940
|
+
);
|
41941
|
+
const dryRunResults = await this.operations.dryRun({
|
41942
|
+
encodedTransactions,
|
41943
|
+
utxoValidation: false
|
41944
|
+
});
|
41945
|
+
const nextRoundTransactions = [];
|
41946
|
+
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41947
|
+
const currentResultIndex = transactionsToProcess[i];
|
41948
|
+
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41949
|
+
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41950
|
+
results[currentResultIndex].dryrunStatus = status;
|
41951
|
+
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41952
|
+
results[currentResultIndex].receipts
|
41953
|
+
);
|
41954
|
+
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41955
|
+
const requestToProcess = allRequests[currentResultIndex];
|
41956
|
+
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
41957
|
+
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
41958
|
+
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
41959
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
41960
|
+
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
41961
|
+
results[currentResultIndex].missingContractIds.push(contractId);
|
41962
|
+
});
|
41963
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41964
|
+
transactionRequest: requestToProcess
|
41965
|
+
});
|
41966
|
+
requestToProcess.maxFee = maxFee;
|
41967
|
+
serializedTransactionsMap.set(
|
41968
|
+
currentResultIndex,
|
41969
|
+
hexlify(requestToProcess.toTransactionBytes())
|
41970
|
+
);
|
41971
|
+
nextRoundTransactions.push(currentResultIndex);
|
41972
|
+
allRequests[currentResultIndex] = requestToProcess;
|
41973
|
+
}
|
41974
|
+
}
|
41975
|
+
transactionsToProcess = nextRoundTransactions;
|
41976
|
+
attempt += 1;
|
41977
|
+
}
|
41978
|
+
return results;
|
41979
|
+
}
|
41980
|
+
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
41981
|
+
if (estimateTxDependencies) {
|
41982
|
+
return this.estimateMultipleTxDependencies(transactionRequests);
|
41983
|
+
}
|
41984
|
+
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
41985
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41986
|
+
encodedTransactions,
|
41987
|
+
utxoValidation: utxoValidation || false
|
41988
|
+
});
|
41989
|
+
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
41990
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41991
|
+
return { receipts, dryrunStatus: status };
|
41992
|
+
});
|
41993
|
+
return results;
|
41994
|
+
}
|
41995
|
+
/**
|
41996
|
+
* Estimates the transaction gas and fee based on the provided transaction request.
|
41997
|
+
* @param transactionRequest - The transaction request object.
|
41998
|
+
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
41999
|
+
*/
|
42000
|
+
async estimateTxGasAndFee(params) {
|
42001
|
+
const { transactionRequest } = params;
|
42002
|
+
let { gasPrice } = params;
|
42003
|
+
const chainInfo = this.getChain();
|
42004
|
+
const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
|
42005
|
+
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
42006
|
+
if (!gasPrice) {
|
42007
|
+
gasPrice = await this.estimateGasPrice(10);
|
42008
|
+
}
|
42009
|
+
const minFee = calculateGasFee({
|
42010
|
+
gasPrice: bn(gasPrice),
|
42011
|
+
gas: minGas,
|
42012
|
+
priceFactor: gasPriceFactor,
|
42013
|
+
tip: transactionRequest.tip
|
42014
|
+
}).add(1);
|
42015
|
+
let gasLimit = bn(0);
|
42016
|
+
if (transactionRequest.type === TransactionType.Script) {
|
42017
|
+
gasLimit = transactionRequest.gasLimit;
|
42018
|
+
if (transactionRequest.gasLimit.eq(0)) {
|
42019
|
+
transactionRequest.gasLimit = minGas;
|
42020
|
+
transactionRequest.gasLimit = maxGasPerTx.sub(
|
42021
|
+
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
42022
|
+
);
|
42023
|
+
gasLimit = transactionRequest.gasLimit;
|
42024
|
+
}
|
42025
|
+
}
|
42026
|
+
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42027
|
+
const maxFee = calculateGasFee({
|
42028
|
+
gasPrice: bn(gasPrice),
|
42029
|
+
gas: maxGas,
|
42030
|
+
priceFactor: gasPriceFactor,
|
42031
|
+
tip: transactionRequest.tip
|
42032
|
+
}).add(1);
|
42033
|
+
return {
|
42034
|
+
minGas,
|
42035
|
+
minFee,
|
42036
|
+
maxGas,
|
42037
|
+
maxFee,
|
42038
|
+
gasPrice,
|
42039
|
+
gasLimit
|
41807
42040
|
};
|
41808
42041
|
}
|
41809
42042
|
/**
|
@@ -41821,15 +42054,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41821
42054
|
if (estimateTxDependencies) {
|
41822
42055
|
return this.estimateTxDependencies(transactionRequest);
|
41823
42056
|
}
|
41824
|
-
const
|
41825
|
-
const { dryRun:
|
41826
|
-
|
42057
|
+
const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
|
42058
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42059
|
+
encodedTransactions,
|
41827
42060
|
utxoValidation: true
|
41828
42061
|
});
|
41829
|
-
const
|
41830
|
-
|
41831
|
-
receipts
|
41832
|
-
|
42062
|
+
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
42063
|
+
const { id, receipts, status } = dryRunStatus;
|
42064
|
+
const processedReceipts = receipts.map(processGqlReceipt);
|
42065
|
+
return { id, receipts: processedReceipts, status };
|
42066
|
+
});
|
42067
|
+
return { receipts: callResult[0].receipts };
|
41833
42068
|
}
|
41834
42069
|
/**
|
41835
42070
|
* Returns a transaction cost to enable user
|
@@ -41846,80 +42081,79 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41846
42081
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
41847
42082
|
* @returns A promise that resolves to the transaction cost object.
|
41848
42083
|
*/
|
41849
|
-
async getTransactionCost(transactionRequestLike,
|
41850
|
-
estimateTxDependencies = true,
|
41851
|
-
estimatePredicates = true,
|
41852
|
-
resourcesOwner,
|
41853
|
-
signatureCallback
|
41854
|
-
} = {}) {
|
42084
|
+
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
41855
42085
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41856
|
-
const chainInfo = this.getChain();
|
41857
|
-
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
41858
|
-
const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
41859
42086
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
41860
42087
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
41861
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
42088
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
41862
42089
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
41863
|
-
|
41864
|
-
|
41865
|
-
|
41866
|
-
}
|
41867
|
-
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41868
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41869
|
-
}
|
41870
|
-
await this.estimatePredicates(txRequestClone);
|
42090
|
+
txRequestClone.maxFee = bn(0);
|
42091
|
+
if (isScriptTransaction) {
|
42092
|
+
txRequestClone.gasLimit = bn(0);
|
41871
42093
|
}
|
42094
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
42095
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
42096
|
+
}
|
42097
|
+
const signedRequest = clone_default(txRequestClone);
|
42098
|
+
let addedSignatures = 0;
|
41872
42099
|
if (signatureCallback && isScriptTransaction) {
|
41873
|
-
|
42100
|
+
const lengthBefore = signedRequest.witnesses.length;
|
42101
|
+
await signatureCallback(signedRequest);
|
42102
|
+
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41874
42103
|
}
|
41875
|
-
|
41876
|
-
|
42104
|
+
await this.estimatePredicates(signedRequest);
|
42105
|
+
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
42106
|
+
transactionRequest: signedRequest
|
42107
|
+
});
|
41877
42108
|
let receipts = [];
|
41878
42109
|
let missingContractIds = [];
|
41879
42110
|
let outputVariables = 0;
|
41880
|
-
|
41881
|
-
|
41882
|
-
|
42111
|
+
let gasUsed = bn(0);
|
42112
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
42113
|
+
txRequestClone.maxFee = maxFee;
|
42114
|
+
if (isScriptTransaction) {
|
42115
|
+
txRequestClone.gasLimit = gasLimit;
|
42116
|
+
if (signatureCallback) {
|
42117
|
+
await signatureCallback(txRequestClone);
|
42118
|
+
}
|
41883
42119
|
const result = await this.estimateTxDependencies(txRequestClone);
|
41884
42120
|
receipts = result.receipts;
|
41885
42121
|
outputVariables = result.outputVariables;
|
41886
42122
|
missingContractIds = result.missingContractIds;
|
42123
|
+
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
42124
|
+
txRequestClone.gasLimit = gasUsed;
|
42125
|
+
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
42126
|
+
transactionRequest: txRequestClone,
|
42127
|
+
gasPrice
|
42128
|
+
}));
|
41887
42129
|
}
|
41888
|
-
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
41889
|
-
const usedFee = calculatePriceWithFactor(
|
41890
|
-
gasUsed,
|
41891
|
-
gasPrice,
|
41892
|
-
gasPriceFactor
|
41893
|
-
).normalizeZeroToOne();
|
41894
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
41895
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
41896
42130
|
return {
|
41897
42131
|
requiredQuantities: allQuantities,
|
41898
42132
|
receipts,
|
41899
42133
|
gasUsed,
|
41900
|
-
minGasPrice,
|
41901
42134
|
gasPrice,
|
41902
42135
|
minGas,
|
41903
42136
|
maxGas,
|
41904
|
-
usedFee,
|
41905
42137
|
minFee,
|
41906
42138
|
maxFee,
|
41907
|
-
estimatedInputs: txRequestClone.inputs,
|
41908
42139
|
outputVariables,
|
41909
|
-
missingContractIds
|
42140
|
+
missingContractIds,
|
42141
|
+
addedSignatures,
|
42142
|
+
estimatedPredicates: txRequestClone.inputs
|
41910
42143
|
};
|
41911
42144
|
}
|
41912
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
42145
|
+
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
41913
42146
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41914
42147
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
41915
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42148
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
42149
|
+
quantitiesToContract
|
42150
|
+
});
|
41916
42151
|
transactionRequest.addResources(
|
41917
42152
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
41918
42153
|
);
|
41919
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41920
|
-
|
41921
|
-
|
41922
|
-
);
|
42154
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
42155
|
+
quantitiesToContract
|
42156
|
+
});
|
41923
42157
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
41924
42158
|
return {
|
41925
42159
|
resources,
|
@@ -41943,7 +42177,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41943
42177
|
assetId: coin.assetId,
|
41944
42178
|
amount: bn(coin.amount),
|
41945
42179
|
owner: Address.fromAddressOrString(coin.owner),
|
41946
|
-
maturity: bn(coin.maturity).toNumber(),
|
41947
42180
|
blockCreated: bn(coin.blockCreated),
|
41948
42181
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41949
42182
|
}));
|
@@ -41995,7 +42228,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41995
42228
|
amount: bn(coin.amount),
|
41996
42229
|
assetId: coin.assetId,
|
41997
42230
|
owner: Address.fromAddressOrString(coin.owner),
|
41998
|
-
maturity: bn(coin.maturity).toNumber(),
|
41999
42231
|
blockCreated: bn(coin.blockCreated),
|
42000
42232
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42001
42233
|
};
|
@@ -42028,7 +42260,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42028
42260
|
}
|
42029
42261
|
return {
|
42030
42262
|
id: block2.id,
|
42031
|
-
height: bn(block2.
|
42263
|
+
height: bn(block2.height),
|
42032
42264
|
time: block2.header.time,
|
42033
42265
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42034
42266
|
};
|
@@ -42043,7 +42275,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42043
42275
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42044
42276
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42045
42277
|
id: block2.id,
|
42046
|
-
height: bn(block2.
|
42278
|
+
height: bn(block2.height),
|
42047
42279
|
time: block2.header.time,
|
42048
42280
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42049
42281
|
}));
|
@@ -42070,7 +42302,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42070
42302
|
}
|
42071
42303
|
return {
|
42072
42304
|
id: block2.id,
|
42073
|
-
height: bn(block2.
|
42305
|
+
height: bn(block2.height, 10),
|
42074
42306
|
time: block2.header.time,
|
42075
42307
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42076
42308
|
transactions: block2.transactions.map(
|
@@ -42250,8 +42482,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42250
42482
|
prevRoot: messageBlockHeader.prevRoot,
|
42251
42483
|
time: messageBlockHeader.time,
|
42252
42484
|
applicationHash: messageBlockHeader.applicationHash,
|
42253
|
-
|
42254
|
-
|
42485
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount),
|
42486
|
+
messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
|
42487
|
+
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42488
|
+
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42489
|
+
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
42255
42490
|
},
|
42256
42491
|
commitBlockHeader: {
|
42257
42492
|
id: commitBlockHeader.id,
|
@@ -42262,8 +42497,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42262
42497
|
prevRoot: commitBlockHeader.prevRoot,
|
42263
42498
|
time: commitBlockHeader.time,
|
42264
42499
|
applicationHash: commitBlockHeader.applicationHash,
|
42265
|
-
|
42266
|
-
|
42500
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount),
|
42501
|
+
messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
|
42502
|
+
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42503
|
+
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42504
|
+
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
42267
42505
|
},
|
42268
42506
|
sender: Address.fromAddressOrString(sender),
|
42269
42507
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -42272,6 +42510,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42272
42510
|
data
|
42273
42511
|
};
|
42274
42512
|
}
|
42513
|
+
async getLatestGasPrice() {
|
42514
|
+
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42515
|
+
return bn(latestGasPrice.gasPrice);
|
42516
|
+
}
|
42517
|
+
async estimateGasPrice(blockHorizon) {
|
42518
|
+
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42519
|
+
blockHorizon: String(blockHorizon)
|
42520
|
+
});
|
42521
|
+
return bn(estimateGasPrice.gasPrice);
|
42522
|
+
}
|
42275
42523
|
/**
|
42276
42524
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42277
42525
|
*
|
@@ -42332,10 +42580,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42332
42580
|
arrayify(gqlTransaction.rawPayload),
|
42333
42581
|
0
|
42334
42582
|
);
|
42335
|
-
|
42583
|
+
let txReceipts = [];
|
42584
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42585
|
+
txReceipts = gqlTransaction.status.receipts;
|
42586
|
+
}
|
42587
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42336
42588
|
const {
|
42337
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42589
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42338
42590
|
} = provider.getChain();
|
42591
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42339
42592
|
const transactionInfo = assembleTransactionSummary({
|
42340
42593
|
id: gqlTransaction.id,
|
42341
42594
|
receipts,
|
@@ -42346,7 +42599,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42346
42599
|
gasPriceFactor: bn(gasPriceFactor),
|
42347
42600
|
abiMap,
|
42348
42601
|
maxInputs,
|
42349
|
-
gasCosts
|
42602
|
+
gasCosts,
|
42603
|
+
maxGasPerTx,
|
42604
|
+
gasPrice
|
42350
42605
|
});
|
42351
42606
|
return {
|
42352
42607
|
gqlTransaction,
|
@@ -42356,10 +42611,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42356
42611
|
async function getTransactionSummaryFromRequest(params) {
|
42357
42612
|
const { provider, transactionRequest, abiMap } = params;
|
42358
42613
|
const { receipts } = await provider.call(transactionRequest);
|
42359
|
-
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42614
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
|
42360
42615
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42361
42616
|
const transaction = transactionRequest.toTransaction();
|
42362
42617
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42618
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42363
42619
|
const transactionSummary = assembleTransactionSummary({
|
42364
42620
|
receipts,
|
42365
42621
|
transaction,
|
@@ -42368,7 +42624,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42368
42624
|
gasPerByte,
|
42369
42625
|
gasPriceFactor,
|
42370
42626
|
maxInputs,
|
42371
|
-
gasCosts
|
42627
|
+
gasCosts,
|
42628
|
+
maxGasPerTx,
|
42629
|
+
gasPrice
|
42372
42630
|
});
|
42373
42631
|
return transactionSummary;
|
42374
42632
|
}
|
@@ -42377,13 +42635,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42377
42635
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42378
42636
|
const { edges, pageInfo } = transactionsByOwner;
|
42379
42637
|
const {
|
42380
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42638
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42381
42639
|
} = provider.getChain();
|
42640
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42382
42641
|
const transactions = edges.map((edge) => {
|
42383
42642
|
const { node: gqlTransaction } = edge;
|
42384
|
-
const { id, rawPayload,
|
42643
|
+
const { id, rawPayload, status } = gqlTransaction;
|
42385
42644
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42386
|
-
|
42645
|
+
let txReceipts = [];
|
42646
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42647
|
+
txReceipts = gqlTransaction.status.receipts;
|
42648
|
+
}
|
42649
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42387
42650
|
const transactionSummary = assembleTransactionSummary({
|
42388
42651
|
id,
|
42389
42652
|
receipts,
|
@@ -42394,7 +42657,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42394
42657
|
gasPerByte,
|
42395
42658
|
gasPriceFactor,
|
42396
42659
|
maxInputs,
|
42397
|
-
gasCosts
|
42660
|
+
gasCosts,
|
42661
|
+
maxGasPerTx,
|
42662
|
+
gasPrice
|
42398
42663
|
});
|
42399
42664
|
const output3 = {
|
42400
42665
|
gqlTransaction,
|
@@ -42723,36 +42988,33 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42723
42988
|
* @param fee - The estimated transaction fee.
|
42724
42989
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42725
42990
|
*/
|
42726
|
-
async fund(request,
|
42727
|
-
const
|
42991
|
+
async fund(request, params) {
|
42992
|
+
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
42993
|
+
const txRequest = request;
|
42994
|
+
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42728
42995
|
amount: bn(fee),
|
42729
42996
|
assetId: BaseAssetId,
|
42730
|
-
coinQuantities
|
42997
|
+
coinQuantities: requiredQuantities
|
42731
42998
|
});
|
42732
42999
|
const quantitiesDict = {};
|
42733
|
-
|
43000
|
+
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
42734
43001
|
quantitiesDict[assetId] = {
|
42735
43002
|
required: amount,
|
42736
43003
|
owned: bn(0)
|
42737
43004
|
};
|
42738
43005
|
});
|
42739
|
-
|
42740
|
-
const cachedMessages = [];
|
42741
|
-
const owner = this.address.toB256();
|
42742
|
-
request.inputs.forEach((input) => {
|
43006
|
+
txRequest.inputs.forEach((input) => {
|
42743
43007
|
const isResource = "amount" in input;
|
42744
43008
|
if (isResource) {
|
42745
43009
|
const isCoin2 = "owner" in input;
|
42746
43010
|
if (isCoin2) {
|
42747
43011
|
const assetId = String(input.assetId);
|
42748
|
-
if (
|
43012
|
+
if (quantitiesDict[assetId]) {
|
42749
43013
|
const amount = bn(input.amount);
|
42750
43014
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42751
|
-
cachedUtxos.push(input.id);
|
42752
43015
|
}
|
42753
|
-
} else if (input.
|
43016
|
+
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42754
43017
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42755
|
-
cachedMessages.push(input.nonce);
|
42756
43018
|
}
|
42757
43019
|
}
|
42758
43020
|
});
|
@@ -42767,12 +43029,23 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42767
43029
|
});
|
42768
43030
|
const needsToBeFunded = missingQuantities.length;
|
42769
43031
|
if (needsToBeFunded) {
|
42770
|
-
const
|
42771
|
-
|
42772
|
-
|
42773
|
-
|
42774
|
-
|
43032
|
+
const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
|
43033
|
+
const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
|
43034
|
+
txRequest.addResources(resources);
|
43035
|
+
}
|
43036
|
+
txRequest.shiftPredicateData();
|
43037
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43038
|
+
const requestToBeReEstimate = clone_default(txRequest);
|
43039
|
+
if (addedSignatures) {
|
43040
|
+
Array.from({ length: addedSignatures }).forEach(
|
43041
|
+
() => requestToBeReEstimate.addEmptyWitness()
|
43042
|
+
);
|
42775
43043
|
}
|
43044
|
+
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43045
|
+
transactionRequest: requestToBeReEstimate
|
43046
|
+
});
|
43047
|
+
txRequest.maxFee = maxFee;
|
43048
|
+
return txRequest;
|
42776
43049
|
}
|
42777
43050
|
/**
|
42778
43051
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -42780,28 +43053,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42780
43053
|
* @param destination - The address of the destination.
|
42781
43054
|
* @param amount - The amount of coins to transfer.
|
42782
43055
|
* @param assetId - The asset ID of the coins to transfer.
|
42783
|
-
* @param txParams - The transaction parameters (gasLimit,
|
43056
|
+
* @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
|
42784
43057
|
* @returns A promise that resolves to the prepared transaction request.
|
42785
43058
|
*/
|
42786
43059
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42787
|
-
const
|
42788
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42789
|
-
const request = new ScriptTransactionRequest(params);
|
43060
|
+
const request = new ScriptTransactionRequest(txParams);
|
42790
43061
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
42791
|
-
const
|
43062
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
42792
43063
|
estimateTxDependencies: true,
|
42793
43064
|
resourcesOwner: this
|
42794
43065
|
});
|
42795
|
-
|
42796
|
-
|
42797
|
-
|
42798
|
-
|
42799
|
-
|
42800
|
-
|
42801
|
-
|
42802
|
-
|
42803
|
-
await this.fund(request,
|
42804
|
-
request.updatePredicateInputs(estimatedInputs);
|
43066
|
+
if ("gasLimit" in txParams) {
|
43067
|
+
this.validateGas({
|
43068
|
+
gasUsed: txCost.gasUsed,
|
43069
|
+
gasLimit: request.gasLimit
|
43070
|
+
});
|
43071
|
+
}
|
43072
|
+
request.gasLimit = txCost.gasUsed;
|
43073
|
+
request.maxFee = txCost.maxFee;
|
43074
|
+
await this.fund(request, txCost);
|
42805
43075
|
return request;
|
42806
43076
|
}
|
42807
43077
|
/**
|
@@ -42840,31 +43110,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42840
43110
|
);
|
42841
43111
|
}
|
42842
43112
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42843
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42844
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42845
43113
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42846
43114
|
hexlifiedContractId: contractAddress.toB256(),
|
42847
43115
|
amountToTransfer: bn(amount),
|
42848
43116
|
assetId
|
42849
43117
|
});
|
42850
43118
|
const request = new ScriptTransactionRequest({
|
42851
|
-
...
|
43119
|
+
...txParams,
|
42852
43120
|
script,
|
42853
43121
|
scriptData
|
42854
43122
|
});
|
42855
43123
|
request.addContractInputAndOutput(contractAddress);
|
42856
|
-
const
|
42857
|
-
|
42858
|
-
[{ amount: bn(amount), assetId: String(assetId) }]
|
42859
|
-
);
|
42860
|
-
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42861
|
-
this.validateGas({
|
42862
|
-
gasUsed,
|
42863
|
-
gasPrice: request.gasPrice,
|
42864
|
-
gasLimit: request.gasLimit,
|
42865
|
-
minGasPrice
|
43124
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
43125
|
+
resourcesOwner: this,
|
43126
|
+
quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
|
42866
43127
|
});
|
42867
|
-
|
43128
|
+
if (txParams.gasLimit) {
|
43129
|
+
this.validateGas({
|
43130
|
+
gasUsed: txCost.gasUsed,
|
43131
|
+
gasLimit: request.gasLimit
|
43132
|
+
});
|
43133
|
+
}
|
43134
|
+
request.gasLimit = txCost.gasUsed;
|
43135
|
+
request.maxFee = txCost.maxFee;
|
43136
|
+
await this.fund(request, txCost);
|
42868
43137
|
return this.sendTransaction(request);
|
42869
43138
|
}
|
42870
43139
|
/**
|
@@ -42876,7 +43145,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42876
43145
|
* @returns A promise that resolves to the transaction response.
|
42877
43146
|
*/
|
42878
43147
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42879
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42880
43148
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42881
43149
|
const recipientDataArray = arrayify(
|
42882
43150
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42889,21 +43157,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42889
43157
|
...recipientDataArray,
|
42890
43158
|
...amountDataArray
|
42891
43159
|
]);
|
42892
|
-
const params = { script,
|
43160
|
+
const params = { script, ...txParams };
|
42893
43161
|
const request = new ScriptTransactionRequest(params);
|
42894
|
-
const
|
42895
|
-
const
|
42896
|
-
|
42897
|
-
|
42898
|
-
|
42899
|
-
|
42900
|
-
|
42901
|
-
|
42902
|
-
|
42903
|
-
|
42904
|
-
|
42905
|
-
});
|
42906
|
-
await this.fund(request, requiredQuantities, maxFee);
|
43162
|
+
const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
|
43163
|
+
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
43164
|
+
if (txParams.gasLimit) {
|
43165
|
+
this.validateGas({
|
43166
|
+
gasUsed: txCost.gasUsed,
|
43167
|
+
gasLimit: request.gasLimit
|
43168
|
+
});
|
43169
|
+
}
|
43170
|
+
request.maxFee = txCost.maxFee;
|
43171
|
+
request.gasLimit = txCost.gasUsed;
|
43172
|
+
await this.fund(request, txCost);
|
42907
43173
|
return this.sendTransaction(request);
|
42908
43174
|
}
|
42909
43175
|
async signMessage(message) {
|
@@ -42961,18 +43227,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42961
43227
|
}
|
42962
43228
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
42963
43229
|
}
|
42964
|
-
validateGas({
|
42965
|
-
gasUsed,
|
42966
|
-
gasPrice,
|
42967
|
-
gasLimit,
|
42968
|
-
minGasPrice
|
42969
|
-
}) {
|
42970
|
-
if (minGasPrice.gt(gasPrice)) {
|
42971
|
-
throw new FuelError(
|
42972
|
-
ErrorCode.GAS_PRICE_TOO_LOW,
|
42973
|
-
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
42974
|
-
);
|
42975
|
-
}
|
43230
|
+
validateGas({ gasUsed, gasLimit }) {
|
42976
43231
|
if (gasUsed.gt(gasLimit)) {
|
42977
43232
|
throw new FuelError(
|
42978
43233
|
ErrorCode.GAS_LIMIT_TOO_LOW,
|
@@ -44355,12 +44610,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44355
44610
|
};
|
44356
44611
|
|
44357
44612
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
44358
|
-
var
|
44613
|
+
var import_crypto16 = __toESM(__require("crypto"));
|
44359
44614
|
var rnds8Pool = new Uint8Array(256);
|
44360
44615
|
var poolPtr = rnds8Pool.length;
|
44361
44616
|
function rng() {
|
44362
44617
|
if (poolPtr > rnds8Pool.length - 16) {
|
44363
|
-
|
44618
|
+
import_crypto16.default.randomFillSync(rnds8Pool);
|
44364
44619
|
poolPtr = 0;
|
44365
44620
|
}
|
44366
44621
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -44376,9 +44631,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44376
44631
|
}
|
44377
44632
|
|
44378
44633
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
44379
|
-
var
|
44634
|
+
var import_crypto17 = __toESM(__require("crypto"));
|
44380
44635
|
var native_default = {
|
44381
|
-
randomUUID:
|
44636
|
+
randomUUID: import_crypto17.default.randomUUID
|
44382
44637
|
};
|
44383
44638
|
|
44384
44639
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -44561,7 +44816,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44561
44816
|
* @param transactionRequestLike - The transaction request to send.
|
44562
44817
|
* @returns A promise that resolves to the TransactionResponse object.
|
44563
44818
|
*/
|
44564
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44819
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
44565
44820
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44566
44821
|
if (estimateTxDependencies) {
|
44567
44822
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -47839,8 +48094,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47839
48094
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
47840
48095
|
request.inputs?.forEach((input) => {
|
47841
48096
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
47842
|
-
input.predicate = this.bytes;
|
47843
|
-
input.predicateData = this.getPredicateData(policies.length);
|
48097
|
+
input.predicate = hexlify(this.bytes);
|
48098
|
+
input.predicateData = hexlify(this.getPredicateData(policies.length));
|
47844
48099
|
}
|
47845
48100
|
});
|
47846
48101
|
return request;
|
@@ -47855,8 +48110,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47855
48110
|
* @returns A promise that resolves to the prepared transaction request.
|
47856
48111
|
*/
|
47857
48112
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
47858
|
-
|
47859
|
-
return this.populateTransactionPredicateData(request);
|
48113
|
+
return super.createTransfer(destination, amount, assetId, txParams);
|
47860
48114
|
}
|
47861
48115
|
/**
|
47862
48116
|
* Sends a transaction with the populated predicate data.
|
@@ -47864,9 +48118,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47864
48118
|
* @param transactionRequestLike - The transaction request-like object.
|
47865
48119
|
* @returns A promise that resolves to the transaction response.
|
47866
48120
|
*/
|
47867
|
-
sendTransaction(transactionRequestLike
|
47868
|
-
const transactionRequest =
|
47869
|
-
return super.sendTransaction(transactionRequest,
|
48121
|
+
sendTransaction(transactionRequestLike) {
|
48122
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48123
|
+
return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
|
47870
48124
|
}
|
47871
48125
|
/**
|
47872
48126
|
* Simulates a transaction with the populated predicate data.
|
@@ -47875,8 +48129,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47875
48129
|
* @returns A promise that resolves to the call result.
|
47876
48130
|
*/
|
47877
48131
|
simulateTransaction(transactionRequestLike) {
|
47878
|
-
const transactionRequest =
|
47879
|
-
return super.simulateTransaction(transactionRequest);
|
48132
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48133
|
+
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
47880
48134
|
}
|
47881
48135
|
getPredicateData(policiesLength) {
|
47882
48136
|
if (!this.predicateData.length) {
|
@@ -47922,6 +48176,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47922
48176
|
predicateInterface: abiInterface
|
47923
48177
|
};
|
47924
48178
|
}
|
48179
|
+
/**
|
48180
|
+
* Retrieves resources satisfying the spend query for the account.
|
48181
|
+
*
|
48182
|
+
* @param quantities - IDs of coins to exclude.
|
48183
|
+
* @param excludedIds - IDs of resources to be excluded from the query.
|
48184
|
+
* @returns A promise that resolves to an array of Resources.
|
48185
|
+
*/
|
48186
|
+
async getResourcesToSpend(quantities, excludedIds) {
|
48187
|
+
const resources = await this.provider.getResourcesToSpend(
|
48188
|
+
this.address,
|
48189
|
+
quantities,
|
48190
|
+
excludedIds
|
48191
|
+
);
|
48192
|
+
return resources.map((resource) => ({
|
48193
|
+
...resource,
|
48194
|
+
predicate: hexlify(this.bytes),
|
48195
|
+
paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48196
|
+
}));
|
48197
|
+
}
|
47925
48198
|
/**
|
47926
48199
|
* Sets the configurable constants for the predicate.
|
47927
48200
|
*
|