@fuel-ts/account 0.0.0-rc-1976-20240404171500 → 0.0.0-rc-1976-20240405090158
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 +38 -212
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +457 -540
- 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 +38 -212
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +424 -501
- 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"}
|
@@ -32045,7 +32045,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32045
32045
|
})(ErrorCode || {});
|
32046
32046
|
var _FuelError = class extends Error {
|
32047
32047
|
VERSIONS = versions;
|
32048
|
-
metadata;
|
32049
32048
|
static parse(e) {
|
32050
32049
|
const error = e;
|
32051
32050
|
if (error.code === void 0) {
|
@@ -32065,15 +32064,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32065
32064
|
return new _FuelError(error.code, error.message);
|
32066
32065
|
}
|
32067
32066
|
code;
|
32068
|
-
constructor(code, message
|
32067
|
+
constructor(code, message) {
|
32069
32068
|
super(message);
|
32070
32069
|
this.code = code;
|
32071
32070
|
this.name = "FuelError";
|
32072
|
-
this.metadata = metadata;
|
32073
32071
|
}
|
32074
32072
|
toObject() {
|
32075
|
-
const { code, name, message,
|
32076
|
-
return { code, name, message,
|
32073
|
+
const { code, name, message, VERSIONS } = this;
|
32074
|
+
return { code, name, message, VERSIONS };
|
32077
32075
|
}
|
32078
32076
|
};
|
32079
32077
|
var FuelError = _FuelError;
|
@@ -35377,6 +35375,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35377
35375
|
__privateAdd2(this, _getPaddedData);
|
35378
35376
|
}
|
35379
35377
|
encode(value) {
|
35378
|
+
if (!Array.isArray(value)) {
|
35379
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
35380
|
+
}
|
35380
35381
|
const parts = [];
|
35381
35382
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
35382
35383
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -35403,7 +35404,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35403
35404
|
};
|
35404
35405
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
35405
35406
|
getPaddedData_fn = function(value) {
|
35406
|
-
const data =
|
35407
|
+
const data = [Uint8Array.from(value)];
|
35407
35408
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
35408
35409
|
if (paddingLength) {
|
35409
35410
|
data.push(new Uint8Array(paddingLength));
|
@@ -35426,7 +35427,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35426
35427
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
35427
35428
|
0
|
35428
35429
|
);
|
35429
|
-
super(
|
35430
|
+
super("enum", `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
35430
35431
|
this.name = name;
|
35431
35432
|
this.coders = coders;
|
35432
35433
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -35496,7 +35497,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35496
35497
|
return { None: [] };
|
35497
35498
|
}
|
35498
35499
|
decode(data, offset) {
|
35499
|
-
if (data.length < this.encodedLength) {
|
35500
|
+
if (data.length < this.encodedLength - 1) {
|
35500
35501
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
35501
35502
|
}
|
35502
35503
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -36079,8 +36080,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36079
36080
|
super("struct", "struct Bytes", WORD_SIZE);
|
36080
36081
|
}
|
36081
36082
|
encode(value) {
|
36082
|
-
|
36083
|
-
|
36083
|
+
if (!Array.isArray(value)) {
|
36084
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
36085
|
+
}
|
36086
|
+
const bytes3 = new Uint8Array(value);
|
36087
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36084
36088
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36085
36089
|
}
|
36086
36090
|
decode(data, offset) {
|
@@ -36113,7 +36117,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36113
36117
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
36114
36118
|
0
|
36115
36119
|
);
|
36116
|
-
super(
|
36120
|
+
super("enum", `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
36117
36121
|
this.name = name;
|
36118
36122
|
this.coders = coders;
|
36119
36123
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -36211,28 +36215,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36211
36215
|
return [toNumber2(bytes3), offset + this.length];
|
36212
36216
|
}
|
36213
36217
|
};
|
36214
|
-
var OptionCoder2 = class extends EnumCoder2 {
|
36215
|
-
encode(value) {
|
36216
|
-
const result = super.encode(this.toSwayOption(value));
|
36217
|
-
return result;
|
36218
|
-
}
|
36219
|
-
toSwayOption(input) {
|
36220
|
-
if (input !== void 0) {
|
36221
|
-
return { Some: input };
|
36222
|
-
}
|
36223
|
-
return { None: [] };
|
36224
|
-
}
|
36225
|
-
decode(data, offset) {
|
36226
|
-
const [decoded, newOffset] = super.decode(data, offset);
|
36227
|
-
return [this.toOption(decoded), newOffset];
|
36228
|
-
}
|
36229
|
-
toOption(output3) {
|
36230
|
-
if (output3 && "Some" in output3) {
|
36231
|
-
return output3.Some;
|
36232
|
-
}
|
36233
|
-
return void 0;
|
36234
|
-
}
|
36235
|
-
};
|
36236
36218
|
var RawSliceCoder2 = class extends Coder {
|
36237
36219
|
constructor() {
|
36238
36220
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -36286,30 +36268,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36286
36268
|
}
|
36287
36269
|
};
|
36288
36270
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
36289
|
-
var StrSliceCoder = class extends Coder {
|
36290
|
-
constructor() {
|
36291
|
-
super("strSlice", "str", WORD_SIZE);
|
36292
|
-
}
|
36293
|
-
encode(value) {
|
36294
|
-
const bytes3 = toUtf8Bytes(value);
|
36295
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36296
|
-
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36297
|
-
}
|
36298
|
-
decode(data, offset) {
|
36299
|
-
if (data.length < this.encodedLength) {
|
36300
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
36301
|
-
}
|
36302
|
-
const offsetAndLength = offset + WORD_SIZE;
|
36303
|
-
const lengthBytes = data.slice(offset, offsetAndLength);
|
36304
|
-
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
36305
|
-
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
36306
|
-
if (bytes3.length !== length) {
|
36307
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
36308
|
-
}
|
36309
|
-
return [toUtf8String(bytes3), offsetAndLength + length];
|
36310
|
-
}
|
36311
|
-
};
|
36312
|
-
__publicField4(StrSliceCoder, "memorySize", 1);
|
36313
36271
|
var StringCoder2 = class extends Coder {
|
36314
36272
|
constructor(length) {
|
36315
36273
|
super("string", `str[${length}]`, length);
|
@@ -36348,7 +36306,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36348
36306
|
Object.keys(this.coders).map((fieldName) => {
|
36349
36307
|
const fieldCoder = this.coders[fieldName];
|
36350
36308
|
const fieldValue = value[fieldName];
|
36351
|
-
if (!(fieldCoder instanceof
|
36309
|
+
if (!(fieldCoder instanceof OptionCoder) && fieldValue == null) {
|
36352
36310
|
throw new FuelError(
|
36353
36311
|
ErrorCode.ENCODE_ERROR,
|
36354
36312
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -36456,8 +36414,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36456
36414
|
return new ByteCoder2();
|
36457
36415
|
case STD_STRING_CODER_TYPE:
|
36458
36416
|
return new StdStringCoder2();
|
36459
|
-
case STR_SLICE_CODER_TYPE:
|
36460
|
-
return new StrSliceCoder();
|
36461
36417
|
default:
|
36462
36418
|
break;
|
36463
36419
|
}
|
@@ -36502,7 +36458,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36502
36458
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
36503
36459
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
36504
36460
|
if (isOptionEnum) {
|
36505
|
-
return new
|
36461
|
+
return new OptionCoder(enumMatch.name, coders);
|
36506
36462
|
}
|
36507
36463
|
return new EnumCoder2(enumMatch.name, coders);
|
36508
36464
|
}
|
@@ -36513,6 +36469,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36513
36469
|
);
|
36514
36470
|
return new TupleCoder2(coders);
|
36515
36471
|
}
|
36472
|
+
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
36473
|
+
throw new FuelError(
|
36474
|
+
ErrorCode.INVALID_DATA,
|
36475
|
+
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
36476
|
+
);
|
36477
|
+
}
|
36516
36478
|
throw new FuelError(
|
36517
36479
|
ErrorCode.CODER_NOT_FOUND,
|
36518
36480
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -36548,8 +36510,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36548
36510
|
var FunctionFragment = class {
|
36549
36511
|
signature;
|
36550
36512
|
selector;
|
36551
|
-
selectorBytes;
|
36552
|
-
encoding;
|
36553
36513
|
name;
|
36554
36514
|
jsonFn;
|
36555
36515
|
attributes;
|
@@ -36562,8 +36522,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36562
36522
|
this.name = name;
|
36563
36523
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
36564
36524
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
36565
|
-
this.selectorBytes = new StdStringCoder2().encode(name);
|
36566
|
-
this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
|
36567
36525
|
this.isInputDataPointer = this.#isInputDataPointer();
|
36568
36526
|
this.outputMetadata = {
|
36569
36527
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -36617,14 +36575,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36617
36575
|
}
|
36618
36576
|
const coders = nonEmptyInputs.map(
|
36619
36577
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
36620
|
-
isRightPadded: nonEmptyInputs.length > 1
|
36621
|
-
encoding: this.encoding
|
36578
|
+
isRightPadded: nonEmptyInputs.length > 1
|
36622
36579
|
})
|
36623
36580
|
);
|
36624
|
-
|
36625
|
-
|
36626
|
-
}
|
36627
|
-
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
36581
|
+
const coder = new TupleCoder(coders);
|
36582
|
+
const results = coder.encode(shallowCopyValues);
|
36628
36583
|
return unpackDynamicData(results, offset, results.byteLength);
|
36629
36584
|
}
|
36630
36585
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
@@ -36671,7 +36626,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36671
36626
|
}
|
36672
36627
|
const result = nonEmptyInputs.reduce(
|
36673
36628
|
(obj, input) => {
|
36674
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input
|
36629
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
36675
36630
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
36676
36631
|
return {
|
36677
36632
|
decoded: [...obj.decoded, decodedValue],
|
@@ -36691,9 +36646,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36691
36646
|
return [void 0, 0];
|
36692
36647
|
}
|
36693
36648
|
const bytes3 = arrayify(data);
|
36694
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
36695
|
-
encoding: this.encoding
|
36696
|
-
});
|
36649
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output);
|
36697
36650
|
return coder.decode(bytes3, 0);
|
36698
36651
|
}
|
36699
36652
|
};
|
@@ -36755,8 +36708,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36755
36708
|
}
|
36756
36709
|
);
|
36757
36710
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
36758
|
-
isRightPadded: true
|
36759
|
-
encoding: this.jsonAbi.encoding
|
36711
|
+
isRightPadded: true
|
36760
36712
|
});
|
36761
36713
|
}
|
36762
36714
|
getTypeById(typeId) {
|
@@ -42461,60 +42413,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42461
42413
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
42462
42414
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
42463
42415
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
42464
|
-
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
42465
42416
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
42466
|
-
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
42467
|
-
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
42468
|
-
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
42469
|
-
var PANIC_REASONS = [
|
42470
|
-
"UnknownPanicReason",
|
42471
|
-
"Revert",
|
42472
|
-
"OutOfGas",
|
42473
|
-
"TransactionValidity",
|
42474
|
-
"MemoryOverflow",
|
42475
|
-
"ArithmeticOverflow",
|
42476
|
-
"ContractNotFound",
|
42477
|
-
"MemoryOwnership",
|
42478
|
-
"NotEnoughBalance",
|
42479
|
-
"ExpectedInternalContext",
|
42480
|
-
"AssetIdNotFound",
|
42481
|
-
"InputNotFound",
|
42482
|
-
"OutputNotFound",
|
42483
|
-
"WitnessNotFound",
|
42484
|
-
"TransactionMaturity",
|
42485
|
-
"InvalidMetadataIdentifier",
|
42486
|
-
"MalformedCallStructure",
|
42487
|
-
"ReservedRegisterNotWritable",
|
42488
|
-
"InvalidFlags",
|
42489
|
-
"InvalidImmediateValue",
|
42490
|
-
"ExpectedCoinInput",
|
42491
|
-
"EcalError",
|
42492
|
-
"MemoryWriteOverlap",
|
42493
|
-
"ContractNotInInputs",
|
42494
|
-
"InternalBalanceOverflow",
|
42495
|
-
"ContractMaxSize",
|
42496
|
-
"ExpectedUnallocatedStack",
|
42497
|
-
"MaxStaticContractsReached",
|
42498
|
-
"TransferAmountCannotBeZero",
|
42499
|
-
"ExpectedOutputVariable",
|
42500
|
-
"ExpectedParentInternalContext",
|
42501
|
-
"PredicateReturnedNonOne",
|
42502
|
-
"ContractIdAlreadyDeployed",
|
42503
|
-
"ContractMismatch",
|
42504
|
-
"MessageDataTooLong",
|
42505
|
-
"ArithmeticError",
|
42506
|
-
"ContractInstructionNotAllowed",
|
42507
|
-
"TransferZeroCoins",
|
42508
|
-
"InvalidInstruction",
|
42509
|
-
"MemoryNotExecutable",
|
42510
|
-
"PolicyIsNotSet",
|
42511
|
-
"PolicyNotFound",
|
42512
|
-
"TooManyReceipts",
|
42513
|
-
"BalanceOverflow",
|
42514
|
-
"InvalidBlockHeight",
|
42515
|
-
"TooManySlots"
|
42516
|
-
];
|
42517
|
-
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
42518
42417
|
|
42519
42418
|
// src/providers/utils/receipts.ts
|
42520
42419
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -42827,74 +42726,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42827
42726
|
});
|
42828
42727
|
}
|
42829
42728
|
|
42830
|
-
// src/providers/utils/extract-tx-error.ts
|
42831
|
-
var assemblePanicError = (status) => {
|
42832
|
-
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
42833
|
-
const reason = status.reason;
|
42834
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
42835
|
-
errorMessage = `${errorMessage}
|
42836
|
-
|
42837
|
-
You can read more about this error at:
|
42838
|
-
|
42839
|
-
${PANIC_DOC_URL}#variant.${status.reason}`;
|
42840
|
-
}
|
42841
|
-
return { errorMessage, reason };
|
42842
|
-
};
|
42843
|
-
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
42844
|
-
var assembleRevertError = (receipts, logs) => {
|
42845
|
-
let errorMessage = "The transaction reverted with an unknown reason.";
|
42846
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42847
|
-
let reason = "";
|
42848
|
-
if (revertReceipt) {
|
42849
|
-
const reasonHex = bn(revertReceipt.val).toHex();
|
42850
|
-
switch (reasonHex) {
|
42851
|
-
case FAILED_REQUIRE_SIGNAL: {
|
42852
|
-
reason = "require";
|
42853
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
42854
|
-
break;
|
42855
|
-
}
|
42856
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
42857
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42858
|
-
reason = "assert_eq";
|
42859
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
42860
|
-
break;
|
42861
|
-
}
|
42862
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
42863
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42864
|
-
reason = "assert_ne";
|
42865
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
42866
|
-
break;
|
42867
|
-
}
|
42868
|
-
case FAILED_ASSERT_SIGNAL:
|
42869
|
-
reason = "assert";
|
42870
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
42871
|
-
break;
|
42872
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
42873
|
-
reason = "MissingOutputChange";
|
42874
|
-
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
42875
|
-
break;
|
42876
|
-
default:
|
42877
|
-
reason = "unknown";
|
42878
|
-
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
42879
|
-
}
|
42880
|
-
}
|
42881
|
-
return { errorMessage, reason };
|
42882
|
-
};
|
42883
|
-
var extractTxError = (params) => {
|
42884
|
-
const { receipts, status, logs } = params;
|
42885
|
-
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
42886
|
-
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42887
|
-
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
42888
|
-
const metadata = {
|
42889
|
-
logs,
|
42890
|
-
receipts,
|
42891
|
-
panic: isPanic,
|
42892
|
-
revert: isRevert,
|
42893
|
-
reason
|
42894
|
-
};
|
42895
|
-
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
42896
|
-
};
|
42897
|
-
|
42898
42729
|
// src/providers/transaction-request/errors.ts
|
42899
42730
|
var NoWitnessAtIndexError = class extends Error {
|
42900
42731
|
constructor(index) {
|
@@ -44654,26 +44485,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44654
44485
|
gqlTransaction: this.gqlTransaction,
|
44655
44486
|
...transactionSummary
|
44656
44487
|
};
|
44657
|
-
let logs = [];
|
44658
44488
|
if (this.abis) {
|
44659
|
-
logs = getDecodedLogs(
|
44489
|
+
const logs = getDecodedLogs(
|
44660
44490
|
transactionSummary.receipts,
|
44661
44491
|
this.abis.main,
|
44662
44492
|
this.abis.otherContractsAbis
|
44663
44493
|
);
|
44664
44494
|
transactionResult.logs = logs;
|
44665
44495
|
}
|
44666
|
-
if (transactionResult.isStatusFailure) {
|
44667
|
-
const {
|
44668
|
-
receipts,
|
44669
|
-
gqlTransaction: { status }
|
44670
|
-
} = transactionResult;
|
44671
|
-
throw extractTxError({
|
44672
|
-
receipts,
|
44673
|
-
status,
|
44674
|
-
logs
|
44675
|
-
});
|
44676
|
-
}
|
44677
44496
|
return transactionResult;
|
44678
44497
|
}
|
44679
44498
|
/**
|
@@ -44682,7 +44501,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44682
44501
|
* @param contractsAbiMap - The contracts ABI map.
|
44683
44502
|
*/
|
44684
44503
|
async wait(contractsAbiMap) {
|
44685
|
-
|
44504
|
+
const result = await this.waitForResult(contractsAbiMap);
|
44505
|
+
if (result.isStatusFailure) {
|
44506
|
+
throw new FuelError(
|
44507
|
+
ErrorCode.TRANSACTION_FAILED,
|
44508
|
+
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
44509
|
+
);
|
44510
|
+
}
|
44511
|
+
return result;
|
44686
44512
|
}
|
44687
44513
|
};
|
44688
44514
|
|