@fuel-ts/account 0.0.0-rc-2143-20240514211533 → 0.0.0-rc-2143-20240515070051
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/account.d.ts.map +1 -1
- package/dist/index.global.js +413 -1147
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +116 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -144
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +0 -1
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +0 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +0 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +0 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-summary/call.d.ts +1 -1
- package/dist/providers/transaction-summary/call.d.ts.map +1 -1
- package/dist/test-utils.global.js +395 -1122
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +110 -132
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +101 -123
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
@@ -34650,9 +34650,9 @@ spurious results.`);
|
|
34650
34650
|
// ../versions/dist/index.mjs
|
34651
34651
|
function getBuiltinVersions() {
|
34652
34652
|
return {
|
34653
|
-
FORC: "0.
|
34653
|
+
FORC: "0.58.0",
|
34654
34654
|
FUEL_CORE: "0.26.0",
|
34655
|
-
FUELS: "0.
|
34655
|
+
FUELS: "0.86.0"
|
34656
34656
|
};
|
34657
34657
|
}
|
34658
34658
|
function parseVersion(version) {
|
@@ -36824,19 +36824,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36824
36824
|
__defNormalProp4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
36825
36825
|
return value;
|
36826
36826
|
};
|
36827
|
-
var __accessCheck2 = (obj, member, msg) => {
|
36828
|
-
if (!member.has(obj))
|
36829
|
-
throw TypeError("Cannot " + msg);
|
36830
|
-
};
|
36831
|
-
var __privateAdd2 = (obj, member, value) => {
|
36832
|
-
if (member.has(obj))
|
36833
|
-
throw TypeError("Cannot add the same private member more than once");
|
36834
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
36835
|
-
};
|
36836
|
-
var __privateMethod2 = (obj, member, method) => {
|
36837
|
-
__accessCheck2(obj, member, "access private method");
|
36838
|
-
return method;
|
36839
|
-
};
|
36840
36827
|
var Coder = class {
|
36841
36828
|
name;
|
36842
36829
|
type;
|
@@ -36868,7 +36855,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36868
36855
|
var enumRegEx = /^enum (?<name>\w+)$/;
|
36869
36856
|
var tupleRegEx = /^\((?<items>.*)\)$/;
|
36870
36857
|
var genericRegEx = /^generic (?<name>\w+)$/;
|
36871
|
-
var ENCODING_V0 = "0";
|
36872
36858
|
var ENCODING_V1 = "1";
|
36873
36859
|
var WORD_SIZE = 8;
|
36874
36860
|
var BYTES_32 = 32;
|
@@ -36879,10 +36865,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36879
36865
|
var TX_LEN = WORD_SIZE * 4;
|
36880
36866
|
var TX_POINTER_LEN = WORD_SIZE * 2;
|
36881
36867
|
var MAX_BYTES = 2 ** 32 - 1;
|
36882
|
-
var calculateVmTxMemory = ({ maxInputs }) => BYTES_32 + // Tx ID
|
36883
|
-
ASSET_ID_LEN + // Base asset ID
|
36884
|
-
// Asset ID/Balance coin input pairs
|
36885
|
-
maxInputs * (ASSET_ID_LEN + WORD_SIZE) + WORD_SIZE;
|
36886
36868
|
var SCRIPT_FIXED_SIZE = WORD_SIZE + // Identifier
|
36887
36869
|
WORD_SIZE + // Gas limit
|
36888
36870
|
WORD_SIZE + // Script size
|
@@ -36913,125 +36895,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36913
36895
|
WORD_SIZE + // Predicate size
|
36914
36896
|
WORD_SIZE + // Predicate data size
|
36915
36897
|
WORD_SIZE;
|
36916
|
-
var encodedLengths = {
|
36917
|
-
u64: WORD_SIZE,
|
36918
|
-
u256: WORD_SIZE * 4
|
36919
|
-
};
|
36920
|
-
var BigNumberCoder = class extends Coder {
|
36921
|
-
constructor(baseType) {
|
36922
|
-
super("bigNumber", baseType, encodedLengths[baseType]);
|
36923
|
-
}
|
36924
|
-
encode(value) {
|
36925
|
-
let bytes2;
|
36926
|
-
try {
|
36927
|
-
bytes2 = toBytes2(value, this.encodedLength);
|
36928
|
-
} catch (error) {
|
36929
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
36930
|
-
}
|
36931
|
-
return bytes2;
|
36932
|
-
}
|
36933
|
-
decode(data, offset) {
|
36934
|
-
if (data.length < this.encodedLength) {
|
36935
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
36936
|
-
}
|
36937
|
-
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
36938
|
-
bytes2 = bytes2.slice(0, this.encodedLength);
|
36939
|
-
if (bytes2.length !== this.encodedLength) {
|
36940
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
36941
|
-
}
|
36942
|
-
return [bn(bytes2), offset + this.encodedLength];
|
36943
|
-
}
|
36944
|
-
};
|
36945
|
-
var VEC_PROPERTY_SPACE = 3;
|
36946
|
-
var BASE_VECTOR_OFFSET = VEC_PROPERTY_SPACE * WORD_SIZE;
|
36947
|
-
var RAW_SLICE_PROPERTY_SPACE = 2;
|
36948
|
-
var BASE_RAW_SLICE_OFFSET = RAW_SLICE_PROPERTY_SPACE * WORD_SIZE;
|
36949
|
-
function concatWithDynamicData(items) {
|
36950
|
-
const topLevelData = {};
|
36951
|
-
let totalIndex = 0;
|
36952
|
-
const objects = items.map((item) => {
|
36953
|
-
const dynamicData = item.dynamicData;
|
36954
|
-
if (dynamicData) {
|
36955
|
-
Object.entries(dynamicData).forEach(([pointerIndex, vData]) => {
|
36956
|
-
topLevelData[parseInt(pointerIndex, 10) + totalIndex] = vData;
|
36957
|
-
});
|
36958
|
-
}
|
36959
|
-
const byteArray = arrayify(item);
|
36960
|
-
totalIndex += byteArray.byteLength / WORD_SIZE;
|
36961
|
-
return byteArray;
|
36962
|
-
});
|
36963
|
-
const length = objects.reduce((accum, item) => accum + item.length, 0);
|
36964
|
-
const result = new Uint8Array(length);
|
36965
|
-
objects.reduce((offset, object) => {
|
36966
|
-
result.set(object, offset);
|
36967
|
-
return offset + object.length;
|
36968
|
-
}, 0);
|
36969
|
-
if (Object.keys(topLevelData).length) {
|
36970
|
-
result.dynamicData = topLevelData;
|
36971
|
-
}
|
36972
|
-
return result;
|
36973
|
-
}
|
36974
|
-
function unpackDynamicData(results, baseOffset, dataOffset) {
|
36975
|
-
if (!results.dynamicData) {
|
36976
|
-
return concat([results]);
|
36977
|
-
}
|
36978
|
-
let cumulativeDynamicByteLength = 0;
|
36979
|
-
let updatedResults = results;
|
36980
|
-
Object.entries(results.dynamicData).forEach(([pointerIndex, vData]) => {
|
36981
|
-
const pointerOffset = parseInt(pointerIndex, 10) * WORD_SIZE;
|
36982
|
-
const adjustedValue = new BigNumberCoder("u64").encode(
|
36983
|
-
dataOffset + baseOffset + cumulativeDynamicByteLength
|
36984
|
-
);
|
36985
|
-
updatedResults.set(adjustedValue, pointerOffset);
|
36986
|
-
const dataToAppend = vData.dynamicData ? (
|
36987
|
-
// unpack child dynamic data
|
36988
|
-
unpackDynamicData(
|
36989
|
-
vData,
|
36990
|
-
baseOffset,
|
36991
|
-
dataOffset + vData.byteLength + cumulativeDynamicByteLength
|
36992
|
-
)
|
36993
|
-
) : vData;
|
36994
|
-
updatedResults = concat([updatedResults, dataToAppend]);
|
36995
|
-
cumulativeDynamicByteLength += dataToAppend.byteLength;
|
36996
|
-
});
|
36997
|
-
return updatedResults;
|
36998
|
-
}
|
36999
|
-
var chunkByLength = (data, length = WORD_SIZE) => {
|
37000
|
-
const chunks = [];
|
37001
|
-
let offset = 0;
|
37002
|
-
let chunk = data.slice(offset, offset + length);
|
37003
|
-
while (chunk.length) {
|
37004
|
-
chunks.push(chunk);
|
37005
|
-
offset += length;
|
37006
|
-
chunk = data.slice(offset, offset + length);
|
37007
|
-
}
|
37008
|
-
return chunks;
|
37009
|
-
};
|
37010
|
-
var isPointerType = (type3) => {
|
37011
|
-
switch (type3) {
|
37012
|
-
case "u8":
|
37013
|
-
case "u16":
|
37014
|
-
case "u32":
|
37015
|
-
case "u64":
|
37016
|
-
case "bool": {
|
37017
|
-
return false;
|
37018
|
-
}
|
37019
|
-
default: {
|
37020
|
-
return true;
|
37021
|
-
}
|
37022
|
-
}
|
37023
|
-
};
|
37024
|
-
var isHeapType = (type3) => type3 === VEC_CODER_TYPE || type3 === BYTES_CODER_TYPE || type3 === STD_STRING_CODER_TYPE;
|
37025
|
-
var isMultipleOfWordSize = (length) => length % WORD_SIZE === 0;
|
37026
|
-
var getWordSizePadding = (length) => WORD_SIZE - length % WORD_SIZE;
|
37027
|
-
var rightPadToWordSize = (encoded) => {
|
37028
|
-
if (isMultipleOfWordSize(encoded.length)) {
|
37029
|
-
return encoded;
|
37030
|
-
}
|
37031
|
-
const padding = new Uint8Array(WORD_SIZE - encoded.length % WORD_SIZE);
|
37032
|
-
return concatBytes2([encoded, padding]);
|
37033
|
-
};
|
37034
|
-
var isUint8Array = (value) => value instanceof Uint8Array;
|
37035
36898
|
var ArrayCoder = class extends Coder {
|
37036
36899
|
coder;
|
37037
36900
|
length;
|
@@ -37047,7 +36910,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37047
36910
|
if (this.length !== value.length) {
|
37048
36911
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Types/values length mismatch.`);
|
37049
36912
|
}
|
37050
|
-
return
|
36913
|
+
return concat(Array.from(value).map((v) => this.coder.encode(v)));
|
37051
36914
|
}
|
37052
36915
|
decode(data, offset) {
|
37053
36916
|
if (data.length < this.encodedLength || data.length > MAX_BYTES) {
|
@@ -37124,16 +36987,42 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37124
36987
|
return [toHex(bytes2, this.encodedLength), offset + this.encodedLength];
|
37125
36988
|
}
|
37126
36989
|
};
|
36990
|
+
var encodedLengths = {
|
36991
|
+
u64: WORD_SIZE,
|
36992
|
+
u256: WORD_SIZE * 4
|
36993
|
+
};
|
36994
|
+
var BigNumberCoder = class extends Coder {
|
36995
|
+
constructor(baseType) {
|
36996
|
+
super("bigNumber", baseType, encodedLengths[baseType]);
|
36997
|
+
}
|
36998
|
+
encode(value) {
|
36999
|
+
let bytes2;
|
37000
|
+
try {
|
37001
|
+
bytes2 = toBytes2(value, this.encodedLength);
|
37002
|
+
} catch (error) {
|
37003
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
37004
|
+
}
|
37005
|
+
return bytes2;
|
37006
|
+
}
|
37007
|
+
decode(data, offset) {
|
37008
|
+
if (data.length < this.encodedLength) {
|
37009
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
37010
|
+
}
|
37011
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
37012
|
+
bytes2 = bytes2.slice(0, this.encodedLength);
|
37013
|
+
if (bytes2.length !== this.encodedLength) {
|
37014
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
37015
|
+
}
|
37016
|
+
return [bn(bytes2), offset + this.encodedLength];
|
37017
|
+
}
|
37018
|
+
};
|
37127
37019
|
var BooleanCoder = class extends Coder {
|
37128
|
-
paddingLength;
|
37129
37020
|
options;
|
37130
37021
|
constructor(options = {
|
37131
|
-
|
37132
|
-
isRightPadded: false
|
37022
|
+
padToWordSize: false
|
37133
37023
|
}) {
|
37134
|
-
const
|
37135
|
-
super("boolean", "boolean",
|
37136
|
-
this.paddingLength = paddingLength;
|
37024
|
+
const encodedLength = options.padToWordSize ? WORD_SIZE : 1;
|
37025
|
+
super("boolean", "boolean", encodedLength);
|
37137
37026
|
this.options = options;
|
37138
37027
|
}
|
37139
37028
|
encode(value) {
|
@@ -37141,73 +37030,45 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37141
37030
|
if (!isTrueBool) {
|
37142
37031
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
|
37143
37032
|
}
|
37144
|
-
|
37145
|
-
if (this.options.isRightPadded) {
|
37146
|
-
return output2.reverse();
|
37147
|
-
}
|
37148
|
-
return output2;
|
37033
|
+
return toBytes2(value ? 1 : 0, this.encodedLength);
|
37149
37034
|
}
|
37150
37035
|
decode(data, offset) {
|
37151
|
-
if (data.length < this.
|
37036
|
+
if (data.length < this.encodedLength) {
|
37152
37037
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
37153
37038
|
}
|
37154
|
-
|
37155
|
-
if (
|
37156
|
-
|
37157
|
-
} else {
|
37158
|
-
bytes2 = data.slice(offset, offset + this.paddingLength);
|
37159
|
-
}
|
37160
|
-
const decodedValue = bn(bytes2);
|
37161
|
-
if (decodedValue.isZero()) {
|
37162
|
-
return [false, offset + this.paddingLength];
|
37039
|
+
const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
|
37040
|
+
if (bytes2.isZero()) {
|
37041
|
+
return [false, offset + this.encodedLength];
|
37163
37042
|
}
|
37164
|
-
if (!
|
37043
|
+
if (!bytes2.eq(bn(1))) {
|
37165
37044
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
37166
37045
|
}
|
37167
|
-
return [true, offset + this.
|
37046
|
+
return [true, offset + this.encodedLength];
|
37168
37047
|
}
|
37169
37048
|
};
|
37170
|
-
var _getPaddedData;
|
37171
|
-
var getPaddedData_fn;
|
37172
37049
|
var ByteCoder = class extends Coder {
|
37173
37050
|
constructor() {
|
37174
|
-
super("struct", "struct Bytes",
|
37175
|
-
__privateAdd2(this, _getPaddedData);
|
37051
|
+
super("struct", "struct Bytes", WORD_SIZE);
|
37176
37052
|
}
|
37177
37053
|
encode(value) {
|
37178
|
-
const
|
37179
|
-
const
|
37180
|
-
|
37181
|
-
pointer.dynamicData = {
|
37182
|
-
0: concatWithDynamicData([data])
|
37183
|
-
};
|
37184
|
-
parts.push(pointer);
|
37185
|
-
parts.push(new BigNumberCoder("u64").encode(data.byteLength));
|
37186
|
-
parts.push(new BigNumberCoder("u64").encode(value.length));
|
37187
|
-
return concatWithDynamicData(parts);
|
37054
|
+
const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
37055
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
37056
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
37188
37057
|
}
|
37189
37058
|
decode(data, offset) {
|
37190
|
-
if (data.length <
|
37059
|
+
if (data.length < WORD_SIZE) {
|
37191
37060
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid byte data size.`);
|
37192
37061
|
}
|
37193
|
-
const
|
37194
|
-
const
|
37195
|
-
const
|
37196
|
-
|
37062
|
+
const offsetAndLength = offset + WORD_SIZE;
|
37063
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
37064
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
37065
|
+
const dataBytes = data.slice(offsetAndLength, offsetAndLength + length);
|
37066
|
+
if (dataBytes.length !== length) {
|
37197
37067
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid bytes byte data size.`);
|
37198
37068
|
}
|
37199
|
-
return [
|
37069
|
+
return [dataBytes, offsetAndLength + length];
|
37200
37070
|
}
|
37201
37071
|
};
|
37202
|
-
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
37203
|
-
getPaddedData_fn = function(value) {
|
37204
|
-
const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
|
37205
|
-
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
37206
|
-
if (paddingLength) {
|
37207
|
-
data.push(new Uint8Array(paddingLength));
|
37208
|
-
}
|
37209
|
-
return concat(data);
|
37210
|
-
};
|
37211
37072
|
__publicField4(ByteCoder, "memorySize", 1);
|
37212
37073
|
var isFullyNativeEnum = (enumCoders) => Object.values(enumCoders).every(
|
37213
37074
|
// @ts-expect-error complicated types
|
@@ -37251,8 +37112,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37251
37112
|
const valueCoder = this.coders[caseKey];
|
37252
37113
|
const caseIndex = Object.keys(this.coders).indexOf(caseKey);
|
37253
37114
|
const encodedValue = valueCoder.encode(value[caseKey]);
|
37254
|
-
|
37255
|
-
return concatWithDynamicData([this.#caseIndexCoder.encode(caseIndex), padding, encodedValue]);
|
37115
|
+
return new Uint8Array([...this.#caseIndexCoder.encode(caseIndex), ...encodedValue]);
|
37256
37116
|
}
|
37257
37117
|
#decodeNativeEnum(caseKey, newOffset) {
|
37258
37118
|
return [caseKey, newOffset];
|
@@ -37261,10 +37121,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37261
37121
|
if (data.length < this.#encodedValueSize) {
|
37262
37122
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
|
37263
37123
|
}
|
37264
|
-
|
37265
|
-
|
37266
|
-
[decoded, newOffset] = new BigNumberCoder("u64").decode(data, newOffset);
|
37267
|
-
const caseIndex = toNumber(decoded);
|
37124
|
+
const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
|
37125
|
+
const caseIndex = toNumber(caseBytes);
|
37268
37126
|
const caseKey = Object.keys(this.coders)[caseIndex];
|
37269
37127
|
if (!caseKey) {
|
37270
37128
|
throw new FuelError(
|
@@ -37273,67 +37131,35 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37273
37131
|
);
|
37274
37132
|
}
|
37275
37133
|
const valueCoder = this.coders[caseKey];
|
37276
|
-
const
|
37277
|
-
newOffset
|
37278
|
-
[decoded, newOffset] = valueCoder.decode(data, newOffset);
|
37134
|
+
const offsetAndCase = offset + WORD_SIZE;
|
37135
|
+
const [decoded, newOffset] = valueCoder.decode(data, offsetAndCase);
|
37279
37136
|
if (isFullyNativeEnum(this.coders)) {
|
37280
37137
|
return this.#decodeNativeEnum(caseKey, newOffset);
|
37281
37138
|
}
|
37282
37139
|
return [{ [caseKey]: decoded }, newOffset];
|
37283
37140
|
}
|
37284
37141
|
};
|
37285
|
-
var
|
37286
|
-
|
37287
|
-
|
37288
|
-
|
37289
|
-
|
37290
|
-
|
37291
|
-
|
37292
|
-
return
|
37293
|
-
|
37294
|
-
|
37295
|
-
}
|
37296
|
-
decode(data, offset) {
|
37297
|
-
if (data.length < this.encodedLength) {
|
37298
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
37299
|
-
}
|
37300
|
-
const [decoded, newOffset] = super.decode(data, offset);
|
37301
|
-
return [this.toOption(decoded), newOffset];
|
37302
|
-
}
|
37303
|
-
toOption(output2) {
|
37304
|
-
if (output2 && "Some" in output2) {
|
37305
|
-
return output2.Some;
|
37306
|
-
}
|
37307
|
-
return void 0;
|
37142
|
+
var getLength = (baseType) => {
|
37143
|
+
switch (baseType) {
|
37144
|
+
case "u8":
|
37145
|
+
return 1;
|
37146
|
+
case "u16":
|
37147
|
+
return 2;
|
37148
|
+
case "u32":
|
37149
|
+
return 4;
|
37150
|
+
default:
|
37151
|
+
throw new FuelError(ErrorCode.TYPE_NOT_SUPPORTED, `Invalid number type: ${baseType}`);
|
37308
37152
|
}
|
37309
37153
|
};
|
37310
37154
|
var NumberCoder = class extends Coder {
|
37311
|
-
// This is to align the bits to the total bytes
|
37312
|
-
// See https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md#unsigned-integers
|
37313
|
-
length;
|
37314
|
-
paddingLength;
|
37315
37155
|
baseType;
|
37316
37156
|
options;
|
37317
37157
|
constructor(baseType, options = {
|
37318
|
-
|
37319
|
-
isRightPadded: false
|
37158
|
+
padToWordSize: false
|
37320
37159
|
}) {
|
37321
|
-
const
|
37322
|
-
super("number", baseType,
|
37160
|
+
const length = options.padToWordSize ? WORD_SIZE : getLength(baseType);
|
37161
|
+
super("number", baseType, length);
|
37323
37162
|
this.baseType = baseType;
|
37324
|
-
switch (baseType) {
|
37325
|
-
case "u8":
|
37326
|
-
this.length = 1;
|
37327
|
-
break;
|
37328
|
-
case "u16":
|
37329
|
-
this.length = 2;
|
37330
|
-
break;
|
37331
|
-
case "u32":
|
37332
|
-
default:
|
37333
|
-
this.length = 4;
|
37334
|
-
break;
|
37335
|
-
}
|
37336
|
-
this.paddingLength = paddingLength;
|
37337
37163
|
this.options = options;
|
37338
37164
|
}
|
37339
37165
|
encode(value) {
|
@@ -37343,755 +37169,74 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37343
37169
|
} catch (error) {
|
37344
37170
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
37345
37171
|
}
|
37346
|
-
if (bytes2.length > this.
|
37172
|
+
if (bytes2.length > this.encodedLength) {
|
37347
37173
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
37348
37174
|
}
|
37349
|
-
|
37350
|
-
if (this.baseType !== "u8") {
|
37351
|
-
return output2;
|
37352
|
-
}
|
37353
|
-
return this.options.isRightPadded ? output2.reverse() : output2;
|
37354
|
-
}
|
37355
|
-
decodeU8(data, offset) {
|
37356
|
-
let bytes2;
|
37357
|
-
if (this.options.isRightPadded) {
|
37358
|
-
bytes2 = data.slice(offset, offset + 1);
|
37359
|
-
} else {
|
37360
|
-
bytes2 = data.slice(offset, offset + this.paddingLength);
|
37361
|
-
bytes2 = bytes2.slice(this.paddingLength - this.length, this.paddingLength);
|
37362
|
-
}
|
37363
|
-
return [toNumber(bytes2), offset + this.paddingLength];
|
37175
|
+
return toBytes2(bytes2, this.encodedLength);
|
37364
37176
|
}
|
37365
37177
|
decode(data, offset) {
|
37366
|
-
if (data.length < this.
|
37178
|
+
if (data.length < this.encodedLength) {
|
37367
37179
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
37368
37180
|
}
|
37369
|
-
|
37370
|
-
|
37371
|
-
}
|
37372
|
-
let bytes2 = data.slice(offset, offset + this.paddingLength);
|
37373
|
-
bytes2 = bytes2.slice(8 - this.length, 8);
|
37374
|
-
if (bytes2.length !== this.paddingLength - (this.paddingLength - this.length)) {
|
37181
|
+
const bytes2 = data.slice(offset, offset + this.encodedLength);
|
37182
|
+
if (bytes2.length !== this.encodedLength) {
|
37375
37183
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
37376
37184
|
}
|
37377
|
-
return [toNumber(bytes2), offset +
|
37185
|
+
return [toNumber(bytes2), offset + this.encodedLength];
|
37378
37186
|
}
|
37379
37187
|
};
|
37380
|
-
var
|
37381
|
-
constructor() {
|
37382
|
-
super("raw untyped slice", "raw untyped slice", BASE_RAW_SLICE_OFFSET);
|
37383
|
-
}
|
37188
|
+
var OptionCoder = class extends EnumCoder {
|
37384
37189
|
encode(value) {
|
37385
|
-
|
37386
|
-
|
37190
|
+
const result = super.encode(this.toSwayOption(value));
|
37191
|
+
return result;
|
37192
|
+
}
|
37193
|
+
toSwayOption(input) {
|
37194
|
+
if (input !== void 0) {
|
37195
|
+
return { Some: input };
|
37387
37196
|
}
|
37388
|
-
|
37389
|
-
const coder = new NumberCoder("u8", { isSmallBytes: true });
|
37390
|
-
const pointer = new BigNumberCoder("u64").encode(
|
37391
|
-
BASE_RAW_SLICE_OFFSET
|
37392
|
-
);
|
37393
|
-
pointer.dynamicData = {
|
37394
|
-
0: concatWithDynamicData(value.map((v) => coder.encode(v)))
|
37395
|
-
};
|
37396
|
-
parts.push(pointer);
|
37397
|
-
parts.push(new BigNumberCoder("u64").encode(value.length));
|
37398
|
-
return concatWithDynamicData(parts);
|
37197
|
+
return { None: [] };
|
37399
37198
|
}
|
37400
37199
|
decode(data, offset) {
|
37401
|
-
const
|
37402
|
-
|
37403
|
-
new NumberCoder("u8", { isSmallBytes: true }),
|
37404
|
-
dataBytes.length
|
37405
|
-
);
|
37406
|
-
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
37407
|
-
return [decodedValue, offset + dataBytes.length];
|
37408
|
-
}
|
37409
|
-
};
|
37410
|
-
var _getPaddedData2;
|
37411
|
-
var getPaddedData_fn2;
|
37412
|
-
var StdStringCoder = class extends Coder {
|
37413
|
-
constructor() {
|
37414
|
-
super("struct", "struct String", 1);
|
37415
|
-
__privateAdd2(this, _getPaddedData2);
|
37416
|
-
}
|
37417
|
-
encode(value) {
|
37418
|
-
const parts = [];
|
37419
|
-
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
37420
|
-
const data = __privateMethod2(this, _getPaddedData2, getPaddedData_fn2).call(this, value);
|
37421
|
-
pointer.dynamicData = {
|
37422
|
-
0: concatWithDynamicData([data])
|
37423
|
-
};
|
37424
|
-
parts.push(pointer);
|
37425
|
-
parts.push(new BigNumberCoder("u64").encode(data.byteLength));
|
37426
|
-
parts.push(new BigNumberCoder("u64").encode(value.length));
|
37427
|
-
return concatWithDynamicData(parts);
|
37200
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
37201
|
+
return [this.toOption(decoded), newOffset];
|
37428
37202
|
}
|
37429
|
-
|
37430
|
-
if (
|
37431
|
-
|
37432
|
-
}
|
37433
|
-
const len = data.slice(16, 24);
|
37434
|
-
const encodedLength = bn(new BigNumberCoder("u64").decode(len, 0)[0]).toNumber();
|
37435
|
-
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
37436
|
-
if (byteData.length !== encodedLength) {
|
37437
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string byte data size.`);
|
37203
|
+
toOption(output2) {
|
37204
|
+
if (output2 && "Some" in output2) {
|
37205
|
+
return output2.Some;
|
37438
37206
|
}
|
37439
|
-
|
37440
|
-
return [value, offset + BASE_VECTOR_OFFSET];
|
37207
|
+
return void 0;
|
37441
37208
|
}
|
37442
37209
|
};
|
37443
|
-
|
37444
|
-
|
37445
|
-
|
37446
|
-
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
37447
|
-
if (paddingLength) {
|
37448
|
-
data.push(new Uint8Array(paddingLength));
|
37449
|
-
}
|
37450
|
-
return concat(data);
|
37451
|
-
};
|
37452
|
-
__publicField4(StdStringCoder, "memorySize", 1);
|
37453
|
-
var StringCoder = class extends Coder {
|
37454
|
-
length;
|
37455
|
-
#paddingLength;
|
37456
|
-
constructor(length) {
|
37457
|
-
let paddingLength = (8 - length) % 8;
|
37458
|
-
paddingLength = paddingLength < 0 ? paddingLength + 8 : paddingLength;
|
37459
|
-
super("string", `str[${length}]`, length + paddingLength);
|
37460
|
-
this.length = length;
|
37461
|
-
this.#paddingLength = paddingLength;
|
37210
|
+
var RawSliceCoder = class extends Coder {
|
37211
|
+
constructor() {
|
37212
|
+
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
37462
37213
|
}
|
37463
37214
|
encode(value) {
|
37464
|
-
if (
|
37465
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `
|
37215
|
+
if (!Array.isArray(value)) {
|
37216
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
37466
37217
|
}
|
37467
|
-
const
|
37468
|
-
const
|
37469
|
-
|
37218
|
+
const internalCoder = new ArrayCoder(new NumberCoder("u8"), value.length);
|
37219
|
+
const bytes2 = internalCoder.encode(value);
|
37220
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
37221
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
37470
37222
|
}
|
37471
37223
|
decode(data, offset) {
|
37472
37224
|
if (data.length < this.encodedLength) {
|
37473
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid
|
37225
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid raw slice data size.`);
|
37474
37226
|
}
|
37475
|
-
const
|
37476
|
-
|
37477
|
-
|
37227
|
+
const offsetAndLength = offset + WORD_SIZE;
|
37228
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
37229
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
37230
|
+
const dataBytes = data.slice(offsetAndLength, offsetAndLength + length);
|
37231
|
+
if (dataBytes.length !== length) {
|
37232
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid raw slice byte data size.`);
|
37478
37233
|
}
|
37479
|
-
const
|
37480
|
-
const
|
37481
|
-
return [
|
37234
|
+
const internalCoder = new ArrayCoder(new NumberCoder("u8"), length);
|
37235
|
+
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
37236
|
+
return [decodedValue, offsetAndLength + length];
|
37482
37237
|
}
|
37483
37238
|
};
|
37484
|
-
var
|
37485
|
-
name;
|
37486
|
-
coders;
|
37487
|
-
constructor(name, coders) {
|
37488
|
-
const encodedLength = Object.values(coders).reduce(
|
37489
|
-
(acc, coder) => acc + coder.encodedLength,
|
37490
|
-
0
|
37491
|
-
);
|
37492
|
-
super("struct", `struct ${name}`, encodedLength);
|
37493
|
-
this.name = name;
|
37494
|
-
this.coders = coders;
|
37495
|
-
}
|
37496
|
-
encode(value) {
|
37497
|
-
const encodedFields = Object.keys(this.coders).map((fieldName) => {
|
37498
|
-
const fieldCoder = this.coders[fieldName];
|
37499
|
-
const fieldValue = value[fieldName];
|
37500
|
-
if (!(fieldCoder instanceof OptionCoder) && fieldValue == null) {
|
37501
|
-
throw new FuelError(
|
37502
|
-
ErrorCode.ENCODE_ERROR,
|
37503
|
-
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
37504
|
-
);
|
37505
|
-
}
|
37506
|
-
const encoded = fieldCoder.encode(fieldValue);
|
37507
|
-
if (!isMultipleOfWordSize(encoded.length)) {
|
37508
|
-
return rightPadToWordSize(encoded);
|
37509
|
-
}
|
37510
|
-
return encoded;
|
37511
|
-
});
|
37512
|
-
return concatWithDynamicData([concatWithDynamicData(encodedFields)]);
|
37513
|
-
}
|
37514
|
-
decode(data, offset) {
|
37515
|
-
if (data.length < this.encodedLength) {
|
37516
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid struct data size.`);
|
37517
|
-
}
|
37518
|
-
let newOffset = offset;
|
37519
|
-
const decodedValue = Object.keys(this.coders).reduce((obj, fieldName) => {
|
37520
|
-
const fieldCoder = this.coders[fieldName];
|
37521
|
-
let decoded;
|
37522
|
-
[decoded, newOffset] = fieldCoder.decode(data, newOffset);
|
37523
|
-
if (!isMultipleOfWordSize(newOffset)) {
|
37524
|
-
newOffset += getWordSizePadding(newOffset);
|
37525
|
-
}
|
37526
|
-
obj[fieldName] = decoded;
|
37527
|
-
return obj;
|
37528
|
-
}, {});
|
37529
|
-
return [decodedValue, newOffset];
|
37530
|
-
}
|
37531
|
-
};
|
37532
|
-
var TupleCoder = class extends Coder {
|
37533
|
-
coders;
|
37534
|
-
constructor(coders) {
|
37535
|
-
const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
|
37536
|
-
super("tuple", `(${coders.map((coder) => coder.type).join(", ")})`, encodedLength);
|
37537
|
-
this.coders = coders;
|
37538
|
-
}
|
37539
|
-
encode(value) {
|
37540
|
-
if (this.coders.length !== value.length) {
|
37541
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Types/values length mismatch.`);
|
37542
|
-
}
|
37543
|
-
return concatWithDynamicData(
|
37544
|
-
this.coders.map((coder, i) => {
|
37545
|
-
const encoded = coder.encode(value[i]);
|
37546
|
-
if (!isMultipleOfWordSize(encoded.length)) {
|
37547
|
-
return rightPadToWordSize(encoded);
|
37548
|
-
}
|
37549
|
-
return encoded;
|
37550
|
-
})
|
37551
|
-
);
|
37552
|
-
}
|
37553
|
-
decode(data, offset) {
|
37554
|
-
if (data.length < this.encodedLength) {
|
37555
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid tuple data size.`);
|
37556
|
-
}
|
37557
|
-
let newOffset = offset;
|
37558
|
-
const decodedValue = this.coders.map((coder) => {
|
37559
|
-
let decoded;
|
37560
|
-
[decoded, newOffset] = coder.decode(data, newOffset);
|
37561
|
-
if (!isMultipleOfWordSize(newOffset)) {
|
37562
|
-
newOffset += getWordSizePadding(newOffset);
|
37563
|
-
}
|
37564
|
-
return decoded;
|
37565
|
-
});
|
37566
|
-
return [decodedValue, newOffset];
|
37567
|
-
}
|
37568
|
-
};
|
37569
|
-
var VecCoder = class extends Coder {
|
37570
|
-
coder;
|
37571
|
-
constructor(coder) {
|
37572
|
-
super("struct", `struct Vec`, coder.encodedLength + BASE_VECTOR_OFFSET);
|
37573
|
-
this.coder = coder;
|
37574
|
-
}
|
37575
|
-
encode(value) {
|
37576
|
-
if (!Array.isArray(value) && !isUint8Array(value)) {
|
37577
|
-
throw new FuelError(
|
37578
|
-
ErrorCode.ENCODE_ERROR,
|
37579
|
-
`Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
|
37580
|
-
);
|
37581
|
-
}
|
37582
|
-
const parts = [];
|
37583
|
-
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
37584
|
-
pointer.dynamicData = {
|
37585
|
-
0: concatWithDynamicData(Array.from(value).map((v) => this.coder.encode(v)))
|
37586
|
-
};
|
37587
|
-
parts.push(pointer);
|
37588
|
-
parts.push(new BigNumberCoder("u64").encode(value.length));
|
37589
|
-
parts.push(new BigNumberCoder("u64").encode(value.length));
|
37590
|
-
return concatWithDynamicData(parts);
|
37591
|
-
}
|
37592
|
-
decode(data, offset) {
|
37593
|
-
if (data.length < BASE_VECTOR_OFFSET || data.length > MAX_BYTES) {
|
37594
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec data size.`);
|
37595
|
-
}
|
37596
|
-
const len = data.slice(16, 24);
|
37597
|
-
const encodedLength = bn(new BigNumberCoder("u64").decode(len, 0)[0]).toNumber();
|
37598
|
-
const vectorRawDataLength = encodedLength * this.coder.encodedLength;
|
37599
|
-
const vectorRawData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + vectorRawDataLength);
|
37600
|
-
if (vectorRawData.length !== vectorRawDataLength) {
|
37601
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec byte data size.`);
|
37602
|
-
}
|
37603
|
-
return [
|
37604
|
-
chunkByLength(vectorRawData, this.coder.encodedLength).map(
|
37605
|
-
(chunk) => this.coder.decode(chunk, 0)[0]
|
37606
|
-
),
|
37607
|
-
offset + BASE_VECTOR_OFFSET
|
37608
|
-
];
|
37609
|
-
}
|
37610
|
-
};
|
37611
|
-
var getEncodingVersion = (encoding) => {
|
37612
|
-
switch (encoding) {
|
37613
|
-
case void 0:
|
37614
|
-
case ENCODING_V0:
|
37615
|
-
return ENCODING_V0;
|
37616
|
-
case ENCODING_V1:
|
37617
|
-
return ENCODING_V1;
|
37618
|
-
default:
|
37619
|
-
throw new FuelError(
|
37620
|
-
ErrorCode.UNSUPPORTED_ENCODING_VERSION,
|
37621
|
-
`Encoding version '${encoding}' is unsupported.`
|
37622
|
-
);
|
37623
|
-
}
|
37624
|
-
};
|
37625
|
-
var findFunctionByName = (abi, name) => {
|
37626
|
-
const fn = abi.functions.find((f2) => f2.name === name);
|
37627
|
-
if (!fn) {
|
37628
|
-
throw new FuelError(
|
37629
|
-
ErrorCode.FUNCTION_NOT_FOUND,
|
37630
|
-
`Function with name '${name}' doesn't exist in the ABI`
|
37631
|
-
);
|
37632
|
-
}
|
37633
|
-
return fn;
|
37634
|
-
};
|
37635
|
-
var findTypeById = (abi, typeId) => {
|
37636
|
-
const type3 = abi.types.find((t) => t.typeId === typeId);
|
37637
|
-
if (!type3) {
|
37638
|
-
throw new FuelError(
|
37639
|
-
ErrorCode.TYPE_NOT_FOUND,
|
37640
|
-
`Type with typeId '${typeId}' doesn't exist in the ABI.`
|
37641
|
-
);
|
37642
|
-
}
|
37643
|
-
return type3;
|
37644
|
-
};
|
37645
|
-
var findNonEmptyInputs = (abi, inputs) => inputs.filter((input) => findTypeById(abi, input.type).type !== "()");
|
37646
|
-
var findVectorBufferArgument = (components) => {
|
37647
|
-
const bufferComponent = components.find((c) => c.name === "buf");
|
37648
|
-
const bufferTypeArgument = bufferComponent?.originalTypeArguments?.[0];
|
37649
|
-
if (!bufferComponent || !bufferTypeArgument) {
|
37650
|
-
throw new FuelError(
|
37651
|
-
ErrorCode.INVALID_COMPONENT,
|
37652
|
-
`The Vec type provided is missing or has a malformed 'buf' component.`
|
37653
|
-
);
|
37654
|
-
}
|
37655
|
-
return bufferTypeArgument;
|
37656
|
-
};
|
37657
|
-
var ResolvedAbiType = class {
|
37658
|
-
abi;
|
37659
|
-
name;
|
37660
|
-
type;
|
37661
|
-
originalTypeArguments;
|
37662
|
-
components;
|
37663
|
-
constructor(abi, argument) {
|
37664
|
-
this.abi = abi;
|
37665
|
-
this.name = argument.name;
|
37666
|
-
const type3 = findTypeById(abi, argument.type);
|
37667
|
-
this.type = type3.type;
|
37668
|
-
this.originalTypeArguments = argument.typeArguments;
|
37669
|
-
this.components = ResolvedAbiType.getResolvedGenericComponents(
|
37670
|
-
abi,
|
37671
|
-
argument,
|
37672
|
-
type3.components,
|
37673
|
-
type3.typeParameters ?? ResolvedAbiType.getImplicitGenericTypeParameters(abi, type3.components)
|
37674
|
-
);
|
37675
|
-
}
|
37676
|
-
static getResolvedGenericComponents(abi, arg, components, typeParameters) {
|
37677
|
-
if (components === null) {
|
37678
|
-
return null;
|
37679
|
-
}
|
37680
|
-
if (typeParameters === null || typeParameters.length === 0) {
|
37681
|
-
return components.map((c) => new ResolvedAbiType(abi, c));
|
37682
|
-
}
|
37683
|
-
const typeParametersAndArgsMap = typeParameters.reduce(
|
37684
|
-
(obj, typeParameter, typeParameterIndex) => {
|
37685
|
-
const o = { ...obj };
|
37686
|
-
o[typeParameter] = structuredClone(
|
37687
|
-
arg.typeArguments?.[typeParameterIndex]
|
37688
|
-
);
|
37689
|
-
return o;
|
37690
|
-
},
|
37691
|
-
{}
|
37692
|
-
);
|
37693
|
-
const resolvedComponents = this.resolveGenericArgTypes(
|
37694
|
-
abi,
|
37695
|
-
components,
|
37696
|
-
typeParametersAndArgsMap
|
37697
|
-
);
|
37698
|
-
return resolvedComponents.map((c) => new ResolvedAbiType(abi, c));
|
37699
|
-
}
|
37700
|
-
static resolveGenericArgTypes(abi, args, typeParametersAndArgsMap) {
|
37701
|
-
return args.map((arg) => {
|
37702
|
-
if (typeParametersAndArgsMap[arg.type] !== void 0) {
|
37703
|
-
return {
|
37704
|
-
...typeParametersAndArgsMap[arg.type],
|
37705
|
-
name: arg.name
|
37706
|
-
};
|
37707
|
-
}
|
37708
|
-
if (arg.typeArguments) {
|
37709
|
-
return {
|
37710
|
-
...structuredClone(arg),
|
37711
|
-
typeArguments: this.resolveGenericArgTypes(
|
37712
|
-
abi,
|
37713
|
-
arg.typeArguments,
|
37714
|
-
typeParametersAndArgsMap
|
37715
|
-
)
|
37716
|
-
};
|
37717
|
-
}
|
37718
|
-
const argType = findTypeById(abi, arg.type);
|
37719
|
-
const implicitTypeParameters = this.getImplicitGenericTypeParameters(abi, argType.components);
|
37720
|
-
if (implicitTypeParameters && implicitTypeParameters.length > 0) {
|
37721
|
-
return {
|
37722
|
-
...structuredClone(arg),
|
37723
|
-
typeArguments: implicitTypeParameters.map((itp) => typeParametersAndArgsMap[itp])
|
37724
|
-
};
|
37725
|
-
}
|
37726
|
-
return arg;
|
37727
|
-
});
|
37728
|
-
}
|
37729
|
-
static getImplicitGenericTypeParameters(abi, args, implicitGenericParametersParam) {
|
37730
|
-
if (!Array.isArray(args)) {
|
37731
|
-
return null;
|
37732
|
-
}
|
37733
|
-
const implicitGenericParameters = implicitGenericParametersParam ?? [];
|
37734
|
-
args.forEach((a) => {
|
37735
|
-
const argType = findTypeById(abi, a.type);
|
37736
|
-
if (genericRegEx.test(argType.type)) {
|
37737
|
-
implicitGenericParameters.push(argType.typeId);
|
37738
|
-
return;
|
37739
|
-
}
|
37740
|
-
if (!Array.isArray(a.typeArguments)) {
|
37741
|
-
return;
|
37742
|
-
}
|
37743
|
-
this.getImplicitGenericTypeParameters(abi, a.typeArguments, implicitGenericParameters);
|
37744
|
-
});
|
37745
|
-
return implicitGenericParameters.length > 0 ? implicitGenericParameters : null;
|
37746
|
-
}
|
37747
|
-
getSignature() {
|
37748
|
-
const prefix = this.getArgSignaturePrefix();
|
37749
|
-
const content = this.getArgSignatureContent();
|
37750
|
-
return `${prefix}${content}`;
|
37751
|
-
}
|
37752
|
-
getArgSignaturePrefix() {
|
37753
|
-
const structMatch = structRegEx.test(this.type);
|
37754
|
-
if (structMatch) {
|
37755
|
-
return "s";
|
37756
|
-
}
|
37757
|
-
const arrayMatch = arrayRegEx.test(this.type);
|
37758
|
-
if (arrayMatch) {
|
37759
|
-
return "a";
|
37760
|
-
}
|
37761
|
-
const enumMatch = enumRegEx.test(this.type);
|
37762
|
-
if (enumMatch) {
|
37763
|
-
return "e";
|
37764
|
-
}
|
37765
|
-
return "";
|
37766
|
-
}
|
37767
|
-
getArgSignatureContent() {
|
37768
|
-
if (this.type === "raw untyped ptr") {
|
37769
|
-
return "rawptr";
|
37770
|
-
}
|
37771
|
-
if (this.type === "raw untyped slice") {
|
37772
|
-
return "rawslice";
|
37773
|
-
}
|
37774
|
-
const strMatch = stringRegEx.exec(this.type)?.groups;
|
37775
|
-
if (strMatch) {
|
37776
|
-
return `str[${strMatch.length}]`;
|
37777
|
-
}
|
37778
|
-
if (this.components === null) {
|
37779
|
-
return this.type;
|
37780
|
-
}
|
37781
|
-
const arrayMatch = arrayRegEx.exec(this.type)?.groups;
|
37782
|
-
if (arrayMatch) {
|
37783
|
-
return `[${this.components[0].getSignature()};${arrayMatch.length}]`;
|
37784
|
-
}
|
37785
|
-
const typeArgumentsSignature = this.originalTypeArguments !== null ? `<${this.originalTypeArguments.map((a) => new ResolvedAbiType(this.abi, a).getSignature()).join(",")}>` : "";
|
37786
|
-
const componentsSignature = `(${this.components.map((c) => c.getSignature()).join(",")})`;
|
37787
|
-
return `${typeArgumentsSignature}${componentsSignature}`;
|
37788
|
-
}
|
37789
|
-
};
|
37790
|
-
function getCoders(components, options) {
|
37791
|
-
const { getCoder: getCoder3 } = options;
|
37792
|
-
return components.reduce((obj, component) => {
|
37793
|
-
const o = obj;
|
37794
|
-
o[component.name] = getCoder3(component, options);
|
37795
|
-
return o;
|
37796
|
-
}, {});
|
37797
|
-
}
|
37798
|
-
var getCoder = (resolvedAbiType, options) => {
|
37799
|
-
switch (resolvedAbiType.type) {
|
37800
|
-
case U8_CODER_TYPE:
|
37801
|
-
case U16_CODER_TYPE:
|
37802
|
-
case U32_CODER_TYPE:
|
37803
|
-
return new NumberCoder(resolvedAbiType.type, options);
|
37804
|
-
case U64_CODER_TYPE:
|
37805
|
-
case RAW_PTR_CODER_TYPE:
|
37806
|
-
return new BigNumberCoder("u64");
|
37807
|
-
case U256_CODER_TYPE:
|
37808
|
-
return new BigNumberCoder("u256");
|
37809
|
-
case RAW_SLICE_CODER_TYPE:
|
37810
|
-
return new RawSliceCoder();
|
37811
|
-
case BOOL_CODER_TYPE:
|
37812
|
-
return new BooleanCoder(options);
|
37813
|
-
case B256_CODER_TYPE:
|
37814
|
-
return new B256Coder();
|
37815
|
-
case B512_CODER_TYPE:
|
37816
|
-
return new B512Coder();
|
37817
|
-
case BYTES_CODER_TYPE:
|
37818
|
-
return new ByteCoder();
|
37819
|
-
case STD_STRING_CODER_TYPE:
|
37820
|
-
return new StdStringCoder();
|
37821
|
-
default:
|
37822
|
-
break;
|
37823
|
-
}
|
37824
|
-
const stringMatch = stringRegEx.exec(resolvedAbiType.type)?.groups;
|
37825
|
-
if (stringMatch) {
|
37826
|
-
const length = parseInt(stringMatch.length, 10);
|
37827
|
-
return new StringCoder(length);
|
37828
|
-
}
|
37829
|
-
const components = resolvedAbiType.components;
|
37830
|
-
const arrayMatch = arrayRegEx.exec(resolvedAbiType.type)?.groups;
|
37831
|
-
if (arrayMatch) {
|
37832
|
-
const length = parseInt(arrayMatch.length, 10);
|
37833
|
-
const arg = components[0];
|
37834
|
-
if (!arg) {
|
37835
|
-
throw new FuelError(
|
37836
|
-
ErrorCode.INVALID_COMPONENT,
|
37837
|
-
`The provided Array type is missing an item of 'component'.`
|
37838
|
-
);
|
37839
|
-
}
|
37840
|
-
const arrayElementCoder = getCoder(arg, { isSmallBytes: true });
|
37841
|
-
return new ArrayCoder(arrayElementCoder, length);
|
37842
|
-
}
|
37843
|
-
if (resolvedAbiType.type === VEC_CODER_TYPE) {
|
37844
|
-
const arg = findVectorBufferArgument(components);
|
37845
|
-
const argType = new ResolvedAbiType(resolvedAbiType.abi, arg);
|
37846
|
-
const itemCoder = getCoder(argType, { isSmallBytes: true, encoding: ENCODING_V0 });
|
37847
|
-
return new VecCoder(itemCoder);
|
37848
|
-
}
|
37849
|
-
const structMatch = structRegEx.exec(resolvedAbiType.type)?.groups;
|
37850
|
-
if (structMatch) {
|
37851
|
-
const coders = getCoders(components, { isRightPadded: true, getCoder });
|
37852
|
-
return new StructCoder(structMatch.name, coders);
|
37853
|
-
}
|
37854
|
-
const enumMatch = enumRegEx.exec(resolvedAbiType.type)?.groups;
|
37855
|
-
if (enumMatch) {
|
37856
|
-
const coders = getCoders(components, { getCoder });
|
37857
|
-
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
37858
|
-
if (isOptionEnum) {
|
37859
|
-
return new OptionCoder(enumMatch.name, coders);
|
37860
|
-
}
|
37861
|
-
return new EnumCoder(enumMatch.name, coders);
|
37862
|
-
}
|
37863
|
-
const tupleMatch = tupleRegEx.exec(resolvedAbiType.type)?.groups;
|
37864
|
-
if (tupleMatch) {
|
37865
|
-
const coders = components.map(
|
37866
|
-
(component) => getCoder(component, { isRightPadded: true, encoding: ENCODING_V0 })
|
37867
|
-
);
|
37868
|
-
return new TupleCoder(coders);
|
37869
|
-
}
|
37870
|
-
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
37871
|
-
throw new FuelError(
|
37872
|
-
ErrorCode.INVALID_DATA,
|
37873
|
-
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
37874
|
-
);
|
37875
|
-
}
|
37876
|
-
throw new FuelError(
|
37877
|
-
ErrorCode.CODER_NOT_FOUND,
|
37878
|
-
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
37879
|
-
);
|
37880
|
-
};
|
37881
|
-
var BooleanCoder2 = class extends Coder {
|
37882
|
-
constructor() {
|
37883
|
-
super("boolean", "boolean", 1);
|
37884
|
-
}
|
37885
|
-
encode(value) {
|
37886
|
-
const isTrueBool = value === true || value === false;
|
37887
|
-
if (!isTrueBool) {
|
37888
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
|
37889
|
-
}
|
37890
|
-
return toBytes2(value ? 1 : 0, this.encodedLength);
|
37891
|
-
}
|
37892
|
-
decode(data, offset) {
|
37893
|
-
if (data.length < this.encodedLength) {
|
37894
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
37895
|
-
}
|
37896
|
-
const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
|
37897
|
-
if (bytes2.isZero()) {
|
37898
|
-
return [false, offset + this.encodedLength];
|
37899
|
-
}
|
37900
|
-
if (!bytes2.eq(bn(1))) {
|
37901
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
37902
|
-
}
|
37903
|
-
return [true, offset + this.encodedLength];
|
37904
|
-
}
|
37905
|
-
};
|
37906
|
-
var ByteCoder2 = class extends Coder {
|
37907
|
-
constructor() {
|
37908
|
-
super("struct", "struct Bytes", WORD_SIZE);
|
37909
|
-
}
|
37910
|
-
encode(value) {
|
37911
|
-
const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
37912
|
-
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
37913
|
-
return new Uint8Array([...lengthBytes, ...bytes2]);
|
37914
|
-
}
|
37915
|
-
decode(data, offset) {
|
37916
|
-
if (data.length < WORD_SIZE) {
|
37917
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid byte data size.`);
|
37918
|
-
}
|
37919
|
-
const offsetAndLength = offset + WORD_SIZE;
|
37920
|
-
const lengthBytes = data.slice(offset, offsetAndLength);
|
37921
|
-
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
37922
|
-
const dataBytes = data.slice(offsetAndLength, offsetAndLength + length);
|
37923
|
-
if (dataBytes.length !== length) {
|
37924
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid bytes byte data size.`);
|
37925
|
-
}
|
37926
|
-
return [dataBytes, offsetAndLength + length];
|
37927
|
-
}
|
37928
|
-
};
|
37929
|
-
__publicField4(ByteCoder2, "memorySize", 1);
|
37930
|
-
var isFullyNativeEnum2 = (enumCoders) => Object.values(enumCoders).every(
|
37931
|
-
// @ts-expect-error complicated types
|
37932
|
-
({ type: type3, coders }) => type3 === "()" && JSON.stringify(coders) === JSON.stringify([])
|
37933
|
-
);
|
37934
|
-
var EnumCoder2 = class extends Coder {
|
37935
|
-
name;
|
37936
|
-
coders;
|
37937
|
-
#caseIndexCoder;
|
37938
|
-
#encodedValueSize;
|
37939
|
-
constructor(name, coders) {
|
37940
|
-
const caseIndexCoder = new BigNumberCoder("u64");
|
37941
|
-
const encodedValueSize = Object.values(coders).reduce(
|
37942
|
-
(max, coder) => Math.max(max, coder.encodedLength),
|
37943
|
-
0
|
37944
|
-
);
|
37945
|
-
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
37946
|
-
this.name = name;
|
37947
|
-
this.coders = coders;
|
37948
|
-
this.#caseIndexCoder = caseIndexCoder;
|
37949
|
-
this.#encodedValueSize = encodedValueSize;
|
37950
|
-
}
|
37951
|
-
#encodeNativeEnum(value) {
|
37952
|
-
const valueCoder = this.coders[value];
|
37953
|
-
const encodedValue = valueCoder.encode([]);
|
37954
|
-
const caseIndex = Object.keys(this.coders).indexOf(value);
|
37955
|
-
const padding = new Uint8Array(this.#encodedValueSize - valueCoder.encodedLength);
|
37956
|
-
return concat([this.#caseIndexCoder.encode(caseIndex), padding, encodedValue]);
|
37957
|
-
}
|
37958
|
-
encode(value) {
|
37959
|
-
if (typeof value === "string" && this.coders[value]) {
|
37960
|
-
return this.#encodeNativeEnum(value);
|
37961
|
-
}
|
37962
|
-
const [caseKey, ...empty] = Object.keys(value);
|
37963
|
-
if (!caseKey) {
|
37964
|
-
throw new FuelError(ErrorCode.INVALID_DECODE_VALUE, "A field for the case must be provided.");
|
37965
|
-
}
|
37966
|
-
if (empty.length !== 0) {
|
37967
|
-
throw new FuelError(ErrorCode.INVALID_DECODE_VALUE, "Only one field must be provided.");
|
37968
|
-
}
|
37969
|
-
const valueCoder = this.coders[caseKey];
|
37970
|
-
const caseIndex = Object.keys(this.coders).indexOf(caseKey);
|
37971
|
-
const encodedValue = valueCoder.encode(value[caseKey]);
|
37972
|
-
return new Uint8Array([...this.#caseIndexCoder.encode(caseIndex), ...encodedValue]);
|
37973
|
-
}
|
37974
|
-
#decodeNativeEnum(caseKey, newOffset) {
|
37975
|
-
return [caseKey, newOffset];
|
37976
|
-
}
|
37977
|
-
decode(data, offset) {
|
37978
|
-
if (data.length < this.#encodedValueSize) {
|
37979
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
|
37980
|
-
}
|
37981
|
-
const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
|
37982
|
-
const caseIndex = toNumber(caseBytes);
|
37983
|
-
const caseKey = Object.keys(this.coders)[caseIndex];
|
37984
|
-
if (!caseKey) {
|
37985
|
-
throw new FuelError(
|
37986
|
-
ErrorCode.INVALID_DECODE_VALUE,
|
37987
|
-
`Invalid caseIndex "${caseIndex}". Valid cases: ${Object.keys(this.coders)}.`
|
37988
|
-
);
|
37989
|
-
}
|
37990
|
-
const valueCoder = this.coders[caseKey];
|
37991
|
-
const offsetAndCase = offset + WORD_SIZE;
|
37992
|
-
const [decoded, newOffset] = valueCoder.decode(data, offsetAndCase);
|
37993
|
-
if (isFullyNativeEnum2(this.coders)) {
|
37994
|
-
return this.#decodeNativeEnum(caseKey, newOffset);
|
37995
|
-
}
|
37996
|
-
return [{ [caseKey]: decoded }, newOffset];
|
37997
|
-
}
|
37998
|
-
};
|
37999
|
-
var getLength = (baseType) => {
|
38000
|
-
switch (baseType) {
|
38001
|
-
case "u8":
|
38002
|
-
return 1;
|
38003
|
-
case "u16":
|
38004
|
-
return 2;
|
38005
|
-
case "u32":
|
38006
|
-
return 4;
|
38007
|
-
default:
|
38008
|
-
throw new FuelError(ErrorCode.TYPE_NOT_SUPPORTED, `Invalid number type: ${baseType}`);
|
38009
|
-
}
|
38010
|
-
};
|
38011
|
-
var NumberCoder2 = class extends Coder {
|
38012
|
-
length;
|
38013
|
-
baseType;
|
38014
|
-
constructor(baseType) {
|
38015
|
-
const length = getLength(baseType);
|
38016
|
-
super("number", baseType, length);
|
38017
|
-
this.baseType = baseType;
|
38018
|
-
this.length = length;
|
38019
|
-
}
|
38020
|
-
encode(value) {
|
38021
|
-
let bytes2;
|
38022
|
-
try {
|
38023
|
-
bytes2 = toBytes2(value);
|
38024
|
-
} catch (error) {
|
38025
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
38026
|
-
}
|
38027
|
-
if (bytes2.length > this.length) {
|
38028
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
38029
|
-
}
|
38030
|
-
return toBytes2(bytes2, this.length);
|
38031
|
-
}
|
38032
|
-
decode(data, offset) {
|
38033
|
-
if (data.length < this.encodedLength) {
|
38034
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
38035
|
-
}
|
38036
|
-
const bytes2 = data.slice(offset, offset + this.length);
|
38037
|
-
if (bytes2.length !== this.encodedLength) {
|
38038
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
38039
|
-
}
|
38040
|
-
return [toNumber(bytes2), offset + this.length];
|
38041
|
-
}
|
38042
|
-
};
|
38043
|
-
var OptionCoder2 = class extends EnumCoder2 {
|
38044
|
-
encode(value) {
|
38045
|
-
const result = super.encode(this.toSwayOption(value));
|
38046
|
-
return result;
|
38047
|
-
}
|
38048
|
-
toSwayOption(input) {
|
38049
|
-
if (input !== void 0) {
|
38050
|
-
return { Some: input };
|
38051
|
-
}
|
38052
|
-
return { None: [] };
|
38053
|
-
}
|
38054
|
-
decode(data, offset) {
|
38055
|
-
const [decoded, newOffset] = super.decode(data, offset);
|
38056
|
-
return [this.toOption(decoded), newOffset];
|
38057
|
-
}
|
38058
|
-
toOption(output2) {
|
38059
|
-
if (output2 && "Some" in output2) {
|
38060
|
-
return output2.Some;
|
38061
|
-
}
|
38062
|
-
return void 0;
|
38063
|
-
}
|
38064
|
-
};
|
38065
|
-
var RawSliceCoder2 = class extends Coder {
|
38066
|
-
constructor() {
|
38067
|
-
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
38068
|
-
}
|
38069
|
-
encode(value) {
|
38070
|
-
if (!Array.isArray(value)) {
|
38071
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
38072
|
-
}
|
38073
|
-
const internalCoder = new ArrayCoder(new NumberCoder2("u8"), value.length);
|
38074
|
-
const bytes2 = internalCoder.encode(value);
|
38075
|
-
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
38076
|
-
return new Uint8Array([...lengthBytes, ...bytes2]);
|
38077
|
-
}
|
38078
|
-
decode(data, offset) {
|
38079
|
-
if (data.length < this.encodedLength) {
|
38080
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid raw slice data size.`);
|
38081
|
-
}
|
38082
|
-
const offsetAndLength = offset + WORD_SIZE;
|
38083
|
-
const lengthBytes = data.slice(offset, offsetAndLength);
|
38084
|
-
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
38085
|
-
const dataBytes = data.slice(offsetAndLength, offsetAndLength + length);
|
38086
|
-
if (dataBytes.length !== length) {
|
38087
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid raw slice byte data size.`);
|
38088
|
-
}
|
38089
|
-
const internalCoder = new ArrayCoder(new NumberCoder2("u8"), length);
|
38090
|
-
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
38091
|
-
return [decodedValue, offsetAndLength + length];
|
38092
|
-
}
|
38093
|
-
};
|
38094
|
-
var StdStringCoder2 = class extends Coder {
|
37239
|
+
var StdStringCoder = class extends Coder {
|
38095
37240
|
constructor() {
|
38096
37241
|
super("struct", "struct String", WORD_SIZE);
|
38097
37242
|
}
|
@@ -38114,7 +37259,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38114
37259
|
return [toUtf8String(dataBytes), offsetAndLength + length];
|
38115
37260
|
}
|
38116
37261
|
};
|
38117
|
-
__publicField4(
|
37262
|
+
__publicField4(StdStringCoder, "memorySize", 1);
|
38118
37263
|
var StrSliceCoder = class extends Coder {
|
38119
37264
|
constructor() {
|
38120
37265
|
super("strSlice", "str", WORD_SIZE);
|
@@ -38139,7 +37284,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38139
37284
|
}
|
38140
37285
|
};
|
38141
37286
|
__publicField4(StrSliceCoder, "memorySize", 1);
|
38142
|
-
var
|
37287
|
+
var StringCoder = class extends Coder {
|
38143
37288
|
constructor(length) {
|
38144
37289
|
super("string", `str[${length}]`, length);
|
38145
37290
|
}
|
@@ -38160,7 +37305,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38160
37305
|
return [toUtf8String(bytes2), offset + this.encodedLength];
|
38161
37306
|
}
|
38162
37307
|
};
|
38163
|
-
var
|
37308
|
+
var StructCoder = class extends Coder {
|
38164
37309
|
name;
|
38165
37310
|
coders;
|
38166
37311
|
constructor(name, coders) {
|
@@ -38177,7 +37322,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38177
37322
|
Object.keys(this.coders).map((fieldName) => {
|
38178
37323
|
const fieldCoder = this.coders[fieldName];
|
38179
37324
|
const fieldValue = value[fieldName];
|
38180
|
-
if (!(fieldCoder instanceof
|
37325
|
+
if (!(fieldCoder instanceof OptionCoder) && fieldValue == null) {
|
38181
37326
|
throw new FuelError(
|
38182
37327
|
ErrorCode.ENCODE_ERROR,
|
38183
37328
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -38202,7 +37347,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38202
37347
|
return [decodedValue, newOffset];
|
38203
37348
|
}
|
38204
37349
|
};
|
38205
|
-
var
|
37350
|
+
var TupleCoder = class extends Coder {
|
38206
37351
|
coders;
|
38207
37352
|
constructor(coders) {
|
38208
37353
|
const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
|
@@ -38228,13 +37373,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38228
37373
|
return [decodedValue, newOffset];
|
38229
37374
|
}
|
38230
37375
|
};
|
38231
|
-
var
|
37376
|
+
var isUint8Array = (value) => value instanceof Uint8Array;
|
37377
|
+
var VecCoder = class extends Coder {
|
38232
37378
|
coder;
|
38233
37379
|
#isOptionVec;
|
38234
37380
|
constructor(coder) {
|
38235
37381
|
super("struct", `struct Vec`, coder.encodedLength + WORD_SIZE);
|
38236
37382
|
this.coder = coder;
|
38237
|
-
this.#isOptionVec = this.coder instanceof
|
37383
|
+
this.#isOptionVec = this.coder instanceof OptionCoder;
|
38238
37384
|
}
|
38239
37385
|
encode(value) {
|
38240
37386
|
if (!Array.isArray(value) && !isUint8Array(value)) {
|
@@ -38273,29 +37419,214 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38273
37419
|
return [chunks, newOffset];
|
38274
37420
|
}
|
38275
37421
|
};
|
38276
|
-
var
|
37422
|
+
var getEncodingVersion = (encoding) => {
|
37423
|
+
switch (encoding) {
|
37424
|
+
case void 0:
|
37425
|
+
case ENCODING_V1:
|
37426
|
+
return ENCODING_V1;
|
37427
|
+
default:
|
37428
|
+
throw new FuelError(
|
37429
|
+
ErrorCode.UNSUPPORTED_ENCODING_VERSION,
|
37430
|
+
`Encoding version '${encoding}' is unsupported.`
|
37431
|
+
);
|
37432
|
+
}
|
37433
|
+
};
|
37434
|
+
var findFunctionByName = (abi, name) => {
|
37435
|
+
const fn = abi.functions.find((f2) => f2.name === name);
|
37436
|
+
if (!fn) {
|
37437
|
+
throw new FuelError(
|
37438
|
+
ErrorCode.FUNCTION_NOT_FOUND,
|
37439
|
+
`Function with name '${name}' doesn't exist in the ABI`
|
37440
|
+
);
|
37441
|
+
}
|
37442
|
+
return fn;
|
37443
|
+
};
|
37444
|
+
var findTypeById = (abi, typeId) => {
|
37445
|
+
const type3 = abi.types.find((t) => t.typeId === typeId);
|
37446
|
+
if (!type3) {
|
37447
|
+
throw new FuelError(
|
37448
|
+
ErrorCode.TYPE_NOT_FOUND,
|
37449
|
+
`Type with typeId '${typeId}' doesn't exist in the ABI.`
|
37450
|
+
);
|
37451
|
+
}
|
37452
|
+
return type3;
|
37453
|
+
};
|
37454
|
+
var findNonEmptyInputs = (abi, inputs) => inputs.filter((input) => findTypeById(abi, input.type).type !== "()");
|
37455
|
+
var findVectorBufferArgument = (components) => {
|
37456
|
+
const bufferComponent = components.find((c) => c.name === "buf");
|
37457
|
+
const bufferTypeArgument = bufferComponent?.originalTypeArguments?.[0];
|
37458
|
+
if (!bufferComponent || !bufferTypeArgument) {
|
37459
|
+
throw new FuelError(
|
37460
|
+
ErrorCode.INVALID_COMPONENT,
|
37461
|
+
`The Vec type provided is missing or has a malformed 'buf' component.`
|
37462
|
+
);
|
37463
|
+
}
|
37464
|
+
return bufferTypeArgument;
|
37465
|
+
};
|
37466
|
+
var ResolvedAbiType = class {
|
37467
|
+
abi;
|
37468
|
+
name;
|
37469
|
+
type;
|
37470
|
+
originalTypeArguments;
|
37471
|
+
components;
|
37472
|
+
constructor(abi, argument) {
|
37473
|
+
this.abi = abi;
|
37474
|
+
this.name = argument.name;
|
37475
|
+
const type3 = findTypeById(abi, argument.type);
|
37476
|
+
this.type = type3.type;
|
37477
|
+
this.originalTypeArguments = argument.typeArguments;
|
37478
|
+
this.components = ResolvedAbiType.getResolvedGenericComponents(
|
37479
|
+
abi,
|
37480
|
+
argument,
|
37481
|
+
type3.components,
|
37482
|
+
type3.typeParameters ?? ResolvedAbiType.getImplicitGenericTypeParameters(abi, type3.components)
|
37483
|
+
);
|
37484
|
+
}
|
37485
|
+
static getResolvedGenericComponents(abi, arg, components, typeParameters) {
|
37486
|
+
if (components === null) {
|
37487
|
+
return null;
|
37488
|
+
}
|
37489
|
+
if (typeParameters === null || typeParameters.length === 0) {
|
37490
|
+
return components.map((c) => new ResolvedAbiType(abi, c));
|
37491
|
+
}
|
37492
|
+
const typeParametersAndArgsMap = typeParameters.reduce(
|
37493
|
+
(obj, typeParameter, typeParameterIndex) => {
|
37494
|
+
const o = { ...obj };
|
37495
|
+
o[typeParameter] = structuredClone(
|
37496
|
+
arg.typeArguments?.[typeParameterIndex]
|
37497
|
+
);
|
37498
|
+
return o;
|
37499
|
+
},
|
37500
|
+
{}
|
37501
|
+
);
|
37502
|
+
const resolvedComponents = this.resolveGenericArgTypes(
|
37503
|
+
abi,
|
37504
|
+
components,
|
37505
|
+
typeParametersAndArgsMap
|
37506
|
+
);
|
37507
|
+
return resolvedComponents.map((c) => new ResolvedAbiType(abi, c));
|
37508
|
+
}
|
37509
|
+
static resolveGenericArgTypes(abi, args, typeParametersAndArgsMap) {
|
37510
|
+
return args.map((arg) => {
|
37511
|
+
if (typeParametersAndArgsMap[arg.type] !== void 0) {
|
37512
|
+
return {
|
37513
|
+
...typeParametersAndArgsMap[arg.type],
|
37514
|
+
name: arg.name
|
37515
|
+
};
|
37516
|
+
}
|
37517
|
+
if (arg.typeArguments) {
|
37518
|
+
return {
|
37519
|
+
...structuredClone(arg),
|
37520
|
+
typeArguments: this.resolveGenericArgTypes(
|
37521
|
+
abi,
|
37522
|
+
arg.typeArguments,
|
37523
|
+
typeParametersAndArgsMap
|
37524
|
+
)
|
37525
|
+
};
|
37526
|
+
}
|
37527
|
+
const argType = findTypeById(abi, arg.type);
|
37528
|
+
const implicitTypeParameters = this.getImplicitGenericTypeParameters(abi, argType.components);
|
37529
|
+
if (implicitTypeParameters && implicitTypeParameters.length > 0) {
|
37530
|
+
return {
|
37531
|
+
...structuredClone(arg),
|
37532
|
+
typeArguments: implicitTypeParameters.map((itp) => typeParametersAndArgsMap[itp])
|
37533
|
+
};
|
37534
|
+
}
|
37535
|
+
return arg;
|
37536
|
+
});
|
37537
|
+
}
|
37538
|
+
static getImplicitGenericTypeParameters(abi, args, implicitGenericParametersParam) {
|
37539
|
+
if (!Array.isArray(args)) {
|
37540
|
+
return null;
|
37541
|
+
}
|
37542
|
+
const implicitGenericParameters = implicitGenericParametersParam ?? [];
|
37543
|
+
args.forEach((a) => {
|
37544
|
+
const argType = findTypeById(abi, a.type);
|
37545
|
+
if (genericRegEx.test(argType.type)) {
|
37546
|
+
implicitGenericParameters.push(argType.typeId);
|
37547
|
+
return;
|
37548
|
+
}
|
37549
|
+
if (!Array.isArray(a.typeArguments)) {
|
37550
|
+
return;
|
37551
|
+
}
|
37552
|
+
this.getImplicitGenericTypeParameters(abi, a.typeArguments, implicitGenericParameters);
|
37553
|
+
});
|
37554
|
+
return implicitGenericParameters.length > 0 ? implicitGenericParameters : null;
|
37555
|
+
}
|
37556
|
+
getSignature() {
|
37557
|
+
const prefix = this.getArgSignaturePrefix();
|
37558
|
+
const content = this.getArgSignatureContent();
|
37559
|
+
return `${prefix}${content}`;
|
37560
|
+
}
|
37561
|
+
getArgSignaturePrefix() {
|
37562
|
+
const structMatch = structRegEx.test(this.type);
|
37563
|
+
if (structMatch) {
|
37564
|
+
return "s";
|
37565
|
+
}
|
37566
|
+
const arrayMatch = arrayRegEx.test(this.type);
|
37567
|
+
if (arrayMatch) {
|
37568
|
+
return "a";
|
37569
|
+
}
|
37570
|
+
const enumMatch = enumRegEx.test(this.type);
|
37571
|
+
if (enumMatch) {
|
37572
|
+
return "e";
|
37573
|
+
}
|
37574
|
+
return "";
|
37575
|
+
}
|
37576
|
+
getArgSignatureContent() {
|
37577
|
+
if (this.type === "raw untyped ptr") {
|
37578
|
+
return "rawptr";
|
37579
|
+
}
|
37580
|
+
if (this.type === "raw untyped slice") {
|
37581
|
+
return "rawslice";
|
37582
|
+
}
|
37583
|
+
const strMatch = stringRegEx.exec(this.type)?.groups;
|
37584
|
+
if (strMatch) {
|
37585
|
+
return `str[${strMatch.length}]`;
|
37586
|
+
}
|
37587
|
+
if (this.components === null) {
|
37588
|
+
return this.type;
|
37589
|
+
}
|
37590
|
+
const arrayMatch = arrayRegEx.exec(this.type)?.groups;
|
37591
|
+
if (arrayMatch) {
|
37592
|
+
return `[${this.components[0].getSignature()};${arrayMatch.length}]`;
|
37593
|
+
}
|
37594
|
+
const typeArgumentsSignature = this.originalTypeArguments !== null ? `<${this.originalTypeArguments.map((a) => new ResolvedAbiType(this.abi, a).getSignature()).join(",")}>` : "";
|
37595
|
+
const componentsSignature = `(${this.components.map((c) => c.getSignature()).join(",")})`;
|
37596
|
+
return `${typeArgumentsSignature}${componentsSignature}`;
|
37597
|
+
}
|
37598
|
+
};
|
37599
|
+
function getCoders(components, options) {
|
37600
|
+
const { getCoder: getCoder2 } = options;
|
37601
|
+
return components.reduce((obj, component) => {
|
37602
|
+
const o = obj;
|
37603
|
+
o[component.name] = getCoder2(component, options);
|
37604
|
+
return o;
|
37605
|
+
}, {});
|
37606
|
+
}
|
37607
|
+
var getCoder = (resolvedAbiType, _options) => {
|
38277
37608
|
switch (resolvedAbiType.type) {
|
38278
37609
|
case U8_CODER_TYPE:
|
38279
37610
|
case U16_CODER_TYPE:
|
38280
37611
|
case U32_CODER_TYPE:
|
38281
|
-
return new
|
37612
|
+
return new NumberCoder(resolvedAbiType.type);
|
38282
37613
|
case U64_CODER_TYPE:
|
38283
37614
|
case RAW_PTR_CODER_TYPE:
|
38284
37615
|
return new BigNumberCoder("u64");
|
38285
37616
|
case U256_CODER_TYPE:
|
38286
37617
|
return new BigNumberCoder("u256");
|
38287
37618
|
case RAW_SLICE_CODER_TYPE:
|
38288
|
-
return new
|
37619
|
+
return new RawSliceCoder();
|
38289
37620
|
case BOOL_CODER_TYPE:
|
38290
|
-
return new
|
37621
|
+
return new BooleanCoder();
|
38291
37622
|
case B256_CODER_TYPE:
|
38292
37623
|
return new B256Coder();
|
38293
37624
|
case B512_CODER_TYPE:
|
38294
37625
|
return new B512Coder();
|
38295
37626
|
case BYTES_CODER_TYPE:
|
38296
|
-
return new
|
37627
|
+
return new ByteCoder();
|
38297
37628
|
case STD_STRING_CODER_TYPE:
|
38298
|
-
return new
|
37629
|
+
return new StdStringCoder();
|
38299
37630
|
case STR_SLICE_CODER_TYPE:
|
38300
37631
|
return new StrSliceCoder();
|
38301
37632
|
default:
|
@@ -38304,7 +37635,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38304
37635
|
const stringMatch = stringRegEx.exec(resolvedAbiType.type)?.groups;
|
38305
37636
|
if (stringMatch) {
|
38306
37637
|
const length = parseInt(stringMatch.length, 10);
|
38307
|
-
return new
|
37638
|
+
return new StringCoder(length);
|
38308
37639
|
}
|
38309
37640
|
const components = resolvedAbiType.components;
|
38310
37641
|
const arrayMatch = arrayRegEx.exec(resolvedAbiType.type)?.groups;
|
@@ -38317,46 +37648,42 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38317
37648
|
`The provided Array type is missing an item of 'component'.`
|
38318
37649
|
);
|
38319
37650
|
}
|
38320
|
-
const arrayElementCoder =
|
37651
|
+
const arrayElementCoder = getCoder(arg);
|
38321
37652
|
return new ArrayCoder(arrayElementCoder, length);
|
38322
37653
|
}
|
38323
37654
|
if (resolvedAbiType.type === VEC_CODER_TYPE) {
|
38324
37655
|
const arg = findVectorBufferArgument(components);
|
38325
37656
|
const argType = new ResolvedAbiType(resolvedAbiType.abi, arg);
|
38326
|
-
const itemCoder =
|
38327
|
-
return new
|
37657
|
+
const itemCoder = getCoder(argType, { encoding: ENCODING_V1 });
|
37658
|
+
return new VecCoder(itemCoder);
|
38328
37659
|
}
|
38329
37660
|
const structMatch = structRegEx.exec(resolvedAbiType.type)?.groups;
|
38330
37661
|
if (structMatch) {
|
38331
|
-
const coders = getCoders(components, {
|
38332
|
-
return new
|
37662
|
+
const coders = getCoders(components, { getCoder });
|
37663
|
+
return new StructCoder(structMatch.name, coders);
|
38333
37664
|
}
|
38334
37665
|
const enumMatch = enumRegEx.exec(resolvedAbiType.type)?.groups;
|
38335
37666
|
if (enumMatch) {
|
38336
|
-
const coders = getCoders(components, { getCoder
|
37667
|
+
const coders = getCoders(components, { getCoder });
|
38337
37668
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
38338
37669
|
if (isOptionEnum) {
|
38339
|
-
return new
|
37670
|
+
return new OptionCoder(enumMatch.name, coders);
|
38340
37671
|
}
|
38341
|
-
return new
|
37672
|
+
return new EnumCoder(enumMatch.name, coders);
|
38342
37673
|
}
|
38343
37674
|
const tupleMatch = tupleRegEx.exec(resolvedAbiType.type)?.groups;
|
38344
37675
|
if (tupleMatch) {
|
38345
|
-
const coders = components.map(
|
38346
|
-
|
38347
|
-
);
|
38348
|
-
return new TupleCoder2(coders);
|
37676
|
+
const coders = components.map((component) => getCoder(component, { encoding: ENCODING_V1 }));
|
37677
|
+
return new TupleCoder(coders);
|
38349
37678
|
}
|
38350
37679
|
throw new FuelError(
|
38351
37680
|
ErrorCode.CODER_NOT_FOUND,
|
38352
37681
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
38353
37682
|
);
|
38354
37683
|
};
|
38355
|
-
function getCoderForEncoding(encoding =
|
37684
|
+
function getCoderForEncoding(encoding = ENCODING_V1) {
|
38356
37685
|
switch (encoding) {
|
38357
37686
|
case ENCODING_V1:
|
38358
|
-
return getCoder2;
|
38359
|
-
case ENCODING_V0:
|
38360
37687
|
return getCoder;
|
38361
37688
|
default:
|
38362
37689
|
throw new FuelError(
|
@@ -38367,7 +37694,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38367
37694
|
}
|
38368
37695
|
var AbiCoder = class {
|
38369
37696
|
static getCoder(abi, argument, options = {
|
38370
|
-
|
37697
|
+
padToWordSize: false
|
38371
37698
|
}) {
|
38372
37699
|
const resolvedAbiType = new ResolvedAbiType(abi, argument);
|
38373
37700
|
return getCoderForEncoding(options.encoding)(resolvedAbiType, options);
|
@@ -38387,8 +37714,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38387
37714
|
name;
|
38388
37715
|
jsonFn;
|
38389
37716
|
attributes;
|
38390
|
-
isInputDataPointer;
|
38391
|
-
outputMetadata;
|
38392
37717
|
jsonAbi;
|
38393
37718
|
constructor(jsonAbi, name) {
|
38394
37719
|
this.jsonAbi = jsonAbi;
|
@@ -38396,13 +37721,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38396
37721
|
this.name = name;
|
38397
37722
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
38398
37723
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
38399
|
-
this.selectorBytes = new
|
37724
|
+
this.selectorBytes = new StdStringCoder().encode(name);
|
38400
37725
|
this.encoding = getEncodingVersion(jsonAbi.encoding);
|
38401
|
-
this.isInputDataPointer = this.#isInputDataPointer();
|
38402
|
-
this.outputMetadata = {
|
38403
|
-
isHeapType: this.#isOutputDataHeap(),
|
38404
|
-
encodedLength: this.#getOutputEncodedLength()
|
38405
|
-
};
|
38406
37726
|
this.attributes = this.jsonFn.attributes ?? [];
|
38407
37727
|
}
|
38408
37728
|
static getSignature(abi, fn) {
|
@@ -38415,29 +37735,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38415
37735
|
const hashedFunctionSignature = sha2562(bufferFromString2(functionSignature, "utf-8"));
|
38416
37736
|
return bn(hashedFunctionSignature.slice(0, 10)).toHex(8);
|
38417
37737
|
}
|
38418
|
-
|
38419
|
-
const inputTypes = this.jsonFn.inputs.map((i) => findTypeById(this.jsonAbi, i.type));
|
38420
|
-
return this.jsonFn.inputs.length > 1 || isPointerType(inputTypes[0]?.type || "");
|
38421
|
-
}
|
38422
|
-
#isOutputDataHeap() {
|
38423
|
-
const outputType = findTypeById(this.jsonAbi, this.jsonFn.output.type);
|
38424
|
-
return isHeapType(outputType?.type || "");
|
38425
|
-
}
|
38426
|
-
#getOutputEncodedLength() {
|
38427
|
-
try {
|
38428
|
-
const heapCoder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output);
|
38429
|
-
if (heapCoder instanceof VecCoder) {
|
38430
|
-
return heapCoder.coder.encodedLength;
|
38431
|
-
}
|
38432
|
-
if (heapCoder instanceof ByteCoder) {
|
38433
|
-
return ByteCoder.memorySize;
|
38434
|
-
}
|
38435
|
-
return heapCoder.encodedLength;
|
38436
|
-
} catch (e) {
|
38437
|
-
return 0;
|
38438
|
-
}
|
38439
|
-
}
|
38440
|
-
encodeArguments(values, offset = 0) {
|
37738
|
+
encodeArguments(values) {
|
38441
37739
|
FunctionFragment.verifyArgsAndInputsAlign(values, this.jsonFn.inputs, this.jsonAbi);
|
38442
37740
|
const shallowCopyValues = values.slice();
|
38443
37741
|
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
@@ -38447,15 +37745,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38447
37745
|
}
|
38448
37746
|
const coders = nonEmptyInputs.map(
|
38449
37747
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
38450
|
-
isRightPadded: nonEmptyInputs.length > 1,
|
38451
37748
|
encoding: this.encoding
|
38452
37749
|
})
|
38453
37750
|
);
|
38454
|
-
|
38455
|
-
return new TupleCoder2(coders).encode(shallowCopyValues);
|
38456
|
-
}
|
38457
|
-
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
38458
|
-
return unpackDynamicData(results, offset, results.byteLength);
|
37751
|
+
return new TupleCoder(coders).encode(shallowCopyValues);
|
38459
37752
|
}
|
38460
37753
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
38461
37754
|
if (args.length === inputs.length) {
|
@@ -38564,9 +37857,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38564
37857
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
38565
37858
|
return fragment.decodeArguments(data);
|
38566
37859
|
}
|
38567
|
-
encodeFunctionData(functionFragment, values
|
37860
|
+
encodeFunctionData(functionFragment, values) {
|
38568
37861
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
38569
|
-
return fragment.encodeArguments(values
|
37862
|
+
return fragment.encodeArguments(values);
|
38570
37863
|
}
|
38571
37864
|
// Decode the result of a function call
|
38572
37865
|
decodeFunctionResult(functionFragment, data) {
|
@@ -38594,9 +37887,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38594
37887
|
);
|
38595
37888
|
}
|
38596
37889
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
38597
|
-
|
38598
|
-
// TODO: Review support for configurables in v1 encoding when it becomes available
|
38599
|
-
encoding: ENCODING_V0
|
37890
|
+
encoding: this.encoding
|
38600
37891
|
});
|
38601
37892
|
}
|
38602
37893
|
getTypeById(typeId) {
|
@@ -38646,8 +37937,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38646
37937
|
var TxPointerCoder = class extends StructCoder {
|
38647
37938
|
constructor() {
|
38648
37939
|
super("TxPointer", {
|
38649
|
-
blockHeight: new NumberCoder("u32"),
|
38650
|
-
txIndex: new NumberCoder("u16")
|
37940
|
+
blockHeight: new NumberCoder("u32", { padToWordSize: true }),
|
37941
|
+
txIndex: new NumberCoder("u16", { padToWordSize: true })
|
38651
37942
|
});
|
38652
37943
|
}
|
38653
37944
|
};
|
@@ -38664,12 +37955,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38664
37955
|
encode(value) {
|
38665
37956
|
const parts = [];
|
38666
37957
|
parts.push(new B256Coder().encode(value.txID));
|
38667
|
-
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
37958
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.outputIndex));
|
38668
37959
|
parts.push(new B256Coder().encode(value.owner));
|
38669
37960
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
38670
37961
|
parts.push(new B256Coder().encode(value.assetId));
|
38671
37962
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
38672
|
-
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
37963
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.witnessIndex));
|
38673
37964
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
38674
37965
|
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
38675
37966
|
parts.push(new BigNumberCoder("u64").encode(value.predicateDataLength));
|
@@ -38684,7 +37975,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38684
37975
|
let o = offset;
|
38685
37976
|
[decoded, o] = new B256Coder().decode(data, o);
|
38686
37977
|
const txID = decoded;
|
38687
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
37978
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
38688
37979
|
const outputIndex = decoded;
|
38689
37980
|
[decoded, o] = new B256Coder().decode(data, o);
|
38690
37981
|
const owner = decoded;
|
@@ -38694,7 +37985,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38694
37985
|
const assetId = decoded;
|
38695
37986
|
[decoded, o] = new TxPointerCoder().decode(data, o);
|
38696
37987
|
const txPointer = decoded;
|
38697
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
37988
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
38698
37989
|
const witnessIndex = Number(decoded);
|
38699
37990
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
38700
37991
|
const predicateGasUsed = decoded;
|
@@ -38733,7 +38024,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38733
38024
|
encode(value) {
|
38734
38025
|
const parts = [];
|
38735
38026
|
parts.push(new B256Coder().encode(value.txID));
|
38736
|
-
parts.push(new NumberCoder("u16").encode(value.outputIndex));
|
38027
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.outputIndex));
|
38737
38028
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
38738
38029
|
parts.push(new B256Coder().encode(value.stateRoot));
|
38739
38030
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
@@ -38745,7 +38036,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38745
38036
|
let o = offset;
|
38746
38037
|
[decoded, o] = new B256Coder().decode(data, o);
|
38747
38038
|
const txID = decoded;
|
38748
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38039
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
38749
38040
|
const outputIndex = decoded;
|
38750
38041
|
[decoded, o] = new B256Coder().decode(data, o);
|
38751
38042
|
const balanceRoot = decoded;
|
@@ -38794,7 +38085,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38794
38085
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
38795
38086
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
38796
38087
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
38797
|
-
parts.push(new NumberCoder("u16").encode(value.witnessIndex));
|
38088
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.witnessIndex));
|
38798
38089
|
parts.push(new BigNumberCoder("u64").encode(value.predicateGasUsed));
|
38799
38090
|
parts.push(new BigNumberCoder("u64").encode(data.length));
|
38800
38091
|
parts.push(new BigNumberCoder("u64").encode(value.predicateLength));
|
@@ -38823,11 +38114,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38823
38114
|
const amount = decoded;
|
38824
38115
|
[decoded, o] = new B256Coder().decode(data, o);
|
38825
38116
|
const nonce = decoded;
|
38826
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38117
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
38827
38118
|
const witnessIndex = Number(decoded);
|
38828
38119
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
38829
38120
|
const predicateGasUsed = decoded;
|
38830
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
38121
|
+
[decoded, o] = new NumberCoder("u32", { padToWordSize: true }).decode(data, o);
|
38831
38122
|
const dataLength = decoded;
|
38832
38123
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
38833
38124
|
const predicateLength = decoded;
|
@@ -38865,7 +38156,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38865
38156
|
}
|
38866
38157
|
encode(value) {
|
38867
38158
|
const parts = [];
|
38868
|
-
parts.push(new NumberCoder("u8").encode(value.type));
|
38159
|
+
parts.push(new NumberCoder("u8", { padToWordSize: true }).encode(value.type));
|
38869
38160
|
const { type: type3 } = value;
|
38870
38161
|
switch (type3) {
|
38871
38162
|
case 0: {
|
@@ -38892,7 +38183,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38892
38183
|
decode(data, offset) {
|
38893
38184
|
let decoded;
|
38894
38185
|
let o = offset;
|
38895
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
38186
|
+
[decoded, o] = new NumberCoder("u8", { padToWordSize: true }).decode(data, o);
|
38896
38187
|
const type3 = decoded;
|
38897
38188
|
switch (type3) {
|
38898
38189
|
case 0: {
|
@@ -38961,7 +38252,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38961
38252
|
}
|
38962
38253
|
encode(value) {
|
38963
38254
|
const parts = [];
|
38964
|
-
parts.push(new NumberCoder("u8").encode(value.inputIndex));
|
38255
|
+
parts.push(new NumberCoder("u8", { padToWordSize: true }).encode(value.inputIndex));
|
38965
38256
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
38966
38257
|
parts.push(new B256Coder().encode(value.stateRoot));
|
38967
38258
|
return concat(parts);
|
@@ -38969,7 +38260,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38969
38260
|
decode(data, offset) {
|
38970
38261
|
let decoded;
|
38971
38262
|
let o = offset;
|
38972
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
38263
|
+
[decoded, o] = new NumberCoder("u8", { padToWordSize: true }).decode(data, o);
|
38973
38264
|
const inputIndex = decoded;
|
38974
38265
|
[decoded, o] = new B256Coder().decode(data, o);
|
38975
38266
|
const balanceRoot = decoded;
|
@@ -39081,7 +38372,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39081
38372
|
}
|
39082
38373
|
encode(value) {
|
39083
38374
|
const parts = [];
|
39084
|
-
parts.push(new NumberCoder("u8").encode(value.type));
|
38375
|
+
parts.push(new NumberCoder("u8", { padToWordSize: true }).encode(value.type));
|
39085
38376
|
const { type: type3 } = value;
|
39086
38377
|
switch (type3) {
|
39087
38378
|
case 0: {
|
@@ -39116,7 +38407,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39116
38407
|
decode(data, offset) {
|
39117
38408
|
let decoded;
|
39118
38409
|
let o = offset;
|
39119
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
38410
|
+
[decoded, o] = new NumberCoder("u8", { padToWordSize: true }).decode(data, o);
|
39120
38411
|
const type3 = decoded;
|
39121
38412
|
switch (type3) {
|
39122
38413
|
case 0: {
|
@@ -39184,7 +38475,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39184
38475
|
parts.push(new BigNumberCoder("u64").encode(data));
|
39185
38476
|
break;
|
39186
38477
|
case 4:
|
39187
|
-
parts.push(new NumberCoder("u32").encode(data));
|
38478
|
+
parts.push(new NumberCoder("u32", { padToWordSize: true }).encode(data));
|
39188
38479
|
break;
|
39189
38480
|
default: {
|
39190
38481
|
throw new FuelError(ErrorCode.INVALID_POLICY_TYPE, `Invalid policy type: ${type3}`);
|
@@ -39207,7 +38498,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39207
38498
|
policies.push({ type: 2, data: witnessLimit });
|
39208
38499
|
}
|
39209
38500
|
if (policyTypes & 4) {
|
39210
|
-
const [maturity, nextOffset] = new NumberCoder("u32").decode(
|
38501
|
+
const [maturity, nextOffset] = new NumberCoder("u32", { padToWordSize: true }).decode(
|
38502
|
+
data,
|
38503
|
+
o
|
38504
|
+
);
|
39211
38505
|
o = nextOffset;
|
39212
38506
|
policies.push({ type: 4, data: maturity });
|
39213
38507
|
}
|
@@ -39254,7 +38548,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39254
38548
|
parts.push(new B256Coder().encode(value.recipient));
|
39255
38549
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
39256
38550
|
parts.push(new B256Coder().encode(value.nonce));
|
39257
|
-
parts.push(new NumberCoder("u16").encode(value.data.length));
|
38551
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.data.length));
|
39258
38552
|
parts.push(new B256Coder().encode(value.digest));
|
39259
38553
|
parts.push(new ByteArrayCoder(value.data.length).encode(value.data));
|
39260
38554
|
return concat(parts);
|
@@ -39270,7 +38564,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39270
38564
|
const amount = decoded;
|
39271
38565
|
[decoded, o] = new B256Coder().decode(data, o);
|
39272
38566
|
const nonce = decoded;
|
39273
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38567
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39274
38568
|
const len = decoded;
|
39275
38569
|
[decoded, o] = new B256Coder().decode(data, o);
|
39276
38570
|
const digest = decoded;
|
@@ -39394,11 +38688,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39394
38688
|
encode(upgradePurposeType) {
|
39395
38689
|
const parts = [];
|
39396
38690
|
const { type: type3 } = upgradePurposeType;
|
39397
|
-
parts.push(new NumberCoder("u8").encode(type3));
|
38691
|
+
parts.push(new NumberCoder("u8", { padToWordSize: true }).encode(type3));
|
39398
38692
|
switch (type3) {
|
39399
38693
|
case 0: {
|
39400
38694
|
const data = upgradePurposeType.data;
|
39401
|
-
parts.push(new NumberCoder("u16").encode(data.witnessIndex));
|
38695
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(data.witnessIndex));
|
39402
38696
|
parts.push(new B256Coder().encode(data.checksum));
|
39403
38697
|
break;
|
39404
38698
|
}
|
@@ -39419,11 +38713,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39419
38713
|
decode(data, offset) {
|
39420
38714
|
let o = offset;
|
39421
38715
|
let decoded;
|
39422
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
38716
|
+
[decoded, o] = new NumberCoder("u8", { padToWordSize: true }).decode(data, o);
|
39423
38717
|
const type3 = decoded;
|
39424
38718
|
switch (type3) {
|
39425
38719
|
case 0: {
|
39426
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38720
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39427
38721
|
const witnessIndex = decoded;
|
39428
38722
|
[decoded, o] = new B256Coder().decode(data, o);
|
39429
38723
|
const checksum = decoded;
|
@@ -39454,14 +38748,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39454
38748
|
}
|
39455
38749
|
encode(value) {
|
39456
38750
|
const parts = [];
|
39457
|
-
parts.push(new NumberCoder("u32").encode(value.dataLength));
|
38751
|
+
parts.push(new NumberCoder("u32", { padToWordSize: true }).encode(value.dataLength));
|
39458
38752
|
parts.push(new ByteArrayCoder(value.dataLength).encode(value.data));
|
39459
38753
|
return concat(parts);
|
39460
38754
|
}
|
39461
38755
|
decode(data, offset) {
|
39462
38756
|
let decoded;
|
39463
38757
|
let o = offset;
|
39464
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
38758
|
+
[decoded, o] = new NumberCoder("u32", { padToWordSize: true }).decode(data, o);
|
39465
38759
|
const dataLength = decoded;
|
39466
38760
|
[decoded, o] = new ByteArrayCoder(dataLength).decode(data, o);
|
39467
38761
|
const witnessData = decoded;
|
@@ -39492,10 +38786,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39492
38786
|
parts.push(new B256Coder().encode(value.receiptsRoot));
|
39493
38787
|
parts.push(new BigNumberCoder("u64").encode(value.scriptLength));
|
39494
38788
|
parts.push(new BigNumberCoder("u64").encode(value.scriptDataLength));
|
39495
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
39496
|
-
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
39497
|
-
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
39498
|
-
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
38789
|
+
parts.push(new NumberCoder("u32", { padToWordSize: true }).encode(value.policyTypes));
|
38790
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.inputsCount));
|
38791
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.outputsCount));
|
38792
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.witnessesCount));
|
39499
38793
|
parts.push(new ByteArrayCoder(value.scriptLength.toNumber()).encode(value.script));
|
39500
38794
|
parts.push(new ByteArrayCoder(value.scriptDataLength.toNumber()).encode(value.scriptData));
|
39501
38795
|
parts.push(new PoliciesCoder().encode(value.policies));
|
@@ -39515,13 +38809,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39515
38809
|
const scriptLength = decoded;
|
39516
38810
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
39517
38811
|
const scriptDataLength = decoded;
|
39518
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
38812
|
+
[decoded, o] = new NumberCoder("u32", { padToWordSize: true }).decode(data, o);
|
39519
38813
|
const policyTypes = decoded;
|
39520
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38814
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39521
38815
|
const inputsCount = decoded;
|
39522
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38816
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39523
38817
|
const outputsCount = decoded;
|
39524
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38818
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39525
38819
|
const witnessesCount = decoded;
|
39526
38820
|
[decoded, o] = new ByteArrayCoder(scriptLength.toNumber()).decode(data, o);
|
39527
38821
|
const script = decoded;
|
@@ -39563,13 +38857,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39563
38857
|
}
|
39564
38858
|
encode(value) {
|
39565
38859
|
const parts = [];
|
39566
|
-
parts.push(new NumberCoder("u16").encode(value.bytecodeWitnessIndex));
|
38860
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.bytecodeWitnessIndex));
|
39567
38861
|
parts.push(new B256Coder().encode(value.salt));
|
39568
38862
|
parts.push(new BigNumberCoder("u64").encode(value.storageSlotsCount));
|
39569
|
-
parts.push(new NumberCoder("u32").encode(value.policyTypes));
|
39570
|
-
parts.push(new NumberCoder("u16").encode(value.inputsCount));
|
39571
|
-
parts.push(new NumberCoder("u16").encode(value.outputsCount));
|
39572
|
-
parts.push(new NumberCoder("u16").encode(value.witnessesCount));
|
38863
|
+
parts.push(new NumberCoder("u32", { padToWordSize: true }).encode(value.policyTypes));
|
38864
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.inputsCount));
|
38865
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.outputsCount));
|
38866
|
+
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.witnessesCount));
|
39573
38867
|
parts.push(
|
39574
38868
|
new ArrayCoder(new StorageSlotCoder(), value.storageSlotsCount.toNumber()).encode(
|
39575
38869
|
value.storageSlots
|
@@ -39584,19 +38878,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39584
38878
|
decode(data, offset) {
|
39585
38879
|
let decoded;
|
39586
38880
|
let o = offset;
|
39587
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38881
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39588
38882
|
const bytecodeWitnessIndex = decoded;
|
39589
38883
|
[decoded, o] = new B256Coder().decode(data, o);
|
39590
38884
|
const salt = decoded;
|
39591
38885
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
39592
38886
|
const storageSlotsCount = decoded;
|
39593
|
-
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
38887
|
+
[decoded, o] = new NumberCoder("u32", { padToWordSize: true }).decode(data, o);
|
39594
38888
|
const policyTypes = decoded;
|
39595
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38889
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39596
38890
|
const inputsCount = decoded;
|
39597
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38891
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39598
38892
|
const outputsCount = decoded;
|
39599
|
-
[decoded, o] = new NumberCoder("u16").decode(data, o);
|
38893
|
+
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
39600
38894
|
const witnessesCount = decoded;
|
39601
38895
|
[decoded, o] = new ArrayCoder(new StorageSlotCoder(), storageSlotsCount.toNumber()).decode(
|
39602
38896
|
data,
|
@@ -39810,7 +39104,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39810
39104
|
}
|
39811
39105
|
encode(value) {
|
39812
39106
|
const parts = [];
|
39813
|
-
parts.push(new NumberCoder("u8").encode(value.type));
|
39107
|
+
parts.push(new NumberCoder("u8", { padToWordSize: true }).encode(value.type));
|
39814
39108
|
const { type: type3 } = value;
|
39815
39109
|
switch (value.type) {
|
39816
39110
|
case 0: {
|
@@ -39853,7 +39147,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39853
39147
|
decode(data, offset) {
|
39854
39148
|
let decoded;
|
39855
39149
|
let o = offset;
|
39856
|
-
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
39150
|
+
[decoded, o] = new NumberCoder("u8", { padToWordSize: true }).decode(data, o);
|
39857
39151
|
const type3 = decoded;
|
39858
39152
|
switch (type3) {
|
39859
39153
|
case 0: {
|
@@ -45488,15 +44782,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45488
44782
|
}
|
45489
44783
|
});
|
45490
44784
|
}
|
45491
|
-
shiftPredicateData() {
|
45492
|
-
this.inputs.forEach((input) => {
|
45493
|
-
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
45494
|
-
input.predicateData = input.padPredicateData(
|
45495
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
45496
|
-
);
|
45497
|
-
}
|
45498
|
-
});
|
45499
|
-
}
|
45500
44785
|
};
|
45501
44786
|
|
45502
44787
|
// src/providers/transaction-request/hash-transaction.ts
|
@@ -45961,37 +45246,27 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45961
45246
|
};
|
45962
45247
|
|
45963
45248
|
// src/providers/transaction-summary/call.ts
|
45964
|
-
var getFunctionCall = ({ abi, receipt
|
45249
|
+
var getFunctionCall = ({ abi, receipt }) => {
|
45965
45250
|
const abiInterface = new Interface(abi);
|
45966
45251
|
const callFunctionSelector = receipt.param1.toHex(8);
|
45967
45252
|
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
45968
45253
|
const inputs = functionFragment.jsonFn.inputs;
|
45969
|
-
|
45970
|
-
if (functionFragment.isInputDataPointer) {
|
45971
|
-
if (rawPayload) {
|
45972
|
-
const argsOffset = bn(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
|
45973
|
-
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
45974
|
-
}
|
45975
|
-
} else {
|
45976
|
-
encodedArgs = receipt.param2.toHex();
|
45977
|
-
}
|
45254
|
+
const encodedArgs = receipt.param2.toHex();
|
45978
45255
|
let argumentsProvided;
|
45979
|
-
|
45980
|
-
|
45981
|
-
|
45982
|
-
|
45983
|
-
|
45984
|
-
|
45985
|
-
|
45986
|
-
|
45987
|
-
|
45988
|
-
|
45989
|
-
|
45990
|
-
|
45991
|
-
|
45992
|
-
|
45993
|
-
}, {});
|
45994
|
-
}
|
45256
|
+
const data = functionFragment.decodeArguments(encodedArgs);
|
45257
|
+
if (data) {
|
45258
|
+
argumentsProvided = inputs.reduce((prev, input, index) => {
|
45259
|
+
const value = data[index];
|
45260
|
+
const name = input.name;
|
45261
|
+
if (name) {
|
45262
|
+
return {
|
45263
|
+
...prev,
|
45264
|
+
// reparse to remove bn
|
45265
|
+
[name]: JSON.parse(JSON.stringify(value))
|
45266
|
+
};
|
45267
|
+
}
|
45268
|
+
return prev;
|
45269
|
+
}, {});
|
45995
45270
|
}
|
45996
45271
|
const call = {
|
45997
45272
|
functionSignature: functionFragment.signature,
|
@@ -48268,7 +47543,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48268
47543
|
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
48269
47544
|
);
|
48270
47545
|
request.addResources(resources);
|
48271
|
-
request.shiftPredicateData();
|
48272
47546
|
request.updatePredicateGasUsed(estimatedPredicates);
|
48273
47547
|
const requestToReestimate2 = clone_default(request);
|
48274
47548
|
if (addedSignatures) {
|
@@ -48300,7 +47574,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48300
47574
|
}
|
48301
47575
|
fundingAttempts += 1;
|
48302
47576
|
}
|
48303
|
-
request.shiftPredicateData();
|
48304
47577
|
request.updatePredicateGasUsed(estimatedPredicates);
|
48305
47578
|
const requestToReestimate = clone_default(request);
|
48306
47579
|
if (addedSignatures) {
|