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