@fuel-ts/account 0.0.0-pr-1699-20240214162234 → 0.0.0-pr-1784-20240221124858
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 +7 -4
- package/dist/account.d.ts.map +1 -1
- package/dist/connectors/fuel.d.ts +5 -6
- package/dist/connectors/fuel.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +0 -2
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/types/asset.d.ts +0 -14
- package/dist/connectors/types/asset.d.ts.map +1 -1
- package/dist/connectors/types/data-type.d.ts +0 -4
- package/dist/connectors/types/data-type.d.ts.map +1 -1
- package/dist/connectors/types/events.d.ts +0 -5
- package/dist/connectors/types/events.d.ts.map +1 -1
- package/dist/connectors/types/index.d.ts +0 -2
- package/dist/connectors/types/index.d.ts.map +1 -1
- package/dist/connectors/utils/cache.d.ts.map +1 -1
- package/dist/connectors/utils/index.d.ts +0 -1
- package/dist/connectors/utils/index.d.ts.map +1 -1
- package/dist/index.global.js +718 -605
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +278 -162
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +336 -220
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/assets/index.d.ts +4 -0
- package/dist/providers/assets/index.d.ts.map +1 -0
- package/dist/providers/assets/types.d.ts +36 -0
- package/dist/providers/assets/types.d.ts.map +1 -0
- package/dist/providers/assets/utils/index.d.ts +4 -0
- package/dist/providers/assets/utils/index.d.ts.map +1 -0
- package/dist/providers/assets/utils/network.d.ts +33 -0
- package/dist/providers/assets/utils/network.d.ts.map +1 -0
- package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
- package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
- package/dist/providers/assets/utils/url.d.ts +2 -0
- package/dist/providers/assets/utils/url.d.ts.map +1 -0
- package/dist/providers/chains.d.ts +11 -0
- package/dist/providers/chains.d.ts.map +1 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +14 -6
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +3 -10
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/utils/json.d.ts.map +1 -1
- package/dist/test-utils.global.js +593 -496
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +176 -79
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +231 -134
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +3 -3
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +17 -17
- package/dist/connectors/fixtures/generate-accounts.d.ts +0 -2
- package/dist/connectors/fixtures/generate-accounts.d.ts.map +0 -1
- package/dist/connectors/fixtures/mocked-connector.d.ts +0 -45
- package/dist/connectors/fixtures/mocked-connector.d.ts.map +0 -1
- package/dist/connectors/fixtures/promise-callback.d.ts +0 -7
- package/dist/connectors/fixtures/promise-callback.d.ts.map +0 -1
- package/dist/connectors/fuel-wallet-locked.d.ts +0 -13
- package/dist/connectors/fuel-wallet-locked.d.ts.map +0 -1
- package/dist/connectors/fuel-wallet-provider.d.ts +0 -14
- package/dist/connectors/fuel-wallet-provider.d.ts.map +0 -1
- package/dist/connectors/types/connection.d.ts +0 -7
- package/dist/connectors/types/connection.d.ts.map +0 -1
- package/dist/connectors/types/nertwork-data.d.ts +0 -7
- package/dist/connectors/types/nertwork-data.d.ts.map +0 -1
- package/dist/connectors/utils/get-asset-by-chain.d.ts +0 -3
- package/dist/connectors/utils/get-asset-by-chain.d.ts.map +0 -1
package/dist/index.global.js
CHANGED
@@ -30103,8 +30103,8 @@ spurious results.`);
|
|
30103
30103
|
function getBuiltinVersions() {
|
30104
30104
|
return {
|
30105
30105
|
FORC: "0.50.0",
|
30106
|
-
FUEL_CORE: "0.22.
|
30107
|
-
FUELS: "0.
|
30106
|
+
FUEL_CORE: "0.22.1",
|
30107
|
+
FUELS: "0.74.0"
|
30108
30108
|
};
|
30109
30109
|
}
|
30110
30110
|
function parseVersion(version2) {
|
@@ -30177,10 +30177,12 @@ spurious results.`);
|
|
30177
30177
|
ErrorCode2["CHAIN_INFO_CACHE_EMPTY"] = "chain-info-cache-empty";
|
30178
30178
|
ErrorCode2["NODE_INFO_CACHE_EMPTY"] = "node-info-cache-empty";
|
30179
30179
|
ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
|
30180
|
+
ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
|
30180
30181
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
30181
30182
|
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
|
30182
30183
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
30183
30184
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
30185
|
+
ErrorCode2["MISSING_CONNECTOR"] = "missing-connector";
|
30184
30186
|
ErrorCode2["PARSE_FAILED"] = "parse-failed";
|
30185
30187
|
ErrorCode2["ENCODE_ERROR"] = "encode-error";
|
30186
30188
|
ErrorCode2["DECODE_ERROR"] = "decode-error";
|
@@ -32985,6 +32987,51 @@ spurious results.`);
|
|
32985
32987
|
return [true, offset + this.paddingLength];
|
32986
32988
|
}
|
32987
32989
|
};
|
32990
|
+
var _getPaddedData;
|
32991
|
+
var getPaddedData_fn;
|
32992
|
+
var ByteCoder = class extends Coder {
|
32993
|
+
constructor() {
|
32994
|
+
super("struct", "struct Bytes", BASE_VECTOR_OFFSET);
|
32995
|
+
__privateAdd2(this, _getPaddedData);
|
32996
|
+
}
|
32997
|
+
encode(value) {
|
32998
|
+
if (!Array.isArray(value)) {
|
32999
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
33000
|
+
}
|
33001
|
+
const parts = [];
|
33002
|
+
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
33003
|
+
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
33004
|
+
pointer.dynamicData = {
|
33005
|
+
0: concatWithDynamicData([data])
|
33006
|
+
};
|
33007
|
+
parts.push(pointer);
|
33008
|
+
parts.push(new U64Coder().encode(data.byteLength));
|
33009
|
+
parts.push(new U64Coder().encode(value.length));
|
33010
|
+
return concatWithDynamicData(parts);
|
33011
|
+
}
|
33012
|
+
decode(data, offset) {
|
33013
|
+
if (data.length < BASE_VECTOR_OFFSET) {
|
33014
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid byte data size.`);
|
33015
|
+
}
|
33016
|
+
const len = data.slice(16, 24);
|
33017
|
+
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
33018
|
+
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
33019
|
+
if (byteData.length !== encodedLength) {
|
33020
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid bytes byte data size.`);
|
33021
|
+
}
|
33022
|
+
return [byteData, offset + BASE_VECTOR_OFFSET];
|
33023
|
+
}
|
33024
|
+
};
|
33025
|
+
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
33026
|
+
getPaddedData_fn = function(value) {
|
33027
|
+
const data = [Uint8Array.from(value)];
|
33028
|
+
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
33029
|
+
if (paddingLength) {
|
33030
|
+
data.push(new Uint8Array(paddingLength));
|
33031
|
+
}
|
33032
|
+
return concat2(data);
|
33033
|
+
};
|
33034
|
+
__publicField3(ByteCoder, "memorySize", 1);
|
32988
33035
|
var isFullyNativeEnum = (enumCoders) => Object.values(enumCoders).every(
|
32989
33036
|
// @ts-expect-error complicated types
|
32990
33037
|
({ type: type3, coders }) => type3 === "()" && JSON.stringify(coders) === JSON.stringify([])
|
@@ -33058,6 +33105,31 @@ spurious results.`);
|
|
33058
33105
|
return [{ [caseKey]: decoded }, newOffset];
|
33059
33106
|
}
|
33060
33107
|
};
|
33108
|
+
var OptionCoder = class extends EnumCoder {
|
33109
|
+
encode(value) {
|
33110
|
+
const result = super.encode(this.toSwayOption(value));
|
33111
|
+
return result;
|
33112
|
+
}
|
33113
|
+
toSwayOption(input) {
|
33114
|
+
if (input !== void 0) {
|
33115
|
+
return { Some: input };
|
33116
|
+
}
|
33117
|
+
return { None: [] };
|
33118
|
+
}
|
33119
|
+
decode(data, offset) {
|
33120
|
+
if (data.length < this.encodedLength - 1) {
|
33121
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
33122
|
+
}
|
33123
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
33124
|
+
return [this.toOption(decoded), newOffset];
|
33125
|
+
}
|
33126
|
+
toOption(output4) {
|
33127
|
+
if (output4 && "Some" in output4) {
|
33128
|
+
return output4.Some;
|
33129
|
+
}
|
33130
|
+
return void 0;
|
33131
|
+
}
|
33132
|
+
};
|
33061
33133
|
var NumberCoder = class extends Coder {
|
33062
33134
|
// This is to align the bits to the total bytes
|
33063
33135
|
// See https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md#unsigned-integers
|
@@ -33128,6 +33200,77 @@ spurious results.`);
|
|
33128
33200
|
return [toNumber2(bytes4), offset + 8];
|
33129
33201
|
}
|
33130
33202
|
};
|
33203
|
+
var RawSliceCoder = class extends Coder {
|
33204
|
+
constructor() {
|
33205
|
+
super("raw untyped slice", "raw untyped slice", BASE_RAW_SLICE_OFFSET);
|
33206
|
+
}
|
33207
|
+
encode(value) {
|
33208
|
+
if (!Array.isArray(value)) {
|
33209
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
33210
|
+
}
|
33211
|
+
const parts = [];
|
33212
|
+
const coder = new NumberCoder("u8", { isSmallBytes: true });
|
33213
|
+
const pointer = new U64Coder().encode(BASE_RAW_SLICE_OFFSET);
|
33214
|
+
pointer.dynamicData = {
|
33215
|
+
0: concatWithDynamicData(value.map((v) => coder.encode(v)))
|
33216
|
+
};
|
33217
|
+
parts.push(pointer);
|
33218
|
+
parts.push(new U64Coder().encode(value.length));
|
33219
|
+
return concatWithDynamicData(parts);
|
33220
|
+
}
|
33221
|
+
decode(data, offset) {
|
33222
|
+
const dataBytes = data.slice(offset);
|
33223
|
+
const internalCoder = new ArrayCoder(
|
33224
|
+
new NumberCoder("u8", { isSmallBytes: true }),
|
33225
|
+
dataBytes.length
|
33226
|
+
);
|
33227
|
+
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
33228
|
+
return [decodedValue, offset + dataBytes.length];
|
33229
|
+
}
|
33230
|
+
};
|
33231
|
+
var _getPaddedData2;
|
33232
|
+
var getPaddedData_fn2;
|
33233
|
+
var StdStringCoder = class extends Coder {
|
33234
|
+
constructor() {
|
33235
|
+
super("struct", "struct String", 1);
|
33236
|
+
__privateAdd2(this, _getPaddedData2);
|
33237
|
+
}
|
33238
|
+
encode(value) {
|
33239
|
+
const parts = [];
|
33240
|
+
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
33241
|
+
const data = __privateMethod2(this, _getPaddedData2, getPaddedData_fn2).call(this, value);
|
33242
|
+
pointer.dynamicData = {
|
33243
|
+
0: concatWithDynamicData([data])
|
33244
|
+
};
|
33245
|
+
parts.push(pointer);
|
33246
|
+
parts.push(new U64Coder().encode(data.byteLength));
|
33247
|
+
parts.push(new U64Coder().encode(value.length));
|
33248
|
+
return concatWithDynamicData(parts);
|
33249
|
+
}
|
33250
|
+
decode(data, offset) {
|
33251
|
+
if (data.length < this.encodedLength) {
|
33252
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string data size.`);
|
33253
|
+
}
|
33254
|
+
const len = data.slice(16, 24);
|
33255
|
+
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
33256
|
+
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
33257
|
+
if (byteData.length !== encodedLength) {
|
33258
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string byte data size.`);
|
33259
|
+
}
|
33260
|
+
const value = toUtf8String(byteData);
|
33261
|
+
return [value, offset + BASE_VECTOR_OFFSET];
|
33262
|
+
}
|
33263
|
+
};
|
33264
|
+
_getPaddedData2 = /* @__PURE__ */ new WeakSet();
|
33265
|
+
getPaddedData_fn2 = function(value) {
|
33266
|
+
const data = [toUtf8Bytes(value)];
|
33267
|
+
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
33268
|
+
if (paddingLength) {
|
33269
|
+
data.push(new Uint8Array(paddingLength));
|
33270
|
+
}
|
33271
|
+
return concat2(data);
|
33272
|
+
};
|
33273
|
+
__publicField3(StdStringCoder, "memorySize", 1);
|
33131
33274
|
var StringCoder = class extends Coder {
|
33132
33275
|
length;
|
33133
33276
|
#paddingLength;
|
@@ -33159,31 +33302,6 @@ spurious results.`);
|
|
33159
33302
|
return [value, offset + this.length + padding];
|
33160
33303
|
}
|
33161
33304
|
};
|
33162
|
-
var OptionCoder = class extends EnumCoder {
|
33163
|
-
encode(value) {
|
33164
|
-
const result = super.encode(this.toSwayOption(value));
|
33165
|
-
return result;
|
33166
|
-
}
|
33167
|
-
toSwayOption(input) {
|
33168
|
-
if (input !== void 0) {
|
33169
|
-
return { Some: input };
|
33170
|
-
}
|
33171
|
-
return { None: [] };
|
33172
|
-
}
|
33173
|
-
decode(data, offset) {
|
33174
|
-
if (data.length < this.encodedLength - 1) {
|
33175
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
33176
|
-
}
|
33177
|
-
const [decoded, newOffset] = super.decode(data, offset);
|
33178
|
-
return [this.toOption(decoded), newOffset];
|
33179
|
-
}
|
33180
|
-
toOption(output4) {
|
33181
|
-
if (output4 && "Some" in output4) {
|
33182
|
-
return output4.Some;
|
33183
|
-
}
|
33184
|
-
return void 0;
|
33185
|
-
}
|
33186
|
-
};
|
33187
33305
|
var StructCoder = class extends Coder {
|
33188
33306
|
name;
|
33189
33307
|
coders;
|
@@ -33308,122 +33426,6 @@ spurious results.`);
|
|
33308
33426
|
];
|
33309
33427
|
}
|
33310
33428
|
};
|
33311
|
-
var _getPaddedData;
|
33312
|
-
var getPaddedData_fn;
|
33313
|
-
var ByteCoder = class extends Coder {
|
33314
|
-
constructor() {
|
33315
|
-
super("struct", "struct Bytes", BASE_VECTOR_OFFSET);
|
33316
|
-
__privateAdd2(this, _getPaddedData);
|
33317
|
-
}
|
33318
|
-
encode(value) {
|
33319
|
-
if (!Array.isArray(value)) {
|
33320
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
33321
|
-
}
|
33322
|
-
const parts = [];
|
33323
|
-
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
33324
|
-
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
33325
|
-
pointer.dynamicData = {
|
33326
|
-
0: concatWithDynamicData([data])
|
33327
|
-
};
|
33328
|
-
parts.push(pointer);
|
33329
|
-
parts.push(new U64Coder().encode(data.byteLength));
|
33330
|
-
parts.push(new U64Coder().encode(value.length));
|
33331
|
-
return concatWithDynamicData(parts);
|
33332
|
-
}
|
33333
|
-
decode(data, offset) {
|
33334
|
-
if (data.length < BASE_VECTOR_OFFSET) {
|
33335
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid byte data size.`);
|
33336
|
-
}
|
33337
|
-
const len = data.slice(16, 24);
|
33338
|
-
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
33339
|
-
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
33340
|
-
if (byteData.length !== encodedLength) {
|
33341
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid bytes byte data size.`);
|
33342
|
-
}
|
33343
|
-
return [byteData, offset + BASE_VECTOR_OFFSET];
|
33344
|
-
}
|
33345
|
-
};
|
33346
|
-
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
33347
|
-
getPaddedData_fn = function(value) {
|
33348
|
-
const data = [Uint8Array.from(value)];
|
33349
|
-
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
33350
|
-
if (paddingLength) {
|
33351
|
-
data.push(new Uint8Array(paddingLength));
|
33352
|
-
}
|
33353
|
-
return concat2(data);
|
33354
|
-
};
|
33355
|
-
__publicField3(ByteCoder, "memorySize", 1);
|
33356
|
-
var RawSliceCoder = class extends Coder {
|
33357
|
-
constructor() {
|
33358
|
-
super("raw untyped slice", "raw untyped slice", BASE_RAW_SLICE_OFFSET);
|
33359
|
-
}
|
33360
|
-
encode(value) {
|
33361
|
-
if (!Array.isArray(value)) {
|
33362
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
33363
|
-
}
|
33364
|
-
const parts = [];
|
33365
|
-
const coder = new NumberCoder("u8", { isSmallBytes: true });
|
33366
|
-
const pointer = new U64Coder().encode(BASE_RAW_SLICE_OFFSET);
|
33367
|
-
pointer.dynamicData = {
|
33368
|
-
0: concatWithDynamicData(value.map((v) => coder.encode(v)))
|
33369
|
-
};
|
33370
|
-
parts.push(pointer);
|
33371
|
-
parts.push(new U64Coder().encode(value.length));
|
33372
|
-
return concatWithDynamicData(parts);
|
33373
|
-
}
|
33374
|
-
decode(data, offset) {
|
33375
|
-
const dataBytes = data.slice(offset);
|
33376
|
-
const internalCoder = new ArrayCoder(
|
33377
|
-
new NumberCoder("u8", { isSmallBytes: true }),
|
33378
|
-
dataBytes.length
|
33379
|
-
);
|
33380
|
-
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
33381
|
-
return [decodedValue, offset + dataBytes.length];
|
33382
|
-
}
|
33383
|
-
};
|
33384
|
-
var _getPaddedData2;
|
33385
|
-
var getPaddedData_fn2;
|
33386
|
-
var StdStringCoder = class extends Coder {
|
33387
|
-
constructor() {
|
33388
|
-
super("struct", "struct String", 1);
|
33389
|
-
__privateAdd2(this, _getPaddedData2);
|
33390
|
-
}
|
33391
|
-
encode(value) {
|
33392
|
-
const parts = [];
|
33393
|
-
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
33394
|
-
const data = __privateMethod2(this, _getPaddedData2, getPaddedData_fn2).call(this, value);
|
33395
|
-
pointer.dynamicData = {
|
33396
|
-
0: concatWithDynamicData([data])
|
33397
|
-
};
|
33398
|
-
parts.push(pointer);
|
33399
|
-
parts.push(new U64Coder().encode(data.byteLength));
|
33400
|
-
parts.push(new U64Coder().encode(value.length));
|
33401
|
-
return concatWithDynamicData(parts);
|
33402
|
-
}
|
33403
|
-
decode(data, offset) {
|
33404
|
-
if (data.length < this.encodedLength) {
|
33405
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string data size.`);
|
33406
|
-
}
|
33407
|
-
const len = data.slice(16, 24);
|
33408
|
-
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
33409
|
-
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
33410
|
-
if (byteData.length !== encodedLength) {
|
33411
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string byte data size.`);
|
33412
|
-
}
|
33413
|
-
const value = toUtf8String(byteData);
|
33414
|
-
return [value, offset + BASE_VECTOR_OFFSET];
|
33415
|
-
}
|
33416
|
-
};
|
33417
|
-
_getPaddedData2 = /* @__PURE__ */ new WeakSet();
|
33418
|
-
getPaddedData_fn2 = function(value) {
|
33419
|
-
const data = [toUtf8Bytes(value)];
|
33420
|
-
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
33421
|
-
if (paddingLength) {
|
33422
|
-
data.push(new Uint8Array(paddingLength));
|
33423
|
-
}
|
33424
|
-
return concat2(data);
|
33425
|
-
};
|
33426
|
-
__publicField3(StdStringCoder, "memorySize", 1);
|
33427
33429
|
var BooleanCoder2 = class extends Coder {
|
33428
33430
|
constructor() {
|
33429
33431
|
super("boolean", "boolean", 1);
|
@@ -35282,6 +35284,242 @@ spurious results.`);
|
|
35282
35284
|
}
|
35283
35285
|
};
|
35284
35286
|
|
35287
|
+
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/utils.js
|
35288
|
+
var utils_exports = {};
|
35289
|
+
__export(utils_exports, {
|
35290
|
+
bitGet: () => bitGet,
|
35291
|
+
bitLen: () => bitLen,
|
35292
|
+
bitMask: () => bitMask,
|
35293
|
+
bitSet: () => bitSet,
|
35294
|
+
bytesToHex: () => bytesToHex2,
|
35295
|
+
bytesToNumberBE: () => bytesToNumberBE,
|
35296
|
+
bytesToNumberLE: () => bytesToNumberLE,
|
35297
|
+
concatBytes: () => concatBytes3,
|
35298
|
+
createHmacDrbg: () => createHmacDrbg,
|
35299
|
+
ensureBytes: () => ensureBytes,
|
35300
|
+
equalBytes: () => equalBytes,
|
35301
|
+
hexToBytes: () => hexToBytes2,
|
35302
|
+
hexToNumber: () => hexToNumber,
|
35303
|
+
isBytes: () => isBytes,
|
35304
|
+
numberToBytesBE: () => numberToBytesBE,
|
35305
|
+
numberToBytesLE: () => numberToBytesLE,
|
35306
|
+
numberToHexUnpadded: () => numberToHexUnpadded,
|
35307
|
+
numberToVarBytesBE: () => numberToVarBytesBE,
|
35308
|
+
utf8ToBytes: () => utf8ToBytes3,
|
35309
|
+
validateObject: () => validateObject
|
35310
|
+
});
|
35311
|
+
var _0n3 = BigInt(0);
|
35312
|
+
var _1n3 = BigInt(1);
|
35313
|
+
var _2n3 = BigInt(2);
|
35314
|
+
function isBytes(a) {
|
35315
|
+
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
35316
|
+
}
|
35317
|
+
var hexes3 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
35318
|
+
function bytesToHex2(bytes4) {
|
35319
|
+
if (!isBytes(bytes4))
|
35320
|
+
throw new Error("Uint8Array expected");
|
35321
|
+
let hex = "";
|
35322
|
+
for (let i = 0; i < bytes4.length; i++) {
|
35323
|
+
hex += hexes3[bytes4[i]];
|
35324
|
+
}
|
35325
|
+
return hex;
|
35326
|
+
}
|
35327
|
+
function numberToHexUnpadded(num) {
|
35328
|
+
const hex = num.toString(16);
|
35329
|
+
return hex.length & 1 ? `0${hex}` : hex;
|
35330
|
+
}
|
35331
|
+
function hexToNumber(hex) {
|
35332
|
+
if (typeof hex !== "string")
|
35333
|
+
throw new Error("hex string expected, got " + typeof hex);
|
35334
|
+
return BigInt(hex === "" ? "0" : `0x${hex}`);
|
35335
|
+
}
|
35336
|
+
var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };
|
35337
|
+
function asciiToBase16(char) {
|
35338
|
+
if (char >= asciis._0 && char <= asciis._9)
|
35339
|
+
return char - asciis._0;
|
35340
|
+
if (char >= asciis._A && char <= asciis._F)
|
35341
|
+
return char - (asciis._A - 10);
|
35342
|
+
if (char >= asciis._a && char <= asciis._f)
|
35343
|
+
return char - (asciis._a - 10);
|
35344
|
+
return;
|
35345
|
+
}
|
35346
|
+
function hexToBytes2(hex) {
|
35347
|
+
if (typeof hex !== "string")
|
35348
|
+
throw new Error("hex string expected, got " + typeof hex);
|
35349
|
+
const hl = hex.length;
|
35350
|
+
const al = hl / 2;
|
35351
|
+
if (hl % 2)
|
35352
|
+
throw new Error("padded hex string expected, got unpadded hex of length " + hl);
|
35353
|
+
const array = new Uint8Array(al);
|
35354
|
+
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
35355
|
+
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
35356
|
+
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
35357
|
+
if (n1 === void 0 || n2 === void 0) {
|
35358
|
+
const char = hex[hi] + hex[hi + 1];
|
35359
|
+
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
35360
|
+
}
|
35361
|
+
array[ai] = n1 * 16 + n2;
|
35362
|
+
}
|
35363
|
+
return array;
|
35364
|
+
}
|
35365
|
+
function bytesToNumberBE(bytes4) {
|
35366
|
+
return hexToNumber(bytesToHex2(bytes4));
|
35367
|
+
}
|
35368
|
+
function bytesToNumberLE(bytes4) {
|
35369
|
+
if (!isBytes(bytes4))
|
35370
|
+
throw new Error("Uint8Array expected");
|
35371
|
+
return hexToNumber(bytesToHex2(Uint8Array.from(bytes4).reverse()));
|
35372
|
+
}
|
35373
|
+
function numberToBytesBE(n, len) {
|
35374
|
+
return hexToBytes2(n.toString(16).padStart(len * 2, "0"));
|
35375
|
+
}
|
35376
|
+
function numberToBytesLE(n, len) {
|
35377
|
+
return numberToBytesBE(n, len).reverse();
|
35378
|
+
}
|
35379
|
+
function numberToVarBytesBE(n) {
|
35380
|
+
return hexToBytes2(numberToHexUnpadded(n));
|
35381
|
+
}
|
35382
|
+
function ensureBytes(title, hex, expectedLength) {
|
35383
|
+
let res;
|
35384
|
+
if (typeof hex === "string") {
|
35385
|
+
try {
|
35386
|
+
res = hexToBytes2(hex);
|
35387
|
+
} catch (e) {
|
35388
|
+
throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
|
35389
|
+
}
|
35390
|
+
} else if (isBytes(hex)) {
|
35391
|
+
res = Uint8Array.from(hex);
|
35392
|
+
} else {
|
35393
|
+
throw new Error(`${title} must be hex string or Uint8Array`);
|
35394
|
+
}
|
35395
|
+
const len = res.length;
|
35396
|
+
if (typeof expectedLength === "number" && len !== expectedLength)
|
35397
|
+
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
35398
|
+
return res;
|
35399
|
+
}
|
35400
|
+
function concatBytes3(...arrays) {
|
35401
|
+
let sum = 0;
|
35402
|
+
for (let i = 0; i < arrays.length; i++) {
|
35403
|
+
const a = arrays[i];
|
35404
|
+
if (!isBytes(a))
|
35405
|
+
throw new Error("Uint8Array expected");
|
35406
|
+
sum += a.length;
|
35407
|
+
}
|
35408
|
+
let res = new Uint8Array(sum);
|
35409
|
+
let pad3 = 0;
|
35410
|
+
for (let i = 0; i < arrays.length; i++) {
|
35411
|
+
const a = arrays[i];
|
35412
|
+
res.set(a, pad3);
|
35413
|
+
pad3 += a.length;
|
35414
|
+
}
|
35415
|
+
return res;
|
35416
|
+
}
|
35417
|
+
function equalBytes(a, b) {
|
35418
|
+
if (a.length !== b.length)
|
35419
|
+
return false;
|
35420
|
+
let diff = 0;
|
35421
|
+
for (let i = 0; i < a.length; i++)
|
35422
|
+
diff |= a[i] ^ b[i];
|
35423
|
+
return diff === 0;
|
35424
|
+
}
|
35425
|
+
function utf8ToBytes3(str) {
|
35426
|
+
if (typeof str !== "string")
|
35427
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
35428
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
35429
|
+
}
|
35430
|
+
function bitLen(n) {
|
35431
|
+
let len;
|
35432
|
+
for (len = 0; n > _0n3; n >>= _1n3, len += 1)
|
35433
|
+
;
|
35434
|
+
return len;
|
35435
|
+
}
|
35436
|
+
function bitGet(n, pos) {
|
35437
|
+
return n >> BigInt(pos) & _1n3;
|
35438
|
+
}
|
35439
|
+
var bitSet = (n, pos, value) => {
|
35440
|
+
return n | (value ? _1n3 : _0n3) << BigInt(pos);
|
35441
|
+
};
|
35442
|
+
var bitMask = (n) => (_2n3 << BigInt(n - 1)) - _1n3;
|
35443
|
+
var u8n = (data) => new Uint8Array(data);
|
35444
|
+
var u8fr = (arr) => Uint8Array.from(arr);
|
35445
|
+
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
35446
|
+
if (typeof hashLen !== "number" || hashLen < 2)
|
35447
|
+
throw new Error("hashLen must be a number");
|
35448
|
+
if (typeof qByteLen !== "number" || qByteLen < 2)
|
35449
|
+
throw new Error("qByteLen must be a number");
|
35450
|
+
if (typeof hmacFn !== "function")
|
35451
|
+
throw new Error("hmacFn must be a function");
|
35452
|
+
let v = u8n(hashLen);
|
35453
|
+
let k = u8n(hashLen);
|
35454
|
+
let i = 0;
|
35455
|
+
const reset = () => {
|
35456
|
+
v.fill(1);
|
35457
|
+
k.fill(0);
|
35458
|
+
i = 0;
|
35459
|
+
};
|
35460
|
+
const h = (...b) => hmacFn(k, v, ...b);
|
35461
|
+
const reseed = (seed = u8n()) => {
|
35462
|
+
k = h(u8fr([0]), seed);
|
35463
|
+
v = h();
|
35464
|
+
if (seed.length === 0)
|
35465
|
+
return;
|
35466
|
+
k = h(u8fr([1]), seed);
|
35467
|
+
v = h();
|
35468
|
+
};
|
35469
|
+
const gen3 = () => {
|
35470
|
+
if (i++ >= 1e3)
|
35471
|
+
throw new Error("drbg: tried 1000 values");
|
35472
|
+
let len = 0;
|
35473
|
+
const out = [];
|
35474
|
+
while (len < qByteLen) {
|
35475
|
+
v = h();
|
35476
|
+
const sl = v.slice();
|
35477
|
+
out.push(sl);
|
35478
|
+
len += v.length;
|
35479
|
+
}
|
35480
|
+
return concatBytes3(...out);
|
35481
|
+
};
|
35482
|
+
const genUntil = (seed, pred) => {
|
35483
|
+
reset();
|
35484
|
+
reseed(seed);
|
35485
|
+
let res = void 0;
|
35486
|
+
while (!(res = pred(gen3())))
|
35487
|
+
reseed();
|
35488
|
+
reset();
|
35489
|
+
return res;
|
35490
|
+
};
|
35491
|
+
return genUntil;
|
35492
|
+
}
|
35493
|
+
var validatorFns = {
|
35494
|
+
bigint: (val) => typeof val === "bigint",
|
35495
|
+
function: (val) => typeof val === "function",
|
35496
|
+
boolean: (val) => typeof val === "boolean",
|
35497
|
+
string: (val) => typeof val === "string",
|
35498
|
+
stringOrUint8Array: (val) => typeof val === "string" || isBytes(val),
|
35499
|
+
isSafeInteger: (val) => Number.isSafeInteger(val),
|
35500
|
+
array: (val) => Array.isArray(val),
|
35501
|
+
field: (val, object) => object.Fp.isValid(val),
|
35502
|
+
hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
|
35503
|
+
};
|
35504
|
+
function validateObject(object, validators, optValidators = {}) {
|
35505
|
+
const checkField = (fieldName, type3, isOptional) => {
|
35506
|
+
const checkVal = validatorFns[type3];
|
35507
|
+
if (typeof checkVal !== "function")
|
35508
|
+
throw new Error(`Invalid validator "${type3}", expected function`);
|
35509
|
+
const val = object[fieldName];
|
35510
|
+
if (isOptional && val === void 0)
|
35511
|
+
return;
|
35512
|
+
if (!checkVal(val, object)) {
|
35513
|
+
throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type3}`);
|
35514
|
+
}
|
35515
|
+
};
|
35516
|
+
for (const [fieldName, type3] of Object.entries(validators))
|
35517
|
+
checkField(fieldName, type3, false);
|
35518
|
+
for (const [fieldName, type3] of Object.entries(optValidators))
|
35519
|
+
checkField(fieldName, type3, true);
|
35520
|
+
return object;
|
35521
|
+
}
|
35522
|
+
|
35285
35523
|
// src/providers/provider.ts
|
35286
35524
|
var import_graphql_request = __toESM(require_dist2());
|
35287
35525
|
|
@@ -40476,7 +40714,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40476
40714
|
*
|
40477
40715
|
* @param quantities - CoinQuantity Array.
|
40478
40716
|
*/
|
40479
|
-
fundWithFakeUtxos(quantities) {
|
40717
|
+
fundWithFakeUtxos(quantities, resourcesOwner) {
|
40480
40718
|
let idCounter = 0;
|
40481
40719
|
const generateId = () => {
|
40482
40720
|
const counterString = String(idCounter++);
|
@@ -40500,7 +40738,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40500
40738
|
id: generateId(),
|
40501
40739
|
amount: quantity,
|
40502
40740
|
assetId,
|
40503
|
-
owner: Address.fromRandom(),
|
40741
|
+
owner: resourcesOwner || Address.fromRandom(),
|
40504
40742
|
maturity: 0,
|
40505
40743
|
blockCreated: bn(1),
|
40506
40744
|
txCreatedIdx: bn(1)
|
@@ -40533,19 +40771,29 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40533
40771
|
toJSON() {
|
40534
40772
|
return normalizeJSON(this);
|
40535
40773
|
}
|
40536
|
-
|
40537
|
-
|
40538
|
-
|
40539
|
-
|
40540
|
-
|
40541
|
-
|
40542
|
-
|
40543
|
-
|
40544
|
-
|
40545
|
-
|
40546
|
-
|
40547
|
-
|
40548
|
-
|
40774
|
+
updatePredicateInputs(inputs) {
|
40775
|
+
this.inputs.forEach((i) => {
|
40776
|
+
let correspondingInput;
|
40777
|
+
switch (i.type) {
|
40778
|
+
case InputType.Contract:
|
40779
|
+
return;
|
40780
|
+
case InputType.Coin:
|
40781
|
+
correspondingInput = inputs.find((x) => x.type === InputType.Coin && x.owner === i.owner);
|
40782
|
+
break;
|
40783
|
+
case InputType.Message:
|
40784
|
+
correspondingInput = inputs.find(
|
40785
|
+
(x) => x.type === InputType.Message && x.sender === i.sender
|
40786
|
+
);
|
40787
|
+
break;
|
40788
|
+
default:
|
40789
|
+
break;
|
40790
|
+
}
|
40791
|
+
if (correspondingInput && "predicateGasUsed" in correspondingInput && bn(correspondingInput.predicateGasUsed).gt(0)) {
|
40792
|
+
i.predicate = correspondingInput.predicate;
|
40793
|
+
i.predicateData = correspondingInput.predicateData;
|
40794
|
+
i.predicateGasUsed = correspondingInput.predicateGasUsed;
|
40795
|
+
}
|
40796
|
+
});
|
40549
40797
|
}
|
40550
40798
|
};
|
40551
40799
|
|
@@ -42233,7 +42481,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42233
42481
|
async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
|
42234
42482
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
42235
42483
|
if (estimateTxDependencies) {
|
42236
|
-
|
42484
|
+
return this.estimateTxDependencies(transactionRequest);
|
42237
42485
|
}
|
42238
42486
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
42239
42487
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
@@ -42252,6 +42500,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42252
42500
|
* @returns A promise that resolves to the estimated transaction request object.
|
42253
42501
|
*/
|
42254
42502
|
async estimatePredicates(transactionRequest) {
|
42503
|
+
const shouldEstimatePredicates = Boolean(
|
42504
|
+
transactionRequest.inputs.find(
|
42505
|
+
(input) => "predicate" in input && input.predicate && !equalBytes(arrayify(input.predicate), arrayify("0x")) && new BN(input.predicateGasUsed).isZero()
|
42506
|
+
)
|
42507
|
+
);
|
42508
|
+
if (!shouldEstimatePredicates) {
|
42509
|
+
return transactionRequest;
|
42510
|
+
}
|
42255
42511
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
42256
42512
|
const response = await this.operations.estimatePredicates({
|
42257
42513
|
encodedTransaction
|
@@ -42282,34 +42538,33 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42282
42538
|
* @returns A promise.
|
42283
42539
|
*/
|
42284
42540
|
async estimateTxDependencies(transactionRequest) {
|
42285
|
-
let missingOutputVariableCount = 0;
|
42286
|
-
let missingOutputContractIdsCount = 0;
|
42287
|
-
let tries = 0;
|
42288
42541
|
if (transactionRequest.type === TransactionType.Create) {
|
42289
|
-
return
|
42290
|
-
|
42291
|
-
|
42292
|
-
if (txRequest.hasPredicateInput()) {
|
42293
|
-
txRequest = await this.estimatePredicates(txRequest);
|
42542
|
+
return {
|
42543
|
+
receipts: []
|
42544
|
+
};
|
42294
42545
|
}
|
42295
|
-
|
42546
|
+
await this.estimatePredicates(transactionRequest);
|
42547
|
+
let receipts = [];
|
42548
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
42296
42549
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
42297
|
-
encodedTransaction: hexlify(
|
42550
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
42298
42551
|
utxoValidation: false
|
42299
42552
|
});
|
42300
|
-
|
42553
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
42301
42554
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
42302
|
-
|
42303
|
-
|
42304
|
-
|
42305
|
-
|
42555
|
+
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
42556
|
+
if (hasMissingOutputs) {
|
42557
|
+
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
42558
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
42559
|
+
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
42560
|
+
});
|
42561
|
+
} else {
|
42562
|
+
break;
|
42306
42563
|
}
|
42307
|
-
txRequest.addVariableOutputs(missingOutputVariableCount);
|
42308
|
-
missingOutputContractIds.forEach(
|
42309
|
-
({ contractId }) => txRequest.addContractInputAndOutput(Address.fromString(contractId))
|
42310
|
-
);
|
42311
|
-
tries += 1;
|
42312
42564
|
}
|
42565
|
+
return {
|
42566
|
+
receipts
|
42567
|
+
};
|
42313
42568
|
}
|
42314
42569
|
/**
|
42315
42570
|
* Executes a signed transaction without applying the states changes
|
@@ -42324,7 +42579,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42324
42579
|
async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
42325
42580
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
42326
42581
|
if (estimateTxDependencies) {
|
42327
|
-
|
42582
|
+
return this.estimateTxDependencies(transactionRequest);
|
42328
42583
|
}
|
42329
42584
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
42330
42585
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
@@ -42351,36 +42606,38 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42351
42606
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
42352
42607
|
* @returns A promise that resolves to the transaction cost object.
|
42353
42608
|
*/
|
42354
|
-
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
42355
|
-
|
42609
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
42610
|
+
estimateTxDependencies = true,
|
42611
|
+
estimatePredicates = true,
|
42612
|
+
resourcesOwner
|
42613
|
+
} = {}) {
|
42614
|
+
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
42356
42615
|
const chainInfo = this.getChain();
|
42357
42616
|
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
42358
|
-
const gasPrice = max(
|
42359
|
-
const isScriptTransaction =
|
42360
|
-
|
42617
|
+
const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
42618
|
+
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
42619
|
+
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
42620
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42621
|
+
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
42622
|
+
if (estimatePredicates) {
|
42361
42623
|
if (isScriptTransaction) {
|
42362
|
-
|
42624
|
+
txRequestClone.gasLimit = bn(0);
|
42625
|
+
}
|
42626
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
42627
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
42363
42628
|
}
|
42364
|
-
await this.estimatePredicates(
|
42629
|
+
await this.estimatePredicates(txRequestClone);
|
42365
42630
|
}
|
42366
|
-
const minGas =
|
42367
|
-
const maxGas =
|
42368
|
-
const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
|
42369
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
42370
|
-
transactionRequest.fundWithFakeUtxos(allQuantities);
|
42371
|
-
let gasUsed = minGas;
|
42631
|
+
const minGas = txRequestClone.calculateMinGas(chainInfo);
|
42632
|
+
const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
|
42372
42633
|
let receipts = [];
|
42373
|
-
if (isScriptTransaction) {
|
42374
|
-
|
42375
|
-
|
42376
|
-
const result = await this.
|
42377
|
-
estimateTxDependencies
|
42378
|
-
});
|
42634
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
42635
|
+
txRequestClone.gasPrice = bn(0);
|
42636
|
+
txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
|
42637
|
+
const result = await this.estimateTxDependencies(txRequestClone);
|
42379
42638
|
receipts = result.receipts;
|
42380
|
-
gasUsed = getGasUsedFromReceipts(receipts);
|
42381
|
-
} else {
|
42382
|
-
gasUsed = minGas;
|
42383
42639
|
}
|
42640
|
+
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
42384
42641
|
const usedFee = calculatePriceWithFactor(
|
42385
42642
|
gasUsed,
|
42386
42643
|
gasPrice,
|
@@ -42398,7 +42655,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42398
42655
|
maxGas,
|
42399
42656
|
usedFee,
|
42400
42657
|
minFee,
|
42401
|
-
maxFee
|
42658
|
+
maxFee,
|
42659
|
+
estimatedInputs: txRequestClone.inputs,
|
42660
|
+
estimatedOutputs: txRequestClone.outputs
|
42402
42661
|
};
|
42403
42662
|
}
|
42404
42663
|
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
@@ -42788,6 +43047,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42788
43047
|
});
|
42789
43048
|
return bn(latestBlockHeight);
|
42790
43049
|
}
|
43050
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
43051
|
+
async getTransactionResponse(transactionId) {
|
43052
|
+
return new TransactionResponse2(transactionId, this);
|
43053
|
+
}
|
42791
43054
|
};
|
42792
43055
|
var Provider = _Provider;
|
42793
43056
|
_cacheInputs = new WeakSet();
|
@@ -42896,6 +43159,127 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42896
43159
|
};
|
42897
43160
|
}
|
42898
43161
|
|
43162
|
+
// src/providers/chains.ts
|
43163
|
+
var CHAIN_IDS = {
|
43164
|
+
eth: {
|
43165
|
+
sepolia: 11155111,
|
43166
|
+
foundry: 31337
|
43167
|
+
},
|
43168
|
+
fuel: {
|
43169
|
+
beta5: 0,
|
43170
|
+
devnet: 10
|
43171
|
+
}
|
43172
|
+
};
|
43173
|
+
|
43174
|
+
// src/providers/assets/utils/network.ts
|
43175
|
+
var getDefaultChainId = (networkType) => {
|
43176
|
+
if (networkType === "ethereum") {
|
43177
|
+
return CHAIN_IDS.eth.sepolia;
|
43178
|
+
}
|
43179
|
+
if (networkType === "fuel") {
|
43180
|
+
return CHAIN_IDS.fuel.beta5;
|
43181
|
+
}
|
43182
|
+
return void 0;
|
43183
|
+
};
|
43184
|
+
var getAssetNetwork = ({
|
43185
|
+
asset,
|
43186
|
+
chainId,
|
43187
|
+
networkType
|
43188
|
+
}) => {
|
43189
|
+
const network = asset.networks.find(
|
43190
|
+
(item) => item.chainId === chainId && item.type === networkType
|
43191
|
+
);
|
43192
|
+
return network;
|
43193
|
+
};
|
43194
|
+
var getAssetWithNetwork = ({
|
43195
|
+
asset,
|
43196
|
+
chainId,
|
43197
|
+
networkType
|
43198
|
+
}) => {
|
43199
|
+
const { networks: _, ...assetRest } = asset;
|
43200
|
+
const chainIdToUse = chainId ?? getDefaultChainId(networkType);
|
43201
|
+
if (chainIdToUse === void 0) {
|
43202
|
+
return void 0;
|
43203
|
+
}
|
43204
|
+
const assetNetwork = getAssetNetwork({
|
43205
|
+
asset,
|
43206
|
+
chainId: chainIdToUse,
|
43207
|
+
networkType
|
43208
|
+
});
|
43209
|
+
if (!assetNetwork) {
|
43210
|
+
return void 0;
|
43211
|
+
}
|
43212
|
+
return {
|
43213
|
+
...assetRest,
|
43214
|
+
...assetNetwork
|
43215
|
+
};
|
43216
|
+
};
|
43217
|
+
var getAssetEth = (asset, chainId) => getAssetWithNetwork({
|
43218
|
+
asset,
|
43219
|
+
networkType: "ethereum",
|
43220
|
+
chainId
|
43221
|
+
});
|
43222
|
+
var getAssetFuel = (asset, chainId) => getAssetWithNetwork({
|
43223
|
+
asset,
|
43224
|
+
networkType: "fuel",
|
43225
|
+
chainId
|
43226
|
+
});
|
43227
|
+
|
43228
|
+
// src/providers/assets/utils/url.ts
|
43229
|
+
var DELIMITER_PATH = "/";
|
43230
|
+
var trimRegex = /^\/|\/$/g;
|
43231
|
+
var trimPath = (path = "") => path.replace(trimRegex, "");
|
43232
|
+
function urlJoin(baseUrl, ...paths) {
|
43233
|
+
const hasBaseUrl = baseUrl !== null && baseUrl !== void 0;
|
43234
|
+
const rootPath = baseUrl?.[0] === "/" && baseUrl.length > 1;
|
43235
|
+
const allPaths = [baseUrl, ...paths].filter(Boolean).map(trimPath);
|
43236
|
+
if (rootPath && hasBaseUrl) {
|
43237
|
+
allPaths.unshift("");
|
43238
|
+
}
|
43239
|
+
return allPaths.join(DELIMITER_PATH);
|
43240
|
+
}
|
43241
|
+
|
43242
|
+
// src/providers/assets/utils/resolveIconPaths.ts
|
43243
|
+
function resolveIconPaths(assets2, basePath = "./") {
|
43244
|
+
return assets2.map((asset) => ({
|
43245
|
+
...asset,
|
43246
|
+
icon: urlJoin(basePath, asset.icon)
|
43247
|
+
}));
|
43248
|
+
}
|
43249
|
+
|
43250
|
+
// src/providers/assets/index.ts
|
43251
|
+
var assets = [
|
43252
|
+
{
|
43253
|
+
name: "Ethereum",
|
43254
|
+
symbol: "ETH",
|
43255
|
+
icon: "eth.svg",
|
43256
|
+
networks: [
|
43257
|
+
{
|
43258
|
+
type: "ethereum",
|
43259
|
+
chainId: CHAIN_IDS.eth.sepolia,
|
43260
|
+
decimals: 18
|
43261
|
+
},
|
43262
|
+
{
|
43263
|
+
type: "ethereum",
|
43264
|
+
chainId: CHAIN_IDS.eth.foundry,
|
43265
|
+
decimals: 18
|
43266
|
+
},
|
43267
|
+
{
|
43268
|
+
type: "fuel",
|
43269
|
+
chainId: CHAIN_IDS.fuel.beta5,
|
43270
|
+
decimals: 9,
|
43271
|
+
assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
43272
|
+
},
|
43273
|
+
{
|
43274
|
+
type: "fuel",
|
43275
|
+
chainId: CHAIN_IDS.fuel.devnet,
|
43276
|
+
decimals: 9,
|
43277
|
+
assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
43278
|
+
}
|
43279
|
+
]
|
43280
|
+
}
|
43281
|
+
];
|
43282
|
+
|
42899
43283
|
// src/utils/formatTransferToContractScriptData.ts
|
42900
43284
|
var asm = __toESM(require_node());
|
42901
43285
|
var formatTransferToContractScriptData = (params) => {
|
@@ -42939,15 +43323,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42939
43323
|
* The provider used to interact with the network.
|
42940
43324
|
*/
|
42941
43325
|
_provider;
|
43326
|
+
_connector;
|
42942
43327
|
/**
|
42943
43328
|
* Creates a new Account instance.
|
42944
43329
|
*
|
42945
43330
|
* @param address - The address of the account.
|
42946
43331
|
* @param provider - A Provider instance (optional).
|
42947
43332
|
*/
|
42948
|
-
constructor(address, provider) {
|
43333
|
+
constructor(address, provider, connector) {
|
42949
43334
|
super();
|
42950
43335
|
this._provider = provider;
|
43336
|
+
this._connector = connector;
|
42951
43337
|
this.address = Address.fromDynamicInput(address);
|
42952
43338
|
}
|
42953
43339
|
/**
|
@@ -43153,7 +43539,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43153
43539
|
const params = { gasPrice: minGasPrice, ...txParams };
|
43154
43540
|
const request = new ScriptTransactionRequest(params);
|
43155
43541
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
43156
|
-
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request
|
43542
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
43543
|
+
estimateTxDependencies: true,
|
43544
|
+
resourcesOwner: this
|
43545
|
+
});
|
43157
43546
|
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
43158
43547
|
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
43159
43548
|
this.validateGas({
|
@@ -43163,6 +43552,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43163
43552
|
minGasPrice
|
43164
43553
|
});
|
43165
43554
|
await this.fund(request, requiredQuantities, maxFee);
|
43555
|
+
request.updatePredicateInputs(estimatedInputs);
|
43166
43556
|
return request;
|
43167
43557
|
}
|
43168
43558
|
/**
|
@@ -43176,7 +43566,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43176
43566
|
*/
|
43177
43567
|
async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
43178
43568
|
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
43179
|
-
return this.sendTransaction(request);
|
43569
|
+
return this.sendTransaction(request, { estimateTxDependencies: false });
|
43180
43570
|
}
|
43181
43571
|
/**
|
43182
43572
|
* Transfers coins to a contract address.
|
@@ -43255,17 +43645,30 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43255
43645
|
await this.fund(request, requiredQuantities, maxFee);
|
43256
43646
|
return this.sendTransaction(request);
|
43257
43647
|
}
|
43648
|
+
async signMessage(message) {
|
43649
|
+
if (!this._connector) {
|
43650
|
+
throw new FuelError(ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
43651
|
+
}
|
43652
|
+
return this._connector.signMessage(this.address.toString(), message);
|
43653
|
+
}
|
43258
43654
|
/**
|
43259
43655
|
* Sends a transaction to the network.
|
43260
43656
|
*
|
43261
43657
|
* @param transactionRequestLike - The transaction request to be sent.
|
43262
43658
|
* @returns A promise that resolves to the transaction response.
|
43263
43659
|
*/
|
43264
|
-
async sendTransaction(transactionRequestLike,
|
43660
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
43661
|
+
if (this._connector) {
|
43662
|
+
return this.provider.getTransactionResponse(
|
43663
|
+
await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
|
43664
|
+
);
|
43665
|
+
}
|
43265
43666
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
43266
|
-
|
43667
|
+
if (estimateTxDependencies) {
|
43668
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
43669
|
+
}
|
43267
43670
|
return this.provider.sendTransaction(transactionRequest, {
|
43268
|
-
|
43671
|
+
awaitExecution,
|
43269
43672
|
estimateTxDependencies: false
|
43270
43673
|
});
|
43271
43674
|
}
|
@@ -43275,9 +43678,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43275
43678
|
* @param transactionRequestLike - The transaction request to be simulated.
|
43276
43679
|
* @returns A promise that resolves to the call result.
|
43277
43680
|
*/
|
43278
|
-
async simulateTransaction(transactionRequestLike) {
|
43681
|
+
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
43279
43682
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
43280
|
-
|
43683
|
+
if (estimateTxDependencies) {
|
43684
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
43685
|
+
}
|
43281
43686
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
43282
43687
|
}
|
43283
43688
|
validateGas({
|
@@ -43306,11 +43711,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43306
43711
|
if (!Number.isSafeInteger(n) || n < 0)
|
43307
43712
|
throw new Error(`Wrong positive integer: ${n}`);
|
43308
43713
|
}
|
43309
|
-
function
|
43714
|
+
function isBytes2(a) {
|
43310
43715
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
43311
43716
|
}
|
43312
43717
|
function bytes3(b, ...lengths) {
|
43313
|
-
if (!
|
43718
|
+
if (!isBytes2(b))
|
43314
43719
|
throw new Error("Expected Uint8Array");
|
43315
43720
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
43316
43721
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
@@ -43340,7 +43745,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43340
43745
|
var crypto5 = nc2 && typeof nc2 === "object" && "webcrypto" in nc2 ? nc2.webcrypto : void 0;
|
43341
43746
|
|
43342
43747
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js
|
43343
|
-
function
|
43748
|
+
function isBytes3(a) {
|
43344
43749
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
43345
43750
|
}
|
43346
43751
|
var createView3 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
@@ -43348,23 +43753,23 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43348
43753
|
var isLE3 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
43349
43754
|
if (!isLE3)
|
43350
43755
|
throw new Error("Non little-endian hardware is not supported");
|
43351
|
-
function
|
43756
|
+
function utf8ToBytes4(str) {
|
43352
43757
|
if (typeof str !== "string")
|
43353
43758
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
43354
43759
|
return new Uint8Array(new TextEncoder().encode(str));
|
43355
43760
|
}
|
43356
43761
|
function toBytes4(data) {
|
43357
43762
|
if (typeof data === "string")
|
43358
|
-
data =
|
43359
|
-
if (!
|
43763
|
+
data = utf8ToBytes4(data);
|
43764
|
+
if (!isBytes3(data))
|
43360
43765
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
43361
43766
|
return data;
|
43362
43767
|
}
|
43363
|
-
function
|
43768
|
+
function concatBytes4(...arrays) {
|
43364
43769
|
let sum = 0;
|
43365
43770
|
for (let i = 0; i < arrays.length; i++) {
|
43366
43771
|
const a = arrays[i];
|
43367
|
-
if (!
|
43772
|
+
if (!isBytes3(a))
|
43368
43773
|
throw new Error("Uint8Array expected");
|
43369
43774
|
sum += a.length;
|
43370
43775
|
}
|
@@ -43578,313 +43983,77 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43578
43983
|
1541459225
|
43579
43984
|
]);
|
43580
43985
|
var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
|
43581
|
-
var SHA2562 = class extends SHA23 {
|
43582
|
-
constructor() {
|
43583
|
-
super(64, 32, 8, false);
|
43584
|
-
this.A = IV2[0] | 0;
|
43585
|
-
this.B = IV2[1] | 0;
|
43586
|
-
this.C = IV2[2] | 0;
|
43587
|
-
this.D = IV2[3] | 0;
|
43588
|
-
this.E = IV2[4] | 0;
|
43589
|
-
this.F = IV2[5] | 0;
|
43590
|
-
this.G = IV2[6] | 0;
|
43591
|
-
this.H = IV2[7] | 0;
|
43592
|
-
}
|
43593
|
-
get() {
|
43594
|
-
const { A, B, C, D, E, F, G, H } = this;
|
43595
|
-
return [A, B, C, D, E, F, G, H];
|
43596
|
-
}
|
43597
|
-
// prettier-ignore
|
43598
|
-
set(A, B, C, D, E, F, G, H) {
|
43599
|
-
this.A = A | 0;
|
43600
|
-
this.B = B | 0;
|
43601
|
-
this.C = C | 0;
|
43602
|
-
this.D = D | 0;
|
43603
|
-
this.E = E | 0;
|
43604
|
-
this.F = F | 0;
|
43605
|
-
this.G = G | 0;
|
43606
|
-
this.H = H | 0;
|
43607
|
-
}
|
43608
|
-
process(view, offset) {
|
43609
|
-
for (let i = 0; i < 16; i++, offset += 4)
|
43610
|
-
SHA256_W2[i] = view.getUint32(offset, false);
|
43611
|
-
for (let i = 16; i < 64; i++) {
|
43612
|
-
const W15 = SHA256_W2[i - 15];
|
43613
|
-
const W2 = SHA256_W2[i - 2];
|
43614
|
-
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
43615
|
-
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
43616
|
-
SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
|
43617
|
-
}
|
43618
|
-
let { A, B, C, D, E, F, G, H } = this;
|
43619
|
-
for (let i = 0; i < 64; i++) {
|
43620
|
-
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
43621
|
-
const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
|
43622
|
-
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
43623
|
-
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
43624
|
-
H = G;
|
43625
|
-
G = F;
|
43626
|
-
F = E;
|
43627
|
-
E = D + T1 | 0;
|
43628
|
-
D = C;
|
43629
|
-
C = B;
|
43630
|
-
B = A;
|
43631
|
-
A = T1 + T2 | 0;
|
43632
|
-
}
|
43633
|
-
A = A + this.A | 0;
|
43634
|
-
B = B + this.B | 0;
|
43635
|
-
C = C + this.C | 0;
|
43636
|
-
D = D + this.D | 0;
|
43637
|
-
E = E + this.E | 0;
|
43638
|
-
F = F + this.F | 0;
|
43639
|
-
G = G + this.G | 0;
|
43640
|
-
H = H + this.H | 0;
|
43641
|
-
this.set(A, B, C, D, E, F, G, H);
|
43642
|
-
}
|
43643
|
-
roundClean() {
|
43644
|
-
SHA256_W2.fill(0);
|
43645
|
-
}
|
43646
|
-
destroy() {
|
43647
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
43648
|
-
this.buffer.fill(0);
|
43649
|
-
}
|
43650
|
-
};
|
43651
|
-
var sha2563 = /* @__PURE__ */ wrapConstructor3(() => new SHA2562());
|
43652
|
-
|
43653
|
-
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/utils.js
|
43654
|
-
var utils_exports = {};
|
43655
|
-
__export(utils_exports, {
|
43656
|
-
bitGet: () => bitGet,
|
43657
|
-
bitLen: () => bitLen,
|
43658
|
-
bitMask: () => bitMask,
|
43659
|
-
bitSet: () => bitSet,
|
43660
|
-
bytesToHex: () => bytesToHex2,
|
43661
|
-
bytesToNumberBE: () => bytesToNumberBE,
|
43662
|
-
bytesToNumberLE: () => bytesToNumberLE,
|
43663
|
-
concatBytes: () => concatBytes4,
|
43664
|
-
createHmacDrbg: () => createHmacDrbg,
|
43665
|
-
ensureBytes: () => ensureBytes,
|
43666
|
-
equalBytes: () => equalBytes,
|
43667
|
-
hexToBytes: () => hexToBytes2,
|
43668
|
-
hexToNumber: () => hexToNumber,
|
43669
|
-
isBytes: () => isBytes3,
|
43670
|
-
numberToBytesBE: () => numberToBytesBE,
|
43671
|
-
numberToBytesLE: () => numberToBytesLE,
|
43672
|
-
numberToHexUnpadded: () => numberToHexUnpadded,
|
43673
|
-
numberToVarBytesBE: () => numberToVarBytesBE,
|
43674
|
-
utf8ToBytes: () => utf8ToBytes4,
|
43675
|
-
validateObject: () => validateObject
|
43676
|
-
});
|
43677
|
-
var _0n3 = BigInt(0);
|
43678
|
-
var _1n3 = BigInt(1);
|
43679
|
-
var _2n3 = BigInt(2);
|
43680
|
-
function isBytes3(a) {
|
43681
|
-
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
43682
|
-
}
|
43683
|
-
var hexes3 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
43684
|
-
function bytesToHex2(bytes4) {
|
43685
|
-
if (!isBytes3(bytes4))
|
43686
|
-
throw new Error("Uint8Array expected");
|
43687
|
-
let hex = "";
|
43688
|
-
for (let i = 0; i < bytes4.length; i++) {
|
43689
|
-
hex += hexes3[bytes4[i]];
|
43690
|
-
}
|
43691
|
-
return hex;
|
43692
|
-
}
|
43693
|
-
function numberToHexUnpadded(num) {
|
43694
|
-
const hex = num.toString(16);
|
43695
|
-
return hex.length & 1 ? `0${hex}` : hex;
|
43696
|
-
}
|
43697
|
-
function hexToNumber(hex) {
|
43698
|
-
if (typeof hex !== "string")
|
43699
|
-
throw new Error("hex string expected, got " + typeof hex);
|
43700
|
-
return BigInt(hex === "" ? "0" : `0x${hex}`);
|
43701
|
-
}
|
43702
|
-
var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };
|
43703
|
-
function asciiToBase16(char) {
|
43704
|
-
if (char >= asciis._0 && char <= asciis._9)
|
43705
|
-
return char - asciis._0;
|
43706
|
-
if (char >= asciis._A && char <= asciis._F)
|
43707
|
-
return char - (asciis._A - 10);
|
43708
|
-
if (char >= asciis._a && char <= asciis._f)
|
43709
|
-
return char - (asciis._a - 10);
|
43710
|
-
return;
|
43711
|
-
}
|
43712
|
-
function hexToBytes2(hex) {
|
43713
|
-
if (typeof hex !== "string")
|
43714
|
-
throw new Error("hex string expected, got " + typeof hex);
|
43715
|
-
const hl = hex.length;
|
43716
|
-
const al = hl / 2;
|
43717
|
-
if (hl % 2)
|
43718
|
-
throw new Error("padded hex string expected, got unpadded hex of length " + hl);
|
43719
|
-
const array = new Uint8Array(al);
|
43720
|
-
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
43721
|
-
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
43722
|
-
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
43723
|
-
if (n1 === void 0 || n2 === void 0) {
|
43724
|
-
const char = hex[hi] + hex[hi + 1];
|
43725
|
-
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
43726
|
-
}
|
43727
|
-
array[ai] = n1 * 16 + n2;
|
43986
|
+
var SHA2562 = class extends SHA23 {
|
43987
|
+
constructor() {
|
43988
|
+
super(64, 32, 8, false);
|
43989
|
+
this.A = IV2[0] | 0;
|
43990
|
+
this.B = IV2[1] | 0;
|
43991
|
+
this.C = IV2[2] | 0;
|
43992
|
+
this.D = IV2[3] | 0;
|
43993
|
+
this.E = IV2[4] | 0;
|
43994
|
+
this.F = IV2[5] | 0;
|
43995
|
+
this.G = IV2[6] | 0;
|
43996
|
+
this.H = IV2[7] | 0;
|
43728
43997
|
}
|
43729
|
-
|
43730
|
-
|
43731
|
-
|
43732
|
-
|
43733
|
-
|
43734
|
-
|
43735
|
-
|
43736
|
-
|
43737
|
-
|
43738
|
-
|
43739
|
-
|
43740
|
-
|
43741
|
-
|
43742
|
-
|
43743
|
-
|
43744
|
-
|
43745
|
-
|
43746
|
-
|
43747
|
-
|
43748
|
-
|
43749
|
-
|
43750
|
-
|
43751
|
-
|
43752
|
-
|
43753
|
-
} catch (e) {
|
43754
|
-
throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
|
43998
|
+
get() {
|
43999
|
+
const { A, B, C, D, E, F, G, H } = this;
|
44000
|
+
return [A, B, C, D, E, F, G, H];
|
44001
|
+
}
|
44002
|
+
// prettier-ignore
|
44003
|
+
set(A, B, C, D, E, F, G, H) {
|
44004
|
+
this.A = A | 0;
|
44005
|
+
this.B = B | 0;
|
44006
|
+
this.C = C | 0;
|
44007
|
+
this.D = D | 0;
|
44008
|
+
this.E = E | 0;
|
44009
|
+
this.F = F | 0;
|
44010
|
+
this.G = G | 0;
|
44011
|
+
this.H = H | 0;
|
44012
|
+
}
|
44013
|
+
process(view, offset) {
|
44014
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
44015
|
+
SHA256_W2[i] = view.getUint32(offset, false);
|
44016
|
+
for (let i = 16; i < 64; i++) {
|
44017
|
+
const W15 = SHA256_W2[i - 15];
|
44018
|
+
const W2 = SHA256_W2[i - 2];
|
44019
|
+
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
44020
|
+
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
44021
|
+
SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
|
43755
44022
|
}
|
43756
|
-
|
43757
|
-
|
43758
|
-
|
43759
|
-
|
44023
|
+
let { A, B, C, D, E, F, G, H } = this;
|
44024
|
+
for (let i = 0; i < 64; i++) {
|
44025
|
+
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
44026
|
+
const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
|
44027
|
+
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
44028
|
+
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
44029
|
+
H = G;
|
44030
|
+
G = F;
|
44031
|
+
F = E;
|
44032
|
+
E = D + T1 | 0;
|
44033
|
+
D = C;
|
44034
|
+
C = B;
|
44035
|
+
B = A;
|
44036
|
+
A = T1 + T2 | 0;
|
44037
|
+
}
|
44038
|
+
A = A + this.A | 0;
|
44039
|
+
B = B + this.B | 0;
|
44040
|
+
C = C + this.C | 0;
|
44041
|
+
D = D + this.D | 0;
|
44042
|
+
E = E + this.E | 0;
|
44043
|
+
F = F + this.F | 0;
|
44044
|
+
G = G + this.G | 0;
|
44045
|
+
H = H + this.H | 0;
|
44046
|
+
this.set(A, B, C, D, E, F, G, H);
|
43760
44047
|
}
|
43761
|
-
|
43762
|
-
|
43763
|
-
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
43764
|
-
return res;
|
43765
|
-
}
|
43766
|
-
function concatBytes4(...arrays) {
|
43767
|
-
let sum = 0;
|
43768
|
-
for (let i = 0; i < arrays.length; i++) {
|
43769
|
-
const a = arrays[i];
|
43770
|
-
if (!isBytes3(a))
|
43771
|
-
throw new Error("Uint8Array expected");
|
43772
|
-
sum += a.length;
|
44048
|
+
roundClean() {
|
44049
|
+
SHA256_W2.fill(0);
|
43773
44050
|
}
|
43774
|
-
|
43775
|
-
|
43776
|
-
|
43777
|
-
const a = arrays[i];
|
43778
|
-
res.set(a, pad3);
|
43779
|
-
pad3 += a.length;
|
44051
|
+
destroy() {
|
44052
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
44053
|
+
this.buffer.fill(0);
|
43780
44054
|
}
|
43781
|
-
return res;
|
43782
|
-
}
|
43783
|
-
function equalBytes(a, b) {
|
43784
|
-
if (a.length !== b.length)
|
43785
|
-
return false;
|
43786
|
-
let diff = 0;
|
43787
|
-
for (let i = 0; i < a.length; i++)
|
43788
|
-
diff |= a[i] ^ b[i];
|
43789
|
-
return diff === 0;
|
43790
|
-
}
|
43791
|
-
function utf8ToBytes4(str) {
|
43792
|
-
if (typeof str !== "string")
|
43793
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
43794
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
43795
|
-
}
|
43796
|
-
function bitLen(n) {
|
43797
|
-
let len;
|
43798
|
-
for (len = 0; n > _0n3; n >>= _1n3, len += 1)
|
43799
|
-
;
|
43800
|
-
return len;
|
43801
|
-
}
|
43802
|
-
function bitGet(n, pos) {
|
43803
|
-
return n >> BigInt(pos) & _1n3;
|
43804
|
-
}
|
43805
|
-
var bitSet = (n, pos, value) => {
|
43806
|
-
return n | (value ? _1n3 : _0n3) << BigInt(pos);
|
43807
|
-
};
|
43808
|
-
var bitMask = (n) => (_2n3 << BigInt(n - 1)) - _1n3;
|
43809
|
-
var u8n = (data) => new Uint8Array(data);
|
43810
|
-
var u8fr = (arr) => Uint8Array.from(arr);
|
43811
|
-
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
43812
|
-
if (typeof hashLen !== "number" || hashLen < 2)
|
43813
|
-
throw new Error("hashLen must be a number");
|
43814
|
-
if (typeof qByteLen !== "number" || qByteLen < 2)
|
43815
|
-
throw new Error("qByteLen must be a number");
|
43816
|
-
if (typeof hmacFn !== "function")
|
43817
|
-
throw new Error("hmacFn must be a function");
|
43818
|
-
let v = u8n(hashLen);
|
43819
|
-
let k = u8n(hashLen);
|
43820
|
-
let i = 0;
|
43821
|
-
const reset = () => {
|
43822
|
-
v.fill(1);
|
43823
|
-
k.fill(0);
|
43824
|
-
i = 0;
|
43825
|
-
};
|
43826
|
-
const h = (...b) => hmacFn(k, v, ...b);
|
43827
|
-
const reseed = (seed = u8n()) => {
|
43828
|
-
k = h(u8fr([0]), seed);
|
43829
|
-
v = h();
|
43830
|
-
if (seed.length === 0)
|
43831
|
-
return;
|
43832
|
-
k = h(u8fr([1]), seed);
|
43833
|
-
v = h();
|
43834
|
-
};
|
43835
|
-
const gen3 = () => {
|
43836
|
-
if (i++ >= 1e3)
|
43837
|
-
throw new Error("drbg: tried 1000 values");
|
43838
|
-
let len = 0;
|
43839
|
-
const out = [];
|
43840
|
-
while (len < qByteLen) {
|
43841
|
-
v = h();
|
43842
|
-
const sl = v.slice();
|
43843
|
-
out.push(sl);
|
43844
|
-
len += v.length;
|
43845
|
-
}
|
43846
|
-
return concatBytes4(...out);
|
43847
|
-
};
|
43848
|
-
const genUntil = (seed, pred) => {
|
43849
|
-
reset();
|
43850
|
-
reseed(seed);
|
43851
|
-
let res = void 0;
|
43852
|
-
while (!(res = pred(gen3())))
|
43853
|
-
reseed();
|
43854
|
-
reset();
|
43855
|
-
return res;
|
43856
|
-
};
|
43857
|
-
return genUntil;
|
43858
|
-
}
|
43859
|
-
var validatorFns = {
|
43860
|
-
bigint: (val) => typeof val === "bigint",
|
43861
|
-
function: (val) => typeof val === "function",
|
43862
|
-
boolean: (val) => typeof val === "boolean",
|
43863
|
-
string: (val) => typeof val === "string",
|
43864
|
-
stringOrUint8Array: (val) => typeof val === "string" || isBytes3(val),
|
43865
|
-
isSafeInteger: (val) => Number.isSafeInteger(val),
|
43866
|
-
array: (val) => Array.isArray(val),
|
43867
|
-
field: (val, object) => object.Fp.isValid(val),
|
43868
|
-
hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
|
43869
44055
|
};
|
43870
|
-
|
43871
|
-
const checkField = (fieldName, type3, isOptional) => {
|
43872
|
-
const checkVal = validatorFns[type3];
|
43873
|
-
if (typeof checkVal !== "function")
|
43874
|
-
throw new Error(`Invalid validator "${type3}", expected function`);
|
43875
|
-
const val = object[fieldName];
|
43876
|
-
if (isOptional && val === void 0)
|
43877
|
-
return;
|
43878
|
-
if (!checkVal(val, object)) {
|
43879
|
-
throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type3}`);
|
43880
|
-
}
|
43881
|
-
};
|
43882
|
-
for (const [fieldName, type3] of Object.entries(validators))
|
43883
|
-
checkField(fieldName, type3, false);
|
43884
|
-
for (const [fieldName, type3] of Object.entries(optValidators))
|
43885
|
-
checkField(fieldName, type3, true);
|
43886
|
-
return object;
|
43887
|
-
}
|
44056
|
+
var sha2563 = /* @__PURE__ */ wrapConstructor3(() => new SHA2562());
|
43888
44057
|
|
43889
44058
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/modular.js
|
43890
44059
|
var _0n4 = BigInt(0);
|
@@ -44321,7 +44490,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44321
44490
|
toSig(hex) {
|
44322
44491
|
const { Err: E } = DER;
|
44323
44492
|
const data = typeof hex === "string" ? h2b(hex) : hex;
|
44324
|
-
if (!
|
44493
|
+
if (!isBytes(data))
|
44325
44494
|
throw new Error("ui8a expected");
|
44326
44495
|
let l = data.length;
|
44327
44496
|
if (l < 2 || data[0] != 48)
|
@@ -44359,7 +44528,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44359
44528
|
const { Fp: Fp2 } = CURVE;
|
44360
44529
|
const toBytes5 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
44361
44530
|
const a = point.toAffine();
|
44362
|
-
return
|
44531
|
+
return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
44363
44532
|
});
|
44364
44533
|
const fromBytes = CURVE.fromBytes || ((bytes4) => {
|
44365
44534
|
const tail = bytes4.subarray(1);
|
@@ -44385,7 +44554,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44385
44554
|
function normPrivateKeyToScalar(key) {
|
44386
44555
|
const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;
|
44387
44556
|
if (lengths && typeof key !== "bigint") {
|
44388
|
-
if (
|
44557
|
+
if (isBytes(key))
|
44389
44558
|
key = bytesToHex2(key);
|
44390
44559
|
if (typeof key !== "string" || !lengths.includes(key.length))
|
44391
44560
|
throw new Error("Invalid key");
|
@@ -44775,7 +44944,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44775
44944
|
toBytes(_c, point, isCompressed) {
|
44776
44945
|
const a = point.toAffine();
|
44777
44946
|
const x = Fp2.toBytes(a.x);
|
44778
|
-
const cat =
|
44947
|
+
const cat = concatBytes3;
|
44779
44948
|
if (isCompressed) {
|
44780
44949
|
return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
|
44781
44950
|
} else {
|
@@ -44920,7 +45089,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44920
45089
|
return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed);
|
44921
45090
|
}
|
44922
45091
|
function isProbPub(item) {
|
44923
|
-
const arr =
|
45092
|
+
const arr = isBytes(item);
|
44924
45093
|
const str = typeof item === "string";
|
44925
45094
|
const len = (arr || str) && item.length;
|
44926
45095
|
if (arr)
|
@@ -44972,7 +45141,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44972
45141
|
const e = ent === true ? randomBytes5(Fp2.BYTES) : ent;
|
44973
45142
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
44974
45143
|
}
|
44975
|
-
const seed =
|
45144
|
+
const seed = concatBytes3(...seedArgs);
|
44976
45145
|
const m = h1int;
|
44977
45146
|
function k2sig(kBytes) {
|
44978
45147
|
const k = bits2int(kBytes);
|
@@ -45015,7 +45184,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45015
45184
|
let _sig = void 0;
|
45016
45185
|
let P;
|
45017
45186
|
try {
|
45018
|
-
if (typeof sg === "string" ||
|
45187
|
+
if (typeof sg === "string" || isBytes(sg)) {
|
45019
45188
|
try {
|
45020
45189
|
_sig = Signature2.fromDER(sg);
|
45021
45190
|
} catch (derError) {
|
@@ -45131,7 +45300,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45131
45300
|
function getHash(hash6) {
|
45132
45301
|
return {
|
45133
45302
|
hash: hash6,
|
45134
|
-
hmac: (key, ...msgs) => hmac2(hash6, key,
|
45303
|
+
hmac: (key, ...msgs) => hmac2(hash6, key, concatBytes4(...msgs)),
|
45135
45304
|
randomBytes: randomBytes4
|
45136
45305
|
};
|
45137
45306
|
}
|
@@ -45530,12 +45699,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45530
45699
|
* @param transactionRequestLike - The transaction request to send.
|
45531
45700
|
* @returns A promise that resolves to the TransactionResponse object.
|
45532
45701
|
*/
|
45533
|
-
async sendTransaction(transactionRequestLike,
|
45702
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
45534
45703
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
45535
|
-
|
45704
|
+
if (estimateTxDependencies) {
|
45705
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
45706
|
+
}
|
45536
45707
|
return this.provider.sendTransaction(
|
45537
45708
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
45538
|
-
{
|
45709
|
+
{ awaitExecution, estimateTxDependencies: false }
|
45539
45710
|
);
|
45540
45711
|
}
|
45541
45712
|
/**
|
@@ -45544,9 +45715,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45544
45715
|
* @param transactionRequestLike - The transaction request to simulate.
|
45545
45716
|
* @returns A promise that resolves to the CallResult object.
|
45546
45717
|
*/
|
45547
|
-
async simulateTransaction(transactionRequestLike) {
|
45718
|
+
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
45548
45719
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
45549
|
-
|
45720
|
+
if (estimateTxDependencies) {
|
45721
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
45722
|
+
}
|
45550
45723
|
return this.provider.call(
|
45551
45724
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
45552
45725
|
{
|
@@ -48970,14 +49143,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48970
49143
|
})(FuelConnectorEventTypes || {});
|
48971
49144
|
var FuelConnectorEventType = "FuelConnector";
|
48972
49145
|
|
48973
|
-
// src/connectors/types/constants.ts
|
48974
|
-
var CONNECTOR_SCRIPT = "FuelConnectorScript";
|
48975
|
-
var CONTENT_SCRIPT_NAME = "FuelContentScript";
|
48976
|
-
var BACKGROUND_SCRIPT_NAME = "FuelBackgroundScript";
|
48977
|
-
var POPUP_SCRIPT_NAME = "FuelPopUpScript";
|
48978
|
-
var VAULT_SCRIPT_NAME = "FuelVaultScript";
|
48979
|
-
var EVENT_MESSAGE = "message";
|
48980
|
-
|
48981
49146
|
// src/connectors/types/data-type.ts
|
48982
49147
|
var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
|
48983
49148
|
MessageTypes2["ping"] = "ping";
|
@@ -49227,40 +49392,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49227
49392
|
}
|
49228
49393
|
};
|
49229
49394
|
|
49230
|
-
// src/connectors/fuel-wallet-locked.ts
|
49231
|
-
var FuelWalletLocked = class extends WalletLocked {
|
49232
|
-
connector;
|
49233
|
-
_provider;
|
49234
|
-
constructor(address, connector, provider) {
|
49235
|
-
super(address, provider);
|
49236
|
-
this.connector = connector;
|
49237
|
-
this._provider = provider;
|
49238
|
-
}
|
49239
|
-
async signMessage(message) {
|
49240
|
-
return this.connector.signMessage(this.address.toString(), message);
|
49241
|
-
}
|
49242
|
-
async sendTransaction(transaction) {
|
49243
|
-
const transactionId = await this.connector.sendTransaction(
|
49244
|
-
this.address.toString(),
|
49245
|
-
transaction
|
49246
|
-
);
|
49247
|
-
return this.provider.getTransactionResponse(transactionId);
|
49248
|
-
}
|
49249
|
-
};
|
49250
|
-
|
49251
|
-
// src/connectors/fuel-wallet-provider.ts
|
49252
|
-
var FuelWalletProvider = class extends Provider {
|
49253
|
-
static async create(url, options) {
|
49254
|
-
const provider = new FuelWalletProvider(url, options);
|
49255
|
-
await provider.fetchChainAndNodeInfo();
|
49256
|
-
return provider;
|
49257
|
-
}
|
49258
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
49259
|
-
async getTransactionResponse(transactionId) {
|
49260
|
-
return new TransactionResponse2(transactionId, this);
|
49261
|
-
}
|
49262
|
-
};
|
49263
|
-
|
49264
49395
|
// src/connectors/utils/cache.ts
|
49265
49396
|
function cacheFor(fn, { cache: cache2, cacheTime, key }) {
|
49266
49397
|
return async (...args) => {
|
@@ -49290,23 +49421,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49290
49421
|
);
|
49291
49422
|
}
|
49292
49423
|
|
49293
|
-
// src/connectors/utils/get-asset-by-chain.ts
|
49294
|
-
function getAssetByChain(asset, chainId, network = "fuel") {
|
49295
|
-
const assetFuelNetwork = asset.networks.find(
|
49296
|
-
(item) => item.chainId === chainId && item.type === network
|
49297
|
-
);
|
49298
|
-
if (!assetFuelNetwork) {
|
49299
|
-
throw new Error("Asset not found for the given chain and network.");
|
49300
|
-
}
|
49301
|
-
return {
|
49302
|
-
...asset,
|
49303
|
-
assetId: assetFuelNetwork.assetId,
|
49304
|
-
decimals: assetFuelNetwork.decimals,
|
49305
|
-
chainId: assetFuelNetwork.chainId,
|
49306
|
-
network: assetFuelNetwork.type
|
49307
|
-
};
|
49308
|
-
}
|
49309
|
-
|
49310
49424
|
// src/connectors/utils/promises.ts
|
49311
49425
|
function deferPromise() {
|
49312
49426
|
const defer = {};
|
@@ -49328,6 +49442,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49328
49442
|
// src/connectors/fuel.ts
|
49329
49443
|
var HAS_CONNECTOR_TIMEOUT = 2e3;
|
49330
49444
|
var PING_CACHE_TIME = 5e3;
|
49445
|
+
var { warn } = console;
|
49331
49446
|
var _Fuel = class extends FuelConnector {
|
49332
49447
|
_storage = null;
|
49333
49448
|
_connectors = [];
|
@@ -49596,14 +49711,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49596
49711
|
* Return a Fuel Provider instance with extends features to work with
|
49597
49712
|
* connectors.
|
49598
49713
|
*
|
49599
|
-
* @deprecated
|
49714
|
+
* @deprecated getProvider is deprecated and is going to be removed in the future, use getWallet instead.
|
49600
49715
|
*/
|
49601
49716
|
async getProvider(providerOrNetwork) {
|
49602
|
-
|
49603
|
-
|
49604
|
-
|
49605
|
-
);
|
49606
|
-
}
|
49717
|
+
warn(
|
49718
|
+
"getProvider is deprecated and is going to be removed in the future, use getWallet instead."
|
49719
|
+
);
|
49607
49720
|
return this._getProvider(providerOrNetwork);
|
49608
49721
|
}
|
49609
49722
|
/**
|
@@ -49615,12 +49728,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49615
49728
|
if (providerOrNetwork && "getTransactionResponse" in providerOrNetwork) {
|
49616
49729
|
provider = providerOrNetwork;
|
49617
49730
|
} else if (providerOrNetwork && "chainId" in providerOrNetwork && "url" in providerOrNetwork) {
|
49618
|
-
provider = await
|
49731
|
+
provider = await Provider.create(providerOrNetwork.url);
|
49619
49732
|
} else if (!providerOrNetwork) {
|
49620
49733
|
const currentNetwork = await this.currentNetwork();
|
49621
|
-
provider = await
|
49734
|
+
provider = await Provider.create(currentNetwork.url);
|
49622
49735
|
} else {
|
49623
|
-
throw new
|
49736
|
+
throw new FuelError(ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
|
49624
49737
|
}
|
49625
49738
|
return provider;
|
49626
49739
|
}
|
@@ -49630,7 +49743,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49630
49743
|
*/
|
49631
49744
|
async getWallet(address, providerOrNetwork) {
|
49632
49745
|
const provider = await this._getProvider(providerOrNetwork);
|
49633
|
-
return new
|
49746
|
+
return new Account(address, provider, this);
|
49634
49747
|
}
|
49635
49748
|
/**
|
49636
49749
|
* Remove all open listeners this is useful when you want to
|
@@ -49683,12 +49796,12 @@ mime-types/index.js:
|
|
49683
49796
|
@noble/hashes/esm/utils.js:
|
49684
49797
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49685
49798
|
|
49686
|
-
@noble/hashes/esm/utils.js:
|
49687
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49688
|
-
|
49689
49799
|
@noble/curves/esm/abstract/utils.js:
|
49690
49800
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49691
49801
|
|
49802
|
+
@noble/hashes/esm/utils.js:
|
49803
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49804
|
+
|
49692
49805
|
@noble/curves/esm/abstract/modular.js:
|
49693
49806
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49694
49807
|
|