@fuel-ts/account 0.0.0-rc-2021-20240424160726 → 0.0.0-rc-2143-20240424161332
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 -6
- 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 +583 -863
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +513 -793
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +395 -674
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +2 -10
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +326 -828
- 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 +2 -4
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +1 -7
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +27 -37
- 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 +29 -8
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -3
- 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 +0 -2
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
- 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 +2 -8
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +4 -2
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +1055 -1551
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +513 -775
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +406 -668
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +16 -16
package/dist/index.global.js
CHANGED
@@ -289,7 +289,7 @@
|
|
289
289
|
}
|
290
290
|
return num !== null && typeof num === "object" && num.constructor.wordSize === BN2.wordSize && Array.isArray(num.words);
|
291
291
|
};
|
292
|
-
BN2.max = function
|
292
|
+
BN2.max = function max2(left, right) {
|
293
293
|
if (left.cmp(right) > 0)
|
294
294
|
return left;
|
295
295
|
return right;
|
@@ -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 clone(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(clone(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 ? clone(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,8 +28952,8 @@ spurious results.`);
|
|
28952
28952
|
// ../versions/dist/index.mjs
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
|
-
FORC: "0.
|
28956
|
-
FUEL_CORE: "0.
|
28955
|
+
FORC: "0.49.3",
|
28956
|
+
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.81.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -29053,7 +29053,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29053
29053
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
29054
29054
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
29055
29055
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
29056
|
-
ErrorCode2["MAX_FEE_TOO_LOW"] = "max-fee-too-low";
|
29057
29056
|
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
|
29058
29057
|
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
|
29059
29058
|
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
|
@@ -29244,9 +29243,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29244
29243
|
};
|
29245
29244
|
var DateTime = _DateTime;
|
29246
29245
|
__publicField3(DateTime, "TAI64_NULL", "");
|
29247
|
-
function isDefined(value) {
|
29248
|
-
return value !== void 0;
|
29249
|
-
}
|
29250
29246
|
|
29251
29247
|
// ../crypto/dist/index.mjs
|
29252
29248
|
var import_crypto8 = __toESM(__require("crypto"), 1);
|
@@ -31499,182 +31495,32 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31499
31495
|
function toBytes3(value, bytesPadding) {
|
31500
31496
|
return bn(value).toBytes(bytesPadding);
|
31501
31497
|
}
|
31502
|
-
|
31503
|
-
|
31504
|
-
function _isPlaceholder(a) {
|
31505
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31506
|
-
}
|
31507
|
-
|
31508
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31509
|
-
function _curry1(fn) {
|
31510
|
-
return function f1(a) {
|
31511
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31512
|
-
return f1;
|
31513
|
-
} else {
|
31514
|
-
return fn.apply(this, arguments);
|
31515
|
-
}
|
31516
|
-
};
|
31517
|
-
}
|
31518
|
-
|
31519
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31520
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
31521
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31522
|
-
};
|
31523
|
-
|
31524
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31525
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31526
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31527
|
-
});
|
31528
|
-
var type_default = type;
|
31529
|
-
|
31530
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31531
|
-
var pad = function pad2(n) {
|
31532
|
-
return (n < 10 ? "0" : "") + n;
|
31533
|
-
};
|
31534
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31535
|
-
return d.toISOString();
|
31536
|
-
} : function _toISOString3(d) {
|
31537
|
-
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";
|
31538
|
-
};
|
31539
|
-
|
31540
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31541
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31542
|
-
return n << 0 === n;
|
31543
|
-
};
|
31544
|
-
|
31545
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31546
|
-
function _cloneRegExp(pattern) {
|
31547
|
-
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" : ""));
|
31548
|
-
}
|
31549
|
-
|
31550
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31551
|
-
function _clone(value, deep, map) {
|
31552
|
-
map || (map = new _ObjectMap());
|
31553
|
-
if (_isPrimitive(value)) {
|
31554
|
-
return value;
|
31555
|
-
}
|
31556
|
-
var copy = function copy2(copiedValue) {
|
31557
|
-
var cachedCopy = map.get(value);
|
31558
|
-
if (cachedCopy) {
|
31559
|
-
return cachedCopy;
|
31560
|
-
}
|
31561
|
-
map.set(value, copiedValue);
|
31562
|
-
for (var key in value) {
|
31563
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31564
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31565
|
-
}
|
31566
|
-
}
|
31567
|
-
return copiedValue;
|
31568
|
-
};
|
31569
|
-
switch (type_default(value)) {
|
31570
|
-
case "Object":
|
31571
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
31572
|
-
case "Array":
|
31573
|
-
return copy([]);
|
31574
|
-
case "Date":
|
31575
|
-
return new Date(value.valueOf());
|
31576
|
-
case "RegExp":
|
31577
|
-
return _cloneRegExp(value);
|
31578
|
-
case "Int8Array":
|
31579
|
-
case "Uint8Array":
|
31580
|
-
case "Uint8ClampedArray":
|
31581
|
-
case "Int16Array":
|
31582
|
-
case "Uint16Array":
|
31583
|
-
case "Int32Array":
|
31584
|
-
case "Uint32Array":
|
31585
|
-
case "Float32Array":
|
31586
|
-
case "Float64Array":
|
31587
|
-
case "BigInt64Array":
|
31588
|
-
case "BigUint64Array":
|
31589
|
-
return value.slice();
|
31590
|
-
default:
|
31591
|
-
return value;
|
31592
|
-
}
|
31593
|
-
}
|
31594
|
-
function _isPrimitive(param) {
|
31595
|
-
var type3 = typeof param;
|
31596
|
-
return param == null || type3 != "object" && type3 != "function";
|
31498
|
+
function max(...numbers) {
|
31499
|
+
return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
|
31597
31500
|
}
|
31598
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
31599
|
-
function _ObjectMap2() {
|
31600
|
-
this.map = {};
|
31601
|
-
this.length = 0;
|
31602
|
-
}
|
31603
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
31604
|
-
const hashedKey = this.hash(key);
|
31605
|
-
let bucket = this.map[hashedKey];
|
31606
|
-
if (!bucket) {
|
31607
|
-
this.map[hashedKey] = bucket = [];
|
31608
|
-
}
|
31609
|
-
bucket.push([key, value]);
|
31610
|
-
this.length += 1;
|
31611
|
-
};
|
31612
|
-
_ObjectMap2.prototype.hash = function(key) {
|
31613
|
-
let hashedKey = [];
|
31614
|
-
for (var value in key) {
|
31615
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31616
|
-
}
|
31617
|
-
return hashedKey.join();
|
31618
|
-
};
|
31619
|
-
_ObjectMap2.prototype.get = function(key) {
|
31620
|
-
if (this.length <= 180) {
|
31621
|
-
for (const p in this.map) {
|
31622
|
-
const bucket2 = this.map[p];
|
31623
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
31624
|
-
const element = bucket2[i];
|
31625
|
-
if (element[0] === key) {
|
31626
|
-
return element[1];
|
31627
|
-
}
|
31628
|
-
}
|
31629
|
-
}
|
31630
|
-
return;
|
31631
|
-
}
|
31632
|
-
const hashedKey = this.hash(key);
|
31633
|
-
const bucket = this.map[hashedKey];
|
31634
|
-
if (!bucket) {
|
31635
|
-
return;
|
31636
|
-
}
|
31637
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
31638
|
-
const element = bucket[i];
|
31639
|
-
if (element[0] === key) {
|
31640
|
-
return element[1];
|
31641
|
-
}
|
31642
|
-
}
|
31643
|
-
};
|
31644
|
-
return _ObjectMap2;
|
31645
|
-
}();
|
31646
|
-
|
31647
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31648
|
-
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31649
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31650
|
-
});
|
31651
|
-
var clone_default = clone;
|
31652
|
-
|
31653
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31654
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31655
31501
|
|
31656
31502
|
// src/providers/coin-quantity.ts
|
31657
31503
|
var coinQuantityfy = (coinQuantityLike) => {
|
31658
31504
|
let assetId;
|
31659
31505
|
let amount;
|
31660
|
-
let
|
31506
|
+
let max2;
|
31661
31507
|
if (Array.isArray(coinQuantityLike)) {
|
31662
31508
|
amount = coinQuantityLike[0];
|
31663
31509
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31664
|
-
|
31510
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31665
31511
|
} else {
|
31666
31512
|
amount = coinQuantityLike.amount;
|
31667
31513
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31668
|
-
|
31514
|
+
max2 = coinQuantityLike.max ?? void 0;
|
31669
31515
|
}
|
31670
31516
|
const bnAmount = bn(amount);
|
31671
31517
|
return {
|
31672
31518
|
assetId: hexlify(assetId),
|
31673
31519
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31674
|
-
max:
|
31520
|
+
max: max2 ? bn(max2) : void 0
|
31675
31521
|
};
|
31676
31522
|
};
|
31677
|
-
var
|
31523
|
+
var addAmountToAsset = (params) => {
|
31678
31524
|
const { amount, assetId } = params;
|
31679
31525
|
const coinQuantities = [...params.coinQuantities];
|
31680
31526
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31759,7 +31605,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31759
31605
|
var ENCODING_V1 = "1";
|
31760
31606
|
var WORD_SIZE = 8;
|
31761
31607
|
var BYTES_32 = 32;
|
31762
|
-
var UTXO_ID_LEN = BYTES_32 +
|
31608
|
+
var UTXO_ID_LEN = BYTES_32 + 1;
|
31763
31609
|
var ASSET_ID_LEN = BYTES_32;
|
31764
31610
|
var ADDRESS_LEN = BYTES_32;
|
31765
31611
|
var NONCE_LEN = BYTES_32;
|
@@ -31767,9 +31613,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31767
31613
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31768
31614
|
var MAX_BYTES = 2 ** 32 - 1;
|
31769
31615
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31770
|
-
|
31616
|
+
WORD_SIZE + // Tx size
|
31771
31617
|
// Asset ID/Balance coin input pairs
|
31772
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE)
|
31618
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31773
31619
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31774
31620
|
WORD_SIZE + // Gas limit
|
31775
31621
|
WORD_SIZE + // Script size
|
@@ -31787,6 +31633,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31787
31633
|
ASSET_ID_LEN + // Asset id
|
31788
31634
|
TX_POINTER_LEN + // TxPointer
|
31789
31635
|
WORD_SIZE + // Witnesses index
|
31636
|
+
WORD_SIZE + // Maturity
|
31790
31637
|
WORD_SIZE + // Predicate size
|
31791
31638
|
WORD_SIZE + // Predicate data size
|
31792
31639
|
WORD_SIZE;
|
@@ -32108,7 +31955,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32108
31955
|
constructor(name, coders) {
|
32109
31956
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32110
31957
|
const encodedValueSize = Object.values(coders).reduce(
|
32111
|
-
(
|
31958
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32112
31959
|
0
|
32113
31960
|
);
|
32114
31961
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32826,7 +32673,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32826
32673
|
constructor(name, coders) {
|
32827
32674
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32828
32675
|
const encodedValueSize = Object.values(coders).reduce(
|
32829
|
-
(
|
32676
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32830
32677
|
0
|
32831
32678
|
);
|
32832
32679
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33540,19 +33387,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33540
33387
|
encode(value) {
|
33541
33388
|
const parts = [];
|
33542
33389
|
parts.push(new B256Coder().encode(value.txID));
|
33543
|
-
parts.push(new NumberCoder("
|
33390
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33544
33391
|
parts.push(new B256Coder().encode(value.owner));
|
33545
33392
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33546
33393
|
parts.push(new B256Coder().encode(value.assetId));
|
33547
33394
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33548
|
-
parts.push(new NumberCoder("
|
33395
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33396
|
+
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33549
33397
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33550
|
-
parts.push(new
|
33551
|
-
parts.push(new
|
33552
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33553
|
-
parts.push(
|
33554
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33555
|
-
);
|
33398
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33399
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33400
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33401
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33556
33402
|
return concat(parts);
|
33557
33403
|
}
|
33558
33404
|
decode(data, offset) {
|
@@ -33560,7 +33406,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33560
33406
|
let o = offset;
|
33561
33407
|
[decoded, o] = new B256Coder().decode(data, o);
|
33562
33408
|
const txID = decoded;
|
33563
|
-
[decoded, o] = new NumberCoder("
|
33409
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33564
33410
|
const outputIndex = decoded;
|
33565
33411
|
[decoded, o] = new B256Coder().decode(data, o);
|
33566
33412
|
const owner = decoded;
|
@@ -33570,17 +33416,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33570
33416
|
const assetId = decoded;
|
33571
33417
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33572
33418
|
const txPointer = decoded;
|
33573
|
-
[decoded, o] = new NumberCoder("
|
33419
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33574
33420
|
const witnessIndex = Number(decoded);
|
33421
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33422
|
+
const maturity = decoded;
|
33575
33423
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33576
33424
|
const predicateGasUsed = decoded;
|
33577
|
-
[decoded, o] = new
|
33425
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33578
33426
|
const predicateLength = decoded;
|
33579
|
-
[decoded, o] = new
|
33427
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33580
33428
|
const predicateDataLength = decoded;
|
33581
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33429
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33582
33430
|
const predicate = decoded;
|
33583
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33431
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33584
33432
|
const predicateData = decoded;
|
33585
33433
|
return [
|
33586
33434
|
{
|
@@ -33592,6 +33440,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33592
33440
|
assetId,
|
33593
33441
|
txPointer,
|
33594
33442
|
witnessIndex,
|
33443
|
+
maturity,
|
33595
33444
|
predicateGasUsed,
|
33596
33445
|
predicateLength,
|
33597
33446
|
predicateDataLength,
|
@@ -33609,7 +33458,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33609
33458
|
encode(value) {
|
33610
33459
|
const parts = [];
|
33611
33460
|
parts.push(new B256Coder().encode(value.txID));
|
33612
|
-
parts.push(new NumberCoder("
|
33461
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33613
33462
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33614
33463
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33615
33464
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33621,7 +33470,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33621
33470
|
let o = offset;
|
33622
33471
|
[decoded, o] = new B256Coder().decode(data, o);
|
33623
33472
|
const txID = decoded;
|
33624
|
-
[decoded, o] = new NumberCoder("
|
33473
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33625
33474
|
const outputIndex = decoded;
|
33626
33475
|
[decoded, o] = new B256Coder().decode(data, o);
|
33627
33476
|
const balanceRoot = decoded;
|
@@ -33670,16 +33519,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33670
33519
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33671
33520
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33672
33521
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33673
|
-
parts.push(new NumberCoder("
|
33522
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33674
33523
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33675
|
-
parts.push(new
|
33676
|
-
parts.push(new
|
33677
|
-
parts.push(new
|
33524
|
+
parts.push(new NumberCoder("u32").encode(data.length));
|
33525
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33526
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33678
33527
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33679
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33680
|
-
parts.push(
|
33681
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33682
|
-
);
|
33528
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33529
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33683
33530
|
return concat(parts);
|
33684
33531
|
}
|
33685
33532
|
static decodeData(messageData) {
|
@@ -33699,21 +33546,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33699
33546
|
const amount = decoded;
|
33700
33547
|
[decoded, o] = new B256Coder().decode(data, o);
|
33701
33548
|
const nonce = decoded;
|
33702
|
-
[decoded, o] = new NumberCoder("
|
33549
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33703
33550
|
const witnessIndex = Number(decoded);
|
33704
33551
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33705
33552
|
const predicateGasUsed = decoded;
|
33706
33553
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33707
33554
|
const dataLength2 = decoded;
|
33708
|
-
[decoded, o] = new
|
33555
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33709
33556
|
const predicateLength = decoded;
|
33710
|
-
[decoded, o] = new
|
33557
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33711
33558
|
const predicateDataLength = decoded;
|
33712
33559
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33713
33560
|
const messageData = decoded;
|
33714
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33561
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33715
33562
|
const predicate = decoded;
|
33716
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33563
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33717
33564
|
const predicateData = decoded;
|
33718
33565
|
return [
|
33719
33566
|
{
|
@@ -34025,7 +33872,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34025
33872
|
}
|
34026
33873
|
};
|
34027
33874
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
34028
|
-
PolicyType2[PolicyType2["
|
33875
|
+
PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
|
34029
33876
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
34030
33877
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
34031
33878
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -34073,9 +33920,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34073
33920
|
let o = offset;
|
34074
33921
|
const policies = [];
|
34075
33922
|
if (policyTypes & 1) {
|
34076
|
-
const [
|
33923
|
+
const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
34077
33924
|
o = nextOffset;
|
34078
|
-
policies.push({ type: 1, data:
|
33925
|
+
policies.push({ type: 1, data: gasPrice });
|
34079
33926
|
}
|
34080
33927
|
if (policyTypes & 2) {
|
34081
33928
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34307,15 +34154,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34307
34154
|
encode(value) {
|
34308
34155
|
const parts = [];
|
34309
34156
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34310
|
-
parts.push(new
|
34311
|
-
parts.push(new
|
34312
|
-
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34157
|
+
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34158
|
+
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34313
34159
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34314
|
-
parts.push(new NumberCoder("
|
34315
|
-
parts.push(new NumberCoder("
|
34316
|
-
parts.push(new NumberCoder("
|
34317
|
-
parts.push(new
|
34318
|
-
parts.push(new ByteArrayCoder(value.
|
34160
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34161
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34162
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34163
|
+
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34164
|
+
parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
|
34165
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
|
34319
34166
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34320
34167
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34321
34168
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34327,23 +34174,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34327
34174
|
let o = offset;
|
34328
34175
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34329
34176
|
const scriptGasLimit = decoded;
|
34330
|
-
[decoded, o] = new
|
34331
|
-
const receiptsRoot = decoded;
|
34332
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34177
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34333
34178
|
const scriptLength = decoded;
|
34334
|
-
[decoded, o] = new
|
34179
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34335
34180
|
const scriptDataLength = decoded;
|
34336
34181
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34337
34182
|
const policyTypes = decoded;
|
34338
|
-
[decoded, o] = new NumberCoder("
|
34183
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34339
34184
|
const inputsCount = decoded;
|
34340
|
-
[decoded, o] = new NumberCoder("
|
34185
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34341
34186
|
const outputsCount = decoded;
|
34342
|
-
[decoded, o] = new NumberCoder("
|
34187
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34343
34188
|
const witnessesCount = decoded;
|
34344
|
-
[decoded, o] = new
|
34189
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34190
|
+
const receiptsRoot = decoded;
|
34191
|
+
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34345
34192
|
const script = decoded;
|
34346
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength
|
34193
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34347
34194
|
const scriptData = decoded;
|
34348
34195
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34349
34196
|
const policies = decoded;
|
@@ -34381,19 +34228,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34381
34228
|
}
|
34382
34229
|
encode(value) {
|
34383
34230
|
const parts = [];
|
34384
|
-
parts.push(new NumberCoder("
|
34385
|
-
parts.push(new
|
34386
|
-
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34231
|
+
parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
|
34232
|
+
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34387
34233
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34388
|
-
parts.push(new NumberCoder("u16").encode(value.
|
34389
|
-
parts.push(new NumberCoder("
|
34390
|
-
parts.push(new NumberCoder("
|
34234
|
+
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
34235
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34236
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34237
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34238
|
+
parts.push(new B256Coder().encode(value.salt));
|
34239
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34391
34240
|
parts.push(
|
34392
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount
|
34393
|
-
value.storageSlots
|
34394
|
-
)
|
34241
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
|
34395
34242
|
);
|
34396
|
-
parts.push(new PoliciesCoder().encode(value.policies));
|
34397
34243
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34398
34244
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34399
34245
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34402,27 +34248,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34402
34248
|
decode(data, offset) {
|
34403
34249
|
let decoded;
|
34404
34250
|
let o = offset;
|
34405
|
-
[decoded, o] = new NumberCoder("
|
34251
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34252
|
+
const bytecodeLength = decoded;
|
34253
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34406
34254
|
const bytecodeWitnessIndex = decoded;
|
34407
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
34408
|
-
const salt = decoded;
|
34409
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34410
|
-
const storageSlotsCount = decoded;
|
34411
34255
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34412
34256
|
const policyTypes = decoded;
|
34413
34257
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34258
|
+
const storageSlotsCount = decoded;
|
34259
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34414
34260
|
const inputsCount = decoded;
|
34415
|
-
[decoded, o] = new NumberCoder("
|
34261
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34416
34262
|
const outputsCount = decoded;
|
34417
|
-
[decoded, o] = new NumberCoder("
|
34263
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34418
34264
|
const witnessesCount = decoded;
|
34419
|
-
[decoded, o] = new
|
34420
|
-
|
34421
|
-
o
|
34422
|
-
);
|
34423
|
-
const storageSlots = decoded;
|
34265
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34266
|
+
const salt = decoded;
|
34424
34267
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34425
34268
|
const policies = decoded;
|
34269
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34270
|
+
const storageSlots = decoded;
|
34426
34271
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34427
34272
|
const inputs = decoded;
|
34428
34273
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34432,6 +34277,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34432
34277
|
return [
|
34433
34278
|
{
|
34434
34279
|
type: 1,
|
34280
|
+
bytecodeLength,
|
34435
34281
|
bytecodeWitnessIndex,
|
34436
34282
|
policyTypes,
|
34437
34283
|
storageSlotsCount,
|
@@ -34460,7 +34306,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34460
34306
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34461
34307
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34462
34308
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34463
|
-
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34464
34309
|
return concat(parts);
|
34465
34310
|
}
|
34466
34311
|
decode(data, offset) {
|
@@ -34476,8 +34321,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34476
34321
|
const mintAmount = decoded;
|
34477
34322
|
[decoded, o] = new B256Coder().decode(data, o);
|
34478
34323
|
const mintAssetId = decoded;
|
34479
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34480
|
-
const gasPrice = decoded;
|
34481
34324
|
return [
|
34482
34325
|
{
|
34483
34326
|
type: 2,
|
@@ -34485,8 +34328,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34485
34328
|
inputContract,
|
34486
34329
|
outputContract,
|
34487
34330
|
mintAmount,
|
34488
|
-
mintAssetId
|
34489
|
-
gasPrice
|
34331
|
+
mintAssetId
|
34490
34332
|
},
|
34491
34333
|
o
|
34492
34334
|
];
|
@@ -34793,6 +34635,159 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34793
34635
|
// src/providers/provider.ts
|
34794
34636
|
var import_graphql_request = __toESM(require_dist2());
|
34795
34637
|
|
34638
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34639
|
+
function _isPlaceholder(a) {
|
34640
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34641
|
+
}
|
34642
|
+
|
34643
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34644
|
+
function _curry1(fn) {
|
34645
|
+
return function f1(a) {
|
34646
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34647
|
+
return f1;
|
34648
|
+
} else {
|
34649
|
+
return fn.apply(this, arguments);
|
34650
|
+
}
|
34651
|
+
};
|
34652
|
+
}
|
34653
|
+
|
34654
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34655
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
34656
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34657
|
+
};
|
34658
|
+
|
34659
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34660
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34661
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34662
|
+
});
|
34663
|
+
var type_default = type;
|
34664
|
+
|
34665
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34666
|
+
var pad = function pad2(n) {
|
34667
|
+
return (n < 10 ? "0" : "") + n;
|
34668
|
+
};
|
34669
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34670
|
+
return d.toISOString();
|
34671
|
+
} : function _toISOString3(d) {
|
34672
|
+
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";
|
34673
|
+
};
|
34674
|
+
|
34675
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34676
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34677
|
+
return n << 0 === n;
|
34678
|
+
};
|
34679
|
+
|
34680
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34681
|
+
function _cloneRegExp(pattern) {
|
34682
|
+
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" : ""));
|
34683
|
+
}
|
34684
|
+
|
34685
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34686
|
+
function _clone(value, deep, map) {
|
34687
|
+
map || (map = new _ObjectMap());
|
34688
|
+
if (_isPrimitive(value)) {
|
34689
|
+
return value;
|
34690
|
+
}
|
34691
|
+
var copy = function copy2(copiedValue) {
|
34692
|
+
var cachedCopy = map.get(value);
|
34693
|
+
if (cachedCopy) {
|
34694
|
+
return cachedCopy;
|
34695
|
+
}
|
34696
|
+
map.set(value, copiedValue);
|
34697
|
+
for (var key in value) {
|
34698
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34699
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34700
|
+
}
|
34701
|
+
}
|
34702
|
+
return copiedValue;
|
34703
|
+
};
|
34704
|
+
switch (type_default(value)) {
|
34705
|
+
case "Object":
|
34706
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
34707
|
+
case "Array":
|
34708
|
+
return copy([]);
|
34709
|
+
case "Date":
|
34710
|
+
return new Date(value.valueOf());
|
34711
|
+
case "RegExp":
|
34712
|
+
return _cloneRegExp(value);
|
34713
|
+
case "Int8Array":
|
34714
|
+
case "Uint8Array":
|
34715
|
+
case "Uint8ClampedArray":
|
34716
|
+
case "Int16Array":
|
34717
|
+
case "Uint16Array":
|
34718
|
+
case "Int32Array":
|
34719
|
+
case "Uint32Array":
|
34720
|
+
case "Float32Array":
|
34721
|
+
case "Float64Array":
|
34722
|
+
case "BigInt64Array":
|
34723
|
+
case "BigUint64Array":
|
34724
|
+
return value.slice();
|
34725
|
+
default:
|
34726
|
+
return value;
|
34727
|
+
}
|
34728
|
+
}
|
34729
|
+
function _isPrimitive(param) {
|
34730
|
+
var type3 = typeof param;
|
34731
|
+
return param == null || type3 != "object" && type3 != "function";
|
34732
|
+
}
|
34733
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
34734
|
+
function _ObjectMap2() {
|
34735
|
+
this.map = {};
|
34736
|
+
this.length = 0;
|
34737
|
+
}
|
34738
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
34739
|
+
const hashedKey = this.hash(key);
|
34740
|
+
let bucket = this.map[hashedKey];
|
34741
|
+
if (!bucket) {
|
34742
|
+
this.map[hashedKey] = bucket = [];
|
34743
|
+
}
|
34744
|
+
bucket.push([key, value]);
|
34745
|
+
this.length += 1;
|
34746
|
+
};
|
34747
|
+
_ObjectMap2.prototype.hash = function(key) {
|
34748
|
+
let hashedKey = [];
|
34749
|
+
for (var value in key) {
|
34750
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34751
|
+
}
|
34752
|
+
return hashedKey.join();
|
34753
|
+
};
|
34754
|
+
_ObjectMap2.prototype.get = function(key) {
|
34755
|
+
if (this.length <= 180) {
|
34756
|
+
for (const p in this.map) {
|
34757
|
+
const bucket2 = this.map[p];
|
34758
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
34759
|
+
const element = bucket2[i];
|
34760
|
+
if (element[0] === key) {
|
34761
|
+
return element[1];
|
34762
|
+
}
|
34763
|
+
}
|
34764
|
+
}
|
34765
|
+
return;
|
34766
|
+
}
|
34767
|
+
const hashedKey = this.hash(key);
|
34768
|
+
const bucket = this.map[hashedKey];
|
34769
|
+
if (!bucket) {
|
34770
|
+
return;
|
34771
|
+
}
|
34772
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
34773
|
+
const element = bucket[i];
|
34774
|
+
if (element[0] === key) {
|
34775
|
+
return element[1];
|
34776
|
+
}
|
34777
|
+
}
|
34778
|
+
};
|
34779
|
+
return _ObjectMap2;
|
34780
|
+
}();
|
34781
|
+
|
34782
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34783
|
+
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34784
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34785
|
+
});
|
34786
|
+
var clone_default = clone2;
|
34787
|
+
|
34788
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34789
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34790
|
+
|
34796
34791
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34797
34792
|
var __assign = function() {
|
34798
34793
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37958,8 +37953,44 @@ spurious results.`);
|
|
37958
37953
|
var lib_default2 = gql;
|
37959
37954
|
|
37960
37955
|
// src/providers/__generated__/operations.ts
|
37961
|
-
var
|
37962
|
-
fragment
|
37956
|
+
var ReceiptFragmentFragmentDoc = lib_default2`
|
37957
|
+
fragment receiptFragment on Receipt {
|
37958
|
+
contract {
|
37959
|
+
id
|
37960
|
+
}
|
37961
|
+
pc
|
37962
|
+
is
|
37963
|
+
to {
|
37964
|
+
id
|
37965
|
+
}
|
37966
|
+
toAddress
|
37967
|
+
amount
|
37968
|
+
assetId
|
37969
|
+
gas
|
37970
|
+
param1
|
37971
|
+
param2
|
37972
|
+
val
|
37973
|
+
ptr
|
37974
|
+
digest
|
37975
|
+
reason
|
37976
|
+
ra
|
37977
|
+
rb
|
37978
|
+
rc
|
37979
|
+
rd
|
37980
|
+
len
|
37981
|
+
receiptType
|
37982
|
+
result
|
37983
|
+
gasUsed
|
37984
|
+
data
|
37985
|
+
sender
|
37986
|
+
recipient
|
37987
|
+
nonce
|
37988
|
+
contractId
|
37989
|
+
subId
|
37990
|
+
}
|
37991
|
+
`;
|
37992
|
+
var TransactionStatusFragmentFragmentDoc = lib_default2`
|
37993
|
+
fragment transactionStatusFragment on TransactionStatus {
|
37963
37994
|
type: __typename
|
37964
37995
|
... on SubmittedStatus {
|
37965
37996
|
time
|
@@ -37986,84 +38017,20 @@ spurious results.`);
|
|
37986
38017
|
}
|
37987
38018
|
}
|
37988
38019
|
`;
|
37989
|
-
var ReceiptFragmentFragmentDoc = lib_default2`
|
37990
|
-
fragment receiptFragment on Receipt {
|
37991
|
-
id
|
37992
|
-
pc
|
37993
|
-
is
|
37994
|
-
to
|
37995
|
-
toAddress
|
37996
|
-
amount
|
37997
|
-
assetId
|
37998
|
-
gas
|
37999
|
-
param1
|
38000
|
-
param2
|
38001
|
-
val
|
38002
|
-
ptr
|
38003
|
-
digest
|
38004
|
-
reason
|
38005
|
-
ra
|
38006
|
-
rb
|
38007
|
-
rc
|
38008
|
-
rd
|
38009
|
-
len
|
38010
|
-
receiptType
|
38011
|
-
result
|
38012
|
-
gasUsed
|
38013
|
-
data
|
38014
|
-
sender
|
38015
|
-
recipient
|
38016
|
-
nonce
|
38017
|
-
contractId
|
38018
|
-
subId
|
38019
|
-
}
|
38020
|
-
`;
|
38021
|
-
var TransactionStatusFragmentFragmentDoc = lib_default2`
|
38022
|
-
fragment transactionStatusFragment on TransactionStatus {
|
38023
|
-
type: __typename
|
38024
|
-
... on SubmittedStatus {
|
38025
|
-
time
|
38026
|
-
}
|
38027
|
-
... on SuccessStatus {
|
38028
|
-
block {
|
38029
|
-
id
|
38030
|
-
}
|
38031
|
-
time
|
38032
|
-
receipts {
|
38033
|
-
...receiptFragment
|
38034
|
-
}
|
38035
|
-
programState {
|
38036
|
-
returnType
|
38037
|
-
data
|
38038
|
-
}
|
38039
|
-
receipts {
|
38040
|
-
...receiptFragment
|
38041
|
-
}
|
38042
|
-
}
|
38043
|
-
... on FailureStatus {
|
38044
|
-
block {
|
38045
|
-
id
|
38046
|
-
}
|
38047
|
-
time
|
38048
|
-
reason
|
38049
|
-
receipts {
|
38050
|
-
...receiptFragment
|
38051
|
-
}
|
38052
|
-
}
|
38053
|
-
... on SqueezedOutStatus {
|
38054
|
-
reason
|
38055
|
-
}
|
38056
|
-
}
|
38057
|
-
${ReceiptFragmentFragmentDoc}`;
|
38058
38020
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38059
38021
|
fragment transactionFragment on Transaction {
|
38060
38022
|
id
|
38061
38023
|
rawPayload
|
38024
|
+
gasPrice
|
38025
|
+
receipts {
|
38026
|
+
...receiptFragment
|
38027
|
+
}
|
38062
38028
|
status {
|
38063
38029
|
...transactionStatusFragment
|
38064
38030
|
}
|
38065
38031
|
}
|
38066
|
-
${
|
38032
|
+
${ReceiptFragmentFragmentDoc}
|
38033
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38067
38034
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38068
38035
|
fragment inputEstimatePredicatesFragment on Input {
|
38069
38036
|
... on InputCoin {
|
@@ -38081,46 +38048,6 @@ spurious results.`);
|
|
38081
38048
|
}
|
38082
38049
|
}
|
38083
38050
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38084
|
-
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38085
|
-
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38086
|
-
reason
|
38087
|
-
programState {
|
38088
|
-
returnType
|
38089
|
-
data
|
38090
|
-
}
|
38091
|
-
}
|
38092
|
-
`;
|
38093
|
-
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38094
|
-
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38095
|
-
programState {
|
38096
|
-
returnType
|
38097
|
-
data
|
38098
|
-
}
|
38099
|
-
}
|
38100
|
-
`;
|
38101
|
-
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38102
|
-
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38103
|
-
... on DryRunFailureStatus {
|
38104
|
-
...dryRunFailureStatusFragment
|
38105
|
-
}
|
38106
|
-
... on DryRunSuccessStatus {
|
38107
|
-
...dryRunSuccessStatusFragment
|
38108
|
-
}
|
38109
|
-
}
|
38110
|
-
${DryRunFailureStatusFragmentFragmentDoc}
|
38111
|
-
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38112
|
-
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38113
|
-
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38114
|
-
id
|
38115
|
-
status {
|
38116
|
-
...dryRunTransactionStatusFragment
|
38117
|
-
}
|
38118
|
-
receipts {
|
38119
|
-
...receiptFragment
|
38120
|
-
}
|
38121
|
-
}
|
38122
|
-
${DryRunTransactionStatusFragmentFragmentDoc}
|
38123
|
-
${ReceiptFragmentFragmentDoc}`;
|
38124
38051
|
var CoinFragmentFragmentDoc = lib_default2`
|
38125
38052
|
fragment coinFragment on Coin {
|
38126
38053
|
__typename
|
@@ -38128,6 +38055,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38128
38055
|
owner
|
38129
38056
|
amount
|
38130
38057
|
assetId
|
38058
|
+
maturity
|
38131
38059
|
blockCreated
|
38132
38060
|
txCreatedIdx
|
38133
38061
|
}
|
@@ -38166,32 +38094,26 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38166
38094
|
messageBlockHeader {
|
38167
38095
|
id
|
38168
38096
|
daHeight
|
38169
|
-
consensusParametersVersion
|
38170
|
-
stateTransitionBytecodeVersion
|
38171
38097
|
transactionsCount
|
38172
|
-
messageReceiptCount
|
38173
38098
|
transactionsRoot
|
38174
|
-
messageOutboxRoot
|
38175
|
-
eventInboxRoot
|
38176
38099
|
height
|
38177
38100
|
prevRoot
|
38178
38101
|
time
|
38179
38102
|
applicationHash
|
38103
|
+
messageReceiptRoot
|
38104
|
+
messageReceiptCount
|
38180
38105
|
}
|
38181
38106
|
commitBlockHeader {
|
38182
38107
|
id
|
38183
38108
|
daHeight
|
38184
|
-
consensusParametersVersion
|
38185
|
-
stateTransitionBytecodeVersion
|
38186
38109
|
transactionsCount
|
38187
|
-
messageReceiptCount
|
38188
38110
|
transactionsRoot
|
38189
|
-
messageOutboxRoot
|
38190
|
-
eventInboxRoot
|
38191
38111
|
height
|
38192
38112
|
prevRoot
|
38193
38113
|
time
|
38194
38114
|
applicationHash
|
38115
|
+
messageReceiptRoot
|
38116
|
+
messageReceiptCount
|
38195
38117
|
}
|
38196
38118
|
sender
|
38197
38119
|
recipient
|
@@ -38210,8 +38132,8 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38210
38132
|
var BlockFragmentFragmentDoc = lib_default2`
|
38211
38133
|
fragment blockFragment on Block {
|
38212
38134
|
id
|
38213
|
-
height
|
38214
38135
|
header {
|
38136
|
+
height
|
38215
38137
|
time
|
38216
38138
|
}
|
38217
38139
|
transactions {
|
@@ -38221,7 +38143,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38221
38143
|
`;
|
38222
38144
|
var TxParametersFragmentFragmentDoc = lib_default2`
|
38223
38145
|
fragment TxParametersFragment on TxParameters {
|
38224
|
-
version
|
38225
38146
|
maxInputs
|
38226
38147
|
maxOutputs
|
38227
38148
|
maxWitnesses
|
@@ -38231,7 +38152,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38231
38152
|
`;
|
38232
38153
|
var PredicateParametersFragmentFragmentDoc = lib_default2`
|
38233
38154
|
fragment PredicateParametersFragment on PredicateParameters {
|
38234
|
-
version
|
38235
38155
|
maxPredicateLength
|
38236
38156
|
maxPredicateDataLength
|
38237
38157
|
maxGasPerPredicate
|
@@ -38240,21 +38160,18 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38240
38160
|
`;
|
38241
38161
|
var ScriptParametersFragmentFragmentDoc = lib_default2`
|
38242
38162
|
fragment ScriptParametersFragment on ScriptParameters {
|
38243
|
-
version
|
38244
38163
|
maxScriptLength
|
38245
38164
|
maxScriptDataLength
|
38246
38165
|
}
|
38247
38166
|
`;
|
38248
38167
|
var ContractParametersFragmentFragmentDoc = lib_default2`
|
38249
38168
|
fragment ContractParametersFragment on ContractParameters {
|
38250
|
-
version
|
38251
38169
|
contractMaxSize
|
38252
38170
|
maxStorageSlots
|
38253
38171
|
}
|
38254
38172
|
`;
|
38255
38173
|
var FeeParametersFragmentFragmentDoc = lib_default2`
|
38256
38174
|
fragment FeeParametersFragment on FeeParameters {
|
38257
|
-
version
|
38258
38175
|
gasPriceFactor
|
38259
38176
|
gasPerByte
|
38260
38177
|
}
|
@@ -38274,7 +38191,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38274
38191
|
`;
|
38275
38192
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38276
38193
|
fragment GasCostsFragment on GasCosts {
|
38277
|
-
version
|
38278
38194
|
add
|
38279
38195
|
addi
|
38280
38196
|
aloc
|
@@ -38287,6 +38203,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38287
38203
|
cb
|
38288
38204
|
cfei
|
38289
38205
|
cfsi
|
38206
|
+
croo
|
38290
38207
|
div
|
38291
38208
|
divi
|
38292
38209
|
ecr1
|
@@ -38369,9 +38286,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38369
38286
|
ccp {
|
38370
38287
|
...DependentCostFragment
|
38371
38288
|
}
|
38372
|
-
croo {
|
38373
|
-
...DependentCostFragment
|
38374
|
-
}
|
38375
38289
|
csiz {
|
38376
38290
|
...DependentCostFragment
|
38377
38291
|
}
|
@@ -38431,7 +38345,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38431
38345
|
${DependentCostFragmentFragmentDoc}`;
|
38432
38346
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38433
38347
|
fragment consensusParametersFragment on ConsensusParameters {
|
38434
|
-
version
|
38435
38348
|
txParams {
|
38436
38349
|
...TxParametersFragment
|
38437
38350
|
}
|
@@ -38491,9 +38404,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38491
38404
|
fragment nodeInfoFragment on NodeInfo {
|
38492
38405
|
utxoValidation
|
38493
38406
|
vmBacktrace
|
38407
|
+
minGasPrice
|
38494
38408
|
maxTx
|
38495
38409
|
maxDepth
|
38496
38410
|
nodeVersion
|
38411
|
+
peers {
|
38412
|
+
id
|
38413
|
+
addresses
|
38414
|
+
clientVersion
|
38415
|
+
blockHeight
|
38416
|
+
lastHeartbeatMs
|
38417
|
+
appScore
|
38418
|
+
}
|
38497
38419
|
}
|
38498
38420
|
`;
|
38499
38421
|
var GetVersionDocument = lib_default2`
|
@@ -38528,9 +38450,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38528
38450
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38529
38451
|
transaction(id: $transactionId) {
|
38530
38452
|
...transactionFragment
|
38453
|
+
receipts {
|
38454
|
+
...receiptFragment
|
38455
|
+
}
|
38531
38456
|
}
|
38532
38457
|
}
|
38533
|
-
${TransactionFragmentFragmentDoc}
|
38458
|
+
${TransactionFragmentFragmentDoc}
|
38459
|
+
${ReceiptFragmentFragmentDoc}`;
|
38534
38460
|
var GetTransactionsDocument = lib_default2`
|
38535
38461
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38536
38462
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38658,20 +38584,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38658
38584
|
}
|
38659
38585
|
}
|
38660
38586
|
${BalanceFragmentFragmentDoc}`;
|
38661
|
-
var GetLatestGasPriceDocument = lib_default2`
|
38662
|
-
query getLatestGasPrice {
|
38663
|
-
latestGasPrice {
|
38664
|
-
gasPrice
|
38665
|
-
}
|
38666
|
-
}
|
38667
|
-
`;
|
38668
|
-
var EstimateGasPriceDocument = lib_default2`
|
38669
|
-
query estimateGasPrice($blockHorizon: U32!) {
|
38670
|
-
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38671
|
-
gasPrice
|
38672
|
-
}
|
38673
|
-
}
|
38674
|
-
`;
|
38675
38587
|
var GetBalancesDocument = lib_default2`
|
38676
38588
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38677
38589
|
balances(
|
@@ -38726,12 +38638,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38726
38638
|
}
|
38727
38639
|
`;
|
38728
38640
|
var DryRunDocument = lib_default2`
|
38729
|
-
mutation dryRun($
|
38730
|
-
dryRun(
|
38731
|
-
...
|
38641
|
+
mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
|
38642
|
+
dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
|
38643
|
+
...receiptFragment
|
38732
38644
|
}
|
38733
38645
|
}
|
38734
|
-
${
|
38646
|
+
${ReceiptFragmentFragmentDoc}`;
|
38735
38647
|
var SubmitDocument = lib_default2`
|
38736
38648
|
mutation submit($encodedTransaction: HexString!) {
|
38737
38649
|
submit(tx: $encodedTransaction) {
|
@@ -38750,17 +38662,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38750
38662
|
var SubmitAndAwaitDocument = lib_default2`
|
38751
38663
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
38752
38664
|
submitAndAwait(tx: $encodedTransaction) {
|
38753
|
-
...
|
38665
|
+
...transactionStatusFragment
|
38754
38666
|
}
|
38755
38667
|
}
|
38756
|
-
${
|
38668
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38757
38669
|
var StatusChangeDocument = lib_default2`
|
38758
38670
|
subscription statusChange($transactionId: TransactionId!) {
|
38759
38671
|
statusChange(id: $transactionId) {
|
38760
|
-
...
|
38672
|
+
...transactionStatusFragment
|
38761
38673
|
}
|
38762
38674
|
}
|
38763
|
-
${
|
38675
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38764
38676
|
function getSdk(requester) {
|
38765
38677
|
return {
|
38766
38678
|
getVersion(variables, options) {
|
@@ -38814,12 +38726,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38814
38726
|
getBalance(variables, options) {
|
38815
38727
|
return requester(GetBalanceDocument, variables, options);
|
38816
38728
|
},
|
38817
|
-
getLatestGasPrice(variables, options) {
|
38818
|
-
return requester(GetLatestGasPriceDocument, variables, options);
|
38819
|
-
},
|
38820
|
-
estimateGasPrice(variables, options) {
|
38821
|
-
return requester(EstimateGasPriceDocument, variables, options);
|
38822
|
-
},
|
38823
38729
|
getBalances(variables, options) {
|
38824
38730
|
return requester(GetBalancesDocument, variables, options);
|
38825
38731
|
},
|
@@ -39003,9 +38909,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39003
38909
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
39004
38910
|
},
|
39005
38911
|
witnessIndex: value.witnessIndex,
|
38912
|
+
maturity: value.maturity ?? 0,
|
39006
38913
|
predicateGasUsed: bn(value.predicateGasUsed),
|
39007
|
-
predicateLength:
|
39008
|
-
predicateDataLength:
|
38914
|
+
predicateLength: predicate.length,
|
38915
|
+
predicateDataLength: predicateData.length,
|
39009
38916
|
predicate: hexlify(predicate),
|
39010
38917
|
predicateData: hexlify(predicateData)
|
39011
38918
|
};
|
@@ -39036,8 +38943,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39036
38943
|
nonce: hexlify(value.nonce),
|
39037
38944
|
witnessIndex: value.witnessIndex,
|
39038
38945
|
predicateGasUsed: bn(value.predicateGasUsed),
|
39039
|
-
predicateLength:
|
39040
|
-
predicateDataLength:
|
38946
|
+
predicateLength: predicate.length,
|
38947
|
+
predicateDataLength: predicateData.length,
|
39041
38948
|
predicate: hexlify(predicate),
|
39042
38949
|
predicateData: hexlify(predicateData),
|
39043
38950
|
data: hexlify(data),
|
@@ -39197,8 +39104,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39197
39104
|
case "CALL" /* Call */: {
|
39198
39105
|
const callReceipt = {
|
39199
39106
|
type: ReceiptType.Call,
|
39200
|
-
from: hexOrZero(receipt.id
|
39201
|
-
to: hexOrZero(receipt?.to),
|
39107
|
+
from: hexOrZero(receipt.contract?.id),
|
39108
|
+
to: hexOrZero(receipt?.to?.id),
|
39202
39109
|
amount: bn(receipt.amount),
|
39203
39110
|
assetId: hexOrZero(receipt.assetId),
|
39204
39111
|
gas: bn(receipt.gas),
|
@@ -39212,7 +39119,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39212
39119
|
case "RETURN" /* Return */: {
|
39213
39120
|
const returnReceipt = {
|
39214
39121
|
type: ReceiptType.Return,
|
39215
|
-
id: hexOrZero(receipt.id
|
39122
|
+
id: hexOrZero(receipt.contract?.id),
|
39216
39123
|
val: bn(receipt.val),
|
39217
39124
|
pc: bn(receipt.pc),
|
39218
39125
|
is: bn(receipt.is)
|
@@ -39222,7 +39129,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39222
39129
|
case "RETURN_DATA" /* ReturnData */: {
|
39223
39130
|
const returnDataReceipt = {
|
39224
39131
|
type: ReceiptType.ReturnData,
|
39225
|
-
id: hexOrZero(receipt.id
|
39132
|
+
id: hexOrZero(receipt.contract?.id),
|
39226
39133
|
ptr: bn(receipt.ptr),
|
39227
39134
|
len: bn(receipt.len),
|
39228
39135
|
digest: hexOrZero(receipt.digest),
|
@@ -39234,7 +39141,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39234
39141
|
case "PANIC" /* Panic */: {
|
39235
39142
|
const panicReceipt = {
|
39236
39143
|
type: ReceiptType.Panic,
|
39237
|
-
id: hexOrZero(receipt.id),
|
39144
|
+
id: hexOrZero(receipt.contract?.id),
|
39238
39145
|
reason: bn(receipt.reason),
|
39239
39146
|
pc: bn(receipt.pc),
|
39240
39147
|
is: bn(receipt.is),
|
@@ -39245,7 +39152,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39245
39152
|
case "REVERT" /* Revert */: {
|
39246
39153
|
const revertReceipt = {
|
39247
39154
|
type: ReceiptType.Revert,
|
39248
|
-
id: hexOrZero(receipt.id
|
39155
|
+
id: hexOrZero(receipt.contract?.id),
|
39249
39156
|
val: bn(receipt.ra),
|
39250
39157
|
pc: bn(receipt.pc),
|
39251
39158
|
is: bn(receipt.is)
|
@@ -39255,7 +39162,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39255
39162
|
case "LOG" /* Log */: {
|
39256
39163
|
const logReceipt = {
|
39257
39164
|
type: ReceiptType.Log,
|
39258
|
-
id: hexOrZero(receipt.id
|
39165
|
+
id: hexOrZero(receipt.contract?.id),
|
39259
39166
|
val0: bn(receipt.ra),
|
39260
39167
|
val1: bn(receipt.rb),
|
39261
39168
|
val2: bn(receipt.rc),
|
@@ -39268,7 +39175,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39268
39175
|
case "LOG_DATA" /* LogData */: {
|
39269
39176
|
const logDataReceipt = {
|
39270
39177
|
type: ReceiptType.LogData,
|
39271
|
-
id: hexOrZero(receipt.id
|
39178
|
+
id: hexOrZero(receipt.contract?.id),
|
39272
39179
|
val0: bn(receipt.ra),
|
39273
39180
|
val1: bn(receipt.rb),
|
39274
39181
|
ptr: bn(receipt.ptr),
|
@@ -39282,8 +39189,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39282
39189
|
case "TRANSFER" /* Transfer */: {
|
39283
39190
|
const transferReceipt = {
|
39284
39191
|
type: ReceiptType.Transfer,
|
39285
|
-
from: hexOrZero(receipt.id
|
39286
|
-
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39192
|
+
from: hexOrZero(receipt.contract?.id),
|
39193
|
+
to: hexOrZero(receipt.toAddress || receipt?.to?.id),
|
39287
39194
|
amount: bn(receipt.amount),
|
39288
39195
|
assetId: hexOrZero(receipt.assetId),
|
39289
39196
|
pc: bn(receipt.pc),
|
@@ -39294,8 +39201,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39294
39201
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39295
39202
|
const transferOutReceipt = {
|
39296
39203
|
type: ReceiptType.TransferOut,
|
39297
|
-
from: hexOrZero(receipt.id
|
39298
|
-
to: hexOrZero(receipt.toAddress || receipt.to),
|
39204
|
+
from: hexOrZero(receipt.contract?.id),
|
39205
|
+
to: hexOrZero(receipt.toAddress || receipt.to?.id),
|
39299
39206
|
amount: bn(receipt.amount),
|
39300
39207
|
assetId: hexOrZero(receipt.assetId),
|
39301
39208
|
pc: bn(receipt.pc),
|
@@ -39338,7 +39245,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39338
39245
|
return receiptMessageOut;
|
39339
39246
|
}
|
39340
39247
|
case "MINT" /* Mint */: {
|
39341
|
-
const contractId = hexOrZero(receipt.id
|
39248
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39342
39249
|
const subId = hexOrZero(receipt.subId);
|
39343
39250
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39344
39251
|
const mintReceipt = {
|
@@ -39353,7 +39260,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39353
39260
|
return mintReceipt;
|
39354
39261
|
}
|
39355
39262
|
case "BURN" /* Burn */: {
|
39356
|
-
const contractId = hexOrZero(receipt.id
|
39263
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39357
39264
|
const subId = hexOrZero(receipt.subId);
|
39358
39265
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39359
39266
|
const burnReceipt = {
|
@@ -39434,6 +39341,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39434
39341
|
};
|
39435
39342
|
|
39436
39343
|
// src/providers/utils/gas.ts
|
39344
|
+
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39437
39345
|
var getGasUsedFromReceipts = (receipts) => {
|
39438
39346
|
const scriptResult = receipts.filter(
|
39439
39347
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39454,28 +39362,18 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39454
39362
|
}
|
39455
39363
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39456
39364
|
const witnessCache = [];
|
39457
|
-
const
|
39458
|
-
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39459
|
-
if (isCoinOrMessage) {
|
39460
|
-
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39461
|
-
return true;
|
39462
|
-
}
|
39463
|
-
if (!witnessCache.includes(input.witnessIndex)) {
|
39464
|
-
witnessCache.push(input.witnessIndex);
|
39465
|
-
return true;
|
39466
|
-
}
|
39467
|
-
}
|
39468
|
-
return false;
|
39469
|
-
});
|
39470
|
-
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39471
|
-
const totalGas = chargeableInputs.reduce((total, input) => {
|
39365
|
+
const totalGas = inputs.reduce((total, input) => {
|
39472
39366
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39473
39367
|
return total.add(
|
39474
|
-
|
39368
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39475
39369
|
);
|
39476
39370
|
}
|
39477
|
-
|
39478
|
-
|
39371
|
+
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
39372
|
+
witnessCache.push(input.witnessIndex);
|
39373
|
+
return total.add(gasCosts.ecr1);
|
39374
|
+
}
|
39375
|
+
return total;
|
39376
|
+
}, bn());
|
39479
39377
|
return totalGas;
|
39480
39378
|
}
|
39481
39379
|
function getMinGas(params) {
|
@@ -39487,20 +39385,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39487
39385
|
return minGas;
|
39488
39386
|
}
|
39489
39387
|
function getMaxGas(params) {
|
39490
|
-
const {
|
39491
|
-
gasPerByte,
|
39492
|
-
witnessesLength,
|
39493
|
-
witnessLimit,
|
39494
|
-
minGas,
|
39495
|
-
gasLimit = bn(0),
|
39496
|
-
maxGasPerTx
|
39497
|
-
} = params;
|
39388
|
+
const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
|
39498
39389
|
let remainingAllowedWitnessGas = bn(0);
|
39499
39390
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39500
39391
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39501
39392
|
}
|
39502
|
-
|
39503
|
-
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39393
|
+
return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39504
39394
|
}
|
39505
39395
|
function calculateMetadataGasForTxCreate({
|
39506
39396
|
gasCosts,
|
@@ -39522,10 +39412,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39522
39412
|
}) {
|
39523
39413
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39524
39414
|
}
|
39525
|
-
var calculateGasFee = (params) => {
|
39526
|
-
const { gas, gasPrice, priceFactor, tip } = params;
|
39527
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39528
|
-
};
|
39529
39415
|
|
39530
39416
|
// src/providers/utils/json.ts
|
39531
39417
|
function normalize2(object) {
|
@@ -39667,7 +39553,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39667
39553
|
// src/providers/transaction-request/transaction-request.ts
|
39668
39554
|
var BaseTransactionRequest = class {
|
39669
39555
|
/** Gas price for transaction */
|
39670
|
-
|
39556
|
+
gasPrice;
|
39671
39557
|
/** Block until which tx cannot be included */
|
39672
39558
|
maturity;
|
39673
39559
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39686,7 +39572,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39686
39572
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39687
39573
|
*/
|
39688
39574
|
constructor({
|
39689
|
-
|
39575
|
+
gasPrice,
|
39690
39576
|
maturity,
|
39691
39577
|
maxFee,
|
39692
39578
|
witnessLimit,
|
@@ -39694,7 +39580,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39694
39580
|
outputs,
|
39695
39581
|
witnesses
|
39696
39582
|
} = {}) {
|
39697
|
-
this.
|
39583
|
+
this.gasPrice = bn(gasPrice);
|
39698
39584
|
this.maturity = maturity ?? 0;
|
39699
39585
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39700
39586
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39705,9 +39591,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39705
39591
|
static getPolicyMeta(req) {
|
39706
39592
|
let policyTypes = 0;
|
39707
39593
|
const policies = [];
|
39708
|
-
if (req.
|
39709
|
-
policyTypes += PolicyType.
|
39710
|
-
policies.push({ data: req.
|
39594
|
+
if (req.gasPrice) {
|
39595
|
+
policyTypes += PolicyType.GasPrice;
|
39596
|
+
policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
|
39711
39597
|
}
|
39712
39598
|
if (req.witnessLimit) {
|
39713
39599
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39891,11 +39777,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39891
39777
|
* assetId, if one it was not added yet.
|
39892
39778
|
*
|
39893
39779
|
* @param coin - Coin resource.
|
39780
|
+
* @param predicate - Predicate bytes.
|
39781
|
+
* @param predicateData - Predicate data bytes.
|
39894
39782
|
*/
|
39895
|
-
addCoinInput(coin) {
|
39783
|
+
addCoinInput(coin, predicate) {
|
39896
39784
|
const { assetId, owner, amount } = coin;
|
39897
39785
|
let witnessIndex;
|
39898
|
-
if (
|
39786
|
+
if (predicate) {
|
39899
39787
|
witnessIndex = 0;
|
39900
39788
|
} else {
|
39901
39789
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39910,7 +39798,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39910
39798
|
amount,
|
39911
39799
|
assetId,
|
39912
39800
|
txPointer: "0x00000000000000000000000000000000",
|
39913
|
-
witnessIndex
|
39801
|
+
witnessIndex,
|
39802
|
+
predicate: predicate?.bytes
|
39914
39803
|
};
|
39915
39804
|
this.pushInput(input);
|
39916
39805
|
this.addChangeOutput(owner, assetId);
|
@@ -39920,12 +39809,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39920
39809
|
* baseAssetId, if one it was not added yet.
|
39921
39810
|
*
|
39922
39811
|
* @param message - Message resource.
|
39812
|
+
* @param predicate - Predicate bytes.
|
39813
|
+
* @param predicateData - Predicate data bytes.
|
39923
39814
|
*/
|
39924
|
-
addMessageInput(message) {
|
39815
|
+
addMessageInput(message, predicate) {
|
39925
39816
|
const { recipient, sender, amount } = message;
|
39926
39817
|
const assetId = BaseAssetId;
|
39927
39818
|
let witnessIndex;
|
39928
|
-
if (
|
39819
|
+
if (predicate) {
|
39929
39820
|
witnessIndex = 0;
|
39930
39821
|
} else {
|
39931
39822
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39939,7 +39830,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39939
39830
|
sender: sender.toB256(),
|
39940
39831
|
recipient: recipient.toB256(),
|
39941
39832
|
amount,
|
39942
|
-
witnessIndex
|
39833
|
+
witnessIndex,
|
39834
|
+
predicate: predicate?.bytes
|
39943
39835
|
};
|
39944
39836
|
this.pushInput(input);
|
39945
39837
|
this.addChangeOutput(recipient, assetId);
|
@@ -39970,6 +39862,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39970
39862
|
resources.forEach((resource) => this.addResource(resource));
|
39971
39863
|
return this;
|
39972
39864
|
}
|
39865
|
+
/**
|
39866
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
39867
|
+
* outputs from the related assetIds.
|
39868
|
+
*
|
39869
|
+
* @param resources - The resources to add.
|
39870
|
+
* @returns This transaction.
|
39871
|
+
*/
|
39872
|
+
addPredicateResource(resource, predicate) {
|
39873
|
+
if (isCoin(resource)) {
|
39874
|
+
this.addCoinInput(resource, predicate);
|
39875
|
+
} else {
|
39876
|
+
this.addMessageInput(resource, predicate);
|
39877
|
+
}
|
39878
|
+
return this;
|
39879
|
+
}
|
39880
|
+
/**
|
39881
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
39882
|
+
* from the related assetIds.
|
39883
|
+
*
|
39884
|
+
* @param resources - The resources to add.
|
39885
|
+
* @returns This transaction.
|
39886
|
+
*/
|
39887
|
+
addPredicateResources(resources, predicate) {
|
39888
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
39889
|
+
return this;
|
39890
|
+
}
|
39973
39891
|
/**
|
39974
39892
|
* Adds a coin output to the transaction.
|
39975
39893
|
*
|
@@ -40049,7 +39967,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40049
39967
|
}
|
40050
39968
|
calculateMaxGas(chainInfo, minGas) {
|
40051
39969
|
const { consensusParameters } = chainInfo;
|
40052
|
-
const { gasPerByte
|
39970
|
+
const { gasPerByte } = consensusParameters;
|
40053
39971
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40054
39972
|
(acc, wit) => acc + wit.dataLength,
|
40055
39973
|
0
|
@@ -40058,8 +39976,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40058
39976
|
gasPerByte,
|
40059
39977
|
minGas,
|
40060
39978
|
witnessesLength,
|
40061
|
-
witnessLimit: this.witnessLimit
|
40062
|
-
maxGasPerTx
|
39979
|
+
witnessLimit: this.witnessLimit
|
40063
39980
|
});
|
40064
39981
|
}
|
40065
39982
|
/**
|
@@ -40077,20 +39994,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40077
39994
|
});
|
40078
39995
|
const updateAssetInput = (assetId, quantity) => {
|
40079
39996
|
const assetInput = findAssetInput(assetId);
|
40080
|
-
let usedQuantity = quantity;
|
40081
|
-
if (assetId === BaseAssetId) {
|
40082
|
-
usedQuantity = bn("1000000000000000000");
|
40083
|
-
}
|
40084
39997
|
if (assetInput && "assetId" in assetInput) {
|
40085
39998
|
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
40086
|
-
assetInput.amount =
|
39999
|
+
assetInput.amount = quantity;
|
40087
40000
|
} else {
|
40088
40001
|
this.addResources([
|
40089
40002
|
{
|
40090
40003
|
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
40091
|
-
amount:
|
40004
|
+
amount: quantity,
|
40092
40005
|
assetId,
|
40093
40006
|
owner: resourcesOwner || Address.fromRandom(),
|
40007
|
+
maturity: 0,
|
40094
40008
|
blockCreated: bn(1),
|
40095
40009
|
txCreatedIdx: bn(1)
|
40096
40010
|
}
|
@@ -40122,7 +40036,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40122
40036
|
toJSON() {
|
40123
40037
|
return normalizeJSON(this);
|
40124
40038
|
}
|
40125
|
-
|
40039
|
+
updatePredicateInputs(inputs) {
|
40126
40040
|
this.inputs.forEach((i) => {
|
40127
40041
|
let correspondingInput;
|
40128
40042
|
switch (i.type) {
|
@@ -40144,15 +40058,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40144
40058
|
}
|
40145
40059
|
});
|
40146
40060
|
}
|
40147
|
-
shiftPredicateData() {
|
40148
|
-
this.inputs.forEach((input) => {
|
40149
|
-
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
40150
|
-
input.predicateData = input.padPredicateData(
|
40151
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40152
|
-
);
|
40153
|
-
}
|
40154
|
-
});
|
40155
|
-
}
|
40156
40061
|
};
|
40157
40062
|
|
40158
40063
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40286,8 +40191,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40286
40191
|
return {
|
40287
40192
|
type: TransactionType.Create,
|
40288
40193
|
...baseTransaction,
|
40194
|
+
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40289
40195
|
bytecodeWitnessIndex,
|
40290
|
-
storageSlotsCount:
|
40196
|
+
storageSlotsCount: storageSlots.length,
|
40291
40197
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40292
40198
|
storageSlots
|
40293
40199
|
};
|
@@ -40401,8 +40307,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40401
40307
|
type: TransactionType.Script,
|
40402
40308
|
scriptGasLimit: this.gasLimit,
|
40403
40309
|
...super.getBaseTransaction(),
|
40404
|
-
scriptLength:
|
40405
|
-
scriptDataLength:
|
40310
|
+
scriptLength: script.length,
|
40311
|
+
scriptDataLength: scriptData.length,
|
40406
40312
|
receiptsRoot: ZeroBytes32,
|
40407
40313
|
script: hexlify(script),
|
40408
40314
|
scriptData: hexlify(scriptData)
|
@@ -40466,7 +40372,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40466
40372
|
}
|
40467
40373
|
calculateMaxGas(chainInfo, minGas) {
|
40468
40374
|
const { consensusParameters } = chainInfo;
|
40469
|
-
const { gasPerByte
|
40375
|
+
const { gasPerByte } = consensusParameters;
|
40470
40376
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40471
40377
|
(acc, wit) => acc + wit.dataLength,
|
40472
40378
|
0
|
@@ -40476,8 +40382,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40476
40382
|
minGas,
|
40477
40383
|
witnessesLength,
|
40478
40384
|
witnessLimit: this.witnessLimit,
|
40479
|
-
gasLimit: this.gasLimit
|
40480
|
-
maxGasPerTx
|
40385
|
+
gasLimit: this.gasLimit
|
40481
40386
|
});
|
40482
40387
|
}
|
40483
40388
|
/**
|
@@ -40550,29 +40455,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40550
40455
|
}
|
40551
40456
|
}
|
40552
40457
|
};
|
40553
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40554
|
-
(acc, input) => {
|
40555
|
-
if (input.type === InputType.Coin && input.owner === owner) {
|
40556
|
-
acc.utxos.push(input.id);
|
40557
|
-
}
|
40558
|
-
if (input.type === InputType.Message && input.recipient === owner) {
|
40559
|
-
acc.messages.push(input.nonce);
|
40560
|
-
}
|
40561
|
-
return acc;
|
40562
|
-
},
|
40563
|
-
{
|
40564
|
-
utxos: [],
|
40565
|
-
messages: []
|
40566
|
-
}
|
40567
|
-
);
|
40568
40458
|
|
40569
40459
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40570
40460
|
var calculateTransactionFee = (params) => {
|
40571
40461
|
const {
|
40572
|
-
|
40462
|
+
gasUsed,
|
40573
40463
|
rawPayload,
|
40574
|
-
|
40575
|
-
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40464
|
+
consensusParameters: { gasCosts, feeParams }
|
40576
40465
|
} = params;
|
40577
40466
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40578
40467
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40582,7 +40471,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40582
40471
|
return {
|
40583
40472
|
fee: bn(0),
|
40584
40473
|
minFee: bn(0),
|
40585
|
-
maxFee: bn(0)
|
40474
|
+
maxFee: bn(0),
|
40475
|
+
feeFromGasUsed: bn(0)
|
40586
40476
|
};
|
40587
40477
|
}
|
40588
40478
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40614,6 +40504,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40614
40504
|
metadataGas,
|
40615
40505
|
txBytesSize: transactionBytes.length
|
40616
40506
|
});
|
40507
|
+
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40617
40508
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40618
40509
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40619
40510
|
const maxGas = getMaxGas({
|
@@ -40621,25 +40512,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40621
40512
|
minGas,
|
40622
40513
|
witnessesLength,
|
40623
40514
|
gasLimit,
|
40624
|
-
witnessLimit
|
40625
|
-
maxGasPerTx
|
40626
|
-
});
|
40627
|
-
const minFee = calculateGasFee({
|
40628
|
-
gasPrice,
|
40629
|
-
gas: minGas,
|
40630
|
-
priceFactor: gasPriceFactor,
|
40631
|
-
tip
|
40632
|
-
});
|
40633
|
-
const maxFee = calculateGasFee({
|
40634
|
-
gasPrice,
|
40635
|
-
gas: maxGas,
|
40636
|
-
priceFactor: gasPriceFactor,
|
40637
|
-
tip
|
40515
|
+
witnessLimit
|
40638
40516
|
});
|
40517
|
+
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40518
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40519
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40520
|
+
const fee = minFee.add(feeFromGasUsed);
|
40639
40521
|
return {
|
40522
|
+
fee,
|
40640
40523
|
minFee,
|
40641
40524
|
maxFee,
|
40642
|
-
|
40525
|
+
feeFromGasUsed
|
40643
40526
|
};
|
40644
40527
|
};
|
40645
40528
|
|
@@ -41240,9 +41123,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41240
41123
|
gqlTransactionStatus,
|
41241
41124
|
abiMap = {},
|
41242
41125
|
maxInputs,
|
41243
|
-
gasCosts
|
41244
|
-
maxGasPerTx,
|
41245
|
-
gasPrice
|
41126
|
+
gasCosts
|
41246
41127
|
} = params;
|
41247
41128
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41248
41129
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41256,14 +41137,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41256
41137
|
maxInputs
|
41257
41138
|
});
|
41258
41139
|
const typeName = getTransactionTypeName(transaction.type);
|
41259
|
-
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41260
41140
|
const { fee } = calculateTransactionFee({
|
41261
|
-
|
41141
|
+
gasUsed,
|
41262
41142
|
rawPayload,
|
41263
|
-
tip,
|
41264
41143
|
consensusParameters: {
|
41265
41144
|
gasCosts,
|
41266
|
-
maxGasPerTx,
|
41267
41145
|
feeParams: {
|
41268
41146
|
gasPerByte,
|
41269
41147
|
gasPriceFactor
|
@@ -41399,13 +41277,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41399
41277
|
const decodedTransaction = this.decodeTransaction(
|
41400
41278
|
transaction
|
41401
41279
|
);
|
41402
|
-
|
41403
|
-
|
41404
|
-
txReceipts = transaction.status.receipts;
|
41405
|
-
}
|
41406
|
-
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41407
|
-
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41408
|
-
const gasPrice = await this.provider.getLatestGasPrice();
|
41280
|
+
const receipts = transaction.receipts?.map(processGqlReceipt) || [];
|
41281
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
|
41409
41282
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41410
41283
|
const transactionSummary = assembleTransactionSummary({
|
41411
41284
|
id: this.id,
|
@@ -41417,9 +41290,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41417
41290
|
gasPriceFactor,
|
41418
41291
|
abiMap: contractsAbiMap,
|
41419
41292
|
maxInputs,
|
41420
|
-
gasCosts
|
41421
|
-
maxGasPerTx,
|
41422
|
-
gasPrice
|
41293
|
+
gasCosts
|
41423
41294
|
});
|
41424
41295
|
return transactionSummary;
|
41425
41296
|
}
|
@@ -41568,7 +41439,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41568
41439
|
gasCosts,
|
41569
41440
|
latestBlock: {
|
41570
41441
|
id: latestBlock.id,
|
41571
|
-
height: bn(latestBlock.height),
|
41442
|
+
height: bn(latestBlock.header.height),
|
41572
41443
|
time: latestBlock.header.time,
|
41573
41444
|
transactions: latestBlock.transactions.map((i) => ({
|
41574
41445
|
id: i.id
|
@@ -41662,8 +41533,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41662
41533
|
* Returns some helpful parameters related to gas fees.
|
41663
41534
|
*/
|
41664
41535
|
getGasConfig() {
|
41536
|
+
const { minGasPrice } = this.getNode();
|
41665
41537
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41666
41538
|
return {
|
41539
|
+
minGasPrice,
|
41667
41540
|
maxGasPerTx,
|
41668
41541
|
maxGasPerPredicate,
|
41669
41542
|
gasPriceFactor,
|
@@ -41761,7 +41634,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41761
41634
|
*/
|
41762
41635
|
async getBlockNumber() {
|
41763
41636
|
const { chain } = await this.operations.getChain();
|
41764
|
-
return bn(chain.latestBlock.height, 10);
|
41637
|
+
return bn(chain.latestBlock.header.height, 10);
|
41765
41638
|
}
|
41766
41639
|
/**
|
41767
41640
|
* Returns the chain information.
|
@@ -41773,9 +41646,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41773
41646
|
const processedNodeInfo = {
|
41774
41647
|
maxDepth: bn(nodeInfo.maxDepth),
|
41775
41648
|
maxTx: bn(nodeInfo.maxTx),
|
41649
|
+
minGasPrice: bn(nodeInfo.minGasPrice),
|
41776
41650
|
nodeVersion: nodeInfo.nodeVersion,
|
41777
41651
|
utxoValidation: nodeInfo.utxoValidation,
|
41778
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41652
|
+
vmBacktrace: nodeInfo.vmBacktrace,
|
41653
|
+
peers: nodeInfo.peers
|
41779
41654
|
};
|
41780
41655
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41781
41656
|
return processedNodeInfo;
|
@@ -41861,13 +41736,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41861
41736
|
return this.estimateTxDependencies(transactionRequest);
|
41862
41737
|
}
|
41863
41738
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41864
|
-
const { dryRun:
|
41865
|
-
|
41739
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41740
|
+
encodedTransaction,
|
41866
41741
|
utxoValidation: utxoValidation || false
|
41867
41742
|
});
|
41868
|
-
const
|
41869
|
-
|
41870
|
-
|
41743
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41744
|
+
return {
|
41745
|
+
receipts
|
41746
|
+
};
|
41871
41747
|
}
|
41872
41748
|
/**
|
41873
41749
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41906,6 +41782,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41906
41782
|
* If there are missing variable outputs,
|
41907
41783
|
* `addVariableOutputs` is called on the transaction.
|
41908
41784
|
*
|
41785
|
+
* @privateRemarks
|
41786
|
+
* TODO: Investigate support for missing contract IDs
|
41787
|
+
* TODO: Add support for missing output messages
|
41909
41788
|
*
|
41910
41789
|
* @param transactionRequest - The transaction request object.
|
41911
41790
|
* @returns A promise.
|
@@ -41918,19 +41797,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41918
41797
|
missingContractIds: []
|
41919
41798
|
};
|
41920
41799
|
}
|
41800
|
+
await this.estimatePredicates(transactionRequest);
|
41921
41801
|
let receipts = [];
|
41922
41802
|
const missingContractIds = [];
|
41923
41803
|
let outputVariables = 0;
|
41924
|
-
let dryrunStatus;
|
41925
41804
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41926
|
-
const {
|
41927
|
-
|
41928
|
-
} = await this.operations.dryRun({
|
41929
|
-
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41805
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41806
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
41930
41807
|
utxoValidation: false
|
41931
41808
|
});
|
41932
|
-
receipts =
|
41933
|
-
dryrunStatus = status;
|
41809
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
41934
41810
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41935
41811
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41936
41812
|
if (hasMissingOutputs) {
|
@@ -41940,10 +41816,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41940
41816
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41941
41817
|
missingContractIds.push(contractId);
|
41942
41818
|
});
|
41943
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41944
|
-
transactionRequest
|
41945
|
-
});
|
41946
|
-
transactionRequest.maxFee = maxFee;
|
41947
41819
|
} else {
|
41948
41820
|
break;
|
41949
41821
|
}
|
@@ -41951,139 +41823,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41951
41823
|
return {
|
41952
41824
|
receipts,
|
41953
41825
|
outputVariables,
|
41954
|
-
missingContractIds
|
41955
|
-
dryrunStatus
|
41826
|
+
missingContractIds
|
41956
41827
|
};
|
41957
41828
|
}
|
41958
|
-
/**
|
41959
|
-
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41960
|
-
*
|
41961
|
-
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41962
|
-
* further modifications are identified. The method iteratively updates these transactions
|
41963
|
-
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41964
|
-
*
|
41965
|
-
* @param transactionRequests - Array of transaction request objects.
|
41966
|
-
* @returns A promise that resolves to an array of results for each transaction.
|
41967
|
-
*/
|
41968
|
-
async estimateMultipleTxDependencies(transactionRequests) {
|
41969
|
-
const results = transactionRequests.map(() => ({
|
41970
|
-
receipts: [],
|
41971
|
-
outputVariables: 0,
|
41972
|
-
missingContractIds: [],
|
41973
|
-
dryrunStatus: void 0
|
41974
|
-
}));
|
41975
|
-
const allRequests = clone_default(transactionRequests);
|
41976
|
-
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41977
|
-
allRequests.forEach((req, index) => {
|
41978
|
-
if (req.type === TransactionType.Script) {
|
41979
|
-
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41980
|
-
}
|
41981
|
-
});
|
41982
|
-
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41983
|
-
let attempt = 0;
|
41984
|
-
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41985
|
-
const encodedTransactions = transactionsToProcess.map(
|
41986
|
-
(index) => serializedTransactionsMap.get(index)
|
41987
|
-
);
|
41988
|
-
const dryRunResults = await this.operations.dryRun({
|
41989
|
-
encodedTransactions,
|
41990
|
-
utxoValidation: false
|
41991
|
-
});
|
41992
|
-
const nextRoundTransactions = [];
|
41993
|
-
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41994
|
-
const currentResultIndex = transactionsToProcess[i];
|
41995
|
-
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41996
|
-
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41997
|
-
results[currentResultIndex].dryrunStatus = status;
|
41998
|
-
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41999
|
-
results[currentResultIndex].receipts
|
42000
|
-
);
|
42001
|
-
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
42002
|
-
const requestToProcess = allRequests[currentResultIndex];
|
42003
|
-
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
42004
|
-
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
42005
|
-
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
42006
|
-
missingOutputContractIds.forEach(({ contractId }) => {
|
42007
|
-
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
42008
|
-
results[currentResultIndex].missingContractIds.push(contractId);
|
42009
|
-
});
|
42010
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
42011
|
-
transactionRequest: requestToProcess
|
42012
|
-
});
|
42013
|
-
requestToProcess.maxFee = maxFee;
|
42014
|
-
serializedTransactionsMap.set(
|
42015
|
-
currentResultIndex,
|
42016
|
-
hexlify(requestToProcess.toTransactionBytes())
|
42017
|
-
);
|
42018
|
-
nextRoundTransactions.push(currentResultIndex);
|
42019
|
-
allRequests[currentResultIndex] = requestToProcess;
|
42020
|
-
}
|
42021
|
-
}
|
42022
|
-
transactionsToProcess = nextRoundTransactions;
|
42023
|
-
attempt += 1;
|
42024
|
-
}
|
42025
|
-
return results;
|
42026
|
-
}
|
42027
|
-
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
42028
|
-
if (estimateTxDependencies) {
|
42029
|
-
return this.estimateMultipleTxDependencies(transactionRequests);
|
42030
|
-
}
|
42031
|
-
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
42032
|
-
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42033
|
-
encodedTransactions,
|
42034
|
-
utxoValidation: utxoValidation || false
|
42035
|
-
});
|
42036
|
-
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
42037
|
-
const receipts = rawReceipts.map(processGqlReceipt);
|
42038
|
-
return { receipts, dryrunStatus: status };
|
42039
|
-
});
|
42040
|
-
return results;
|
42041
|
-
}
|
42042
41829
|
/**
|
42043
41830
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
42044
41831
|
* @param transactionRequest - The transaction request object.
|
42045
41832
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
42046
41833
|
*/
|
42047
|
-
|
41834
|
+
estimateTxGasAndFee(params) {
|
42048
41835
|
const { transactionRequest } = params;
|
42049
|
-
|
41836
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
42050
41837
|
const chainInfo = this.getChain();
|
42051
|
-
const
|
41838
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
41839
|
+
transactionRequest.gasPrice = gasPrice;
|
42052
41840
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
42053
|
-
|
42054
|
-
gasPrice = await this.estimateGasPrice(10);
|
42055
|
-
}
|
42056
|
-
const minFee = calculateGasFee({
|
42057
|
-
gasPrice: bn(gasPrice),
|
42058
|
-
gas: minGas,
|
42059
|
-
priceFactor: gasPriceFactor,
|
42060
|
-
tip: transactionRequest.tip
|
42061
|
-
}).add(1);
|
42062
|
-
let gasLimit = bn(0);
|
41841
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42063
41842
|
if (transactionRequest.type === TransactionType.Script) {
|
42064
|
-
gasLimit = transactionRequest.gasLimit;
|
42065
41843
|
if (transactionRequest.gasLimit.eq(0)) {
|
42066
41844
|
transactionRequest.gasLimit = minGas;
|
42067
41845
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
42068
41846
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
42069
41847
|
);
|
42070
|
-
gasLimit = transactionRequest.gasLimit;
|
42071
41848
|
}
|
42072
41849
|
}
|
42073
41850
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42074
|
-
const maxFee =
|
42075
|
-
gasPrice: bn(gasPrice),
|
42076
|
-
gas: maxGas,
|
42077
|
-
priceFactor: gasPriceFactor,
|
42078
|
-
tip: transactionRequest.tip
|
42079
|
-
}).add(1);
|
41851
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42080
41852
|
return {
|
42081
41853
|
minGas,
|
42082
41854
|
minFee,
|
42083
41855
|
maxGas,
|
42084
|
-
maxFee
|
42085
|
-
gasPrice,
|
42086
|
-
gasLimit
|
41856
|
+
maxFee
|
42087
41857
|
};
|
42088
41858
|
}
|
42089
41859
|
/**
|
@@ -42101,17 +41871,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42101
41871
|
if (estimateTxDependencies) {
|
42102
41872
|
return this.estimateTxDependencies(transactionRequest);
|
42103
41873
|
}
|
42104
|
-
const
|
42105
|
-
const { dryRun:
|
42106
|
-
|
41874
|
+
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41875
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41876
|
+
encodedTransaction,
|
42107
41877
|
utxoValidation: true
|
42108
41878
|
});
|
42109
|
-
const
|
42110
|
-
|
42111
|
-
|
42112
|
-
|
42113
|
-
});
|
42114
|
-
return { receipts: callResult[0].receipts };
|
41879
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41880
|
+
return {
|
41881
|
+
receipts
|
41882
|
+
};
|
42115
41883
|
}
|
42116
41884
|
/**
|
42117
41885
|
* Returns a transaction cost to enable user
|
@@ -42128,79 +41896,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42128
41896
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
42129
41897
|
* @returns A promise that resolves to the transaction cost object.
|
42130
41898
|
*/
|
42131
|
-
async getTransactionCost(transactionRequestLike,
|
41899
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
41900
|
+
estimateTxDependencies = true,
|
41901
|
+
estimatePredicates = true,
|
41902
|
+
resourcesOwner,
|
41903
|
+
signatureCallback
|
41904
|
+
} = {}) {
|
42132
41905
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41906
|
+
const { minGasPrice } = this.getGasConfig();
|
41907
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
42133
41908
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
42134
41909
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
42135
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
41910
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42136
41911
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42137
|
-
txRequestClone.maxFee = bn(0);
|
42138
41912
|
if (isScriptTransaction) {
|
42139
41913
|
txRequestClone.gasLimit = bn(0);
|
42140
41914
|
}
|
42141
|
-
if (
|
42142
|
-
resourcesOwner
|
41915
|
+
if (estimatePredicates) {
|
41916
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41917
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41918
|
+
}
|
41919
|
+
await this.estimatePredicates(txRequestClone);
|
42143
41920
|
}
|
42144
|
-
const signedRequest = clone_default(txRequestClone);
|
42145
|
-
let addedSignatures = 0;
|
42146
41921
|
if (signatureCallback && isScriptTransaction) {
|
42147
|
-
|
42148
|
-
await signatureCallback(signedRequest);
|
42149
|
-
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41922
|
+
await signatureCallback(txRequestClone);
|
42150
41923
|
}
|
42151
|
-
|
42152
|
-
|
42153
|
-
transactionRequest: signedRequest
|
41924
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41925
|
+
transactionRequest: txRequestClone
|
42154
41926
|
});
|
42155
41927
|
let receipts = [];
|
42156
41928
|
let missingContractIds = [];
|
42157
41929
|
let outputVariables = 0;
|
42158
41930
|
let gasUsed = bn(0);
|
42159
|
-
|
42160
|
-
|
42161
|
-
if (isScriptTransaction) {
|
42162
|
-
txRequestClone.gasLimit = gasLimit;
|
42163
|
-
if (signatureCallback) {
|
42164
|
-
await signatureCallback(txRequestClone);
|
42165
|
-
}
|
41931
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
41932
|
+
txRequestClone.gasPrice = bn(0);
|
42166
41933
|
const result = await this.estimateTxDependencies(txRequestClone);
|
42167
41934
|
receipts = result.receipts;
|
42168
41935
|
outputVariables = result.outputVariables;
|
42169
41936
|
missingContractIds = result.missingContractIds;
|
42170
41937
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
42171
41938
|
txRequestClone.gasLimit = gasUsed;
|
42172
|
-
|
42173
|
-
|
42174
|
-
|
41939
|
+
txRequestClone.gasPrice = setGasPrice;
|
41940
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41941
|
+
transactionRequest: txRequestClone
|
42175
41942
|
}));
|
42176
41943
|
}
|
42177
41944
|
return {
|
42178
41945
|
requiredQuantities: allQuantities,
|
42179
41946
|
receipts,
|
42180
41947
|
gasUsed,
|
42181
|
-
|
41948
|
+
minGasPrice,
|
41949
|
+
gasPrice: setGasPrice,
|
42182
41950
|
minGas,
|
42183
41951
|
maxGas,
|
42184
41952
|
minFee,
|
42185
41953
|
maxFee,
|
41954
|
+
estimatedInputs: txRequestClone.inputs,
|
42186
41955
|
outputVariables,
|
42187
|
-
missingContractIds
|
42188
|
-
addedSignatures,
|
42189
|
-
estimatedPredicates: txRequestClone.inputs
|
41956
|
+
missingContractIds
|
42190
41957
|
};
|
42191
41958
|
}
|
42192
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
41959
|
+
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
42193
41960
|
const ownerAddress = Address.fromAddressOrString(owner);
|
42194
41961
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
42195
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42196
|
-
quantitiesToContract
|
42197
|
-
});
|
41962
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
|
42198
41963
|
transactionRequest.addResources(
|
42199
41964
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
42200
41965
|
);
|
42201
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
42202
|
-
|
42203
|
-
|
41966
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41967
|
+
transactionRequest,
|
41968
|
+
forwardingQuantities
|
41969
|
+
);
|
42204
41970
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
42205
41971
|
return {
|
42206
41972
|
resources,
|
@@ -42224,6 +41990,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42224
41990
|
assetId: coin.assetId,
|
42225
41991
|
amount: bn(coin.amount),
|
42226
41992
|
owner: Address.fromAddressOrString(coin.owner),
|
41993
|
+
maturity: bn(coin.maturity).toNumber(),
|
42227
41994
|
blockCreated: bn(coin.blockCreated),
|
42228
41995
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42229
41996
|
}));
|
@@ -42275,6 +42042,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42275
42042
|
amount: bn(coin.amount),
|
42276
42043
|
assetId: coin.assetId,
|
42277
42044
|
owner: Address.fromAddressOrString(coin.owner),
|
42045
|
+
maturity: bn(coin.maturity).toNumber(),
|
42278
42046
|
blockCreated: bn(coin.blockCreated),
|
42279
42047
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42280
42048
|
};
|
@@ -42307,7 +42075,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42307
42075
|
}
|
42308
42076
|
return {
|
42309
42077
|
id: block2.id,
|
42310
|
-
height: bn(block2.height),
|
42078
|
+
height: bn(block2.header.height),
|
42311
42079
|
time: block2.header.time,
|
42312
42080
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42313
42081
|
};
|
@@ -42322,7 +42090,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42322
42090
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42323
42091
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42324
42092
|
id: block2.id,
|
42325
|
-
height: bn(block2.height),
|
42093
|
+
height: bn(block2.header.height),
|
42326
42094
|
time: block2.header.time,
|
42327
42095
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42328
42096
|
}));
|
@@ -42349,7 +42117,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42349
42117
|
}
|
42350
42118
|
return {
|
42351
42119
|
id: block2.id,
|
42352
|
-
height: bn(block2.height, 10),
|
42120
|
+
height: bn(block2.header.height, 10),
|
42353
42121
|
time: block2.header.time,
|
42354
42122
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42355
42123
|
transactions: block2.transactions.map(
|
@@ -42529,11 +42297,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42529
42297
|
prevRoot: messageBlockHeader.prevRoot,
|
42530
42298
|
time: messageBlockHeader.time,
|
42531
42299
|
applicationHash: messageBlockHeader.applicationHash,
|
42532
|
-
|
42533
|
-
|
42534
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42535
|
-
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42536
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
42300
|
+
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
42301
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
|
42537
42302
|
},
|
42538
42303
|
commitBlockHeader: {
|
42539
42304
|
id: commitBlockHeader.id,
|
@@ -42544,11 +42309,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42544
42309
|
prevRoot: commitBlockHeader.prevRoot,
|
42545
42310
|
time: commitBlockHeader.time,
|
42546
42311
|
applicationHash: commitBlockHeader.applicationHash,
|
42547
|
-
|
42548
|
-
|
42549
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42550
|
-
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42551
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
42312
|
+
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
42313
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
|
42552
42314
|
},
|
42553
42315
|
sender: Address.fromAddressOrString(sender),
|
42554
42316
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -42557,16 +42319,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42557
42319
|
data
|
42558
42320
|
};
|
42559
42321
|
}
|
42560
|
-
async getLatestGasPrice() {
|
42561
|
-
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42562
|
-
return bn(latestGasPrice.gasPrice);
|
42563
|
-
}
|
42564
|
-
async estimateGasPrice(blockHorizon) {
|
42565
|
-
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42566
|
-
blockHorizon: String(blockHorizon)
|
42567
|
-
});
|
42568
|
-
return bn(estimateGasPrice.gasPrice);
|
42569
|
-
}
|
42570
42322
|
/**
|
42571
42323
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42572
42324
|
*
|
@@ -42627,15 +42379,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42627
42379
|
arrayify(gqlTransaction.rawPayload),
|
42628
42380
|
0
|
42629
42381
|
);
|
42630
|
-
|
42631
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42632
|
-
txReceipts = gqlTransaction.status.receipts;
|
42633
|
-
}
|
42634
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42382
|
+
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
42635
42383
|
const {
|
42636
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42384
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42637
42385
|
} = provider.getChain();
|
42638
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42639
42386
|
const transactionInfo = assembleTransactionSummary({
|
42640
42387
|
id: gqlTransaction.id,
|
42641
42388
|
receipts,
|
@@ -42646,9 +42393,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42646
42393
|
gasPriceFactor: bn(gasPriceFactor),
|
42647
42394
|
abiMap,
|
42648
42395
|
maxInputs,
|
42649
|
-
gasCosts
|
42650
|
-
maxGasPerTx,
|
42651
|
-
gasPrice
|
42396
|
+
gasCosts
|
42652
42397
|
});
|
42653
42398
|
return {
|
42654
42399
|
gqlTransaction,
|
@@ -42658,11 +42403,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42658
42403
|
async function getTransactionSummaryFromRequest(params) {
|
42659
42404
|
const { provider, transactionRequest, abiMap } = params;
|
42660
42405
|
const { receipts } = await provider.call(transactionRequest);
|
42661
|
-
const { gasPerByte, gasPriceFactor, gasCosts
|
42406
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42662
42407
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42663
42408
|
const transaction = transactionRequest.toTransaction();
|
42664
42409
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42665
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42666
42410
|
const transactionSummary = assembleTransactionSummary({
|
42667
42411
|
receipts,
|
42668
42412
|
transaction,
|
@@ -42671,9 +42415,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42671
42415
|
gasPerByte,
|
42672
42416
|
gasPriceFactor,
|
42673
42417
|
maxInputs,
|
42674
|
-
gasCosts
|
42675
|
-
maxGasPerTx,
|
42676
|
-
gasPrice
|
42418
|
+
gasCosts
|
42677
42419
|
});
|
42678
42420
|
return transactionSummary;
|
42679
42421
|
}
|
@@ -42682,18 +42424,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42682
42424
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42683
42425
|
const { edges, pageInfo } = transactionsByOwner;
|
42684
42426
|
const {
|
42685
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42427
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42686
42428
|
} = provider.getChain();
|
42687
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42688
42429
|
const transactions = edges.map((edge) => {
|
42689
42430
|
const { node: gqlTransaction } = edge;
|
42690
|
-
const { id, rawPayload, status } = gqlTransaction;
|
42431
|
+
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
42691
42432
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42692
|
-
|
42693
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42694
|
-
txReceipts = gqlTransaction.status.receipts;
|
42695
|
-
}
|
42696
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42433
|
+
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
42697
42434
|
const transactionSummary = assembleTransactionSummary({
|
42698
42435
|
id,
|
42699
42436
|
receipts,
|
@@ -42704,9 +42441,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42704
42441
|
gasPerByte,
|
42705
42442
|
gasPriceFactor,
|
42706
42443
|
maxInputs,
|
42707
|
-
gasCosts
|
42708
|
-
maxGasPerTx,
|
42709
|
-
gasPrice
|
42444
|
+
gasCosts
|
42710
42445
|
});
|
42711
42446
|
const output3 = {
|
42712
42447
|
gqlTransaction,
|
@@ -43035,33 +42770,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43035
42770
|
* @param fee - The estimated transaction fee.
|
43036
42771
|
* @returns A promise that resolves when the resources are added to the transaction.
|
43037
42772
|
*/
|
43038
|
-
async fund(request,
|
43039
|
-
const
|
43040
|
-
const txRequest = request;
|
43041
|
-
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42773
|
+
async fund(request, coinQuantities, fee) {
|
42774
|
+
const updatedQuantities = addAmountToAsset({
|
43042
42775
|
amount: bn(fee),
|
43043
42776
|
assetId: BaseAssetId,
|
43044
|
-
coinQuantities
|
42777
|
+
coinQuantities
|
43045
42778
|
});
|
43046
42779
|
const quantitiesDict = {};
|
43047
|
-
|
42780
|
+
updatedQuantities.forEach(({ amount, assetId }) => {
|
43048
42781
|
quantitiesDict[assetId] = {
|
43049
42782
|
required: amount,
|
43050
42783
|
owned: bn(0)
|
43051
42784
|
};
|
43052
42785
|
});
|
43053
|
-
|
42786
|
+
const cachedUtxos = [];
|
42787
|
+
const cachedMessages = [];
|
42788
|
+
const owner = this.address.toB256();
|
42789
|
+
request.inputs.forEach((input) => {
|
43054
42790
|
const isResource = "amount" in input;
|
43055
42791
|
if (isResource) {
|
43056
42792
|
const isCoin2 = "owner" in input;
|
43057
42793
|
if (isCoin2) {
|
43058
42794
|
const assetId = String(input.assetId);
|
43059
|
-
if (quantitiesDict[assetId]) {
|
42795
|
+
if (input.owner === owner && quantitiesDict[assetId]) {
|
43060
42796
|
const amount = bn(input.amount);
|
43061
42797
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42798
|
+
cachedUtxos.push(input.id);
|
43062
42799
|
}
|
43063
|
-
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42800
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
43064
42801
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42802
|
+
cachedMessages.push(input.nonce);
|
43065
42803
|
}
|
43066
42804
|
}
|
43067
42805
|
});
|
@@ -43076,23 +42814,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43076
42814
|
});
|
43077
42815
|
const needsToBeFunded = missingQuantities.length;
|
43078
42816
|
if (needsToBeFunded) {
|
43079
|
-
const
|
43080
|
-
|
43081
|
-
|
43082
|
-
|
43083
|
-
|
43084
|
-
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43085
|
-
const requestToBeReEstimate = clone_default(txRequest);
|
43086
|
-
if (addedSignatures) {
|
43087
|
-
Array.from({ length: addedSignatures }).forEach(
|
43088
|
-
() => requestToBeReEstimate.addEmptyWitness()
|
43089
|
-
);
|
42817
|
+
const resources = await this.getResourcesToSpend(missingQuantities, {
|
42818
|
+
messages: cachedMessages,
|
42819
|
+
utxos: cachedUtxos
|
42820
|
+
});
|
42821
|
+
request.addResources(resources);
|
43090
42822
|
}
|
43091
|
-
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43092
|
-
transactionRequest: requestToBeReEstimate
|
43093
|
-
});
|
43094
|
-
txRequest.maxFee = maxFee;
|
43095
|
-
return txRequest;
|
43096
42823
|
}
|
43097
42824
|
/**
|
43098
42825
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -43100,24 +42827,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43100
42827
|
* @param destination - The address of the destination.
|
43101
42828
|
* @param amount - The amount of coins to transfer.
|
43102
42829
|
* @param assetId - The asset ID of the coins to transfer.
|
43103
|
-
* @param txParams - The transaction parameters (gasLimit,
|
42830
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
43104
42831
|
* @returns A promise that resolves to the prepared transaction request.
|
43105
42832
|
*/
|
43106
42833
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
43107
|
-
const
|
42834
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42835
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42836
|
+
const request = new ScriptTransactionRequest(params);
|
43108
42837
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
43109
|
-
const
|
42838
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43110
42839
|
estimateTxDependencies: true,
|
43111
42840
|
resourcesOwner: this
|
43112
42841
|
});
|
43113
|
-
|
43114
|
-
|
43115
|
-
|
43116
|
-
|
42842
|
+
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
42843
|
+
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
42844
|
+
this.validateGas({
|
42845
|
+
gasUsed,
|
42846
|
+
gasPrice: request.gasPrice,
|
42847
|
+
gasLimit: request.gasLimit,
|
42848
|
+
minGasPrice
|
43117
42849
|
});
|
43118
|
-
request
|
43119
|
-
request.
|
43120
|
-
await this.fund(request, txCost);
|
42850
|
+
await this.fund(request, requiredQuantities, maxFee);
|
42851
|
+
request.updatePredicateInputs(estimatedInputs);
|
43121
42852
|
return request;
|
43122
42853
|
}
|
43123
42854
|
/**
|
@@ -43156,29 +42887,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43156
42887
|
);
|
43157
42888
|
}
|
43158
42889
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42890
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42891
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
43159
42892
|
const { script, scriptData } = await assembleTransferToContractScript({
|
43160
42893
|
hexlifiedContractId: contractAddress.toB256(),
|
43161
42894
|
amountToTransfer: bn(amount),
|
43162
42895
|
assetId
|
43163
42896
|
});
|
43164
42897
|
const request = new ScriptTransactionRequest({
|
43165
|
-
...
|
42898
|
+
...params,
|
43166
42899
|
script,
|
43167
42900
|
scriptData
|
43168
42901
|
});
|
43169
42902
|
request.addContractInputAndOutput(contractAddress);
|
43170
|
-
const
|
43171
|
-
|
43172
|
-
|
43173
|
-
|
43174
|
-
|
43175
|
-
|
43176
|
-
|
43177
|
-
|
42903
|
+
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42904
|
+
request,
|
42905
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42906
|
+
);
|
42907
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42908
|
+
this.validateGas({
|
42909
|
+
gasUsed,
|
42910
|
+
gasPrice: request.gasPrice,
|
42911
|
+
gasLimit: request.gasLimit,
|
42912
|
+
minGasPrice
|
43178
42913
|
});
|
43179
|
-
request
|
43180
|
-
request.maxFee = txCost.maxFee;
|
43181
|
-
await this.fund(request, txCost);
|
42914
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43182
42915
|
return this.sendTransaction(request);
|
43183
42916
|
}
|
43184
42917
|
/**
|
@@ -43190,6 +42923,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43190
42923
|
* @returns A promise that resolves to the transaction response.
|
43191
42924
|
*/
|
43192
42925
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42926
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
43193
42927
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
43194
42928
|
const recipientDataArray = arrayify(
|
43195
42929
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -43202,18 +42936,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43202
42936
|
...recipientDataArray,
|
43203
42937
|
...amountDataArray
|
43204
42938
|
]);
|
43205
|
-
const params = { script, ...txParams };
|
42939
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
43206
42940
|
const request = new ScriptTransactionRequest(params);
|
43207
|
-
const
|
43208
|
-
const
|
43209
|
-
|
43210
|
-
|
43211
|
-
|
43212
|
-
|
42941
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42942
|
+
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42943
|
+
request,
|
42944
|
+
forwardingQuantities
|
42945
|
+
);
|
42946
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42947
|
+
this.validateGas({
|
42948
|
+
gasUsed,
|
42949
|
+
gasPrice: request.gasPrice,
|
42950
|
+
gasLimit: request.gasLimit,
|
42951
|
+
minGasPrice
|
43213
42952
|
});
|
43214
|
-
request
|
43215
|
-
request.gasLimit = txCost.gasUsed;
|
43216
|
-
await this.fund(request, txCost);
|
42953
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43217
42954
|
return this.sendTransaction(request);
|
43218
42955
|
}
|
43219
42956
|
async signMessage(message) {
|
@@ -43271,21 +43008,22 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43271
43008
|
}
|
43272
43009
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43273
43010
|
}
|
43274
|
-
|
43275
|
-
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
|
43011
|
+
validateGas({
|
43276
43012
|
gasUsed,
|
43277
|
-
|
43013
|
+
gasPrice,
|
43014
|
+
gasLimit,
|
43015
|
+
minGasPrice
|
43278
43016
|
}) {
|
43279
|
-
if (
|
43017
|
+
if (minGasPrice.gt(gasPrice)) {
|
43280
43018
|
throw new FuelError(
|
43281
|
-
ErrorCode.
|
43282
|
-
`Gas
|
43019
|
+
ErrorCode.GAS_PRICE_TOO_LOW,
|
43020
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
43283
43021
|
);
|
43284
43022
|
}
|
43285
|
-
if (
|
43023
|
+
if (gasUsed.gt(gasLimit)) {
|
43286
43024
|
throw new FuelError(
|
43287
|
-
ErrorCode.
|
43288
|
-
`
|
43025
|
+
ErrorCode.GAS_LIMIT_TOO_LOW,
|
43026
|
+
`Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
|
43289
43027
|
);
|
43290
43028
|
}
|
43291
43029
|
}
|
@@ -44870,7 +44608,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44870
44608
|
* @param transactionRequestLike - The transaction request to send.
|
44871
44609
|
* @returns A promise that resolves to the TransactionResponse object.
|
44872
44610
|
*/
|
44873
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44611
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
44874
44612
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44875
44613
|
if (estimateTxDependencies) {
|
44876
44614
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -48148,8 +47886,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48148
47886
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
48149
47887
|
request.inputs?.forEach((input) => {
|
48150
47888
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
48151
|
-
input.predicate =
|
48152
|
-
input.predicateData =
|
47889
|
+
input.predicate = this.bytes;
|
47890
|
+
input.predicateData = this.getPredicateData(policies.length);
|
48153
47891
|
}
|
48154
47892
|
});
|
48155
47893
|
return request;
|
@@ -48164,7 +47902,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48164
47902
|
* @returns A promise that resolves to the prepared transaction request.
|
48165
47903
|
*/
|
48166
47904
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
48167
|
-
|
47905
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
47906
|
+
return this.populateTransactionPredicateData(request);
|
48168
47907
|
}
|
48169
47908
|
/**
|
48170
47909
|
* Sends a transaction with the populated predicate data.
|
@@ -48172,9 +47911,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48172
47911
|
* @param transactionRequestLike - The transaction request-like object.
|
48173
47912
|
* @returns A promise that resolves to the transaction response.
|
48174
47913
|
*/
|
48175
|
-
sendTransaction(transactionRequestLike) {
|
48176
|
-
const transactionRequest =
|
48177
|
-
return super.sendTransaction(transactionRequest,
|
47914
|
+
sendTransaction(transactionRequestLike, options) {
|
47915
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47916
|
+
return super.sendTransaction(transactionRequest, options);
|
48178
47917
|
}
|
48179
47918
|
/**
|
48180
47919
|
* Simulates a transaction with the populated predicate data.
|
@@ -48183,8 +47922,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48183
47922
|
* @returns A promise that resolves to the call result.
|
48184
47923
|
*/
|
48185
47924
|
simulateTransaction(transactionRequestLike) {
|
48186
|
-
const transactionRequest =
|
48187
|
-
return super.simulateTransaction(transactionRequest
|
47925
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47926
|
+
return super.simulateTransaction(transactionRequest);
|
48188
47927
|
}
|
48189
47928
|
getPredicateData(policiesLength) {
|
48190
47929
|
if (!this.predicateData.length) {
|
@@ -48230,25 +47969,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48230
47969
|
predicateInterface: abiInterface
|
48231
47970
|
};
|
48232
47971
|
}
|
48233
|
-
/**
|
48234
|
-
* Retrieves resources satisfying the spend query for the account.
|
48235
|
-
*
|
48236
|
-
* @param quantities - IDs of coins to exclude.
|
48237
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
48238
|
-
* @returns A promise that resolves to an array of Resources.
|
48239
|
-
*/
|
48240
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
48241
|
-
const resources = await this.provider.getResourcesToSpend(
|
48242
|
-
this.address,
|
48243
|
-
quantities,
|
48244
|
-
excludedIds
|
48245
|
-
);
|
48246
|
-
return resources.map((resource) => ({
|
48247
|
-
...resource,
|
48248
|
-
predicate: hexlify(this.bytes),
|
48249
|
-
padPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48250
|
-
}));
|
48251
|
-
}
|
48252
47972
|
/**
|
48253
47973
|
* Sets the configurable constants for the predicate.
|
48254
47974
|
*
|