@fuel-ts/account 0.0.0-rc-2143-20240424161332 → 0.0.0-rc-2021-20240424162616
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 +6 -5
- 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 +808 -553
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +769 -514
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +650 -396
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +10 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +810 -359
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +4 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +7 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +37 -27
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +2 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +8 -29
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +3 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +8 -2
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +2 -4
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +1527 -1056
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +751 -514
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +644 -407
- 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 max(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 clone3(instance) {
|
5117
5117
|
let p1, p2;
|
5118
5118
|
let body = instance.body;
|
5119
5119
|
if (instance.bodyUsed) {
|
@@ -6047,7 +6047,7 @@
|
|
6047
6047
|
* @return Response
|
6048
6048
|
*/
|
6049
6049
|
clone() {
|
6050
|
-
return new Response2(
|
6050
|
+
return new Response2(clone3(this), {
|
6051
6051
|
url: this.url,
|
6052
6052
|
status: this.status,
|
6053
6053
|
statusText: this.statusText,
|
@@ -6097,7 +6097,7 @@
|
|
6097
6097
|
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
6098
6098
|
throw new TypeError("Request with GET/HEAD method cannot have body");
|
6099
6099
|
}
|
6100
|
-
let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ?
|
6100
|
+
let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone3(input) : null;
|
6101
6101
|
Body.call(this, inputBody, {
|
6102
6102
|
timeout: init.timeout || input.timeout || 0,
|
6103
6103
|
size: init.size || input.size || 0
|
@@ -28952,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.51.1",
|
28956
|
+
FUEL_CORE: "0.24.3",
|
28957
28957
|
FUELS: "0.81.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -29053,6 +29053,7 @@ 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";
|
29056
29057
|
ErrorCode2["TRANSACTION_NOT_FOUND"] = "transaction-not-found";
|
29057
29058
|
ErrorCode2["TRANSACTION_FAILED"] = "transaction-failed";
|
29058
29059
|
ErrorCode2["INVALID_CONFIGURABLE_CONSTANTS"] = "invalid-configurable-constants";
|
@@ -29243,6 +29244,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29243
29244
|
};
|
29244
29245
|
var DateTime = _DateTime;
|
29245
29246
|
__publicField3(DateTime, "TAI64_NULL", "");
|
29247
|
+
function isDefined(value) {
|
29248
|
+
return value !== void 0;
|
29249
|
+
}
|
29246
29250
|
|
29247
29251
|
// ../crypto/dist/index.mjs
|
29248
29252
|
var import_crypto8 = __toESM(__require("crypto"), 1);
|
@@ -31495,32 +31499,182 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31495
31499
|
function toBytes3(value, bytesPadding) {
|
31496
31500
|
return bn(value).toBytes(bytesPadding);
|
31497
31501
|
}
|
31498
|
-
|
31499
|
-
|
31502
|
+
|
31503
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
31504
|
+
function _isPlaceholder(a) {
|
31505
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31500
31506
|
}
|
31501
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";
|
31597
|
+
}
|
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
|
+
|
31502
31656
|
// src/providers/coin-quantity.ts
|
31503
31657
|
var coinQuantityfy = (coinQuantityLike) => {
|
31504
31658
|
let assetId;
|
31505
31659
|
let amount;
|
31506
|
-
let
|
31660
|
+
let max;
|
31507
31661
|
if (Array.isArray(coinQuantityLike)) {
|
31508
31662
|
amount = coinQuantityLike[0];
|
31509
31663
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31510
|
-
|
31664
|
+
max = coinQuantityLike[2] ?? void 0;
|
31511
31665
|
} else {
|
31512
31666
|
amount = coinQuantityLike.amount;
|
31513
31667
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31514
|
-
|
31668
|
+
max = coinQuantityLike.max ?? void 0;
|
31515
31669
|
}
|
31516
31670
|
const bnAmount = bn(amount);
|
31517
31671
|
return {
|
31518
31672
|
assetId: hexlify(assetId),
|
31519
31673
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31520
|
-
max:
|
31674
|
+
max: max ? bn(max) : void 0
|
31521
31675
|
};
|
31522
31676
|
};
|
31523
|
-
var
|
31677
|
+
var addAmountToCoinQuantities = (params) => {
|
31524
31678
|
const { amount, assetId } = params;
|
31525
31679
|
const coinQuantities = [...params.coinQuantities];
|
31526
31680
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31605,7 +31759,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31605
31759
|
var ENCODING_V1 = "1";
|
31606
31760
|
var WORD_SIZE = 8;
|
31607
31761
|
var BYTES_32 = 32;
|
31608
|
-
var UTXO_ID_LEN = BYTES_32 +
|
31762
|
+
var UTXO_ID_LEN = BYTES_32 + 2;
|
31609
31763
|
var ASSET_ID_LEN = BYTES_32;
|
31610
31764
|
var ADDRESS_LEN = BYTES_32;
|
31611
31765
|
var NONCE_LEN = BYTES_32;
|
@@ -31613,9 +31767,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31613
31767
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31614
31768
|
var MAX_BYTES = 2 ** 32 - 1;
|
31615
31769
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31616
|
-
|
31770
|
+
ASSET_ID_LEN + // Base asset ID
|
31617
31771
|
// Asset ID/Balance coin input pairs
|
31618
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31772
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
|
31619
31773
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31620
31774
|
WORD_SIZE + // Gas limit
|
31621
31775
|
WORD_SIZE + // Script size
|
@@ -31633,7 +31787,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31633
31787
|
ASSET_ID_LEN + // Asset id
|
31634
31788
|
TX_POINTER_LEN + // TxPointer
|
31635
31789
|
WORD_SIZE + // Witnesses index
|
31636
|
-
WORD_SIZE + // Maturity
|
31637
31790
|
WORD_SIZE + // Predicate size
|
31638
31791
|
WORD_SIZE + // Predicate data size
|
31639
31792
|
WORD_SIZE;
|
@@ -31955,7 +32108,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31955
32108
|
constructor(name, coders) {
|
31956
32109
|
const caseIndexCoder = new BigNumberCoder("u64");
|
31957
32110
|
const encodedValueSize = Object.values(coders).reduce(
|
31958
|
-
(
|
32111
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
31959
32112
|
0
|
31960
32113
|
);
|
31961
32114
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32673,7 +32826,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32673
32826
|
constructor(name, coders) {
|
32674
32827
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32675
32828
|
const encodedValueSize = Object.values(coders).reduce(
|
32676
|
-
(
|
32829
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
32677
32830
|
0
|
32678
32831
|
);
|
32679
32832
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33387,18 +33540,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33387
33540
|
encode(value) {
|
33388
33541
|
const parts = [];
|
33389
33542
|
parts.push(new B256Coder().encode(value.txID));
|
33390
|
-
parts.push(new NumberCoder("
|
33543
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
33391
33544
|
parts.push(new B256Coder().encode(value.owner));
|
33392
33545
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33393
33546
|
parts.push(new B256Coder().encode(value.assetId));
|
33394
33547
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33395
|
-
parts.push(new NumberCoder("
|
33396
|
-
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33548
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
33397
33549
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33398
|
-
parts.push(new
|
33399
|
-
parts.push(new
|
33400
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33401
|
-
parts.push(
|
33550
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33551
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33552
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33553
|
+
parts.push(
|
33554
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33555
|
+
);
|
33402
33556
|
return concat(parts);
|
33403
33557
|
}
|
33404
33558
|
decode(data, offset) {
|
@@ -33406,7 +33560,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33406
33560
|
let o = offset;
|
33407
33561
|
[decoded, o] = new B256Coder().decode(data, o);
|
33408
33562
|
const txID = decoded;
|
33409
|
-
[decoded, o] = new NumberCoder("
|
33563
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33410
33564
|
const outputIndex = decoded;
|
33411
33565
|
[decoded, o] = new B256Coder().decode(data, o);
|
33412
33566
|
const owner = decoded;
|
@@ -33416,19 +33570,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33416
33570
|
const assetId = decoded;
|
33417
33571
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33418
33572
|
const txPointer = decoded;
|
33419
|
-
[decoded, o] = new NumberCoder("
|
33573
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33420
33574
|
const witnessIndex = Number(decoded);
|
33421
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33422
|
-
const maturity = decoded;
|
33423
33575
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33424
33576
|
const predicateGasUsed = decoded;
|
33425
|
-
[decoded, o] = new
|
33577
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33426
33578
|
const predicateLength = decoded;
|
33427
|
-
[decoded, o] = new
|
33579
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33428
33580
|
const predicateDataLength = decoded;
|
33429
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33581
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33430
33582
|
const predicate = decoded;
|
33431
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33583
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
33432
33584
|
const predicateData = decoded;
|
33433
33585
|
return [
|
33434
33586
|
{
|
@@ -33440,7 +33592,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33440
33592
|
assetId,
|
33441
33593
|
txPointer,
|
33442
33594
|
witnessIndex,
|
33443
|
-
maturity,
|
33444
33595
|
predicateGasUsed,
|
33445
33596
|
predicateLength,
|
33446
33597
|
predicateDataLength,
|
@@ -33458,7 +33609,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33458
33609
|
encode(value) {
|
33459
33610
|
const parts = [];
|
33460
33611
|
parts.push(new B256Coder().encode(value.txID));
|
33461
|
-
parts.push(new NumberCoder("
|
33612
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
33462
33613
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33463
33614
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33464
33615
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33470,7 +33621,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33470
33621
|
let o = offset;
|
33471
33622
|
[decoded, o] = new B256Coder().decode(data, o);
|
33472
33623
|
const txID = decoded;
|
33473
|
-
[decoded, o] = new NumberCoder("
|
33624
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33474
33625
|
const outputIndex = decoded;
|
33475
33626
|
[decoded, o] = new B256Coder().decode(data, o);
|
33476
33627
|
const balanceRoot = decoded;
|
@@ -33519,14 +33670,16 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33519
33670
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33520
33671
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33521
33672
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33522
|
-
parts.push(new NumberCoder("
|
33673
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
33523
33674
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33524
|
-
parts.push(new
|
33525
|
-
parts.push(new
|
33526
|
-
parts.push(new
|
33675
|
+
parts.push(new BigNumberCoder("u64").encode(data.length));
|
33676
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33677
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33527
33678
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33528
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33529
|
-
parts.push(
|
33679
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33680
|
+
parts.push(
|
33681
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33682
|
+
);
|
33530
33683
|
return concat(parts);
|
33531
33684
|
}
|
33532
33685
|
static decodeData(messageData) {
|
@@ -33546,21 +33699,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33546
33699
|
const amount = decoded;
|
33547
33700
|
[decoded, o] = new B256Coder().decode(data, o);
|
33548
33701
|
const nonce = decoded;
|
33549
|
-
[decoded, o] = new NumberCoder("
|
33702
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33550
33703
|
const witnessIndex = Number(decoded);
|
33551
33704
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33552
33705
|
const predicateGasUsed = decoded;
|
33553
33706
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33554
33707
|
const dataLength2 = decoded;
|
33555
|
-
[decoded, o] = new
|
33708
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33556
33709
|
const predicateLength = decoded;
|
33557
|
-
[decoded, o] = new
|
33710
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33558
33711
|
const predicateDataLength = decoded;
|
33559
33712
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33560
33713
|
const messageData = decoded;
|
33561
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33714
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33562
33715
|
const predicate = decoded;
|
33563
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33716
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
33564
33717
|
const predicateData = decoded;
|
33565
33718
|
return [
|
33566
33719
|
{
|
@@ -33872,7 +34025,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33872
34025
|
}
|
33873
34026
|
};
|
33874
34027
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
33875
|
-
PolicyType2[PolicyType2["
|
34028
|
+
PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
|
33876
34029
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
33877
34030
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
33878
34031
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -33920,9 +34073,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33920
34073
|
let o = offset;
|
33921
34074
|
const policies = [];
|
33922
34075
|
if (policyTypes & 1) {
|
33923
|
-
const [
|
34076
|
+
const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
33924
34077
|
o = nextOffset;
|
33925
|
-
policies.push({ type: 1, data:
|
34078
|
+
policies.push({ type: 1, data: tip });
|
33926
34079
|
}
|
33927
34080
|
if (policyTypes & 2) {
|
33928
34081
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34154,15 +34307,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34154
34307
|
encode(value) {
|
34155
34308
|
const parts = [];
|
34156
34309
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34157
|
-
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34158
|
-
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34159
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
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
34310
|
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34164
|
-
parts.push(new
|
34165
|
-
parts.push(new
|
34311
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
|
34312
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34313
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34314
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34315
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34316
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34317
|
+
parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
|
34318
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
|
34166
34319
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34167
34320
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34168
34321
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34174,23 +34327,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34174
34327
|
let o = offset;
|
34175
34328
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34176
34329
|
const scriptGasLimit = decoded;
|
34177
|
-
[decoded, o] = new
|
34330
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34331
|
+
const receiptsRoot = decoded;
|
34332
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34178
34333
|
const scriptLength = decoded;
|
34179
|
-
[decoded, o] = new
|
34334
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34180
34335
|
const scriptDataLength = decoded;
|
34181
34336
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34182
34337
|
const policyTypes = decoded;
|
34183
|
-
[decoded, o] = new NumberCoder("
|
34338
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34184
34339
|
const inputsCount = decoded;
|
34185
|
-
[decoded, o] = new NumberCoder("
|
34340
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34186
34341
|
const outputsCount = decoded;
|
34187
|
-
[decoded, o] = new NumberCoder("
|
34342
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34188
34343
|
const witnessesCount = decoded;
|
34189
|
-
[decoded, o] = new
|
34190
|
-
const receiptsRoot = decoded;
|
34191
|
-
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34344
|
+
[decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
|
34192
34345
|
const script = decoded;
|
34193
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34346
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
|
34194
34347
|
const scriptData = decoded;
|
34195
34348
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34196
34349
|
const policies = decoded;
|
@@ -34228,18 +34381,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34228
34381
|
}
|
34229
34382
|
encode(value) {
|
34230
34383
|
const parts = [];
|
34231
|
-
parts.push(new NumberCoder("
|
34232
|
-
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34233
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
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));
|
34384
|
+
parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
|
34238
34385
|
parts.push(new B256Coder().encode(value.salt));
|
34239
|
-
parts.push(new
|
34386
|
+
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34387
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34388
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34389
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34390
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34240
34391
|
parts.push(
|
34241
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(
|
34392
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
|
34393
|
+
value.storageSlots
|
34394
|
+
)
|
34242
34395
|
);
|
34396
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34243
34397
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34244
34398
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34245
34399
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34248,26 +34402,27 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34248
34402
|
decode(data, offset) {
|
34249
34403
|
let decoded;
|
34250
34404
|
let o = offset;
|
34251
|
-
[decoded, o] = new NumberCoder("
|
34252
|
-
const bytecodeLength = decoded;
|
34253
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34405
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34254
34406
|
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;
|
34255
34411
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34256
34412
|
const policyTypes = decoded;
|
34257
34413
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34258
|
-
const storageSlotsCount = decoded;
|
34259
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34260
34414
|
const inputsCount = decoded;
|
34261
|
-
[decoded, o] = new NumberCoder("
|
34415
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34262
34416
|
const outputsCount = decoded;
|
34263
|
-
[decoded, o] = new NumberCoder("
|
34417
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34264
34418
|
const witnessesCount = decoded;
|
34265
|
-
[decoded, o] = new
|
34266
|
-
|
34419
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
|
34420
|
+
data,
|
34421
|
+
o
|
34422
|
+
);
|
34423
|
+
const storageSlots = decoded;
|
34267
34424
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34268
34425
|
const policies = decoded;
|
34269
|
-
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34270
|
-
const storageSlots = decoded;
|
34271
34426
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34272
34427
|
const inputs = decoded;
|
34273
34428
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34277,7 +34432,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34277
34432
|
return [
|
34278
34433
|
{
|
34279
34434
|
type: 1,
|
34280
|
-
bytecodeLength,
|
34281
34435
|
bytecodeWitnessIndex,
|
34282
34436
|
policyTypes,
|
34283
34437
|
storageSlotsCount,
|
@@ -34306,6 +34460,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34306
34460
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34307
34461
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34308
34462
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34463
|
+
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34309
34464
|
return concat(parts);
|
34310
34465
|
}
|
34311
34466
|
decode(data, offset) {
|
@@ -34321,6 +34476,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34321
34476
|
const mintAmount = decoded;
|
34322
34477
|
[decoded, o] = new B256Coder().decode(data, o);
|
34323
34478
|
const mintAssetId = decoded;
|
34479
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34480
|
+
const gasPrice = decoded;
|
34324
34481
|
return [
|
34325
34482
|
{
|
34326
34483
|
type: 2,
|
@@ -34328,7 +34485,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34328
34485
|
inputContract,
|
34329
34486
|
outputContract,
|
34330
34487
|
mintAmount,
|
34331
|
-
mintAssetId
|
34488
|
+
mintAssetId,
|
34489
|
+
gasPrice
|
34332
34490
|
},
|
34333
34491
|
o
|
34334
34492
|
];
|
@@ -34635,159 +34793,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34635
34793
|
// src/providers/provider.ts
|
34636
34794
|
var import_graphql_request = __toESM(require_dist2());
|
34637
34795
|
|
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
|
-
|
34791
34796
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34792
34797
|
var __assign = function() {
|
34793
34798
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37953,16 +37958,20 @@ spurious results.`);
|
|
37953
37958
|
var lib_default2 = gql;
|
37954
37959
|
|
37955
37960
|
// src/providers/__generated__/operations.ts
|
37961
|
+
var TransactionStatusSubscriptionFragmentFragmentDoc = lib_default2`
|
37962
|
+
fragment transactionStatusSubscriptionFragment on TransactionStatus {
|
37963
|
+
type: __typename
|
37964
|
+
... on SqueezedOutStatus {
|
37965
|
+
reason
|
37966
|
+
}
|
37967
|
+
}
|
37968
|
+
`;
|
37956
37969
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37957
37970
|
fragment receiptFragment on Receipt {
|
37958
|
-
|
37959
|
-
id
|
37960
|
-
}
|
37971
|
+
id
|
37961
37972
|
pc
|
37962
37973
|
is
|
37963
|
-
to
|
37964
|
-
id
|
37965
|
-
}
|
37974
|
+
to
|
37966
37975
|
toAddress
|
37967
37976
|
amount
|
37968
37977
|
assetId
|
@@ -38000,10 +38009,16 @@ spurious results.`);
|
|
38000
38009
|
id
|
38001
38010
|
}
|
38002
38011
|
time
|
38012
|
+
receipts {
|
38013
|
+
...receiptFragment
|
38014
|
+
}
|
38003
38015
|
programState {
|
38004
38016
|
returnType
|
38005
38017
|
data
|
38006
38018
|
}
|
38019
|
+
receipts {
|
38020
|
+
...receiptFragment
|
38021
|
+
}
|
38007
38022
|
}
|
38008
38023
|
... on FailureStatus {
|
38009
38024
|
block {
|
@@ -38011,26 +38026,24 @@ spurious results.`);
|
|
38011
38026
|
}
|
38012
38027
|
time
|
38013
38028
|
reason
|
38029
|
+
receipts {
|
38030
|
+
...receiptFragment
|
38031
|
+
}
|
38014
38032
|
}
|
38015
38033
|
... on SqueezedOutStatus {
|
38016
38034
|
reason
|
38017
38035
|
}
|
38018
38036
|
}
|
38019
|
-
`;
|
38037
|
+
${ReceiptFragmentFragmentDoc}`;
|
38020
38038
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38021
38039
|
fragment transactionFragment on Transaction {
|
38022
38040
|
id
|
38023
38041
|
rawPayload
|
38024
|
-
gasPrice
|
38025
|
-
receipts {
|
38026
|
-
...receiptFragment
|
38027
|
-
}
|
38028
38042
|
status {
|
38029
38043
|
...transactionStatusFragment
|
38030
38044
|
}
|
38031
38045
|
}
|
38032
|
-
${
|
38033
|
-
${TransactionStatusFragmentFragmentDoc}`;
|
38046
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38034
38047
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38035
38048
|
fragment inputEstimatePredicatesFragment on Input {
|
38036
38049
|
... on InputCoin {
|
@@ -38048,6 +38061,46 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38048
38061
|
}
|
38049
38062
|
}
|
38050
38063
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38064
|
+
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38065
|
+
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38066
|
+
reason
|
38067
|
+
programState {
|
38068
|
+
returnType
|
38069
|
+
data
|
38070
|
+
}
|
38071
|
+
}
|
38072
|
+
`;
|
38073
|
+
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38074
|
+
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38075
|
+
programState {
|
38076
|
+
returnType
|
38077
|
+
data
|
38078
|
+
}
|
38079
|
+
}
|
38080
|
+
`;
|
38081
|
+
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38082
|
+
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38083
|
+
... on DryRunFailureStatus {
|
38084
|
+
...dryRunFailureStatusFragment
|
38085
|
+
}
|
38086
|
+
... on DryRunSuccessStatus {
|
38087
|
+
...dryRunSuccessStatusFragment
|
38088
|
+
}
|
38089
|
+
}
|
38090
|
+
${DryRunFailureStatusFragmentFragmentDoc}
|
38091
|
+
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38092
|
+
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38093
|
+
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38094
|
+
id
|
38095
|
+
status {
|
38096
|
+
...dryRunTransactionStatusFragment
|
38097
|
+
}
|
38098
|
+
receipts {
|
38099
|
+
...receiptFragment
|
38100
|
+
}
|
38101
|
+
}
|
38102
|
+
${DryRunTransactionStatusFragmentFragmentDoc}
|
38103
|
+
${ReceiptFragmentFragmentDoc}`;
|
38051
38104
|
var CoinFragmentFragmentDoc = lib_default2`
|
38052
38105
|
fragment coinFragment on Coin {
|
38053
38106
|
__typename
|
@@ -38055,7 +38108,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38055
38108
|
owner
|
38056
38109
|
amount
|
38057
38110
|
assetId
|
38058
|
-
maturity
|
38059
38111
|
blockCreated
|
38060
38112
|
txCreatedIdx
|
38061
38113
|
}
|
@@ -38094,26 +38146,32 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38094
38146
|
messageBlockHeader {
|
38095
38147
|
id
|
38096
38148
|
daHeight
|
38149
|
+
consensusParametersVersion
|
38150
|
+
stateTransitionBytecodeVersion
|
38097
38151
|
transactionsCount
|
38152
|
+
messageReceiptCount
|
38098
38153
|
transactionsRoot
|
38154
|
+
messageOutboxRoot
|
38155
|
+
eventInboxRoot
|
38099
38156
|
height
|
38100
38157
|
prevRoot
|
38101
38158
|
time
|
38102
38159
|
applicationHash
|
38103
|
-
messageReceiptRoot
|
38104
|
-
messageReceiptCount
|
38105
38160
|
}
|
38106
38161
|
commitBlockHeader {
|
38107
38162
|
id
|
38108
38163
|
daHeight
|
38164
|
+
consensusParametersVersion
|
38165
|
+
stateTransitionBytecodeVersion
|
38109
38166
|
transactionsCount
|
38167
|
+
messageReceiptCount
|
38110
38168
|
transactionsRoot
|
38169
|
+
messageOutboxRoot
|
38170
|
+
eventInboxRoot
|
38111
38171
|
height
|
38112
38172
|
prevRoot
|
38113
38173
|
time
|
38114
38174
|
applicationHash
|
38115
|
-
messageReceiptRoot
|
38116
|
-
messageReceiptCount
|
38117
38175
|
}
|
38118
38176
|
sender
|
38119
38177
|
recipient
|
@@ -38132,8 +38190,8 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38132
38190
|
var BlockFragmentFragmentDoc = lib_default2`
|
38133
38191
|
fragment blockFragment on Block {
|
38134
38192
|
id
|
38193
|
+
height
|
38135
38194
|
header {
|
38136
|
-
height
|
38137
38195
|
time
|
38138
38196
|
}
|
38139
38197
|
transactions {
|
@@ -38143,6 +38201,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38143
38201
|
`;
|
38144
38202
|
var TxParametersFragmentFragmentDoc = lib_default2`
|
38145
38203
|
fragment TxParametersFragment on TxParameters {
|
38204
|
+
version
|
38146
38205
|
maxInputs
|
38147
38206
|
maxOutputs
|
38148
38207
|
maxWitnesses
|
@@ -38152,6 +38211,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38152
38211
|
`;
|
38153
38212
|
var PredicateParametersFragmentFragmentDoc = lib_default2`
|
38154
38213
|
fragment PredicateParametersFragment on PredicateParameters {
|
38214
|
+
version
|
38155
38215
|
maxPredicateLength
|
38156
38216
|
maxPredicateDataLength
|
38157
38217
|
maxGasPerPredicate
|
@@ -38160,18 +38220,21 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38160
38220
|
`;
|
38161
38221
|
var ScriptParametersFragmentFragmentDoc = lib_default2`
|
38162
38222
|
fragment ScriptParametersFragment on ScriptParameters {
|
38223
|
+
version
|
38163
38224
|
maxScriptLength
|
38164
38225
|
maxScriptDataLength
|
38165
38226
|
}
|
38166
38227
|
`;
|
38167
38228
|
var ContractParametersFragmentFragmentDoc = lib_default2`
|
38168
38229
|
fragment ContractParametersFragment on ContractParameters {
|
38230
|
+
version
|
38169
38231
|
contractMaxSize
|
38170
38232
|
maxStorageSlots
|
38171
38233
|
}
|
38172
38234
|
`;
|
38173
38235
|
var FeeParametersFragmentFragmentDoc = lib_default2`
|
38174
38236
|
fragment FeeParametersFragment on FeeParameters {
|
38237
|
+
version
|
38175
38238
|
gasPriceFactor
|
38176
38239
|
gasPerByte
|
38177
38240
|
}
|
@@ -38191,6 +38254,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38191
38254
|
`;
|
38192
38255
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38193
38256
|
fragment GasCostsFragment on GasCosts {
|
38257
|
+
version
|
38194
38258
|
add
|
38195
38259
|
addi
|
38196
38260
|
aloc
|
@@ -38203,7 +38267,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38203
38267
|
cb
|
38204
38268
|
cfei
|
38205
38269
|
cfsi
|
38206
|
-
croo
|
38207
38270
|
div
|
38208
38271
|
divi
|
38209
38272
|
ecr1
|
@@ -38286,6 +38349,9 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38286
38349
|
ccp {
|
38287
38350
|
...DependentCostFragment
|
38288
38351
|
}
|
38352
|
+
croo {
|
38353
|
+
...DependentCostFragment
|
38354
|
+
}
|
38289
38355
|
csiz {
|
38290
38356
|
...DependentCostFragment
|
38291
38357
|
}
|
@@ -38345,6 +38411,7 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38345
38411
|
${DependentCostFragmentFragmentDoc}`;
|
38346
38412
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38347
38413
|
fragment consensusParametersFragment on ConsensusParameters {
|
38414
|
+
version
|
38348
38415
|
txParams {
|
38349
38416
|
...TxParametersFragment
|
38350
38417
|
}
|
@@ -38404,18 +38471,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38404
38471
|
fragment nodeInfoFragment on NodeInfo {
|
38405
38472
|
utxoValidation
|
38406
38473
|
vmBacktrace
|
38407
|
-
minGasPrice
|
38408
38474
|
maxTx
|
38409
38475
|
maxDepth
|
38410
38476
|
nodeVersion
|
38411
|
-
peers {
|
38412
|
-
id
|
38413
|
-
addresses
|
38414
|
-
clientVersion
|
38415
|
-
blockHeight
|
38416
|
-
lastHeartbeatMs
|
38417
|
-
appScore
|
38418
|
-
}
|
38419
38477
|
}
|
38420
38478
|
`;
|
38421
38479
|
var GetVersionDocument = lib_default2`
|
@@ -38450,13 +38508,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38450
38508
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38451
38509
|
transaction(id: $transactionId) {
|
38452
38510
|
...transactionFragment
|
38453
|
-
receipts {
|
38454
|
-
...receiptFragment
|
38455
|
-
}
|
38456
38511
|
}
|
38457
38512
|
}
|
38458
|
-
${TransactionFragmentFragmentDoc}
|
38459
|
-
${ReceiptFragmentFragmentDoc}`;
|
38513
|
+
${TransactionFragmentFragmentDoc}`;
|
38460
38514
|
var GetTransactionsDocument = lib_default2`
|
38461
38515
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38462
38516
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38584,6 +38638,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38584
38638
|
}
|
38585
38639
|
}
|
38586
38640
|
${BalanceFragmentFragmentDoc}`;
|
38641
|
+
var GetLatestGasPriceDocument = lib_default2`
|
38642
|
+
query getLatestGasPrice {
|
38643
|
+
latestGasPrice {
|
38644
|
+
gasPrice
|
38645
|
+
}
|
38646
|
+
}
|
38647
|
+
`;
|
38648
|
+
var EstimateGasPriceDocument = lib_default2`
|
38649
|
+
query estimateGasPrice($blockHorizon: U32!) {
|
38650
|
+
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38651
|
+
gasPrice
|
38652
|
+
}
|
38653
|
+
}
|
38654
|
+
`;
|
38587
38655
|
var GetBalancesDocument = lib_default2`
|
38588
38656
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38589
38657
|
balances(
|
@@ -38638,12 +38706,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38638
38706
|
}
|
38639
38707
|
`;
|
38640
38708
|
var DryRunDocument = lib_default2`
|
38641
|
-
mutation dryRun($
|
38642
|
-
dryRun(
|
38643
|
-
...
|
38709
|
+
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
38710
|
+
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
38711
|
+
...dryRunTransactionExecutionStatusFragment
|
38644
38712
|
}
|
38645
38713
|
}
|
38646
|
-
${
|
38714
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
38647
38715
|
var SubmitDocument = lib_default2`
|
38648
38716
|
mutation submit($encodedTransaction: HexString!) {
|
38649
38717
|
submit(tx: $encodedTransaction) {
|
@@ -38662,17 +38730,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38662
38730
|
var SubmitAndAwaitDocument = lib_default2`
|
38663
38731
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
38664
38732
|
submitAndAwait(tx: $encodedTransaction) {
|
38665
|
-
...
|
38733
|
+
...transactionStatusSubscriptionFragment
|
38666
38734
|
}
|
38667
38735
|
}
|
38668
|
-
${
|
38736
|
+
${TransactionStatusSubscriptionFragmentFragmentDoc}`;
|
38669
38737
|
var StatusChangeDocument = lib_default2`
|
38670
38738
|
subscription statusChange($transactionId: TransactionId!) {
|
38671
38739
|
statusChange(id: $transactionId) {
|
38672
|
-
...
|
38740
|
+
...transactionStatusSubscriptionFragment
|
38673
38741
|
}
|
38674
38742
|
}
|
38675
|
-
${
|
38743
|
+
${TransactionStatusSubscriptionFragmentFragmentDoc}`;
|
38676
38744
|
function getSdk(requester) {
|
38677
38745
|
return {
|
38678
38746
|
getVersion(variables, options) {
|
@@ -38726,6 +38794,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38726
38794
|
getBalance(variables, options) {
|
38727
38795
|
return requester(GetBalanceDocument, variables, options);
|
38728
38796
|
},
|
38797
|
+
getLatestGasPrice(variables, options) {
|
38798
|
+
return requester(GetLatestGasPriceDocument, variables, options);
|
38799
|
+
},
|
38800
|
+
estimateGasPrice(variables, options) {
|
38801
|
+
return requester(EstimateGasPriceDocument, variables, options);
|
38802
|
+
},
|
38729
38803
|
getBalances(variables, options) {
|
38730
38804
|
return requester(GetBalancesDocument, variables, options);
|
38731
38805
|
},
|
@@ -38909,10 +38983,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38909
38983
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38910
38984
|
},
|
38911
38985
|
witnessIndex: value.witnessIndex,
|
38912
|
-
maturity: value.maturity ?? 0,
|
38913
38986
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38914
|
-
predicateLength: predicate.length,
|
38915
|
-
predicateDataLength: predicateData.length,
|
38987
|
+
predicateLength: bn(predicate.length),
|
38988
|
+
predicateDataLength: bn(predicateData.length),
|
38916
38989
|
predicate: hexlify(predicate),
|
38917
38990
|
predicateData: hexlify(predicateData)
|
38918
38991
|
};
|
@@ -38943,8 +39016,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38943
39016
|
nonce: hexlify(value.nonce),
|
38944
39017
|
witnessIndex: value.witnessIndex,
|
38945
39018
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38946
|
-
predicateLength: predicate.length,
|
38947
|
-
predicateDataLength: predicateData.length,
|
39019
|
+
predicateLength: bn(predicate.length),
|
39020
|
+
predicateDataLength: bn(predicateData.length),
|
38948
39021
|
predicate: hexlify(predicate),
|
38949
39022
|
predicateData: hexlify(predicateData),
|
38950
39023
|
data: hexlify(data),
|
@@ -39104,8 +39177,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39104
39177
|
case "CALL" /* Call */: {
|
39105
39178
|
const callReceipt = {
|
39106
39179
|
type: ReceiptType.Call,
|
39107
|
-
from: hexOrZero(receipt.
|
39108
|
-
to: hexOrZero(receipt?.to
|
39180
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39181
|
+
to: hexOrZero(receipt?.to),
|
39109
39182
|
amount: bn(receipt.amount),
|
39110
39183
|
assetId: hexOrZero(receipt.assetId),
|
39111
39184
|
gas: bn(receipt.gas),
|
@@ -39119,7 +39192,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39119
39192
|
case "RETURN" /* Return */: {
|
39120
39193
|
const returnReceipt = {
|
39121
39194
|
type: ReceiptType.Return,
|
39122
|
-
id: hexOrZero(receipt.
|
39195
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39123
39196
|
val: bn(receipt.val),
|
39124
39197
|
pc: bn(receipt.pc),
|
39125
39198
|
is: bn(receipt.is)
|
@@ -39129,7 +39202,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39129
39202
|
case "RETURN_DATA" /* ReturnData */: {
|
39130
39203
|
const returnDataReceipt = {
|
39131
39204
|
type: ReceiptType.ReturnData,
|
39132
|
-
id: hexOrZero(receipt.
|
39205
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39133
39206
|
ptr: bn(receipt.ptr),
|
39134
39207
|
len: bn(receipt.len),
|
39135
39208
|
digest: hexOrZero(receipt.digest),
|
@@ -39141,7 +39214,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39141
39214
|
case "PANIC" /* Panic */: {
|
39142
39215
|
const panicReceipt = {
|
39143
39216
|
type: ReceiptType.Panic,
|
39144
|
-
id: hexOrZero(receipt.
|
39217
|
+
id: hexOrZero(receipt.id),
|
39145
39218
|
reason: bn(receipt.reason),
|
39146
39219
|
pc: bn(receipt.pc),
|
39147
39220
|
is: bn(receipt.is),
|
@@ -39152,7 +39225,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39152
39225
|
case "REVERT" /* Revert */: {
|
39153
39226
|
const revertReceipt = {
|
39154
39227
|
type: ReceiptType.Revert,
|
39155
|
-
id: hexOrZero(receipt.
|
39228
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39156
39229
|
val: bn(receipt.ra),
|
39157
39230
|
pc: bn(receipt.pc),
|
39158
39231
|
is: bn(receipt.is)
|
@@ -39162,7 +39235,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39162
39235
|
case "LOG" /* Log */: {
|
39163
39236
|
const logReceipt = {
|
39164
39237
|
type: ReceiptType.Log,
|
39165
|
-
id: hexOrZero(receipt.
|
39238
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39166
39239
|
val0: bn(receipt.ra),
|
39167
39240
|
val1: bn(receipt.rb),
|
39168
39241
|
val2: bn(receipt.rc),
|
@@ -39175,7 +39248,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39175
39248
|
case "LOG_DATA" /* LogData */: {
|
39176
39249
|
const logDataReceipt = {
|
39177
39250
|
type: ReceiptType.LogData,
|
39178
|
-
id: hexOrZero(receipt.
|
39251
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39179
39252
|
val0: bn(receipt.ra),
|
39180
39253
|
val1: bn(receipt.rb),
|
39181
39254
|
ptr: bn(receipt.ptr),
|
@@ -39189,8 +39262,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39189
39262
|
case "TRANSFER" /* Transfer */: {
|
39190
39263
|
const transferReceipt = {
|
39191
39264
|
type: ReceiptType.Transfer,
|
39192
|
-
from: hexOrZero(receipt.
|
39193
|
-
to: hexOrZero(receipt.toAddress || receipt?.to
|
39265
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39266
|
+
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39194
39267
|
amount: bn(receipt.amount),
|
39195
39268
|
assetId: hexOrZero(receipt.assetId),
|
39196
39269
|
pc: bn(receipt.pc),
|
@@ -39201,8 +39274,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39201
39274
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39202
39275
|
const transferOutReceipt = {
|
39203
39276
|
type: ReceiptType.TransferOut,
|
39204
|
-
from: hexOrZero(receipt.
|
39205
|
-
to: hexOrZero(receipt.toAddress || receipt.to
|
39277
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39278
|
+
to: hexOrZero(receipt.toAddress || receipt.to),
|
39206
39279
|
amount: bn(receipt.amount),
|
39207
39280
|
assetId: hexOrZero(receipt.assetId),
|
39208
39281
|
pc: bn(receipt.pc),
|
@@ -39245,7 +39318,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39245
39318
|
return receiptMessageOut;
|
39246
39319
|
}
|
39247
39320
|
case "MINT" /* Mint */: {
|
39248
|
-
const contractId = hexOrZero(receipt.
|
39321
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39249
39322
|
const subId = hexOrZero(receipt.subId);
|
39250
39323
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39251
39324
|
const mintReceipt = {
|
@@ -39260,7 +39333,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39260
39333
|
return mintReceipt;
|
39261
39334
|
}
|
39262
39335
|
case "BURN" /* Burn */: {
|
39263
|
-
const contractId = hexOrZero(receipt.
|
39336
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39264
39337
|
const subId = hexOrZero(receipt.subId);
|
39265
39338
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39266
39339
|
const burnReceipt = {
|
@@ -39341,7 +39414,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39341
39414
|
};
|
39342
39415
|
|
39343
39416
|
// src/providers/utils/gas.ts
|
39344
|
-
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39345
39417
|
var getGasUsedFromReceipts = (receipts) => {
|
39346
39418
|
const scriptResult = receipts.filter(
|
39347
39419
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39362,18 +39434,28 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39362
39434
|
}
|
39363
39435
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39364
39436
|
const witnessCache = [];
|
39365
|
-
const
|
39437
|
+
const chargeableInputs = inputs.filter((input) => {
|
39438
|
+
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39439
|
+
if (isCoinOrMessage) {
|
39440
|
+
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39441
|
+
return true;
|
39442
|
+
}
|
39443
|
+
if (!witnessCache.includes(input.witnessIndex)) {
|
39444
|
+
witnessCache.push(input.witnessIndex);
|
39445
|
+
return true;
|
39446
|
+
}
|
39447
|
+
}
|
39448
|
+
return false;
|
39449
|
+
});
|
39450
|
+
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39451
|
+
const totalGas = chargeableInputs.reduce((total, input) => {
|
39366
39452
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39367
39453
|
return total.add(
|
39368
|
-
|
39454
|
+
vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39369
39455
|
);
|
39370
39456
|
}
|
39371
|
-
|
39372
|
-
|
39373
|
-
return total.add(gasCosts.ecr1);
|
39374
|
-
}
|
39375
|
-
return total;
|
39376
|
-
}, bn());
|
39457
|
+
return total.add(gasCosts.ecr1);
|
39458
|
+
}, bn(0));
|
39377
39459
|
return totalGas;
|
39378
39460
|
}
|
39379
39461
|
function getMinGas(params) {
|
@@ -39385,12 +39467,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39385
39467
|
return minGas;
|
39386
39468
|
}
|
39387
39469
|
function getMaxGas(params) {
|
39388
|
-
const {
|
39470
|
+
const {
|
39471
|
+
gasPerByte,
|
39472
|
+
witnessesLength,
|
39473
|
+
witnessLimit,
|
39474
|
+
minGas,
|
39475
|
+
gasLimit = bn(0),
|
39476
|
+
maxGasPerTx
|
39477
|
+
} = params;
|
39389
39478
|
let remainingAllowedWitnessGas = bn(0);
|
39390
39479
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39391
39480
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39392
39481
|
}
|
39393
|
-
|
39482
|
+
const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39483
|
+
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39394
39484
|
}
|
39395
39485
|
function calculateMetadataGasForTxCreate({
|
39396
39486
|
gasCosts,
|
@@ -39412,6 +39502,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39412
39502
|
}) {
|
39413
39503
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39414
39504
|
}
|
39505
|
+
var calculateGasFee = (params) => {
|
39506
|
+
const { gas, gasPrice, priceFactor, tip } = params;
|
39507
|
+
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39508
|
+
};
|
39415
39509
|
|
39416
39510
|
// src/providers/utils/json.ts
|
39417
39511
|
function normalize2(object) {
|
@@ -39553,7 +39647,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39553
39647
|
// src/providers/transaction-request/transaction-request.ts
|
39554
39648
|
var BaseTransactionRequest = class {
|
39555
39649
|
/** Gas price for transaction */
|
39556
|
-
|
39650
|
+
tip;
|
39557
39651
|
/** Block until which tx cannot be included */
|
39558
39652
|
maturity;
|
39559
39653
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39572,7 +39666,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39572
39666
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39573
39667
|
*/
|
39574
39668
|
constructor({
|
39575
|
-
|
39669
|
+
tip,
|
39576
39670
|
maturity,
|
39577
39671
|
maxFee,
|
39578
39672
|
witnessLimit,
|
@@ -39580,7 +39674,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39580
39674
|
outputs,
|
39581
39675
|
witnesses
|
39582
39676
|
} = {}) {
|
39583
|
-
this.
|
39677
|
+
this.tip = bn(tip);
|
39584
39678
|
this.maturity = maturity ?? 0;
|
39585
39679
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39586
39680
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39591,9 +39685,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39591
39685
|
static getPolicyMeta(req) {
|
39592
39686
|
let policyTypes = 0;
|
39593
39687
|
const policies = [];
|
39594
|
-
if (req.
|
39595
|
-
policyTypes += PolicyType.
|
39596
|
-
policies.push({ data: req.
|
39688
|
+
if (req.tip) {
|
39689
|
+
policyTypes += PolicyType.Tip;
|
39690
|
+
policies.push({ data: req.tip, type: PolicyType.Tip });
|
39597
39691
|
}
|
39598
39692
|
if (req.witnessLimit) {
|
39599
39693
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39777,13 +39871,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39777
39871
|
* assetId, if one it was not added yet.
|
39778
39872
|
*
|
39779
39873
|
* @param coin - Coin resource.
|
39780
|
-
* @param predicate - Predicate bytes.
|
39781
|
-
* @param predicateData - Predicate data bytes.
|
39782
39874
|
*/
|
39783
|
-
addCoinInput(coin
|
39875
|
+
addCoinInput(coin) {
|
39784
39876
|
const { assetId, owner, amount } = coin;
|
39785
39877
|
let witnessIndex;
|
39786
|
-
if (predicate) {
|
39878
|
+
if (coin.predicate) {
|
39787
39879
|
witnessIndex = 0;
|
39788
39880
|
} else {
|
39789
39881
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39798,8 +39890,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39798
39890
|
amount,
|
39799
39891
|
assetId,
|
39800
39892
|
txPointer: "0x00000000000000000000000000000000",
|
39801
|
-
witnessIndex
|
39802
|
-
predicate: predicate?.bytes
|
39893
|
+
witnessIndex
|
39803
39894
|
};
|
39804
39895
|
this.pushInput(input);
|
39805
39896
|
this.addChangeOutput(owner, assetId);
|
@@ -39809,14 +39900,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39809
39900
|
* baseAssetId, if one it was not added yet.
|
39810
39901
|
*
|
39811
39902
|
* @param message - Message resource.
|
39812
|
-
* @param predicate - Predicate bytes.
|
39813
|
-
* @param predicateData - Predicate data bytes.
|
39814
39903
|
*/
|
39815
|
-
addMessageInput(message
|
39904
|
+
addMessageInput(message) {
|
39816
39905
|
const { recipient, sender, amount } = message;
|
39817
39906
|
const assetId = BaseAssetId;
|
39818
39907
|
let witnessIndex;
|
39819
|
-
if (predicate) {
|
39908
|
+
if (message.predicate) {
|
39820
39909
|
witnessIndex = 0;
|
39821
39910
|
} else {
|
39822
39911
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39830,8 +39919,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39830
39919
|
sender: sender.toB256(),
|
39831
39920
|
recipient: recipient.toB256(),
|
39832
39921
|
amount,
|
39833
|
-
witnessIndex
|
39834
|
-
predicate: predicate?.bytes
|
39922
|
+
witnessIndex
|
39835
39923
|
};
|
39836
39924
|
this.pushInput(input);
|
39837
39925
|
this.addChangeOutput(recipient, assetId);
|
@@ -39862,32 +39950,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39862
39950
|
resources.forEach((resource) => this.addResource(resource));
|
39863
39951
|
return this;
|
39864
39952
|
}
|
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
|
-
}
|
39891
39953
|
/**
|
39892
39954
|
* Adds a coin output to the transaction.
|
39893
39955
|
*
|
@@ -39967,7 +40029,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39967
40029
|
}
|
39968
40030
|
calculateMaxGas(chainInfo, minGas) {
|
39969
40031
|
const { consensusParameters } = chainInfo;
|
39970
|
-
const { gasPerByte } = consensusParameters;
|
40032
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
39971
40033
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
39972
40034
|
(acc, wit) => acc + wit.dataLength,
|
39973
40035
|
0
|
@@ -39976,7 +40038,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39976
40038
|
gasPerByte,
|
39977
40039
|
minGas,
|
39978
40040
|
witnessesLength,
|
39979
|
-
witnessLimit: this.witnessLimit
|
40041
|
+
witnessLimit: this.witnessLimit,
|
40042
|
+
maxGasPerTx
|
39980
40043
|
});
|
39981
40044
|
}
|
39982
40045
|
/**
|
@@ -39994,17 +40057,20 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39994
40057
|
});
|
39995
40058
|
const updateAssetInput = (assetId, quantity) => {
|
39996
40059
|
const assetInput = findAssetInput(assetId);
|
40060
|
+
let usedQuantity = quantity;
|
40061
|
+
if (assetId === BaseAssetId) {
|
40062
|
+
usedQuantity = bn("1000000000000000000");
|
40063
|
+
}
|
39997
40064
|
if (assetInput && "assetId" in assetInput) {
|
39998
40065
|
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
39999
|
-
assetInput.amount =
|
40066
|
+
assetInput.amount = usedQuantity;
|
40000
40067
|
} else {
|
40001
40068
|
this.addResources([
|
40002
40069
|
{
|
40003
40070
|
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
40004
|
-
amount:
|
40071
|
+
amount: usedQuantity,
|
40005
40072
|
assetId,
|
40006
40073
|
owner: resourcesOwner || Address.fromRandom(),
|
40007
|
-
maturity: 0,
|
40008
40074
|
blockCreated: bn(1),
|
40009
40075
|
txCreatedIdx: bn(1)
|
40010
40076
|
}
|
@@ -40036,7 +40102,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40036
40102
|
toJSON() {
|
40037
40103
|
return normalizeJSON(this);
|
40038
40104
|
}
|
40039
|
-
|
40105
|
+
updatePredicateGasUsed(inputs) {
|
40040
40106
|
this.inputs.forEach((i) => {
|
40041
40107
|
let correspondingInput;
|
40042
40108
|
switch (i.type) {
|
@@ -40058,6 +40124,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40058
40124
|
}
|
40059
40125
|
});
|
40060
40126
|
}
|
40127
|
+
shiftPredicateData() {
|
40128
|
+
this.inputs.forEach((input) => {
|
40129
|
+
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
40130
|
+
input.predicateData = input.padPredicateData(
|
40131
|
+
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40132
|
+
);
|
40133
|
+
}
|
40134
|
+
});
|
40135
|
+
}
|
40061
40136
|
};
|
40062
40137
|
|
40063
40138
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40191,9 +40266,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40191
40266
|
return {
|
40192
40267
|
type: TransactionType.Create,
|
40193
40268
|
...baseTransaction,
|
40194
|
-
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40195
40269
|
bytecodeWitnessIndex,
|
40196
|
-
storageSlotsCount: storageSlots.length,
|
40270
|
+
storageSlotsCount: bn(storageSlots.length),
|
40197
40271
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40198
40272
|
storageSlots
|
40199
40273
|
};
|
@@ -40307,8 +40381,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40307
40381
|
type: TransactionType.Script,
|
40308
40382
|
scriptGasLimit: this.gasLimit,
|
40309
40383
|
...super.getBaseTransaction(),
|
40310
|
-
scriptLength: script.length,
|
40311
|
-
scriptDataLength: scriptData.length,
|
40384
|
+
scriptLength: bn(script.length),
|
40385
|
+
scriptDataLength: bn(scriptData.length),
|
40312
40386
|
receiptsRoot: ZeroBytes32,
|
40313
40387
|
script: hexlify(script),
|
40314
40388
|
scriptData: hexlify(scriptData)
|
@@ -40372,7 +40446,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40372
40446
|
}
|
40373
40447
|
calculateMaxGas(chainInfo, minGas) {
|
40374
40448
|
const { consensusParameters } = chainInfo;
|
40375
|
-
const { gasPerByte } = consensusParameters;
|
40449
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
40376
40450
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40377
40451
|
(acc, wit) => acc + wit.dataLength,
|
40378
40452
|
0
|
@@ -40382,7 +40456,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40382
40456
|
minGas,
|
40383
40457
|
witnessesLength,
|
40384
40458
|
witnessLimit: this.witnessLimit,
|
40385
|
-
gasLimit: this.gasLimit
|
40459
|
+
gasLimit: this.gasLimit,
|
40460
|
+
maxGasPerTx
|
40386
40461
|
});
|
40387
40462
|
}
|
40388
40463
|
/**
|
@@ -40455,13 +40530,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40455
40530
|
}
|
40456
40531
|
}
|
40457
40532
|
};
|
40533
|
+
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40534
|
+
(acc, input) => {
|
40535
|
+
if (input.type === InputType.Coin && input.owner === owner) {
|
40536
|
+
acc.utxos.push(input.id);
|
40537
|
+
}
|
40538
|
+
if (input.type === InputType.Message && input.recipient === owner) {
|
40539
|
+
acc.messages.push(input.nonce);
|
40540
|
+
}
|
40541
|
+
return acc;
|
40542
|
+
},
|
40543
|
+
{
|
40544
|
+
utxos: [],
|
40545
|
+
messages: []
|
40546
|
+
}
|
40547
|
+
);
|
40458
40548
|
|
40459
40549
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40460
40550
|
var calculateTransactionFee = (params) => {
|
40461
40551
|
const {
|
40462
|
-
|
40552
|
+
gasPrice,
|
40463
40553
|
rawPayload,
|
40464
|
-
|
40554
|
+
tip,
|
40555
|
+
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40465
40556
|
} = params;
|
40466
40557
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40467
40558
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40471,8 +40562,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40471
40562
|
return {
|
40472
40563
|
fee: bn(0),
|
40473
40564
|
minFee: bn(0),
|
40474
|
-
maxFee: bn(0)
|
40475
|
-
feeFromGasUsed: bn(0)
|
40565
|
+
maxFee: bn(0)
|
40476
40566
|
};
|
40477
40567
|
}
|
40478
40568
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40504,7 +40594,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40504
40594
|
metadataGas,
|
40505
40595
|
txBytesSize: transactionBytes.length
|
40506
40596
|
});
|
40507
|
-
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40508
40597
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40509
40598
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40510
40599
|
const maxGas = getMaxGas({
|
@@ -40512,17 +40601,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40512
40601
|
minGas,
|
40513
40602
|
witnessesLength,
|
40514
40603
|
gasLimit,
|
40515
|
-
witnessLimit
|
40604
|
+
witnessLimit,
|
40605
|
+
maxGasPerTx
|
40606
|
+
});
|
40607
|
+
const minFee = calculateGasFee({
|
40608
|
+
gasPrice,
|
40609
|
+
gas: minGas,
|
40610
|
+
priceFactor: gasPriceFactor,
|
40611
|
+
tip
|
40612
|
+
});
|
40613
|
+
const maxFee = calculateGasFee({
|
40614
|
+
gasPrice,
|
40615
|
+
gas: maxGas,
|
40616
|
+
priceFactor: gasPriceFactor,
|
40617
|
+
tip
|
40516
40618
|
});
|
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);
|
40521
40619
|
return {
|
40522
|
-
fee,
|
40523
40620
|
minFee,
|
40524
40621
|
maxFee,
|
40525
|
-
|
40622
|
+
fee: maxFee
|
40526
40623
|
};
|
40527
40624
|
};
|
40528
40625
|
|
@@ -41123,7 +41220,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41123
41220
|
gqlTransactionStatus,
|
41124
41221
|
abiMap = {},
|
41125
41222
|
maxInputs,
|
41126
|
-
gasCosts
|
41223
|
+
gasCosts,
|
41224
|
+
maxGasPerTx,
|
41225
|
+
gasPrice
|
41127
41226
|
} = params;
|
41128
41227
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41129
41228
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41137,11 +41236,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41137
41236
|
maxInputs
|
41138
41237
|
});
|
41139
41238
|
const typeName = getTransactionTypeName(transaction.type);
|
41239
|
+
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41140
41240
|
const { fee } = calculateTransactionFee({
|
41141
|
-
|
41241
|
+
gasPrice,
|
41142
41242
|
rawPayload,
|
41243
|
+
tip,
|
41143
41244
|
consensusParameters: {
|
41144
41245
|
gasCosts,
|
41246
|
+
maxGasPerTx,
|
41145
41247
|
feeParams: {
|
41146
41248
|
gasPerByte,
|
41147
41249
|
gasPriceFactor
|
@@ -41277,8 +41379,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41277
41379
|
const decodedTransaction = this.decodeTransaction(
|
41278
41380
|
transaction
|
41279
41381
|
);
|
41280
|
-
|
41281
|
-
|
41382
|
+
let txReceipts = [];
|
41383
|
+
if (transaction?.status && "receipts" in transaction.status) {
|
41384
|
+
txReceipts = transaction.status.receipts;
|
41385
|
+
}
|
41386
|
+
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41387
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41388
|
+
const gasPrice = await this.provider.getLatestGasPrice();
|
41282
41389
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41283
41390
|
const transactionSummary = assembleTransactionSummary({
|
41284
41391
|
id: this.id,
|
@@ -41290,7 +41397,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41290
41397
|
gasPriceFactor,
|
41291
41398
|
abiMap: contractsAbiMap,
|
41292
41399
|
maxInputs,
|
41293
|
-
gasCosts
|
41400
|
+
gasCosts,
|
41401
|
+
maxGasPerTx,
|
41402
|
+
gasPrice
|
41294
41403
|
});
|
41295
41404
|
return transactionSummary;
|
41296
41405
|
}
|
@@ -41439,7 +41548,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41439
41548
|
gasCosts,
|
41440
41549
|
latestBlock: {
|
41441
41550
|
id: latestBlock.id,
|
41442
|
-
height: bn(latestBlock.
|
41551
|
+
height: bn(latestBlock.height),
|
41443
41552
|
time: latestBlock.header.time,
|
41444
41553
|
transactions: latestBlock.transactions.map((i) => ({
|
41445
41554
|
id: i.id
|
@@ -41533,10 +41642,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41533
41642
|
* Returns some helpful parameters related to gas fees.
|
41534
41643
|
*/
|
41535
41644
|
getGasConfig() {
|
41536
|
-
const { minGasPrice } = this.getNode();
|
41537
41645
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41538
41646
|
return {
|
41539
|
-
minGasPrice,
|
41540
41647
|
maxGasPerTx,
|
41541
41648
|
maxGasPerPredicate,
|
41542
41649
|
gasPriceFactor,
|
@@ -41634,7 +41741,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41634
41741
|
*/
|
41635
41742
|
async getBlockNumber() {
|
41636
41743
|
const { chain } = await this.operations.getChain();
|
41637
|
-
return bn(chain.latestBlock.
|
41744
|
+
return bn(chain.latestBlock.height, 10);
|
41638
41745
|
}
|
41639
41746
|
/**
|
41640
41747
|
* Returns the chain information.
|
@@ -41646,11 +41753,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41646
41753
|
const processedNodeInfo = {
|
41647
41754
|
maxDepth: bn(nodeInfo.maxDepth),
|
41648
41755
|
maxTx: bn(nodeInfo.maxTx),
|
41649
|
-
minGasPrice: bn(nodeInfo.minGasPrice),
|
41650
41756
|
nodeVersion: nodeInfo.nodeVersion,
|
41651
41757
|
utxoValidation: nodeInfo.utxoValidation,
|
41652
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41653
|
-
peers: nodeInfo.peers
|
41758
|
+
vmBacktrace: nodeInfo.vmBacktrace
|
41654
41759
|
};
|
41655
41760
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41656
41761
|
return processedNodeInfo;
|
@@ -41736,14 +41841,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41736
41841
|
return this.estimateTxDependencies(transactionRequest);
|
41737
41842
|
}
|
41738
41843
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41739
|
-
const { dryRun:
|
41740
|
-
encodedTransaction,
|
41844
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41845
|
+
encodedTransactions: encodedTransaction,
|
41741
41846
|
utxoValidation: utxoValidation || false
|
41742
41847
|
});
|
41743
|
-
const receipts =
|
41744
|
-
|
41745
|
-
|
41746
|
-
};
|
41848
|
+
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
41849
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41850
|
+
return { receipts, dryrunStatus: status };
|
41747
41851
|
}
|
41748
41852
|
/**
|
41749
41853
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41782,9 +41886,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41782
41886
|
* If there are missing variable outputs,
|
41783
41887
|
* `addVariableOutputs` is called on the transaction.
|
41784
41888
|
*
|
41785
|
-
* @privateRemarks
|
41786
|
-
* TODO: Investigate support for missing contract IDs
|
41787
|
-
* TODO: Add support for missing output messages
|
41788
41889
|
*
|
41789
41890
|
* @param transactionRequest - The transaction request object.
|
41790
41891
|
* @returns A promise.
|
@@ -41797,16 +41898,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41797
41898
|
missingContractIds: []
|
41798
41899
|
};
|
41799
41900
|
}
|
41800
|
-
await this.estimatePredicates(transactionRequest);
|
41801
41901
|
let receipts = [];
|
41802
41902
|
const missingContractIds = [];
|
41803
41903
|
let outputVariables = 0;
|
41904
|
+
let dryrunStatus;
|
41804
41905
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41805
|
-
const {
|
41806
|
-
|
41906
|
+
const {
|
41907
|
+
dryRun: [{ receipts: rawReceipts, status }]
|
41908
|
+
} = await this.operations.dryRun({
|
41909
|
+
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41807
41910
|
utxoValidation: false
|
41808
41911
|
});
|
41809
|
-
receipts =
|
41912
|
+
receipts = rawReceipts.map(processGqlReceipt);
|
41913
|
+
dryrunStatus = status;
|
41810
41914
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41811
41915
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41812
41916
|
if (hasMissingOutputs) {
|
@@ -41816,6 +41920,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41816
41920
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41817
41921
|
missingContractIds.push(contractId);
|
41818
41922
|
});
|
41923
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41924
|
+
transactionRequest
|
41925
|
+
});
|
41926
|
+
transactionRequest.maxFee = maxFee;
|
41819
41927
|
} else {
|
41820
41928
|
break;
|
41821
41929
|
}
|
@@ -41823,37 +41931,136 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41823
41931
|
return {
|
41824
41932
|
receipts,
|
41825
41933
|
outputVariables,
|
41826
|
-
missingContractIds
|
41934
|
+
missingContractIds,
|
41935
|
+
dryrunStatus
|
41827
41936
|
};
|
41828
41937
|
}
|
41938
|
+
/**
|
41939
|
+
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41940
|
+
*
|
41941
|
+
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41942
|
+
* further modifications are identified. The method iteratively updates these transactions
|
41943
|
+
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41944
|
+
*
|
41945
|
+
* @param transactionRequests - Array of transaction request objects.
|
41946
|
+
* @returns A promise that resolves to an array of results for each transaction.
|
41947
|
+
*/
|
41948
|
+
async estimateMultipleTxDependencies(transactionRequests) {
|
41949
|
+
const results = transactionRequests.map(() => ({
|
41950
|
+
receipts: [],
|
41951
|
+
outputVariables: 0,
|
41952
|
+
missingContractIds: [],
|
41953
|
+
dryrunStatus: void 0
|
41954
|
+
}));
|
41955
|
+
const allRequests = clone_default(transactionRequests);
|
41956
|
+
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41957
|
+
allRequests.forEach((req, index) => {
|
41958
|
+
if (req.type === TransactionType.Script) {
|
41959
|
+
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41960
|
+
}
|
41961
|
+
});
|
41962
|
+
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41963
|
+
let attempt = 0;
|
41964
|
+
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41965
|
+
const encodedTransactions = transactionsToProcess.map(
|
41966
|
+
(index) => serializedTransactionsMap.get(index)
|
41967
|
+
);
|
41968
|
+
const dryRunResults = await this.operations.dryRun({
|
41969
|
+
encodedTransactions,
|
41970
|
+
utxoValidation: false
|
41971
|
+
});
|
41972
|
+
const nextRoundTransactions = [];
|
41973
|
+
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41974
|
+
const requestIdx = transactionsToProcess[i];
|
41975
|
+
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41976
|
+
const result = results[requestIdx];
|
41977
|
+
result.receipts = rawReceipts.map(processGqlReceipt);
|
41978
|
+
result.dryrunStatus = status;
|
41979
|
+
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41980
|
+
result.receipts
|
41981
|
+
);
|
41982
|
+
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41983
|
+
const request = allRequests[requestIdx];
|
41984
|
+
if (hasMissingOutputs && request?.type === TransactionType.Script) {
|
41985
|
+
result.outputVariables += missingOutputVariables.length;
|
41986
|
+
request.addVariableOutputs(missingOutputVariables.length);
|
41987
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
41988
|
+
request.addContractInputAndOutput(Address.fromString(contractId));
|
41989
|
+
result.missingContractIds.push(contractId);
|
41990
|
+
});
|
41991
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41992
|
+
transactionRequest: request
|
41993
|
+
});
|
41994
|
+
request.maxFee = maxFee;
|
41995
|
+
serializedTransactionsMap.set(requestIdx, hexlify(request.toTransactionBytes()));
|
41996
|
+
nextRoundTransactions.push(requestIdx);
|
41997
|
+
}
|
41998
|
+
}
|
41999
|
+
transactionsToProcess = nextRoundTransactions;
|
42000
|
+
attempt += 1;
|
42001
|
+
}
|
42002
|
+
return results;
|
42003
|
+
}
|
42004
|
+
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
42005
|
+
if (estimateTxDependencies) {
|
42006
|
+
return this.estimateMultipleTxDependencies(transactionRequests);
|
42007
|
+
}
|
42008
|
+
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
42009
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42010
|
+
encodedTransactions,
|
42011
|
+
utxoValidation: utxoValidation || false
|
42012
|
+
});
|
42013
|
+
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
42014
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
42015
|
+
return { receipts, dryrunStatus: status };
|
42016
|
+
});
|
42017
|
+
return results;
|
42018
|
+
}
|
41829
42019
|
/**
|
41830
42020
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
41831
42021
|
* @param transactionRequest - The transaction request object.
|
41832
42022
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
41833
42023
|
*/
|
41834
|
-
estimateTxGasAndFee(params) {
|
42024
|
+
async estimateTxGasAndFee(params) {
|
41835
42025
|
const { transactionRequest } = params;
|
41836
|
-
|
42026
|
+
let { gasPrice } = params;
|
41837
42027
|
const chainInfo = this.getChain();
|
41838
|
-
const
|
41839
|
-
transactionRequest.gasPrice = gasPrice;
|
42028
|
+
const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
|
41840
42029
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
41841
|
-
|
42030
|
+
if (!gasPrice) {
|
42031
|
+
gasPrice = await this.estimateGasPrice(10);
|
42032
|
+
}
|
42033
|
+
const minFee = calculateGasFee({
|
42034
|
+
gasPrice: bn(gasPrice),
|
42035
|
+
gas: minGas,
|
42036
|
+
priceFactor: gasPriceFactor,
|
42037
|
+
tip: transactionRequest.tip
|
42038
|
+
}).add(1);
|
42039
|
+
let gasLimit = bn(0);
|
41842
42040
|
if (transactionRequest.type === TransactionType.Script) {
|
42041
|
+
gasLimit = transactionRequest.gasLimit;
|
41843
42042
|
if (transactionRequest.gasLimit.eq(0)) {
|
41844
42043
|
transactionRequest.gasLimit = minGas;
|
41845
42044
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
41846
42045
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
41847
42046
|
);
|
42047
|
+
gasLimit = transactionRequest.gasLimit;
|
41848
42048
|
}
|
41849
42049
|
}
|
41850
42050
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
41851
|
-
const maxFee =
|
42051
|
+
const maxFee = calculateGasFee({
|
42052
|
+
gasPrice: bn(gasPrice),
|
42053
|
+
gas: maxGas,
|
42054
|
+
priceFactor: gasPriceFactor,
|
42055
|
+
tip: transactionRequest.tip
|
42056
|
+
}).add(1);
|
41852
42057
|
return {
|
41853
42058
|
minGas,
|
41854
42059
|
minFee,
|
41855
42060
|
maxGas,
|
41856
|
-
maxFee
|
42061
|
+
maxFee,
|
42062
|
+
gasPrice,
|
42063
|
+
gasLimit
|
41857
42064
|
};
|
41858
42065
|
}
|
41859
42066
|
/**
|
@@ -41871,15 +42078,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41871
42078
|
if (estimateTxDependencies) {
|
41872
42079
|
return this.estimateTxDependencies(transactionRequest);
|
41873
42080
|
}
|
41874
|
-
const
|
41875
|
-
const { dryRun:
|
41876
|
-
|
42081
|
+
const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
|
42082
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42083
|
+
encodedTransactions,
|
41877
42084
|
utxoValidation: true
|
41878
42085
|
});
|
41879
|
-
const
|
41880
|
-
|
41881
|
-
receipts
|
41882
|
-
|
42086
|
+
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
42087
|
+
const { id, receipts, status } = dryRunStatus;
|
42088
|
+
const processedReceipts = receipts.map(processGqlReceipt);
|
42089
|
+
return { id, receipts: processedReceipts, status };
|
42090
|
+
});
|
42091
|
+
return { receipts: callResult[0].receipts };
|
41883
42092
|
}
|
41884
42093
|
/**
|
41885
42094
|
* Returns a transaction cost to enable user
|
@@ -41896,77 +42105,79 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41896
42105
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
41897
42106
|
* @returns A promise that resolves to the transaction cost object.
|
41898
42107
|
*/
|
41899
|
-
async getTransactionCost(transactionRequestLike,
|
41900
|
-
estimateTxDependencies = true,
|
41901
|
-
estimatePredicates = true,
|
41902
|
-
resourcesOwner,
|
41903
|
-
signatureCallback
|
41904
|
-
} = {}) {
|
42108
|
+
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
41905
42109
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41906
|
-
const { minGasPrice } = this.getGasConfig();
|
41907
|
-
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
41908
42110
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
41909
42111
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
41910
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
42112
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
41911
42113
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42114
|
+
txRequestClone.maxFee = bn(0);
|
41912
42115
|
if (isScriptTransaction) {
|
41913
42116
|
txRequestClone.gasLimit = bn(0);
|
41914
42117
|
}
|
41915
|
-
if (
|
41916
|
-
|
41917
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41918
|
-
}
|
41919
|
-
await this.estimatePredicates(txRequestClone);
|
42118
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
42119
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41920
42120
|
}
|
42121
|
+
const signedRequest = clone_default(txRequestClone);
|
42122
|
+
let addedSignatures = 0;
|
41921
42123
|
if (signatureCallback && isScriptTransaction) {
|
41922
|
-
|
42124
|
+
const lengthBefore = signedRequest.witnesses.length;
|
42125
|
+
await signatureCallback(signedRequest);
|
42126
|
+
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41923
42127
|
}
|
41924
|
-
|
41925
|
-
|
42128
|
+
await this.estimatePredicates(signedRequest);
|
42129
|
+
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
42130
|
+
transactionRequest: signedRequest
|
41926
42131
|
});
|
41927
42132
|
let receipts = [];
|
41928
42133
|
let missingContractIds = [];
|
41929
42134
|
let outputVariables = 0;
|
41930
42135
|
let gasUsed = bn(0);
|
41931
|
-
|
41932
|
-
|
42136
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
42137
|
+
txRequestClone.maxFee = maxFee;
|
42138
|
+
if (isScriptTransaction) {
|
42139
|
+
txRequestClone.gasLimit = gasLimit;
|
42140
|
+
if (signatureCallback) {
|
42141
|
+
await signatureCallback(txRequestClone);
|
42142
|
+
}
|
41933
42143
|
const result = await this.estimateTxDependencies(txRequestClone);
|
41934
42144
|
receipts = result.receipts;
|
41935
42145
|
outputVariables = result.outputVariables;
|
41936
42146
|
missingContractIds = result.missingContractIds;
|
41937
42147
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
41938
42148
|
txRequestClone.gasLimit = gasUsed;
|
41939
|
-
|
41940
|
-
|
41941
|
-
|
42149
|
+
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
42150
|
+
transactionRequest: txRequestClone,
|
42151
|
+
gasPrice
|
41942
42152
|
}));
|
41943
42153
|
}
|
41944
42154
|
return {
|
41945
42155
|
requiredQuantities: allQuantities,
|
41946
42156
|
receipts,
|
41947
42157
|
gasUsed,
|
41948
|
-
|
41949
|
-
gasPrice: setGasPrice,
|
42158
|
+
gasPrice,
|
41950
42159
|
minGas,
|
41951
42160
|
maxGas,
|
41952
42161
|
minFee,
|
41953
42162
|
maxFee,
|
41954
|
-
estimatedInputs: txRequestClone.inputs,
|
41955
42163
|
outputVariables,
|
41956
|
-
missingContractIds
|
42164
|
+
missingContractIds,
|
42165
|
+
addedSignatures,
|
42166
|
+
estimatedPredicates: txRequestClone.inputs
|
41957
42167
|
};
|
41958
42168
|
}
|
41959
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
42169
|
+
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
41960
42170
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41961
42171
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
41962
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42172
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
42173
|
+
quantitiesToContract
|
42174
|
+
});
|
41963
42175
|
transactionRequest.addResources(
|
41964
42176
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
41965
42177
|
);
|
41966
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41967
|
-
|
41968
|
-
|
41969
|
-
);
|
42178
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
42179
|
+
quantitiesToContract
|
42180
|
+
});
|
41970
42181
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
41971
42182
|
return {
|
41972
42183
|
resources,
|
@@ -41990,7 +42201,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41990
42201
|
assetId: coin.assetId,
|
41991
42202
|
amount: bn(coin.amount),
|
41992
42203
|
owner: Address.fromAddressOrString(coin.owner),
|
41993
|
-
maturity: bn(coin.maturity).toNumber(),
|
41994
42204
|
blockCreated: bn(coin.blockCreated),
|
41995
42205
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41996
42206
|
}));
|
@@ -42042,7 +42252,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42042
42252
|
amount: bn(coin.amount),
|
42043
42253
|
assetId: coin.assetId,
|
42044
42254
|
owner: Address.fromAddressOrString(coin.owner),
|
42045
|
-
maturity: bn(coin.maturity).toNumber(),
|
42046
42255
|
blockCreated: bn(coin.blockCreated),
|
42047
42256
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42048
42257
|
};
|
@@ -42075,7 +42284,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42075
42284
|
}
|
42076
42285
|
return {
|
42077
42286
|
id: block2.id,
|
42078
|
-
height: bn(block2.
|
42287
|
+
height: bn(block2.height),
|
42079
42288
|
time: block2.header.time,
|
42080
42289
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42081
42290
|
};
|
@@ -42090,7 +42299,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42090
42299
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42091
42300
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42092
42301
|
id: block2.id,
|
42093
|
-
height: bn(block2.
|
42302
|
+
height: bn(block2.height),
|
42094
42303
|
time: block2.header.time,
|
42095
42304
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42096
42305
|
}));
|
@@ -42117,7 +42326,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42117
42326
|
}
|
42118
42327
|
return {
|
42119
42328
|
id: block2.id,
|
42120
|
-
height: bn(block2.
|
42329
|
+
height: bn(block2.height, 10),
|
42121
42330
|
time: block2.header.time,
|
42122
42331
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42123
42332
|
transactions: block2.transactions.map(
|
@@ -42297,8 +42506,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42297
42506
|
prevRoot: messageBlockHeader.prevRoot,
|
42298
42507
|
time: messageBlockHeader.time,
|
42299
42508
|
applicationHash: messageBlockHeader.applicationHash,
|
42300
|
-
|
42301
|
-
|
42509
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount),
|
42510
|
+
messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
|
42511
|
+
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42512
|
+
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42513
|
+
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
42302
42514
|
},
|
42303
42515
|
commitBlockHeader: {
|
42304
42516
|
id: commitBlockHeader.id,
|
@@ -42309,8 +42521,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42309
42521
|
prevRoot: commitBlockHeader.prevRoot,
|
42310
42522
|
time: commitBlockHeader.time,
|
42311
42523
|
applicationHash: commitBlockHeader.applicationHash,
|
42312
|
-
|
42313
|
-
|
42524
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount),
|
42525
|
+
messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
|
42526
|
+
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42527
|
+
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42528
|
+
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
42314
42529
|
},
|
42315
42530
|
sender: Address.fromAddressOrString(sender),
|
42316
42531
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -42319,6 +42534,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42319
42534
|
data
|
42320
42535
|
};
|
42321
42536
|
}
|
42537
|
+
async getLatestGasPrice() {
|
42538
|
+
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42539
|
+
return bn(latestGasPrice.gasPrice);
|
42540
|
+
}
|
42541
|
+
async estimateGasPrice(blockHorizon) {
|
42542
|
+
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42543
|
+
blockHorizon: String(blockHorizon)
|
42544
|
+
});
|
42545
|
+
return bn(estimateGasPrice.gasPrice);
|
42546
|
+
}
|
42322
42547
|
/**
|
42323
42548
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42324
42549
|
*
|
@@ -42379,10 +42604,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42379
42604
|
arrayify(gqlTransaction.rawPayload),
|
42380
42605
|
0
|
42381
42606
|
);
|
42382
|
-
|
42607
|
+
let txReceipts = [];
|
42608
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42609
|
+
txReceipts = gqlTransaction.status.receipts;
|
42610
|
+
}
|
42611
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42383
42612
|
const {
|
42384
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42613
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42385
42614
|
} = provider.getChain();
|
42615
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42386
42616
|
const transactionInfo = assembleTransactionSummary({
|
42387
42617
|
id: gqlTransaction.id,
|
42388
42618
|
receipts,
|
@@ -42393,7 +42623,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42393
42623
|
gasPriceFactor: bn(gasPriceFactor),
|
42394
42624
|
abiMap,
|
42395
42625
|
maxInputs,
|
42396
|
-
gasCosts
|
42626
|
+
gasCosts,
|
42627
|
+
maxGasPerTx,
|
42628
|
+
gasPrice
|
42397
42629
|
});
|
42398
42630
|
return {
|
42399
42631
|
gqlTransaction,
|
@@ -42403,10 +42635,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42403
42635
|
async function getTransactionSummaryFromRequest(params) {
|
42404
42636
|
const { provider, transactionRequest, abiMap } = params;
|
42405
42637
|
const { receipts } = await provider.call(transactionRequest);
|
42406
|
-
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42638
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
|
42407
42639
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42408
42640
|
const transaction = transactionRequest.toTransaction();
|
42409
42641
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42642
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42410
42643
|
const transactionSummary = assembleTransactionSummary({
|
42411
42644
|
receipts,
|
42412
42645
|
transaction,
|
@@ -42415,7 +42648,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42415
42648
|
gasPerByte,
|
42416
42649
|
gasPriceFactor,
|
42417
42650
|
maxInputs,
|
42418
|
-
gasCosts
|
42651
|
+
gasCosts,
|
42652
|
+
maxGasPerTx,
|
42653
|
+
gasPrice
|
42419
42654
|
});
|
42420
42655
|
return transactionSummary;
|
42421
42656
|
}
|
@@ -42424,13 +42659,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42424
42659
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42425
42660
|
const { edges, pageInfo } = transactionsByOwner;
|
42426
42661
|
const {
|
42427
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42662
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42428
42663
|
} = provider.getChain();
|
42664
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42429
42665
|
const transactions = edges.map((edge) => {
|
42430
42666
|
const { node: gqlTransaction } = edge;
|
42431
|
-
const { id, rawPayload,
|
42667
|
+
const { id, rawPayload, status } = gqlTransaction;
|
42432
42668
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42433
|
-
|
42669
|
+
let txReceipts = [];
|
42670
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42671
|
+
txReceipts = gqlTransaction.status.receipts;
|
42672
|
+
}
|
42673
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42434
42674
|
const transactionSummary = assembleTransactionSummary({
|
42435
42675
|
id,
|
42436
42676
|
receipts,
|
@@ -42441,7 +42681,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42441
42681
|
gasPerByte,
|
42442
42682
|
gasPriceFactor,
|
42443
42683
|
maxInputs,
|
42444
|
-
gasCosts
|
42684
|
+
gasCosts,
|
42685
|
+
maxGasPerTx,
|
42686
|
+
gasPrice
|
42445
42687
|
});
|
42446
42688
|
const output3 = {
|
42447
42689
|
gqlTransaction,
|
@@ -42770,36 +43012,33 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42770
43012
|
* @param fee - The estimated transaction fee.
|
42771
43013
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42772
43014
|
*/
|
42773
|
-
async fund(request,
|
42774
|
-
const
|
43015
|
+
async fund(request, params) {
|
43016
|
+
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
43017
|
+
const txRequest = request;
|
43018
|
+
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42775
43019
|
amount: bn(fee),
|
42776
43020
|
assetId: BaseAssetId,
|
42777
|
-
coinQuantities
|
43021
|
+
coinQuantities: requiredQuantities
|
42778
43022
|
});
|
42779
43023
|
const quantitiesDict = {};
|
42780
|
-
|
43024
|
+
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
42781
43025
|
quantitiesDict[assetId] = {
|
42782
43026
|
required: amount,
|
42783
43027
|
owned: bn(0)
|
42784
43028
|
};
|
42785
43029
|
});
|
42786
|
-
|
42787
|
-
const cachedMessages = [];
|
42788
|
-
const owner = this.address.toB256();
|
42789
|
-
request.inputs.forEach((input) => {
|
43030
|
+
txRequest.inputs.forEach((input) => {
|
42790
43031
|
const isResource = "amount" in input;
|
42791
43032
|
if (isResource) {
|
42792
43033
|
const isCoin2 = "owner" in input;
|
42793
43034
|
if (isCoin2) {
|
42794
43035
|
const assetId = String(input.assetId);
|
42795
|
-
if (
|
43036
|
+
if (quantitiesDict[assetId]) {
|
42796
43037
|
const amount = bn(input.amount);
|
42797
43038
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42798
|
-
cachedUtxos.push(input.id);
|
42799
43039
|
}
|
42800
|
-
} else if (input.
|
43040
|
+
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42801
43041
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42802
|
-
cachedMessages.push(input.nonce);
|
42803
43042
|
}
|
42804
43043
|
}
|
42805
43044
|
});
|
@@ -42814,12 +43053,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42814
43053
|
});
|
42815
43054
|
const needsToBeFunded = missingQuantities.length;
|
42816
43055
|
if (needsToBeFunded) {
|
42817
|
-
const
|
42818
|
-
|
42819
|
-
|
42820
|
-
|
42821
|
-
|
42822
|
-
|
43056
|
+
const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
|
43057
|
+
const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
|
43058
|
+
txRequest.addResources(resources);
|
43059
|
+
}
|
43060
|
+
txRequest.shiftPredicateData();
|
43061
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43062
|
+
const requestToReestimate = clone_default(txRequest);
|
43063
|
+
if (addedSignatures) {
|
43064
|
+
Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
|
43065
|
+
}
|
43066
|
+
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43067
|
+
transactionRequest: requestToReestimate
|
43068
|
+
});
|
43069
|
+
txRequest.maxFee = maxFee;
|
43070
|
+
return txRequest;
|
42823
43071
|
}
|
42824
43072
|
/**
|
42825
43073
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -42827,28 +43075,24 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42827
43075
|
* @param destination - The address of the destination.
|
42828
43076
|
* @param amount - The amount of coins to transfer.
|
42829
43077
|
* @param assetId - The asset ID of the coins to transfer.
|
42830
|
-
* @param txParams - The transaction parameters (gasLimit,
|
43078
|
+
* @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
|
42831
43079
|
* @returns A promise that resolves to the prepared transaction request.
|
42832
43080
|
*/
|
42833
43081
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42834
|
-
const
|
42835
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42836
|
-
const request = new ScriptTransactionRequest(params);
|
43082
|
+
const request = new ScriptTransactionRequest(txParams);
|
42837
43083
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
42838
|
-
const
|
43084
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
42839
43085
|
estimateTxDependencies: true,
|
42840
43086
|
resourcesOwner: this
|
42841
43087
|
});
|
42842
|
-
|
42843
|
-
|
42844
|
-
|
42845
|
-
|
42846
|
-
gasPrice: request.gasPrice,
|
42847
|
-
gasLimit: request.gasLimit,
|
42848
|
-
minGasPrice
|
43088
|
+
this.validateGasLimitAndMaxFee({
|
43089
|
+
gasUsed: txCost.gasUsed,
|
43090
|
+
maxFee: txCost.maxFee,
|
43091
|
+
txParams
|
42849
43092
|
});
|
42850
|
-
|
42851
|
-
request.
|
43093
|
+
request.gasLimit = txCost.gasUsed;
|
43094
|
+
request.maxFee = txCost.maxFee;
|
43095
|
+
await this.fund(request, txCost);
|
42852
43096
|
return request;
|
42853
43097
|
}
|
42854
43098
|
/**
|
@@ -42887,31 +43131,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42887
43131
|
);
|
42888
43132
|
}
|
42889
43133
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42890
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42891
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42892
43134
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42893
43135
|
hexlifiedContractId: contractAddress.toB256(),
|
42894
43136
|
amountToTransfer: bn(amount),
|
42895
43137
|
assetId
|
42896
43138
|
});
|
42897
43139
|
const request = new ScriptTransactionRequest({
|
42898
|
-
...
|
43140
|
+
...txParams,
|
42899
43141
|
script,
|
42900
43142
|
scriptData
|
42901
43143
|
});
|
42902
43144
|
request.addContractInputAndOutput(contractAddress);
|
42903
|
-
const
|
42904
|
-
|
42905
|
-
[{ amount: bn(amount), assetId: String(assetId) }]
|
42906
|
-
);
|
42907
|
-
|
42908
|
-
|
42909
|
-
|
42910
|
-
|
42911
|
-
gasLimit: request.gasLimit,
|
42912
|
-
minGasPrice
|
43145
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
43146
|
+
resourcesOwner: this,
|
43147
|
+
quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
|
43148
|
+
});
|
43149
|
+
this.validateGasLimitAndMaxFee({
|
43150
|
+
gasUsed: txCost.gasUsed,
|
43151
|
+
maxFee: txCost.maxFee,
|
43152
|
+
txParams
|
42913
43153
|
});
|
42914
|
-
|
43154
|
+
request.gasLimit = txCost.gasUsed;
|
43155
|
+
request.maxFee = txCost.maxFee;
|
43156
|
+
await this.fund(request, txCost);
|
42915
43157
|
return this.sendTransaction(request);
|
42916
43158
|
}
|
42917
43159
|
/**
|
@@ -42923,7 +43165,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42923
43165
|
* @returns A promise that resolves to the transaction response.
|
42924
43166
|
*/
|
42925
43167
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42926
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42927
43168
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42928
43169
|
const recipientDataArray = arrayify(
|
42929
43170
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42936,21 +43177,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42936
43177
|
...recipientDataArray,
|
42937
43178
|
...amountDataArray
|
42938
43179
|
]);
|
42939
|
-
const params = { script,
|
43180
|
+
const params = { script, ...txParams };
|
42940
43181
|
const request = new ScriptTransactionRequest(params);
|
42941
|
-
const
|
42942
|
-
const
|
42943
|
-
|
42944
|
-
|
42945
|
-
|
42946
|
-
|
42947
|
-
this.validateGas({
|
42948
|
-
gasUsed,
|
42949
|
-
gasPrice: request.gasPrice,
|
42950
|
-
gasLimit: request.gasLimit,
|
42951
|
-
minGasPrice
|
43182
|
+
const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
|
43183
|
+
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
43184
|
+
this.validateGasLimitAndMaxFee({
|
43185
|
+
gasUsed: txCost.gasUsed,
|
43186
|
+
maxFee: txCost.maxFee,
|
43187
|
+
txParams
|
42952
43188
|
});
|
42953
|
-
|
43189
|
+
request.maxFee = txCost.maxFee;
|
43190
|
+
request.gasLimit = txCost.gasUsed;
|
43191
|
+
await this.fund(request, txCost);
|
42954
43192
|
return this.sendTransaction(request);
|
42955
43193
|
}
|
42956
43194
|
async signMessage(message) {
|
@@ -43008,22 +43246,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43008
43246
|
}
|
43009
43247
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43010
43248
|
}
|
43011
|
-
|
43249
|
+
validateGasLimitAndMaxFee({
|
43250
|
+
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
|
43012
43251
|
gasUsed,
|
43013
|
-
|
43014
|
-
gasLimit,
|
43015
|
-
minGasPrice
|
43252
|
+
maxFee
|
43016
43253
|
}) {
|
43017
|
-
if (
|
43254
|
+
if (isDefined(setGasLimit) && gasUsed.gt(setGasLimit)) {
|
43018
43255
|
throw new FuelError(
|
43019
|
-
ErrorCode.
|
43020
|
-
`Gas
|
43256
|
+
ErrorCode.GAS_LIMIT_TOO_LOW,
|
43257
|
+
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
43021
43258
|
);
|
43022
43259
|
}
|
43023
|
-
if (
|
43260
|
+
if (isDefined(setMaxFee) && maxFee.gt(setMaxFee)) {
|
43024
43261
|
throw new FuelError(
|
43025
|
-
ErrorCode.
|
43026
|
-
`
|
43262
|
+
ErrorCode.MAX_FEE_TOO_LOW,
|
43263
|
+
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
43027
43264
|
);
|
43028
43265
|
}
|
43029
43266
|
}
|
@@ -44608,7 +44845,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44608
44845
|
* @param transactionRequestLike - The transaction request to send.
|
44609
44846
|
* @returns A promise that resolves to the TransactionResponse object.
|
44610
44847
|
*/
|
44611
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44848
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
44612
44849
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44613
44850
|
if (estimateTxDependencies) {
|
44614
44851
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -47886,8 +48123,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47886
48123
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
47887
48124
|
request.inputs?.forEach((input) => {
|
47888
48125
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
47889
|
-
input.predicate = this.bytes;
|
47890
|
-
input.predicateData = this.getPredicateData(policies.length);
|
48126
|
+
input.predicate = hexlify(this.bytes);
|
48127
|
+
input.predicateData = hexlify(this.getPredicateData(policies.length));
|
47891
48128
|
}
|
47892
48129
|
});
|
47893
48130
|
return request;
|
@@ -47902,8 +48139,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47902
48139
|
* @returns A promise that resolves to the prepared transaction request.
|
47903
48140
|
*/
|
47904
48141
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
47905
|
-
|
47906
|
-
return this.populateTransactionPredicateData(request);
|
48142
|
+
return super.createTransfer(destination, amount, assetId, txParams);
|
47907
48143
|
}
|
47908
48144
|
/**
|
47909
48145
|
* Sends a transaction with the populated predicate data.
|
@@ -47911,9 +48147,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47911
48147
|
* @param transactionRequestLike - The transaction request-like object.
|
47912
48148
|
* @returns A promise that resolves to the transaction response.
|
47913
48149
|
*/
|
47914
|
-
sendTransaction(transactionRequestLike
|
47915
|
-
const transactionRequest =
|
47916
|
-
return super.sendTransaction(transactionRequest,
|
48150
|
+
sendTransaction(transactionRequestLike) {
|
48151
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48152
|
+
return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
|
47917
48153
|
}
|
47918
48154
|
/**
|
47919
48155
|
* Simulates a transaction with the populated predicate data.
|
@@ -47922,8 +48158,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47922
48158
|
* @returns A promise that resolves to the call result.
|
47923
48159
|
*/
|
47924
48160
|
simulateTransaction(transactionRequestLike) {
|
47925
|
-
const transactionRequest =
|
47926
|
-
return super.simulateTransaction(transactionRequest);
|
48161
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48162
|
+
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
47927
48163
|
}
|
47928
48164
|
getPredicateData(policiesLength) {
|
47929
48165
|
if (!this.predicateData.length) {
|
@@ -47969,6 +48205,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47969
48205
|
predicateInterface: abiInterface
|
47970
48206
|
};
|
47971
48207
|
}
|
48208
|
+
/**
|
48209
|
+
* Retrieves resources satisfying the spend query for the account.
|
48210
|
+
*
|
48211
|
+
* @param quantities - IDs of coins to exclude.
|
48212
|
+
* @param excludedIds - IDs of resources to be excluded from the query.
|
48213
|
+
* @returns A promise that resolves to an array of Resources.
|
48214
|
+
*/
|
48215
|
+
async getResourcesToSpend(quantities, excludedIds) {
|
48216
|
+
const resources = await this.provider.getResourcesToSpend(
|
48217
|
+
this.address,
|
48218
|
+
quantities,
|
48219
|
+
excludedIds
|
48220
|
+
);
|
48221
|
+
return resources.map((resource) => ({
|
48222
|
+
...resource,
|
48223
|
+
predicate: hexlify(this.bytes),
|
48224
|
+
padPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48225
|
+
}));
|
48226
|
+
}
|
47972
48227
|
/**
|
47973
48228
|
* Sets the configurable constants for the predicate.
|
47974
48229
|
*
|