@fuel-ts/account 0.94.2 → 0.94.4
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.
- package/dist/account.d.ts +1 -1
- package/dist/account.d.ts.map +1 -1
- package/dist/index.global.js +376 -277
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +328 -173
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -173
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +81 -0
- package/dist/providers/__generated__/operations.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 +27 -2
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/blob-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +2 -0
- package/dist/providers/transaction-request/helpers.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 +4 -2
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/providers/utils/handle-gql-error-message.d.ts +6 -0
- package/dist/providers/utils/handle-gql-error-message.d.ts.map +1 -0
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +220 -127
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +283 -140
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +281 -138
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +16 -16
@@ -7610,8 +7610,8 @@
|
|
7610
7610
|
var utils = require_utils();
|
7611
7611
|
var Impl = require_URL_impl();
|
7612
7612
|
var impl = utils.implSymbol;
|
7613
|
-
function
|
7614
|
-
if (!this || this[impl] || !(this instanceof
|
7613
|
+
function URL3(url) {
|
7614
|
+
if (!this || this[impl] || !(this instanceof URL3)) {
|
7615
7615
|
throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
|
7616
7616
|
}
|
7617
7617
|
if (arguments.length < 1) {
|
@@ -7627,7 +7627,7 @@
|
|
7627
7627
|
}
|
7628
7628
|
module.exports.setup(this, args);
|
7629
7629
|
}
|
7630
|
-
|
7630
|
+
URL3.prototype.toJSON = function toJSON() {
|
7631
7631
|
if (!this || !module.exports.is(this)) {
|
7632
7632
|
throw new TypeError("Illegal invocation");
|
7633
7633
|
}
|
@@ -7637,7 +7637,7 @@
|
|
7637
7637
|
}
|
7638
7638
|
return this[impl].toJSON.apply(this[impl], args);
|
7639
7639
|
};
|
7640
|
-
Object.defineProperty(
|
7640
|
+
Object.defineProperty(URL3.prototype, "href", {
|
7641
7641
|
get() {
|
7642
7642
|
return this[impl].href;
|
7643
7643
|
},
|
@@ -7648,20 +7648,20 @@
|
|
7648
7648
|
enumerable: true,
|
7649
7649
|
configurable: true
|
7650
7650
|
});
|
7651
|
-
|
7651
|
+
URL3.prototype.toString = function() {
|
7652
7652
|
if (!this || !module.exports.is(this)) {
|
7653
7653
|
throw new TypeError("Illegal invocation");
|
7654
7654
|
}
|
7655
7655
|
return this.href;
|
7656
7656
|
};
|
7657
|
-
Object.defineProperty(
|
7657
|
+
Object.defineProperty(URL3.prototype, "origin", {
|
7658
7658
|
get() {
|
7659
7659
|
return this[impl].origin;
|
7660
7660
|
},
|
7661
7661
|
enumerable: true,
|
7662
7662
|
configurable: true
|
7663
7663
|
});
|
7664
|
-
Object.defineProperty(
|
7664
|
+
Object.defineProperty(URL3.prototype, "protocol", {
|
7665
7665
|
get() {
|
7666
7666
|
return this[impl].protocol;
|
7667
7667
|
},
|
@@ -7672,7 +7672,7 @@
|
|
7672
7672
|
enumerable: true,
|
7673
7673
|
configurable: true
|
7674
7674
|
});
|
7675
|
-
Object.defineProperty(
|
7675
|
+
Object.defineProperty(URL3.prototype, "username", {
|
7676
7676
|
get() {
|
7677
7677
|
return this[impl].username;
|
7678
7678
|
},
|
@@ -7683,7 +7683,7 @@
|
|
7683
7683
|
enumerable: true,
|
7684
7684
|
configurable: true
|
7685
7685
|
});
|
7686
|
-
Object.defineProperty(
|
7686
|
+
Object.defineProperty(URL3.prototype, "password", {
|
7687
7687
|
get() {
|
7688
7688
|
return this[impl].password;
|
7689
7689
|
},
|
@@ -7694,7 +7694,7 @@
|
|
7694
7694
|
enumerable: true,
|
7695
7695
|
configurable: true
|
7696
7696
|
});
|
7697
|
-
Object.defineProperty(
|
7697
|
+
Object.defineProperty(URL3.prototype, "host", {
|
7698
7698
|
get() {
|
7699
7699
|
return this[impl].host;
|
7700
7700
|
},
|
@@ -7705,7 +7705,7 @@
|
|
7705
7705
|
enumerable: true,
|
7706
7706
|
configurable: true
|
7707
7707
|
});
|
7708
|
-
Object.defineProperty(
|
7708
|
+
Object.defineProperty(URL3.prototype, "hostname", {
|
7709
7709
|
get() {
|
7710
7710
|
return this[impl].hostname;
|
7711
7711
|
},
|
@@ -7716,7 +7716,7 @@
|
|
7716
7716
|
enumerable: true,
|
7717
7717
|
configurable: true
|
7718
7718
|
});
|
7719
|
-
Object.defineProperty(
|
7719
|
+
Object.defineProperty(URL3.prototype, "port", {
|
7720
7720
|
get() {
|
7721
7721
|
return this[impl].port;
|
7722
7722
|
},
|
@@ -7727,7 +7727,7 @@
|
|
7727
7727
|
enumerable: true,
|
7728
7728
|
configurable: true
|
7729
7729
|
});
|
7730
|
-
Object.defineProperty(
|
7730
|
+
Object.defineProperty(URL3.prototype, "pathname", {
|
7731
7731
|
get() {
|
7732
7732
|
return this[impl].pathname;
|
7733
7733
|
},
|
@@ -7738,7 +7738,7 @@
|
|
7738
7738
|
enumerable: true,
|
7739
7739
|
configurable: true
|
7740
7740
|
});
|
7741
|
-
Object.defineProperty(
|
7741
|
+
Object.defineProperty(URL3.prototype, "search", {
|
7742
7742
|
get() {
|
7743
7743
|
return this[impl].search;
|
7744
7744
|
},
|
@@ -7749,7 +7749,7 @@
|
|
7749
7749
|
enumerable: true,
|
7750
7750
|
configurable: true
|
7751
7751
|
});
|
7752
|
-
Object.defineProperty(
|
7752
|
+
Object.defineProperty(URL3.prototype, "hash", {
|
7753
7753
|
get() {
|
7754
7754
|
return this[impl].hash;
|
7755
7755
|
},
|
@@ -7765,7 +7765,7 @@
|
|
7765
7765
|
return !!obj && obj[impl] instanceof Impl.implementation;
|
7766
7766
|
},
|
7767
7767
|
create(constructorArgs, privateData) {
|
7768
|
-
let obj = Object.create(
|
7768
|
+
let obj = Object.create(URL3.prototype);
|
7769
7769
|
this.setup(obj, constructorArgs, privateData);
|
7770
7770
|
return obj;
|
7771
7771
|
},
|
@@ -7776,10 +7776,10 @@
|
|
7776
7776
|
obj[impl] = new Impl.implementation(constructorArgs, privateData);
|
7777
7777
|
obj[impl][utils.wrapperSymbol] = obj;
|
7778
7778
|
},
|
7779
|
-
interface:
|
7779
|
+
interface: URL3,
|
7780
7780
|
expose: {
|
7781
|
-
Window: { URL:
|
7782
|
-
Worker: { URL:
|
7781
|
+
Window: { URL: URL3 },
|
7782
|
+
Worker: { URL: URL3 }
|
7783
7783
|
}
|
7784
7784
|
};
|
7785
7785
|
}
|
@@ -8113,7 +8113,7 @@
|
|
8113
8113
|
}
|
8114
8114
|
function parseURL(urlStr) {
|
8115
8115
|
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
|
8116
|
-
urlStr = new
|
8116
|
+
urlStr = new URL2(urlStr).toString();
|
8117
8117
|
}
|
8118
8118
|
return parse_url(urlStr);
|
8119
8119
|
}
|
@@ -8407,7 +8407,7 @@
|
|
8407
8407
|
stream.end();
|
8408
8408
|
}
|
8409
8409
|
}
|
8410
|
-
var import_stream, import_http, import_url, import_whatwg_url, import_https, import_zlib, Readable, BUFFER, TYPE, Blob2, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers2, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES, Response2, INTERNALS$2,
|
8410
|
+
var import_stream, import_http, import_url, import_whatwg_url, import_https, import_zlib, Readable, BUFFER, TYPE, Blob2, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers2, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES, Response2, INTERNALS$2, URL2, parse_url, format_url, streamDestructionSupported, Request, URL$1, PassThrough$1, isDomainOrSubdomain, isSameProtocol, lib_default;
|
8411
8411
|
var init_lib = __esm({
|
8412
8412
|
"../../node_modules/.pnpm/node-fetch@2.7.0/node_modules/node-fetch/lib/index.mjs"() {
|
8413
8413
|
import_stream = __toESM(__require("stream"), 1);
|
@@ -8930,7 +8930,7 @@
|
|
8930
8930
|
configurable: true
|
8931
8931
|
});
|
8932
8932
|
INTERNALS$2 = Symbol("Request internals");
|
8933
|
-
|
8933
|
+
URL2 = import_url.default.URL || import_whatwg_url.default.URL;
|
8934
8934
|
parse_url = import_url.default.parse;
|
8935
8935
|
format_url = import_url.default.format;
|
8936
8936
|
streamDestructionSupported = "destroy" in import_stream.default.Readable.prototype;
|
@@ -31655,9 +31655,9 @@ spurious results.`);
|
|
31655
31655
|
// ../versions/dist/index.mjs
|
31656
31656
|
function getBuiltinVersions() {
|
31657
31657
|
return {
|
31658
|
-
FORC: "0.63.
|
31659
|
-
FUEL_CORE: "0.
|
31660
|
-
FUELS: "0.94.
|
31658
|
+
FORC: "0.63.3",
|
31659
|
+
FUEL_CORE: "0.35.0",
|
31660
|
+
FUELS: "0.94.4"
|
31661
31661
|
};
|
31662
31662
|
}
|
31663
31663
|
function parseVersion(version) {
|
@@ -31820,7 +31820,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31820
31820
|
return new _FuelError(error.code, error.message);
|
31821
31821
|
}
|
31822
31822
|
code;
|
31823
|
-
constructor(code, message, metadata = {}, rawError =
|
31823
|
+
constructor(code, message, metadata = {}, rawError = null) {
|
31824
31824
|
super(message);
|
31825
31825
|
this.code = code;
|
31826
31826
|
this.name = "FuelError";
|
@@ -34057,44 +34057,16 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34057
34057
|
return derivedKey;
|
34058
34058
|
};
|
34059
34059
|
var keccak256 = (data) => keccak_256(data);
|
34060
|
-
var locked = false;
|
34061
|
-
var helper2 = (data) => ripemd160(data);
|
34062
|
-
var ripemd = helper2;
|
34063
34060
|
function ripemd1602(_data) {
|
34064
34061
|
const data = arrayify(_data, "data");
|
34065
|
-
return
|
34062
|
+
return ripemd160(data);
|
34066
34063
|
}
|
34067
|
-
ripemd1602._ = helper2;
|
34068
|
-
ripemd1602.lock = () => {
|
34069
|
-
locked = true;
|
34070
|
-
};
|
34071
|
-
ripemd1602.register = (func) => {
|
34072
|
-
if (locked) {
|
34073
|
-
throw new FuelError(ErrorCode.HASHER_LOCKED, "ripemd160 is locked");
|
34074
|
-
}
|
34075
|
-
ripemd = func;
|
34076
|
-
};
|
34077
|
-
Object.freeze(ripemd1602);
|
34078
34064
|
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
34079
|
-
var locked2 = false;
|
34080
|
-
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
34081
|
-
var pBkdf2 = PBKDF2;
|
34082
34065
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
34083
34066
|
const password = arrayify(_password, "password");
|
34084
34067
|
const salt = arrayify(_salt, "salt");
|
34085
|
-
return hexlify(
|
34068
|
+
return hexlify((0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo));
|
34086
34069
|
}
|
34087
|
-
pbkdf22._ = PBKDF2;
|
34088
|
-
pbkdf22.lock = () => {
|
34089
|
-
locked2 = true;
|
34090
|
-
};
|
34091
|
-
pbkdf22.register = (func) => {
|
34092
|
-
if (locked2) {
|
34093
|
-
throw new FuelError(ErrorCode.HASHER_LOCKED, "pbkdf2 is locked");
|
34094
|
-
}
|
34095
|
-
pBkdf2 = func;
|
34096
|
-
};
|
34097
|
-
Object.freeze(pbkdf22);
|
34098
34070
|
var randomBytes = (length) => {
|
34099
34071
|
const randomValues = Uint8Array.from(import_crypto3.default.randomBytes(length));
|
34100
34072
|
return randomValues;
|
@@ -34145,25 +34117,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34145
34117
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
34146
34118
|
return new Uint8Array(decrypted);
|
34147
34119
|
}
|
34148
|
-
var locked3 = false;
|
34149
|
-
var COMPUTEHMAC = (algorithm, key, data) => (0, import_crypto5.createHmac)(algorithm, key).update(data).digest();
|
34150
|
-
var computeHMAC = COMPUTEHMAC;
|
34151
34120
|
function computeHmac(algorithm, _key, _data) {
|
34152
34121
|
const key = arrayify(_key, "key");
|
34153
34122
|
const data = arrayify(_data, "data");
|
34154
|
-
return hexlify(
|
34123
|
+
return hexlify((0, import_crypto5.createHmac)(algorithm, key).update(data).digest());
|
34155
34124
|
}
|
34156
|
-
computeHmac._ = COMPUTEHMAC;
|
34157
|
-
computeHmac.lock = () => {
|
34158
|
-
locked3 = true;
|
34159
|
-
};
|
34160
|
-
computeHmac.register = (func) => {
|
34161
|
-
if (locked3) {
|
34162
|
-
throw new FuelError(ErrorCode.HASHER_LOCKED, "computeHmac is locked");
|
34163
|
-
}
|
34164
|
-
computeHMAC = func;
|
34165
|
-
};
|
34166
|
-
Object.freeze(computeHmac);
|
34167
34125
|
var randomUUID = () => (0, import_crypto6.randomUUID)();
|
34168
34126
|
var api = {
|
34169
34127
|
bufferFromString,
|
@@ -37941,20 +37899,14 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37941
37899
|
const rows = text.split("\n");
|
37942
37900
|
const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1);
|
37943
37901
|
const [realIp, realPort] = rowWithUrl.split(" ").at(-1).trim().split(":");
|
37944
|
-
|
37945
|
-
|
37946
|
-
|
37947
|
-
|
37948
|
-
|
37949
|
-
|
37950
|
-
|
37951
|
-
|
37952
|
-
snapshotDir: snapshotDirToUse,
|
37953
|
-
pid: child.pid
|
37954
|
-
})
|
37955
|
-
),
|
37956
|
-
500
|
37957
|
-
);
|
37902
|
+
resolve({
|
37903
|
+
cleanup,
|
37904
|
+
ip: realIp,
|
37905
|
+
port: realPort,
|
37906
|
+
url: `http://${realIp}:${realPort}/v1/graphql`,
|
37907
|
+
snapshotDir: snapshotDirToUse,
|
37908
|
+
pid: child.pid
|
37909
|
+
});
|
37958
37910
|
}
|
37959
37911
|
if (/error/i.test(text)) {
|
37960
37912
|
console.log(text);
|
@@ -43104,6 +43056,14 @@ ${ReceiptFragmentDoc}`;
|
|
43104
43056
|
height
|
43105
43057
|
header {
|
43106
43058
|
time
|
43059
|
+
daHeight
|
43060
|
+
stateTransitionBytecodeVersion
|
43061
|
+
transactionsCount
|
43062
|
+
transactionsRoot
|
43063
|
+
messageOutboxRoot
|
43064
|
+
eventInboxRoot
|
43065
|
+
prevRoot
|
43066
|
+
applicationHash
|
43107
43067
|
}
|
43108
43068
|
transactions {
|
43109
43069
|
id
|
@@ -44070,6 +44030,9 @@ ${MessageFragmentDoc}`;
|
|
44070
44030
|
}
|
44071
44031
|
};
|
44072
44032
|
|
44033
|
+
// src/providers/message.ts
|
44034
|
+
var isMessageCoin = (message) => !("data" in message);
|
44035
|
+
|
44073
44036
|
// src/providers/resource.ts
|
44074
44037
|
var isCoin = (resource) => "id" in resource;
|
44075
44038
|
|
@@ -44498,20 +44461,22 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44498
44461
|
let reason = "";
|
44499
44462
|
if (revertReceipt) {
|
44500
44463
|
const reasonHex = bn(revertReceipt.val).toHex();
|
44464
|
+
const lastLog = logs[logs.length - 1];
|
44465
|
+
const lastButOneLog = logs[logs.length - 2];
|
44501
44466
|
switch (reasonHex) {
|
44502
44467
|
case FAILED_REQUIRE_SIGNAL: {
|
44503
44468
|
reason = "require";
|
44504
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(
|
44469
|
+
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(lastLog) : "an error."}.`;
|
44505
44470
|
break;
|
44506
44471
|
}
|
44507
44472
|
case FAILED_ASSERT_EQ_SIGNAL: {
|
44508
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify(
|
44473
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.` : ".";
|
44509
44474
|
reason = "assert_eq";
|
44510
44475
|
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
44511
44476
|
break;
|
44512
44477
|
}
|
44513
44478
|
case FAILED_ASSERT_NE_SIGNAL: {
|
44514
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify(
|
44479
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.` : ".";
|
44515
44480
|
reason = "assert_ne";
|
44516
44481
|
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
44517
44482
|
break;
|
@@ -44570,7 +44535,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44570
44535
|
// src/providers/transaction-request/helpers.ts
|
44571
44536
|
var isRequestInputCoin = (input) => input.type === InputType.Coin;
|
44572
44537
|
var isRequestInputMessage = (input) => input.type === InputType.Message;
|
44573
|
-
var
|
44538
|
+
var isRequestInputMessageWithoutData = (input) => input.type === InputType.Message && bn(input.data).isZero();
|
44539
|
+
var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
44540
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
|
44574
44541
|
var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
|
44575
44542
|
var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
|
44576
44543
|
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
@@ -44865,7 +44832,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44865
44832
|
* @param message - Message resource.
|
44866
44833
|
*/
|
44867
44834
|
addMessageInput(message) {
|
44868
|
-
const { recipient, sender, amount, predicate, nonce,
|
44835
|
+
const { recipient, sender, amount, predicate, nonce, predicateData } = message;
|
44869
44836
|
let witnessIndex;
|
44870
44837
|
if (message.predicate) {
|
44871
44838
|
witnessIndex = 0;
|
@@ -44880,13 +44847,16 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44880
44847
|
type: InputType.Message,
|
44881
44848
|
sender: sender.toB256(),
|
44882
44849
|
recipient: recipient.toB256(),
|
44850
|
+
data: isMessageCoin(message) ? "0x" : message.data,
|
44883
44851
|
amount,
|
44884
44852
|
witnessIndex,
|
44885
44853
|
predicate,
|
44886
44854
|
predicateData
|
44887
44855
|
};
|
44888
44856
|
this.pushInput(input);
|
44889
|
-
|
44857
|
+
if (isMessageCoin(message)) {
|
44858
|
+
this.addChangeOutput(recipient, message.assetId);
|
44859
|
+
}
|
44890
44860
|
}
|
44891
44861
|
/**
|
44892
44862
|
* Adds a single resource to the transaction by adding a coin/message input and a
|
@@ -45018,6 +44988,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
45018
44988
|
*
|
45019
44989
|
* @param quantities - CoinQuantity Array.
|
45020
44990
|
* @param baseAssetId - The base asset to fund the transaction.
|
44991
|
+
* @deprecated - This method is deprecated and will be removed in future versions.
|
44992
|
+
* Please use `Account.generateFakeResources` along with `this.addResources` instead.
|
45021
44993
|
*/
|
45022
44994
|
fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
|
45023
44995
|
const findAssetInput = (assetId) => this.inputs.find((input) => {
|
@@ -45086,7 +45058,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
45086
45058
|
});
|
45087
45059
|
}
|
45088
45060
|
updatePredicateGasUsed(inputs) {
|
45089
|
-
const inputsToExtractGasUsed = inputs.filter(
|
45061
|
+
const inputsToExtractGasUsed = inputs.filter(isRequestInputCoinOrMessage);
|
45090
45062
|
this.inputs.filter(isRequestInputResource).forEach((i) => {
|
45091
45063
|
const owner = getRequestInputResourceOwner(i);
|
45092
45064
|
const correspondingInput = inputsToExtractGasUsed.find(
|
@@ -45170,10 +45142,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
45170
45142
|
// src/providers/transaction-request/blob-transaction-request.ts
|
45171
45143
|
var BlobTransactionRequest = class extends BaseTransactionRequest {
|
45172
45144
|
static from(obj) {
|
45173
|
-
|
45174
|
-
return obj;
|
45175
|
-
}
|
45176
|
-
return new this(obj);
|
45145
|
+
return new this(clone_default(obj));
|
45177
45146
|
}
|
45178
45147
|
/** Type of the transaction */
|
45179
45148
|
type = TransactionType.Blob;
|
@@ -45256,10 +45225,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
45256
45225
|
// src/providers/transaction-request/create-transaction-request.ts
|
45257
45226
|
var CreateTransactionRequest = class extends BaseTransactionRequest {
|
45258
45227
|
static from(obj) {
|
45259
|
-
|
45260
|
-
return obj;
|
45261
|
-
}
|
45262
|
-
return new this(obj);
|
45228
|
+
return new this(clone_default(obj));
|
45263
45229
|
}
|
45264
45230
|
/** Type of the transaction */
|
45265
45231
|
type = TransactionType.Create;
|
@@ -45369,10 +45335,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
45369
45335
|
// src/providers/transaction-request/script-transaction-request.ts
|
45370
45336
|
var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
45371
45337
|
static from(obj) {
|
45372
|
-
|
45373
|
-
return obj;
|
45374
|
-
}
|
45375
|
-
return new this(obj);
|
45338
|
+
return new this(clone_default(obj));
|
45376
45339
|
}
|
45377
45340
|
/** Type of the transaction */
|
45378
45341
|
type = TransactionType.Script;
|
@@ -46645,6 +46608,21 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
46645
46608
|
};
|
46646
46609
|
}
|
46647
46610
|
|
46611
|
+
// src/providers/utils/handle-gql-error-message.ts
|
46612
|
+
var handleGqlErrorMessage = (errorMessage, rawError) => {
|
46613
|
+
switch (errorMessage) {
|
46614
|
+
case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
|
46615
|
+
throw new FuelError(
|
46616
|
+
ErrorCode.NOT_ENOUGH_FUNDS,
|
46617
|
+
`The account(s) sending the transaction don't have enough funds to cover the transaction.`,
|
46618
|
+
{},
|
46619
|
+
rawError
|
46620
|
+
);
|
46621
|
+
default:
|
46622
|
+
throw new FuelError(ErrorCode.INVALID_REQUEST, errorMessage);
|
46623
|
+
}
|
46624
|
+
};
|
46625
|
+
|
46648
46626
|
// src/providers/provider.ts
|
46649
46627
|
var MAX_RETRIES = 10;
|
46650
46628
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
@@ -46771,6 +46749,17 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
46771
46749
|
return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
|
46772
46750
|
}, retryOptions);
|
46773
46751
|
}
|
46752
|
+
static extractBasicAuth(url) {
|
46753
|
+
const parsedUrl = new URL(url);
|
46754
|
+
const username = parsedUrl.username;
|
46755
|
+
const password = parsedUrl.password;
|
46756
|
+
const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
|
46757
|
+
if (!(username && password)) {
|
46758
|
+
return { url, auth: void 0 };
|
46759
|
+
}
|
46760
|
+
const auth = `Basic ${btoa(`${username}:${password}`)}`;
|
46761
|
+
return { url: urlNoBasicAuth, auth };
|
46762
|
+
}
|
46774
46763
|
/**
|
46775
46764
|
* Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
|
46776
46765
|
*
|
@@ -46780,7 +46769,17 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
46780
46769
|
* @returns A promise that resolves to a Provider instance.
|
46781
46770
|
*/
|
46782
46771
|
static async create(url, options = {}) {
|
46783
|
-
const
|
46772
|
+
const { url: urlToUse, auth } = this.extractBasicAuth(url);
|
46773
|
+
const provider = new _Provider(urlToUse, {
|
46774
|
+
...options,
|
46775
|
+
requestMiddleware: async (request) => {
|
46776
|
+
if (auth) {
|
46777
|
+
request.headers ??= {};
|
46778
|
+
request.headers.Authorization = auth;
|
46779
|
+
}
|
46780
|
+
return options.requestMiddleware?.(request) ?? request;
|
46781
|
+
}
|
46782
|
+
});
|
46784
46783
|
await provider.fetchChainAndNodeInfo();
|
46785
46784
|
return provider;
|
46786
46785
|
}
|
@@ -46886,10 +46885,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46886
46885
|
if ("response" in response) {
|
46887
46886
|
const graphQlResponse = response.response;
|
46888
46887
|
if (Array.isArray(graphQlResponse?.errors)) {
|
46889
|
-
|
46890
|
-
|
46891
|
-
|
46892
|
-
);
|
46888
|
+
for (const error of graphQlResponse.errors) {
|
46889
|
+
handleGqlErrorMessage(error.message, error);
|
46890
|
+
}
|
46893
46891
|
}
|
46894
46892
|
}
|
46895
46893
|
}
|
@@ -46907,7 +46905,26 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46907
46905
|
}
|
46908
46906
|
return gqlClient.request(query, vars);
|
46909
46907
|
};
|
46910
|
-
|
46908
|
+
const customOperations = (requester) => ({
|
46909
|
+
getBlobs(variables) {
|
46910
|
+
const queryParams = variables.blobIds.map((_, i) => `$blobId${i}: BlobId!`).join(", ");
|
46911
|
+
const blobParams = variables.blobIds.map((_, i) => `blob${i}: blob(id: $blobId${i}) { id }`).join("\n");
|
46912
|
+
const updatedVariables = variables.blobIds.reduce(
|
46913
|
+
(acc, blobId, i) => {
|
46914
|
+
acc[`blobId${i}`] = blobId;
|
46915
|
+
return acc;
|
46916
|
+
},
|
46917
|
+
{}
|
46918
|
+
);
|
46919
|
+
const document2 = lib_default2`
|
46920
|
+
query getBlobs(${queryParams}) {
|
46921
|
+
${blobParams}
|
46922
|
+
}
|
46923
|
+
`;
|
46924
|
+
return requester(document2, updatedVariables);
|
46925
|
+
}
|
46926
|
+
});
|
46927
|
+
return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
|
46911
46928
|
}
|
46912
46929
|
/**
|
46913
46930
|
* Returns the version of the connected node.
|
@@ -47004,7 +47021,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47004
47021
|
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
47005
47022
|
* @returns A promise that resolves to the transaction response object.
|
47006
47023
|
*/
|
47007
|
-
// #region Provider-sendTransaction
|
47008
47024
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
47009
47025
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
47010
47026
|
if (estimateTxDependencies) {
|
@@ -47455,6 +47471,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47455
47471
|
}).filter((v) => !!v);
|
47456
47472
|
return coins;
|
47457
47473
|
}
|
47474
|
+
/**
|
47475
|
+
* Returns an array of blobIds that exist on chain, for a given array of blobIds.
|
47476
|
+
*
|
47477
|
+
* @param blobIds - blobIds to check.
|
47478
|
+
* @returns - A promise that resolves to an array of blobIds that exist on chain.
|
47479
|
+
*/
|
47480
|
+
async getBlobs(blobIds) {
|
47481
|
+
const res = await this.operations.getBlobs({ blobIds });
|
47482
|
+
const blobs = [];
|
47483
|
+
Object.keys(res).forEach((key) => {
|
47484
|
+
const val = res[key];
|
47485
|
+
blobs.push(val?.id ?? null);
|
47486
|
+
});
|
47487
|
+
return blobs.filter((v) => v);
|
47488
|
+
}
|
47458
47489
|
/**
|
47459
47490
|
* Returns block matching the given ID or height.
|
47460
47491
|
*
|
@@ -47476,11 +47507,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47476
47507
|
if (!block2) {
|
47477
47508
|
return null;
|
47478
47509
|
}
|
47510
|
+
const { header, height, id, transactions } = block2;
|
47479
47511
|
return {
|
47480
|
-
id
|
47481
|
-
height: bn(
|
47482
|
-
time:
|
47483
|
-
|
47512
|
+
id,
|
47513
|
+
height: bn(height),
|
47514
|
+
time: header.time,
|
47515
|
+
header: {
|
47516
|
+
applicationHash: header.applicationHash,
|
47517
|
+
daHeight: bn(header.daHeight),
|
47518
|
+
eventInboxRoot: header.eventInboxRoot,
|
47519
|
+
messageOutboxRoot: header.messageOutboxRoot,
|
47520
|
+
prevRoot: header.prevRoot,
|
47521
|
+
stateTransitionBytecodeVersion: header.stateTransitionBytecodeVersion,
|
47522
|
+
transactionsCount: header.transactionsCount,
|
47523
|
+
transactionsRoot: header.transactionsRoot
|
47524
|
+
},
|
47525
|
+
transactionIds: transactions.map((tx) => tx.id)
|
47484
47526
|
};
|
47485
47527
|
}
|
47486
47528
|
/**
|
@@ -47502,6 +47544,16 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47502
47544
|
id: block2.id,
|
47503
47545
|
height: bn(block2.height),
|
47504
47546
|
time: block2.header.time,
|
47547
|
+
header: {
|
47548
|
+
applicationHash: block2.header.applicationHash,
|
47549
|
+
daHeight: bn(block2.header.daHeight),
|
47550
|
+
eventInboxRoot: block2.header.eventInboxRoot,
|
47551
|
+
messageOutboxRoot: block2.header.messageOutboxRoot,
|
47552
|
+
prevRoot: block2.header.prevRoot,
|
47553
|
+
stateTransitionBytecodeVersion: block2.header.stateTransitionBytecodeVersion,
|
47554
|
+
transactionsCount: block2.header.transactionsCount,
|
47555
|
+
transactionsRoot: block2.header.transactionsRoot
|
47556
|
+
},
|
47505
47557
|
transactionIds: block2.transactions.map((tx) => tx.id)
|
47506
47558
|
}));
|
47507
47559
|
return { blocks, pageInfo };
|
@@ -47529,6 +47581,16 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47529
47581
|
id: block2.id,
|
47530
47582
|
height: bn(block2.height, 10),
|
47531
47583
|
time: block2.header.time,
|
47584
|
+
header: {
|
47585
|
+
applicationHash: block2.header.applicationHash,
|
47586
|
+
daHeight: bn(block2.header.daHeight),
|
47587
|
+
eventInboxRoot: block2.header.eventInboxRoot,
|
47588
|
+
messageOutboxRoot: block2.header.messageOutboxRoot,
|
47589
|
+
prevRoot: block2.header.prevRoot,
|
47590
|
+
stateTransitionBytecodeVersion: block2.header.stateTransitionBytecodeVersion,
|
47591
|
+
transactionsCount: block2.header.transactionsCount,
|
47592
|
+
transactionsRoot: block2.header.transactionsRoot
|
47593
|
+
},
|
47532
47594
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
47533
47595
|
transactions: block2.transactions.map(
|
47534
47596
|
(tx) => new TransactionCoder().decode(arrayify(tx.rawPayload), 0)?.[0]
|
@@ -47546,10 +47608,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47546
47608
|
if (!transaction) {
|
47547
47609
|
return null;
|
47548
47610
|
}
|
47549
|
-
|
47550
|
-
|
47551
|
-
|
47552
|
-
|
47611
|
+
try {
|
47612
|
+
return new TransactionCoder().decode(
|
47613
|
+
arrayify(transaction.rawPayload),
|
47614
|
+
0
|
47615
|
+
)?.[0];
|
47616
|
+
} catch (error) {
|
47617
|
+
if (error instanceof FuelError && error.code === ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
|
47618
|
+
console.warn("Unsupported transaction type encountered");
|
47619
|
+
return null;
|
47620
|
+
}
|
47621
|
+
throw error;
|
47622
|
+
}
|
47553
47623
|
}
|
47554
47624
|
/**
|
47555
47625
|
* Retrieves transactions based on the provided pagination arguments.
|
@@ -47561,9 +47631,17 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47561
47631
|
transactions: { edges, pageInfo }
|
47562
47632
|
} = await this.operations.getTransactions(paginationArgs);
|
47563
47633
|
const coder = new TransactionCoder();
|
47564
|
-
const transactions = edges.map(
|
47565
|
-
|
47566
|
-
|
47634
|
+
const transactions = edges.map(({ node: { rawPayload } }) => {
|
47635
|
+
try {
|
47636
|
+
return coder.decode(arrayify(rawPayload), 0)[0];
|
47637
|
+
} catch (error) {
|
47638
|
+
if (error instanceof FuelError && error.code === ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
|
47639
|
+
console.warn("Unsupported transaction type encountered");
|
47640
|
+
return null;
|
47641
|
+
}
|
47642
|
+
throw error;
|
47643
|
+
}
|
47644
|
+
}).filter((tx) => tx !== null);
|
47567
47645
|
return { transactions, pageInfo };
|
47568
47646
|
}
|
47569
47647
|
/**
|
@@ -47824,10 +47902,25 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47824
47902
|
* @returns A promise that resolves to the Message object or null.
|
47825
47903
|
*/
|
47826
47904
|
async getMessageByNonce(nonce) {
|
47827
|
-
const { message } = await this.operations.getMessageByNonce({ nonce });
|
47828
|
-
if (!
|
47905
|
+
const { message: rawMessage } = await this.operations.getMessageByNonce({ nonce });
|
47906
|
+
if (!rawMessage) {
|
47829
47907
|
return null;
|
47830
47908
|
}
|
47909
|
+
const message = {
|
47910
|
+
messageId: InputMessageCoder.getMessageId({
|
47911
|
+
sender: rawMessage.sender,
|
47912
|
+
recipient: rawMessage.recipient,
|
47913
|
+
nonce: rawMessage.nonce,
|
47914
|
+
amount: bn(rawMessage.amount),
|
47915
|
+
data: rawMessage.data
|
47916
|
+
}),
|
47917
|
+
sender: Address.fromAddressOrString(rawMessage.sender),
|
47918
|
+
recipient: Address.fromAddressOrString(rawMessage.recipient),
|
47919
|
+
nonce: rawMessage.nonce,
|
47920
|
+
amount: bn(rawMessage.amount),
|
47921
|
+
data: InputMessageCoder.decodeData(rawMessage.data),
|
47922
|
+
daHeight: bn(rawMessage.daHeight)
|
47923
|
+
};
|
47831
47924
|
return message;
|
47832
47925
|
}
|
47833
47926
|
/**
|
@@ -48233,7 +48326,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48233
48326
|
gasPrice
|
48234
48327
|
});
|
48235
48328
|
const totalBaseAssetOnInputs = getAssetAmountInRequestInputs(
|
48236
|
-
request.inputs,
|
48329
|
+
request.inputs.filter(isRequestInputResource),
|
48237
48330
|
baseAssetId,
|
48238
48331
|
baseAssetId
|
48239
48332
|
);
|
@@ -48439,10 +48532,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48439
48532
|
const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
|
48440
48533
|
const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: bn("100000000000000000") }];
|
48441
48534
|
const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
|
48442
|
-
if (
|
48535
|
+
if (input.type === InputType.Coin) {
|
48443
48536
|
return input.assetId === assetId;
|
48444
48537
|
}
|
48445
|
-
if (
|
48538
|
+
if (isRequestInputMessageWithoutData(input)) {
|
48446
48539
|
return baseAssetId === assetId;
|
48447
48540
|
}
|
48448
48541
|
return false;
|