@fuel-ts/account 0.0.0-rc-1895-20240404023124 → 0.0.0-rc-1832-20240404064601
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/dist/index.global.js +84 -177
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +468 -551
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -328
- package/dist/index.mjs.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +0 -1
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils.global.js +84 -177
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +434 -511
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +213 -298
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/providers/utils/extract-tx-error.d.ts +0 -36
- package/dist/providers/utils/extract-tx-error.d.ts.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-response.d.ts","sourceRoot":"","sources":["../../../src/providers/transaction-response/transaction-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"transaction-response.d.ts","sourceRoot":"","sources":["../../../src/providers/transaction-response/transaction-response.ts"],"names":[],"mapp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AgB,GAAG,IAAI,EACjD,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;YAgClC,mBAAmB;IAyBjC;;;;OAIG;IACG,aAAa,CAAC,gBAAgB,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAuB/C;;;;OAIG;IACG,IAAI,CAAC,gBAAgB,GAAG,IAAI,EAChC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAYhD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
@@ -31975,7 +31975,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31975
31975
|
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
|
31976
31976
|
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
|
31977
31977
|
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
|
31978
|
-
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
|
31979
31978
|
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
|
31980
31979
|
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
|
31981
31980
|
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
|
@@ -31990,14 +31989,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31990
31989
|
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
|
31991
31990
|
ErrorCode2["INVALID_EVM_ADDRESS"] = "invalid-evm-address";
|
31992
31991
|
ErrorCode2["INVALID_B256_ADDRESS"] = "invalid-b256-address";
|
31993
|
-
ErrorCode2["INVALID_URL"] = "invalid-url";
|
31994
31992
|
ErrorCode2["CHAIN_INFO_CACHE_EMPTY"] = "chain-info-cache-empty";
|
31995
31993
|
ErrorCode2["NODE_INFO_CACHE_EMPTY"] = "node-info-cache-empty";
|
31996
31994
|
ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
|
31997
31995
|
ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
|
31998
31996
|
ErrorCode2["CONNECTION_REFUSED"] = "connection-refused";
|
31999
31997
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
32000
|
-
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
|
32001
31998
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
32002
31999
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
32003
32000
|
ErrorCode2["MISSING_CONNECTOR"] = "missing-connector";
|
@@ -32014,7 +32011,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32014
32011
|
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
|
32015
32012
|
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
|
32016
32013
|
ErrorCode2["INVALID_REQUEST"] = "invalid-request";
|
32017
|
-
ErrorCode2["UNEXPECTED_HEX_VALUE"] = "unexpected-hex-value";
|
32018
32014
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
32019
32015
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
32020
32016
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
@@ -32038,7 +32034,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32038
32034
|
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
|
32039
32035
|
ErrorCode2["ACCOUNT_REQUIRED"] = "account-required";
|
32040
32036
|
ErrorCode2["UNLOCKED_WALLET_REQUIRED"] = "unlocked-wallet-required";
|
32041
|
-
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
|
32042
32037
|
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
|
32043
32038
|
ErrorCode2["UNSUPPORTED_FUEL_CLIENT_VERSION"] = "unsupported-fuel-client-version";
|
32044
32039
|
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
|
@@ -32050,7 +32045,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32050
32045
|
})(ErrorCode || {});
|
32051
32046
|
var _FuelError = class extends Error {
|
32052
32047
|
VERSIONS = versions;
|
32053
|
-
metadata;
|
32054
32048
|
static parse(e) {
|
32055
32049
|
const error = e;
|
32056
32050
|
if (error.code === void 0) {
|
@@ -32070,15 +32064,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32070
32064
|
return new _FuelError(error.code, error.message);
|
32071
32065
|
}
|
32072
32066
|
code;
|
32073
|
-
constructor(code, message
|
32067
|
+
constructor(code, message) {
|
32074
32068
|
super(message);
|
32075
32069
|
this.code = code;
|
32076
32070
|
this.name = "FuelError";
|
32077
|
-
this.metadata = metadata;
|
32078
32071
|
}
|
32079
32072
|
toObject() {
|
32080
|
-
const { code, name, message,
|
32081
|
-
return { code, name, message,
|
32073
|
+
const { code, name, message, VERSIONS } = this;
|
32074
|
+
return { code, name, message, VERSIONS };
|
32082
32075
|
}
|
32083
32076
|
};
|
32084
32077
|
var FuelError = _FuelError;
|
@@ -35385,9 +35378,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35385
35378
|
__privateAdd2(this, _getPaddedData);
|
35386
35379
|
}
|
35387
35380
|
encode(value) {
|
35388
|
-
if (!Array.isArray(value)) {
|
35389
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
35390
|
-
}
|
35391
35381
|
const parts = [];
|
35392
35382
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
35393
35383
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -35414,7 +35404,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35414
35404
|
};
|
35415
35405
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
35416
35406
|
getPaddedData_fn = function(value) {
|
35417
|
-
const data = [Uint8Array
|
35407
|
+
const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
|
35418
35408
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
35419
35409
|
if (paddingLength) {
|
35420
35410
|
data.push(new Uint8Array(paddingLength));
|
@@ -35437,7 +35427,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35437
35427
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
35438
35428
|
0
|
35439
35429
|
);
|
35440
|
-
super(
|
35430
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
35441
35431
|
this.name = name;
|
35442
35432
|
this.coders = coders;
|
35443
35433
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -35507,7 +35497,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35507
35497
|
return { None: [] };
|
35508
35498
|
}
|
35509
35499
|
decode(data, offset) {
|
35510
|
-
if (data.length < this.encodedLength
|
35500
|
+
if (data.length < this.encodedLength) {
|
35511
35501
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
35512
35502
|
}
|
35513
35503
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -36090,11 +36080,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36090
36080
|
super("struct", "struct Bytes", WORD_SIZE);
|
36091
36081
|
}
|
36092
36082
|
encode(value) {
|
36093
|
-
|
36094
|
-
|
36095
|
-
}
|
36096
|
-
const bytes3 = new Uint8Array(value);
|
36097
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36083
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
36084
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
36098
36085
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36099
36086
|
}
|
36100
36087
|
decode(data, offset) {
|
@@ -36127,7 +36114,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36127
36114
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
36128
36115
|
0
|
36129
36116
|
);
|
36130
|
-
super(
|
36117
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
36131
36118
|
this.name = name;
|
36132
36119
|
this.coders = coders;
|
36133
36120
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -36225,6 +36212,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36225
36212
|
return [toNumber2(bytes3), offset + this.length];
|
36226
36213
|
}
|
36227
36214
|
};
|
36215
|
+
var OptionCoder2 = class extends EnumCoder2 {
|
36216
|
+
encode(value) {
|
36217
|
+
const result = super.encode(this.toSwayOption(value));
|
36218
|
+
return result;
|
36219
|
+
}
|
36220
|
+
toSwayOption(input) {
|
36221
|
+
if (input !== void 0) {
|
36222
|
+
return { Some: input };
|
36223
|
+
}
|
36224
|
+
return { None: [] };
|
36225
|
+
}
|
36226
|
+
decode(data, offset) {
|
36227
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
36228
|
+
return [this.toOption(decoded), newOffset];
|
36229
|
+
}
|
36230
|
+
toOption(output3) {
|
36231
|
+
if (output3 && "Some" in output3) {
|
36232
|
+
return output3.Some;
|
36233
|
+
}
|
36234
|
+
return void 0;
|
36235
|
+
}
|
36236
|
+
};
|
36228
36237
|
var RawSliceCoder2 = class extends Coder {
|
36229
36238
|
constructor() {
|
36230
36239
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -36278,6 +36287,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36278
36287
|
}
|
36279
36288
|
};
|
36280
36289
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
36290
|
+
var StrSliceCoder = class extends Coder {
|
36291
|
+
constructor() {
|
36292
|
+
super("strSlice", "str", WORD_SIZE);
|
36293
|
+
}
|
36294
|
+
encode(value) {
|
36295
|
+
const bytes3 = toUtf8Bytes(value);
|
36296
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36297
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36298
|
+
}
|
36299
|
+
decode(data, offset) {
|
36300
|
+
if (data.length < this.encodedLength) {
|
36301
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
36302
|
+
}
|
36303
|
+
const offsetAndLength = offset + WORD_SIZE;
|
36304
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
36305
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
36306
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
36307
|
+
if (bytes3.length !== length) {
|
36308
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
36309
|
+
}
|
36310
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
36311
|
+
}
|
36312
|
+
};
|
36313
|
+
__publicField4(StrSliceCoder, "memorySize", 1);
|
36281
36314
|
var StringCoder2 = class extends Coder {
|
36282
36315
|
constructor(length) {
|
36283
36316
|
super("string", `str[${length}]`, length);
|
@@ -36316,7 +36349,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36316
36349
|
Object.keys(this.coders).map((fieldName) => {
|
36317
36350
|
const fieldCoder = this.coders[fieldName];
|
36318
36351
|
const fieldValue = value[fieldName];
|
36319
|
-
if (!(fieldCoder instanceof
|
36352
|
+
if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
|
36320
36353
|
throw new FuelError(
|
36321
36354
|
ErrorCode.ENCODE_ERROR,
|
36322
36355
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -36424,6 +36457,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36424
36457
|
return new ByteCoder2();
|
36425
36458
|
case STD_STRING_CODER_TYPE:
|
36426
36459
|
return new StdStringCoder2();
|
36460
|
+
case STR_SLICE_CODER_TYPE:
|
36461
|
+
return new StrSliceCoder();
|
36427
36462
|
default:
|
36428
36463
|
break;
|
36429
36464
|
}
|
@@ -36468,7 +36503,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36468
36503
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
36469
36504
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
36470
36505
|
if (isOptionEnum) {
|
36471
|
-
return new
|
36506
|
+
return new OptionCoder2(enumMatch.name, coders);
|
36472
36507
|
}
|
36473
36508
|
return new EnumCoder2(enumMatch.name, coders);
|
36474
36509
|
}
|
@@ -36479,12 +36514,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36479
36514
|
);
|
36480
36515
|
return new TupleCoder2(coders);
|
36481
36516
|
}
|
36482
|
-
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
36483
|
-
throw new FuelError(
|
36484
|
-
ErrorCode.INVALID_DATA,
|
36485
|
-
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
36486
|
-
);
|
36487
|
-
}
|
36488
36517
|
throw new FuelError(
|
36489
36518
|
ErrorCode.CODER_NOT_FOUND,
|
36490
36519
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -36520,6 +36549,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36520
36549
|
var FunctionFragment = class {
|
36521
36550
|
signature;
|
36522
36551
|
selector;
|
36552
|
+
selectorBytes;
|
36553
|
+
encoding;
|
36523
36554
|
name;
|
36524
36555
|
jsonFn;
|
36525
36556
|
attributes;
|
@@ -36532,6 +36563,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36532
36563
|
this.name = name;
|
36533
36564
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
36534
36565
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
36566
|
+
this.selectorBytes = new StdStringCoder2().encode(name);
|
36567
|
+
this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
|
36535
36568
|
this.isInputDataPointer = this.#isInputDataPointer();
|
36536
36569
|
this.outputMetadata = {
|
36537
36570
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -36585,11 +36618,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36585
36618
|
}
|
36586
36619
|
const coders = nonEmptyInputs.map(
|
36587
36620
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
36588
|
-
isRightPadded: nonEmptyInputs.length > 1
|
36621
|
+
isRightPadded: nonEmptyInputs.length > 1,
|
36622
|
+
encoding: this.encoding
|
36589
36623
|
})
|
36590
36624
|
);
|
36591
|
-
|
36592
|
-
|
36625
|
+
if (this.encoding === ENCODING_V1) {
|
36626
|
+
return new TupleCoder2(coders).encode(shallowCopyValues);
|
36627
|
+
}
|
36628
|
+
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
36593
36629
|
return unpackDynamicData(results, offset, results.byteLength);
|
36594
36630
|
}
|
36595
36631
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
@@ -36636,7 +36672,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36636
36672
|
}
|
36637
36673
|
const result = nonEmptyInputs.reduce(
|
36638
36674
|
(obj, input) => {
|
36639
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
36675
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
36640
36676
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
36641
36677
|
return {
|
36642
36678
|
decoded: [...obj.decoded, decodedValue],
|
@@ -36656,7 +36692,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36656
36692
|
return [void 0, 0];
|
36657
36693
|
}
|
36658
36694
|
const bytes3 = arrayify(data);
|
36659
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
36695
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
36696
|
+
encoding: this.encoding
|
36697
|
+
});
|
36660
36698
|
return coder.decode(bytes3, 0);
|
36661
36699
|
}
|
36662
36700
|
};
|
@@ -36689,16 +36727,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36689
36727
|
}
|
36690
36728
|
decodeFunctionData(functionFragment, data) {
|
36691
36729
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
36692
|
-
if (!fragment) {
|
36693
|
-
throw new FuelError(ErrorCode.FRAGMENT_NOT_FOUND, "Fragment not found.");
|
36694
|
-
}
|
36695
36730
|
return fragment.decodeArguments(data);
|
36696
36731
|
}
|
36697
36732
|
encodeFunctionData(functionFragment, values, offset = 0) {
|
36698
36733
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
36699
|
-
if (!fragment) {
|
36700
|
-
throw new FuelError(ErrorCode.FRAGMENT_NOT_FOUND, "Fragment not found.");
|
36701
|
-
}
|
36702
36734
|
return fragment.encodeArguments(values, offset);
|
36703
36735
|
}
|
36704
36736
|
// Decode the result of a function call
|
@@ -36724,7 +36756,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36724
36756
|
}
|
36725
36757
|
);
|
36726
36758
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
36727
|
-
isRightPadded: true
|
36759
|
+
isRightPadded: true,
|
36760
|
+
encoding: this.jsonAbi.encoding
|
36728
36761
|
});
|
36729
36762
|
}
|
36730
36763
|
getTypeById(typeId) {
|
@@ -42426,60 +42459,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42426
42459
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
42427
42460
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
42428
42461
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
42429
|
-
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
42430
42462
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
42431
|
-
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
42432
|
-
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
42433
|
-
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
42434
|
-
var PANIC_REASONS = [
|
42435
|
-
"UnknownPanicReason",
|
42436
|
-
"Revert",
|
42437
|
-
"OutOfGas",
|
42438
|
-
"TransactionValidity",
|
42439
|
-
"MemoryOverflow",
|
42440
|
-
"ArithmeticOverflow",
|
42441
|
-
"ContractNotFound",
|
42442
|
-
"MemoryOwnership",
|
42443
|
-
"NotEnoughBalance",
|
42444
|
-
"ExpectedInternalContext",
|
42445
|
-
"AssetIdNotFound",
|
42446
|
-
"InputNotFound",
|
42447
|
-
"OutputNotFound",
|
42448
|
-
"WitnessNotFound",
|
42449
|
-
"TransactionMaturity",
|
42450
|
-
"InvalidMetadataIdentifier",
|
42451
|
-
"MalformedCallStructure",
|
42452
|
-
"ReservedRegisterNotWritable",
|
42453
|
-
"InvalidFlags",
|
42454
|
-
"InvalidImmediateValue",
|
42455
|
-
"ExpectedCoinInput",
|
42456
|
-
"EcalError",
|
42457
|
-
"MemoryWriteOverlap",
|
42458
|
-
"ContractNotInInputs",
|
42459
|
-
"InternalBalanceOverflow",
|
42460
|
-
"ContractMaxSize",
|
42461
|
-
"ExpectedUnallocatedStack",
|
42462
|
-
"MaxStaticContractsReached",
|
42463
|
-
"TransferAmountCannotBeZero",
|
42464
|
-
"ExpectedOutputVariable",
|
42465
|
-
"ExpectedParentInternalContext",
|
42466
|
-
"PredicateReturnedNonOne",
|
42467
|
-
"ContractIdAlreadyDeployed",
|
42468
|
-
"ContractMismatch",
|
42469
|
-
"MessageDataTooLong",
|
42470
|
-
"ArithmeticError",
|
42471
|
-
"ContractInstructionNotAllowed",
|
42472
|
-
"TransferZeroCoins",
|
42473
|
-
"InvalidInstruction",
|
42474
|
-
"MemoryNotExecutable",
|
42475
|
-
"PolicyIsNotSet",
|
42476
|
-
"PolicyNotFound",
|
42477
|
-
"TooManyReceipts",
|
42478
|
-
"BalanceOverflow",
|
42479
|
-
"InvalidBlockHeight",
|
42480
|
-
"TooManySlots"
|
42481
|
-
];
|
42482
|
-
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
42483
42463
|
|
42484
42464
|
// src/providers/utils/receipts.ts
|
42485
42465
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -42792,74 +42772,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42792
42772
|
});
|
42793
42773
|
}
|
42794
42774
|
|
42795
|
-
// src/providers/utils/extract-tx-error.ts
|
42796
|
-
var assemblePanicError = (status) => {
|
42797
|
-
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
42798
|
-
const reason = status.reason;
|
42799
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
42800
|
-
errorMessage = `${errorMessage}
|
42801
|
-
|
42802
|
-
You can read more about this error at:
|
42803
|
-
|
42804
|
-
${PANIC_DOC_URL}#variant.${status.reason}`;
|
42805
|
-
}
|
42806
|
-
return { errorMessage, reason };
|
42807
|
-
};
|
42808
|
-
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
42809
|
-
var assembleRevertError = (receipts, logs) => {
|
42810
|
-
let errorMessage = "The transaction reverted with an unknown reason.";
|
42811
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42812
|
-
let reason = "";
|
42813
|
-
if (revertReceipt) {
|
42814
|
-
const reasonHex = bn(revertReceipt.val).toHex();
|
42815
|
-
switch (reasonHex) {
|
42816
|
-
case FAILED_REQUIRE_SIGNAL: {
|
42817
|
-
reason = "require";
|
42818
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
42819
|
-
break;
|
42820
|
-
}
|
42821
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
42822
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42823
|
-
reason = "assert_eq";
|
42824
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
42825
|
-
break;
|
42826
|
-
}
|
42827
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
42828
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42829
|
-
reason = "assert_ne";
|
42830
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
42831
|
-
break;
|
42832
|
-
}
|
42833
|
-
case FAILED_ASSERT_SIGNAL:
|
42834
|
-
reason = "assert";
|
42835
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
42836
|
-
break;
|
42837
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
42838
|
-
reason = "MissingOutputChange";
|
42839
|
-
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
42840
|
-
break;
|
42841
|
-
default:
|
42842
|
-
reason = "unknown";
|
42843
|
-
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
42844
|
-
}
|
42845
|
-
}
|
42846
|
-
return { errorMessage, reason };
|
42847
|
-
};
|
42848
|
-
var extractTxError = (params) => {
|
42849
|
-
const { receipts, status, logs } = params;
|
42850
|
-
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
42851
|
-
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42852
|
-
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
42853
|
-
const metadata = {
|
42854
|
-
logs,
|
42855
|
-
receipts,
|
42856
|
-
panic: isPanic,
|
42857
|
-
revert: isRevert,
|
42858
|
-
reason
|
42859
|
-
};
|
42860
|
-
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
42861
|
-
};
|
42862
|
-
|
42863
42775
|
// src/providers/transaction-request/errors.ts
|
42864
42776
|
var NoWitnessAtIndexError = class extends Error {
|
42865
42777
|
constructor(index) {
|
@@ -44617,26 +44529,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44617
44529
|
gqlTransaction: this.gqlTransaction,
|
44618
44530
|
...transactionSummary
|
44619
44531
|
};
|
44620
|
-
let logs = [];
|
44621
44532
|
if (this.abis) {
|
44622
|
-
logs = getDecodedLogs(
|
44533
|
+
const logs = getDecodedLogs(
|
44623
44534
|
transactionSummary.receipts,
|
44624
44535
|
this.abis.main,
|
44625
44536
|
this.abis.otherContractsAbis
|
44626
44537
|
);
|
44627
44538
|
transactionResult.logs = logs;
|
44628
44539
|
}
|
44629
|
-
if (transactionResult.isStatusFailure) {
|
44630
|
-
const {
|
44631
|
-
receipts,
|
44632
|
-
gqlTransaction: { status }
|
44633
|
-
} = transactionResult;
|
44634
|
-
throw extractTxError({
|
44635
|
-
receipts,
|
44636
|
-
status,
|
44637
|
-
logs
|
44638
|
-
});
|
44639
|
-
}
|
44640
44540
|
return transactionResult;
|
44641
44541
|
}
|
44642
44542
|
/**
|
@@ -44645,7 +44545,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44645
44545
|
* @param contractsAbiMap - The contracts ABI map.
|
44646
44546
|
*/
|
44647
44547
|
async wait(contractsAbiMap) {
|
44648
|
-
|
44548
|
+
const result = await this.waitForResult(contractsAbiMap);
|
44549
|
+
if (result.isStatusFailure) {
|
44550
|
+
throw new FuelError(
|
44551
|
+
ErrorCode.TRANSACTION_FAILED,
|
44552
|
+
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
44553
|
+
);
|
44554
|
+
}
|
44555
|
+
return result;
|
44649
44556
|
}
|
44650
44557
|
};
|
44651
44558
|
|