@fuel-ts/account 0.0.0-rc-2034-20240410113328 → 0.0.0-rc-2021-20240410132122
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 +798 -564
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +759 -525
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +639 -406
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +10 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +888 -322
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +4 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/message.d.ts +3 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +36 -31
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +2 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +8 -25
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +3 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +8 -2
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +1512 -1063
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +735 -521
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +629 -415
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +17 -17
package/dist/index.global.js
CHANGED
@@ -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.79.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -31516,32 +31516,182 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31516
31516
|
function toBytes3(value, bytesPadding) {
|
31517
31517
|
return bn(value).toBytes(bytesPadding);
|
31518
31518
|
}
|
31519
|
-
|
31520
|
-
|
31519
|
+
|
31520
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
31521
|
+
function _isPlaceholder(a) {
|
31522
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31523
|
+
}
|
31524
|
+
|
31525
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31526
|
+
function _curry1(fn) {
|
31527
|
+
return function f1(a) {
|
31528
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31529
|
+
return f1;
|
31530
|
+
} else {
|
31531
|
+
return fn.apply(this, arguments);
|
31532
|
+
}
|
31533
|
+
};
|
31534
|
+
}
|
31535
|
+
|
31536
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31537
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
31538
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31539
|
+
};
|
31540
|
+
|
31541
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31542
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31543
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31544
|
+
});
|
31545
|
+
var type_default = type;
|
31546
|
+
|
31547
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31548
|
+
var pad = function pad2(n) {
|
31549
|
+
return (n < 10 ? "0" : "") + n;
|
31550
|
+
};
|
31551
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31552
|
+
return d.toISOString();
|
31553
|
+
} : function _toISOString3(d) {
|
31554
|
+
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";
|
31555
|
+
};
|
31556
|
+
|
31557
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31558
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31559
|
+
return n << 0 === n;
|
31560
|
+
};
|
31561
|
+
|
31562
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31563
|
+
function _cloneRegExp(pattern) {
|
31564
|
+
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" : ""));
|
31565
|
+
}
|
31566
|
+
|
31567
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31568
|
+
function _clone(value, deep, map) {
|
31569
|
+
map || (map = new _ObjectMap());
|
31570
|
+
if (_isPrimitive(value)) {
|
31571
|
+
return value;
|
31572
|
+
}
|
31573
|
+
var copy = function copy2(copiedValue) {
|
31574
|
+
var cachedCopy = map.get(value);
|
31575
|
+
if (cachedCopy) {
|
31576
|
+
return cachedCopy;
|
31577
|
+
}
|
31578
|
+
map.set(value, copiedValue);
|
31579
|
+
for (var key in value) {
|
31580
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31581
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31582
|
+
}
|
31583
|
+
}
|
31584
|
+
return copiedValue;
|
31585
|
+
};
|
31586
|
+
switch (type_default(value)) {
|
31587
|
+
case "Object":
|
31588
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
31589
|
+
case "Array":
|
31590
|
+
return copy([]);
|
31591
|
+
case "Date":
|
31592
|
+
return new Date(value.valueOf());
|
31593
|
+
case "RegExp":
|
31594
|
+
return _cloneRegExp(value);
|
31595
|
+
case "Int8Array":
|
31596
|
+
case "Uint8Array":
|
31597
|
+
case "Uint8ClampedArray":
|
31598
|
+
case "Int16Array":
|
31599
|
+
case "Uint16Array":
|
31600
|
+
case "Int32Array":
|
31601
|
+
case "Uint32Array":
|
31602
|
+
case "Float32Array":
|
31603
|
+
case "Float64Array":
|
31604
|
+
case "BigInt64Array":
|
31605
|
+
case "BigUint64Array":
|
31606
|
+
return value.slice();
|
31607
|
+
default:
|
31608
|
+
return value;
|
31609
|
+
}
|
31521
31610
|
}
|
31611
|
+
function _isPrimitive(param) {
|
31612
|
+
var type3 = typeof param;
|
31613
|
+
return param == null || type3 != "object" && type3 != "function";
|
31614
|
+
}
|
31615
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
31616
|
+
function _ObjectMap2() {
|
31617
|
+
this.map = {};
|
31618
|
+
this.length = 0;
|
31619
|
+
}
|
31620
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
31621
|
+
const hashedKey = this.hash(key);
|
31622
|
+
let bucket = this.map[hashedKey];
|
31623
|
+
if (!bucket) {
|
31624
|
+
this.map[hashedKey] = bucket = [];
|
31625
|
+
}
|
31626
|
+
bucket.push([key, value]);
|
31627
|
+
this.length += 1;
|
31628
|
+
};
|
31629
|
+
_ObjectMap2.prototype.hash = function(key) {
|
31630
|
+
let hashedKey = [];
|
31631
|
+
for (var value in key) {
|
31632
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31633
|
+
}
|
31634
|
+
return hashedKey.join();
|
31635
|
+
};
|
31636
|
+
_ObjectMap2.prototype.get = function(key) {
|
31637
|
+
if (this.length <= 180) {
|
31638
|
+
for (const p in this.map) {
|
31639
|
+
const bucket2 = this.map[p];
|
31640
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
31641
|
+
const element = bucket2[i];
|
31642
|
+
if (element[0] === key) {
|
31643
|
+
return element[1];
|
31644
|
+
}
|
31645
|
+
}
|
31646
|
+
}
|
31647
|
+
return;
|
31648
|
+
}
|
31649
|
+
const hashedKey = this.hash(key);
|
31650
|
+
const bucket = this.map[hashedKey];
|
31651
|
+
if (!bucket) {
|
31652
|
+
return;
|
31653
|
+
}
|
31654
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
31655
|
+
const element = bucket[i];
|
31656
|
+
if (element[0] === key) {
|
31657
|
+
return element[1];
|
31658
|
+
}
|
31659
|
+
}
|
31660
|
+
};
|
31661
|
+
return _ObjectMap2;
|
31662
|
+
}();
|
31663
|
+
|
31664
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31665
|
+
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31666
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31667
|
+
});
|
31668
|
+
var clone_default = clone;
|
31669
|
+
|
31670
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31671
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31522
31672
|
|
31523
31673
|
// src/providers/coin-quantity.ts
|
31524
31674
|
var coinQuantityfy = (coinQuantityLike) => {
|
31525
31675
|
let assetId;
|
31526
31676
|
let amount;
|
31527
|
-
let
|
31677
|
+
let max;
|
31528
31678
|
if (Array.isArray(coinQuantityLike)) {
|
31529
31679
|
amount = coinQuantityLike[0];
|
31530
31680
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31531
|
-
|
31681
|
+
max = coinQuantityLike[2] ?? void 0;
|
31532
31682
|
} else {
|
31533
31683
|
amount = coinQuantityLike.amount;
|
31534
31684
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31535
|
-
|
31685
|
+
max = coinQuantityLike.max ?? void 0;
|
31536
31686
|
}
|
31537
31687
|
const bnAmount = bn(amount);
|
31538
31688
|
return {
|
31539
31689
|
assetId: hexlify(assetId),
|
31540
31690
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31541
|
-
max:
|
31691
|
+
max: max ? bn(max) : void 0
|
31542
31692
|
};
|
31543
31693
|
};
|
31544
|
-
var
|
31694
|
+
var addAmountToCoinQuantities = (params) => {
|
31545
31695
|
const { amount, assetId } = params;
|
31546
31696
|
const coinQuantities = [...params.coinQuantities];
|
31547
31697
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31633,9 +31783,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31633
31783
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
31634
31784
|
var MAX_BYTES = 2 ** 32 - 1;
|
31635
31785
|
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
31636
|
-
|
31786
|
+
ASSET_ID_LEN + // Base asset ID
|
31637
31787
|
// Asset ID/Balance coin input pairs
|
31638
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE);
|
31788
|
+
maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
|
31639
31789
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
31640
31790
|
WORD_SIZE + // Gas limit
|
31641
31791
|
WORD_SIZE + // Script size
|
@@ -31653,7 +31803,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31653
31803
|
ASSET_ID_LEN + // Asset id
|
31654
31804
|
TX_POINTER_LEN + // TxPointer
|
31655
31805
|
WORD_SIZE + // Witnesses index
|
31656
|
-
WORD_SIZE + // Maturity
|
31657
31806
|
WORD_SIZE + // Predicate size
|
31658
31807
|
WORD_SIZE + // Predicate data size
|
31659
31808
|
WORD_SIZE;
|
@@ -31785,6 +31934,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31785
31934
|
const padding = new Uint8Array(WORD_SIZE - encoded.length % WORD_SIZE);
|
31786
31935
|
return concatBytes2([encoded, padding]);
|
31787
31936
|
};
|
31937
|
+
var isUint8Array = (value) => value instanceof Uint8Array;
|
31788
31938
|
var ArrayCoder = class extends Coder {
|
31789
31939
|
coder;
|
31790
31940
|
length;
|
@@ -31974,7 +32124,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31974
32124
|
constructor(name, coders) {
|
31975
32125
|
const caseIndexCoder = new BigNumberCoder("u64");
|
31976
32126
|
const encodedValueSize = Object.values(coders).reduce(
|
31977
|
-
(
|
32127
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
31978
32128
|
0
|
31979
32129
|
);
|
31980
32130
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32326,8 +32476,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32326
32476
|
this.coder = coder;
|
32327
32477
|
}
|
32328
32478
|
encode(value) {
|
32329
|
-
if (!Array.isArray(value)) {
|
32330
|
-
throw new FuelError(
|
32479
|
+
if (!Array.isArray(value) && !isUint8Array(value)) {
|
32480
|
+
throw new FuelError(
|
32481
|
+
ErrorCode.ENCODE_ERROR,
|
32482
|
+
`Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
|
32483
|
+
);
|
32331
32484
|
}
|
32332
32485
|
const parts = [];
|
32333
32486
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
@@ -32675,7 +32828,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32675
32828
|
constructor(name, coders) {
|
32676
32829
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32677
32830
|
const encodedValueSize = Object.values(coders).reduce(
|
32678
|
-
(
|
32831
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
32679
32832
|
0
|
32680
32833
|
);
|
32681
32834
|
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33377,18 +33530,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33377
33530
|
encode(value) {
|
33378
33531
|
const parts = [];
|
33379
33532
|
parts.push(new B256Coder().encode(value.txID));
|
33380
|
-
parts.push(new NumberCoder("
|
33533
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
33381
33534
|
parts.push(new B256Coder().encode(value.owner));
|
33382
33535
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33383
33536
|
parts.push(new B256Coder().encode(value.assetId));
|
33384
33537
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33385
|
-
parts.push(new NumberCoder("
|
33386
|
-
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33538
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
33387
33539
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33388
|
-
parts.push(new
|
33389
|
-
parts.push(new
|
33390
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33391
|
-
parts.push(
|
33540
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33541
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33542
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33543
|
+
parts.push(
|
33544
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33545
|
+
);
|
33392
33546
|
return concat(parts);
|
33393
33547
|
}
|
33394
33548
|
decode(data, offset) {
|
@@ -33396,7 +33550,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33396
33550
|
let o = offset;
|
33397
33551
|
[decoded, o] = new B256Coder().decode(data, o);
|
33398
33552
|
const txID = decoded;
|
33399
|
-
[decoded, o] = new NumberCoder("
|
33553
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33400
33554
|
const outputIndex = decoded;
|
33401
33555
|
[decoded, o] = new B256Coder().decode(data, o);
|
33402
33556
|
const owner = decoded;
|
@@ -33406,19 +33560,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33406
33560
|
const assetId = decoded;
|
33407
33561
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
33408
33562
|
const txPointer = decoded;
|
33409
|
-
[decoded, o] = new NumberCoder("
|
33563
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33410
33564
|
const witnessIndex = Number(decoded);
|
33411
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33412
|
-
const maturity = decoded;
|
33413
33565
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33414
33566
|
const predicateGasUsed = decoded;
|
33415
|
-
[decoded, o] = new
|
33567
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33416
33568
|
const predicateLength = decoded;
|
33417
|
-
[decoded, o] = new
|
33569
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33418
33570
|
const predicateDataLength = decoded;
|
33419
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33571
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33420
33572
|
const predicate = decoded;
|
33421
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33573
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
33422
33574
|
const predicateData = decoded;
|
33423
33575
|
return [
|
33424
33576
|
{
|
@@ -33430,7 +33582,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33430
33582
|
assetId,
|
33431
33583
|
txPointer,
|
33432
33584
|
witnessIndex,
|
33433
|
-
maturity,
|
33434
33585
|
predicateGasUsed,
|
33435
33586
|
predicateLength,
|
33436
33587
|
predicateDataLength,
|
@@ -33448,7 +33599,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33448
33599
|
encode(value) {
|
33449
33600
|
const parts = [];
|
33450
33601
|
parts.push(new B256Coder().encode(value.txID));
|
33451
|
-
parts.push(new NumberCoder("
|
33602
|
+
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
33452
33603
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
33453
33604
|
parts.push(new B256Coder().encode(value.stateRoot));
|
33454
33605
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -33460,7 +33611,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33460
33611
|
let o = offset;
|
33461
33612
|
[decoded, o] = new B256Coder().decode(data, o);
|
33462
33613
|
const txID = decoded;
|
33463
|
-
[decoded, o] = new NumberCoder("
|
33614
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33464
33615
|
const outputIndex = decoded;
|
33465
33616
|
[decoded, o] = new B256Coder().decode(data, o);
|
33466
33617
|
const balanceRoot = decoded;
|
@@ -33509,14 +33660,16 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33509
33660
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
33510
33661
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33511
33662
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33512
|
-
parts.push(new NumberCoder("
|
33663
|
+
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
33513
33664
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33514
|
-
parts.push(new
|
33515
|
-
parts.push(new
|
33516
|
-
parts.push(new
|
33665
|
+
parts.push(new BigNumberCoder("u64").encode(data.length));
|
33666
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
33667
|
+
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
33517
33668
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
33518
|
-
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
33519
|
-
parts.push(
|
33669
|
+
parts.push(new ByteArrayCoder(value.predicateLength.toNumber()).encode(value.predicate));
|
33670
|
+
parts.push(
|
33671
|
+
new ByteArrayCoder(value.predicateDataLength.toNumber()).encode(value.predicateData)
|
33672
|
+
);
|
33520
33673
|
return concat(parts);
|
33521
33674
|
}
|
33522
33675
|
static decodeData(messageData) {
|
@@ -33536,21 +33689,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33536
33689
|
const amount = decoded;
|
33537
33690
|
[decoded, o] = new B256Coder().decode(data, o);
|
33538
33691
|
const nonce = decoded;
|
33539
|
-
[decoded, o] = new NumberCoder("
|
33692
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
33540
33693
|
const witnessIndex = Number(decoded);
|
33541
33694
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33542
33695
|
const predicateGasUsed = decoded;
|
33543
33696
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33544
33697
|
const dataLength2 = decoded;
|
33545
|
-
[decoded, o] = new
|
33698
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33546
33699
|
const predicateLength = decoded;
|
33547
|
-
[decoded, o] = new
|
33700
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33548
33701
|
const predicateDataLength = decoded;
|
33549
33702
|
[decoded, o] = new ByteArrayCoder(dataLength2).decode(data, o);
|
33550
33703
|
const messageData = decoded;
|
33551
|
-
[decoded, o] = new ByteArrayCoder(predicateLength).decode(data, o);
|
33704
|
+
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33552
33705
|
const predicate = decoded;
|
33553
|
-
[decoded, o] = new ByteArrayCoder(predicateDataLength).decode(data, o);
|
33706
|
+
[decoded, o] = new ByteArrayCoder(predicateDataLength.toNumber()).decode(data, o);
|
33554
33707
|
const predicateData = decoded;
|
33555
33708
|
return [
|
33556
33709
|
{
|
@@ -33862,7 +34015,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33862
34015
|
}
|
33863
34016
|
};
|
33864
34017
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
33865
|
-
PolicyType2[PolicyType2["
|
34018
|
+
PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
|
33866
34019
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
33867
34020
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
33868
34021
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -33910,9 +34063,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33910
34063
|
let o = offset;
|
33911
34064
|
const policies = [];
|
33912
34065
|
if (policyTypes & 1) {
|
33913
|
-
const [
|
34066
|
+
const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
33914
34067
|
o = nextOffset;
|
33915
|
-
policies.push({ type: 1, data:
|
34068
|
+
policies.push({ type: 1, data: tip });
|
33916
34069
|
}
|
33917
34070
|
if (policyTypes & 2) {
|
33918
34071
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34144,15 +34297,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34144
34297
|
encode(value) {
|
34145
34298
|
const parts = [];
|
34146
34299
|
parts.push(new BigNumberCoder("u64").encode(value.scriptGasLimit));
|
34147
|
-
parts.push(new NumberCoder("u32").encode(value.scriptLength));
|
34148
|
-
parts.push(new NumberCoder("u32").encode(value.scriptDataLength));
|
34149
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34150
|
-
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34151
|
-
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34152
|
-
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34153
34300
|
parts.push(new B256Coder().encode(value.receiptsRoot));
|
34154
|
-
parts.push(new
|
34155
|
-
parts.push(new
|
34301
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
|
34302
|
+
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
34303
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34304
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34305
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34306
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34307
|
+
parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
|
34308
|
+
parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
|
34156
34309
|
parts.push(new PoliciesCoder().encode(value.policies));
|
34157
34310
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34158
34311
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
@@ -34164,23 +34317,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34164
34317
|
let o = offset;
|
34165
34318
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34166
34319
|
const scriptGasLimit = decoded;
|
34167
|
-
[decoded, o] = new
|
34320
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34321
|
+
const receiptsRoot = decoded;
|
34322
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34168
34323
|
const scriptLength = decoded;
|
34169
|
-
[decoded, o] = new
|
34324
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34170
34325
|
const scriptDataLength = decoded;
|
34171
34326
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34172
34327
|
const policyTypes = decoded;
|
34173
|
-
[decoded, o] = new NumberCoder("
|
34328
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34174
34329
|
const inputsCount = decoded;
|
34175
|
-
[decoded, o] = new NumberCoder("
|
34330
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34176
34331
|
const outputsCount = decoded;
|
34177
|
-
[decoded, o] = new NumberCoder("
|
34332
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34178
34333
|
const witnessesCount = decoded;
|
34179
|
-
[decoded, o] = new
|
34180
|
-
const receiptsRoot = decoded;
|
34181
|
-
[decoded, o] = new ByteArrayCoder(scriptLength).decode(data, o);
|
34334
|
+
[decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
|
34182
34335
|
const script = decoded;
|
34183
|
-
[decoded, o] = new ByteArrayCoder(scriptDataLength).decode(data, o);
|
34336
|
+
[decoded, o] = new ByteArrayCoder(scriptDataLength.toNumber()).decode(data, o);
|
34184
34337
|
const scriptData = decoded;
|
34185
34338
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34186
34339
|
const policies = decoded;
|
@@ -34218,18 +34371,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34218
34371
|
}
|
34219
34372
|
encode(value) {
|
34220
34373
|
const parts = [];
|
34221
|
-
parts.push(new NumberCoder("
|
34222
|
-
parts.push(new NumberCoder("u8").encode(value.bytecodeWitnessIndex));
|
34223
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34224
|
-
parts.push(new NumberCoder("u16").encode(value.storageSlotsCount));
|
34225
|
-
parts.push(new NumberCoder("u8").encode(value.inputsCount));
|
34226
|
-
parts.push(new NumberCoder("u8").encode(value.outputsCount));
|
34227
|
-
parts.push(new NumberCoder("u8").encode(value.witnessesCount));
|
34374
|
+
parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
|
34228
34375
|
parts.push(new B256Coder().encode(value.salt));
|
34229
|
-
parts.push(new
|
34376
|
+
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
34377
|
+
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
34378
|
+
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
34379
|
+
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
34380
|
+
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
34230
34381
|
parts.push(
|
34231
|
-
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount).encode(
|
34382
|
+
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
|
34383
|
+
value.storageSlots
|
34384
|
+
)
|
34232
34385
|
);
|
34386
|
+
parts.push(new PoliciesCoder().encode(value.policies));
|
34233
34387
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
34234
34388
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
34235
34389
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
@@ -34238,26 +34392,27 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34238
34392
|
decode(data, offset) {
|
34239
34393
|
let decoded;
|
34240
34394
|
let o = offset;
|
34241
|
-
[decoded, o] = new NumberCoder("
|
34242
|
-
const bytecodeLength = decoded;
|
34243
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34395
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34244
34396
|
const bytecodeWitnessIndex = decoded;
|
34397
|
+
[decoded, o] = new B256Coder().decode(data, o);
|
34398
|
+
const salt = decoded;
|
34399
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34400
|
+
const storageSlotsCount = decoded;
|
34245
34401
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
34246
34402
|
const policyTypes = decoded;
|
34247
34403
|
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34248
|
-
const storageSlotsCount = decoded;
|
34249
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
34250
34404
|
const inputsCount = decoded;
|
34251
|
-
[decoded, o] = new NumberCoder("
|
34405
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34252
34406
|
const outputsCount = decoded;
|
34253
|
-
[decoded, o] = new NumberCoder("
|
34407
|
+
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
34254
34408
|
const witnessesCount = decoded;
|
34255
|
-
[decoded, o] = new
|
34256
|
-
|
34409
|
+
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
|
34410
|
+
data,
|
34411
|
+
o
|
34412
|
+
);
|
34413
|
+
const storageSlots = decoded;
|
34257
34414
|
[decoded, o] = new PoliciesCoder().decode(data, o, policyTypes);
|
34258
34415
|
const policies = decoded;
|
34259
|
-
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount).decode(data, o);
|
34260
|
-
const storageSlots = decoded;
|
34261
34416
|
[decoded, o] = new ArrayCoder(new InputCoder(), inputsCount).decode(data, o);
|
34262
34417
|
const inputs = decoded;
|
34263
34418
|
[decoded, o] = new ArrayCoder(new OutputCoder(), outputsCount).decode(data, o);
|
@@ -34267,7 +34422,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34267
34422
|
return [
|
34268
34423
|
{
|
34269
34424
|
type: 1,
|
34270
|
-
bytecodeLength,
|
34271
34425
|
bytecodeWitnessIndex,
|
34272
34426
|
policyTypes,
|
34273
34427
|
storageSlotsCount,
|
@@ -34296,6 +34450,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34296
34450
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
34297
34451
|
parts.push(new BigNumberCoder("u64").encode(value.mintAmount));
|
34298
34452
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
34453
|
+
parts.push(new BigNumberCoder("u64").encode(value.gasPrice));
|
34299
34454
|
return concat(parts);
|
34300
34455
|
}
|
34301
34456
|
decode(data, offset) {
|
@@ -34311,6 +34466,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34311
34466
|
const mintAmount = decoded;
|
34312
34467
|
[decoded, o] = new B256Coder().decode(data, o);
|
34313
34468
|
const mintAssetId = decoded;
|
34469
|
+
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
34470
|
+
const gasPrice = decoded;
|
34314
34471
|
return [
|
34315
34472
|
{
|
34316
34473
|
type: 2,
|
@@ -34318,7 +34475,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34318
34475
|
inputContract,
|
34319
34476
|
outputContract,
|
34320
34477
|
mintAmount,
|
34321
|
-
mintAssetId
|
34478
|
+
mintAssetId,
|
34479
|
+
gasPrice
|
34322
34480
|
},
|
34323
34481
|
o
|
34324
34482
|
];
|
@@ -34625,159 +34783,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34625
34783
|
// src/providers/provider.ts
|
34626
34784
|
var import_graphql_request = __toESM(require_dist2());
|
34627
34785
|
|
34628
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34629
|
-
function _isPlaceholder(a) {
|
34630
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34631
|
-
}
|
34632
|
-
|
34633
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34634
|
-
function _curry1(fn) {
|
34635
|
-
return function f1(a) {
|
34636
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34637
|
-
return f1;
|
34638
|
-
} else {
|
34639
|
-
return fn.apply(this, arguments);
|
34640
|
-
}
|
34641
|
-
};
|
34642
|
-
}
|
34643
|
-
|
34644
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34645
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
34646
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34647
|
-
};
|
34648
|
-
|
34649
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34650
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34651
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34652
|
-
});
|
34653
|
-
var type_default = type;
|
34654
|
-
|
34655
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34656
|
-
var pad = function pad2(n) {
|
34657
|
-
return (n < 10 ? "0" : "") + n;
|
34658
|
-
};
|
34659
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34660
|
-
return d.toISOString();
|
34661
|
-
} : function _toISOString3(d) {
|
34662
|
-
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";
|
34663
|
-
};
|
34664
|
-
|
34665
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34666
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34667
|
-
return n << 0 === n;
|
34668
|
-
};
|
34669
|
-
|
34670
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34671
|
-
function _cloneRegExp(pattern) {
|
34672
|
-
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" : ""));
|
34673
|
-
}
|
34674
|
-
|
34675
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34676
|
-
function _clone(value, deep, map) {
|
34677
|
-
map || (map = new _ObjectMap());
|
34678
|
-
if (_isPrimitive(value)) {
|
34679
|
-
return value;
|
34680
|
-
}
|
34681
|
-
var copy = function copy2(copiedValue) {
|
34682
|
-
var cachedCopy = map.get(value);
|
34683
|
-
if (cachedCopy) {
|
34684
|
-
return cachedCopy;
|
34685
|
-
}
|
34686
|
-
map.set(value, copiedValue);
|
34687
|
-
for (var key in value) {
|
34688
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34689
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34690
|
-
}
|
34691
|
-
}
|
34692
|
-
return copiedValue;
|
34693
|
-
};
|
34694
|
-
switch (type_default(value)) {
|
34695
|
-
case "Object":
|
34696
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
34697
|
-
case "Array":
|
34698
|
-
return copy([]);
|
34699
|
-
case "Date":
|
34700
|
-
return new Date(value.valueOf());
|
34701
|
-
case "RegExp":
|
34702
|
-
return _cloneRegExp(value);
|
34703
|
-
case "Int8Array":
|
34704
|
-
case "Uint8Array":
|
34705
|
-
case "Uint8ClampedArray":
|
34706
|
-
case "Int16Array":
|
34707
|
-
case "Uint16Array":
|
34708
|
-
case "Int32Array":
|
34709
|
-
case "Uint32Array":
|
34710
|
-
case "Float32Array":
|
34711
|
-
case "Float64Array":
|
34712
|
-
case "BigInt64Array":
|
34713
|
-
case "BigUint64Array":
|
34714
|
-
return value.slice();
|
34715
|
-
default:
|
34716
|
-
return value;
|
34717
|
-
}
|
34718
|
-
}
|
34719
|
-
function _isPrimitive(param) {
|
34720
|
-
var type3 = typeof param;
|
34721
|
-
return param == null || type3 != "object" && type3 != "function";
|
34722
|
-
}
|
34723
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
34724
|
-
function _ObjectMap2() {
|
34725
|
-
this.map = {};
|
34726
|
-
this.length = 0;
|
34727
|
-
}
|
34728
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
34729
|
-
const hashedKey = this.hash(key);
|
34730
|
-
let bucket = this.map[hashedKey];
|
34731
|
-
if (!bucket) {
|
34732
|
-
this.map[hashedKey] = bucket = [];
|
34733
|
-
}
|
34734
|
-
bucket.push([key, value]);
|
34735
|
-
this.length += 1;
|
34736
|
-
};
|
34737
|
-
_ObjectMap2.prototype.hash = function(key) {
|
34738
|
-
let hashedKey = [];
|
34739
|
-
for (var value in key) {
|
34740
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34741
|
-
}
|
34742
|
-
return hashedKey.join();
|
34743
|
-
};
|
34744
|
-
_ObjectMap2.prototype.get = function(key) {
|
34745
|
-
if (this.length <= 180) {
|
34746
|
-
for (const p in this.map) {
|
34747
|
-
const bucket2 = this.map[p];
|
34748
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
34749
|
-
const element = bucket2[i];
|
34750
|
-
if (element[0] === key) {
|
34751
|
-
return element[1];
|
34752
|
-
}
|
34753
|
-
}
|
34754
|
-
}
|
34755
|
-
return;
|
34756
|
-
}
|
34757
|
-
const hashedKey = this.hash(key);
|
34758
|
-
const bucket = this.map[hashedKey];
|
34759
|
-
if (!bucket) {
|
34760
|
-
return;
|
34761
|
-
}
|
34762
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
34763
|
-
const element = bucket[i];
|
34764
|
-
if (element[0] === key) {
|
34765
|
-
return element[1];
|
34766
|
-
}
|
34767
|
-
}
|
34768
|
-
};
|
34769
|
-
return _ObjectMap2;
|
34770
|
-
}();
|
34771
|
-
|
34772
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34773
|
-
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34774
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34775
|
-
});
|
34776
|
-
var clone_default = clone2;
|
34777
|
-
|
34778
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34779
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34780
|
-
|
34781
34786
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34782
34787
|
var __assign = function() {
|
34783
34788
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37945,14 +37950,10 @@ spurious results.`);
|
|
37945
37950
|
// src/providers/__generated__/operations.ts
|
37946
37951
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37947
37952
|
fragment receiptFragment on Receipt {
|
37948
|
-
|
37949
|
-
id
|
37950
|
-
}
|
37953
|
+
id
|
37951
37954
|
pc
|
37952
37955
|
is
|
37953
|
-
to
|
37954
|
-
id
|
37955
|
-
}
|
37956
|
+
to
|
37956
37957
|
toAddress
|
37957
37958
|
amount
|
37958
37959
|
assetId
|
@@ -37990,10 +37991,16 @@ spurious results.`);
|
|
37990
37991
|
id
|
37991
37992
|
}
|
37992
37993
|
time
|
37994
|
+
receipts {
|
37995
|
+
...receiptFragment
|
37996
|
+
}
|
37993
37997
|
programState {
|
37994
37998
|
returnType
|
37995
37999
|
data
|
37996
38000
|
}
|
38001
|
+
receipts {
|
38002
|
+
...receiptFragment
|
38003
|
+
}
|
37997
38004
|
}
|
37998
38005
|
... on FailureStatus {
|
37999
38006
|
block {
|
@@ -38001,26 +38008,24 @@ spurious results.`);
|
|
38001
38008
|
}
|
38002
38009
|
time
|
38003
38010
|
reason
|
38011
|
+
receipts {
|
38012
|
+
...receiptFragment
|
38013
|
+
}
|
38004
38014
|
}
|
38005
38015
|
... on SqueezedOutStatus {
|
38006
38016
|
reason
|
38007
38017
|
}
|
38008
38018
|
}
|
38009
|
-
`;
|
38019
|
+
${ReceiptFragmentFragmentDoc}`;
|
38010
38020
|
var TransactionFragmentFragmentDoc = lib_default2`
|
38011
38021
|
fragment transactionFragment on Transaction {
|
38012
38022
|
id
|
38013
38023
|
rawPayload
|
38014
|
-
gasPrice
|
38015
|
-
receipts {
|
38016
|
-
...receiptFragment
|
38017
|
-
}
|
38018
38024
|
status {
|
38019
38025
|
...transactionStatusFragment
|
38020
38026
|
}
|
38021
38027
|
}
|
38022
|
-
${
|
38023
|
-
${TransactionStatusFragmentFragmentDoc}`;
|
38028
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
38024
38029
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
38025
38030
|
fragment inputEstimatePredicatesFragment on Input {
|
38026
38031
|
... on InputCoin {
|
@@ -38038,6 +38043,46 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38038
38043
|
}
|
38039
38044
|
}
|
38040
38045
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38046
|
+
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38047
|
+
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38048
|
+
reason
|
38049
|
+
programState {
|
38050
|
+
returnType
|
38051
|
+
data
|
38052
|
+
}
|
38053
|
+
}
|
38054
|
+
`;
|
38055
|
+
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38056
|
+
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38057
|
+
programState {
|
38058
|
+
returnType
|
38059
|
+
data
|
38060
|
+
}
|
38061
|
+
}
|
38062
|
+
`;
|
38063
|
+
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38064
|
+
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38065
|
+
... on DryRunFailureStatus {
|
38066
|
+
...dryRunFailureStatusFragment
|
38067
|
+
}
|
38068
|
+
... on DryRunSuccessStatus {
|
38069
|
+
...dryRunSuccessStatusFragment
|
38070
|
+
}
|
38071
|
+
}
|
38072
|
+
${DryRunFailureStatusFragmentFragmentDoc}
|
38073
|
+
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38074
|
+
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38075
|
+
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38076
|
+
id
|
38077
|
+
status {
|
38078
|
+
...dryRunTransactionStatusFragment
|
38079
|
+
}
|
38080
|
+
receipts {
|
38081
|
+
...receiptFragment
|
38082
|
+
}
|
38083
|
+
}
|
38084
|
+
${DryRunTransactionStatusFragmentFragmentDoc}
|
38085
|
+
${ReceiptFragmentFragmentDoc}`;
|
38041
38086
|
var CoinFragmentFragmentDoc = lib_default2`
|
38042
38087
|
fragment coinFragment on Coin {
|
38043
38088
|
__typename
|
@@ -38045,7 +38090,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38045
38090
|
owner
|
38046
38091
|
amount
|
38047
38092
|
assetId
|
38048
|
-
maturity
|
38049
38093
|
blockCreated
|
38050
38094
|
txCreatedIdx
|
38051
38095
|
}
|
@@ -38090,7 +38134,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38090
38134
|
prevRoot
|
38091
38135
|
time
|
38092
38136
|
applicationHash
|
38093
|
-
messageReceiptRoot
|
38094
38137
|
messageReceiptCount
|
38095
38138
|
}
|
38096
38139
|
commitBlockHeader {
|
@@ -38102,7 +38145,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38102
38145
|
prevRoot
|
38103
38146
|
time
|
38104
38147
|
applicationHash
|
38105
|
-
messageReceiptRoot
|
38106
38148
|
messageReceiptCount
|
38107
38149
|
}
|
38108
38150
|
sender
|
@@ -38122,8 +38164,8 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38122
38164
|
var BlockFragmentFragmentDoc = lib_default2`
|
38123
38165
|
fragment blockFragment on Block {
|
38124
38166
|
id
|
38167
|
+
height
|
38125
38168
|
header {
|
38126
|
-
height
|
38127
38169
|
time
|
38128
38170
|
}
|
38129
38171
|
transactions {
|
@@ -38181,6 +38223,11 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38181
38223
|
`;
|
38182
38224
|
var GasCostsFragmentFragmentDoc = lib_default2`
|
38183
38225
|
fragment GasCostsFragment on GasCosts {
|
38226
|
+
version {
|
38227
|
+
... on Version {
|
38228
|
+
value
|
38229
|
+
}
|
38230
|
+
}
|
38184
38231
|
add
|
38185
38232
|
addi
|
38186
38233
|
aloc
|
@@ -38193,7 +38240,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38193
38240
|
cb
|
38194
38241
|
cfei
|
38195
38242
|
cfsi
|
38196
|
-
croo
|
38197
38243
|
div
|
38198
38244
|
divi
|
38199
38245
|
ecr1
|
@@ -38276,6 +38322,9 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38276
38322
|
ccp {
|
38277
38323
|
...DependentCostFragment
|
38278
38324
|
}
|
38325
|
+
croo {
|
38326
|
+
...DependentCostFragment
|
38327
|
+
}
|
38279
38328
|
csiz {
|
38280
38329
|
...DependentCostFragment
|
38281
38330
|
}
|
@@ -38335,6 +38384,11 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38335
38384
|
${DependentCostFragmentFragmentDoc}`;
|
38336
38385
|
var ConsensusParametersFragmentFragmentDoc = lib_default2`
|
38337
38386
|
fragment consensusParametersFragment on ConsensusParameters {
|
38387
|
+
version {
|
38388
|
+
... on Version {
|
38389
|
+
value
|
38390
|
+
}
|
38391
|
+
}
|
38338
38392
|
txParams {
|
38339
38393
|
...TxParametersFragment
|
38340
38394
|
}
|
@@ -38394,18 +38448,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38394
38448
|
fragment nodeInfoFragment on NodeInfo {
|
38395
38449
|
utxoValidation
|
38396
38450
|
vmBacktrace
|
38397
|
-
minGasPrice
|
38398
38451
|
maxTx
|
38399
38452
|
maxDepth
|
38400
38453
|
nodeVersion
|
38401
|
-
peers {
|
38402
|
-
id
|
38403
|
-
addresses
|
38404
|
-
clientVersion
|
38405
|
-
blockHeight
|
38406
|
-
lastHeartbeatMs
|
38407
|
-
appScore
|
38408
|
-
}
|
38409
38454
|
}
|
38410
38455
|
`;
|
38411
38456
|
var GetVersionDocument = lib_default2`
|
@@ -38440,13 +38485,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38440
38485
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38441
38486
|
transaction(id: $transactionId) {
|
38442
38487
|
...transactionFragment
|
38443
|
-
receipts {
|
38444
|
-
...receiptFragment
|
38445
|
-
}
|
38446
38488
|
}
|
38447
38489
|
}
|
38448
|
-
${TransactionFragmentFragmentDoc}
|
38449
|
-
${ReceiptFragmentFragmentDoc}`;
|
38490
|
+
${TransactionFragmentFragmentDoc}`;
|
38450
38491
|
var GetTransactionsDocument = lib_default2`
|
38451
38492
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38452
38493
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38574,6 +38615,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38574
38615
|
}
|
38575
38616
|
}
|
38576
38617
|
${BalanceFragmentFragmentDoc}`;
|
38618
|
+
var GetLatestGasPriceDocument = lib_default2`
|
38619
|
+
query getLatestGasPrice {
|
38620
|
+
latestGasPrice {
|
38621
|
+
gasPrice
|
38622
|
+
}
|
38623
|
+
}
|
38624
|
+
`;
|
38625
|
+
var EstimateGasPriceDocument = lib_default2`
|
38626
|
+
query estimateGasPrice($blockHorizon: U32!) {
|
38627
|
+
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38628
|
+
gasPrice
|
38629
|
+
}
|
38630
|
+
}
|
38631
|
+
`;
|
38577
38632
|
var GetBalancesDocument = lib_default2`
|
38578
38633
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38579
38634
|
balances(
|
@@ -38628,12 +38683,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38628
38683
|
}
|
38629
38684
|
`;
|
38630
38685
|
var DryRunDocument = lib_default2`
|
38631
|
-
mutation dryRun($
|
38632
|
-
dryRun(
|
38633
|
-
...
|
38686
|
+
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
38687
|
+
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
38688
|
+
...dryRunTransactionExecutionStatusFragment
|
38634
38689
|
}
|
38635
38690
|
}
|
38636
|
-
${
|
38691
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
38637
38692
|
var SubmitDocument = lib_default2`
|
38638
38693
|
mutation submit($encodedTransaction: HexString!) {
|
38639
38694
|
submit(tx: $encodedTransaction) {
|
@@ -38716,6 +38771,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38716
38771
|
getBalance(variables, options) {
|
38717
38772
|
return requester(GetBalanceDocument, variables, options);
|
38718
38773
|
},
|
38774
|
+
getLatestGasPrice(variables, options) {
|
38775
|
+
return requester(GetLatestGasPriceDocument, variables, options);
|
38776
|
+
},
|
38777
|
+
estimateGasPrice(variables, options) {
|
38778
|
+
return requester(EstimateGasPriceDocument, variables, options);
|
38779
|
+
},
|
38719
38780
|
getBalances(variables, options) {
|
38720
38781
|
return requester(GetBalancesDocument, variables, options);
|
38721
38782
|
},
|
@@ -38783,11 +38844,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38783
38844
|
let data;
|
38784
38845
|
let errors;
|
38785
38846
|
try {
|
38786
|
-
|
38847
|
+
const sanitizedText = text.replace(/\s/g, "");
|
38848
|
+
({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
|
38787
38849
|
} catch (e) {
|
38788
38850
|
throw new FuelError(
|
38789
38851
|
ErrorCode.STREAM_PARSING_ERROR,
|
38790
|
-
`Error while parsing stream data response: ${text}
|
38852
|
+
`Error while parsing stream data response: ${text}
|
38853
|
+
|
38854
|
+
Thrown error: ${e}`
|
38791
38855
|
);
|
38792
38856
|
}
|
38793
38857
|
if (Array.isArray(errors)) {
|
@@ -38881,7 +38945,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38881
38945
|
return {
|
38882
38946
|
type: InputType.Coin,
|
38883
38947
|
txID: hexlify(arrayify(value.id).slice(0, 32)),
|
38884
|
-
outputIndex: toNumber2(arrayify(value.id).slice(32,
|
38948
|
+
outputIndex: toNumber2(arrayify(value.id).slice(32, 34)),
|
38885
38949
|
owner: hexlify(value.owner),
|
38886
38950
|
amount: bn(value.amount),
|
38887
38951
|
assetId: hexlify(value.assetId),
|
@@ -38890,10 +38954,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38890
38954
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38891
38955
|
},
|
38892
38956
|
witnessIndex: value.witnessIndex,
|
38893
|
-
maturity: value.maturity ?? 0,
|
38894
38957
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38895
|
-
predicateLength: predicate.length,
|
38896
|
-
predicateDataLength: predicateData.length,
|
38958
|
+
predicateLength: bn(predicate.length),
|
38959
|
+
predicateDataLength: bn(predicateData.length),
|
38897
38960
|
predicate: hexlify(predicate),
|
38898
38961
|
predicateData: hexlify(predicateData)
|
38899
38962
|
};
|
@@ -38924,8 +38987,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38924
38987
|
nonce: hexlify(value.nonce),
|
38925
38988
|
witnessIndex: value.witnessIndex,
|
38926
38989
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38927
|
-
predicateLength: predicate.length,
|
38928
|
-
predicateDataLength: predicateData.length,
|
38990
|
+
predicateLength: bn(predicate.length),
|
38991
|
+
predicateDataLength: bn(predicateData.length),
|
38929
38992
|
predicate: hexlify(predicate),
|
38930
38993
|
predicateData: hexlify(predicateData),
|
38931
38994
|
data: hexlify(data),
|
@@ -39085,8 +39148,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39085
39148
|
case "CALL" /* Call */: {
|
39086
39149
|
const callReceipt = {
|
39087
39150
|
type: ReceiptType.Call,
|
39088
|
-
from: hexOrZero(receipt.
|
39089
|
-
to: hexOrZero(receipt?.to
|
39151
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39152
|
+
to: hexOrZero(receipt?.to),
|
39090
39153
|
amount: bn(receipt.amount),
|
39091
39154
|
assetId: hexOrZero(receipt.assetId),
|
39092
39155
|
gas: bn(receipt.gas),
|
@@ -39100,7 +39163,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39100
39163
|
case "RETURN" /* Return */: {
|
39101
39164
|
const returnReceipt = {
|
39102
39165
|
type: ReceiptType.Return,
|
39103
|
-
id: hexOrZero(receipt.
|
39166
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39104
39167
|
val: bn(receipt.val),
|
39105
39168
|
pc: bn(receipt.pc),
|
39106
39169
|
is: bn(receipt.is)
|
@@ -39110,7 +39173,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39110
39173
|
case "RETURN_DATA" /* ReturnData */: {
|
39111
39174
|
const returnDataReceipt = {
|
39112
39175
|
type: ReceiptType.ReturnData,
|
39113
|
-
id: hexOrZero(receipt.
|
39176
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39114
39177
|
ptr: bn(receipt.ptr),
|
39115
39178
|
len: bn(receipt.len),
|
39116
39179
|
digest: hexOrZero(receipt.digest),
|
@@ -39122,7 +39185,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39122
39185
|
case "PANIC" /* Panic */: {
|
39123
39186
|
const panicReceipt = {
|
39124
39187
|
type: ReceiptType.Panic,
|
39125
|
-
id: hexOrZero(receipt.
|
39188
|
+
id: hexOrZero(receipt.id),
|
39126
39189
|
reason: bn(receipt.reason),
|
39127
39190
|
pc: bn(receipt.pc),
|
39128
39191
|
is: bn(receipt.is),
|
@@ -39133,7 +39196,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39133
39196
|
case "REVERT" /* Revert */: {
|
39134
39197
|
const revertReceipt = {
|
39135
39198
|
type: ReceiptType.Revert,
|
39136
|
-
id: hexOrZero(receipt.
|
39199
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39137
39200
|
val: bn(receipt.ra),
|
39138
39201
|
pc: bn(receipt.pc),
|
39139
39202
|
is: bn(receipt.is)
|
@@ -39143,7 +39206,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39143
39206
|
case "LOG" /* Log */: {
|
39144
39207
|
const logReceipt = {
|
39145
39208
|
type: ReceiptType.Log,
|
39146
|
-
id: hexOrZero(receipt.
|
39209
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39147
39210
|
val0: bn(receipt.ra),
|
39148
39211
|
val1: bn(receipt.rb),
|
39149
39212
|
val2: bn(receipt.rc),
|
@@ -39156,7 +39219,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39156
39219
|
case "LOG_DATA" /* LogData */: {
|
39157
39220
|
const logDataReceipt = {
|
39158
39221
|
type: ReceiptType.LogData,
|
39159
|
-
id: hexOrZero(receipt.
|
39222
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39160
39223
|
val0: bn(receipt.ra),
|
39161
39224
|
val1: bn(receipt.rb),
|
39162
39225
|
ptr: bn(receipt.ptr),
|
@@ -39170,8 +39233,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39170
39233
|
case "TRANSFER" /* Transfer */: {
|
39171
39234
|
const transferReceipt = {
|
39172
39235
|
type: ReceiptType.Transfer,
|
39173
|
-
from: hexOrZero(receipt.
|
39174
|
-
to: hexOrZero(receipt.toAddress || receipt?.to
|
39236
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39237
|
+
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39175
39238
|
amount: bn(receipt.amount),
|
39176
39239
|
assetId: hexOrZero(receipt.assetId),
|
39177
39240
|
pc: bn(receipt.pc),
|
@@ -39182,8 +39245,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39182
39245
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39183
39246
|
const transferOutReceipt = {
|
39184
39247
|
type: ReceiptType.TransferOut,
|
39185
|
-
from: hexOrZero(receipt.
|
39186
|
-
to: hexOrZero(receipt.toAddress || receipt.to
|
39248
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39249
|
+
to: hexOrZero(receipt.toAddress || receipt.to),
|
39187
39250
|
amount: bn(receipt.amount),
|
39188
39251
|
assetId: hexOrZero(receipt.assetId),
|
39189
39252
|
pc: bn(receipt.pc),
|
@@ -39226,7 +39289,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39226
39289
|
return receiptMessageOut;
|
39227
39290
|
}
|
39228
39291
|
case "MINT" /* Mint */: {
|
39229
|
-
const contractId = hexOrZero(receipt.
|
39292
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39230
39293
|
const subId = hexOrZero(receipt.subId);
|
39231
39294
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39232
39295
|
const mintReceipt = {
|
@@ -39241,7 +39304,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39241
39304
|
return mintReceipt;
|
39242
39305
|
}
|
39243
39306
|
case "BURN" /* Burn */: {
|
39244
|
-
const contractId = hexOrZero(receipt.
|
39307
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39245
39308
|
const subId = hexOrZero(receipt.subId);
|
39246
39309
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39247
39310
|
const burnReceipt = {
|
@@ -39322,7 +39385,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39322
39385
|
};
|
39323
39386
|
|
39324
39387
|
// src/providers/utils/gas.ts
|
39325
|
-
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39326
39388
|
var getGasUsedFromReceipts = (receipts) => {
|
39327
39389
|
const scriptResult = receipts.filter(
|
39328
39390
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39343,18 +39405,28 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39343
39405
|
}
|
39344
39406
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39345
39407
|
const witnessCache = [];
|
39346
|
-
const
|
39408
|
+
const chargeableInputs = inputs.filter((input) => {
|
39409
|
+
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39410
|
+
if (isCoinOrMessage) {
|
39411
|
+
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39412
|
+
return true;
|
39413
|
+
}
|
39414
|
+
if (!witnessCache.includes(input.witnessIndex)) {
|
39415
|
+
witnessCache.push(input.witnessIndex);
|
39416
|
+
return true;
|
39417
|
+
}
|
39418
|
+
}
|
39419
|
+
return false;
|
39420
|
+
});
|
39421
|
+
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39422
|
+
const totalGas = chargeableInputs.reduce((total, input) => {
|
39347
39423
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39348
39424
|
return total.add(
|
39349
|
-
|
39425
|
+
vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39350
39426
|
);
|
39351
39427
|
}
|
39352
|
-
|
39353
|
-
|
39354
|
-
return total.add(gasCosts.ecr1);
|
39355
|
-
}
|
39356
|
-
return total;
|
39357
|
-
}, bn());
|
39428
|
+
return total.add(gasCosts.ecr1);
|
39429
|
+
}, bn(0));
|
39358
39430
|
return totalGas;
|
39359
39431
|
}
|
39360
39432
|
function getMinGas(params) {
|
@@ -39366,12 +39438,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39366
39438
|
return minGas;
|
39367
39439
|
}
|
39368
39440
|
function getMaxGas(params) {
|
39369
|
-
const {
|
39441
|
+
const {
|
39442
|
+
gasPerByte,
|
39443
|
+
witnessesLength,
|
39444
|
+
witnessLimit,
|
39445
|
+
minGas,
|
39446
|
+
gasLimit = bn(0),
|
39447
|
+
maxGasPerTx
|
39448
|
+
} = params;
|
39370
39449
|
let remainingAllowedWitnessGas = bn(0);
|
39371
39450
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39372
39451
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39373
39452
|
}
|
39374
|
-
|
39453
|
+
const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39454
|
+
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39375
39455
|
}
|
39376
39456
|
function calculateMetadataGasForTxCreate({
|
39377
39457
|
gasCosts,
|
@@ -39393,6 +39473,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39393
39473
|
}) {
|
39394
39474
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39395
39475
|
}
|
39476
|
+
var calculateGasFee = (params) => {
|
39477
|
+
const { gas, gasPrice, priceFactor, tip } = params;
|
39478
|
+
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39479
|
+
};
|
39396
39480
|
|
39397
39481
|
// src/providers/utils/json.ts
|
39398
39482
|
function normalize2(object) {
|
@@ -39534,7 +39618,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39534
39618
|
// src/providers/transaction-request/transaction-request.ts
|
39535
39619
|
var BaseTransactionRequest = class {
|
39536
39620
|
/** Gas price for transaction */
|
39537
|
-
|
39621
|
+
tip;
|
39538
39622
|
/** Block until which tx cannot be included */
|
39539
39623
|
maturity;
|
39540
39624
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39553,7 +39637,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39553
39637
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39554
39638
|
*/
|
39555
39639
|
constructor({
|
39556
|
-
|
39640
|
+
tip,
|
39557
39641
|
maturity,
|
39558
39642
|
maxFee,
|
39559
39643
|
witnessLimit,
|
@@ -39561,7 +39645,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39561
39645
|
outputs,
|
39562
39646
|
witnesses
|
39563
39647
|
} = {}) {
|
39564
|
-
this.
|
39648
|
+
this.tip = bn(tip);
|
39565
39649
|
this.maturity = maturity ?? 0;
|
39566
39650
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39567
39651
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
@@ -39572,9 +39656,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39572
39656
|
static getPolicyMeta(req) {
|
39573
39657
|
let policyTypes = 0;
|
39574
39658
|
const policies = [];
|
39575
|
-
if (req.
|
39576
|
-
policyTypes += PolicyType.
|
39577
|
-
policies.push({ data: req.
|
39659
|
+
if (req.tip) {
|
39660
|
+
policyTypes += PolicyType.Tip;
|
39661
|
+
policies.push({ data: req.tip, type: PolicyType.Tip });
|
39578
39662
|
}
|
39579
39663
|
if (req.witnessLimit) {
|
39580
39664
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39761,10 +39845,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39761
39845
|
* @param predicate - Predicate bytes.
|
39762
39846
|
* @param predicateData - Predicate data bytes.
|
39763
39847
|
*/
|
39764
|
-
addCoinInput(coin
|
39848
|
+
addCoinInput(coin) {
|
39765
39849
|
const { assetId, owner, amount } = coin;
|
39766
39850
|
let witnessIndex;
|
39767
|
-
if (predicate) {
|
39851
|
+
if (coin.predicate) {
|
39768
39852
|
witnessIndex = 0;
|
39769
39853
|
} else {
|
39770
39854
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39779,9 +39863,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39779
39863
|
amount,
|
39780
39864
|
assetId,
|
39781
39865
|
txPointer: "0x00000000000000000000000000000000",
|
39782
|
-
witnessIndex
|
39783
|
-
predicate: predicate?.bytes,
|
39784
|
-
predicateData: predicate?.predicateDataBytes
|
39866
|
+
witnessIndex
|
39785
39867
|
};
|
39786
39868
|
this.pushInput(input);
|
39787
39869
|
this.addChangeOutput(owner, assetId);
|
@@ -39794,11 +39876,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39794
39876
|
* @param predicate - Predicate bytes.
|
39795
39877
|
* @param predicateData - Predicate data bytes.
|
39796
39878
|
*/
|
39797
|
-
addMessageInput(message
|
39879
|
+
addMessageInput(message) {
|
39798
39880
|
const { recipient, sender, amount } = message;
|
39799
39881
|
const assetId = BaseAssetId;
|
39800
39882
|
let witnessIndex;
|
39801
|
-
if (predicate) {
|
39883
|
+
if (message.predicate) {
|
39802
39884
|
witnessIndex = 0;
|
39803
39885
|
} else {
|
39804
39886
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39812,9 +39894,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39812
39894
|
sender: sender.toB256(),
|
39813
39895
|
recipient: recipient.toB256(),
|
39814
39896
|
amount,
|
39815
|
-
witnessIndex
|
39816
|
-
predicate: predicate?.bytes,
|
39817
|
-
predicateData: predicate?.predicateDataBytes
|
39897
|
+
witnessIndex
|
39818
39898
|
};
|
39819
39899
|
this.pushInput(input);
|
39820
39900
|
this.addChangeOutput(recipient, assetId);
|
@@ -39845,32 +39925,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39845
39925
|
resources.forEach((resource) => this.addResource(resource));
|
39846
39926
|
return this;
|
39847
39927
|
}
|
39848
|
-
/**
|
39849
|
-
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
39850
|
-
* outputs from the related assetIds.
|
39851
|
-
*
|
39852
|
-
* @param resources - The resources to add.
|
39853
|
-
* @returns This transaction.
|
39854
|
-
*/
|
39855
|
-
addPredicateResource(resource, predicate) {
|
39856
|
-
if (isCoin(resource)) {
|
39857
|
-
this.addCoinInput(resource, predicate);
|
39858
|
-
} else {
|
39859
|
-
this.addMessageInput(resource, predicate);
|
39860
|
-
}
|
39861
|
-
return this;
|
39862
|
-
}
|
39863
|
-
/**
|
39864
|
-
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
39865
|
-
* from the related assetIds.
|
39866
|
-
*
|
39867
|
-
* @param resources - The resources to add.
|
39868
|
-
* @returns This transaction.
|
39869
|
-
*/
|
39870
|
-
addPredicateResources(resources, predicate) {
|
39871
|
-
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
39872
|
-
return this;
|
39873
|
-
}
|
39874
39928
|
/**
|
39875
39929
|
* Adds a coin output to the transaction.
|
39876
39930
|
*
|
@@ -39950,7 +40004,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39950
40004
|
}
|
39951
40005
|
calculateMaxGas(chainInfo, minGas) {
|
39952
40006
|
const { consensusParameters } = chainInfo;
|
39953
|
-
const { gasPerByte } = consensusParameters;
|
40007
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
39954
40008
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
39955
40009
|
(acc, wit) => acc + wit.dataLength,
|
39956
40010
|
0
|
@@ -39959,7 +40013,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39959
40013
|
gasPerByte,
|
39960
40014
|
minGas,
|
39961
40015
|
witnessesLength,
|
39962
|
-
witnessLimit: this.witnessLimit
|
40016
|
+
witnessLimit: this.witnessLimit,
|
40017
|
+
maxGasPerTx
|
39963
40018
|
});
|
39964
40019
|
}
|
39965
40020
|
/**
|
@@ -39977,17 +40032,20 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39977
40032
|
});
|
39978
40033
|
const updateAssetInput = (assetId, quantity) => {
|
39979
40034
|
const assetInput = findAssetInput(assetId);
|
40035
|
+
let usedQuantity = quantity;
|
40036
|
+
if (assetId === BaseAssetId) {
|
40037
|
+
usedQuantity = bn("1000000000000000000");
|
40038
|
+
}
|
39980
40039
|
if (assetInput && "assetId" in assetInput) {
|
39981
|
-
assetInput.id = hexlify(randomBytes3(
|
39982
|
-
assetInput.amount =
|
40040
|
+
assetInput.id = hexlify(randomBytes3(34));
|
40041
|
+
assetInput.amount = usedQuantity;
|
39983
40042
|
} else {
|
39984
40043
|
this.addResources([
|
39985
40044
|
{
|
39986
|
-
id: hexlify(randomBytes3(
|
39987
|
-
amount:
|
40045
|
+
id: hexlify(randomBytes3(34)),
|
40046
|
+
amount: usedQuantity,
|
39988
40047
|
assetId,
|
39989
40048
|
owner: resourcesOwner || Address.fromRandom(),
|
39990
|
-
maturity: 0,
|
39991
40049
|
blockCreated: bn(1),
|
39992
40050
|
txCreatedIdx: bn(1)
|
39993
40051
|
}
|
@@ -40019,7 +40077,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40019
40077
|
toJSON() {
|
40020
40078
|
return normalizeJSON(this);
|
40021
40079
|
}
|
40022
|
-
|
40080
|
+
updatePredicateGasUsed(inputs) {
|
40023
40081
|
this.inputs.forEach((i) => {
|
40024
40082
|
let correspondingInput;
|
40025
40083
|
switch (i.type) {
|
@@ -40041,6 +40099,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40041
40099
|
}
|
40042
40100
|
});
|
40043
40101
|
}
|
40102
|
+
shiftPredicateData() {
|
40103
|
+
this.inputs.forEach((input) => {
|
40104
|
+
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
40105
|
+
input.predicateData = input.paddPredicateData(
|
40106
|
+
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40107
|
+
);
|
40108
|
+
}
|
40109
|
+
});
|
40110
|
+
}
|
40044
40111
|
};
|
40045
40112
|
|
40046
40113
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40174,9 +40241,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40174
40241
|
return {
|
40175
40242
|
type: TransactionType.Create,
|
40176
40243
|
...baseTransaction,
|
40177
|
-
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
40178
40244
|
bytecodeWitnessIndex,
|
40179
|
-
storageSlotsCount: storageSlots.length,
|
40245
|
+
storageSlotsCount: bn(storageSlots.length),
|
40180
40246
|
salt: this.salt ? hexlify(this.salt) : ZeroBytes32,
|
40181
40247
|
storageSlots
|
40182
40248
|
};
|
@@ -40290,8 +40356,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40290
40356
|
type: TransactionType.Script,
|
40291
40357
|
scriptGasLimit: this.gasLimit,
|
40292
40358
|
...super.getBaseTransaction(),
|
40293
|
-
scriptLength: script.length,
|
40294
|
-
scriptDataLength: scriptData.length,
|
40359
|
+
scriptLength: bn(script.length),
|
40360
|
+
scriptDataLength: bn(scriptData.length),
|
40295
40361
|
receiptsRoot: ZeroBytes32,
|
40296
40362
|
script: hexlify(script),
|
40297
40363
|
scriptData: hexlify(scriptData)
|
@@ -40355,7 +40421,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40355
40421
|
}
|
40356
40422
|
calculateMaxGas(chainInfo, minGas) {
|
40357
40423
|
const { consensusParameters } = chainInfo;
|
40358
|
-
const { gasPerByte } = consensusParameters;
|
40424
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
40359
40425
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40360
40426
|
(acc, wit) => acc + wit.dataLength,
|
40361
40427
|
0
|
@@ -40365,7 +40431,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40365
40431
|
minGas,
|
40366
40432
|
witnessesLength,
|
40367
40433
|
witnessLimit: this.witnessLimit,
|
40368
|
-
gasLimit: this.gasLimit
|
40434
|
+
gasLimit: this.gasLimit,
|
40435
|
+
maxGasPerTx
|
40369
40436
|
});
|
40370
40437
|
}
|
40371
40438
|
/**
|
@@ -40438,13 +40505,29 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40438
40505
|
}
|
40439
40506
|
}
|
40440
40507
|
};
|
40508
|
+
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40509
|
+
(acc, input) => {
|
40510
|
+
if (input.type === InputType.Coin && input.owner === owner) {
|
40511
|
+
acc.utxos.push(input.id);
|
40512
|
+
}
|
40513
|
+
if (input.type === InputType.Message && input.recipient === owner) {
|
40514
|
+
acc.messages.push(input.nonce);
|
40515
|
+
}
|
40516
|
+
return acc;
|
40517
|
+
},
|
40518
|
+
{
|
40519
|
+
utxos: [],
|
40520
|
+
messages: []
|
40521
|
+
}
|
40522
|
+
);
|
40441
40523
|
|
40442
40524
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40443
40525
|
var calculateTransactionFee = (params) => {
|
40444
40526
|
const {
|
40445
|
-
|
40527
|
+
gasPrice,
|
40446
40528
|
rawPayload,
|
40447
|
-
|
40529
|
+
tip,
|
40530
|
+
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40448
40531
|
} = params;
|
40449
40532
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40450
40533
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40454,8 +40537,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40454
40537
|
return {
|
40455
40538
|
fee: bn(0),
|
40456
40539
|
minFee: bn(0),
|
40457
|
-
maxFee: bn(0)
|
40458
|
-
feeFromGasUsed: bn(0)
|
40540
|
+
maxFee: bn(0)
|
40459
40541
|
};
|
40460
40542
|
}
|
40461
40543
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40487,7 +40569,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40487
40569
|
metadataGas,
|
40488
40570
|
txBytesSize: transactionBytes.length
|
40489
40571
|
});
|
40490
|
-
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40491
40572
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40492
40573
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40493
40574
|
const maxGas = getMaxGas({
|
@@ -40495,17 +40576,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40495
40576
|
minGas,
|
40496
40577
|
witnessesLength,
|
40497
40578
|
gasLimit,
|
40498
|
-
witnessLimit
|
40579
|
+
witnessLimit,
|
40580
|
+
maxGasPerTx
|
40581
|
+
});
|
40582
|
+
const minFee = calculateGasFee({
|
40583
|
+
gasPrice,
|
40584
|
+
gas: minGas,
|
40585
|
+
priceFactor: gasPriceFactor,
|
40586
|
+
tip
|
40587
|
+
});
|
40588
|
+
const maxFee = calculateGasFee({
|
40589
|
+
gasPrice,
|
40590
|
+
gas: maxGas,
|
40591
|
+
priceFactor: gasPriceFactor,
|
40592
|
+
tip
|
40499
40593
|
});
|
40500
|
-
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40501
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40502
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40503
|
-
const fee = minFee.add(feeFromGasUsed);
|
40504
40594
|
return {
|
40505
|
-
fee,
|
40506
40595
|
minFee,
|
40507
40596
|
maxFee,
|
40508
|
-
|
40597
|
+
fee: maxFee
|
40509
40598
|
};
|
40510
40599
|
};
|
40511
40600
|
|
@@ -41106,7 +41195,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41106
41195
|
gqlTransactionStatus,
|
41107
41196
|
abiMap = {},
|
41108
41197
|
maxInputs,
|
41109
|
-
gasCosts
|
41198
|
+
gasCosts,
|
41199
|
+
maxGasPerTx,
|
41200
|
+
gasPrice
|
41110
41201
|
} = params;
|
41111
41202
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
41112
41203
|
const rawPayload = hexlify(transactionBytes);
|
@@ -41120,11 +41211,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41120
41211
|
maxInputs
|
41121
41212
|
});
|
41122
41213
|
const typeName = getTransactionTypeName(transaction.type);
|
41214
|
+
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
41123
41215
|
const { fee } = calculateTransactionFee({
|
41124
|
-
|
41216
|
+
gasPrice,
|
41125
41217
|
rawPayload,
|
41218
|
+
tip,
|
41126
41219
|
consensusParameters: {
|
41127
41220
|
gasCosts,
|
41221
|
+
maxGasPerTx,
|
41128
41222
|
feeParams: {
|
41129
41223
|
gasPerByte,
|
41130
41224
|
gasPriceFactor
|
@@ -41260,8 +41354,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41260
41354
|
const decodedTransaction = this.decodeTransaction(
|
41261
41355
|
transaction
|
41262
41356
|
);
|
41263
|
-
|
41264
|
-
|
41357
|
+
let txReceipts = [];
|
41358
|
+
if (transaction?.status && "receipts" in transaction.status) {
|
41359
|
+
txReceipts = transaction.status.receipts;
|
41360
|
+
}
|
41361
|
+
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41362
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41363
|
+
const gasPrice = await this.provider.getLatestGasPrice();
|
41265
41364
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41266
41365
|
const transactionSummary = assembleTransactionSummary({
|
41267
41366
|
id: this.id,
|
@@ -41273,7 +41372,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41273
41372
|
gasPriceFactor,
|
41274
41373
|
abiMap: contractsAbiMap,
|
41275
41374
|
maxInputs,
|
41276
|
-
gasCosts
|
41375
|
+
gasCosts,
|
41376
|
+
maxGasPerTx,
|
41377
|
+
gasPrice
|
41277
41378
|
});
|
41278
41379
|
return transactionSummary;
|
41279
41380
|
}
|
@@ -41422,7 +41523,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41422
41523
|
gasCosts,
|
41423
41524
|
latestBlock: {
|
41424
41525
|
id: latestBlock.id,
|
41425
|
-
height: bn(latestBlock.
|
41526
|
+
height: bn(latestBlock.height),
|
41426
41527
|
time: latestBlock.header.time,
|
41427
41528
|
transactions: latestBlock.transactions.map((i) => ({
|
41428
41529
|
id: i.id
|
@@ -41516,10 +41617,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41516
41617
|
* Returns some helpful parameters related to gas fees.
|
41517
41618
|
*/
|
41518
41619
|
getGasConfig() {
|
41519
|
-
const { minGasPrice } = this.getNode();
|
41520
41620
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
41521
41621
|
return {
|
41522
|
-
minGasPrice,
|
41523
41622
|
maxGasPerTx,
|
41524
41623
|
maxGasPerPredicate,
|
41525
41624
|
gasPriceFactor,
|
@@ -41617,7 +41716,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41617
41716
|
*/
|
41618
41717
|
async getBlockNumber() {
|
41619
41718
|
const { chain } = await this.operations.getChain();
|
41620
|
-
return bn(chain.latestBlock.
|
41719
|
+
return bn(chain.latestBlock.height, 10);
|
41621
41720
|
}
|
41622
41721
|
/**
|
41623
41722
|
* Returns the chain information.
|
@@ -41629,11 +41728,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41629
41728
|
const processedNodeInfo = {
|
41630
41729
|
maxDepth: bn(nodeInfo.maxDepth),
|
41631
41730
|
maxTx: bn(nodeInfo.maxTx),
|
41632
|
-
minGasPrice: bn(nodeInfo.minGasPrice),
|
41633
41731
|
nodeVersion: nodeInfo.nodeVersion,
|
41634
41732
|
utxoValidation: nodeInfo.utxoValidation,
|
41635
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41636
|
-
peers: nodeInfo.peers
|
41733
|
+
vmBacktrace: nodeInfo.vmBacktrace
|
41637
41734
|
};
|
41638
41735
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41639
41736
|
return processedNodeInfo;
|
@@ -41719,14 +41816,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41719
41816
|
return this.estimateTxDependencies(transactionRequest);
|
41720
41817
|
}
|
41721
41818
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41722
|
-
const { dryRun:
|
41723
|
-
encodedTransaction,
|
41819
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41820
|
+
encodedTransactions: encodedTransaction,
|
41724
41821
|
utxoValidation: utxoValidation || false
|
41725
41822
|
});
|
41726
|
-
const receipts =
|
41727
|
-
|
41728
|
-
|
41729
|
-
};
|
41823
|
+
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
41824
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41825
|
+
return { receipts, dryrunStatus: status };
|
41730
41826
|
}
|
41731
41827
|
/**
|
41732
41828
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41765,9 +41861,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41765
41861
|
* If there are missing variable outputs,
|
41766
41862
|
* `addVariableOutputs` is called on the transaction.
|
41767
41863
|
*
|
41768
|
-
* @privateRemarks
|
41769
|
-
* TODO: Investigate support for missing contract IDs
|
41770
|
-
* TODO: Add support for missing output messages
|
41771
41864
|
*
|
41772
41865
|
* @param transactionRequest - The transaction request object.
|
41773
41866
|
* @returns A promise.
|
@@ -41780,16 +41873,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41780
41873
|
missingContractIds: []
|
41781
41874
|
};
|
41782
41875
|
}
|
41783
|
-
await this.estimatePredicates(transactionRequest);
|
41784
41876
|
let receipts = [];
|
41785
41877
|
const missingContractIds = [];
|
41786
41878
|
let outputVariables = 0;
|
41879
|
+
let dryrunStatus;
|
41787
41880
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41788
|
-
const {
|
41789
|
-
|
41881
|
+
const {
|
41882
|
+
dryRun: [{ receipts: rawReceipts, status }]
|
41883
|
+
} = await this.operations.dryRun({
|
41884
|
+
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41790
41885
|
utxoValidation: false
|
41791
41886
|
});
|
41792
|
-
receipts =
|
41887
|
+
receipts = rawReceipts.map(processGqlReceipt);
|
41888
|
+
dryrunStatus = status;
|
41793
41889
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41794
41890
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41795
41891
|
if (hasMissingOutputs) {
|
@@ -41799,6 +41895,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41799
41895
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41800
41896
|
missingContractIds.push(contractId);
|
41801
41897
|
});
|
41898
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41899
|
+
transactionRequest,
|
41900
|
+
optimizeGas: false
|
41901
|
+
});
|
41902
|
+
transactionRequest.maxFee = maxFee;
|
41802
41903
|
} else {
|
41803
41904
|
break;
|
41804
41905
|
}
|
@@ -41806,38 +41907,133 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41806
41907
|
return {
|
41807
41908
|
receipts,
|
41808
41909
|
outputVariables,
|
41809
|
-
missingContractIds
|
41910
|
+
missingContractIds,
|
41911
|
+
dryrunStatus
|
41810
41912
|
};
|
41811
41913
|
}
|
41812
41914
|
/**
|
41813
|
-
*
|
41814
|
-
*
|
41815
|
-
*
|
41816
|
-
*
|
41817
|
-
|
41818
|
-
|
41819
|
-
|
41820
|
-
|
41915
|
+
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41916
|
+
*
|
41917
|
+
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41918
|
+
* further modifications are identified. The method iteratively updates these transactions
|
41919
|
+
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41920
|
+
*
|
41921
|
+
* @param transactionRequests - Array of transaction request objects.
|
41922
|
+
* @returns A promise that resolves to an array of results for each transaction.
|
41923
|
+
*/
|
41924
|
+
async estimateMultipleTxDependencies(transactionRequests) {
|
41925
|
+
const results = transactionRequests.map(() => ({
|
41926
|
+
receipts: [],
|
41927
|
+
outputVariables: 0,
|
41928
|
+
missingContractIds: [],
|
41929
|
+
dryrunStatus: void 0
|
41930
|
+
}));
|
41931
|
+
const allRequests = clone_default(transactionRequests);
|
41932
|
+
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41933
|
+
allRequests.forEach((req, index) => {
|
41934
|
+
if (req.type === TransactionType.Script) {
|
41935
|
+
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41936
|
+
}
|
41937
|
+
});
|
41938
|
+
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41939
|
+
let attempt = 0;
|
41940
|
+
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41941
|
+
const encodedTransactions = transactionsToProcess.map(
|
41942
|
+
(index) => serializedTransactionsMap.get(index)
|
41943
|
+
);
|
41944
|
+
const dryRunResults = await this.operations.dryRun({
|
41945
|
+
encodedTransactions,
|
41946
|
+
utxoValidation: false
|
41947
|
+
});
|
41948
|
+
const nextRoundTransactions = [];
|
41949
|
+
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41950
|
+
const currentResultIndex = transactionsToProcess[i];
|
41951
|
+
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41952
|
+
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41953
|
+
results[currentResultIndex].dryrunStatus = status;
|
41954
|
+
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41955
|
+
results[currentResultIndex].receipts
|
41956
|
+
);
|
41957
|
+
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41958
|
+
const requestToProcess = allRequests[currentResultIndex];
|
41959
|
+
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
41960
|
+
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
41961
|
+
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
41962
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
41963
|
+
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
41964
|
+
results[currentResultIndex].missingContractIds.push(contractId);
|
41965
|
+
});
|
41966
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41967
|
+
transactionRequest: requestToProcess,
|
41968
|
+
optimizeGas: false
|
41969
|
+
});
|
41970
|
+
requestToProcess.maxFee = maxFee;
|
41971
|
+
serializedTransactionsMap.set(
|
41972
|
+
currentResultIndex,
|
41973
|
+
hexlify(requestToProcess.toTransactionBytes())
|
41974
|
+
);
|
41975
|
+
nextRoundTransactions.push(currentResultIndex);
|
41976
|
+
allRequests[currentResultIndex] = requestToProcess;
|
41977
|
+
}
|
41978
|
+
}
|
41979
|
+
transactionsToProcess = nextRoundTransactions;
|
41980
|
+
attempt += 1;
|
41981
|
+
}
|
41982
|
+
return results;
|
41983
|
+
}
|
41984
|
+
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
41985
|
+
if (estimateTxDependencies) {
|
41986
|
+
return this.estimateMultipleTxDependencies(transactionRequests);
|
41987
|
+
}
|
41988
|
+
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
41989
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41990
|
+
encodedTransactions,
|
41991
|
+
utxoValidation: utxoValidation || false
|
41992
|
+
});
|
41993
|
+
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
41994
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41995
|
+
return { receipts, dryrunStatus: status };
|
41996
|
+
});
|
41997
|
+
return results;
|
41998
|
+
}
|
41999
|
+
async estimateTxGasAndFee(params) {
|
42000
|
+
const { transactionRequest, optimizeGas = true } = params;
|
42001
|
+
let { gasPrice } = params;
|
41821
42002
|
const chainInfo = this.getChain();
|
41822
|
-
const
|
41823
|
-
transactionRequest.gasPrice = gasPrice;
|
42003
|
+
const { gasPriceFactor } = this.getGasConfig();
|
41824
42004
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
41825
|
-
|
42005
|
+
if (!gasPrice) {
|
42006
|
+
gasPrice = await this.estimateGasPrice(10);
|
42007
|
+
}
|
42008
|
+
const minFee = calculateGasFee({
|
42009
|
+
gasPrice: bn(gasPrice),
|
42010
|
+
gas: minGas,
|
42011
|
+
priceFactor: gasPriceFactor,
|
42012
|
+
tip: transactionRequest.tip
|
42013
|
+
}).add(1);
|
42014
|
+
let gasLimit = bn(0);
|
41826
42015
|
if (transactionRequest.type === TransactionType.Script) {
|
41827
|
-
|
42016
|
+
gasLimit = transactionRequest.gasLimit;
|
42017
|
+
if (!optimizeGas) {
|
41828
42018
|
transactionRequest.gasLimit = minGas;
|
41829
|
-
|
41830
|
-
|
41831
|
-
);
|
42019
|
+
gasLimit = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
42020
|
+
transactionRequest.gasLimit = gasLimit;
|
41832
42021
|
}
|
41833
42022
|
}
|
41834
42023
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
41835
|
-
const maxFee =
|
42024
|
+
const maxFee = calculateGasFee({
|
42025
|
+
gasPrice: bn(gasPrice),
|
42026
|
+
gas: maxGas,
|
42027
|
+
priceFactor: gasPriceFactor,
|
42028
|
+
tip: transactionRequest.tip
|
42029
|
+
}).add(1);
|
41836
42030
|
return {
|
41837
42031
|
minGas,
|
41838
42032
|
minFee,
|
41839
42033
|
maxGas,
|
41840
|
-
maxFee
|
42034
|
+
maxFee,
|
42035
|
+
gasPrice,
|
42036
|
+
gasLimit
|
41841
42037
|
};
|
41842
42038
|
}
|
41843
42039
|
/**
|
@@ -41855,15 +42051,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41855
42051
|
if (estimateTxDependencies) {
|
41856
42052
|
return this.estimateTxDependencies(transactionRequest);
|
41857
42053
|
}
|
41858
|
-
const
|
41859
|
-
const { dryRun:
|
41860
|
-
|
42054
|
+
const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
|
42055
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42056
|
+
encodedTransactions,
|
41861
42057
|
utxoValidation: true
|
41862
42058
|
});
|
41863
|
-
const
|
41864
|
-
|
41865
|
-
receipts
|
41866
|
-
|
42059
|
+
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
42060
|
+
const { id, receipts, status } = dryRunStatus;
|
42061
|
+
const processedReceipts = receipts.map(processGqlReceipt);
|
42062
|
+
return { id, receipts: processedReceipts, status };
|
42063
|
+
});
|
42064
|
+
return { receipts: callResult[0].receipts };
|
41867
42065
|
}
|
41868
42066
|
/**
|
41869
42067
|
* Returns a transaction cost to enable user
|
@@ -41880,77 +42078,80 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41880
42078
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
41881
42079
|
* @returns A promise that resolves to the transaction cost object.
|
41882
42080
|
*/
|
41883
|
-
async getTransactionCost(transactionRequestLike,
|
41884
|
-
estimateTxDependencies = true,
|
41885
|
-
estimatePredicates = true,
|
41886
|
-
resourcesOwner,
|
41887
|
-
signatureCallback
|
41888
|
-
} = {}) {
|
42081
|
+
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
41889
42082
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41890
|
-
const { minGasPrice } = this.getGasConfig();
|
41891
|
-
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
41892
42083
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
41893
42084
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
41894
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
42085
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
41895
42086
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42087
|
+
txRequestClone.maxFee = bn(0);
|
41896
42088
|
if (isScriptTransaction) {
|
41897
42089
|
txRequestClone.gasLimit = bn(0);
|
41898
42090
|
}
|
41899
|
-
if (
|
41900
|
-
|
41901
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41902
|
-
}
|
41903
|
-
await this.estimatePredicates(txRequestClone);
|
42091
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
42092
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41904
42093
|
}
|
42094
|
+
const signedRequest = clone_default(txRequestClone);
|
42095
|
+
let addedSignatures = 0;
|
41905
42096
|
if (signatureCallback && isScriptTransaction) {
|
41906
|
-
|
41907
|
-
|
41908
|
-
|
41909
|
-
|
42097
|
+
const lengthBefore = signedRequest.witnesses.length;
|
42098
|
+
await signatureCallback(signedRequest);
|
42099
|
+
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
42100
|
+
}
|
42101
|
+
await this.estimatePredicates(signedRequest);
|
42102
|
+
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
42103
|
+
transactionRequest: signedRequest,
|
42104
|
+
optimizeGas: false
|
41910
42105
|
});
|
42106
|
+
txRequestClone.maxFee = maxFee;
|
41911
42107
|
let receipts = [];
|
41912
42108
|
let missingContractIds = [];
|
41913
42109
|
let outputVariables = 0;
|
41914
42110
|
let gasUsed = bn(0);
|
41915
|
-
|
41916
|
-
|
42111
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
42112
|
+
if (isScriptTransaction) {
|
42113
|
+
if (signatureCallback) {
|
42114
|
+
await signatureCallback(txRequestClone);
|
42115
|
+
}
|
42116
|
+
txRequestClone.gasLimit = gasLimit;
|
41917
42117
|
const result = await this.estimateTxDependencies(txRequestClone);
|
41918
42118
|
receipts = result.receipts;
|
41919
42119
|
outputVariables = result.outputVariables;
|
41920
42120
|
missingContractIds = result.missingContractIds;
|
41921
|
-
gasUsed =
|
42121
|
+
gasUsed = getGasUsedFromReceipts(receipts);
|
41922
42122
|
txRequestClone.gasLimit = gasUsed;
|
41923
|
-
|
41924
|
-
|
41925
|
-
|
42123
|
+
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
42124
|
+
transactionRequest: txRequestClone,
|
42125
|
+
gasPrice
|
41926
42126
|
}));
|
41927
42127
|
}
|
41928
42128
|
return {
|
41929
42129
|
requiredQuantities: allQuantities,
|
41930
42130
|
receipts,
|
41931
42131
|
gasUsed,
|
41932
|
-
|
41933
|
-
gasPrice: setGasPrice,
|
42132
|
+
gasPrice,
|
41934
42133
|
minGas,
|
41935
42134
|
maxGas,
|
41936
42135
|
minFee,
|
41937
42136
|
maxFee,
|
41938
|
-
estimatedInputs: txRequestClone.inputs,
|
41939
42137
|
outputVariables,
|
41940
|
-
missingContractIds
|
42138
|
+
missingContractIds,
|
42139
|
+
addedSignatures,
|
42140
|
+
estimatedPredicates: txRequestClone.inputs
|
41941
42141
|
};
|
41942
42142
|
}
|
41943
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
42143
|
+
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
41944
42144
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41945
42145
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
41946
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42146
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
42147
|
+
quantitiesToContract
|
42148
|
+
});
|
41947
42149
|
transactionRequest.addResources(
|
41948
42150
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
41949
42151
|
);
|
41950
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41951
|
-
|
41952
|
-
|
41953
|
-
);
|
42152
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
42153
|
+
quantitiesToContract
|
42154
|
+
});
|
41954
42155
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
41955
42156
|
return {
|
41956
42157
|
resources,
|
@@ -41974,7 +42175,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41974
42175
|
assetId: coin.assetId,
|
41975
42176
|
amount: bn(coin.amount),
|
41976
42177
|
owner: Address.fromAddressOrString(coin.owner),
|
41977
|
-
maturity: bn(coin.maturity).toNumber(),
|
41978
42178
|
blockCreated: bn(coin.blockCreated),
|
41979
42179
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41980
42180
|
}));
|
@@ -42026,7 +42226,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42026
42226
|
amount: bn(coin.amount),
|
42027
42227
|
assetId: coin.assetId,
|
42028
42228
|
owner: Address.fromAddressOrString(coin.owner),
|
42029
|
-
maturity: bn(coin.maturity).toNumber(),
|
42030
42229
|
blockCreated: bn(coin.blockCreated),
|
42031
42230
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
42032
42231
|
};
|
@@ -42059,7 +42258,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42059
42258
|
}
|
42060
42259
|
return {
|
42061
42260
|
id: block2.id,
|
42062
|
-
height: bn(block2.
|
42261
|
+
height: bn(block2.height),
|
42063
42262
|
time: block2.header.time,
|
42064
42263
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42065
42264
|
};
|
@@ -42074,7 +42273,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42074
42273
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
42075
42274
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
42076
42275
|
id: block2.id,
|
42077
|
-
height: bn(block2.
|
42276
|
+
height: bn(block2.height),
|
42078
42277
|
time: block2.header.time,
|
42079
42278
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
42080
42279
|
}));
|
@@ -42101,7 +42300,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42101
42300
|
}
|
42102
42301
|
return {
|
42103
42302
|
id: block2.id,
|
42104
|
-
height: bn(block2.
|
42303
|
+
height: bn(block2.height, 10),
|
42105
42304
|
time: block2.header.time,
|
42106
42305
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42107
42306
|
transactions: block2.transactions.map(
|
@@ -42281,7 +42480,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42281
42480
|
prevRoot: messageBlockHeader.prevRoot,
|
42282
42481
|
time: messageBlockHeader.time,
|
42283
42482
|
applicationHash: messageBlockHeader.applicationHash,
|
42284
|
-
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
42285
42483
|
messageReceiptCount: bn(messageBlockHeader.messageReceiptCount)
|
42286
42484
|
},
|
42287
42485
|
commitBlockHeader: {
|
@@ -42293,7 +42491,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42293
42491
|
prevRoot: commitBlockHeader.prevRoot,
|
42294
42492
|
time: commitBlockHeader.time,
|
42295
42493
|
applicationHash: commitBlockHeader.applicationHash,
|
42296
|
-
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
42297
42494
|
messageReceiptCount: bn(commitBlockHeader.messageReceiptCount)
|
42298
42495
|
},
|
42299
42496
|
sender: Address.fromAddressOrString(sender),
|
@@ -42303,6 +42500,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42303
42500
|
data
|
42304
42501
|
};
|
42305
42502
|
}
|
42503
|
+
async getLatestGasPrice() {
|
42504
|
+
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42505
|
+
return bn(latestGasPrice.gasPrice);
|
42506
|
+
}
|
42507
|
+
async estimateGasPrice(blockHorizon) {
|
42508
|
+
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42509
|
+
blockHorizon: String(blockHorizon)
|
42510
|
+
});
|
42511
|
+
return bn(estimateGasPrice.gasPrice);
|
42512
|
+
}
|
42306
42513
|
/**
|
42307
42514
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42308
42515
|
*
|
@@ -42363,10 +42570,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42363
42570
|
arrayify(gqlTransaction.rawPayload),
|
42364
42571
|
0
|
42365
42572
|
);
|
42366
|
-
|
42573
|
+
let txReceipts = [];
|
42574
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42575
|
+
txReceipts = gqlTransaction.status.receipts;
|
42576
|
+
}
|
42577
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42367
42578
|
const {
|
42368
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42579
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42369
42580
|
} = provider.getChain();
|
42581
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42370
42582
|
const transactionInfo = assembleTransactionSummary({
|
42371
42583
|
id: gqlTransaction.id,
|
42372
42584
|
receipts,
|
@@ -42377,7 +42589,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42377
42589
|
gasPriceFactor: bn(gasPriceFactor),
|
42378
42590
|
abiMap,
|
42379
42591
|
maxInputs,
|
42380
|
-
gasCosts
|
42592
|
+
gasCosts,
|
42593
|
+
maxGasPerTx,
|
42594
|
+
gasPrice
|
42381
42595
|
});
|
42382
42596
|
return {
|
42383
42597
|
gqlTransaction,
|
@@ -42387,10 +42601,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42387
42601
|
async function getTransactionSummaryFromRequest(params) {
|
42388
42602
|
const { provider, transactionRequest, abiMap } = params;
|
42389
42603
|
const { receipts } = await provider.call(transactionRequest);
|
42390
|
-
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42604
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
|
42391
42605
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42392
42606
|
const transaction = transactionRequest.toTransaction();
|
42393
42607
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42608
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42394
42609
|
const transactionSummary = assembleTransactionSummary({
|
42395
42610
|
receipts,
|
42396
42611
|
transaction,
|
@@ -42399,7 +42614,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42399
42614
|
gasPerByte,
|
42400
42615
|
gasPriceFactor,
|
42401
42616
|
maxInputs,
|
42402
|
-
gasCosts
|
42617
|
+
gasCosts,
|
42618
|
+
maxGasPerTx,
|
42619
|
+
gasPrice
|
42403
42620
|
});
|
42404
42621
|
return transactionSummary;
|
42405
42622
|
}
|
@@ -42408,13 +42625,18 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42408
42625
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42409
42626
|
const { edges, pageInfo } = transactionsByOwner;
|
42410
42627
|
const {
|
42411
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42628
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42412
42629
|
} = provider.getChain();
|
42630
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42413
42631
|
const transactions = edges.map((edge) => {
|
42414
42632
|
const { node: gqlTransaction } = edge;
|
42415
|
-
const { id, rawPayload,
|
42633
|
+
const { id, rawPayload, status } = gqlTransaction;
|
42416
42634
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42417
|
-
|
42635
|
+
let txReceipts = [];
|
42636
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42637
|
+
txReceipts = gqlTransaction.status.receipts;
|
42638
|
+
}
|
42639
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42418
42640
|
const transactionSummary = assembleTransactionSummary({
|
42419
42641
|
id,
|
42420
42642
|
receipts,
|
@@ -42425,7 +42647,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42425
42647
|
gasPerByte,
|
42426
42648
|
gasPriceFactor,
|
42427
42649
|
maxInputs,
|
42428
|
-
gasCosts
|
42650
|
+
gasCosts,
|
42651
|
+
maxGasPerTx,
|
42652
|
+
gasPrice
|
42429
42653
|
});
|
42430
42654
|
const output3 = {
|
42431
42655
|
gqlTransaction,
|
@@ -42754,36 +42978,33 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42754
42978
|
* @param fee - The estimated transaction fee.
|
42755
42979
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42756
42980
|
*/
|
42757
|
-
async fund(request,
|
42758
|
-
const
|
42981
|
+
async fund(request, params) {
|
42982
|
+
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
42983
|
+
const txRequest = request;
|
42984
|
+
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42759
42985
|
amount: bn(fee),
|
42760
42986
|
assetId: BaseAssetId,
|
42761
|
-
coinQuantities
|
42987
|
+
coinQuantities: requiredQuantities
|
42762
42988
|
});
|
42763
42989
|
const quantitiesDict = {};
|
42764
|
-
|
42990
|
+
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
42765
42991
|
quantitiesDict[assetId] = {
|
42766
42992
|
required: amount,
|
42767
42993
|
owned: bn(0)
|
42768
42994
|
};
|
42769
42995
|
});
|
42770
|
-
|
42771
|
-
const cachedMessages = [];
|
42772
|
-
const owner = this.address.toB256();
|
42773
|
-
request.inputs.forEach((input) => {
|
42996
|
+
txRequest.inputs.forEach((input) => {
|
42774
42997
|
const isResource = "amount" in input;
|
42775
42998
|
if (isResource) {
|
42776
42999
|
const isCoin2 = "owner" in input;
|
42777
43000
|
if (isCoin2) {
|
42778
43001
|
const assetId = String(input.assetId);
|
42779
|
-
if (
|
43002
|
+
if (quantitiesDict[assetId]) {
|
42780
43003
|
const amount = bn(input.amount);
|
42781
43004
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42782
|
-
cachedUtxos.push(input.id);
|
42783
43005
|
}
|
42784
|
-
} else if (input.
|
43006
|
+
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42785
43007
|
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42786
|
-
cachedMessages.push(input.nonce);
|
42787
43008
|
}
|
42788
43009
|
}
|
42789
43010
|
});
|
@@ -42798,12 +43019,23 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42798
43019
|
});
|
42799
43020
|
const needsToBeFunded = missingQuantities.length;
|
42800
43021
|
if (needsToBeFunded) {
|
42801
|
-
const
|
42802
|
-
|
42803
|
-
|
42804
|
-
|
42805
|
-
|
43022
|
+
const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
|
43023
|
+
const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
|
43024
|
+
txRequest.addResources(resources);
|
43025
|
+
}
|
43026
|
+
txRequest.shiftPredicateData();
|
43027
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
43028
|
+
const requestToBeReEstimate = clone_default(txRequest);
|
43029
|
+
if (addedSignatures) {
|
43030
|
+
Array.from({ length: addedSignatures }).forEach(
|
43031
|
+
() => requestToBeReEstimate.addEmptyWitness()
|
43032
|
+
);
|
42806
43033
|
}
|
43034
|
+
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
43035
|
+
transactionRequest: requestToBeReEstimate
|
43036
|
+
});
|
43037
|
+
txRequest.maxFee = maxFee;
|
43038
|
+
return txRequest;
|
42807
43039
|
}
|
42808
43040
|
/**
|
42809
43041
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -42811,28 +43043,25 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42811
43043
|
* @param destination - The address of the destination.
|
42812
43044
|
* @param amount - The amount of coins to transfer.
|
42813
43045
|
* @param assetId - The asset ID of the coins to transfer.
|
42814
|
-
* @param txParams - The transaction parameters (gasLimit,
|
43046
|
+
* @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
|
42815
43047
|
* @returns A promise that resolves to the prepared transaction request.
|
42816
43048
|
*/
|
42817
43049
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42818
|
-
const
|
42819
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42820
|
-
const request = new ScriptTransactionRequest(params);
|
43050
|
+
const request = new ScriptTransactionRequest(txParams);
|
42821
43051
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
42822
|
-
const
|
43052
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
42823
43053
|
estimateTxDependencies: true,
|
42824
43054
|
resourcesOwner: this
|
42825
43055
|
});
|
42826
|
-
|
42827
|
-
|
42828
|
-
|
42829
|
-
|
42830
|
-
|
42831
|
-
|
42832
|
-
|
42833
|
-
|
42834
|
-
await this.fund(request,
|
42835
|
-
request.updatePredicateInputs(estimatedInputs);
|
43056
|
+
if ("gasLimit" in txParams) {
|
43057
|
+
this.validateGas({
|
43058
|
+
gasUsed: txCost.gasUsed,
|
43059
|
+
gasLimit: request.gasLimit
|
43060
|
+
});
|
43061
|
+
}
|
43062
|
+
request.gasLimit = txCost.gasUsed;
|
43063
|
+
request.maxFee = txCost.maxFee;
|
43064
|
+
await this.fund(request, txCost);
|
42836
43065
|
return request;
|
42837
43066
|
}
|
42838
43067
|
/**
|
@@ -42871,31 +43100,30 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42871
43100
|
);
|
42872
43101
|
}
|
42873
43102
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42874
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42875
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42876
43103
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42877
43104
|
hexlifiedContractId: contractAddress.toB256(),
|
42878
43105
|
amountToTransfer: bn(amount),
|
42879
43106
|
assetId
|
42880
43107
|
});
|
42881
43108
|
const request = new ScriptTransactionRequest({
|
42882
|
-
...
|
43109
|
+
...txParams,
|
42883
43110
|
script,
|
42884
43111
|
scriptData
|
42885
43112
|
});
|
42886
43113
|
request.addContractInputAndOutput(contractAddress);
|
42887
|
-
const
|
42888
|
-
|
42889
|
-
[{ amount: bn(amount), assetId: String(assetId) }]
|
42890
|
-
);
|
42891
|
-
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42892
|
-
this.validateGas({
|
42893
|
-
gasUsed,
|
42894
|
-
gasPrice: request.gasPrice,
|
42895
|
-
gasLimit: request.gasLimit,
|
42896
|
-
minGasPrice
|
43114
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
43115
|
+
resourcesOwner: this,
|
43116
|
+
quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
|
42897
43117
|
});
|
42898
|
-
|
43118
|
+
if (txParams.gasLimit) {
|
43119
|
+
this.validateGas({
|
43120
|
+
gasUsed: txCost.gasUsed,
|
43121
|
+
gasLimit: request.gasLimit
|
43122
|
+
});
|
43123
|
+
}
|
43124
|
+
request.gasLimit = txCost.gasUsed;
|
43125
|
+
request.maxFee = txCost.maxFee;
|
43126
|
+
await this.fund(request, txCost);
|
42899
43127
|
return this.sendTransaction(request);
|
42900
43128
|
}
|
42901
43129
|
/**
|
@@ -42907,7 +43135,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42907
43135
|
* @returns A promise that resolves to the transaction response.
|
42908
43136
|
*/
|
42909
43137
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42910
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42911
43138
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42912
43139
|
const recipientDataArray = arrayify(
|
42913
43140
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42920,21 +43147,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42920
43147
|
...recipientDataArray,
|
42921
43148
|
...amountDataArray
|
42922
43149
|
]);
|
42923
|
-
const params = { script,
|
43150
|
+
const params = { script, ...txParams };
|
42924
43151
|
const request = new ScriptTransactionRequest(params);
|
42925
|
-
const
|
42926
|
-
const
|
42927
|
-
|
42928
|
-
|
42929
|
-
|
42930
|
-
|
42931
|
-
|
42932
|
-
|
42933
|
-
|
42934
|
-
|
42935
|
-
|
42936
|
-
});
|
42937
|
-
await this.fund(request, requiredQuantities, maxFee);
|
43152
|
+
const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
|
43153
|
+
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
43154
|
+
if (txParams.gasLimit) {
|
43155
|
+
this.validateGas({
|
43156
|
+
gasUsed: txCost.gasUsed,
|
43157
|
+
gasLimit: request.gasLimit
|
43158
|
+
});
|
43159
|
+
}
|
43160
|
+
request.maxFee = txCost.maxFee;
|
43161
|
+
request.gasLimit = txCost.gasUsed;
|
43162
|
+
await this.fund(request, txCost);
|
42938
43163
|
return this.sendTransaction(request);
|
42939
43164
|
}
|
42940
43165
|
async signMessage(message) {
|
@@ -42992,18 +43217,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
42992
43217
|
}
|
42993
43218
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
42994
43219
|
}
|
42995
|
-
validateGas({
|
42996
|
-
gasUsed,
|
42997
|
-
gasPrice,
|
42998
|
-
gasLimit,
|
42999
|
-
minGasPrice
|
43000
|
-
}) {
|
43001
|
-
if (minGasPrice.gt(gasPrice)) {
|
43002
|
-
throw new FuelError(
|
43003
|
-
ErrorCode.GAS_PRICE_TOO_LOW,
|
43004
|
-
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
43005
|
-
);
|
43006
|
-
}
|
43220
|
+
validateGas({ gasUsed, gasLimit }) {
|
43007
43221
|
if (gasUsed.gt(gasLimit)) {
|
43008
43222
|
throw new FuelError(
|
43009
43223
|
ErrorCode.GAS_LIMIT_TOO_LOW,
|
@@ -44592,7 +44806,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44592
44806
|
* @param transactionRequestLike - The transaction request to send.
|
44593
44807
|
* @returns A promise that resolves to the TransactionResponse object.
|
44594
44808
|
*/
|
44595
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44809
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
44596
44810
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44597
44811
|
if (estimateTxDependencies) {
|
44598
44812
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -47858,6 +48072,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47858
48072
|
this.interface = predicateInterface;
|
47859
48073
|
if (inputData !== void 0 && inputData.length > 0) {
|
47860
48074
|
this.predicateData = inputData;
|
48075
|
+
this.predicateDataBytes = this.getPredicateData(0);
|
47861
48076
|
}
|
47862
48077
|
}
|
47863
48078
|
/**
|
@@ -47871,8 +48086,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47871
48086
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
47872
48087
|
request.inputs?.forEach((input) => {
|
47873
48088
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
47874
|
-
input.predicate = this.bytes;
|
47875
|
-
input.predicateData = this.getPredicateData(policies.length);
|
48089
|
+
input.predicate = hexlify(this.bytes);
|
48090
|
+
input.predicateData = hexlify(this.getPredicateData(policies.length));
|
47876
48091
|
}
|
47877
48092
|
});
|
47878
48093
|
return request;
|
@@ -47887,8 +48102,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47887
48102
|
* @returns A promise that resolves to the prepared transaction request.
|
47888
48103
|
*/
|
47889
48104
|
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
47890
|
-
|
47891
|
-
return this.populateTransactionPredicateData(request);
|
48105
|
+
return super.createTransfer(destination, amount, assetId, txParams);
|
47892
48106
|
}
|
47893
48107
|
/**
|
47894
48108
|
* Sends a transaction with the populated predicate data.
|
@@ -47896,9 +48110,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47896
48110
|
* @param transactionRequestLike - The transaction request-like object.
|
47897
48111
|
* @returns A promise that resolves to the transaction response.
|
47898
48112
|
*/
|
47899
|
-
sendTransaction(transactionRequestLike
|
47900
|
-
const transactionRequest =
|
47901
|
-
return super.sendTransaction(transactionRequest,
|
48113
|
+
sendTransaction(transactionRequestLike) {
|
48114
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48115
|
+
return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
|
47902
48116
|
}
|
47903
48117
|
/**
|
47904
48118
|
* Simulates a transaction with the populated predicate data.
|
@@ -47907,8 +48121,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47907
48121
|
* @returns A promise that resolves to the call result.
|
47908
48122
|
*/
|
47909
48123
|
simulateTransaction(transactionRequestLike) {
|
47910
|
-
const transactionRequest =
|
47911
|
-
return super.simulateTransaction(transactionRequest);
|
48124
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48125
|
+
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
47912
48126
|
}
|
47913
48127
|
getPredicateData(policiesLength) {
|
47914
48128
|
if (!this.predicateData.length) {
|
@@ -47954,6 +48168,26 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
47954
48168
|
predicateInterface: abiInterface
|
47955
48169
|
};
|
47956
48170
|
}
|
48171
|
+
/**
|
48172
|
+
* Retrieves resources satisfying the spend query for the account.
|
48173
|
+
*
|
48174
|
+
* @param quantities - IDs of coins to exclude.
|
48175
|
+
* @param excludedIds - IDs of resources to be excluded from the query.
|
48176
|
+
* @returns A promise that resolves to an array of Resources.
|
48177
|
+
*/
|
48178
|
+
async getResourcesToSpend(quantities, excludedIds) {
|
48179
|
+
const resources = await this.provider.getResourcesToSpend(
|
48180
|
+
this.address,
|
48181
|
+
quantities,
|
48182
|
+
excludedIds
|
48183
|
+
);
|
48184
|
+
return resources.map((resource) => ({
|
48185
|
+
...resource,
|
48186
|
+
predicate: hexlify(this.bytes),
|
48187
|
+
predicateData: hexlify(this.predicateDataBytes),
|
48188
|
+
paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48189
|
+
}));
|
48190
|
+
}
|
47957
48191
|
/**
|
47958
48192
|
* Sets the configurable constants for the predicate.
|
47959
48193
|
*
|