@fuel-ts/account 0.0.0-rc-1976-20240404073406 → 0.0.0-rc-1764-20240404125616
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 +912 -544
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1032 -714
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +909 -587
- 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 +822 -303
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +3 -3
- 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 -0
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +44 -31
- package/dist/providers/provider.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 +9 -29
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +3 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +36 -0
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -0
- package/dist/providers/utils/gas.d.ts +8 -2
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +1 -0
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +871 -540
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +944 -671
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +832 -551
- 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.23.0",
|
28957
28957
|
FUELS: "0.79.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
@@ -29083,6 +29083,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29083
29083
|
})(ErrorCode || {});
|
29084
29084
|
var _FuelError = class extends Error {
|
29085
29085
|
VERSIONS = versions;
|
29086
|
+
metadata;
|
29086
29087
|
static parse(e) {
|
29087
29088
|
const error = e;
|
29088
29089
|
if (error.code === void 0) {
|
@@ -29102,14 +29103,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29102
29103
|
return new _FuelError(error.code, error.message);
|
29103
29104
|
}
|
29104
29105
|
code;
|
29105
|
-
constructor(code, message) {
|
29106
|
+
constructor(code, message, metadata = {}) {
|
29106
29107
|
super(message);
|
29107
29108
|
this.code = code;
|
29108
29109
|
this.name = "FuelError";
|
29110
|
+
this.metadata = metadata;
|
29109
29111
|
}
|
29110
29112
|
toObject() {
|
29111
|
-
const { code, name, message, VERSIONS } = this;
|
29112
|
-
return { code, name, message, VERSIONS };
|
29113
|
+
const { code, name, message, metadata, VERSIONS } = this;
|
29114
|
+
return { code, name, message, metadata, VERSIONS };
|
29113
29115
|
}
|
29114
29116
|
};
|
29115
29117
|
var FuelError = _FuelError;
|
@@ -29242,7 +29244,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29242
29244
|
__publicField3(DateTime, "TAI64_NULL", "");
|
29243
29245
|
|
29244
29246
|
// ../crypto/dist/index.mjs
|
29245
|
-
var
|
29247
|
+
var import_crypto9 = __toESM(__require("crypto"), 1);
|
29246
29248
|
|
29247
29249
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
29248
29250
|
var version = "6.7.1";
|
@@ -30314,6 +30316,27 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30314
30316
|
};
|
30315
30317
|
Object.freeze(pbkdf22);
|
30316
30318
|
|
30319
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/random.js
|
30320
|
+
var locked5 = false;
|
30321
|
+
var _randomBytes = function(length) {
|
30322
|
+
return new Uint8Array((0, import_crypto2.randomBytes)(length));
|
30323
|
+
};
|
30324
|
+
var __randomBytes = _randomBytes;
|
30325
|
+
function randomBytes3(length) {
|
30326
|
+
return __randomBytes(length);
|
30327
|
+
}
|
30328
|
+
randomBytes3._ = _randomBytes;
|
30329
|
+
randomBytes3.lock = function() {
|
30330
|
+
locked5 = true;
|
30331
|
+
};
|
30332
|
+
randomBytes3.register = function(func) {
|
30333
|
+
if (locked5) {
|
30334
|
+
throw new Error("randomBytes is locked");
|
30335
|
+
}
|
30336
|
+
__randomBytes = func;
|
30337
|
+
};
|
30338
|
+
Object.freeze(randomBytes3);
|
30339
|
+
|
30317
30340
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
|
30318
30341
|
var BN_03 = BigInt(0);
|
30319
30342
|
var BN_36 = BigInt(36);
|
@@ -30898,8 +30921,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30898
30921
|
}
|
30899
30922
|
|
30900
30923
|
// ../crypto/dist/index.mjs
|
30901
|
-
var import_crypto9 = __toESM(__require("crypto"), 1);
|
30902
30924
|
var import_crypto10 = __toESM(__require("crypto"), 1);
|
30925
|
+
var import_crypto11 = __toESM(__require("crypto"), 1);
|
30903
30926
|
var scrypt3 = (params) => {
|
30904
30927
|
const { password, salt, n, p, r, dklen } = params;
|
30905
30928
|
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
@@ -30908,7 +30931,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30908
30931
|
var keccak2562 = (data) => keccak_256(data);
|
30909
30932
|
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
30910
30933
|
var randomBytes4 = (length) => {
|
30911
|
-
const randomValues = Uint8Array.from(
|
30934
|
+
const randomValues = Uint8Array.from(import_crypto10.default.randomBytes(length));
|
30912
30935
|
return randomValues;
|
30913
30936
|
};
|
30914
30937
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -30923,7 +30946,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30923
30946
|
const salt = randomBytes4(32);
|
30924
30947
|
const secret = keyFromPassword(password, salt);
|
30925
30948
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
30926
|
-
const cipher = await
|
30949
|
+
const cipher = await import_crypto9.default.createCipheriv(ALGORITHM, secret, iv);
|
30927
30950
|
let cipherData = cipher.update(dataBuffer);
|
30928
30951
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
30929
30952
|
return {
|
@@ -30937,7 +30960,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30937
30960
|
const salt = bufferFromString(keystore.salt);
|
30938
30961
|
const secret = keyFromPassword(password, salt);
|
30939
30962
|
const encryptedText = bufferFromString(keystore.data);
|
30940
|
-
const decipher = await
|
30963
|
+
const decipher = await import_crypto9.default.createDecipheriv(ALGORITHM, secret, iv);
|
30941
30964
|
const decrypted = decipher.update(encryptedText);
|
30942
30965
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
30943
30966
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -30948,12 +30971,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30948
30971
|
}
|
30949
30972
|
};
|
30950
30973
|
async function encryptJsonWalletData(data, key, iv) {
|
30951
|
-
const cipher = await
|
30974
|
+
const cipher = await import_crypto11.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30952
30975
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
30953
30976
|
return new Uint8Array(encrypted);
|
30954
30977
|
}
|
30955
30978
|
async function decryptJsonWalletData(data, key, iv) {
|
30956
|
-
const decipher =
|
30979
|
+
const decipher = import_crypto11.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30957
30980
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
30958
30981
|
return new Uint8Array(decrypted);
|
30959
30982
|
}
|
@@ -31269,6 +31292,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31269
31292
|
}
|
31270
31293
|
};
|
31271
31294
|
|
31295
|
+
// ../address/dist/configs.mjs
|
31296
|
+
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
31297
|
+
var BaseAssetId = ZeroBytes32;
|
31298
|
+
|
31272
31299
|
// ../math/dist/index.mjs
|
31273
31300
|
var import_bn = __toESM(require_bn(), 1);
|
31274
31301
|
var DEFAULT_PRECISION = 9;
|
@@ -31488,32 +31515,182 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31488
31515
|
function toBytes3(value, bytesPadding) {
|
31489
31516
|
return bn(value).toBytes(bytesPadding);
|
31490
31517
|
}
|
31491
|
-
|
31492
|
-
|
31518
|
+
|
31519
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
31520
|
+
function _isPlaceholder(a) {
|
31521
|
+
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
31522
|
+
}
|
31523
|
+
|
31524
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
31525
|
+
function _curry1(fn) {
|
31526
|
+
return function f1(a) {
|
31527
|
+
if (arguments.length === 0 || _isPlaceholder(a)) {
|
31528
|
+
return f1;
|
31529
|
+
} else {
|
31530
|
+
return fn.apply(this, arguments);
|
31531
|
+
}
|
31532
|
+
};
|
31533
|
+
}
|
31534
|
+
|
31535
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
31536
|
+
var isArray_default = Array.isArray || function _isArray(val) {
|
31537
|
+
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
31538
|
+
};
|
31539
|
+
|
31540
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
31541
|
+
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
31542
|
+
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
31543
|
+
});
|
31544
|
+
var type_default = type;
|
31545
|
+
|
31546
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
31547
|
+
var pad = function pad2(n) {
|
31548
|
+
return (n < 10 ? "0" : "") + n;
|
31549
|
+
};
|
31550
|
+
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
31551
|
+
return d.toISOString();
|
31552
|
+
} : function _toISOString3(d) {
|
31553
|
+
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";
|
31554
|
+
};
|
31555
|
+
|
31556
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
31557
|
+
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
31558
|
+
return n << 0 === n;
|
31559
|
+
};
|
31560
|
+
|
31561
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
31562
|
+
function _cloneRegExp(pattern) {
|
31563
|
+
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" : ""));
|
31493
31564
|
}
|
31494
31565
|
|
31566
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
31567
|
+
function _clone(value, deep, map) {
|
31568
|
+
map || (map = new _ObjectMap());
|
31569
|
+
if (_isPrimitive(value)) {
|
31570
|
+
return value;
|
31571
|
+
}
|
31572
|
+
var copy = function copy2(copiedValue) {
|
31573
|
+
var cachedCopy = map.get(value);
|
31574
|
+
if (cachedCopy) {
|
31575
|
+
return cachedCopy;
|
31576
|
+
}
|
31577
|
+
map.set(value, copiedValue);
|
31578
|
+
for (var key in value) {
|
31579
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
31580
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
31581
|
+
}
|
31582
|
+
}
|
31583
|
+
return copiedValue;
|
31584
|
+
};
|
31585
|
+
switch (type_default(value)) {
|
31586
|
+
case "Object":
|
31587
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
31588
|
+
case "Array":
|
31589
|
+
return copy([]);
|
31590
|
+
case "Date":
|
31591
|
+
return new Date(value.valueOf());
|
31592
|
+
case "RegExp":
|
31593
|
+
return _cloneRegExp(value);
|
31594
|
+
case "Int8Array":
|
31595
|
+
case "Uint8Array":
|
31596
|
+
case "Uint8ClampedArray":
|
31597
|
+
case "Int16Array":
|
31598
|
+
case "Uint16Array":
|
31599
|
+
case "Int32Array":
|
31600
|
+
case "Uint32Array":
|
31601
|
+
case "Float32Array":
|
31602
|
+
case "Float64Array":
|
31603
|
+
case "BigInt64Array":
|
31604
|
+
case "BigUint64Array":
|
31605
|
+
return value.slice();
|
31606
|
+
default:
|
31607
|
+
return value;
|
31608
|
+
}
|
31609
|
+
}
|
31610
|
+
function _isPrimitive(param) {
|
31611
|
+
var type3 = typeof param;
|
31612
|
+
return param == null || type3 != "object" && type3 != "function";
|
31613
|
+
}
|
31614
|
+
var _ObjectMap = /* @__PURE__ */ function() {
|
31615
|
+
function _ObjectMap2() {
|
31616
|
+
this.map = {};
|
31617
|
+
this.length = 0;
|
31618
|
+
}
|
31619
|
+
_ObjectMap2.prototype.set = function(key, value) {
|
31620
|
+
const hashedKey = this.hash(key);
|
31621
|
+
let bucket = this.map[hashedKey];
|
31622
|
+
if (!bucket) {
|
31623
|
+
this.map[hashedKey] = bucket = [];
|
31624
|
+
}
|
31625
|
+
bucket.push([key, value]);
|
31626
|
+
this.length += 1;
|
31627
|
+
};
|
31628
|
+
_ObjectMap2.prototype.hash = function(key) {
|
31629
|
+
let hashedKey = [];
|
31630
|
+
for (var value in key) {
|
31631
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
31632
|
+
}
|
31633
|
+
return hashedKey.join();
|
31634
|
+
};
|
31635
|
+
_ObjectMap2.prototype.get = function(key) {
|
31636
|
+
if (this.length <= 180) {
|
31637
|
+
for (const p in this.map) {
|
31638
|
+
const bucket2 = this.map[p];
|
31639
|
+
for (let i = 0; i < bucket2.length; i += 1) {
|
31640
|
+
const element = bucket2[i];
|
31641
|
+
if (element[0] === key) {
|
31642
|
+
return element[1];
|
31643
|
+
}
|
31644
|
+
}
|
31645
|
+
}
|
31646
|
+
return;
|
31647
|
+
}
|
31648
|
+
const hashedKey = this.hash(key);
|
31649
|
+
const bucket = this.map[hashedKey];
|
31650
|
+
if (!bucket) {
|
31651
|
+
return;
|
31652
|
+
}
|
31653
|
+
for (let i = 0; i < bucket.length; i += 1) {
|
31654
|
+
const element = bucket[i];
|
31655
|
+
if (element[0] === key) {
|
31656
|
+
return element[1];
|
31657
|
+
}
|
31658
|
+
}
|
31659
|
+
};
|
31660
|
+
return _ObjectMap2;
|
31661
|
+
}();
|
31662
|
+
|
31663
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
31664
|
+
var clone = /* @__PURE__ */ _curry1(function clone2(value) {
|
31665
|
+
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
31666
|
+
});
|
31667
|
+
var clone_default = clone;
|
31668
|
+
|
31669
|
+
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
31670
|
+
var hasProtoTrim = typeof String.prototype.trim === "function";
|
31671
|
+
|
31495
31672
|
// src/providers/coin-quantity.ts
|
31496
31673
|
var coinQuantityfy = (coinQuantityLike) => {
|
31497
31674
|
let assetId;
|
31498
31675
|
let amount;
|
31499
|
-
let
|
31676
|
+
let max;
|
31500
31677
|
if (Array.isArray(coinQuantityLike)) {
|
31501
31678
|
amount = coinQuantityLike[0];
|
31502
|
-
assetId = coinQuantityLike[1];
|
31503
|
-
|
31679
|
+
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
31680
|
+
max = coinQuantityLike[2] ?? void 0;
|
31504
31681
|
} else {
|
31505
31682
|
amount = coinQuantityLike.amount;
|
31506
|
-
assetId = coinQuantityLike.assetId;
|
31507
|
-
|
31683
|
+
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
31684
|
+
max = coinQuantityLike.max ?? void 0;
|
31508
31685
|
}
|
31509
31686
|
const bnAmount = bn(amount);
|
31510
31687
|
return {
|
31511
31688
|
assetId: hexlify(assetId),
|
31512
31689
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
31513
|
-
max:
|
31690
|
+
max: max ? bn(max) : void 0
|
31514
31691
|
};
|
31515
31692
|
};
|
31516
|
-
var
|
31693
|
+
var addAmountToCoinQuantities = (params) => {
|
31517
31694
|
const { amount, assetId } = params;
|
31518
31695
|
const coinQuantities = [...params.coinQuantities];
|
31519
31696
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -31625,7 +31802,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31625
31802
|
ASSET_ID_LEN + // Asset id
|
31626
31803
|
TX_POINTER_LEN + // TxPointer
|
31627
31804
|
WORD_SIZE + // Witnesses index
|
31628
|
-
WORD_SIZE + // Maturity
|
31629
31805
|
WORD_SIZE + // Predicate size
|
31630
31806
|
WORD_SIZE + // Predicate data size
|
31631
31807
|
WORD_SIZE;
|
@@ -31958,7 +32134,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31958
32134
|
constructor(name, coders) {
|
31959
32135
|
const caseIndexCoder = new BigNumberCoder("u64");
|
31960
32136
|
const encodedValueSize = Object.values(coders).reduce(
|
31961
|
-
(
|
32137
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
31962
32138
|
0
|
31963
32139
|
);
|
31964
32140
|
super("enum", `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -32648,7 +32824,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32648
32824
|
constructor(name, coders) {
|
32649
32825
|
const caseIndexCoder = new BigNumberCoder("u64");
|
32650
32826
|
const encodedValueSize = Object.values(coders).reduce(
|
32651
|
-
(
|
32827
|
+
(max, coder) => Math.max(max, coder.encodedLength),
|
32652
32828
|
0
|
32653
32829
|
);
|
32654
32830
|
super("enum", `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
@@ -33325,7 +33501,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33325
33501
|
parts.push(new B256Coder().encode(value.assetId));
|
33326
33502
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
33327
33503
|
parts.push(new NumberCoder("u8").encode(value.witnessIndex));
|
33328
|
-
parts.push(new NumberCoder("u32").encode(value.maturity));
|
33329
33504
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
33330
33505
|
parts.push(new NumberCoder("u32").encode(value.predicateLength));
|
33331
33506
|
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
@@ -33350,8 +33525,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33350
33525
|
const txPointer = decoded;
|
33351
33526
|
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
33352
33527
|
const witnessIndex = Number(decoded);
|
33353
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33354
|
-
const maturity = decoded;
|
33355
33528
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33356
33529
|
const predicateGasUsed = decoded;
|
33357
33530
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
@@ -33372,7 +33545,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33372
33545
|
assetId,
|
33373
33546
|
txPointer,
|
33374
33547
|
witnessIndex,
|
33375
|
-
maturity,
|
33376
33548
|
predicateGasUsed,
|
33377
33549
|
predicateLength,
|
33378
33550
|
predicateDataLength,
|
@@ -33804,7 +33976,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33804
33976
|
}
|
33805
33977
|
};
|
33806
33978
|
var PolicyType = /* @__PURE__ */ ((PolicyType2) => {
|
33807
|
-
PolicyType2[PolicyType2["
|
33979
|
+
PolicyType2[PolicyType2["Tip"] = 1] = "Tip";
|
33808
33980
|
PolicyType2[PolicyType2["WitnessLimit"] = 2] = "WitnessLimit";
|
33809
33981
|
PolicyType2[PolicyType2["Maturity"] = 4] = "Maturity";
|
33810
33982
|
PolicyType2[PolicyType2["MaxFee"] = 8] = "MaxFee";
|
@@ -33852,9 +34024,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33852
34024
|
let o = offset;
|
33853
34025
|
const policies = [];
|
33854
34026
|
if (policyTypes & 1) {
|
33855
|
-
const [
|
34027
|
+
const [tip, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
33856
34028
|
o = nextOffset;
|
33857
|
-
policies.push({ type: 1, data:
|
34029
|
+
policies.push({ type: 1, data: tip });
|
33858
34030
|
}
|
33859
34031
|
if (policyTypes & 2) {
|
33860
34032
|
const [witnessLimit, nextOffset] = new BigNumberCoder("u64").decode(data, o);
|
@@ -34567,159 +34739,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34567
34739
|
// src/providers/provider.ts
|
34568
34740
|
var import_graphql_request = __toESM(require_dist2());
|
34569
34741
|
|
34570
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
34571
|
-
function _isPlaceholder(a) {
|
34572
|
-
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
34573
|
-
}
|
34574
|
-
|
34575
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_curry1.js
|
34576
|
-
function _curry1(fn) {
|
34577
|
-
return function f1(a) {
|
34578
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
34579
|
-
return f1;
|
34580
|
-
} else {
|
34581
|
-
return fn.apply(this, arguments);
|
34582
|
-
}
|
34583
|
-
};
|
34584
|
-
}
|
34585
|
-
|
34586
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isArray.js
|
34587
|
-
var isArray_default = Array.isArray || function _isArray(val) {
|
34588
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
|
34589
|
-
};
|
34590
|
-
|
34591
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/type.js
|
34592
|
-
var type = /* @__PURE__ */ _curry1(function type2(val) {
|
34593
|
-
return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
|
34594
|
-
});
|
34595
|
-
var type_default = type;
|
34596
|
-
|
34597
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_toISOString.js
|
34598
|
-
var pad = function pad2(n) {
|
34599
|
-
return (n < 10 ? "0" : "") + n;
|
34600
|
-
};
|
34601
|
-
var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
|
34602
|
-
return d.toISOString();
|
34603
|
-
} : function _toISOString3(d) {
|
34604
|
-
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";
|
34605
|
-
};
|
34606
|
-
|
34607
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isInteger.js
|
34608
|
-
var isInteger_default = Number.isInteger || function _isInteger(n) {
|
34609
|
-
return n << 0 === n;
|
34610
|
-
};
|
34611
|
-
|
34612
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_cloneRegExp.js
|
34613
|
-
function _cloneRegExp(pattern) {
|
34614
|
-
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" : ""));
|
34615
|
-
}
|
34616
|
-
|
34617
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_clone.js
|
34618
|
-
function _clone(value, deep, map) {
|
34619
|
-
map || (map = new _ObjectMap());
|
34620
|
-
if (_isPrimitive(value)) {
|
34621
|
-
return value;
|
34622
|
-
}
|
34623
|
-
var copy = function copy2(copiedValue) {
|
34624
|
-
var cachedCopy = map.get(value);
|
34625
|
-
if (cachedCopy) {
|
34626
|
-
return cachedCopy;
|
34627
|
-
}
|
34628
|
-
map.set(value, copiedValue);
|
34629
|
-
for (var key in value) {
|
34630
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
34631
|
-
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
34632
|
-
}
|
34633
|
-
}
|
34634
|
-
return copiedValue;
|
34635
|
-
};
|
34636
|
-
switch (type_default(value)) {
|
34637
|
-
case "Object":
|
34638
|
-
return copy(Object.create(Object.getPrototypeOf(value)));
|
34639
|
-
case "Array":
|
34640
|
-
return copy([]);
|
34641
|
-
case "Date":
|
34642
|
-
return new Date(value.valueOf());
|
34643
|
-
case "RegExp":
|
34644
|
-
return _cloneRegExp(value);
|
34645
|
-
case "Int8Array":
|
34646
|
-
case "Uint8Array":
|
34647
|
-
case "Uint8ClampedArray":
|
34648
|
-
case "Int16Array":
|
34649
|
-
case "Uint16Array":
|
34650
|
-
case "Int32Array":
|
34651
|
-
case "Uint32Array":
|
34652
|
-
case "Float32Array":
|
34653
|
-
case "Float64Array":
|
34654
|
-
case "BigInt64Array":
|
34655
|
-
case "BigUint64Array":
|
34656
|
-
return value.slice();
|
34657
|
-
default:
|
34658
|
-
return value;
|
34659
|
-
}
|
34660
|
-
}
|
34661
|
-
function _isPrimitive(param) {
|
34662
|
-
var type3 = typeof param;
|
34663
|
-
return param == null || type3 != "object" && type3 != "function";
|
34664
|
-
}
|
34665
|
-
var _ObjectMap = /* @__PURE__ */ function() {
|
34666
|
-
function _ObjectMap2() {
|
34667
|
-
this.map = {};
|
34668
|
-
this.length = 0;
|
34669
|
-
}
|
34670
|
-
_ObjectMap2.prototype.set = function(key, value) {
|
34671
|
-
const hashedKey = this.hash(key);
|
34672
|
-
let bucket = this.map[hashedKey];
|
34673
|
-
if (!bucket) {
|
34674
|
-
this.map[hashedKey] = bucket = [];
|
34675
|
-
}
|
34676
|
-
bucket.push([key, value]);
|
34677
|
-
this.length += 1;
|
34678
|
-
};
|
34679
|
-
_ObjectMap2.prototype.hash = function(key) {
|
34680
|
-
let hashedKey = [];
|
34681
|
-
for (var value in key) {
|
34682
|
-
hashedKey.push(Object.prototype.toString.call(key[value]));
|
34683
|
-
}
|
34684
|
-
return hashedKey.join();
|
34685
|
-
};
|
34686
|
-
_ObjectMap2.prototype.get = function(key) {
|
34687
|
-
if (this.length <= 180) {
|
34688
|
-
for (const p in this.map) {
|
34689
|
-
const bucket2 = this.map[p];
|
34690
|
-
for (let i = 0; i < bucket2.length; i += 1) {
|
34691
|
-
const element = bucket2[i];
|
34692
|
-
if (element[0] === key) {
|
34693
|
-
return element[1];
|
34694
|
-
}
|
34695
|
-
}
|
34696
|
-
}
|
34697
|
-
return;
|
34698
|
-
}
|
34699
|
-
const hashedKey = this.hash(key);
|
34700
|
-
const bucket = this.map[hashedKey];
|
34701
|
-
if (!bucket) {
|
34702
|
-
return;
|
34703
|
-
}
|
34704
|
-
for (let i = 0; i < bucket.length; i += 1) {
|
34705
|
-
const element = bucket[i];
|
34706
|
-
if (element[0] === key) {
|
34707
|
-
return element[1];
|
34708
|
-
}
|
34709
|
-
}
|
34710
|
-
};
|
34711
|
-
return _ObjectMap2;
|
34712
|
-
}();
|
34713
|
-
|
34714
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/clone.js
|
34715
|
-
var clone2 = /* @__PURE__ */ _curry1(function clone3(value) {
|
34716
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, true);
|
34717
|
-
});
|
34718
|
-
var clone_default = clone2;
|
34719
|
-
|
34720
|
-
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/trim.js
|
34721
|
-
var hasProtoTrim = typeof String.prototype.trim === "function";
|
34722
|
-
|
34723
34742
|
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
34724
34743
|
var __assign = function() {
|
34725
34744
|
__assign = Object.assign || function __assign2(t) {
|
@@ -37887,14 +37906,10 @@ spurious results.`);
|
|
37887
37906
|
// src/providers/__generated__/operations.ts
|
37888
37907
|
var ReceiptFragmentFragmentDoc = lib_default2`
|
37889
37908
|
fragment receiptFragment on Receipt {
|
37890
|
-
|
37891
|
-
id
|
37892
|
-
}
|
37909
|
+
id
|
37893
37910
|
pc
|
37894
37911
|
is
|
37895
|
-
to
|
37896
|
-
id
|
37897
|
-
}
|
37912
|
+
to
|
37898
37913
|
toAddress
|
37899
37914
|
amount
|
37900
37915
|
assetId
|
@@ -37932,10 +37947,16 @@ spurious results.`);
|
|
37932
37947
|
id
|
37933
37948
|
}
|
37934
37949
|
time
|
37950
|
+
receipts {
|
37951
|
+
...receiptFragment
|
37952
|
+
}
|
37935
37953
|
programState {
|
37936
37954
|
returnType
|
37937
37955
|
data
|
37938
37956
|
}
|
37957
|
+
receipts {
|
37958
|
+
...receiptFragment
|
37959
|
+
}
|
37939
37960
|
}
|
37940
37961
|
... on FailureStatus {
|
37941
37962
|
block {
|
@@ -37943,26 +37964,24 @@ spurious results.`);
|
|
37943
37964
|
}
|
37944
37965
|
time
|
37945
37966
|
reason
|
37967
|
+
receipts {
|
37968
|
+
...receiptFragment
|
37969
|
+
}
|
37946
37970
|
}
|
37947
37971
|
... on SqueezedOutStatus {
|
37948
37972
|
reason
|
37949
37973
|
}
|
37950
37974
|
}
|
37951
|
-
`;
|
37975
|
+
${ReceiptFragmentFragmentDoc}`;
|
37952
37976
|
var TransactionFragmentFragmentDoc = lib_default2`
|
37953
37977
|
fragment transactionFragment on Transaction {
|
37954
37978
|
id
|
37955
37979
|
rawPayload
|
37956
|
-
gasPrice
|
37957
|
-
receipts {
|
37958
|
-
...receiptFragment
|
37959
|
-
}
|
37960
37980
|
status {
|
37961
37981
|
...transactionStatusFragment
|
37962
37982
|
}
|
37963
37983
|
}
|
37964
|
-
${
|
37965
|
-
${TransactionStatusFragmentFragmentDoc}`;
|
37984
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
37966
37985
|
var InputEstimatePredicatesFragmentFragmentDoc = lib_default2`
|
37967
37986
|
fragment inputEstimatePredicatesFragment on Input {
|
37968
37987
|
... on InputCoin {
|
@@ -37980,6 +37999,46 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37980
37999
|
}
|
37981
38000
|
}
|
37982
38001
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
38002
|
+
var DryRunFailureStatusFragmentFragmentDoc = lib_default2`
|
38003
|
+
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
38004
|
+
reason
|
38005
|
+
programState {
|
38006
|
+
returnType
|
38007
|
+
data
|
38008
|
+
}
|
38009
|
+
}
|
38010
|
+
`;
|
38011
|
+
var DryRunSuccessStatusFragmentFragmentDoc = lib_default2`
|
38012
|
+
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
38013
|
+
programState {
|
38014
|
+
returnType
|
38015
|
+
data
|
38016
|
+
}
|
38017
|
+
}
|
38018
|
+
`;
|
38019
|
+
var DryRunTransactionStatusFragmentFragmentDoc = lib_default2`
|
38020
|
+
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
38021
|
+
... on DryRunFailureStatus {
|
38022
|
+
...dryRunFailureStatusFragment
|
38023
|
+
}
|
38024
|
+
... on DryRunSuccessStatus {
|
38025
|
+
...dryRunSuccessStatusFragment
|
38026
|
+
}
|
38027
|
+
}
|
38028
|
+
${DryRunFailureStatusFragmentFragmentDoc}
|
38029
|
+
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
38030
|
+
var DryRunTransactionExecutionStatusFragmentFragmentDoc = lib_default2`
|
38031
|
+
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
38032
|
+
id
|
38033
|
+
status {
|
38034
|
+
...dryRunTransactionStatusFragment
|
38035
|
+
}
|
38036
|
+
receipts {
|
38037
|
+
...receiptFragment
|
38038
|
+
}
|
38039
|
+
}
|
38040
|
+
${DryRunTransactionStatusFragmentFragmentDoc}
|
38041
|
+
${ReceiptFragmentFragmentDoc}`;
|
37983
38042
|
var CoinFragmentFragmentDoc = lib_default2`
|
37984
38043
|
fragment coinFragment on Coin {
|
37985
38044
|
__typename
|
@@ -37987,7 +38046,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
37987
38046
|
owner
|
37988
38047
|
amount
|
37989
38048
|
assetId
|
37990
|
-
maturity
|
37991
38049
|
blockCreated
|
37992
38050
|
txCreatedIdx
|
37993
38051
|
}
|
@@ -38064,8 +38122,8 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38064
38122
|
var BlockFragmentFragmentDoc = lib_default2`
|
38065
38123
|
fragment blockFragment on Block {
|
38066
38124
|
id
|
38125
|
+
height
|
38067
38126
|
header {
|
38068
|
-
height
|
38069
38127
|
time
|
38070
38128
|
}
|
38071
38129
|
transactions {
|
@@ -38135,7 +38193,6 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38135
38193
|
cb
|
38136
38194
|
cfei
|
38137
38195
|
cfsi
|
38138
|
-
croo
|
38139
38196
|
div
|
38140
38197
|
divi
|
38141
38198
|
ecr1
|
@@ -38218,6 +38275,9 @@ ${TransactionStatusFragmentFragmentDoc}`;
|
|
38218
38275
|
ccp {
|
38219
38276
|
...DependentCostFragment
|
38220
38277
|
}
|
38278
|
+
croo {
|
38279
|
+
...DependentCostFragment
|
38280
|
+
}
|
38221
38281
|
csiz {
|
38222
38282
|
...DependentCostFragment
|
38223
38283
|
}
|
@@ -38340,14 +38400,6 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38340
38400
|
maxTx
|
38341
38401
|
maxDepth
|
38342
38402
|
nodeVersion
|
38343
|
-
peers {
|
38344
|
-
id
|
38345
|
-
addresses
|
38346
|
-
clientVersion
|
38347
|
-
blockHeight
|
38348
|
-
lastHeartbeatMs
|
38349
|
-
appScore
|
38350
|
-
}
|
38351
38403
|
}
|
38352
38404
|
`;
|
38353
38405
|
var GetVersionDocument = lib_default2`
|
@@ -38382,13 +38434,9 @@ ${ConsensusParametersFragmentFragmentDoc}`;
|
|
38382
38434
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
38383
38435
|
transaction(id: $transactionId) {
|
38384
38436
|
...transactionFragment
|
38385
|
-
receipts {
|
38386
|
-
...receiptFragment
|
38387
|
-
}
|
38388
38437
|
}
|
38389
38438
|
}
|
38390
|
-
${TransactionFragmentFragmentDoc}
|
38391
|
-
${ReceiptFragmentFragmentDoc}`;
|
38439
|
+
${TransactionFragmentFragmentDoc}`;
|
38392
38440
|
var GetTransactionsDocument = lib_default2`
|
38393
38441
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
38394
38442
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -38516,6 +38564,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38516
38564
|
}
|
38517
38565
|
}
|
38518
38566
|
${BalanceFragmentFragmentDoc}`;
|
38567
|
+
var GetLatestGasPriceDocument = lib_default2`
|
38568
|
+
query getLatestGasPrice {
|
38569
|
+
latestGasPrice {
|
38570
|
+
gasPrice
|
38571
|
+
}
|
38572
|
+
}
|
38573
|
+
`;
|
38574
|
+
var EstimateGasPriceDocument = lib_default2`
|
38575
|
+
query estimateGasPrice($blockHorizon: U32!) {
|
38576
|
+
estimateGasPrice(blockHorizon: $blockHorizon) {
|
38577
|
+
gasPrice
|
38578
|
+
}
|
38579
|
+
}
|
38580
|
+
`;
|
38519
38581
|
var GetBalancesDocument = lib_default2`
|
38520
38582
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
38521
38583
|
balances(
|
@@ -38570,12 +38632,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38570
38632
|
}
|
38571
38633
|
`;
|
38572
38634
|
var DryRunDocument = lib_default2`
|
38573
|
-
mutation dryRun($
|
38574
|
-
dryRun(
|
38575
|
-
...
|
38635
|
+
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
38636
|
+
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
38637
|
+
...dryRunTransactionExecutionStatusFragment
|
38576
38638
|
}
|
38577
38639
|
}
|
38578
|
-
${
|
38640
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
38579
38641
|
var SubmitDocument = lib_default2`
|
38580
38642
|
mutation submit($encodedTransaction: HexString!) {
|
38581
38643
|
submit(tx: $encodedTransaction) {
|
@@ -38658,6 +38720,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38658
38720
|
getBalance(variables, options) {
|
38659
38721
|
return requester(GetBalanceDocument, variables, options);
|
38660
38722
|
},
|
38723
|
+
getLatestGasPrice(variables, options) {
|
38724
|
+
return requester(GetLatestGasPriceDocument, variables, options);
|
38725
|
+
},
|
38726
|
+
estimateGasPrice(variables, options) {
|
38727
|
+
return requester(EstimateGasPriceDocument, variables, options);
|
38728
|
+
},
|
38661
38729
|
getBalances(variables, options) {
|
38662
38730
|
return requester(GetBalancesDocument, variables, options);
|
38663
38731
|
},
|
@@ -38813,9 +38881,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38813
38881
|
}
|
38814
38882
|
};
|
38815
38883
|
|
38816
|
-
// ../address/dist/configs.mjs
|
38817
|
-
var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
38818
|
-
|
38819
38884
|
// src/providers/transaction-request/input.ts
|
38820
38885
|
var inputify = (value) => {
|
38821
38886
|
const { type: type3 } = value;
|
@@ -38835,7 +38900,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38835
38900
|
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
38836
38901
|
},
|
38837
38902
|
witnessIndex: value.witnessIndex,
|
38838
|
-
maturity: value.maturity ?? 0,
|
38839
38903
|
predicateGasUsed: bn(value.predicateGasUsed),
|
38840
38904
|
predicateLength: predicate.length,
|
38841
38905
|
predicateDataLength: predicateData.length,
|
@@ -38950,7 +39014,60 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38950
39014
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
38951
39015
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
38952
39016
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
39017
|
+
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
38953
39018
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
39019
|
+
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
39020
|
+
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
39021
|
+
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
39022
|
+
var PANIC_REASONS = [
|
39023
|
+
"UnknownPanicReason",
|
39024
|
+
"Revert",
|
39025
|
+
"OutOfGas",
|
39026
|
+
"TransactionValidity",
|
39027
|
+
"MemoryOverflow",
|
39028
|
+
"ArithmeticOverflow",
|
39029
|
+
"ContractNotFound",
|
39030
|
+
"MemoryOwnership",
|
39031
|
+
"NotEnoughBalance",
|
39032
|
+
"ExpectedInternalContext",
|
39033
|
+
"AssetIdNotFound",
|
39034
|
+
"InputNotFound",
|
39035
|
+
"OutputNotFound",
|
39036
|
+
"WitnessNotFound",
|
39037
|
+
"TransactionMaturity",
|
39038
|
+
"InvalidMetadataIdentifier",
|
39039
|
+
"MalformedCallStructure",
|
39040
|
+
"ReservedRegisterNotWritable",
|
39041
|
+
"InvalidFlags",
|
39042
|
+
"InvalidImmediateValue",
|
39043
|
+
"ExpectedCoinInput",
|
39044
|
+
"EcalError",
|
39045
|
+
"MemoryWriteOverlap",
|
39046
|
+
"ContractNotInInputs",
|
39047
|
+
"InternalBalanceOverflow",
|
39048
|
+
"ContractMaxSize",
|
39049
|
+
"ExpectedUnallocatedStack",
|
39050
|
+
"MaxStaticContractsReached",
|
39051
|
+
"TransferAmountCannotBeZero",
|
39052
|
+
"ExpectedOutputVariable",
|
39053
|
+
"ExpectedParentInternalContext",
|
39054
|
+
"PredicateReturnedNonOne",
|
39055
|
+
"ContractIdAlreadyDeployed",
|
39056
|
+
"ContractMismatch",
|
39057
|
+
"MessageDataTooLong",
|
39058
|
+
"ArithmeticError",
|
39059
|
+
"ContractInstructionNotAllowed",
|
39060
|
+
"TransferZeroCoins",
|
39061
|
+
"InvalidInstruction",
|
39062
|
+
"MemoryNotExecutable",
|
39063
|
+
"PolicyIsNotSet",
|
39064
|
+
"PolicyNotFound",
|
39065
|
+
"TooManyReceipts",
|
39066
|
+
"BalanceOverflow",
|
39067
|
+
"InvalidBlockHeight",
|
39068
|
+
"TooManySlots"
|
39069
|
+
];
|
39070
|
+
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
38954
39071
|
|
38955
39072
|
// src/providers/utils/receipts.ts
|
38956
39073
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -38977,8 +39094,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38977
39094
|
case "CALL" /* Call */: {
|
38978
39095
|
const callReceipt = {
|
38979
39096
|
type: ReceiptType.Call,
|
38980
|
-
from: hexOrZero(receipt.
|
38981
|
-
to: hexOrZero(receipt?.to
|
39097
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39098
|
+
to: hexOrZero(receipt?.to),
|
38982
39099
|
amount: bn(receipt.amount),
|
38983
39100
|
assetId: hexOrZero(receipt.assetId),
|
38984
39101
|
gas: bn(receipt.gas),
|
@@ -38992,7 +39109,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38992
39109
|
case "RETURN" /* Return */: {
|
38993
39110
|
const returnReceipt = {
|
38994
39111
|
type: ReceiptType.Return,
|
38995
|
-
id: hexOrZero(receipt.
|
39112
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
38996
39113
|
val: bn(receipt.val),
|
38997
39114
|
pc: bn(receipt.pc),
|
38998
39115
|
is: bn(receipt.is)
|
@@ -39002,7 +39119,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39002
39119
|
case "RETURN_DATA" /* ReturnData */: {
|
39003
39120
|
const returnDataReceipt = {
|
39004
39121
|
type: ReceiptType.ReturnData,
|
39005
|
-
id: hexOrZero(receipt.
|
39122
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39006
39123
|
ptr: bn(receipt.ptr),
|
39007
39124
|
len: bn(receipt.len),
|
39008
39125
|
digest: hexOrZero(receipt.digest),
|
@@ -39014,7 +39131,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39014
39131
|
case "PANIC" /* Panic */: {
|
39015
39132
|
const panicReceipt = {
|
39016
39133
|
type: ReceiptType.Panic,
|
39017
|
-
id: hexOrZero(receipt.
|
39134
|
+
id: hexOrZero(receipt.id),
|
39018
39135
|
reason: bn(receipt.reason),
|
39019
39136
|
pc: bn(receipt.pc),
|
39020
39137
|
is: bn(receipt.is),
|
@@ -39025,7 +39142,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39025
39142
|
case "REVERT" /* Revert */: {
|
39026
39143
|
const revertReceipt = {
|
39027
39144
|
type: ReceiptType.Revert,
|
39028
|
-
id: hexOrZero(receipt.
|
39145
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39029
39146
|
val: bn(receipt.ra),
|
39030
39147
|
pc: bn(receipt.pc),
|
39031
39148
|
is: bn(receipt.is)
|
@@ -39035,7 +39152,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39035
39152
|
case "LOG" /* Log */: {
|
39036
39153
|
const logReceipt = {
|
39037
39154
|
type: ReceiptType.Log,
|
39038
|
-
id: hexOrZero(receipt.
|
39155
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39039
39156
|
val0: bn(receipt.ra),
|
39040
39157
|
val1: bn(receipt.rb),
|
39041
39158
|
val2: bn(receipt.rc),
|
@@ -39048,7 +39165,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39048
39165
|
case "LOG_DATA" /* LogData */: {
|
39049
39166
|
const logDataReceipt = {
|
39050
39167
|
type: ReceiptType.LogData,
|
39051
|
-
id: hexOrZero(receipt.
|
39168
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
39052
39169
|
val0: bn(receipt.ra),
|
39053
39170
|
val1: bn(receipt.rb),
|
39054
39171
|
ptr: bn(receipt.ptr),
|
@@ -39062,8 +39179,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39062
39179
|
case "TRANSFER" /* Transfer */: {
|
39063
39180
|
const transferReceipt = {
|
39064
39181
|
type: ReceiptType.Transfer,
|
39065
|
-
from: hexOrZero(receipt.
|
39066
|
-
to: hexOrZero(receipt.toAddress || receipt?.to
|
39182
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39183
|
+
to: hexOrZero(receipt.toAddress || receipt?.to),
|
39067
39184
|
amount: bn(receipt.amount),
|
39068
39185
|
assetId: hexOrZero(receipt.assetId),
|
39069
39186
|
pc: bn(receipt.pc),
|
@@ -39074,8 +39191,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39074
39191
|
case "TRANSFER_OUT" /* TransferOut */: {
|
39075
39192
|
const transferOutReceipt = {
|
39076
39193
|
type: ReceiptType.TransferOut,
|
39077
|
-
from: hexOrZero(receipt.
|
39078
|
-
to: hexOrZero(receipt.toAddress || receipt.to
|
39194
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
39195
|
+
to: hexOrZero(receipt.toAddress || receipt.to),
|
39079
39196
|
amount: bn(receipt.amount),
|
39080
39197
|
assetId: hexOrZero(receipt.assetId),
|
39081
39198
|
pc: bn(receipt.pc),
|
@@ -39118,7 +39235,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39118
39235
|
return receiptMessageOut;
|
39119
39236
|
}
|
39120
39237
|
case "MINT" /* Mint */: {
|
39121
|
-
const contractId = hexOrZero(receipt.
|
39238
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39122
39239
|
const subId = hexOrZero(receipt.subId);
|
39123
39240
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
39124
39241
|
const mintReceipt = {
|
@@ -39133,7 +39250,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39133
39250
|
return mintReceipt;
|
39134
39251
|
}
|
39135
39252
|
case "BURN" /* Burn */: {
|
39136
|
-
const contractId = hexOrZero(receipt.
|
39253
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
39137
39254
|
const subId = hexOrZero(receipt.subId);
|
39138
39255
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
39139
39256
|
const burnReceipt = {
|
@@ -39214,7 +39331,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39214
39331
|
};
|
39215
39332
|
|
39216
39333
|
// src/providers/utils/gas.ts
|
39217
|
-
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
39218
39334
|
var getGasUsedFromReceipts = (receipts) => {
|
39219
39335
|
const scriptResult = receipts.filter(
|
39220
39336
|
(receipt) => receipt.type === ReceiptType.ScriptResult
|
@@ -39235,18 +39351,28 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39235
39351
|
}
|
39236
39352
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
39237
39353
|
const witnessCache = [];
|
39238
|
-
const
|
39354
|
+
const chargeableInputs = inputs.filter((input) => {
|
39355
|
+
const isCoinOrMessage = "owner" in input || "sender" in input;
|
39356
|
+
if (isCoinOrMessage) {
|
39357
|
+
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39358
|
+
return true;
|
39359
|
+
}
|
39360
|
+
if (!witnessCache.includes(input.witnessIndex)) {
|
39361
|
+
witnessCache.push(input.witnessIndex);
|
39362
|
+
return true;
|
39363
|
+
}
|
39364
|
+
}
|
39365
|
+
return false;
|
39366
|
+
});
|
39367
|
+
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
39368
|
+
const totalGas = chargeableInputs.reduce((total, input) => {
|
39239
39369
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
39240
39370
|
return total.add(
|
39241
|
-
|
39371
|
+
vmInitializationCost.add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
39242
39372
|
);
|
39243
39373
|
}
|
39244
|
-
|
39245
|
-
|
39246
|
-
return total.add(gasCosts.ecr1);
|
39247
|
-
}
|
39248
|
-
return total;
|
39249
|
-
}, bn());
|
39374
|
+
return total.add(gasCosts.ecr1);
|
39375
|
+
}, bn(0));
|
39250
39376
|
return totalGas;
|
39251
39377
|
}
|
39252
39378
|
function getMinGas(params) {
|
@@ -39258,12 +39384,20 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39258
39384
|
return minGas;
|
39259
39385
|
}
|
39260
39386
|
function getMaxGas(params) {
|
39261
|
-
const {
|
39387
|
+
const {
|
39388
|
+
gasPerByte,
|
39389
|
+
witnessesLength,
|
39390
|
+
witnessLimit,
|
39391
|
+
minGas,
|
39392
|
+
gasLimit = bn(0),
|
39393
|
+
maxGasPerTx
|
39394
|
+
} = params;
|
39262
39395
|
let remainingAllowedWitnessGas = bn(0);
|
39263
39396
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
39264
39397
|
remainingAllowedWitnessGas = bn(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
39265
39398
|
}
|
39266
|
-
|
39399
|
+
const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
39400
|
+
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
39267
39401
|
}
|
39268
39402
|
function calculateMetadataGasForTxCreate({
|
39269
39403
|
gasCosts,
|
@@ -39285,6 +39419,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39285
39419
|
}) {
|
39286
39420
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
39287
39421
|
}
|
39422
|
+
var calculateGasFee = (params) => {
|
39423
|
+
const { gas, gasPrice, priceFactor, tip } = params;
|
39424
|
+
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
39425
|
+
};
|
39288
39426
|
|
39289
39427
|
// src/providers/utils/json.ts
|
39290
39428
|
function normalize2(object) {
|
@@ -39324,6 +39462,74 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39324
39462
|
});
|
39325
39463
|
}
|
39326
39464
|
|
39465
|
+
// src/providers/utils/extract-tx-error.ts
|
39466
|
+
var assemblePanicError = (status) => {
|
39467
|
+
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
39468
|
+
const reason = status.reason;
|
39469
|
+
if (PANIC_REASONS.includes(status.reason)) {
|
39470
|
+
errorMessage = `${errorMessage}
|
39471
|
+
|
39472
|
+
You can read more about this error at:
|
39473
|
+
|
39474
|
+
${PANIC_DOC_URL}#variant.${status.reason}`;
|
39475
|
+
}
|
39476
|
+
return { errorMessage, reason };
|
39477
|
+
};
|
39478
|
+
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
39479
|
+
var assembleRevertError = (receipts, logs) => {
|
39480
|
+
let errorMessage = "The transaction reverted with an unknown reason.";
|
39481
|
+
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
39482
|
+
let reason = "";
|
39483
|
+
if (revertReceipt) {
|
39484
|
+
const reasonHex = bn(revertReceipt.val).toHex();
|
39485
|
+
switch (reasonHex) {
|
39486
|
+
case FAILED_REQUIRE_SIGNAL: {
|
39487
|
+
reason = "require";
|
39488
|
+
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
39489
|
+
break;
|
39490
|
+
}
|
39491
|
+
case FAILED_ASSERT_EQ_SIGNAL: {
|
39492
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
39493
|
+
reason = "assert_eq";
|
39494
|
+
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
39495
|
+
break;
|
39496
|
+
}
|
39497
|
+
case FAILED_ASSERT_NE_SIGNAL: {
|
39498
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
39499
|
+
reason = "assert_ne";
|
39500
|
+
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
39501
|
+
break;
|
39502
|
+
}
|
39503
|
+
case FAILED_ASSERT_SIGNAL:
|
39504
|
+
reason = "assert";
|
39505
|
+
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
39506
|
+
break;
|
39507
|
+
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
39508
|
+
reason = "MissingOutputChange";
|
39509
|
+
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
39510
|
+
break;
|
39511
|
+
default:
|
39512
|
+
reason = "unknown";
|
39513
|
+
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
39514
|
+
}
|
39515
|
+
}
|
39516
|
+
return { errorMessage, reason };
|
39517
|
+
};
|
39518
|
+
var extractTxError = (params) => {
|
39519
|
+
const { receipts, status, logs } = params;
|
39520
|
+
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
39521
|
+
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
39522
|
+
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
39523
|
+
const metadata = {
|
39524
|
+
logs,
|
39525
|
+
receipts,
|
39526
|
+
panic: isPanic,
|
39527
|
+
revert: isRevert,
|
39528
|
+
reason
|
39529
|
+
};
|
39530
|
+
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
39531
|
+
};
|
39532
|
+
|
39327
39533
|
// src/providers/transaction-request/errors.ts
|
39328
39534
|
var ChangeOutputCollisionError = class extends Error {
|
39329
39535
|
name = "ChangeOutputCollisionError";
|
@@ -39358,7 +39564,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39358
39564
|
// src/providers/transaction-request/transaction-request.ts
|
39359
39565
|
var BaseTransactionRequest = class {
|
39360
39566
|
/** Gas price for transaction */
|
39361
|
-
|
39567
|
+
tip;
|
39362
39568
|
/** Block until which tx cannot be included */
|
39363
39569
|
maturity;
|
39364
39570
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -39371,38 +39577,34 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39371
39577
|
outputs = [];
|
39372
39578
|
/** List of witnesses */
|
39373
39579
|
witnesses = [];
|
39374
|
-
/** Base asset ID - should be fetched from the chain */
|
39375
|
-
baseAssetId = ZeroBytes32;
|
39376
39580
|
/**
|
39377
39581
|
* Constructor for initializing a base transaction request.
|
39378
39582
|
*
|
39379
39583
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
39380
39584
|
*/
|
39381
39585
|
constructor({
|
39382
|
-
|
39586
|
+
tip,
|
39383
39587
|
maturity,
|
39384
39588
|
maxFee,
|
39385
39589
|
witnessLimit,
|
39386
39590
|
inputs,
|
39387
39591
|
outputs,
|
39388
|
-
witnesses
|
39389
|
-
baseAssetId
|
39592
|
+
witnesses
|
39390
39593
|
} = {}) {
|
39391
|
-
this.
|
39594
|
+
this.tip = bn(tip);
|
39392
39595
|
this.maturity = maturity ?? 0;
|
39393
39596
|
this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
|
39394
39597
|
this.maxFee = maxFee ? bn(maxFee) : void 0;
|
39395
39598
|
this.inputs = inputs ?? [];
|
39396
39599
|
this.outputs = outputs ?? [];
|
39397
39600
|
this.witnesses = witnesses ?? [];
|
39398
|
-
this.baseAssetId = baseAssetId ?? ZeroBytes32;
|
39399
39601
|
}
|
39400
39602
|
static getPolicyMeta(req) {
|
39401
39603
|
let policyTypes = 0;
|
39402
39604
|
const policies = [];
|
39403
|
-
if (req.
|
39404
|
-
policyTypes += PolicyType.
|
39405
|
-
policies.push({ data: req.
|
39605
|
+
if (req.tip) {
|
39606
|
+
policyTypes += PolicyType.Tip;
|
39607
|
+
policies.push({ data: req.tip, type: PolicyType.Tip });
|
39406
39608
|
}
|
39407
39609
|
if (req.witnessLimit) {
|
39408
39610
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -39589,10 +39791,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39589
39791
|
* @param predicate - Predicate bytes.
|
39590
39792
|
* @param predicateData - Predicate data bytes.
|
39591
39793
|
*/
|
39592
|
-
addCoinInput(coin
|
39794
|
+
addCoinInput(coin) {
|
39593
39795
|
const { assetId, owner, amount } = coin;
|
39594
39796
|
let witnessIndex;
|
39595
|
-
if (predicate) {
|
39797
|
+
if (coin.predicate) {
|
39596
39798
|
witnessIndex = 0;
|
39597
39799
|
} else {
|
39598
39800
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -39607,9 +39809,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39607
39809
|
amount,
|
39608
39810
|
assetId,
|
39609
39811
|
txPointer: "0x00000000000000000000000000000000",
|
39610
|
-
witnessIndex
|
39611
|
-
predicate: predicate?.bytes,
|
39612
|
-
predicateData: predicate?.predicateDataBytes
|
39812
|
+
witnessIndex
|
39613
39813
|
};
|
39614
39814
|
this.pushInput(input);
|
39615
39815
|
this.addChangeOutput(owner, assetId);
|
@@ -39620,11 +39820,13 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39620
39820
|
*
|
39621
39821
|
* @param message - Message resource.
|
39622
39822
|
* @param predicate - Predicate bytes.
|
39823
|
+
* @param predicateData - Predicate data bytes.
|
39623
39824
|
*/
|
39624
|
-
addMessageInput(message
|
39825
|
+
addMessageInput(message) {
|
39625
39826
|
const { recipient, sender, amount } = message;
|
39827
|
+
const assetId = BaseAssetId;
|
39626
39828
|
let witnessIndex;
|
39627
|
-
if (predicate) {
|
39829
|
+
if (message.predicate) {
|
39628
39830
|
witnessIndex = 0;
|
39629
39831
|
} else {
|
39630
39832
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -39638,12 +39840,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39638
39840
|
sender: sender.toB256(),
|
39639
39841
|
recipient: recipient.toB256(),
|
39640
39842
|
amount,
|
39641
|
-
witnessIndex
|
39642
|
-
predicate: predicate?.bytes,
|
39643
|
-
predicateData: predicate?.predicateDataBytes
|
39843
|
+
witnessIndex
|
39644
39844
|
};
|
39645
39845
|
this.pushInput(input);
|
39646
|
-
this.addChangeOutput(recipient,
|
39846
|
+
this.addChangeOutput(recipient, assetId);
|
39647
39847
|
}
|
39648
39848
|
/**
|
39649
39849
|
* Adds a single resource to the transaction by adding a coin/message input and a
|
@@ -39671,32 +39871,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39671
39871
|
resources.forEach((resource) => this.addResource(resource));
|
39672
39872
|
return this;
|
39673
39873
|
}
|
39674
|
-
/**
|
39675
|
-
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
39676
|
-
* outputs from the related assetIds.
|
39677
|
-
*
|
39678
|
-
* @param resources - The resources to add.
|
39679
|
-
* @returns This transaction.
|
39680
|
-
*/
|
39681
|
-
addPredicateResource(resource, predicate) {
|
39682
|
-
if (isCoin(resource)) {
|
39683
|
-
this.addCoinInput(resource, predicate);
|
39684
|
-
} else {
|
39685
|
-
this.addMessageInput(resource, predicate);
|
39686
|
-
}
|
39687
|
-
return this;
|
39688
|
-
}
|
39689
|
-
/**
|
39690
|
-
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
39691
|
-
* from the related assetIds.
|
39692
|
-
*
|
39693
|
-
* @param resources - The resources to add.
|
39694
|
-
* @returns This transaction.
|
39695
|
-
*/
|
39696
|
-
addPredicateResources(resources, predicate) {
|
39697
|
-
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
39698
|
-
return this;
|
39699
|
-
}
|
39700
39874
|
/**
|
39701
39875
|
* Adds a coin output to the transaction.
|
39702
39876
|
*
|
@@ -39704,12 +39878,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39704
39878
|
* @param amount - Amount of coin.
|
39705
39879
|
* @param assetId - Asset ID of coin.
|
39706
39880
|
*/
|
39707
|
-
addCoinOutput(to, amount, assetId) {
|
39881
|
+
addCoinOutput(to, amount, assetId = BaseAssetId) {
|
39708
39882
|
this.pushOutput({
|
39709
39883
|
type: OutputType.Coin,
|
39710
39884
|
to: addressify(to).toB256(),
|
39711
39885
|
amount,
|
39712
|
-
assetId
|
39886
|
+
assetId
|
39713
39887
|
});
|
39714
39888
|
return this;
|
39715
39889
|
}
|
@@ -39736,7 +39910,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39736
39910
|
* @param to - Address of the owner.
|
39737
39911
|
* @param assetId - Asset ID of coin.
|
39738
39912
|
*/
|
39739
|
-
addChangeOutput(to, assetId) {
|
39913
|
+
addChangeOutput(to, assetId = BaseAssetId) {
|
39740
39914
|
const changeOutput = this.getChangeOutputs().find(
|
39741
39915
|
(output3) => hexlify(output3.assetId) === assetId
|
39742
39916
|
);
|
@@ -39744,7 +39918,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39744
39918
|
this.pushOutput({
|
39745
39919
|
type: OutputType.Change,
|
39746
39920
|
to: addressify(to).toB256(),
|
39747
|
-
assetId
|
39921
|
+
assetId
|
39748
39922
|
});
|
39749
39923
|
}
|
39750
39924
|
}
|
@@ -39776,7 +39950,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39776
39950
|
}
|
39777
39951
|
calculateMaxGas(chainInfo, minGas) {
|
39778
39952
|
const { consensusParameters } = chainInfo;
|
39779
|
-
const { gasPerByte } = consensusParameters;
|
39953
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
39780
39954
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
39781
39955
|
(acc, wit) => acc + wit.dataLength,
|
39782
39956
|
0
|
@@ -39785,7 +39959,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39785
39959
|
gasPerByte,
|
39786
39960
|
minGas,
|
39787
39961
|
witnessesLength,
|
39788
|
-
witnessLimit: this.witnessLimit
|
39962
|
+
witnessLimit: this.witnessLimit,
|
39963
|
+
maxGasPerTx
|
39789
39964
|
});
|
39790
39965
|
}
|
39791
39966
|
/**
|
@@ -39795,12 +39970,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39795
39970
|
* @param quantities - CoinQuantity Array.
|
39796
39971
|
*/
|
39797
39972
|
fundWithFakeUtxos(quantities, resourcesOwner) {
|
39798
|
-
let idCounter = 0;
|
39799
|
-
const generateId = () => {
|
39800
|
-
const counterString = String(idCounter++);
|
39801
|
-
const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString);
|
39802
|
-
return id;
|
39803
|
-
};
|
39804
39973
|
const findAssetInput = (assetId) => this.inputs.find((input) => {
|
39805
39974
|
if ("assetId" in input) {
|
39806
39975
|
return input.assetId === assetId;
|
@@ -39809,24 +39978,27 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39809
39978
|
});
|
39810
39979
|
const updateAssetInput = (assetId, quantity) => {
|
39811
39980
|
const assetInput = findAssetInput(assetId);
|
39981
|
+
let usedQuantity = quantity;
|
39982
|
+
if (assetId === BaseAssetId) {
|
39983
|
+
usedQuantity = bn("1000000000000000000");
|
39984
|
+
}
|
39812
39985
|
if (assetInput && "assetId" in assetInput) {
|
39813
|
-
assetInput.id =
|
39814
|
-
assetInput.amount =
|
39986
|
+
assetInput.id = hexlify(randomBytes3(33));
|
39987
|
+
assetInput.amount = usedQuantity;
|
39815
39988
|
} else {
|
39816
39989
|
this.addResources([
|
39817
39990
|
{
|
39818
|
-
id:
|
39819
|
-
amount:
|
39991
|
+
id: hexlify(randomBytes3(33)),
|
39992
|
+
amount: usedQuantity,
|
39820
39993
|
assetId,
|
39821
39994
|
owner: resourcesOwner || Address.fromRandom(),
|
39822
|
-
maturity: 0,
|
39823
39995
|
blockCreated: bn(1),
|
39824
39996
|
txCreatedIdx: bn(1)
|
39825
39997
|
}
|
39826
39998
|
]);
|
39827
39999
|
}
|
39828
40000
|
};
|
39829
|
-
updateAssetInput(
|
40001
|
+
updateAssetInput(BaseAssetId, bn(1e11));
|
39830
40002
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
39831
40003
|
}
|
39832
40004
|
/**
|
@@ -39851,7 +40023,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39851
40023
|
toJSON() {
|
39852
40024
|
return normalizeJSON(this);
|
39853
40025
|
}
|
39854
|
-
|
40026
|
+
updatePredicateGasUsed(inputs) {
|
39855
40027
|
this.inputs.forEach((i) => {
|
39856
40028
|
let correspondingInput;
|
39857
40029
|
switch (i.type) {
|
@@ -39873,6 +40045,15 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39873
40045
|
}
|
39874
40046
|
});
|
39875
40047
|
}
|
40048
|
+
shiftPredicateData() {
|
40049
|
+
this.inputs.forEach((input) => {
|
40050
|
+
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
40051
|
+
input.predicateData = input.paddPredicateData(
|
40052
|
+
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
40053
|
+
);
|
40054
|
+
}
|
40055
|
+
});
|
40056
|
+
}
|
39876
40057
|
};
|
39877
40058
|
|
39878
40059
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -40187,7 +40368,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40187
40368
|
}
|
40188
40369
|
calculateMaxGas(chainInfo, minGas) {
|
40189
40370
|
const { consensusParameters } = chainInfo;
|
40190
|
-
const { gasPerByte } = consensusParameters;
|
40371
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
40191
40372
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
40192
40373
|
(acc, wit) => acc + wit.dataLength,
|
40193
40374
|
0
|
@@ -40197,7 +40378,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40197
40378
|
minGas,
|
40198
40379
|
witnessesLength,
|
40199
40380
|
witnessLimit: this.witnessLimit,
|
40200
|
-
gasLimit: this.gasLimit
|
40381
|
+
gasLimit: this.gasLimit,
|
40382
|
+
maxGasPerTx
|
40201
40383
|
});
|
40202
40384
|
}
|
40203
40385
|
/**
|
@@ -40270,13 +40452,29 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40270
40452
|
}
|
40271
40453
|
}
|
40272
40454
|
};
|
40455
|
+
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
40456
|
+
(acc, input) => {
|
40457
|
+
if (input.type === InputType.Coin && input.owner === owner) {
|
40458
|
+
acc.utxos.push(input.id);
|
40459
|
+
}
|
40460
|
+
if (input.type === InputType.Message && input.recipient === owner) {
|
40461
|
+
acc.messages.push(input.nonce);
|
40462
|
+
}
|
40463
|
+
return acc;
|
40464
|
+
},
|
40465
|
+
{
|
40466
|
+
utxos: [],
|
40467
|
+
messages: []
|
40468
|
+
}
|
40469
|
+
);
|
40273
40470
|
|
40274
40471
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
40275
40472
|
var calculateTransactionFee = (params) => {
|
40276
40473
|
const {
|
40277
|
-
|
40474
|
+
gasPrice,
|
40278
40475
|
rawPayload,
|
40279
|
-
|
40476
|
+
tip,
|
40477
|
+
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
40280
40478
|
} = params;
|
40281
40479
|
const gasPerByte = bn(feeParams.gasPerByte);
|
40282
40480
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
@@ -40286,8 +40484,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40286
40484
|
return {
|
40287
40485
|
fee: bn(0),
|
40288
40486
|
minFee: bn(0),
|
40289
|
-
maxFee: bn(0)
|
40290
|
-
feeFromGasUsed: bn(0)
|
40487
|
+
maxFee: bn(0)
|
40291
40488
|
};
|
40292
40489
|
}
|
40293
40490
|
const { type: type3, witnesses, inputs, policies } = transaction;
|
@@ -40319,7 +40516,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40319
40516
|
metadataGas,
|
40320
40517
|
txBytesSize: transactionBytes.length
|
40321
40518
|
});
|
40322
|
-
const gasPrice = bn(policies.find((policy) => policy.type === PolicyType.GasPrice)?.data);
|
40323
40519
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType.WitnessLimit)?.data;
|
40324
40520
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
40325
40521
|
const maxGas = getMaxGas({
|
@@ -40327,17 +40523,25 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40327
40523
|
minGas,
|
40328
40524
|
witnessesLength,
|
40329
40525
|
gasLimit,
|
40330
|
-
witnessLimit
|
40526
|
+
witnessLimit,
|
40527
|
+
maxGasPerTx
|
40528
|
+
});
|
40529
|
+
const minFee = calculateGasFee({
|
40530
|
+
gasPrice,
|
40531
|
+
gas: minGas,
|
40532
|
+
priceFactor: gasPriceFactor,
|
40533
|
+
tip
|
40534
|
+
});
|
40535
|
+
const maxFee = calculateGasFee({
|
40536
|
+
gasPrice,
|
40537
|
+
gas: maxGas,
|
40538
|
+
priceFactor: gasPriceFactor,
|
40539
|
+
tip
|
40331
40540
|
});
|
40332
|
-
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
40333
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
40334
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
40335
|
-
const fee = minFee.add(feeFromGasUsed);
|
40336
40541
|
return {
|
40337
|
-
fee,
|
40338
40542
|
minFee,
|
40339
40543
|
maxFee,
|
40340
|
-
|
40544
|
+
fee: maxFee
|
40341
40545
|
};
|
40342
40546
|
};
|
40343
40547
|
|
@@ -40938,7 +41142,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40938
41142
|
gqlTransactionStatus,
|
40939
41143
|
abiMap = {},
|
40940
41144
|
maxInputs,
|
40941
|
-
gasCosts
|
41145
|
+
gasCosts,
|
41146
|
+
maxGasPerTx,
|
41147
|
+
gasPrice
|
40942
41148
|
} = params;
|
40943
41149
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
40944
41150
|
const rawPayload = hexlify(transactionBytes);
|
@@ -40952,11 +41158,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40952
41158
|
maxInputs
|
40953
41159
|
});
|
40954
41160
|
const typeName = getTransactionTypeName(transaction.type);
|
41161
|
+
const tip = bn(transaction.policies?.find((policy) => policy.type === PolicyType.Tip)?.data);
|
40955
41162
|
const { fee } = calculateTransactionFee({
|
40956
|
-
|
41163
|
+
gasPrice,
|
40957
41164
|
rawPayload,
|
41165
|
+
tip,
|
40958
41166
|
consensusParameters: {
|
40959
41167
|
gasCosts,
|
41168
|
+
maxGasPerTx,
|
40960
41169
|
feeParams: {
|
40961
41170
|
gasPerByte,
|
40962
41171
|
gasPriceFactor
|
@@ -41092,8 +41301,13 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41092
41301
|
const decodedTransaction = this.decodeTransaction(
|
41093
41302
|
transaction
|
41094
41303
|
);
|
41095
|
-
|
41096
|
-
|
41304
|
+
let txReceipts = [];
|
41305
|
+
if (transaction?.status && "receipts" in transaction.status) {
|
41306
|
+
txReceipts = transaction.status.receipts;
|
41307
|
+
}
|
41308
|
+
const receipts = txReceipts.map(processGqlReceipt) || [];
|
41309
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
41310
|
+
const gasPrice = await this.provider.getLatestGasPrice();
|
41097
41311
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
41098
41312
|
const transactionSummary = assembleTransactionSummary({
|
41099
41313
|
id: this.id,
|
@@ -41105,7 +41319,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41105
41319
|
gasPriceFactor,
|
41106
41320
|
abiMap: contractsAbiMap,
|
41107
41321
|
maxInputs,
|
41108
|
-
gasCosts
|
41322
|
+
gasCosts,
|
41323
|
+
maxGasPerTx,
|
41324
|
+
gasPrice
|
41109
41325
|
});
|
41110
41326
|
return transactionSummary;
|
41111
41327
|
}
|
@@ -41142,14 +41358,26 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41142
41358
|
gqlTransaction: this.gqlTransaction,
|
41143
41359
|
...transactionSummary
|
41144
41360
|
};
|
41361
|
+
let logs = [];
|
41145
41362
|
if (this.abis) {
|
41146
|
-
|
41363
|
+
logs = getDecodedLogs(
|
41147
41364
|
transactionSummary.receipts,
|
41148
41365
|
this.abis.main,
|
41149
41366
|
this.abis.otherContractsAbis
|
41150
41367
|
);
|
41151
41368
|
transactionResult.logs = logs;
|
41152
41369
|
}
|
41370
|
+
if (transactionResult.isStatusFailure) {
|
41371
|
+
const {
|
41372
|
+
receipts,
|
41373
|
+
gqlTransaction: { status }
|
41374
|
+
} = transactionResult;
|
41375
|
+
throw extractTxError({
|
41376
|
+
receipts,
|
41377
|
+
status,
|
41378
|
+
logs
|
41379
|
+
});
|
41380
|
+
}
|
41153
41381
|
return transactionResult;
|
41154
41382
|
}
|
41155
41383
|
/**
|
@@ -41158,14 +41386,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41158
41386
|
* @param contractsAbiMap - The contracts ABI map.
|
41159
41387
|
*/
|
41160
41388
|
async wait(contractsAbiMap) {
|
41161
|
-
|
41162
|
-
if (result.isStatusFailure) {
|
41163
|
-
throw new FuelError(
|
41164
|
-
ErrorCode.TRANSACTION_FAILED,
|
41165
|
-
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
41166
|
-
);
|
41167
|
-
}
|
41168
|
-
return result;
|
41389
|
+
return this.waitForResult(contractsAbiMap);
|
41169
41390
|
}
|
41170
41391
|
};
|
41171
41392
|
|
@@ -41244,13 +41465,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41244
41465
|
gasPerByte: bn(feeParams.gasPerByte),
|
41245
41466
|
maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
|
41246
41467
|
chainId: bn(consensusParameters.chainId),
|
41247
|
-
baseAssetId: consensusParameters.baseAssetId,
|
41248
41468
|
gasCosts
|
41249
41469
|
},
|
41250
41470
|
gasCosts,
|
41251
41471
|
latestBlock: {
|
41252
41472
|
id: latestBlock.id,
|
41253
|
-
height: bn(latestBlock.
|
41473
|
+
height: bn(latestBlock.height),
|
41254
41474
|
time: latestBlock.header.time,
|
41255
41475
|
transactions: latestBlock.transactions.map((i) => ({
|
41256
41476
|
id: i.id
|
@@ -41445,7 +41665,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41445
41665
|
*/
|
41446
41666
|
async getBlockNumber() {
|
41447
41667
|
const { chain } = await this.operations.getChain();
|
41448
|
-
return bn(chain.latestBlock.
|
41668
|
+
return bn(chain.latestBlock.height, 10);
|
41449
41669
|
}
|
41450
41670
|
/**
|
41451
41671
|
* Returns the chain information.
|
@@ -41460,8 +41680,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41460
41680
|
minGasPrice: bn(nodeInfo.minGasPrice),
|
41461
41681
|
nodeVersion: nodeInfo.nodeVersion,
|
41462
41682
|
utxoValidation: nodeInfo.utxoValidation,
|
41463
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
41464
|
-
peers: nodeInfo.peers
|
41683
|
+
vmBacktrace: nodeInfo.vmBacktrace
|
41465
41684
|
};
|
41466
41685
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
41467
41686
|
return processedNodeInfo;
|
@@ -41487,17 +41706,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41487
41706
|
} = this.getChain();
|
41488
41707
|
return chainId.toNumber();
|
41489
41708
|
}
|
41490
|
-
/**
|
41491
|
-
* Returns the base asset ID
|
41492
|
-
*
|
41493
|
-
* @returns A promise that resolves to the base asset ID
|
41494
|
-
*/
|
41495
|
-
getBaseAssetId() {
|
41496
|
-
const {
|
41497
|
-
consensusParameters: { baseAssetId }
|
41498
|
-
} = this.getChain();
|
41499
|
-
return baseAssetId;
|
41500
|
-
}
|
41501
41709
|
/**
|
41502
41710
|
* Submits a transaction to the chain to be executed.
|
41503
41711
|
*
|
@@ -41558,14 +41766,13 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41558
41766
|
return this.estimateTxDependencies(transactionRequest);
|
41559
41767
|
}
|
41560
41768
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41561
|
-
const { dryRun:
|
41562
|
-
encodedTransaction,
|
41769
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41770
|
+
encodedTransactions: encodedTransaction,
|
41563
41771
|
utxoValidation: utxoValidation || false
|
41564
41772
|
});
|
41565
|
-
const receipts =
|
41566
|
-
|
41567
|
-
|
41568
|
-
};
|
41773
|
+
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
41774
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41775
|
+
return { receipts, dryrunStatus: status };
|
41569
41776
|
}
|
41570
41777
|
/**
|
41571
41778
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -41604,9 +41811,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41604
41811
|
* If there are missing variable outputs,
|
41605
41812
|
* `addVariableOutputs` is called on the transaction.
|
41606
41813
|
*
|
41607
|
-
* @privateRemarks
|
41608
|
-
* TODO: Investigate support for missing contract IDs
|
41609
|
-
* TODO: Add support for missing output messages
|
41610
41814
|
*
|
41611
41815
|
* @param transactionRequest - The transaction request object.
|
41612
41816
|
* @returns A promise.
|
@@ -41619,16 +41823,19 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41619
41823
|
missingContractIds: []
|
41620
41824
|
};
|
41621
41825
|
}
|
41622
|
-
await this.estimatePredicates(transactionRequest);
|
41623
41826
|
let receipts = [];
|
41624
41827
|
const missingContractIds = [];
|
41625
41828
|
let outputVariables = 0;
|
41829
|
+
let dryrunStatus;
|
41626
41830
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
41627
|
-
const {
|
41628
|
-
|
41831
|
+
const {
|
41832
|
+
dryRun: [{ receipts: rawReceipts, status }]
|
41833
|
+
} = await this.operations.dryRun({
|
41834
|
+
encodedTransactions: [hexlify(transactionRequest.toTransactionBytes())],
|
41629
41835
|
utxoValidation: false
|
41630
41836
|
});
|
41631
|
-
receipts =
|
41837
|
+
receipts = rawReceipts.map(processGqlReceipt);
|
41838
|
+
dryrunStatus = status;
|
41632
41839
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
41633
41840
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
41634
41841
|
if (hasMissingOutputs) {
|
@@ -41638,6 +41845,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41638
41845
|
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
41639
41846
|
missingContractIds.push(contractId);
|
41640
41847
|
});
|
41848
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41849
|
+
transactionRequest,
|
41850
|
+
optimizeGas: false
|
41851
|
+
});
|
41852
|
+
transactionRequest.maxFee = maxFee;
|
41641
41853
|
} else {
|
41642
41854
|
break;
|
41643
41855
|
}
|
@@ -41645,7 +41857,133 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41645
41857
|
return {
|
41646
41858
|
receipts,
|
41647
41859
|
outputVariables,
|
41648
|
-
missingContractIds
|
41860
|
+
missingContractIds,
|
41861
|
+
dryrunStatus
|
41862
|
+
};
|
41863
|
+
}
|
41864
|
+
/**
|
41865
|
+
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
41866
|
+
*
|
41867
|
+
* Transactions are dry run in batches. After each dry run, transactions requiring
|
41868
|
+
* further modifications are identified. The method iteratively updates these transactions
|
41869
|
+
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
41870
|
+
*
|
41871
|
+
* @param transactionRequests - Array of transaction request objects.
|
41872
|
+
* @returns A promise that resolves to an array of results for each transaction.
|
41873
|
+
*/
|
41874
|
+
async estimateMultipleTxDependencies(transactionRequests) {
|
41875
|
+
const results = transactionRequests.map(() => ({
|
41876
|
+
receipts: [],
|
41877
|
+
outputVariables: 0,
|
41878
|
+
missingContractIds: [],
|
41879
|
+
dryrunStatus: void 0
|
41880
|
+
}));
|
41881
|
+
const allRequests = clone_default(transactionRequests);
|
41882
|
+
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
41883
|
+
allRequests.forEach((req, index) => {
|
41884
|
+
if (req.type === TransactionType.Script) {
|
41885
|
+
serializedTransactionsMap.set(index, hexlify(req.toTransactionBytes()));
|
41886
|
+
}
|
41887
|
+
});
|
41888
|
+
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
41889
|
+
let attempt = 0;
|
41890
|
+
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
41891
|
+
const encodedTransactions = transactionsToProcess.map(
|
41892
|
+
(index) => serializedTransactionsMap.get(index)
|
41893
|
+
);
|
41894
|
+
const dryRunResults = await this.operations.dryRun({
|
41895
|
+
encodedTransactions,
|
41896
|
+
utxoValidation: false
|
41897
|
+
});
|
41898
|
+
const nextRoundTransactions = [];
|
41899
|
+
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
41900
|
+
const currentResultIndex = transactionsToProcess[i];
|
41901
|
+
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
41902
|
+
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
41903
|
+
results[currentResultIndex].dryrunStatus = status;
|
41904
|
+
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
41905
|
+
results[currentResultIndex].receipts
|
41906
|
+
);
|
41907
|
+
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
41908
|
+
const requestToProcess = allRequests[currentResultIndex];
|
41909
|
+
if (hasMissingOutputs && requestToProcess?.type === TransactionType.Script) {
|
41910
|
+
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
41911
|
+
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
41912
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
41913
|
+
requestToProcess.addContractInputAndOutput(Address.fromString(contractId));
|
41914
|
+
results[currentResultIndex].missingContractIds.push(contractId);
|
41915
|
+
});
|
41916
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
41917
|
+
transactionRequest: requestToProcess,
|
41918
|
+
optimizeGas: false
|
41919
|
+
});
|
41920
|
+
requestToProcess.maxFee = maxFee;
|
41921
|
+
serializedTransactionsMap.set(
|
41922
|
+
currentResultIndex,
|
41923
|
+
hexlify(requestToProcess.toTransactionBytes())
|
41924
|
+
);
|
41925
|
+
nextRoundTransactions.push(currentResultIndex);
|
41926
|
+
allRequests[currentResultIndex] = requestToProcess;
|
41927
|
+
}
|
41928
|
+
}
|
41929
|
+
transactionsToProcess = nextRoundTransactions;
|
41930
|
+
attempt += 1;
|
41931
|
+
}
|
41932
|
+
return results;
|
41933
|
+
}
|
41934
|
+
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
41935
|
+
if (estimateTxDependencies) {
|
41936
|
+
return this.estimateMultipleTxDependencies(transactionRequests);
|
41937
|
+
}
|
41938
|
+
const encodedTransactions = transactionRequests.map((tx) => hexlify(tx.toTransactionBytes()));
|
41939
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
41940
|
+
encodedTransactions,
|
41941
|
+
utxoValidation: utxoValidation || false
|
41942
|
+
});
|
41943
|
+
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
41944
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
41945
|
+
return { receipts, dryrunStatus: status };
|
41946
|
+
});
|
41947
|
+
return results;
|
41948
|
+
}
|
41949
|
+
async estimateTxGasAndFee(params) {
|
41950
|
+
const { transactionRequest, totalGasUsedByPredicates = bn(0), optimizeGas = true } = params;
|
41951
|
+
let { gasPrice } = params;
|
41952
|
+
const chainInfo = this.getChain();
|
41953
|
+
const { gasPriceFactor } = this.getGasConfig();
|
41954
|
+
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
41955
|
+
if (!gasPrice) {
|
41956
|
+
gasPrice = await this.estimateGasPrice(10);
|
41957
|
+
}
|
41958
|
+
const shouldSetGaslimit = transactionRequest.type === TransactionType.Script && !optimizeGas;
|
41959
|
+
const minFee = calculateGasFee({
|
41960
|
+
gasPrice: bn(gasPrice),
|
41961
|
+
gas: minGas,
|
41962
|
+
priceFactor: gasPriceFactor,
|
41963
|
+
tip: transactionRequest.tip
|
41964
|
+
}).add(1);
|
41965
|
+
if (shouldSetGaslimit) {
|
41966
|
+
transactionRequest.gasLimit = chainInfo.consensusParameters.maxGasPerTx.sub(
|
41967
|
+
minGas.add(totalGasUsedByPredicates)
|
41968
|
+
);
|
41969
|
+
}
|
41970
|
+
let maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
41971
|
+
const maxFee = calculateGasFee({
|
41972
|
+
gasPrice: bn(gasPrice),
|
41973
|
+
gas: maxGas,
|
41974
|
+
priceFactor: gasPriceFactor,
|
41975
|
+
tip: transactionRequest.tip
|
41976
|
+
}).add(1);
|
41977
|
+
if (shouldSetGaslimit) {
|
41978
|
+
maxGas = chainInfo.consensusParameters.maxGasPerTx.sub(maxFee);
|
41979
|
+
transactionRequest.gasLimit = maxGas;
|
41980
|
+
}
|
41981
|
+
return {
|
41982
|
+
minGas,
|
41983
|
+
minFee,
|
41984
|
+
maxGas,
|
41985
|
+
maxFee,
|
41986
|
+
gasPrice
|
41649
41987
|
};
|
41650
41988
|
}
|
41651
41989
|
/**
|
@@ -41663,15 +42001,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41663
42001
|
if (estimateTxDependencies) {
|
41664
42002
|
return this.estimateTxDependencies(transactionRequest);
|
41665
42003
|
}
|
41666
|
-
const
|
41667
|
-
const { dryRun:
|
41668
|
-
|
42004
|
+
const encodedTransactions = [hexlify(transactionRequest.toTransactionBytes())];
|
42005
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
42006
|
+
encodedTransactions,
|
41669
42007
|
utxoValidation: true
|
41670
42008
|
});
|
41671
|
-
const
|
41672
|
-
|
41673
|
-
receipts
|
41674
|
-
|
42009
|
+
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
42010
|
+
const { id, receipts, status } = dryRunStatus;
|
42011
|
+
const processedReceipts = receipts.map(processGqlReceipt);
|
42012
|
+
return { id, receipts: processedReceipts, status };
|
42013
|
+
});
|
42014
|
+
return { receipts: callResult[0].receipts };
|
41675
42015
|
}
|
41676
42016
|
/**
|
41677
42017
|
* Returns a transaction cost to enable user
|
@@ -41688,80 +42028,80 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41688
42028
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
41689
42029
|
* @returns A promise that resolves to the transaction cost object.
|
41690
42030
|
*/
|
41691
|
-
async getTransactionCost(transactionRequestLike,
|
41692
|
-
estimateTxDependencies = true,
|
41693
|
-
estimatePredicates = true,
|
41694
|
-
resourcesOwner,
|
41695
|
-
signatureCallback
|
41696
|
-
} = {}) {
|
42031
|
+
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
41697
42032
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
41698
|
-
const chainInfo = this.getChain();
|
41699
|
-
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
41700
|
-
const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
41701
42033
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
41702
42034
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
41703
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
42035
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
41704
42036
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
41705
|
-
|
41706
|
-
|
41707
|
-
|
41708
|
-
}
|
41709
|
-
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
41710
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41711
|
-
}
|
41712
|
-
await this.estimatePredicates(txRequestClone);
|
42037
|
+
txRequestClone.maxFee = bn(0);
|
42038
|
+
if (isScriptTransaction) {
|
42039
|
+
txRequestClone.gasLimit = bn(0);
|
41713
42040
|
}
|
41714
|
-
if (
|
41715
|
-
|
42041
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
42042
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
41716
42043
|
}
|
41717
|
-
const
|
41718
|
-
|
42044
|
+
const signedRequest = clone_default(txRequestClone);
|
42045
|
+
let addedSignatures = 0;
|
42046
|
+
if (signatureCallback && isScriptTransaction) {
|
42047
|
+
const lengthBefore = signedRequest.witnesses.length;
|
42048
|
+
await signatureCallback(signedRequest);
|
42049
|
+
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
42050
|
+
}
|
42051
|
+
await this.estimatePredicates(signedRequest);
|
42052
|
+
let { maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
42053
|
+
transactionRequest: signedRequest,
|
42054
|
+
optimizeGas: false
|
42055
|
+
});
|
42056
|
+
txRequestClone.maxFee = maxFee;
|
41719
42057
|
let receipts = [];
|
41720
42058
|
let missingContractIds = [];
|
41721
42059
|
let outputVariables = 0;
|
41722
|
-
|
41723
|
-
|
41724
|
-
|
42060
|
+
let gasUsed = bn(0);
|
42061
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
42062
|
+
if (isScriptTransaction) {
|
42063
|
+
if (signatureCallback) {
|
42064
|
+
await signatureCallback(txRequestClone);
|
42065
|
+
}
|
42066
|
+
txRequestClone.gasLimit = maxGas;
|
41725
42067
|
const result = await this.estimateTxDependencies(txRequestClone);
|
41726
42068
|
receipts = result.receipts;
|
41727
42069
|
outputVariables = result.outputVariables;
|
41728
42070
|
missingContractIds = result.missingContractIds;
|
42071
|
+
gasUsed = getGasUsedFromReceipts(receipts);
|
42072
|
+
txRequestClone.gasLimit = gasUsed;
|
42073
|
+
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
42074
|
+
transactionRequest: txRequestClone,
|
42075
|
+
gasPrice
|
42076
|
+
}));
|
41729
42077
|
}
|
41730
|
-
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
41731
|
-
const usedFee = calculatePriceWithFactor(
|
41732
|
-
gasUsed,
|
41733
|
-
gasPrice,
|
41734
|
-
gasPriceFactor
|
41735
|
-
).normalizeZeroToOne();
|
41736
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
41737
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
41738
42078
|
return {
|
41739
42079
|
requiredQuantities: allQuantities,
|
41740
42080
|
receipts,
|
41741
42081
|
gasUsed,
|
41742
|
-
minGasPrice,
|
41743
42082
|
gasPrice,
|
41744
42083
|
minGas,
|
41745
42084
|
maxGas,
|
41746
|
-
usedFee,
|
41747
42085
|
minFee,
|
41748
42086
|
maxFee,
|
41749
|
-
estimatedInputs: txRequestClone.inputs,
|
41750
42087
|
outputVariables,
|
41751
|
-
missingContractIds
|
42088
|
+
missingContractIds,
|
42089
|
+
addedSignatures,
|
42090
|
+
estimatedPredicates: txRequestClone.inputs
|
41752
42091
|
};
|
41753
42092
|
}
|
41754
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
42093
|
+
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
41755
42094
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41756
42095
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
41757
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
42096
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
42097
|
+
quantitiesToContract
|
42098
|
+
});
|
41758
42099
|
transactionRequest.addResources(
|
41759
42100
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
41760
42101
|
);
|
41761
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
41762
|
-
|
41763
|
-
|
41764
|
-
);
|
42102
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
42103
|
+
quantitiesToContract
|
42104
|
+
});
|
41765
42105
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
41766
42106
|
return {
|
41767
42107
|
resources,
|
@@ -41785,7 +42125,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41785
42125
|
assetId: coin.assetId,
|
41786
42126
|
amount: bn(coin.amount),
|
41787
42127
|
owner: Address.fromAddressOrString(coin.owner),
|
41788
|
-
maturity: bn(coin.maturity).toNumber(),
|
41789
42128
|
blockCreated: bn(coin.blockCreated),
|
41790
42129
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41791
42130
|
}));
|
@@ -41837,7 +42176,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41837
42176
|
amount: bn(coin.amount),
|
41838
42177
|
assetId: coin.assetId,
|
41839
42178
|
owner: Address.fromAddressOrString(coin.owner),
|
41840
|
-
maturity: bn(coin.maturity).toNumber(),
|
41841
42179
|
blockCreated: bn(coin.blockCreated),
|
41842
42180
|
txCreatedIdx: bn(coin.txCreatedIdx)
|
41843
42181
|
};
|
@@ -41870,7 +42208,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41870
42208
|
}
|
41871
42209
|
return {
|
41872
42210
|
id: block2.id,
|
41873
|
-
height: bn(block2.
|
42211
|
+
height: bn(block2.height),
|
41874
42212
|
time: block2.header.time,
|
41875
42213
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
41876
42214
|
};
|
@@ -41885,7 +42223,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41885
42223
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
41886
42224
|
const blocks = fetchedData.edges.map(({ node: block2 }) => ({
|
41887
42225
|
id: block2.id,
|
41888
|
-
height: bn(block2.
|
42226
|
+
height: bn(block2.height),
|
41889
42227
|
time: block2.header.time,
|
41890
42228
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
41891
42229
|
}));
|
@@ -41912,7 +42250,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41912
42250
|
}
|
41913
42251
|
return {
|
41914
42252
|
id: block2.id,
|
41915
|
-
height: bn(block2.
|
42253
|
+
height: bn(block2.height, 10),
|
41916
42254
|
time: block2.header.time,
|
41917
42255
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
41918
42256
|
transactions: block2.transactions.map(
|
@@ -42114,6 +42452,16 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42114
42452
|
data
|
42115
42453
|
};
|
42116
42454
|
}
|
42455
|
+
async getLatestGasPrice() {
|
42456
|
+
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
42457
|
+
return bn(latestGasPrice.gasPrice);
|
42458
|
+
}
|
42459
|
+
async estimateGasPrice(blockHorizon) {
|
42460
|
+
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
42461
|
+
blockHorizon: String(blockHorizon)
|
42462
|
+
});
|
42463
|
+
return bn(estimateGasPrice.gasPrice);
|
42464
|
+
}
|
42117
42465
|
/**
|
42118
42466
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
42119
42467
|
*
|
@@ -42174,10 +42522,15 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42174
42522
|
arrayify(gqlTransaction.rawPayload),
|
42175
42523
|
0
|
42176
42524
|
);
|
42177
|
-
|
42525
|
+
let txReceipts = [];
|
42526
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42527
|
+
txReceipts = gqlTransaction.status.receipts;
|
42528
|
+
}
|
42529
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42178
42530
|
const {
|
42179
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42531
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42180
42532
|
} = provider.getChain();
|
42533
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42181
42534
|
const transactionInfo = assembleTransactionSummary({
|
42182
42535
|
id: gqlTransaction.id,
|
42183
42536
|
receipts,
|
@@ -42188,7 +42541,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42188
42541
|
gasPriceFactor: bn(gasPriceFactor),
|
42189
42542
|
abiMap,
|
42190
42543
|
maxInputs,
|
42191
|
-
gasCosts
|
42544
|
+
gasCosts,
|
42545
|
+
maxGasPerTx,
|
42546
|
+
gasPrice
|
42192
42547
|
});
|
42193
42548
|
return {
|
42194
42549
|
gqlTransaction,
|
@@ -42198,10 +42553,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42198
42553
|
async function getTransactionSummaryFromRequest(params) {
|
42199
42554
|
const { provider, transactionRequest, abiMap } = params;
|
42200
42555
|
const { receipts } = await provider.call(transactionRequest);
|
42201
|
-
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
42556
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
|
42202
42557
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
42203
42558
|
const transaction = transactionRequest.toTransaction();
|
42204
42559
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
42560
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42205
42561
|
const transactionSummary = assembleTransactionSummary({
|
42206
42562
|
receipts,
|
42207
42563
|
transaction,
|
@@ -42210,7 +42566,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42210
42566
|
gasPerByte,
|
42211
42567
|
gasPriceFactor,
|
42212
42568
|
maxInputs,
|
42213
|
-
gasCosts
|
42569
|
+
gasCosts,
|
42570
|
+
maxGasPerTx,
|
42571
|
+
gasPrice
|
42214
42572
|
});
|
42215
42573
|
return transactionSummary;
|
42216
42574
|
}
|
@@ -42219,13 +42577,18 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42219
42577
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
42220
42578
|
const { edges, pageInfo } = transactionsByOwner;
|
42221
42579
|
const {
|
42222
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
42580
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
42223
42581
|
} = provider.getChain();
|
42582
|
+
const gasPrice = await provider.getLatestGasPrice();
|
42224
42583
|
const transactions = edges.map((edge) => {
|
42225
42584
|
const { node: gqlTransaction } = edge;
|
42226
|
-
const { id, rawPayload,
|
42585
|
+
const { id, rawPayload, status } = gqlTransaction;
|
42227
42586
|
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
42228
|
-
|
42587
|
+
let txReceipts = [];
|
42588
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
42589
|
+
txReceipts = gqlTransaction.status.receipts;
|
42590
|
+
}
|
42591
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
42229
42592
|
const transactionSummary = assembleTransactionSummary({
|
42230
42593
|
id,
|
42231
42594
|
receipts,
|
@@ -42236,7 +42599,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42236
42599
|
gasPerByte,
|
42237
42600
|
gasPriceFactor,
|
42238
42601
|
maxInputs,
|
42239
|
-
gasCosts
|
42602
|
+
gasCosts,
|
42603
|
+
maxGasPerTx,
|
42604
|
+
gasPrice
|
42240
42605
|
});
|
42241
42606
|
const output3 = {
|
42242
42607
|
gqlTransaction,
|
@@ -42527,9 +42892,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42527
42892
|
* @param assetId - The asset ID to check the balance for.
|
42528
42893
|
* @returns A promise that resolves to the balance amount.
|
42529
42894
|
*/
|
42530
|
-
async getBalance(assetId) {
|
42531
|
-
const
|
42532
|
-
const amount = await this.provider.getBalance(this.address, assetIdToFetch);
|
42895
|
+
async getBalance(assetId = BaseAssetId) {
|
42896
|
+
const amount = await this.provider.getBalance(this.address, assetId);
|
42533
42897
|
return amount;
|
42534
42898
|
}
|
42535
42899
|
/**
|
@@ -42566,37 +42930,33 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42566
42930
|
* @param fee - The estimated transaction fee.
|
42567
42931
|
* @returns A promise that resolves when the resources are added to the transaction.
|
42568
42932
|
*/
|
42569
|
-
async fund(request,
|
42570
|
-
const
|
42571
|
-
const
|
42933
|
+
async fund(request, params) {
|
42934
|
+
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
42935
|
+
const txRequest = request;
|
42936
|
+
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
42572
42937
|
amount: bn(fee),
|
42573
|
-
assetId:
|
42574
|
-
coinQuantities
|
42938
|
+
assetId: BaseAssetId,
|
42939
|
+
coinQuantities: requiredQuantities
|
42575
42940
|
});
|
42576
42941
|
const quantitiesDict = {};
|
42577
|
-
|
42942
|
+
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
42578
42943
|
quantitiesDict[assetId] = {
|
42579
42944
|
required: amount,
|
42580
42945
|
owned: bn(0)
|
42581
42946
|
};
|
42582
42947
|
});
|
42583
|
-
|
42584
|
-
const cachedMessages = [];
|
42585
|
-
const owner = this.address.toB256();
|
42586
|
-
request.inputs.forEach((input) => {
|
42948
|
+
txRequest.inputs.forEach((input) => {
|
42587
42949
|
const isResource = "amount" in input;
|
42588
42950
|
if (isResource) {
|
42589
42951
|
const isCoin2 = "owner" in input;
|
42590
42952
|
if (isCoin2) {
|
42591
42953
|
const assetId = String(input.assetId);
|
42592
|
-
if (
|
42954
|
+
if (quantitiesDict[assetId]) {
|
42593
42955
|
const amount = bn(input.amount);
|
42594
42956
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
42595
|
-
cachedUtxos.push(input.id);
|
42596
42957
|
}
|
42597
|
-
} else if (input.
|
42598
|
-
quantitiesDict[
|
42599
|
-
cachedMessages.push(input.nonce);
|
42958
|
+
} else if (input.amount && quantitiesDict[BaseAssetId]) {
|
42959
|
+
quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
|
42600
42960
|
}
|
42601
42961
|
}
|
42602
42962
|
});
|
@@ -42611,12 +42971,23 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42611
42971
|
});
|
42612
42972
|
const needsToBeFunded = missingQuantities.length;
|
42613
42973
|
if (needsToBeFunded) {
|
42614
|
-
const
|
42615
|
-
|
42616
|
-
|
42617
|
-
|
42618
|
-
|
42974
|
+
const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toString());
|
42975
|
+
const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
|
42976
|
+
txRequest.addResources(resources);
|
42977
|
+
}
|
42978
|
+
txRequest.shiftPredicateData();
|
42979
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
42980
|
+
const requestToBeReEstimate = clone_default(txRequest);
|
42981
|
+
if (addedSignatures) {
|
42982
|
+
Array.from({ length: addedSignatures }).forEach(
|
42983
|
+
() => requestToBeReEstimate.addEmptyWitness()
|
42984
|
+
);
|
42619
42985
|
}
|
42986
|
+
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
42987
|
+
transactionRequest: requestToBeReEstimate
|
42988
|
+
});
|
42989
|
+
txRequest.maxFee = maxFee;
|
42990
|
+
return txRequest;
|
42620
42991
|
}
|
42621
42992
|
/**
|
42622
42993
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -42624,29 +42995,25 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42624
42995
|
* @param destination - The address of the destination.
|
42625
42996
|
* @param amount - The amount of coins to transfer.
|
42626
42997
|
* @param assetId - The asset ID of the coins to transfer.
|
42627
|
-
* @param txParams - The transaction parameters (gasLimit,
|
42998
|
+
* @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
|
42628
42999
|
* @returns A promise that resolves to the prepared transaction request.
|
42629
43000
|
*/
|
42630
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
42631
|
-
const
|
42632
|
-
|
42633
|
-
const
|
42634
|
-
const request = new ScriptTransactionRequest(params);
|
42635
|
-
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
|
42636
|
-
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43001
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
43002
|
+
const request = new ScriptTransactionRequest(txParams);
|
43003
|
+
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
43004
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
42637
43005
|
estimateTxDependencies: true,
|
42638
43006
|
resourcesOwner: this
|
42639
43007
|
});
|
42640
|
-
|
42641
|
-
|
42642
|
-
|
42643
|
-
|
42644
|
-
|
42645
|
-
|
42646
|
-
|
42647
|
-
|
42648
|
-
await this.fund(request,
|
42649
|
-
request.updatePredicateInputs(estimatedInputs);
|
43008
|
+
if ("gasLimit" in txParams) {
|
43009
|
+
this.validateGas({
|
43010
|
+
gasUsed: txCost.gasUsed,
|
43011
|
+
gasLimit: request.gasLimit
|
43012
|
+
});
|
43013
|
+
}
|
43014
|
+
request.gasLimit = txCost.gasUsed;
|
43015
|
+
request.maxFee = txCost.maxFee;
|
43016
|
+
await this.fund(request, txCost);
|
42650
43017
|
return request;
|
42651
43018
|
}
|
42652
43019
|
/**
|
@@ -42658,15 +43025,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42658
43025
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
42659
43026
|
* @returns A promise that resolves to the transaction response.
|
42660
43027
|
*/
|
42661
|
-
async transfer(destination, amount, assetId, txParams = {}) {
|
43028
|
+
async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
42662
43029
|
if (bn(amount).lte(0)) {
|
42663
43030
|
throw new FuelError(
|
42664
43031
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
42665
43032
|
"Transfer amount must be a positive number."
|
42666
43033
|
);
|
42667
43034
|
}
|
42668
|
-
const
|
42669
|
-
const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
43035
|
+
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
42670
43036
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
42671
43037
|
}
|
42672
43038
|
/**
|
@@ -42678,7 +43044,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42678
43044
|
* @param txParams - The optional transaction parameters.
|
42679
43045
|
* @returns A promise that resolves to the transaction response.
|
42680
43046
|
*/
|
42681
|
-
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
43047
|
+
async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
|
42682
43048
|
if (bn(amount).lte(0)) {
|
42683
43049
|
throw new FuelError(
|
42684
43050
|
ErrorCode.INVALID_TRANSFER_AMOUNT,
|
@@ -42686,32 +43052,30 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42686
43052
|
);
|
42687
43053
|
}
|
42688
43054
|
const contractAddress = Address.fromAddressOrString(contractId);
|
42689
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42690
|
-
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
42691
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
42692
43055
|
const { script, scriptData } = await assembleTransferToContractScript({
|
42693
43056
|
hexlifiedContractId: contractAddress.toB256(),
|
42694
43057
|
amountToTransfer: bn(amount),
|
42695
|
-
assetId
|
43058
|
+
assetId
|
42696
43059
|
});
|
42697
43060
|
const request = new ScriptTransactionRequest({
|
42698
|
-
...
|
43061
|
+
...txParams,
|
42699
43062
|
script,
|
42700
43063
|
scriptData
|
42701
43064
|
});
|
42702
43065
|
request.addContractInputAndOutput(contractAddress);
|
42703
|
-
const
|
42704
|
-
|
42705
|
-
[{ amount: bn(amount), assetId: String(
|
42706
|
-
);
|
42707
|
-
request.gasLimit = bn(params.gasLimit ?? gasUsed);
|
42708
|
-
this.validateGas({
|
42709
|
-
gasUsed,
|
42710
|
-
gasPrice: request.gasPrice,
|
42711
|
-
gasLimit: request.gasLimit,
|
42712
|
-
minGasPrice
|
43066
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
43067
|
+
resourcesOwner: this,
|
43068
|
+
quantitiesToContract: [{ amount: bn(amount), assetId: String(assetId) }]
|
42713
43069
|
});
|
42714
|
-
|
43070
|
+
if (txParams.gasLimit) {
|
43071
|
+
this.validateGas({
|
43072
|
+
gasUsed: txCost.gasUsed,
|
43073
|
+
gasLimit: request.gasLimit
|
43074
|
+
});
|
43075
|
+
}
|
43076
|
+
request.gasLimit = txCost.gasUsed;
|
43077
|
+
request.maxFee = txCost.maxFee;
|
43078
|
+
await this.fund(request, txCost);
|
42715
43079
|
return this.sendTransaction(request);
|
42716
43080
|
}
|
42717
43081
|
/**
|
@@ -42723,8 +43087,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42723
43087
|
* @returns A promise that resolves to the transaction response.
|
42724
43088
|
*/
|
42725
43089
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
42726
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
42727
|
-
const baseAssetId = this.provider.getBaseAssetId();
|
42728
43090
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
42729
43091
|
const recipientDataArray = arrayify(
|
42730
43092
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -42737,21 +43099,19 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42737
43099
|
...recipientDataArray,
|
42738
43100
|
...amountDataArray
|
42739
43101
|
]);
|
42740
|
-
const params = { script,
|
43102
|
+
const params = { script, ...txParams };
|
42741
43103
|
const request = new ScriptTransactionRequest(params);
|
42742
|
-
const
|
42743
|
-
const
|
42744
|
-
|
42745
|
-
|
42746
|
-
|
42747
|
-
|
42748
|
-
|
42749
|
-
|
42750
|
-
|
42751
|
-
|
42752
|
-
|
42753
|
-
});
|
42754
|
-
await this.fund(request, requiredQuantities, maxFee);
|
43104
|
+
const quantitiesToContract = [{ amount: bn(amount), assetId: BaseAssetId }];
|
43105
|
+
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
43106
|
+
if (txParams.gasLimit) {
|
43107
|
+
this.validateGas({
|
43108
|
+
gasUsed: txCost.gasUsed,
|
43109
|
+
gasLimit: request.gasLimit
|
43110
|
+
});
|
43111
|
+
}
|
43112
|
+
request.maxFee = txCost.maxFee;
|
43113
|
+
request.gasLimit = txCost.gasUsed;
|
43114
|
+
await this.fund(request, txCost);
|
42755
43115
|
return this.sendTransaction(request);
|
42756
43116
|
}
|
42757
43117
|
async signMessage(message) {
|
@@ -42809,18 +43169,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42809
43169
|
}
|
42810
43170
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
42811
43171
|
}
|
42812
|
-
validateGas({
|
42813
|
-
gasUsed,
|
42814
|
-
gasPrice,
|
42815
|
-
gasLimit,
|
42816
|
-
minGasPrice
|
42817
|
-
}) {
|
42818
|
-
if (minGasPrice.gt(gasPrice)) {
|
42819
|
-
throw new FuelError(
|
42820
|
-
ErrorCode.GAS_PRICE_TOO_LOW,
|
42821
|
-
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
42822
|
-
);
|
42823
|
-
}
|
43172
|
+
validateGas({ gasUsed, gasLimit }) {
|
42824
43173
|
if (gasUsed.gt(gasLimit)) {
|
42825
43174
|
throw new FuelError(
|
42826
43175
|
ErrorCode.GAS_LIMIT_TOO_LOW,
|
@@ -44203,12 +44552,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44203
44552
|
};
|
44204
44553
|
|
44205
44554
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
44206
|
-
var
|
44555
|
+
var import_crypto16 = __toESM(__require("crypto"));
|
44207
44556
|
var rnds8Pool = new Uint8Array(256);
|
44208
44557
|
var poolPtr = rnds8Pool.length;
|
44209
44558
|
function rng() {
|
44210
44559
|
if (poolPtr > rnds8Pool.length - 16) {
|
44211
|
-
|
44560
|
+
import_crypto16.default.randomFillSync(rnds8Pool);
|
44212
44561
|
poolPtr = 0;
|
44213
44562
|
}
|
44214
44563
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -44224,9 +44573,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44224
44573
|
}
|
44225
44574
|
|
44226
44575
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
44227
|
-
var
|
44576
|
+
var import_crypto17 = __toESM(__require("crypto"));
|
44228
44577
|
var native_default = {
|
44229
|
-
randomUUID:
|
44578
|
+
randomUUID: import_crypto17.default.randomUUID
|
44230
44579
|
};
|
44231
44580
|
|
44232
44581
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -44409,7 +44758,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44409
44758
|
* @param transactionRequestLike - The transaction request to send.
|
44410
44759
|
* @returns A promise that resolves to the TransactionResponse object.
|
44411
44760
|
*/
|
44412
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
44761
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
44413
44762
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
44414
44763
|
if (estimateTxDependencies) {
|
44415
44764
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -47675,6 +48024,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47675
48024
|
this.interface = predicateInterface;
|
47676
48025
|
if (inputData !== void 0 && inputData.length > 0) {
|
47677
48026
|
this.predicateData = inputData;
|
48027
|
+
this.predicateDataBytes = this.getPredicateData(0);
|
47678
48028
|
}
|
47679
48029
|
}
|
47680
48030
|
/**
|
@@ -47688,8 +48038,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47688
48038
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
47689
48039
|
request.inputs?.forEach((input) => {
|
47690
48040
|
if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
|
47691
|
-
input.predicate = this.bytes;
|
47692
|
-
input.predicateData = this.getPredicateData(policies.length);
|
48041
|
+
input.predicate = hexlify(this.bytes);
|
48042
|
+
input.predicateData = hexlify(this.getPredicateData(policies.length));
|
47693
48043
|
}
|
47694
48044
|
});
|
47695
48045
|
return request;
|
@@ -47703,10 +48053,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47703
48053
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
47704
48054
|
* @returns A promise that resolves to the prepared transaction request.
|
47705
48055
|
*/
|
47706
|
-
async createTransfer(destination, amount, assetId, txParams = {}) {
|
47707
|
-
|
47708
|
-
const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
|
47709
|
-
return this.populateTransactionPredicateData(request);
|
48056
|
+
async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
48057
|
+
return super.createTransfer(destination, amount, assetId, txParams);
|
47710
48058
|
}
|
47711
48059
|
/**
|
47712
48060
|
* Sends a transaction with the populated predicate data.
|
@@ -47714,9 +48062,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47714
48062
|
* @param transactionRequestLike - The transaction request-like object.
|
47715
48063
|
* @returns A promise that resolves to the transaction response.
|
47716
48064
|
*/
|
47717
|
-
sendTransaction(transactionRequestLike
|
47718
|
-
const transactionRequest =
|
47719
|
-
return super.sendTransaction(transactionRequest,
|
48065
|
+
sendTransaction(transactionRequestLike) {
|
48066
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48067
|
+
return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
|
47720
48068
|
}
|
47721
48069
|
/**
|
47722
48070
|
* Simulates a transaction with the populated predicate data.
|
@@ -47725,8 +48073,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47725
48073
|
* @returns A promise that resolves to the call result.
|
47726
48074
|
*/
|
47727
48075
|
simulateTransaction(transactionRequestLike) {
|
47728
|
-
const transactionRequest =
|
47729
|
-
return super.simulateTransaction(transactionRequest);
|
48076
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48077
|
+
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
47730
48078
|
}
|
47731
48079
|
getPredicateData(policiesLength) {
|
47732
48080
|
if (!this.predicateData.length) {
|
@@ -47772,6 +48120,26 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47772
48120
|
predicateInterface: abiInterface
|
47773
48121
|
};
|
47774
48122
|
}
|
48123
|
+
/**
|
48124
|
+
* Retrieves resources satisfying the spend query for the account.
|
48125
|
+
*
|
48126
|
+
* @param quantities - IDs of coins to exclude.
|
48127
|
+
* @param excludedIds - IDs of resources to be excluded from the query.
|
48128
|
+
* @returns A promise that resolves to an array of Resources.
|
48129
|
+
*/
|
48130
|
+
async getResourcesToSpend(quantities, excludedIds) {
|
48131
|
+
const resources = await this.provider.getResourcesToSpend(
|
48132
|
+
this.address,
|
48133
|
+
quantities,
|
48134
|
+
excludedIds
|
48135
|
+
);
|
48136
|
+
return resources.map((resource) => ({
|
48137
|
+
...resource,
|
48138
|
+
predicate: hexlify(this.bytes),
|
48139
|
+
predicateData: hexlify(this.predicateDataBytes),
|
48140
|
+
paddPredicateData: (policiesLength) => hexlify(this.getPredicateData(policiesLength))
|
48141
|
+
}));
|
48142
|
+
}
|
47775
48143
|
/**
|
47776
48144
|
* Sets the configurable constants for the predicate.
|
47777
48145
|
*
|