@fuel-ts/account 0.0.0-rc-2021-20240418170033 → 0.0.0-rc-2037-20240418195040
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 +4 -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 +596 -797
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +633 -825
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +451 -648
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +18 -11
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +329 -911
- 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 +1 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +1 -6
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +27 -37
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +10 -0
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -0
- package/dist/providers/transaction-request/index.d.ts +1 -0
- package/dist/providers/transaction-request/index.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 +7 -6
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -3
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +2 -8
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/index.d.ts +1 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/resources.d.ts +4 -0
- package/dist/test-utils/resources.d.ts.map +1 -0
- package/dist/test-utils/seedTestWallet.d.ts +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils/transactionRequest.d.ts +5 -0
- package/dist/test-utils/transactionRequest.d.ts.map +1 -0
- package/dist/test-utils.global.js +1085 -1547
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +608 -804
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +442 -641
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +16 -16
package/dist/index.global.js
CHANGED
@@ -289,7 +289,7 @@
|
|
289
289
|
}
|
290
290
|
return num !== null && typeof num === "object" && num.constructor.wordSize === BN2.wordSize && Array.isArray(num.words);
|
291
291
|
};
|
292
|
-
BN2.max = function
|
292
|
+
BN2.max = function max2(left, right) {
|
293
293
|
if (left.cmp(right) > 0)
|
294
294
|
return left;
|
295
295
|
return right;
|
@@ -5113,7 +5113,7 @@
|
|
5113
5113
|
function isBlob(obj) {
|
5114
5114
|
return typeof obj === "object" && typeof obj.arrayBuffer === "function" && typeof obj.type === "string" && typeof obj.stream === "function" && typeof obj.constructor === "function" && typeof obj.constructor.name === "string" && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
|
5115
5115
|
}
|
5116
|
-
function
|
5116
|
+
function clone(instance) {
|
5117
5117
|
let p1, p2;
|
5118
5118
|
let body = instance.body;
|
5119
5119
|
if (instance.bodyUsed) {
|
@@ -6047,7 +6047,7 @@
|
|
6047
6047
|
* @return Response
|
6048
6048
|
*/
|
6049
6049
|
clone() {
|
6050
|
-
return new Response2(
|
6050
|
+
return new Response2(clone(this), {
|
6051
6051
|
url: this.url,
|
6052
6052
|
status: this.status,
|
6053
6053
|
statusText: this.statusText,
|
@@ -6097,7 +6097,7 @@
|
|
6097
6097
|
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
6098
6098
|
throw new TypeError("Request with GET/HEAD method cannot have body");
|
6099
6099
|
}
|
6100
|
-
let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ?
|
6100
|
+
let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
|
6101
6101
|
Body.call(this, inputBody, {
|
6102
6102
|
timeout: init.timeout || input.timeout || 0,
|
6103
6103
|
size: init.size || input.size || 0
|
@@ -28952,8 +28952,8 @@ spurious results.`);
|
|
28952
28952
|
// ../versions/dist/index.mjs
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
|
-
FORC: "0.
|
28956
|
-
FUEL_CORE: "0.
|
28955
|
+
FORC: "0.49.3",
|
28956
|
+
FUEL_CORE: "0.22.1",
|
28957
28957
|
FUELS: "0.81.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -31495,182 +31495,32 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31495
31495
|
function toBytes3(value, bytesPadding) {
|
31496
31496
|
return bn(value).toBytes(bytesPadding);
|
31497
31497
|
}
|
31498
|
-
|
31499
|
-
|
31500
|
-
function _isPlaceholder(a) {
|
31501
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31502
|
-
}
|
31503
|
-
|
31504
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31505
|
-
function _curry1(fn) {
|
31506
|
-
return function f1(a) {
|
31507
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31508
|
-
return f1;
|
31509
|
-
} else {
|
31510
|
-
return fn.apply(this, arguments);
|
31511
|
-
}
|
31512
|
-
};
|
31513
|
-
}
|
31514
|
-
|
31515
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31516
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
31517
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31518
|
-
};
|
31519
|
-
|
31520
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31521
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31522
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31523
|
-
});
|
31524
|
-
var type_default = type;
|
31525
|
-
|
31526
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31527
|
-
var pad = function pad2(n) {
|
31528
|
-
return (n < 10 ? "0" : "") + n;
|
31529
|
-
};
|
31530
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31531
|
-
return d.toISOString();
|
31532
|
-
} : function _toISOString3(d) {
|
31533
|
-
return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
|
31534
|
-
};
|
31535
|
-
|
31536
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31537
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31538
|
-
return n << 0 === n;
|
31539
|
-
};
|
31540
|
-
|
31541
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31542
|
-
function _cloneRegExp(pattern) {
|
31543
|
-
return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "") + (pattern.dotAll ? "s" : ""));
|
31544
|
-
}
|
31545
|
-
|
31546
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31547
|
-
function _clone(value, deep, map) {
|
31548
|
-
map || (map = new _ObjectMap());
|
31549
|
-
if (_isPrimitive(value)) {
|
31550
|
-
return value;
|
31551
|
-
}
|
31552
|
-
var copy = function copy2(copiedValue) {
|
31553
|
-
var cachedCopy = map.get(value);
|
31554
|
-
if (cachedCopy) {
|
31555
|
-
return cachedCopy;
|
31556
|
-
}
|
31557
|
-
map.set(value, copiedValue);
|
31558
|
-
for (var key in value) {
|
31559
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31560
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31561
|
-
}
|
31562
|
-
}
|
31563
|
-
return copiedValue;
|
31564
|
-
};
|
31565
|
-
switch (type_default(value)) {
|
31566
|
-
case "Object":
|
31567
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
31568
|
-
case "Array":
|
31569
|
-
return copy([]);
|
31570
|
-
case "Date":
|
31571
|
-
return new Date(value.valueOf());
|
31572
|
-
case "RegExp":
|
31573
|
-
return _cloneRegExp(value);
|
31574
|
-
case "Int8Array":
|
31575
|
-
case "Uint8Array":
|
31576
|
-
case "Uint8ClampedArray":
|
31577
|
-
case "Int16Array":
|
31578
|
-
case "Uint16Array":
|
31579
|
-
case "Int32Array":
|
31580
|
-
case "Uint32Array":
|
31581
|
-
case "Float32Array":
|
31582
|
-
case "Float64Array":
|
31583
|
-
case "BigInt64Array":
|
31584
|
-
case "BigUint64Array":
|
31585
|
-
return value.slice();
|
31586
|
-
default:
|
31587
|
-
return value;
|
31588
|
-
}
|
31589
|
-
}
|
31590
|
-
function _isPrimitive(param) {
|
31591
|
-
var type3 = typeof param;
|
31592
|
-
return param == null || type3 != "object" && type3 != "function";
|
31498
|
+
function max(...numbers) {
|
31499
|
+
return numbers.reduce((prev, cur) => bn(cur).gt(prev) ? bn(cur) : prev, bn(0));
|
31593
31500
|
}
|
31594
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
31595
|
-
function _ObjectMap2() {
|
31596
|
-
this.map = {};
|
31597
|
-
this.length = 0;
|
31598
|
-
}
|
31599
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
31600
|
-
const hashedKey = this.hash(key);
|
31601
|
-
let bucket = this.map[hashedKey];
|
31602
|
-
if (!bucket) {
|
31603
|
-
this.map[hashedKey] = bucket = [];
|
31604
|
-
}
|
31605
|
-
bucket.push([key, value]);
|
31606
|
-
this.length += 1;
|
31607
|
-
};
|
31608
|
-
_ObjectMap2.prototype.hash = function(key) {
|
31609
|
-
let hashedKey = [];
|
31610
|
-
for (var value in key) {
|
31611
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31612
|
-
}
|
31613
|
-
return hashedKey.join();
|
31614
|
-
};
|
31615
|
-
_ObjectMap2.prototype.get = function(key) {
|
31616
|
-
if (this.length <= 180) {
|
31617
|
-
for (const p in this.map) {
|
31618
|
-
const bucket2 = this.map[p];
|
31619
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
31620
|
-
const element = bucket2[i];
|
31621
|
-
if (element[0] === key) {
|
31622
|
-
return element[1];
|
31623
|
-
}
|
31624
|
-
}
|
31625
|
-
}
|
31626
|
-
return;
|
31627
|
-
}
|
31628
|
-
const hashedKey = this.hash(key);
|
31629
|
-
const bucket = this.map[hashedKey];
|
31630
|
-
if (!bucket) {
|
31631
|
-
return;
|
31632
|
-
}
|
31633
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
31634
|
-
const element = bucket[i];
|
31635
|
-
if (element[0] === key) {
|
31636
|
-
return element[1];
|
31637
|
-
}
|
31638
|
-
}
|
31639
|
-
};
|
31640
|
-
return _ObjectMap2;
|
31641
|
-
}();
|
31642
|
-
|
31643
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31644
|
-
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31645
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31646
|
-
});
|
31647
|
-
var clone_default = clone;
|
31648
|
-
|
31649
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31650
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31651
31501
|
|
31652
31502
|
// src/providers/coin-quantity.ts
|
31653
31503
|
var coinQuantityfy = (coinQuantityLike) => {
|
31654
31504
|
let assetId;
|
31655
31505
|
let amount;
|
31656
|
-
let
|
31506
|
+
let max2;
|
31657
31507
|
if (Array.isArray(coinQuantityLike)) {
|
31658
31508
|
amount = coinQuantityLike[0];
|
31659
31509
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31660
|
-
|
31510
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
31661
31511
|
} else {
|
31662
31512
|
amount = coinQuantityLike.amount;
|
31663
31513
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31664
|
-
|
31514
|
+
max2 = coinQuantityLike.max ?? void 0;
|
31665
31515
|
}
|
31666
31516
|
const bnAmount = bn(amount);
|
31667
31517
|
return {
|
31668
31518
|
assetId: hexlify(assetId),
|
31669
31519
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31670
|
-
max:
|
31520
|
+
max: max2 ? bn(max2) : void 0
|
31671
31521
|
};
|
31672
31522
|
};
|
31673
|
-
var
|
31523
|
+
var addAmountToAsset = (params) => {
|
31674
31524
|
const { amount, assetId } = params;
|
31675
31525
|
const coinQuantities = [...params.coinQuantities];
|
31676
31526
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31755,7 +31605,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31755
31605
|
var ENCODING_V1 = "1";
|
31756
31606
|
var WORD_SIZE = 8;
|
31757
31607
|
var BYTES_32 = 32;
|
31758
|
-
var UTXO_ID_LEN = BYTES_32 +
|
31608
|
+
var UTXO_ID_LEN = BYTES_32 + 1;
|
31759
31609
|
var ASSET_ID_LEN = BYTES_32;
|
31760
31610
|
var ADDRESS_LEN = BYTES_32;
|
31761
31611
|
var NONCE_LEN = BYTES_32;
|
@@ -31763,9 +31613,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31763
31613
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31764
31614
|
var MAX_BYTES = 2 ** 32 - 1;
|
31765
31615
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31766
|
-
|
31616
|
+
WORD_SIZE + // Tx size
|
31767
31617
|
// Asset ID/Balance coin input pairs
|
31768
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE)
|
31618
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31769
31619
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31770
31620
|
WORD_SIZE + // Gas limit
|
31771
31621
|
WORD_SIZE + // Script size
|
@@ -31783,6 +31633,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31783
31633
|
ASSET_ID_LEN + // Asset id
|
31784
31634
|
TX_POINTER_LEN + // TxPointer
|
31785
31635
|
WORD_SIZE + // Witnesses index
|
31636
|
+
WORD_SIZE + // Maturity
|
31786
31637
|
WORD_SIZE + // Predicate size
|
31787
31638
|
WORD_SIZE + // Predicate data size
|
31788
31639
|
WORD_SIZE;
|
@@ -32104,7 +31955,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32104
31955
|
constructor(name, coders) {
|
32105
31956
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32106
31957
|
const encodedValueSize = Object.values(coders).reduce(
|
32107
|
-
(
|
31958
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32108
31959
|
0
|
32109
31960
|
);
|
32110
31961
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32808,7 +32659,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32808
32659
|
constructor(name, coders) {
|
32809
32660
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32810
32661
|
const encodedValueSize = Object.values(coders).reduce(
|
32811
|
-
(
|
32662
|
+
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32812
32663
|
0
|
32813
32664
|
);
|
32814
32665
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33520,19 +33371,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33520
33371
|
encode(value) {
|
33521
33372
|
const parts = [];
|
33522
33373
|
parts.push(new B256Coder().encode(value.txID));
|
33523
|
-
parts.push(new NumberCoder("
|
33374
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33524
33375
|
parts.push(new B256Coder().encode(value.owner));
|
33525
33376
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33526
33377
|
parts.push(new B256Coder().encode(value.assetId));
|
33527
33378
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33528
|
-
parts.push(new NumberCoder("
|
33379
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33380
|
+
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33529
33381
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33530
|
-
parts.push(new
|
33531
|
-
parts.push(new
|
33532
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33533
|
-
parts.push(
|
33534
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33535
|
-
);
|
33382
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33383
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33384
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33385
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33536
33386
|
return concat(parts);
|
33537
33387
|
}
|
33538
33388
|
decode(data, offset) {
|
@@ -33540,7 +33390,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33540
33390
|
let o = offset;
|
33541
33391
|
[decoded, o] = new B256Coder().decode(data, o);
|
33542
33392
|
const txID = decoded;
|
33543
|
-
[decoded, o] = new NumberCoder("
|
33393
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33544
33394
|
const outputIndex = decoded;
|
33545
33395
|
[decoded, o] = new B256Coder().decode(data, o);
|
33546
33396
|
const owner = decoded;
|
@@ -33550,17 +33400,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33550
33400
|
const assetId = decoded;
|
33551
33401
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33552
33402
|
const txPointer = decoded;
|
33553
|
-
[decoded, o] = new NumberCoder("
|
33403
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33554
33404
|
const witnessIndex = Number(decoded);
|
33405
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33406
|
+
const maturity = decoded;
|
33555
33407
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33556
33408
|
const predicateGasUsed = decoded;
|
33557
|
-
[decoded, o] = new
|
33409
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33558
33410
|
const predicateLength = decoded;
|
33559
|
-
[decoded, o] = new
|
33411
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33560
33412
|
const predicateDataLength = decoded;
|
33561
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33413
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33562
33414
|
const predicate = decoded;
|
33563
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33415
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33564
33416
|
const predicateData = decoded;
|
33565
33417
|
return [
|
33566
33418
|
{
|
@@ -33572,6 +33424,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33572
33424
|
assetId,
|
33573
33425
|
txPointer,
|
33574
33426
|
witnessIndex,
|
33427
|
+
maturity,
|
33575
33428
|
predicateGasUsed,
|
33576
33429
|
predicateLength,
|
33577
33430
|
predicateDataLength,
|
@@ -33589,7 +33442,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33589
33442
|
encode(value) {
|
33590
33443
|
const parts = [];
|
33591
33444
|
parts.push(new B256Coder().encode(value.txID));
|
33592
|
-
parts.push(new NumberCoder("
|
33445
|
+
parts.push(new NumberCoder("u8").encode(value.outputIndex));
|
33593
33446
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33594
33447
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33595
33448
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33601,7 +33454,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33601
33454
|
let o = offset;
|
33602
33455
|
[decoded, o] = new B256Coder().decode(data, o);
|
33603
33456
|
const txID = decoded;
|
33604
|
-
[decoded, o] = new NumberCoder("
|
33457
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33605
33458
|
const outputIndex = decoded;
|
33606
33459
|
[decoded, o] = new B256Coder().decode(data, o);
|
33607
33460
|
const balanceRoot = decoded;
|
@@ -33650,16 +33503,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33650
33503
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33651
33504
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33652
33505
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33653
|
-
parts.push(new NumberCoder("
|
33506
|
+
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33654
33507
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33655
|
-
parts.push(new
|
33656
|
-
parts.push(new
|
33657
|
-
parts.push(new
|
33508
|
+
parts.push(new NumberCoder("u32").encode(data.length));
|
33509
|
+
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33510
|
+
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
33658
33511
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33659
|
-
parts.push(new ByteArrayCoder(value.predicateLength
|
33660
|
-
parts.push(
|
33661
|
-
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33662
|
-
);
|
33512
|
+
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33513
|
+
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
33663
33514
|
return concat(parts);
|
33664
33515
|
}
|
33665
33516
|
static decodeData(messageData) {
|
@@ -33679,21 +33530,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33679
33530
|
const amount = decoded;
|
33680
33531
|
[decoded, o] = new B256Coder().decode(data, o);
|
33681
33532
|
const nonce = decoded;
|
33682
|
-
[decoded, o] = new NumberCoder("
|
33533
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33683
33534
|
const witnessIndex = Number(decoded);
|
33684
33535
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33685
33536
|
const predicateGasUsed = decoded;
|
33686
33537
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33687
33538
|
const dataLength2 = decoded;
|
33688
|
-
[decoded, o] = new
|
33539
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33689
33540
|
const predicateLength = decoded;
|
33690
|
-
[decoded, o] = new
|
33541
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33691
33542
|
const predicateDataLength = decoded;
|
33692
33543
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33693
33544
|
const messageData = decoded;
|
33694
|
-
[decoded, o] = new ByteArrayCoder(predicateLength
|
33545
|
+
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33695
33546
|
const predicate = decoded;
|
33696
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength
|
33547
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33697
33548
|
const predicateData = decoded;
|
33698
33549
|
return [
|
33699
33550
|
{
|
@@ -34005,7 +33856,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34005
33856
|
}
|
34006
33857
|
};
|
34007
33858
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
34008
|
-
PolicyType2[PolicyType2["
|
33859
|
+
PolicyType2[PolicyType2["GasPrice"] = 1] = "GasPrice";
|
34009
33860
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
34010
33861
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
34011
33862
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -34053,9 +33904,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34053
33904
|
let o = offset;
|
34054
33905
|
const policies = [];
|
34055
33906
|
if (policyTypes & 1) {
|
34056
|
-
const [
|
33907
|
+
const [gasPrice, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
34057
33908
|
o = nextOffset;
|
34058
|
-
policies.push({ type: 1, data:
|
33909
|
+
policies.push({ type: 1, data: gasPrice });
|
34059
33910
|
}
|
34060
33911
|
if (policyTypes & 2) {
|
34061
33912
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34287,15 +34138,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34287
34138
|
encode(value) {
|
34288
34139
|
const parts = [];
|
34289
34140
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34290
|
-
parts.push(new
|
34291
|
-
parts.push(new
|
34292
|
-
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34141
|
+
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34142
|
+
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34293
34143
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34294
|
-
parts.push(new NumberCoder("
|
34295
|
-
parts.push(new NumberCoder("
|
34296
|
-
parts.push(new NumberCoder("
|
34297
|
-
parts.push(new
|
34298
|
-
parts.push(new ByteArrayCoder(value.
|
34144
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34145
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34146
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34147
|
+
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34148
|
+
parts.push(new ByteArrayCoder(value.scriptLength).encode(value.script));
|
34149
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength).encode(value.scriptData));
|
34299
34150
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34300
34151
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34301
34152
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34307,23 +34158,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34307
34158
|
let o = offset;
|
34308
34159
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34309
34160
|
const scriptGasLimit = decoded;
|
34310
|
-
[decoded, o] = new
|
34311
|
-
const receiptsRoot = decoded;
|
34312
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34161
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34313
34162
|
const scriptLength = decoded;
|
34314
|
-
[decoded, o] = new
|
34163
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34315
34164
|
const scriptDataLength = decoded;
|
34316
34165
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34317
34166
|
const policyTypes = decoded;
|
34318
|
-
[decoded, o] = new NumberCoder("
|
34167
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34319
34168
|
const inputsCount = decoded;
|
34320
|
-
[decoded, o] = new NumberCoder("
|
34169
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34321
34170
|
const outputsCount = decoded;
|
34322
|
-
[decoded, o] = new NumberCoder("
|
34171
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34323
34172
|
const witnessesCount = decoded;
|
34324
|
-
[decoded, o] = new
|
34173
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34174
|
+
const receiptsRoot = decoded;
|
34175
|
+
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34325
34176
|
const script = decoded;
|
34326
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength
|
34177
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34327
34178
|
const scriptData = decoded;
|
34328
34179
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34329
34180
|
const policies = decoded;
|
@@ -34361,19 +34212,18 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34361
34212
|
}
|
34362
34213
|
encode(value) {
|
34363
34214
|
const parts = [];
|
34364
|
-
parts.push(new NumberCoder("
|
34365
|
-
parts.push(new
|
34366
|
-
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34215
|
+
parts.push(new NumberCoder("u32").encode(value.bytecodeLength));
|
34216
|
+
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34367
34217
|
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34368
|
-
parts.push(new NumberCoder("u16").encode(value.
|
34369
|
-
parts.push(new NumberCoder("
|
34370
|
-
parts.push(new NumberCoder("
|
34218
|
+
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
34219
|
+
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34220
|
+
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34221
|
+
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34222
|
+
parts.push(new B256Coder().encode(value.salt));
|
34223
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34371
34224
|
parts.push(
|
34372
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount
|
34373
|
-
value.storageSlots
|
34374
|
-
)
|
34225
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(value.storageSlots)
|
34375
34226
|
);
|
34376
|
-
parts.push(new PoliciesCoder().encode(value.policies));
|
34377
34227
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34378
34228
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34379
34229
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34382,27 +34232,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34382
34232
|
decode(data, offset) {
|
34383
34233
|
let decoded;
|
34384
34234
|
let o = offset;
|
34385
|
-
[decoded, o] = new NumberCoder("
|
34235
|
+
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34236
|
+
const bytecodeLength = decoded;
|
34237
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34386
34238
|
const bytecodeWitnessIndex = decoded;
|
34387
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
34388
|
-
const salt = decoded;
|
34389
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34390
|
-
const storageSlotsCount = decoded;
|
34391
34239
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34392
34240
|
const policyTypes = decoded;
|
34393
34241
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34242
|
+
const storageSlotsCount = decoded;
|
34243
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34394
34244
|
const inputsCount = decoded;
|
34395
|
-
[decoded, o] = new NumberCoder("
|
34245
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34396
34246
|
const outputsCount = decoded;
|
34397
|
-
[decoded, o] = new NumberCoder("
|
34247
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34398
34248
|
const witnessesCount = decoded;
|
34399
|
-
[decoded, o] = new
|
34400
|
-
|
34401
|
-
o
|
34402
|
-
);
|
34403
|
-
const storageSlots = decoded;
|
34249
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34250
|
+
const salt = decoded;
|
34404
34251
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34405
34252
|
const policies = decoded;
|
34253
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34254
|
+
const storageSlots = decoded;
|
34406
34255
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34407
34256
|
const inputs = decoded;
|
34408
34257
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34412,6 +34261,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34412
34261
|
return [
|
34413
34262
|
{
|
34414
34263
|
type: 1,
|
34264
|
+
bytecodeLength,
|
34415
34265
|
bytecodeWitnessIndex,
|
34416
34266
|
policyTypes,
|
34417
34267
|
storageSlotsCount,
|
@@ -34440,7 +34290,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34440
34290
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34441
34291
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34442
34292
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34443
|
-
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34444
34293
|
return concat(parts);
|
34445
34294
|
}
|
34446
34295
|
decode(data, offset) {
|
@@ -34456,8 +34305,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34456
34305
|
const mintAmount = decoded;
|
34457
34306
|
[decoded, o] = new B256Coder().decode(data, o);
|
34458
34307
|
const mintAssetId = decoded;
|
34459
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34460
|
-
const gasPrice = decoded;
|
34461
34308
|
return [
|
34462
34309
|
{
|
34463
34310
|
type: 2,
|
@@ -34465,8 +34312,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34465
34312
|
inputContract,
|
34466
34313
|
outputContract,
|
34467
34314
|
mintAmount,
|
34468
|
-
mintAssetId
|
34469
|
-
gasPrice
|
34315
|
+
mintAssetId
|
34470
34316
|
},
|
34471
34317
|
o
|
34472
34318
|
];
|
@@ -34773,6 +34619,159 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34773
34619
|
// src/providers/provider.ts
|
34774
34620
|
var import_graphql_request = __toESM(require_dist2());
|
34775
34621
|
|
34622
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34623
|
+
function _isPlaceholder(a) {
|
34624
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34625
|
+
}
|
34626
|
+
|
34627
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34628
|
+
function _curry1(fn) {
|
34629
|
+
return function f1(a) {
|
34630
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34631
|
+
return f1;
|
34632
|
+
} else {
|
34633
|
+
return fn.apply(this, arguments);
|
34634
|
+
}
|
34635
|
+
};
|
34636
|
+
}
|
34637
|
+
|
34638
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34639
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
34640
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34641
|
+
};
|
34642
|
+
|
34643
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34644
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34645
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34646
|
+
});
|
34647
|
+
var type_default = type;
|
34648
|
+
|
34649
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34650
|
+
var pad = function pad2(n) {
|
34651
|
+
return (n < 10 ? "0" : "") + n;
|
34652
|
+
};
|
34653
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34654
|
+
return d.toISOString();
|
34655
|
+
} : function _toISOString3(d) {
|
34656
|
+
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";
|
34657
|
+
};
|
34658
|
+
|
34659
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34660
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34661
|
+
return n << 0 === n;
|
34662
|
+
};
|
34663
|
+
|
34664
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34665
|
+
function _cloneRegExp(pattern) {
|
34666
|
+
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" : ""));
|
34667
|
+
}
|
34668
|
+
|
34669
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34670
|
+
function _clone(value, deep, map) {
|
34671
|
+
map || (map = new _ObjectMap());
|
34672
|
+
if (_isPrimitive(value)) {
|
34673
|
+
return value;
|
34674
|
+
}
|
34675
|
+
var copy = function copy2(copiedValue) {
|
34676
|
+
var cachedCopy = map.get(value);
|
34677
|
+
if (cachedCopy) {
|
34678
|
+
return cachedCopy;
|
34679
|
+
}
|
34680
|
+
map.set(value, copiedValue);
|
34681
|
+
for (var key in value) {
|
34682
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34683
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34684
|
+
}
|
34685
|
+
}
|
34686
|
+
return copiedValue;
|
34687
|
+
};
|
34688
|
+
switch (type_default(value)) {
|
34689
|
+
case "Object":
|
34690
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
34691
|
+
case "Array":
|
34692
|
+
return copy([]);
|
34693
|
+
case "Date":
|
34694
|
+
return new Date(value.valueOf());
|
34695
|
+
case "RegExp":
|
34696
|
+
return _cloneRegExp(value);
|
34697
|
+
case "Int8Array":
|
34698
|
+
case "Uint8Array":
|
34699
|
+
case "Uint8ClampedArray":
|
34700
|
+
case "Int16Array":
|
34701
|
+
case "Uint16Array":
|
34702
|
+
case "Int32Array":
|
34703
|
+
case "Uint32Array":
|
34704
|
+
case "Float32Array":
|
34705
|
+
case "Float64Array":
|
34706
|
+
case "BigInt64Array":
|
34707
|
+
case "BigUint64Array":
|
34708
|
+
return value.slice();
|
34709
|
+
default:
|
34710
|
+
return value;
|
34711
|
+
}
|
34712
|
+
}
|
34713
|
+
function _isPrimitive(param) {
|
34714
|
+
var type3 = typeof param;
|
34715
|
+
return param == null || type3 != "object" && type3 != "function";
|
34716
|
+
}
|
34717
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
34718
|
+
function _ObjectMap2() {
|
34719
|
+
this.map = {};
|
34720
|
+
this.length = 0;
|
34721
|
+
}
|
34722
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
34723
|
+
const hashedKey = this.hash(key);
|
34724
|
+
let bucket = this.map[hashedKey];
|
34725
|
+
if (!bucket) {
|
34726
|
+
this.map[hashedKey] = bucket = [];
|
34727
|
+
}
|
34728
|
+
bucket.push([key, value]);
|
34729
|
+
this.length += 1;
|
34730
|
+
};
|
34731
|
+
_ObjectMap2.prototype.hash = function(key) {
|
34732
|
+
let hashedKey = [];
|
34733
|
+
for (var value in key) {
|
34734
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34735
|
+
}
|
34736
|
+
return hashedKey.join();
|
34737
|
+
};
|
34738
|
+
_ObjectMap2.prototype.get = function(key) {
|
34739
|
+
if (this.length <= 180) {
|
34740
|
+
for (const p in this.map) {
|
34741
|
+
const bucket2 = this.map[p];
|
34742
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
34743
|
+
const element = bucket2[i];
|
34744
|
+
if (element[0] === key) {
|
34745
|
+
return element[1];
|
34746
|
+
}
|
34747
|
+
}
|
34748
|
+
}
|
34749
|
+
return;
|
34750
|
+
}
|
34751
|
+
const hashedKey = this.hash(key);
|
34752
|
+
const bucket = this.map[hashedKey];
|
34753
|
+
if (!bucket) {
|
34754
|
+
return;
|
34755
|
+
}
|
34756
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
34757
|
+
const element = bucket[i];
|
34758
|
+
if (element[0] === key) {
|
34759
|
+
return element[1];
|
34760
|
+
}
|
34761
|
+
}
|
34762
|
+
};
|
34763
|
+
return _ObjectMap2;
|
34764
|
+
}();
|
34765
|
+
|
34766
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34767
|
+
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34768
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34769
|
+
});
|
34770
|
+
var clone_default = clone2;
|
34771
|
+
|
34772
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34773
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34774
|
+
|
34776
34775
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34777
34776
|
var __assign = function() {
|
34778
34777
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37940,10 +37939,14 @@ spurious results.`);
|
|
37940
37939
|
// src/providers/__generated__/operations.ts
|
37941
37940
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37942
37941
|
fragment receiptFragment on Receipt {
|
37943
|
-
|
37942
|
+
contract {
|
37943
|
+
id
|
37944
|
+
}
|
37944
37945
|
pc
|
37945
37946
|
is
|
37946
|
-
to
|
37947
|
+
to {
|
37948
|
+
id
|
37949
|
+
}
|
37947
37950
|
toAddress
|
37948
37951
|
amount
|
37949
37952
|
assetId
|
@@ -37981,16 +37984,10 @@ spurious results.`);
|
|
37981
37984
|
id
|
37982
37985
|
}
|
37983
37986
|
time
|
37984
|
-
receipts {
|
37985
|
-
...receiptFragment
|
37986
|
-
}
|
37987
37987
|
programState {
|
37988
37988
|
returnType
|
37989
37989
|
data
|
37990
37990
|
}
|
37991
|
-
receipts {
|
37992
|
-
...receiptFragment
|
37993
|
-
}
|
37994
37991
|
}
|
37995
37992
|
... on FailureStatus {
|
37996
37993
|
block {
|
@@ -37998,24 +37995,26 @@ spurious results.`);
|
|
37998
37995
|
}
|
37999
37996
|
time
|
38000
37997
|
reason
|
38001
|
-
receipts {
|
38002
|
-
...receiptFragment
|
38003
|
-
}
|
38004
37998
|
}
|
38005
37999
|
... on SqueezedOutStatus {
|
38006
38000
|
reason
|
38007
38001
|
}
|
38008
38002
|
}
|
38009
|
-
|
38003
|
+
`;
|
38010
38004
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38011
38005
|
fragment transactionFragment on Transaction {
|
38012
38006
|
id
|
38013
38007
|
rawPayload
|
38008
|
+
gasPrice
|
38009
|
+
receipts {
|
38010
|
+
...receiptFragment
|
38011
|
+
}
|
38014
38012
|
status {
|
38015
38013
|
...transactionStatusFragment
|
38016
38014
|
}
|
38017
38015
|
}
|
38018
|
-
${
|
38016
|
+
${ReceiptFragmentFragmentDoc}
|
38017
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38019
38018
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38020
38019
|
fragment inputEstimatePredicatesFragment on Input {
|
38021
38020
|
... on InputCoin {
|
@@ -38033,46 +38032,6 @@ spurious results.`);
|
|
38033
38032
|
}
|
38034
38033
|
}
|
38035
38034
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38036
|
-
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38037
|
-
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38038
|
-
reason
|
38039
|
-
programState {
|
38040
|
-
returnType
|
38041
|
-
data
|
38042
|
-
}
|
38043
|
-
}
|
38044
|
-
`;
|
38045
|
-
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38046
|
-
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38047
|
-
programState {
|
38048
|
-
returnType
|
38049
|
-
data
|
38050
|
-
}
|
38051
|
-
}
|
38052
|
-
`;
|
38053
|
-
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38054
|
-
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38055
|
-
... on DryRunFailureStatus {
|
38056
|
-
...dryRunFailureStatusFragment
|
38057
|
-
}
|
38058
|
-
... on DryRunSuccessStatus {
|
38059
|
-
...dryRunSuccessStatusFragment
|
38060
|
-
}
|
38061
|
-
}
|
38062
|
-
${DryRunFailureStatusFragmentFragmentDoc}
|
38063
|
-
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38064
|
-
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38065
|
-
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38066
|
-
id
|
38067
|
-
status {
|
38068
|
-
...dryRunTransactionStatusFragment
|
38069
|
-
}
|
38070
|
-
receipts {
|
38071
|
-
...receiptFragment
|
38072
|
-
}
|
38073
|
-
}
|
38074
|
-
${DryRunTransactionStatusFragmentFragmentDoc}
|
38075
|
-
${ReceiptFragmentFragmentDoc}`;
|
38076
38035
|
var CoinFragmentFragmentDoc = lib_default2`
|
38077
38036
|
fragment coinFragment on Coin {
|
38078
38037
|
__typename
|
@@ -38080,6 +38039,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38080
38039
|
owner
|
38081
38040
|
amount
|
38082
38041
|
assetId
|
38042
|
+
maturity
|
38083
38043
|
blockCreated
|
38084
38044
|
txCreatedIdx
|
38085
38045
|
}
|
@@ -38118,32 +38078,26 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38118
38078
|
messageBlockHeader {
|
38119
38079
|
id
|
38120
38080
|
daHeight
|
38121
|
-
consensusParametersVersion
|
38122
|
-
stateTransitionBytecodeVersion
|
38123
38081
|
transactionsCount
|
38124
|
-
messageReceiptCount
|
38125
38082
|
transactionsRoot
|
38126
|
-
messageOutboxRoot
|
38127
|
-
eventInboxRoot
|
38128
38083
|
height
|
38129
38084
|
prevRoot
|
38130
38085
|
time
|
38131
38086
|
applicationHash
|
38087
|
+
messageReceiptRoot
|
38088
|
+
messageReceiptCount
|
38132
38089
|
}
|
38133
38090
|
commitBlockHeader {
|
38134
38091
|
id
|
38135
38092
|
daHeight
|
38136
|
-
consensusParametersVersion
|
38137
|
-
stateTransitionBytecodeVersion
|
38138
38093
|
transactionsCount
|
38139
|
-
messageReceiptCount
|
38140
38094
|
transactionsRoot
|
38141
|
-
messageOutboxRoot
|
38142
|
-
eventInboxRoot
|
38143
38095
|
height
|
38144
38096
|
prevRoot
|
38145
38097
|
time
|
38146
38098
|
applicationHash
|
38099
|
+
messageReceiptRoot
|
38100
|
+
messageReceiptCount
|
38147
38101
|
}
|
38148
38102
|
sender
|
38149
38103
|
recipient
|
@@ -38162,8 +38116,8 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38162
38116
|
var BlockFragmentFragmentDoc = lib_default2`
|
38163
38117
|
fragment blockFragment on Block {
|
38164
38118
|
id
|
38165
|
-
height
|
38166
38119
|
header {
|
38120
|
+
height
|
38167
38121
|
time
|
38168
38122
|
}
|
38169
38123
|
transactions {
|
@@ -38221,11 +38175,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38221
38175
|
`;
|
38222
38176
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38223
38177
|
fragment GasCostsFragment on GasCosts {
|
38224
|
-
version {
|
38225
|
-
... on Version {
|
38226
|
-
value
|
38227
|
-
}
|
38228
|
-
}
|
38229
38178
|
add
|
38230
38179
|
addi
|
38231
38180
|
aloc
|
@@ -38238,6 +38187,7 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38238
38187
|
cb
|
38239
38188
|
cfei
|
38240
38189
|
cfsi
|
38190
|
+
croo
|
38241
38191
|
div
|
38242
38192
|
divi
|
38243
38193
|
ecr1
|
@@ -38320,9 +38270,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38320
38270
|
ccp {
|
38321
38271
|
...DependentCostFragment
|
38322
38272
|
}
|
38323
|
-
croo {
|
38324
|
-
...DependentCostFragment
|
38325
|
-
}
|
38326
38273
|
csiz {
|
38327
38274
|
...DependentCostFragment
|
38328
38275
|
}
|
@@ -38382,11 +38329,6 @@ ${ReceiptFragmentFragmentDoc}`;
|
|
38382
38329
|
${DependentCostFragmentFragmentDoc}`;
|
38383
38330
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38384
38331
|
fragment consensusParametersFragment on ConsensusParameters {
|
38385
|
-
version {
|
38386
|
-
... on Version {
|
38387
|
-
value
|
38388
|
-
}
|
38389
|
-
}
|
38390
38332
|
txParams {
|
38391
38333
|
...TxParametersFragment
|
38392
38334
|
}
|
@@ -38446,9 +38388,18 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38446
38388
|
fragment nodeInfoFragment on NodeInfo {
|
38447
38389
|
utxoValidation
|
38448
38390
|
vmBacktrace
|
38391
|
+
minGasPrice
|
38449
38392
|
maxTx
|
38450
38393
|
maxDepth
|
38451
38394
|
nodeVersion
|
38395
|
+
peers {
|
38396
|
+
id
|
38397
|
+
addresses
|
38398
|
+
clientVersion
|
38399
|
+
blockHeight
|
38400
|
+
lastHeartbeatMs
|
38401
|
+
appScore
|
38402
|
+
}
|
38452
38403
|
}
|
38453
38404
|
`;
|
38454
38405
|
var GetVersionDocument = lib_default2`
|
@@ -38483,9 +38434,13 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38483
38434
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38484
38435
|
transaction(id: $transactionId) {
|
38485
38436
|
...transactionFragment
|
38437
|
+
receipts {
|
38438
|
+
...receiptFragment
|
38439
|
+
}
|
38486
38440
|
}
|
38487
38441
|
}
|
38488
|
-
${TransactionFragmentFragmentDoc}
|
38442
|
+
${TransactionFragmentFragmentDoc}
|
38443
|
+
${ReceiptFragmentFragmentDoc}`;
|
38489
38444
|
var GetTransactionsDocument = lib_default2`
|
38490
38445
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38491
38446
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38613,20 +38568,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38613
38568
|
}
|
38614
38569
|
}
|
38615
38570
|
${BalanceFragmentFragmentDoc}`;
|
38616
|
-
var GetLatestGasPriceDocument = lib_default2`
|
38617
|
-
query getLatestGasPrice {
|
38618
|
-
latestGasPrice {
|
38619
|
-
gasPrice
|
38620
|
-
}
|
38621
|
-
}
|
38622
|
-
`;
|
38623
|
-
var EstimateGasPriceDocument = lib_default2`
|
38624
|
-
query estimateGasPrice($blockHorizon: U32!) {
|
38625
|
-
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38626
|
-
gasPrice
|
38627
|
-
}
|
38628
|
-
}
|
38629
|
-
`;
|
38630
38571
|
var GetBalancesDocument = lib_default2`
|
38631
38572
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38632
38573
|
balances(
|
@@ -38681,12 +38622,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38681
38622
|
}
|
38682
38623
|
`;
|
38683
38624
|
var DryRunDocument = lib_default2`
|
38684
|
-
mutation dryRun($
|
38685
|
-
dryRun(
|
38686
|
-
...
|
38625
|
+
mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
|
38626
|
+
dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
|
38627
|
+
...receiptFragment
|
38687
38628
|
}
|
38688
38629
|
}
|
38689
|
-
${
|
38630
|
+
${ReceiptFragmentFragmentDoc}`;
|
38690
38631
|
var SubmitDocument = lib_default2`
|
38691
38632
|
mutation submit($encodedTransaction: HexString!) {
|
38692
38633
|
submit(tx: $encodedTransaction) {
|
@@ -38769,12 +38710,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38769
38710
|
getBalance(variables, options) {
|
38770
38711
|
return requester(GetBalanceDocument, variables, options);
|
38771
38712
|
},
|
38772
|
-
getLatestGasPrice(variables, options) {
|
38773
|
-
return requester(GetLatestGasPriceDocument, variables, options);
|
38774
|
-
},
|
38775
|
-
estimateGasPrice(variables, options) {
|
38776
|
-
return requester(EstimateGasPriceDocument, variables, options);
|
38777
|
-
},
|
38778
38713
|
getBalances(variables, options) {
|
38779
38714
|
return requester(GetBalancesDocument, variables, options);
|
38780
38715
|
},
|
@@ -38958,9 +38893,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38958
38893
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38959
38894
|
},
|
38960
38895
|
witnessIndex: value.witnessIndex,
|
38896
|
+
maturity: value.maturity ?? 0,
|
38961
38897
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38962
|
-
predicateLength:
|
38963
|
-
predicateDataLength:
|
38898
|
+
predicateLength: predicate.length,
|
38899
|
+
predicateDataLength: predicateData.length,
|
38964
38900
|
predicate: hexlify(predicate),
|
38965
38901
|
predicateData: hexlify(predicateData)
|
38966
38902
|
};
|
@@ -38991,8 +38927,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38991
38927
|
nonce: hexlify(value.nonce),
|
38992
38928
|
witnessIndex: value.witnessIndex,
|
38993
38929
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38994
|
-
predicateLength:
|
38995
|
-
predicateDataLength:
|
38930
|
+
predicateLength: predicate.length,
|
38931
|
+
predicateDataLength: predicateData.length,
|
38996
38932
|
predicate: hexlify(predicate),
|
38997
38933
|
predicateData: hexlify(predicateData),
|
38998
38934
|
data: hexlify(data),
|
@@ -39152,8 +39088,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39152
39088
|
case "CALL" /* Call */: {
|
39153
39089
|
const callReceipt = {
|
39154
39090
|
type: ReceiptType.Call,
|
39155
|
-
from: hexOrZero(receipt.id
|
39156
|
-
to: hexOrZero(receipt?.to),
|
39091
|
+
from: hexOrZero(receipt.contract?.id),
|
39092
|
+
to: hexOrZero(receipt?.to?.id),
|
39157
39093
|
amount: bn(receipt.amount),
|
39158
39094
|
assetId: hexOrZero(receipt.assetId),
|
39159
39095
|
gas: bn(receipt.gas),
|
@@ -39167,7 +39103,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39167
39103
|
case "RETURN" /* Return */: {
|
39168
39104
|
const returnReceipt = {
|
39169
39105
|
type: ReceiptType.Return,
|
39170
|
-
id: hexOrZero(receipt.id
|
39106
|
+
id: hexOrZero(receipt.contract?.id),
|
39171
39107
|
val: bn(receipt.val),
|
39172
39108
|
pc: bn(receipt.pc),
|
39173
39109
|
is: bn(receipt.is)
|
@@ -39177,7 +39113,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39177
39113
|
case "RETURN_DATA" /* ReturnData */: {
|
39178
39114
|
const returnDataReceipt = {
|
39179
39115
|
type: ReceiptType.ReturnData,
|
39180
|
-
id: hexOrZero(receipt.id
|
39116
|
+
id: hexOrZero(receipt.contract?.id),
|
39181
39117
|
ptr: bn(receipt.ptr),
|
39182
39118
|
len: bn(receipt.len),
|
39183
39119
|
digest: hexOrZero(receipt.digest),
|
@@ -39189,7 +39125,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39189
39125
|
case "PANIC" /* Panic */: {
|
39190
39126
|
const panicReceipt = {
|
39191
39127
|
type: ReceiptType.Panic,
|
39192
|
-
id: hexOrZero(receipt.id),
|
39128
|
+
id: hexOrZero(receipt.contract?.id),
|
39193
39129
|
reason: bn(receipt.reason),
|
39194
39130
|
pc: bn(receipt.pc),
|
39195
39131
|
is: bn(receipt.is),
|
@@ -39200,7 +39136,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39200
39136
|
case "REVERT" /* Revert */: {
|
39201
39137
|
const revertReceipt = {
|
39202
39138
|
type: ReceiptType.Revert,
|
39203
|
-
id: hexOrZero(receipt.id
|
39139
|
+
id: hexOrZero(receipt.contract?.id),
|
39204
39140
|
val: bn(receipt.ra),
|
39205
39141
|
pc: bn(receipt.pc),
|
39206
39142
|
is: bn(receipt.is)
|
@@ -39210,7 +39146,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39210
39146
|
case "LOG" /* Log */: {
|
39211
39147
|
const logReceipt = {
|
39212
39148
|
type: ReceiptType.Log,
|
39213
|
-
id: hexOrZero(receipt.id
|
39149
|
+
id: hexOrZero(receipt.contract?.id),
|
39214
39150
|
val0: bn(receipt.ra),
|
39215
39151
|
val1: bn(receipt.rb),
|
39216
39152
|
val2: bn(receipt.rc),
|
@@ -39223,7 +39159,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39223
39159
|
case "LOG_DATA" /* LogData */: {
|
39224
39160
|
const logDataReceipt = {
|
39225
39161
|
type: ReceiptType.LogData,
|
39226
|
-
id: hexOrZero(receipt.id
|
39162
|
+
id: hexOrZero(receipt.contract?.id),
|
39227
39163
|
val0: bn(receipt.ra),
|
39228
39164
|
val1: bn(receipt.rb),
|
39229
39165
|
ptr: bn(receipt.ptr),
|
@@ -39237,8 +39173,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39237
39173
|
case "TRANSFER" /* Transfer */: {
|
39238
39174
|
const transferReceipt = {
|
39239
39175
|
type: ReceiptType.Transfer,
|
39240
|
-
from: hexOrZero(receipt.id
|
39241
|
-
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39176
|
+
from: hexOrZero(receipt.contract?.id),
|
39177
|
+
to: hexOrZero(receipt.toAddress || receipt?.to?.id),
|
39242
39178
|
amount: bn(receipt.amount),
|
39243
39179
|
assetId: hexOrZero(receipt.assetId),
|
39244
39180
|
pc: bn(receipt.pc),
|
@@ -39249,8 +39185,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39249
39185
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39250
39186
|
const transferOutReceipt = {
|
39251
39187
|
type: ReceiptType.TransferOut,
|
39252
|
-
from: hexOrZero(receipt.id
|
39253
|
-
to: hexOrZero(receipt.toAddress || receipt.to),
|
39188
|
+
from: hexOrZero(receipt.contract?.id),
|
39189
|
+
to: hexOrZero(receipt.toAddress || receipt.to?.id),
|
39254
39190
|
amount: bn(receipt.amount),
|
39255
39191
|
assetId: hexOrZero(receipt.assetId),
|
39256
39192
|
pc: bn(receipt.pc),
|
@@ -39293,7 +39229,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39293
39229
|
return receiptMessageOut;
|
39294
39230
|
}
|
39295
39231
|
case "MINT" /* Mint */: {
|
39296
|
-
const contractId = hexOrZero(receipt.id
|
39232
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39297
39233
|
const subId = hexOrZero(receipt.subId);
|
39298
39234
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39299
39235
|
const mintReceipt = {
|
@@ -39308,7 +39244,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39308
39244
|
return mintReceipt;
|
39309
39245
|
}
|
39310
39246
|
case "BURN" /* Burn */: {
|
39311
|
-
const contractId = hexOrZero(receipt.id
|
39247
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
39312
39248
|
const subId = hexOrZero(receipt.subId);
|
39313
39249
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39314
39250
|
const burnReceipt = {
|
@@ -39389,6 +39325,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39389
39325
|
};
|
39390
39326
|
|
39391
39327
|
// src/providers/utils/gas.ts
|
39328
|
+
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39392
39329
|
var getGasUsedFromReceipts = (receipts) => {
|
39393
39330
|
const scriptResult = receipts.filter(
|
39394
39331
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39409,28 +39346,18 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39409
39346
|
}
|
39410
39347
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39411
39348
|
const witnessCache = [];
|
39412
|
-
const
|
39413
|
-
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39414
|
-
if (isCoinOrMessage) {
|
39415
|
-
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39416
|
-
return true;
|
39417
|
-
}
|
39418
|
-
if (!witnessCache.includes(input.witnessIndex)) {
|
39419
|
-
witnessCache.push(input.witnessIndex);
|
39420
|
-
return true;
|
39421
|
-
}
|
39422
|
-
}
|
39423
|
-
return false;
|
39424
|
-
});
|
39425
|
-
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39426
|
-
const totalGas = chargeableInputs.reduce((total, input) => {
|
39349
|
+
const totalGas = inputs.reduce((total, input) => {
|
39427
39350
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39428
39351
|
return total.add(
|
39429
|
-
|
39352
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39430
39353
|
);
|
39431
39354
|
}
|
39432
|
-
|
39433
|
-
|
39355
|
+
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
39356
|
+
witnessCache.push(input.witnessIndex);
|
39357
|
+
return total.add(gasCosts.ecr1);
|
39358
|
+
}
|
39359
|
+
return total;
|
39360
|
+
}, bn());
|
39434
39361
|
return totalGas;
|
39435
39362
|
}
|
39436
39363
|
function getMinGas(params) {
|
@@ -39442,20 +39369,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39442
39369
|
return minGas;
|
39443
39370
|
}
|
39444
39371
|
function getMaxGas(params) {
|
39445
|
-
const {
|
39446
|
-
gasPerByte,
|
39447
|
-
witnessesLength,
|
39448
|
-
witnessLimit,
|
39449
|
-
minGas,
|
39450
|
-
gasLimit = bn(0),
|
39451
|
-
maxGasPerTx
|
39452
|
-
} = params;
|
39372
|
+
const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn(0) } = params;
|
39453
39373
|
let remainingAllowedWitnessGas = bn(0);
|
39454
39374
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39455
39375
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39456
39376
|
}
|
39457
|
-
|
39458
|
-
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39377
|
+
return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39459
39378
|
}
|
39460
39379
|
function calculateMetadataGasForTxCreate({
|
39461
39380
|
gasCosts,
|
@@ -39477,10 +39396,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39477
39396
|
}) {
|
39478
39397
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39479
39398
|
}
|
39480
|
-
var calculateGasFee = (params) => {
|
39481
|
-
const { gas, gasPrice, priceFactor, tip } = params;
|
39482
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39483
|
-
};
|
39484
39399
|
|
39485
39400
|
// src/providers/utils/json.ts
|
39486
39401
|
function normalize2(object) {
|
@@ -39610,6 +39525,27 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39610
39525
|
name = "NoWitnessByOwnerError";
|
39611
39526
|
};
|
39612
39527
|
|
39528
|
+
// src/providers/transaction-request/helpers.ts
|
39529
|
+
var isRequestInputCoin = (input) => input.type === InputType.Coin;
|
39530
|
+
var isRequestInputMessage = (input) => input.type === InputType.Message;
|
39531
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
39532
|
+
var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
|
39533
|
+
var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
|
39534
|
+
var cacheResources = (resources) => resources.reduce(
|
39535
|
+
(cache2, resource) => {
|
39536
|
+
if (isCoin(resource)) {
|
39537
|
+
cache2.utxos.push(resource.id);
|
39538
|
+
} else {
|
39539
|
+
cache2.messages.push(resource.nonce);
|
39540
|
+
}
|
39541
|
+
return cache2;
|
39542
|
+
},
|
39543
|
+
{
|
39544
|
+
utxos: [],
|
39545
|
+
messages: []
|
39546
|
+
}
|
39547
|
+
);
|
39548
|
+
|
39613
39549
|
// src/providers/transaction-request/witness.ts
|
39614
39550
|
var witnessify = (value) => {
|
39615
39551
|
const data = arrayify(value);
|
@@ -39622,7 +39558,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39622
39558
|
// src/providers/transaction-request/transaction-request.ts
|
39623
39559
|
var BaseTransactionRequest = class {
|
39624
39560
|
/** Gas price for transaction */
|
39625
|
-
|
39561
|
+
gasPrice;
|
39626
39562
|
/** Block until which tx cannot be included */
|
39627
39563
|
maturity;
|
39628
39564
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39641,7 +39577,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39641
39577
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39642
39578
|
*/
|
39643
39579
|
constructor({
|
39644
|
-
|
39580
|
+
gasPrice,
|
39645
39581
|
maturity,
|
39646
39582
|
maxFee,
|
39647
39583
|
witnessLimit,
|
@@ -39649,7 +39585,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39649
39585
|
outputs,
|
39650
39586
|
witnesses
|
39651
39587
|
} = {}) {
|
39652
|
-
this.
|
39588
|
+
this.gasPrice = bn(gasPrice);
|
39653
39589
|
this.maturity = maturity ?? 0;
|
39654
39590
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39655
39591
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39660,9 +39596,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39660
39596
|
static getPolicyMeta(req) {
|
39661
39597
|
let policyTypes = 0;
|
39662
39598
|
const policies = [];
|
39663
|
-
if (req.
|
39664
|
-
policyTypes += PolicyType.
|
39665
|
-
policies.push({ data: req.
|
39599
|
+
if (req.gasPrice) {
|
39600
|
+
policyTypes += PolicyType.GasPrice;
|
39601
|
+
policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
|
39666
39602
|
}
|
39667
39603
|
if (req.witnessLimit) {
|
39668
39604
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39850,9 +39786,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39850
39786
|
* @param predicateData - Predicate data bytes.
|
39851
39787
|
*/
|
39852
39788
|
addCoinInput(coin) {
|
39853
|
-
const { assetId, owner, amount } = coin;
|
39789
|
+
const { assetId, owner, amount, id, predicate } = coin;
|
39854
39790
|
let witnessIndex;
|
39855
|
-
if (
|
39791
|
+
if (predicate) {
|
39856
39792
|
witnessIndex = 0;
|
39857
39793
|
} else {
|
39858
39794
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39861,13 +39797,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39861
39797
|
}
|
39862
39798
|
}
|
39863
39799
|
const input = {
|
39864
|
-
|
39800
|
+
id,
|
39865
39801
|
type: InputType.Coin,
|
39866
39802
|
owner: owner.toB256(),
|
39867
39803
|
amount,
|
39868
39804
|
assetId,
|
39869
39805
|
txPointer: "0x00000000000000000000000000000000",
|
39870
|
-
witnessIndex
|
39806
|
+
witnessIndex,
|
39807
|
+
predicate
|
39871
39808
|
};
|
39872
39809
|
this.pushInput(input);
|
39873
39810
|
this.addChangeOutput(owner, assetId);
|
@@ -39881,10 +39818,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39881
39818
|
* @param predicateData - Predicate data bytes.
|
39882
39819
|
*/
|
39883
39820
|
addMessageInput(message) {
|
39884
|
-
const { recipient, sender, amount } = message;
|
39821
|
+
const { recipient, sender, amount, predicate, nonce } = message;
|
39885
39822
|
const assetId = BaseAssetId;
|
39886
39823
|
let witnessIndex;
|
39887
|
-
if (
|
39824
|
+
if (predicate) {
|
39888
39825
|
witnessIndex = 0;
|
39889
39826
|
} else {
|
39890
39827
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39893,12 +39830,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39893
39830
|
}
|
39894
39831
|
}
|
39895
39832
|
const input = {
|
39896
|
-
|
39833
|
+
nonce,
|
39897
39834
|
type: InputType.Message,
|
39898
39835
|
sender: sender.toB256(),
|
39899
39836
|
recipient: recipient.toB256(),
|
39900
39837
|
amount,
|
39901
|
-
witnessIndex
|
39838
|
+
witnessIndex,
|
39839
|
+
predicate
|
39902
39840
|
};
|
39903
39841
|
this.pushInput(input);
|
39904
39842
|
this.addChangeOutput(recipient, assetId);
|
@@ -40008,7 +39946,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40008
39946
|
}
|
40009
39947
|
calculateMaxGas(chainInfo, minGas) {
|
40010
39948
|
const { consensusParameters } = chainInfo;
|
40011
|
-
const { gasPerByte
|
39949
|
+
const { gasPerByte } = consensusParameters;
|
40012
39950
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40013
39951
|
(acc, wit) => acc + wit.dataLength,
|
40014
39952
|
0
|
@@ -40017,8 +39955,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40017
39955
|
gasPerByte,
|
40018
39956
|
minGas,
|
40019
39957
|
witnessesLength,
|
40020
|
-
witnessLimit: this.witnessLimit
|
40021
|
-
maxGasPerTx
|
39958
|
+
witnessLimit: this.witnessLimit
|
40022
39959
|
});
|
40023
39960
|
}
|
40024
39961
|
/**
|
@@ -40036,20 +39973,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40036
39973
|
});
|
40037
39974
|
const updateAssetInput = (assetId, quantity) => {
|
40038
39975
|
const assetInput = findAssetInput(assetId);
|
40039
|
-
let usedQuantity = quantity;
|
40040
|
-
if (assetId === BaseAssetId) {
|
40041
|
-
usedQuantity = bn("1000000000000000000");
|
40042
|
-
}
|
40043
39976
|
if (assetInput && "assetId" in assetInput) {
|
40044
39977
|
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
40045
|
-
assetInput.amount =
|
39978
|
+
assetInput.amount = quantity;
|
40046
39979
|
} else {
|
40047
39980
|
this.addResources([
|
40048
39981
|
{
|
40049
39982
|
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
40050
|
-
amount:
|
39983
|
+
amount: quantity,
|
40051
39984
|
assetId,
|
40052
39985
|
owner: resourcesOwner || Address.fromRandom(),
|
39986
|
+
maturity: 0,
|
40053
39987
|
blockCreated: bn(1),
|
40054
39988
|
txCreatedIdx: bn(1)
|
40055
39989
|
}
|
@@ -40081,7 +40015,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40081
40015
|
toJSON() {
|
40082
40016
|
return normalizeJSON(this);
|
40083
40017
|
}
|
40084
|
-
|
40018
|
+
removeWitness(index) {
|
40019
|
+
this.witnesses.splice(index, 1);
|
40020
|
+
this.adjustWitnessIndexes(index);
|
40021
|
+
}
|
40022
|
+
updatePredicateInputs(inputs) {
|
40085
40023
|
this.inputs.forEach((i) => {
|
40086
40024
|
let correspondingInput;
|
40087
40025
|
switch (i.type) {
|
@@ -40103,12 +40041,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40103
40041
|
}
|
40104
40042
|
});
|
40105
40043
|
}
|
40106
|
-
|
40107
|
-
this.inputs.forEach((input) => {
|
40108
|
-
if (
|
40109
|
-
input.
|
40110
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40111
|
-
);
|
40044
|
+
adjustWitnessIndexes(removedIndex) {
|
40045
|
+
this.inputs.filter(isRequestInputResource).forEach((input) => {
|
40046
|
+
if (input.witnessIndex > removedIndex) {
|
40047
|
+
input.witnessIndex -= 1;
|
40112
40048
|
}
|
40113
40049
|
});
|
40114
40050
|
}
|
@@ -40245,8 +40181,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40245
40181
|
return {
|
40246
40182
|
type: TransactionType.Create,
|
40247
40183
|
...baseTransaction,
|
40184
|
+
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40248
40185
|
bytecodeWitnessIndex,
|
40249
|
-
storageSlotsCount:
|
40186
|
+
storageSlotsCount: storageSlots.length,
|
40250
40187
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40251
40188
|
storageSlots
|
40252
40189
|
};
|
@@ -40360,8 +40297,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40360
40297
|
type: TransactionType.Script,
|
40361
40298
|
scriptGasLimit: this.gasLimit,
|
40362
40299
|
...super.getBaseTransaction(),
|
40363
|
-
scriptLength:
|
40364
|
-
scriptDataLength:
|
40300
|
+
scriptLength: script.length,
|
40301
|
+
scriptDataLength: scriptData.length,
|
40365
40302
|
receiptsRoot: ZeroBytes32,
|
40366
40303
|
script: hexlify(script),
|
40367
40304
|
scriptData: hexlify(scriptData)
|
@@ -40425,7 +40362,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40425
40362
|
}
|
40426
40363
|
calculateMaxGas(chainInfo, minGas) {
|
40427
40364
|
const { consensusParameters } = chainInfo;
|
40428
|
-
const { gasPerByte
|
40365
|
+
const { gasPerByte } = consensusParameters;
|
40429
40366
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40430
40367
|
(acc, wit) => acc + wit.dataLength,
|
40431
40368
|
0
|
@@ -40435,8 +40372,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40435
40372
|
minGas,
|
40436
40373
|
witnessesLength,
|
40437
40374
|
witnessLimit: this.witnessLimit,
|
40438
|
-
gasLimit: this.gasLimit
|
40439
|
-
maxGasPerTx
|
40375
|
+
gasLimit: this.gasLimit
|
40440
40376
|
});
|
40441
40377
|
}
|
40442
40378
|
/**
|
@@ -40509,29 +40445,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40509
40445
|
}
|
40510
40446
|
}
|
40511
40447
|
};
|
40512
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40513
|
-
(acc, input) => {
|
40514
|
-
if (input.type === InputType.Coin && input.owner === owner) {
|
40515
|
-
acc.utxos.push(input.id);
|
40516
|
-
}
|
40517
|
-
if (input.type === InputType.Message && input.recipient === owner) {
|
40518
|
-
acc.messages.push(input.nonce);
|
40519
|
-
}
|
40520
|
-
return acc;
|
40521
|
-
},
|
40522
|
-
{
|
40523
|
-
utxos: [],
|
40524
|
-
messages: []
|
40525
|
-
}
|
40526
|
-
);
|
40527
40448
|
|
40528
40449
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40529
40450
|
var calculateTransactionFee = (params) => {
|
40530
40451
|
const {
|
40531
|
-
|
40452
|
+
gasUsed,
|
40532
40453
|
rawPayload,
|
40533
|
-
|
40534
|
-
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40454
|
+
consensusParameters: { gasCosts, feeParams }
|
40535
40455
|
} = params;
|
40536
40456
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40537
40457
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40541,7 +40461,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40541
40461
|
return {
|
40542
40462
|
fee: bn(0),
|
40543
40463
|
minFee: bn(0),
|
40544
|
-
maxFee: bn(0)
|
40464
|
+
maxFee: bn(0),
|
40465
|
+
feeFromGasUsed: bn(0)
|
40545
40466
|
};
|
40546
40467
|
}
|
40547
40468
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40573,6 +40494,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40573
40494
|
metadataGas,
|
40574
40495
|
txBytesSize: transactionBytes.length
|
40575
40496
|
});
|
40497
|
+
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40576
40498
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40577
40499
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40578
40500
|
const maxGas = getMaxGas({
|
@@ -40580,25 +40502,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40580
40502
|
minGas,
|
40581
40503
|
witnessesLength,
|
40582
40504
|
gasLimit,
|
40583
|
-
witnessLimit
|
40584
|
-
maxGasPerTx
|
40585
|
-
});
|
40586
|
-
const minFee = calculateGasFee({
|
40587
|
-
gasPrice,
|
40588
|
-
gas: minGas,
|
40589
|
-
priceFactor: gasPriceFactor,
|
40590
|
-
tip
|
40591
|
-
});
|
40592
|
-
const maxFee = calculateGasFee({
|
40593
|
-
gasPrice,
|
40594
|
-
gas: maxGas,
|
40595
|
-
priceFactor: gasPriceFactor,
|
40596
|
-
tip
|
40505
|
+
witnessLimit
|
40597
40506
|
});
|
40507
|
+
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40508
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40509
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40510
|
+
const fee = minFee.add(feeFromGasUsed);
|
40598
40511
|
return {
|
40512
|
+
fee,
|
40599
40513
|
minFee,
|
40600
40514
|
maxFee,
|
40601
|
-
|
40515
|
+
feeFromGasUsed
|
40602
40516
|
};
|
40603
40517
|
};
|
40604
40518
|
|
@@ -41199,9 +41113,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41199
41113
|
gqlTransactionStatus,
|
41200
41114
|
abiMap = {},
|
41201
41115
|
maxInputs,
|
41202
|
-
gasCosts
|
41203
|
-
maxGasPerTx,
|
41204
|
-
gasPrice
|
41116
|
+
gasCosts
|
41205
41117
|
} = params;
|
41206
41118
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41207
41119
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41215,14 +41127,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41215
41127
|
maxInputs
|
41216
41128
|
});
|
41217
41129
|
const typeName = getTransactionTypeName(transaction.type);
|
41218
|
-
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41219
41130
|
const { fee } = calculateTransactionFee({
|
41220
|
-
|
41131
|
+
gasUsed,
|
41221
41132
|
rawPayload,
|
41222
|
-
tip,
|
41223
41133
|
consensusParameters: {
|
41224
41134
|
gasCosts,
|
41225
|
-
maxGasPerTx,
|
41226
41135
|
feeParams: {
|
41227
41136
|
gasPerByte,
|
41228
41137
|
gasPriceFactor
|
@@ -41358,13 +41267,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41358
41267
|
const decodedTransaction = this.decodeTransaction(
|
41359
41268
|
transaction
|
41360
41269
|
);
|
41361
|
-
|
41362
|
-
|
41363
|
-
txReceipts = transaction.status.receipts;
|
41364
|
-
}
|
41365
|
-
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41366
|
-
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41367
|
-
const gasPrice = await this.provider.getLatestGasPrice();
|
41270
|
+
const receipts = transaction.receipts?.map(processGqlReceipt) || [];
|
41271
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
|
41368
41272
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41369
41273
|
const transactionSummary = assembleTransactionSummary({
|
41370
41274
|
id: this.id,
|
@@ -41376,9 +41280,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41376
41280
|
gasPriceFactor,
|
41377
41281
|
abiMap: contractsAbiMap,
|
41378
41282
|
maxInputs,
|
41379
|
-
gasCosts
|
41380
|
-
maxGasPerTx,
|
41381
|
-
gasPrice
|
41283
|
+
gasCosts
|
41382
41284
|
});
|
41383
41285
|
return transactionSummary;
|
41384
41286
|
}
|
@@ -41527,7 +41429,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41527
41429
|
gasCosts,
|
41528
41430
|
latestBlock: {
|
41529
41431
|
id: latestBlock.id,
|
41530
|
-
height: bn(latestBlock.height),
|
41432
|
+
height: bn(latestBlock.header.height),
|
41531
41433
|
time: latestBlock.header.time,
|
41532
41434
|
transactions: latestBlock.transactions.map((i) => ({
|
41533
41435
|
id: i.id
|
@@ -41621,8 +41523,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41621
41523
|
* Returns some helpful parameters related to gas fees.
|
41622
41524
|
*/
|
41623
41525
|
getGasConfig() {
|
41526
|
+
const { minGasPrice } = this.getNode();
|
41624
41527
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41625
41528
|
return {
|
41529
|
+
minGasPrice,
|
41626
41530
|
maxGasPerTx,
|
41627
41531
|
maxGasPerPredicate,
|
41628
41532
|
gasPriceFactor,
|
@@ -41720,7 +41624,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41720
41624
|
*/
|
41721
41625
|
async getBlockNumber() {
|
41722
41626
|
const { chain } = await this.operations.getChain();
|
41723
|
-
return bn(chain.latestBlock.height, 10);
|
41627
|
+
return bn(chain.latestBlock.header.height, 10);
|
41724
41628
|
}
|
41725
41629
|
/**
|
41726
41630
|
* Returns the chain information.
|
@@ -41732,9 +41636,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41732
41636
|
const processedNodeInfo = {
|
41733
41637
|
maxDepth: bn(nodeInfo.maxDepth),
|
41734
41638
|
maxTx: bn(nodeInfo.maxTx),
|
41639
|
+
minGasPrice: bn(nodeInfo.minGasPrice),
|
41735
41640
|
nodeVersion: nodeInfo.nodeVersion,
|
41736
41641
|
utxoValidation: nodeInfo.utxoValidation,
|
41737
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41642
|
+
vmBacktrace: nodeInfo.vmBacktrace,
|
41643
|
+
peers: nodeInfo.peers
|
41738
41644
|
};
|
41739
41645
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41740
41646
|
return processedNodeInfo;
|
@@ -41820,13 +41726,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41820
41726
|
return this.estimateTxDependencies(transactionRequest);
|
41821
41727
|
}
|
41822
41728
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41823
|
-
const { dryRun:
|
41824
|
-
|
41729
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41730
|
+
encodedTransaction,
|
41825
41731
|
utxoValidation: utxoValidation || false
|
41826
41732
|
});
|
41827
|
-
const
|
41828
|
-
|
41829
|
-
|
41733
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41734
|
+
return {
|
41735
|
+
receipts
|
41736
|
+
};
|
41830
41737
|
}
|
41831
41738
|
/**
|
41832
41739
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41865,6 +41772,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41865
41772
|
* If there are missing variable outputs,
|
41866
41773
|
* `addVariableOutputs` is called on the transaction.
|
41867
41774
|
*
|
41775
|
+
* @privateRemarks
|
41776
|
+
* TODO: Investigate support for missing contract IDs
|
41777
|
+
* TODO: Add support for missing output messages
|
41868
41778
|
*
|
41869
41779
|
* @param transactionRequest - The transaction request object.
|
41870
41780
|
* @returns A promise.
|
@@ -41877,19 +41787,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41877
41787
|
missingContractIds: []
|
41878
41788
|
};
|
41879
41789
|
}
|
41790
|
+
await this.estimatePredicates(transactionRequest);
|
41880
41791
|
let receipts = [];
|
41881
41792
|
const missingContractIds = [];
|
41882
41793
|
let outputVariables = 0;
|
41883
|
-
let dryrunStatus;
|
41884
41794
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41885
|
-
const {
|
41886
|
-
|
41887
|
-
} = await this.operations.dryRun({
|
41888
|
-
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41795
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41796
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
41889
41797
|
utxoValidation: false
|
41890
41798
|
});
|
41891
|
-
receipts =
|
41892
|
-
dryrunStatus = status;
|
41799
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
41893
41800
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41894
41801
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41895
41802
|
if (hasMissingOutputs) {
|
@@ -41899,10 +41806,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41899
41806
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41900
41807
|
missingContractIds.push(contractId);
|
41901
41808
|
});
|
41902
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41903
|
-
transactionRequest
|
41904
|
-
});
|
41905
|
-
transactionRequest.maxFee = maxFee;
|
41906
41809
|
} else {
|
41907
41810
|
break;
|
41908
41811
|
}
|
@@ -41910,139 +41813,37 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41910
41813
|
return {
|
41911
41814
|
receipts,
|
41912
41815
|
outputVariables,
|
41913
|
-
missingContractIds
|
41914
|
-
dryrunStatus
|
41816
|
+
missingContractIds
|
41915
41817
|
};
|
41916
41818
|
}
|
41917
|
-
/**
|
41918
|
-
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41919
|
-
*
|
41920
|
-
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41921
|
-
* further modifications are identified. The method iteratively updates these transactions
|
41922
|
-
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41923
|
-
*
|
41924
|
-
* @param transactionRequests - Array of transaction request objects.
|
41925
|
-
* @returns A promise that resolves to an array of results for each transaction.
|
41926
|
-
*/
|
41927
|
-
async estimateMultipleTxDependencies(transactionRequests) {
|
41928
|
-
const results = transactionRequests.map(() => ({
|
41929
|
-
receipts: [],
|
41930
|
-
outputVariables: 0,
|
41931
|
-
missingContractIds: [],
|
41932
|
-
dryrunStatus: void 0
|
41933
|
-
}));
|
41934
|
-
const allRequests = clone_default(transactionRequests);
|
41935
|
-
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41936
|
-
allRequests.forEach((req, index) => {
|
41937
|
-
if (req.type === TransactionType.Script) {
|
41938
|
-
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41939
|
-
}
|
41940
|
-
});
|
41941
|
-
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41942
|
-
let attempt = 0;
|
41943
|
-
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41944
|
-
const encodedTransactions = transactionsToProcess.map(
|
41945
|
-
(index) => serializedTransactionsMap.get(index)
|
41946
|
-
);
|
41947
|
-
const dryRunResults = await this.operations.dryRun({
|
41948
|
-
encodedTransactions,
|
41949
|
-
utxoValidation: false
|
41950
|
-
});
|
41951
|
-
const nextRoundTransactions = [];
|
41952
|
-
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41953
|
-
const currentResultIndex = transactionsToProcess[i];
|
41954
|
-
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41955
|
-
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41956
|
-
results[currentResultIndex].dryrunStatus = status;
|
41957
|
-
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41958
|
-
results[currentResultIndex].receipts
|
41959
|
-
);
|
41960
|
-
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41961
|
-
const requestToProcess = allRequests[currentResultIndex];
|
41962
|
-
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
41963
|
-
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
41964
|
-
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
41965
|
-
missingOutputContractIds.forEach(({ contractId }) => {
|
41966
|
-
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
41967
|
-
results[currentResultIndex].missingContractIds.push(contractId);
|
41968
|
-
});
|
41969
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
41970
|
-
transactionRequest: requestToProcess
|
41971
|
-
});
|
41972
|
-
requestToProcess.maxFee = maxFee;
|
41973
|
-
serializedTransactionsMap.set(
|
41974
|
-
currentResultIndex,
|
41975
|
-
hexlify(requestToProcess.toTransactionBytes())
|
41976
|
-
);
|
41977
|
-
nextRoundTransactions.push(currentResultIndex);
|
41978
|
-
allRequests[currentResultIndex] = requestToProcess;
|
41979
|
-
}
|
41980
|
-
}
|
41981
|
-
transactionsToProcess = nextRoundTransactions;
|
41982
|
-
attempt += 1;
|
41983
|
-
}
|
41984
|
-
return results;
|
41985
|
-
}
|
41986
|
-
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
41987
|
-
if (estimateTxDependencies) {
|
41988
|
-
return this.estimateMultipleTxDependencies(transactionRequests);
|
41989
|
-
}
|
41990
|
-
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
41991
|
-
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41992
|
-
encodedTransactions,
|
41993
|
-
utxoValidation: utxoValidation || false
|
41994
|
-
});
|
41995
|
-
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
41996
|
-
const receipts = rawReceipts.map(processGqlReceipt);
|
41997
|
-
return { receipts, dryrunStatus: status };
|
41998
|
-
});
|
41999
|
-
return results;
|
42000
|
-
}
|
42001
41819
|
/**
|
42002
41820
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
42003
41821
|
* @param transactionRequest - The transaction request object.
|
42004
41822
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
42005
41823
|
*/
|
42006
|
-
|
41824
|
+
estimateTxGasAndFee(params) {
|
42007
41825
|
const { transactionRequest } = params;
|
42008
|
-
|
41826
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
42009
41827
|
const chainInfo = this.getChain();
|
42010
|
-
const
|
41828
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
41829
|
+
transactionRequest.gasPrice = gasPrice;
|
42011
41830
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
42012
|
-
|
42013
|
-
gasPrice = await this.estimateGasPrice(10);
|
42014
|
-
}
|
42015
|
-
const minFee = calculateGasFee({
|
42016
|
-
gasPrice: bn(gasPrice),
|
42017
|
-
gas: minGas,
|
42018
|
-
priceFactor: gasPriceFactor,
|
42019
|
-
tip: transactionRequest.tip
|
42020
|
-
}).add(1);
|
42021
|
-
let gasLimit = bn(0);
|
41831
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42022
41832
|
if (transactionRequest.type === TransactionType.Script) {
|
42023
|
-
gasLimit = transactionRequest.gasLimit;
|
42024
41833
|
if (transactionRequest.gasLimit.eq(0)) {
|
42025
41834
|
transactionRequest.gasLimit = minGas;
|
42026
41835
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
42027
41836
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
42028
41837
|
);
|
42029
|
-
gasLimit = transactionRequest.gasLimit;
|
42030
41838
|
}
|
42031
41839
|
}
|
42032
41840
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42033
|
-
const maxFee =
|
42034
|
-
gasPrice: bn(gasPrice),
|
42035
|
-
gas: maxGas,
|
42036
|
-
priceFactor: gasPriceFactor,
|
42037
|
-
tip: transactionRequest.tip
|
42038
|
-
}).add(1);
|
41841
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
42039
41842
|
return {
|
42040
41843
|
minGas,
|
42041
41844
|
minFee,
|
42042
41845
|
maxGas,
|
42043
|
-
maxFee
|
42044
|
-
gasPrice,
|
42045
|
-
gasLimit
|
41846
|
+
maxFee
|
42046
41847
|
};
|
42047
41848
|
}
|
42048
41849
|
/**
|
@@ -42060,17 +41861,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42060
41861
|
if (estimateTxDependencies) {
|
42061
41862
|
return this.estimateTxDependencies(transactionRequest);
|
42062
41863
|
}
|
42063
|
-
const
|
42064
|
-
const { dryRun:
|
42065
|
-
|
41864
|
+
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41865
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
41866
|
+
encodedTransaction,
|
42066
41867
|
utxoValidation: true
|
42067
41868
|
});
|
42068
|
-
const
|
42069
|
-
|
42070
|
-
|
42071
|
-
|
42072
|
-
});
|
42073
|
-
return { receipts: callResult[0].receipts };
|
41869
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
41870
|
+
return {
|
41871
|
+
receipts
|
41872
|
+
};
|
42074
41873
|
}
|
42075
41874
|
/**
|
42076
41875
|
* Returns a transaction cost to enable user
|
@@ -42087,79 +41886,77 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42087
41886
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
42088
41887
|
* @returns A promise that resolves to the transaction cost object.
|
42089
41888
|
*/
|
42090
|
-
async getTransactionCost(transactionRequestLike,
|
41889
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
41890
|
+
estimateTxDependencies = true,
|
41891
|
+
estimatePredicates = true,
|
41892
|
+
resourcesOwner,
|
41893
|
+
signatureCallback
|
41894
|
+
} = {}) {
|
42091
41895
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41896
|
+
const { minGasPrice } = this.getGasConfig();
|
41897
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
42092
41898
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
42093
41899
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
42094
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
41900
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42095
41901
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42096
|
-
txRequestClone.maxFee = bn(0);
|
42097
41902
|
if (isScriptTransaction) {
|
42098
41903
|
txRequestClone.gasLimit = bn(0);
|
42099
41904
|
}
|
42100
|
-
if (
|
42101
|
-
resourcesOwner
|
41905
|
+
if (estimatePredicates) {
|
41906
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41907
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41908
|
+
}
|
41909
|
+
await this.estimatePredicates(txRequestClone);
|
42102
41910
|
}
|
42103
|
-
const signedRequest = clone_default(txRequestClone);
|
42104
|
-
let addedSignatures = 0;
|
42105
41911
|
if (signatureCallback && isScriptTransaction) {
|
42106
|
-
|
42107
|
-
await signatureCallback(signedRequest);
|
42108
|
-
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
41912
|
+
await signatureCallback(txRequestClone);
|
42109
41913
|
}
|
42110
|
-
|
42111
|
-
|
42112
|
-
transactionRequest: signedRequest
|
41914
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41915
|
+
transactionRequest: txRequestClone
|
42113
41916
|
});
|
42114
41917
|
let receipts = [];
|
42115
41918
|
let missingContractIds = [];
|
42116
41919
|
let outputVariables = 0;
|
42117
41920
|
let gasUsed = bn(0);
|
42118
|
-
|
42119
|
-
|
42120
|
-
if (isScriptTransaction) {
|
42121
|
-
txRequestClone.gasLimit = gasLimit;
|
42122
|
-
if (signatureCallback) {
|
42123
|
-
await signatureCallback(txRequestClone);
|
42124
|
-
}
|
41921
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
41922
|
+
txRequestClone.gasPrice = bn(0);
|
42125
41923
|
const result = await this.estimateTxDependencies(txRequestClone);
|
42126
41924
|
receipts = result.receipts;
|
42127
41925
|
outputVariables = result.outputVariables;
|
42128
41926
|
missingContractIds = result.missingContractIds;
|
42129
41927
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
42130
41928
|
txRequestClone.gasLimit = gasUsed;
|
42131
|
-
|
42132
|
-
|
42133
|
-
|
41929
|
+
txRequestClone.gasPrice = setGasPrice;
|
41930
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
41931
|
+
transactionRequest: txRequestClone
|
42134
41932
|
}));
|
42135
41933
|
}
|
42136
41934
|
return {
|
42137
41935
|
requiredQuantities: allQuantities,
|
42138
41936
|
receipts,
|
42139
41937
|
gasUsed,
|
42140
|
-
|
41938
|
+
minGasPrice,
|
41939
|
+
gasPrice: setGasPrice,
|
42141
41940
|
minGas,
|
42142
41941
|
maxGas,
|
42143
41942
|
minFee,
|
42144
41943
|
maxFee,
|
41944
|
+
estimatedInputs: txRequestClone.inputs,
|
42145
41945
|
outputVariables,
|
42146
|
-
missingContractIds
|
42147
|
-
addedSignatures,
|
42148
|
-
estimatedPredicates: txRequestClone.inputs
|
41946
|
+
missingContractIds
|
42149
41947
|
};
|
42150
41948
|
}
|
42151
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
41949
|
+
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
42152
41950
|
const ownerAddress = Address.fromAddressOrString(owner);
|
42153
41951
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
42154
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42155
|
-
quantitiesToContract
|
42156
|
-
});
|
41952
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
|
42157
41953
|
transactionRequest.addResources(
|
42158
41954
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
42159
41955
|
);
|
42160
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
42161
|
-
|
42162
|
-
|
41956
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41957
|
+
transactionRequest,
|
41958
|
+
forwardingQuantities
|
41959
|
+
);
|
42163
41960
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
42164
41961
|
return {
|
42165
41962
|
resources,
|
@@ -42183,6 +41980,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42183
41980
|
assetId: coin.assetId,
|
42184
41981
|
amount: bn(coin.amount),
|
42185
41982
|
owner: Address.fromAddressOrString(coin.owner),
|
41983
|
+
maturity: bn(coin.maturity).toNumber(),
|
42186
41984
|
blockCreated: bn(coin.blockCreated),
|
42187
41985
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42188
41986
|
}));
|
@@ -42234,6 +42032,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42234
42032
|
amount: bn(coin.amount),
|
42235
42033
|
assetId: coin.assetId,
|
42236
42034
|
owner: Address.fromAddressOrString(coin.owner),
|
42035
|
+
maturity: bn(coin.maturity).toNumber(),
|
42237
42036
|
blockCreated: bn(coin.blockCreated),
|
42238
42037
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42239
42038
|
};
|
@@ -42266,7 +42065,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42266
42065
|
}
|
42267
42066
|
return {
|
42268
42067
|
id: block2.id,
|
42269
|
-
height: bn(block2.height),
|
42068
|
+
height: bn(block2.header.height),
|
42270
42069
|
time: block2.header.time,
|
42271
42070
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42272
42071
|
};
|
@@ -42281,7 +42080,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42281
42080
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42282
42081
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42283
42082
|
id: block2.id,
|
42284
|
-
height: bn(block2.height),
|
42083
|
+
height: bn(block2.header.height),
|
42285
42084
|
time: block2.header.time,
|
42286
42085
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42287
42086
|
}));
|
@@ -42308,7 +42107,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42308
42107
|
}
|
42309
42108
|
return {
|
42310
42109
|
id: block2.id,
|
42311
|
-
height: bn(block2.height, 10),
|
42110
|
+
height: bn(block2.header.height, 10),
|
42312
42111
|
time: block2.header.time,
|
42313
42112
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42314
42113
|
transactions: block2.transactions.map(
|
@@ -42488,11 +42287,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42488
42287
|
prevRoot: messageBlockHeader.prevRoot,
|
42489
42288
|
time: messageBlockHeader.time,
|
42490
42289
|
applicationHash: messageBlockHeader.applicationHash,
|
42491
|
-
|
42492
|
-
|
42493
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
42494
|
-
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
42495
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
42290
|
+
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
42291
|
+
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
|
42496
42292
|
},
|
42497
42293
|
commitBlockHeader: {
|
42498
42294
|
id: commitBlockHeader.id,
|
@@ -42503,11 +42299,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42503
42299
|
prevRoot: commitBlockHeader.prevRoot,
|
42504
42300
|
time: commitBlockHeader.time,
|
42505
42301
|
applicationHash: commitBlockHeader.applicationHash,
|
42506
|
-
|
42507
|
-
|
42508
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
42509
|
-
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
42510
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
42302
|
+
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
42303
|
+
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
|
42511
42304
|
},
|
42512
42305
|
sender: Address.fromAddressOrString(sender),
|
42513
42306
|
recipient: Address.fromAddressOrString(recipient),
|
@@ -42516,16 +42309,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42516
42309
|
data
|
42517
42310
|
};
|
42518
42311
|
}
|
42519
|
-
async getLatestGasPrice() {
|
42520
|
-
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42521
|
-
return bn(latestGasPrice.gasPrice);
|
42522
|
-
}
|
42523
|
-
async estimateGasPrice(blockHorizon) {
|
42524
|
-
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42525
|
-
blockHorizon: String(blockHorizon)
|
42526
|
-
});
|
42527
|
-
return bn(estimateGasPrice.gasPrice);
|
42528
|
-
}
|
42529
42312
|
/**
|
42530
42313
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42531
42314
|
*
|
@@ -42586,15 +42369,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42586
42369
|
arrayify(gqlTransaction.rawPayload),
|
42587
42370
|
0
|
42588
42371
|
);
|
42589
|
-
|
42590
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42591
|
-
txReceipts = gqlTransaction.status.receipts;
|
42592
|
-
}
|
42593
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42372
|
+
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
42594
42373
|
const {
|
42595
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42374
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42596
42375
|
} = provider.getChain();
|
42597
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42598
42376
|
const transactionInfo = assembleTransactionSummary({
|
42599
42377
|
id: gqlTransaction.id,
|
42600
42378
|
receipts,
|
@@ -42605,9 +42383,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42605
42383
|
gasPriceFactor: bn(gasPriceFactor),
|
42606
42384
|
abiMap,
|
42607
42385
|
maxInputs,
|
42608
|
-
gasCosts
|
42609
|
-
maxGasPerTx,
|
42610
|
-
gasPrice
|
42386
|
+
gasCosts
|
42611
42387
|
});
|
42612
42388
|
return {
|
42613
42389
|
gqlTransaction,
|
@@ -42617,11 +42393,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42617
42393
|
async function getTransactionSummaryFromRequest(params) {
|
42618
42394
|
const { provider, transactionRequest, abiMap } = params;
|
42619
42395
|
const { receipts } = await provider.call(transactionRequest);
|
42620
|
-
const { gasPerByte, gasPriceFactor, gasCosts
|
42396
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42621
42397
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42622
42398
|
const transaction = transactionRequest.toTransaction();
|
42623
42399
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42624
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42625
42400
|
const transactionSummary = assembleTransactionSummary({
|
42626
42401
|
receipts,
|
42627
42402
|
transaction,
|
@@ -42630,9 +42405,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42630
42405
|
gasPerByte,
|
42631
42406
|
gasPriceFactor,
|
42632
42407
|
maxInputs,
|
42633
|
-
gasCosts
|
42634
|
-
maxGasPerTx,
|
42635
|
-
gasPrice
|
42408
|
+
gasCosts
|
42636
42409
|
});
|
42637
42410
|
return transactionSummary;
|
42638
42411
|
}
|
@@ -42641,18 +42414,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42641
42414
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42642
42415
|
const { edges, pageInfo } = transactionsByOwner;
|
42643
42416
|
const {
|
42644
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
42417
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42645
42418
|
} = provider.getChain();
|
42646
|
-
const gasPrice = await provider.getLatestGasPrice();
|
42647
42419
|
const transactions = edges.map((edge) => {
|
42648
42420
|
const { node: gqlTransaction } = edge;
|
42649
|
-
const { id, rawPayload, status } = gqlTransaction;
|
42421
|
+
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
42650
42422
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42651
|
-
|
42652
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42653
|
-
txReceipts = gqlTransaction.status.receipts;
|
42654
|
-
}
|
42655
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
42423
|
+
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
42656
42424
|
const transactionSummary = assembleTransactionSummary({
|
42657
42425
|
id,
|
42658
42426
|
receipts,
|
@@ -42663,9 +42431,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42663
42431
|
gasPerByte,
|
42664
42432
|
gasPriceFactor,
|
42665
42433
|
maxInputs,
|
42666
|
-
gasCosts
|
42667
|
-
maxGasPerTx,
|
42668
|
-
gasPrice
|
42434
|
+
gasCosts
|
42669
42435
|
});
|
42670
42436
|
const output3 = {
|
42671
42437
|
gqlTransaction,
|
@@ -42994,33 +42760,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42994
42760
|
* @param fee - The estimated transaction fee.
|
42995
42761
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42996
42762
|
*/
|
42997
|
-
async fund(request,
|
42998
|
-
const
|
42999
|
-
const txRequest = request;
|
43000
|
-
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42763
|
+
async fund(request, coinQuantities, fee) {
|
42764
|
+
const updatedQuantities = addAmountToAsset({
|
43001
42765
|
amount: bn(fee),
|
43002
42766
|
assetId: BaseAssetId,
|
43003
|
-
coinQuantities
|
42767
|
+
coinQuantities
|
43004
42768
|
});
|
43005
42769
|
const quantitiesDict = {};
|
43006
|
-
|
42770
|
+
updatedQuantities.forEach(({ amount, assetId }) => {
|
43007
42771
|
quantitiesDict[assetId] = {
|
43008
42772
|
required: amount,
|
43009
42773
|
owned: bn(0)
|
43010
42774
|
};
|
43011
42775
|
});
|
43012
|
-
|
42776
|
+
const cachedUtxos = [];
|
42777
|
+
const cachedMessages = [];
|
42778
|
+
const owner = this.address.toB256();
|
42779
|
+
request.inputs.forEach((input) => {
|
43013
42780
|
const isResource = "amount" in input;
|
43014
42781
|
if (isResource) {
|
43015
42782
|
const isCoin2 = "owner" in input;
|
43016
42783
|
if (isCoin2) {
|
43017
42784
|
const assetId = String(input.assetId);
|
43018
|
-
if (quantitiesDict[assetId]) {
|
42785
|
+
if (input.owner === owner && quantitiesDict[assetId]) {
|
43019
42786
|
const amount = bn(input.amount);
|
43020
42787
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42788
|
+
cachedUtxos.push(input.id);
|
43021
42789
|
}
|
43022
|
-
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42790
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
|
43023
42791
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42792
|
+
cachedMessages.push(input.nonce);
|
43024
42793
|
}
|
43025
42794
|
}
|
43026
42795
|
});
|
@@ -43035,23 +42804,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43035
42804
|
});
|
43036
42805
|
const needsToBeFunded = missingQuantities.length;
|
43037
42806
|
if (needsToBeFunded) {
|
43038
|
-
const
|
43039
|
-
|
43040
|
-
|
43041
|
-
|
43042
|
-
|
43043
|
-
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43044
|
-
const requestToBeReEstimate = clone_default(txRequest);
|
43045
|
-
if (addedSignatures) {
|
43046
|
-
Array.from({ length: addedSignatures }).forEach(
|
43047
|
-
() => requestToBeReEstimate.addEmptyWitness()
|
43048
|
-
);
|
42807
|
+
const resources = await this.getResourcesToSpend(missingQuantities, {
|
42808
|
+
messages: cachedMessages,
|
42809
|
+
utxos: cachedUtxos
|
42810
|
+
});
|
42811
|
+
request.addResources(resources);
|
43049
42812
|
}
|
43050
|
-
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43051
|
-
transactionRequest: requestToBeReEstimate
|
43052
|
-
});
|
43053
|
-
txRequest.maxFee = maxFee;
|
43054
|
-
return txRequest;
|
43055
42813
|
}
|
43056
42814
|
/**
|
43057
42815
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -43059,25 +42817,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43059
42817
|
* @param destination - The address of the destination.
|
43060
42818
|
* @param amount - The amount of coins to transfer.
|
43061
42819
|
* @param assetId - The asset ID of the coins to transfer.
|
43062
|
-
* @param txParams - The transaction parameters (gasLimit,
|
42820
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
43063
42821
|
* @returns A promise that resolves to the prepared transaction request.
|
43064
42822
|
*/
|
43065
42823
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
43066
|
-
const
|
42824
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42825
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
42826
|
+
const request = new ScriptTransactionRequest(params);
|
43067
42827
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
43068
|
-
const
|
42828
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43069
42829
|
estimateTxDependencies: true,
|
43070
42830
|
resourcesOwner: this
|
43071
42831
|
});
|
43072
|
-
|
43073
|
-
|
43074
|
-
|
43075
|
-
|
43076
|
-
|
43077
|
-
|
43078
|
-
|
43079
|
-
|
43080
|
-
await this.fund(request,
|
42832
|
+
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
42833
|
+
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
42834
|
+
this.validateGas({
|
42835
|
+
gasUsed,
|
42836
|
+
gasPrice: request.gasPrice,
|
42837
|
+
gasLimit: request.gasLimit,
|
42838
|
+
minGasPrice
|
42839
|
+
});
|
42840
|
+
await this.fund(request, requiredQuantities, maxFee);
|
42841
|
+
request.updatePredicateInputs(estimatedInputs);
|
43081
42842
|
return request;
|
43082
42843
|
}
|
43083
42844
|
/**
|
@@ -43116,30 +42877,31 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43116
42877
|
);
|
43117
42878
|
}
|
43118
42879
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42880
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
42881
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
43119
42882
|
const { script, scriptData } = await assembleTransferToContractScript({
|
43120
42883
|
hexlifiedContractId: contractAddress.toB256(),
|
43121
42884
|
amountToTransfer: bn(amount),
|
43122
42885
|
assetId
|
43123
42886
|
});
|
43124
42887
|
const request = new ScriptTransactionRequest({
|
43125
|
-
...
|
42888
|
+
...params,
|
43126
42889
|
script,
|
43127
42890
|
scriptData
|
43128
42891
|
});
|
43129
42892
|
request.addContractInputAndOutput(contractAddress);
|
43130
|
-
const
|
43131
|
-
|
43132
|
-
|
42893
|
+
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
42894
|
+
request,
|
42895
|
+
[{ amount: bn(amount), assetId: String(assetId) }]
|
42896
|
+
);
|
42897
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42898
|
+
this.validateGas({
|
42899
|
+
gasUsed,
|
42900
|
+
gasPrice: request.gasPrice,
|
42901
|
+
gasLimit: request.gasLimit,
|
42902
|
+
minGasPrice
|
43133
42903
|
});
|
43134
|
-
|
43135
|
-
this.validateGas({
|
43136
|
-
gasUsed: txCost.gasUsed,
|
43137
|
-
gasLimit: request.gasLimit
|
43138
|
-
});
|
43139
|
-
}
|
43140
|
-
request.gasLimit = txCost.gasUsed;
|
43141
|
-
request.maxFee = txCost.maxFee;
|
43142
|
-
await this.fund(request, txCost);
|
42904
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43143
42905
|
return this.sendTransaction(request);
|
43144
42906
|
}
|
43145
42907
|
/**
|
@@ -43151,6 +42913,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43151
42913
|
* @returns A promise that resolves to the transaction response.
|
43152
42914
|
*/
|
43153
42915
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42916
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
43154
42917
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
43155
42918
|
const recipientDataArray = arrayify(
|
43156
42919
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -43163,19 +42926,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43163
42926
|
...recipientDataArray,
|
43164
42927
|
...amountDataArray
|
43165
42928
|
]);
|
43166
|
-
const params = { script, ...txParams };
|
42929
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
43167
42930
|
const request = new ScriptTransactionRequest(params);
|
43168
|
-
const
|
43169
|
-
const
|
43170
|
-
|
43171
|
-
|
43172
|
-
|
43173
|
-
|
43174
|
-
|
43175
|
-
|
43176
|
-
|
43177
|
-
|
43178
|
-
|
42931
|
+
const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
|
42932
|
+
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
42933
|
+
request,
|
42934
|
+
forwardingQuantities
|
42935
|
+
);
|
42936
|
+
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42937
|
+
this.validateGas({
|
42938
|
+
gasUsed,
|
42939
|
+
gasPrice: request.gasPrice,
|
42940
|
+
gasLimit: request.gasLimit,
|
42941
|
+
minGasPrice
|
42942
|
+
});
|
42943
|
+
await this.fund(request, requiredQuantities, maxFee);
|
43179
42944
|
return this.sendTransaction(request);
|
43180
42945
|
}
|
43181
42946
|
async signMessage(message) {
|
@@ -43233,7 +42998,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
43233
42998
|
}
|
43234
42999
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43235
43000
|
}
|
43236
|
-
validateGas({
|
43001
|
+
validateGas({
|
43002
|
+
gasUsed,
|
43003
|
+
gasPrice,
|
43004
|
+
gasLimit,
|
43005
|
+
minGasPrice
|
43006
|
+
}) {
|
43007
|
+
if (minGasPrice.gt(gasPrice)) {
|
43008
|
+
throw new FuelError(
|
43009
|
+
ErrorCode.GAS_PRICE_TOO_LOW,
|
43010
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
43011
|
+
);
|
43012
|
+
}
|
43237
43013
|
if (gasUsed.gt(gasLimit)) {
|
43238
43014
|
throw new FuelError(
|
43239
43015
|
ErrorCode.GAS_LIMIT_TOO_LOW,
|
@@ -44822,7 +44598,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44822
44598
|
* @param transactionRequestLike - The transaction request to send.
|
44823
44599
|
* @returns A promise that resolves to the TransactionResponse object.
|
44824
44600
|
*/
|
44825
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44601
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
44826
44602
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44827
44603
|
if (estimateTxDependencies) {
|
44828
44604
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -48098,10 +47874,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48098
47874
|
populateTransactionPredicateData(transactionRequestLike) {
|
48099
47875
|
const request = transactionRequestify(transactionRequestLike);
|
48100
47876
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
48101
|
-
|
48102
|
-
|
48103
|
-
|
48104
|
-
|
47877
|
+
const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
|
47878
|
+
if (placeholderIndex !== -1) {
|
47879
|
+
request.removeWitness(placeholderIndex);
|
47880
|
+
}
|
47881
|
+
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
47882
|
+
if (isRequestInputResourceFromOwner(input, this.address)) {
|
47883
|
+
input.predicate = this.bytes;
|
47884
|
+
input.predicateData = this.getPredicateData(policies.length);
|
47885
|
+
input.witnessIndex = 0;
|
48105
47886
|
}
|
48106
47887
|
});
|
48107
47888
|
return request;
|
@@ -48116,7 +47897,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48116
47897
|
* @returns A promise that resolves to the prepared transaction request.
|
48117
47898
|
*/
|
48118
47899
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
48119
|
-
|
47900
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
47901
|
+
return this.populateTransactionPredicateData(request);
|
48120
47902
|
}
|
48121
47903
|
/**
|
48122
47904
|
* Sends a transaction with the populated predicate data.
|
@@ -48124,9 +47906,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48124
47906
|
* @param transactionRequestLike - The transaction request-like object.
|
48125
47907
|
* @returns A promise that resolves to the transaction response.
|
48126
47908
|
*/
|
48127
|
-
sendTransaction(transactionRequestLike) {
|
48128
|
-
const transactionRequest =
|
48129
|
-
return super.sendTransaction(transactionRequest,
|
47909
|
+
sendTransaction(transactionRequestLike, options) {
|
47910
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47911
|
+
return super.sendTransaction(transactionRequest, options);
|
48130
47912
|
}
|
48131
47913
|
/**
|
48132
47914
|
* Simulates a transaction with the populated predicate data.
|
@@ -48135,8 +47917,22 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48135
47917
|
* @returns A promise that resolves to the call result.
|
48136
47918
|
*/
|
48137
47919
|
simulateTransaction(transactionRequestLike) {
|
48138
|
-
const transactionRequest =
|
48139
|
-
return super.simulateTransaction(transactionRequest
|
47920
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
47921
|
+
return super.simulateTransaction(transactionRequest);
|
47922
|
+
}
|
47923
|
+
/**
|
47924
|
+
* Retrieves resources satisfying the spend query for the account.
|
47925
|
+
*
|
47926
|
+
* @param quantities - Coins to retrieve.
|
47927
|
+
* @param excludedIds - IDs of resources to be excluded from the query.
|
47928
|
+
* @returns A promise that resolves to an array of Resources.
|
47929
|
+
*/
|
47930
|
+
async getResourcesToSpend(quantities, excludedIds) {
|
47931
|
+
const resources = await super.getResourcesToSpend(quantities, excludedIds);
|
47932
|
+
return resources.map((resource) => ({
|
47933
|
+
...resource,
|
47934
|
+
predicate: hexlify(this.bytes)
|
47935
|
+
}));
|
48140
47936
|
}
|
48141
47937
|
getPredicateData(policiesLength) {
|
48142
47938
|
if (!this.predicateData.length) {
|
@@ -48182,25 +47978,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48182
47978
|
predicateInterface: abiInterface
|
48183
47979
|
};
|
48184
47980
|
}
|
48185
|
-
/**
|
48186
|
-
* Retrieves resources satisfying the spend query for the account.
|
48187
|
-
*
|
48188
|
-
* @param quantities - IDs of coins to exclude.
|
48189
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
48190
|
-
* @returns A promise that resolves to an array of Resources.
|
48191
|
-
*/
|
48192
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
48193
|
-
const resources = await this.provider.getResourcesToSpend(
|
48194
|
-
this.address,
|
48195
|
-
quantities,
|
48196
|
-
excludedIds
|
48197
|
-
);
|
48198
|
-
return resources.map((resource) => ({
|
48199
|
-
...resource,
|
48200
|
-
predicate: hexlify(this.bytes),
|
48201
|
-
paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48202
|
-
}));
|
48203
|
-
}
|
48204
47981
|
/**
|
48205
47982
|
* Sets the configurable constants for the predicate.
|
48206
47983
|
*
|
@@ -48236,6 +48013,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
48236
48013
|
}
|
48237
48014
|
return mutatedBytes;
|
48238
48015
|
}
|
48016
|
+
/**
|
48017
|
+
* Returns the index of the witness placeholder that was added to this predicate.
|
48018
|
+
* If no witness placeholder was added, it returns -1.
|
48019
|
+
* @param request - The transaction request.
|
48020
|
+
* @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
|
48021
|
+
*/
|
48022
|
+
getIndexFromPlaceholderWitness(request) {
|
48023
|
+
const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
|
48024
|
+
let index = -1;
|
48025
|
+
const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
|
48026
|
+
if (hasEmptyPredicateInputs) {
|
48027
|
+
index = hasEmptyPredicateInputs.witnessIndex;
|
48028
|
+
const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
|
48029
|
+
if (!allInputsAreEmpty) {
|
48030
|
+
const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
|
48031
|
+
if (wasFilledInputAddedFirst) {
|
48032
|
+
index = -1;
|
48033
|
+
}
|
48034
|
+
}
|
48035
|
+
}
|
48036
|
+
return index;
|
48037
|
+
}
|
48239
48038
|
};
|
48240
48039
|
|
48241
48040
|
// src/connectors/fuel-connector.ts
|