@fuel-ts/account 0.0.0-pr-1699-20240214162434 → 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
@@ -33065,8 +33065,8 @@ spurious results.`);
|
|
33065
33065
|
function getBuiltinVersions() {
|
33066
33066
|
return {
|
33067
33067
|
FORC: "0.50.0",
|
33068
|
-
FUEL_CORE: "0.22.
|
33069
|
-
FUELS: "0.
|
33068
|
+
FUEL_CORE: "0.22.1",
|
33069
|
+
FUELS: "0.74.0"
|
33070
33070
|
};
|
33071
33071
|
}
|
33072
33072
|
function parseVersion(version2) {
|
@@ -33139,10 +33139,12 @@ spurious results.`);
|
|
33139
33139
|
ErrorCode2["CHAIN_INFO_CACHE_EMPTY"] = "chain-info-cache-empty";
|
33140
33140
|
ErrorCode2["NODE_INFO_CACHE_EMPTY"] = "node-info-cache-empty";
|
33141
33141
|
ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
|
33142
|
+
ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
|
33142
33143
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
33143
33144
|
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
|
33144
33145
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
33145
33146
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
33147
|
+
ErrorCode2["MISSING_CONNECTOR"] = "missing-connector";
|
33146
33148
|
ErrorCode2["PARSE_FAILED"] = "parse-failed";
|
33147
33149
|
ErrorCode2["ENCODE_ERROR"] = "encode-error";
|
33148
33150
|
ErrorCode2["DECODE_ERROR"] = "decode-error";
|
@@ -36465,6 +36467,51 @@ spurious results.`);
|
|
36465
36467
|
return [true, offset + this.paddingLength];
|
36466
36468
|
}
|
36467
36469
|
};
|
36470
|
+
var _getPaddedData;
|
36471
|
+
var getPaddedData_fn;
|
36472
|
+
var ByteCoder = class extends Coder {
|
36473
|
+
constructor() {
|
36474
|
+
super("struct", "struct Bytes", BASE_VECTOR_OFFSET);
|
36475
|
+
__privateAdd2(this, _getPaddedData);
|
36476
|
+
}
|
36477
|
+
encode(value) {
|
36478
|
+
if (!Array.isArray(value)) {
|
36479
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
36480
|
+
}
|
36481
|
+
const parts = [];
|
36482
|
+
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
36483
|
+
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
36484
|
+
pointer.dynamicData = {
|
36485
|
+
0: concatWithDynamicData([data])
|
36486
|
+
};
|
36487
|
+
parts.push(pointer);
|
36488
|
+
parts.push(new U64Coder().encode(data.byteLength));
|
36489
|
+
parts.push(new U64Coder().encode(value.length));
|
36490
|
+
return concatWithDynamicData(parts);
|
36491
|
+
}
|
36492
|
+
decode(data, offset) {
|
36493
|
+
if (data.length < BASE_VECTOR_OFFSET) {
|
36494
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid byte data size.`);
|
36495
|
+
}
|
36496
|
+
const len = data.slice(16, 24);
|
36497
|
+
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
36498
|
+
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
36499
|
+
if (byteData.length !== encodedLength) {
|
36500
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid bytes byte data size.`);
|
36501
|
+
}
|
36502
|
+
return [byteData, offset + BASE_VECTOR_OFFSET];
|
36503
|
+
}
|
36504
|
+
};
|
36505
|
+
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
36506
|
+
getPaddedData_fn = function(value) {
|
36507
|
+
const data = [Uint8Array.from(value)];
|
36508
|
+
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
36509
|
+
if (paddingLength) {
|
36510
|
+
data.push(new Uint8Array(paddingLength));
|
36511
|
+
}
|
36512
|
+
return concat2(data);
|
36513
|
+
};
|
36514
|
+
__publicField3(ByteCoder, "memorySize", 1);
|
36468
36515
|
var isFullyNativeEnum = (enumCoders) => Object.values(enumCoders).every(
|
36469
36516
|
// @ts-expect-error complicated types
|
36470
36517
|
({ type: type3, coders }) => type3 === "()" && JSON.stringify(coders) === JSON.stringify([])
|
@@ -36538,6 +36585,31 @@ spurious results.`);
|
|
36538
36585
|
return [{ [caseKey]: decoded }, newOffset];
|
36539
36586
|
}
|
36540
36587
|
};
|
36588
|
+
var OptionCoder = class extends EnumCoder {
|
36589
|
+
encode(value) {
|
36590
|
+
const result = super.encode(this.toSwayOption(value));
|
36591
|
+
return result;
|
36592
|
+
}
|
36593
|
+
toSwayOption(input) {
|
36594
|
+
if (input !== void 0) {
|
36595
|
+
return { Some: input };
|
36596
|
+
}
|
36597
|
+
return { None: [] };
|
36598
|
+
}
|
36599
|
+
decode(data, offset) {
|
36600
|
+
if (data.length < this.encodedLength - 1) {
|
36601
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
36602
|
+
}
|
36603
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
36604
|
+
return [this.toOption(decoded), newOffset];
|
36605
|
+
}
|
36606
|
+
toOption(output4) {
|
36607
|
+
if (output4 && "Some" in output4) {
|
36608
|
+
return output4.Some;
|
36609
|
+
}
|
36610
|
+
return void 0;
|
36611
|
+
}
|
36612
|
+
};
|
36541
36613
|
var NumberCoder = class extends Coder {
|
36542
36614
|
// This is to align the bits to the total bytes
|
36543
36615
|
// See https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md#unsigned-integers
|
@@ -36608,6 +36680,77 @@ spurious results.`);
|
|
36608
36680
|
return [toNumber2(bytes4), offset + 8];
|
36609
36681
|
}
|
36610
36682
|
};
|
36683
|
+
var RawSliceCoder = class extends Coder {
|
36684
|
+
constructor() {
|
36685
|
+
super("raw untyped slice", "raw untyped slice", BASE_RAW_SLICE_OFFSET);
|
36686
|
+
}
|
36687
|
+
encode(value) {
|
36688
|
+
if (!Array.isArray(value)) {
|
36689
|
+
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
36690
|
+
}
|
36691
|
+
const parts = [];
|
36692
|
+
const coder = new NumberCoder("u8", { isSmallBytes: true });
|
36693
|
+
const pointer = new U64Coder().encode(BASE_RAW_SLICE_OFFSET);
|
36694
|
+
pointer.dynamicData = {
|
36695
|
+
0: concatWithDynamicData(value.map((v) => coder.encode(v)))
|
36696
|
+
};
|
36697
|
+
parts.push(pointer);
|
36698
|
+
parts.push(new U64Coder().encode(value.length));
|
36699
|
+
return concatWithDynamicData(parts);
|
36700
|
+
}
|
36701
|
+
decode(data, offset) {
|
36702
|
+
const dataBytes = data.slice(offset);
|
36703
|
+
const internalCoder = new ArrayCoder(
|
36704
|
+
new NumberCoder("u8", { isSmallBytes: true }),
|
36705
|
+
dataBytes.length
|
36706
|
+
);
|
36707
|
+
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
36708
|
+
return [decodedValue, offset + dataBytes.length];
|
36709
|
+
}
|
36710
|
+
};
|
36711
|
+
var _getPaddedData2;
|
36712
|
+
var getPaddedData_fn2;
|
36713
|
+
var StdStringCoder = class extends Coder {
|
36714
|
+
constructor() {
|
36715
|
+
super("struct", "struct String", 1);
|
36716
|
+
__privateAdd2(this, _getPaddedData2);
|
36717
|
+
}
|
36718
|
+
encode(value) {
|
36719
|
+
const parts = [];
|
36720
|
+
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
36721
|
+
const data = __privateMethod2(this, _getPaddedData2, getPaddedData_fn2).call(this, value);
|
36722
|
+
pointer.dynamicData = {
|
36723
|
+
0: concatWithDynamicData([data])
|
36724
|
+
};
|
36725
|
+
parts.push(pointer);
|
36726
|
+
parts.push(new U64Coder().encode(data.byteLength));
|
36727
|
+
parts.push(new U64Coder().encode(value.length));
|
36728
|
+
return concatWithDynamicData(parts);
|
36729
|
+
}
|
36730
|
+
decode(data, offset) {
|
36731
|
+
if (data.length < this.encodedLength) {
|
36732
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string data size.`);
|
36733
|
+
}
|
36734
|
+
const len = data.slice(16, 24);
|
36735
|
+
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
36736
|
+
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
36737
|
+
if (byteData.length !== encodedLength) {
|
36738
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string byte data size.`);
|
36739
|
+
}
|
36740
|
+
const value = toUtf8String(byteData);
|
36741
|
+
return [value, offset + BASE_VECTOR_OFFSET];
|
36742
|
+
}
|
36743
|
+
};
|
36744
|
+
_getPaddedData2 = /* @__PURE__ */ new WeakSet();
|
36745
|
+
getPaddedData_fn2 = function(value) {
|
36746
|
+
const data = [toUtf8Bytes(value)];
|
36747
|
+
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
36748
|
+
if (paddingLength) {
|
36749
|
+
data.push(new Uint8Array(paddingLength));
|
36750
|
+
}
|
36751
|
+
return concat2(data);
|
36752
|
+
};
|
36753
|
+
__publicField3(StdStringCoder, "memorySize", 1);
|
36611
36754
|
var StringCoder = class extends Coder {
|
36612
36755
|
length;
|
36613
36756
|
#paddingLength;
|
@@ -36639,31 +36782,6 @@ spurious results.`);
|
|
36639
36782
|
return [value, offset + this.length + padding];
|
36640
36783
|
}
|
36641
36784
|
};
|
36642
|
-
var OptionCoder = class extends EnumCoder {
|
36643
|
-
encode(value) {
|
36644
|
-
const result = super.encode(this.toSwayOption(value));
|
36645
|
-
return result;
|
36646
|
-
}
|
36647
|
-
toSwayOption(input) {
|
36648
|
-
if (input !== void 0) {
|
36649
|
-
return { Some: input };
|
36650
|
-
}
|
36651
|
-
return { None: [] };
|
36652
|
-
}
|
36653
|
-
decode(data, offset) {
|
36654
|
-
if (data.length < this.encodedLength - 1) {
|
36655
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
36656
|
-
}
|
36657
|
-
const [decoded, newOffset] = super.decode(data, offset);
|
36658
|
-
return [this.toOption(decoded), newOffset];
|
36659
|
-
}
|
36660
|
-
toOption(output4) {
|
36661
|
-
if (output4 && "Some" in output4) {
|
36662
|
-
return output4.Some;
|
36663
|
-
}
|
36664
|
-
return void 0;
|
36665
|
-
}
|
36666
|
-
};
|
36667
36785
|
var StructCoder = class extends Coder {
|
36668
36786
|
name;
|
36669
36787
|
coders;
|
@@ -36788,122 +36906,6 @@ spurious results.`);
|
|
36788
36906
|
];
|
36789
36907
|
}
|
36790
36908
|
};
|
36791
|
-
var _getPaddedData;
|
36792
|
-
var getPaddedData_fn;
|
36793
|
-
var ByteCoder = class extends Coder {
|
36794
|
-
constructor() {
|
36795
|
-
super("struct", "struct Bytes", BASE_VECTOR_OFFSET);
|
36796
|
-
__privateAdd2(this, _getPaddedData);
|
36797
|
-
}
|
36798
|
-
encode(value) {
|
36799
|
-
if (!Array.isArray(value)) {
|
36800
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
36801
|
-
}
|
36802
|
-
const parts = [];
|
36803
|
-
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
36804
|
-
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
36805
|
-
pointer.dynamicData = {
|
36806
|
-
0: concatWithDynamicData([data])
|
36807
|
-
};
|
36808
|
-
parts.push(pointer);
|
36809
|
-
parts.push(new U64Coder().encode(data.byteLength));
|
36810
|
-
parts.push(new U64Coder().encode(value.length));
|
36811
|
-
return concatWithDynamicData(parts);
|
36812
|
-
}
|
36813
|
-
decode(data, offset) {
|
36814
|
-
if (data.length < BASE_VECTOR_OFFSET) {
|
36815
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid byte data size.`);
|
36816
|
-
}
|
36817
|
-
const len = data.slice(16, 24);
|
36818
|
-
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
36819
|
-
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
36820
|
-
if (byteData.length !== encodedLength) {
|
36821
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid bytes byte data size.`);
|
36822
|
-
}
|
36823
|
-
return [byteData, offset + BASE_VECTOR_OFFSET];
|
36824
|
-
}
|
36825
|
-
};
|
36826
|
-
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
36827
|
-
getPaddedData_fn = function(value) {
|
36828
|
-
const data = [Uint8Array.from(value)];
|
36829
|
-
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
36830
|
-
if (paddingLength) {
|
36831
|
-
data.push(new Uint8Array(paddingLength));
|
36832
|
-
}
|
36833
|
-
return concat2(data);
|
36834
|
-
};
|
36835
|
-
__publicField3(ByteCoder, "memorySize", 1);
|
36836
|
-
var RawSliceCoder = class extends Coder {
|
36837
|
-
constructor() {
|
36838
|
-
super("raw untyped slice", "raw untyped slice", BASE_RAW_SLICE_OFFSET);
|
36839
|
-
}
|
36840
|
-
encode(value) {
|
36841
|
-
if (!Array.isArray(value)) {
|
36842
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
36843
|
-
}
|
36844
|
-
const parts = [];
|
36845
|
-
const coder = new NumberCoder("u8", { isSmallBytes: true });
|
36846
|
-
const pointer = new U64Coder().encode(BASE_RAW_SLICE_OFFSET);
|
36847
|
-
pointer.dynamicData = {
|
36848
|
-
0: concatWithDynamicData(value.map((v) => coder.encode(v)))
|
36849
|
-
};
|
36850
|
-
parts.push(pointer);
|
36851
|
-
parts.push(new U64Coder().encode(value.length));
|
36852
|
-
return concatWithDynamicData(parts);
|
36853
|
-
}
|
36854
|
-
decode(data, offset) {
|
36855
|
-
const dataBytes = data.slice(offset);
|
36856
|
-
const internalCoder = new ArrayCoder(
|
36857
|
-
new NumberCoder("u8", { isSmallBytes: true }),
|
36858
|
-
dataBytes.length
|
36859
|
-
);
|
36860
|
-
const [decodedValue] = internalCoder.decode(dataBytes, 0);
|
36861
|
-
return [decodedValue, offset + dataBytes.length];
|
36862
|
-
}
|
36863
|
-
};
|
36864
|
-
var _getPaddedData2;
|
36865
|
-
var getPaddedData_fn2;
|
36866
|
-
var StdStringCoder = class extends Coder {
|
36867
|
-
constructor() {
|
36868
|
-
super("struct", "struct String", 1);
|
36869
|
-
__privateAdd2(this, _getPaddedData2);
|
36870
|
-
}
|
36871
|
-
encode(value) {
|
36872
|
-
const parts = [];
|
36873
|
-
const pointer = new U64Coder().encode(BASE_VECTOR_OFFSET);
|
36874
|
-
const data = __privateMethod2(this, _getPaddedData2, getPaddedData_fn2).call(this, value);
|
36875
|
-
pointer.dynamicData = {
|
36876
|
-
0: concatWithDynamicData([data])
|
36877
|
-
};
|
36878
|
-
parts.push(pointer);
|
36879
|
-
parts.push(new U64Coder().encode(data.byteLength));
|
36880
|
-
parts.push(new U64Coder().encode(value.length));
|
36881
|
-
return concatWithDynamicData(parts);
|
36882
|
-
}
|
36883
|
-
decode(data, offset) {
|
36884
|
-
if (data.length < this.encodedLength) {
|
36885
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string data size.`);
|
36886
|
-
}
|
36887
|
-
const len = data.slice(16, 24);
|
36888
|
-
const encodedLength = bn(new U64Coder().decode(len, 0)[0]).toNumber();
|
36889
|
-
const byteData = data.slice(BASE_VECTOR_OFFSET, BASE_VECTOR_OFFSET + encodedLength);
|
36890
|
-
if (byteData.length !== encodedLength) {
|
36891
|
-
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid std string byte data size.`);
|
36892
|
-
}
|
36893
|
-
const value = toUtf8String(byteData);
|
36894
|
-
return [value, offset + BASE_VECTOR_OFFSET];
|
36895
|
-
}
|
36896
|
-
};
|
36897
|
-
_getPaddedData2 = /* @__PURE__ */ new WeakSet();
|
36898
|
-
getPaddedData_fn2 = function(value) {
|
36899
|
-
const data = [toUtf8Bytes(value)];
|
36900
|
-
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
36901
|
-
if (paddingLength) {
|
36902
|
-
data.push(new Uint8Array(paddingLength));
|
36903
|
-
}
|
36904
|
-
return concat2(data);
|
36905
|
-
};
|
36906
|
-
__publicField3(StdStringCoder, "memorySize", 1);
|
36907
36909
|
var BooleanCoder2 = class extends Coder {
|
36908
36910
|
constructor() {
|
36909
36911
|
super("boolean", "boolean", 1);
|
@@ -38732,35 +38734,271 @@ spurious results.`);
|
|
38732
38734
|
);
|
38733
38735
|
}
|
38734
38736
|
}
|
38735
|
-
return concat2(parts);
|
38737
|
+
return concat2(parts);
|
38738
|
+
}
|
38739
|
+
decode(data, offset) {
|
38740
|
+
let decoded;
|
38741
|
+
let o = offset;
|
38742
|
+
[decoded, o] = new NumberCoder("u8").decode(data, o);
|
38743
|
+
const type3 = decoded;
|
38744
|
+
switch (type3) {
|
38745
|
+
case 0: {
|
38746
|
+
[decoded, o] = new TransactionScriptCoder().decode(data, o);
|
38747
|
+
return [decoded, o];
|
38748
|
+
}
|
38749
|
+
case 1: {
|
38750
|
+
[decoded, o] = new TransactionCreateCoder().decode(data, o);
|
38751
|
+
return [decoded, o];
|
38752
|
+
}
|
38753
|
+
case 2: {
|
38754
|
+
[decoded, o] = new TransactionMintCoder().decode(data, o);
|
38755
|
+
return [decoded, o];
|
38756
|
+
}
|
38757
|
+
default: {
|
38758
|
+
throw new FuelError(
|
38759
|
+
ErrorCode.INVALID_TRANSACTION_TYPE,
|
38760
|
+
`Invalid transaction type: ${type3}`
|
38761
|
+
);
|
38762
|
+
}
|
38763
|
+
}
|
38764
|
+
}
|
38765
|
+
};
|
38766
|
+
|
38767
|
+
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/utils.js
|
38768
|
+
var utils_exports = {};
|
38769
|
+
__export(utils_exports, {
|
38770
|
+
bitGet: () => bitGet,
|
38771
|
+
bitLen: () => bitLen,
|
38772
|
+
bitMask: () => bitMask,
|
38773
|
+
bitSet: () => bitSet,
|
38774
|
+
bytesToHex: () => bytesToHex2,
|
38775
|
+
bytesToNumberBE: () => bytesToNumberBE,
|
38776
|
+
bytesToNumberLE: () => bytesToNumberLE,
|
38777
|
+
concatBytes: () => concatBytes3,
|
38778
|
+
createHmacDrbg: () => createHmacDrbg,
|
38779
|
+
ensureBytes: () => ensureBytes,
|
38780
|
+
equalBytes: () => equalBytes,
|
38781
|
+
hexToBytes: () => hexToBytes2,
|
38782
|
+
hexToNumber: () => hexToNumber,
|
38783
|
+
isBytes: () => isBytes,
|
38784
|
+
numberToBytesBE: () => numberToBytesBE,
|
38785
|
+
numberToBytesLE: () => numberToBytesLE,
|
38786
|
+
numberToHexUnpadded: () => numberToHexUnpadded,
|
38787
|
+
numberToVarBytesBE: () => numberToVarBytesBE,
|
38788
|
+
utf8ToBytes: () => utf8ToBytes3,
|
38789
|
+
validateObject: () => validateObject
|
38790
|
+
});
|
38791
|
+
var _0n3 = BigInt(0);
|
38792
|
+
var _1n3 = BigInt(1);
|
38793
|
+
var _2n3 = BigInt(2);
|
38794
|
+
function isBytes(a) {
|
38795
|
+
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
38796
|
+
}
|
38797
|
+
var hexes3 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
38798
|
+
function bytesToHex2(bytes4) {
|
38799
|
+
if (!isBytes(bytes4))
|
38800
|
+
throw new Error("Uint8Array expected");
|
38801
|
+
let hex = "";
|
38802
|
+
for (let i = 0; i < bytes4.length; i++) {
|
38803
|
+
hex += hexes3[bytes4[i]];
|
38804
|
+
}
|
38805
|
+
return hex;
|
38806
|
+
}
|
38807
|
+
function numberToHexUnpadded(num) {
|
38808
|
+
const hex = num.toString(16);
|
38809
|
+
return hex.length & 1 ? `0${hex}` : hex;
|
38810
|
+
}
|
38811
|
+
function hexToNumber(hex) {
|
38812
|
+
if (typeof hex !== "string")
|
38813
|
+
throw new Error("hex string expected, got " + typeof hex);
|
38814
|
+
return BigInt(hex === "" ? "0" : `0x${hex}`);
|
38815
|
+
}
|
38816
|
+
var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };
|
38817
|
+
function asciiToBase16(char) {
|
38818
|
+
if (char >= asciis._0 && char <= asciis._9)
|
38819
|
+
return char - asciis._0;
|
38820
|
+
if (char >= asciis._A && char <= asciis._F)
|
38821
|
+
return char - (asciis._A - 10);
|
38822
|
+
if (char >= asciis._a && char <= asciis._f)
|
38823
|
+
return char - (asciis._a - 10);
|
38824
|
+
return;
|
38825
|
+
}
|
38826
|
+
function hexToBytes2(hex) {
|
38827
|
+
if (typeof hex !== "string")
|
38828
|
+
throw new Error("hex string expected, got " + typeof hex);
|
38829
|
+
const hl = hex.length;
|
38830
|
+
const al = hl / 2;
|
38831
|
+
if (hl % 2)
|
38832
|
+
throw new Error("padded hex string expected, got unpadded hex of length " + hl);
|
38833
|
+
const array = new Uint8Array(al);
|
38834
|
+
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
38835
|
+
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
38836
|
+
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
38837
|
+
if (n1 === void 0 || n2 === void 0) {
|
38838
|
+
const char = hex[hi] + hex[hi + 1];
|
38839
|
+
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
38840
|
+
}
|
38841
|
+
array[ai] = n1 * 16 + n2;
|
38736
38842
|
}
|
38737
|
-
|
38738
|
-
|
38739
|
-
|
38740
|
-
|
38741
|
-
|
38742
|
-
|
38743
|
-
|
38744
|
-
|
38745
|
-
|
38746
|
-
|
38747
|
-
|
38748
|
-
|
38749
|
-
|
38750
|
-
|
38751
|
-
|
38752
|
-
|
38753
|
-
|
38754
|
-
|
38755
|
-
|
38756
|
-
|
38757
|
-
|
38758
|
-
|
38759
|
-
|
38760
|
-
|
38843
|
+
return array;
|
38844
|
+
}
|
38845
|
+
function bytesToNumberBE(bytes4) {
|
38846
|
+
return hexToNumber(bytesToHex2(bytes4));
|
38847
|
+
}
|
38848
|
+
function bytesToNumberLE(bytes4) {
|
38849
|
+
if (!isBytes(bytes4))
|
38850
|
+
throw new Error("Uint8Array expected");
|
38851
|
+
return hexToNumber(bytesToHex2(Uint8Array.from(bytes4).reverse()));
|
38852
|
+
}
|
38853
|
+
function numberToBytesBE(n, len) {
|
38854
|
+
return hexToBytes2(n.toString(16).padStart(len * 2, "0"));
|
38855
|
+
}
|
38856
|
+
function numberToBytesLE(n, len) {
|
38857
|
+
return numberToBytesBE(n, len).reverse();
|
38858
|
+
}
|
38859
|
+
function numberToVarBytesBE(n) {
|
38860
|
+
return hexToBytes2(numberToHexUnpadded(n));
|
38861
|
+
}
|
38862
|
+
function ensureBytes(title, hex, expectedLength) {
|
38863
|
+
let res;
|
38864
|
+
if (typeof hex === "string") {
|
38865
|
+
try {
|
38866
|
+
res = hexToBytes2(hex);
|
38867
|
+
} catch (e) {
|
38868
|
+
throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
|
38761
38869
|
}
|
38870
|
+
} else if (isBytes(hex)) {
|
38871
|
+
res = Uint8Array.from(hex);
|
38872
|
+
} else {
|
38873
|
+
throw new Error(`${title} must be hex string or Uint8Array`);
|
38874
|
+
}
|
38875
|
+
const len = res.length;
|
38876
|
+
if (typeof expectedLength === "number" && len !== expectedLength)
|
38877
|
+
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
38878
|
+
return res;
|
38879
|
+
}
|
38880
|
+
function concatBytes3(...arrays) {
|
38881
|
+
let sum = 0;
|
38882
|
+
for (let i = 0; i < arrays.length; i++) {
|
38883
|
+
const a = arrays[i];
|
38884
|
+
if (!isBytes(a))
|
38885
|
+
throw new Error("Uint8Array expected");
|
38886
|
+
sum += a.length;
|
38887
|
+
}
|
38888
|
+
let res = new Uint8Array(sum);
|
38889
|
+
let pad3 = 0;
|
38890
|
+
for (let i = 0; i < arrays.length; i++) {
|
38891
|
+
const a = arrays[i];
|
38892
|
+
res.set(a, pad3);
|
38893
|
+
pad3 += a.length;
|
38762
38894
|
}
|
38895
|
+
return res;
|
38896
|
+
}
|
38897
|
+
function equalBytes(a, b) {
|
38898
|
+
if (a.length !== b.length)
|
38899
|
+
return false;
|
38900
|
+
let diff = 0;
|
38901
|
+
for (let i = 0; i < a.length; i++)
|
38902
|
+
diff |= a[i] ^ b[i];
|
38903
|
+
return diff === 0;
|
38904
|
+
}
|
38905
|
+
function utf8ToBytes3(str) {
|
38906
|
+
if (typeof str !== "string")
|
38907
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
38908
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
38909
|
+
}
|
38910
|
+
function bitLen(n) {
|
38911
|
+
let len;
|
38912
|
+
for (len = 0; n > _0n3; n >>= _1n3, len += 1)
|
38913
|
+
;
|
38914
|
+
return len;
|
38915
|
+
}
|
38916
|
+
function bitGet(n, pos) {
|
38917
|
+
return n >> BigInt(pos) & _1n3;
|
38918
|
+
}
|
38919
|
+
var bitSet = (n, pos, value) => {
|
38920
|
+
return n | (value ? _1n3 : _0n3) << BigInt(pos);
|
38921
|
+
};
|
38922
|
+
var bitMask = (n) => (_2n3 << BigInt(n - 1)) - _1n3;
|
38923
|
+
var u8n = (data) => new Uint8Array(data);
|
38924
|
+
var u8fr = (arr) => Uint8Array.from(arr);
|
38925
|
+
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
38926
|
+
if (typeof hashLen !== "number" || hashLen < 2)
|
38927
|
+
throw new Error("hashLen must be a number");
|
38928
|
+
if (typeof qByteLen !== "number" || qByteLen < 2)
|
38929
|
+
throw new Error("qByteLen must be a number");
|
38930
|
+
if (typeof hmacFn !== "function")
|
38931
|
+
throw new Error("hmacFn must be a function");
|
38932
|
+
let v = u8n(hashLen);
|
38933
|
+
let k = u8n(hashLen);
|
38934
|
+
let i = 0;
|
38935
|
+
const reset = () => {
|
38936
|
+
v.fill(1);
|
38937
|
+
k.fill(0);
|
38938
|
+
i = 0;
|
38939
|
+
};
|
38940
|
+
const h = (...b) => hmacFn(k, v, ...b);
|
38941
|
+
const reseed = (seed = u8n()) => {
|
38942
|
+
k = h(u8fr([0]), seed);
|
38943
|
+
v = h();
|
38944
|
+
if (seed.length === 0)
|
38945
|
+
return;
|
38946
|
+
k = h(u8fr([1]), seed);
|
38947
|
+
v = h();
|
38948
|
+
};
|
38949
|
+
const gen3 = () => {
|
38950
|
+
if (i++ >= 1e3)
|
38951
|
+
throw new Error("drbg: tried 1000 values");
|
38952
|
+
let len = 0;
|
38953
|
+
const out = [];
|
38954
|
+
while (len < qByteLen) {
|
38955
|
+
v = h();
|
38956
|
+
const sl = v.slice();
|
38957
|
+
out.push(sl);
|
38958
|
+
len += v.length;
|
38959
|
+
}
|
38960
|
+
return concatBytes3(...out);
|
38961
|
+
};
|
38962
|
+
const genUntil = (seed, pred) => {
|
38963
|
+
reset();
|
38964
|
+
reseed(seed);
|
38965
|
+
let res = void 0;
|
38966
|
+
while (!(res = pred(gen3())))
|
38967
|
+
reseed();
|
38968
|
+
reset();
|
38969
|
+
return res;
|
38970
|
+
};
|
38971
|
+
return genUntil;
|
38972
|
+
}
|
38973
|
+
var validatorFns = {
|
38974
|
+
bigint: (val) => typeof val === "bigint",
|
38975
|
+
function: (val) => typeof val === "function",
|
38976
|
+
boolean: (val) => typeof val === "boolean",
|
38977
|
+
string: (val) => typeof val === "string",
|
38978
|
+
stringOrUint8Array: (val) => typeof val === "string" || isBytes(val),
|
38979
|
+
isSafeInteger: (val) => Number.isSafeInteger(val),
|
38980
|
+
array: (val) => Array.isArray(val),
|
38981
|
+
field: (val, object) => object.Fp.isValid(val),
|
38982
|
+
hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
|
38763
38983
|
};
|
38984
|
+
function validateObject(object, validators, optValidators = {}) {
|
38985
|
+
const checkField = (fieldName, type3, isOptional) => {
|
38986
|
+
const checkVal = validatorFns[type3];
|
38987
|
+
if (typeof checkVal !== "function")
|
38988
|
+
throw new Error(`Invalid validator "${type3}", expected function`);
|
38989
|
+
const val = object[fieldName];
|
38990
|
+
if (isOptional && val === void 0)
|
38991
|
+
return;
|
38992
|
+
if (!checkVal(val, object)) {
|
38993
|
+
throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type3}`);
|
38994
|
+
}
|
38995
|
+
};
|
38996
|
+
for (const [fieldName, type3] of Object.entries(validators))
|
38997
|
+
checkField(fieldName, type3, false);
|
38998
|
+
for (const [fieldName, type3] of Object.entries(optValidators))
|
38999
|
+
checkField(fieldName, type3, true);
|
39000
|
+
return object;
|
39001
|
+
}
|
38764
39002
|
|
38765
39003
|
// src/providers/provider.ts
|
38766
39004
|
var import_graphql_request = __toESM(require_dist2());
|
@@ -43879,7 +44117,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43879
44117
|
*
|
43880
44118
|
* @param quantities - CoinQuantity Array.
|
43881
44119
|
*/
|
43882
|
-
fundWithFakeUtxos(quantities) {
|
44120
|
+
fundWithFakeUtxos(quantities, resourcesOwner) {
|
43883
44121
|
let idCounter = 0;
|
43884
44122
|
const generateId = () => {
|
43885
44123
|
const counterString = String(idCounter++);
|
@@ -43903,7 +44141,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43903
44141
|
id: generateId(),
|
43904
44142
|
amount: quantity,
|
43905
44143
|
assetId,
|
43906
|
-
owner: Address.fromRandom(),
|
44144
|
+
owner: resourcesOwner || Address.fromRandom(),
|
43907
44145
|
maturity: 0,
|
43908
44146
|
blockCreated: bn(1),
|
43909
44147
|
txCreatedIdx: bn(1)
|
@@ -43936,19 +44174,29 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43936
44174
|
toJSON() {
|
43937
44175
|
return normalizeJSON(this);
|
43938
44176
|
}
|
43939
|
-
|
43940
|
-
|
43941
|
-
|
43942
|
-
|
43943
|
-
|
43944
|
-
|
43945
|
-
|
43946
|
-
|
43947
|
-
|
43948
|
-
|
43949
|
-
|
43950
|
-
|
43951
|
-
|
44177
|
+
updatePredicateInputs(inputs) {
|
44178
|
+
this.inputs.forEach((i) => {
|
44179
|
+
let correspondingInput;
|
44180
|
+
switch (i.type) {
|
44181
|
+
case InputType.Contract:
|
44182
|
+
return;
|
44183
|
+
case InputType.Coin:
|
44184
|
+
correspondingInput = inputs.find((x) => x.type === InputType.Coin && x.owner === i.owner);
|
44185
|
+
break;
|
44186
|
+
case InputType.Message:
|
44187
|
+
correspondingInput = inputs.find(
|
44188
|
+
(x) => x.type === InputType.Message && x.sender === i.sender
|
44189
|
+
);
|
44190
|
+
break;
|
44191
|
+
default:
|
44192
|
+
break;
|
44193
|
+
}
|
44194
|
+
if (correspondingInput && "predicateGasUsed" in correspondingInput && bn(correspondingInput.predicateGasUsed).gt(0)) {
|
44195
|
+
i.predicate = correspondingInput.predicate;
|
44196
|
+
i.predicateData = correspondingInput.predicateData;
|
44197
|
+
i.predicateGasUsed = correspondingInput.predicateGasUsed;
|
44198
|
+
}
|
44199
|
+
});
|
43952
44200
|
}
|
43953
44201
|
};
|
43954
44202
|
|
@@ -45562,7 +45810,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45562
45810
|
async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
|
45563
45811
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
45564
45812
|
if (estimateTxDependencies) {
|
45565
|
-
|
45813
|
+
return this.estimateTxDependencies(transactionRequest);
|
45566
45814
|
}
|
45567
45815
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
45568
45816
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
@@ -45581,6 +45829,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45581
45829
|
* @returns A promise that resolves to the estimated transaction request object.
|
45582
45830
|
*/
|
45583
45831
|
async estimatePredicates(transactionRequest) {
|
45832
|
+
const shouldEstimatePredicates = Boolean(
|
45833
|
+
transactionRequest.inputs.find(
|
45834
|
+
(input) => "predicate" in input && input.predicate && !equalBytes(arrayify(input.predicate), arrayify("0x")) && new BN(input.predicateGasUsed).isZero()
|
45835
|
+
)
|
45836
|
+
);
|
45837
|
+
if (!shouldEstimatePredicates) {
|
45838
|
+
return transactionRequest;
|
45839
|
+
}
|
45584
45840
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
45585
45841
|
const response = await this.operations.estimatePredicates({
|
45586
45842
|
encodedTransaction
|
@@ -45611,34 +45867,33 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45611
45867
|
* @returns A promise.
|
45612
45868
|
*/
|
45613
45869
|
async estimateTxDependencies(transactionRequest) {
|
45614
|
-
let missingOutputVariableCount = 0;
|
45615
|
-
let missingOutputContractIdsCount = 0;
|
45616
|
-
let tries = 0;
|
45617
45870
|
if (transactionRequest.type === TransactionType.Create) {
|
45618
|
-
return
|
45619
|
-
|
45620
|
-
|
45621
|
-
if (txRequest.hasPredicateInput()) {
|
45622
|
-
txRequest = await this.estimatePredicates(txRequest);
|
45871
|
+
return {
|
45872
|
+
receipts: []
|
45873
|
+
};
|
45623
45874
|
}
|
45624
|
-
|
45875
|
+
await this.estimatePredicates(transactionRequest);
|
45876
|
+
let receipts = [];
|
45877
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
45625
45878
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
45626
|
-
encodedTransaction: hexlify(
|
45879
|
+
encodedTransaction: hexlify(transactionRequest.toTransactionBytes()),
|
45627
45880
|
utxoValidation: false
|
45628
45881
|
});
|
45629
|
-
|
45882
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
45630
45883
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
45631
|
-
|
45632
|
-
|
45633
|
-
|
45634
|
-
|
45884
|
+
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
45885
|
+
if (hasMissingOutputs) {
|
45886
|
+
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
45887
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
45888
|
+
transactionRequest.addContractInputAndOutput(Address.fromString(contractId));
|
45889
|
+
});
|
45890
|
+
} else {
|
45891
|
+
break;
|
45635
45892
|
}
|
45636
|
-
txRequest.addVariableOutputs(missingOutputVariableCount);
|
45637
|
-
missingOutputContractIds.forEach(
|
45638
|
-
({ contractId }) => txRequest.addContractInputAndOutput(Address.fromString(contractId))
|
45639
|
-
);
|
45640
|
-
tries += 1;
|
45641
45893
|
}
|
45894
|
+
return {
|
45895
|
+
receipts
|
45896
|
+
};
|
45642
45897
|
}
|
45643
45898
|
/**
|
45644
45899
|
* Executes a signed transaction without applying the states changes
|
@@ -45653,7 +45908,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45653
45908
|
async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
45654
45909
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
45655
45910
|
if (estimateTxDependencies) {
|
45656
|
-
|
45911
|
+
return this.estimateTxDependencies(transactionRequest);
|
45657
45912
|
}
|
45658
45913
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
45659
45914
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
@@ -45680,36 +45935,38 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45680
45935
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
45681
45936
|
* @returns A promise that resolves to the transaction cost object.
|
45682
45937
|
*/
|
45683
|
-
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
45684
|
-
|
45938
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
45939
|
+
estimateTxDependencies = true,
|
45940
|
+
estimatePredicates = true,
|
45941
|
+
resourcesOwner
|
45942
|
+
} = {}) {
|
45943
|
+
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
45685
45944
|
const chainInfo = this.getChain();
|
45686
45945
|
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
45687
|
-
const gasPrice = max(
|
45688
|
-
const isScriptTransaction =
|
45689
|
-
|
45946
|
+
const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
45947
|
+
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
45948
|
+
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
45949
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
45950
|
+
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
45951
|
+
if (estimatePredicates) {
|
45690
45952
|
if (isScriptTransaction) {
|
45691
|
-
|
45953
|
+
txRequestClone.gasLimit = bn(0);
|
45954
|
+
}
|
45955
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
45956
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
45692
45957
|
}
|
45693
|
-
await this.estimatePredicates(
|
45958
|
+
await this.estimatePredicates(txRequestClone);
|
45694
45959
|
}
|
45695
|
-
const minGas =
|
45696
|
-
const maxGas =
|
45697
|
-
const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
|
45698
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
45699
|
-
transactionRequest.fundWithFakeUtxos(allQuantities);
|
45700
|
-
let gasUsed = minGas;
|
45960
|
+
const minGas = txRequestClone.calculateMinGas(chainInfo);
|
45961
|
+
const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
|
45701
45962
|
let receipts = [];
|
45702
|
-
if (isScriptTransaction) {
|
45703
|
-
|
45704
|
-
|
45705
|
-
const result = await this.
|
45706
|
-
estimateTxDependencies
|
45707
|
-
});
|
45963
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
45964
|
+
txRequestClone.gasPrice = bn(0);
|
45965
|
+
txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
|
45966
|
+
const result = await this.estimateTxDependencies(txRequestClone);
|
45708
45967
|
receipts = result.receipts;
|
45709
|
-
gasUsed = getGasUsedFromReceipts(receipts);
|
45710
|
-
} else {
|
45711
|
-
gasUsed = minGas;
|
45712
45968
|
}
|
45969
|
+
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
45713
45970
|
const usedFee = calculatePriceWithFactor(
|
45714
45971
|
gasUsed,
|
45715
45972
|
gasPrice,
|
@@ -45727,7 +45984,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45727
45984
|
maxGas,
|
45728
45985
|
usedFee,
|
45729
45986
|
minFee,
|
45730
|
-
maxFee
|
45987
|
+
maxFee,
|
45988
|
+
estimatedInputs: txRequestClone.inputs,
|
45989
|
+
estimatedOutputs: txRequestClone.outputs
|
45731
45990
|
};
|
45732
45991
|
}
|
45733
45992
|
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
@@ -46117,6 +46376,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46117
46376
|
});
|
46118
46377
|
return bn(latestBlockHeight);
|
46119
46378
|
}
|
46379
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
46380
|
+
async getTransactionResponse(transactionId) {
|
46381
|
+
return new TransactionResponse2(transactionId, this);
|
46382
|
+
}
|
46120
46383
|
};
|
46121
46384
|
var Provider = _Provider;
|
46122
46385
|
_cacheInputs = new WeakSet();
|
@@ -46133,6 +46396,51 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46133
46396
|
__publicField(Provider, "chainInfoCache", {});
|
46134
46397
|
__publicField(Provider, "nodeInfoCache", {});
|
46135
46398
|
|
46399
|
+
// src/providers/chains.ts
|
46400
|
+
var CHAIN_IDS = {
|
46401
|
+
eth: {
|
46402
|
+
sepolia: 11155111,
|
46403
|
+
foundry: 31337
|
46404
|
+
},
|
46405
|
+
fuel: {
|
46406
|
+
beta5: 0,
|
46407
|
+
devnet: 10
|
46408
|
+
}
|
46409
|
+
};
|
46410
|
+
|
46411
|
+
// src/providers/assets/index.ts
|
46412
|
+
var assets = [
|
46413
|
+
{
|
46414
|
+
name: "Ethereum",
|
46415
|
+
symbol: "ETH",
|
46416
|
+
icon: "eth.svg",
|
46417
|
+
networks: [
|
46418
|
+
{
|
46419
|
+
type: "ethereum",
|
46420
|
+
chainId: CHAIN_IDS.eth.sepolia,
|
46421
|
+
decimals: 18
|
46422
|
+
},
|
46423
|
+
{
|
46424
|
+
type: "ethereum",
|
46425
|
+
chainId: CHAIN_IDS.eth.foundry,
|
46426
|
+
decimals: 18
|
46427
|
+
},
|
46428
|
+
{
|
46429
|
+
type: "fuel",
|
46430
|
+
chainId: CHAIN_IDS.fuel.beta5,
|
46431
|
+
decimals: 9,
|
46432
|
+
assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
46433
|
+
},
|
46434
|
+
{
|
46435
|
+
type: "fuel",
|
46436
|
+
chainId: CHAIN_IDS.fuel.devnet,
|
46437
|
+
decimals: 9,
|
46438
|
+
assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
46439
|
+
}
|
46440
|
+
]
|
46441
|
+
}
|
46442
|
+
];
|
46443
|
+
|
46136
46444
|
// src/utils/formatTransferToContractScriptData.ts
|
46137
46445
|
var asm = __toESM(require_node());
|
46138
46446
|
var formatTransferToContractScriptData = (params) => {
|
@@ -46176,15 +46484,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46176
46484
|
* The provider used to interact with the network.
|
46177
46485
|
*/
|
46178
46486
|
_provider;
|
46487
|
+
_connector;
|
46179
46488
|
/**
|
46180
46489
|
* Creates a new Account instance.
|
46181
46490
|
*
|
46182
46491
|
* @param address - The address of the account.
|
46183
46492
|
* @param provider - A Provider instance (optional).
|
46184
46493
|
*/
|
46185
|
-
constructor(address, provider) {
|
46494
|
+
constructor(address, provider, connector) {
|
46186
46495
|
super();
|
46187
46496
|
this._provider = provider;
|
46497
|
+
this._connector = connector;
|
46188
46498
|
this.address = Address.fromDynamicInput(address);
|
46189
46499
|
}
|
46190
46500
|
/**
|
@@ -46390,7 +46700,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46390
46700
|
const params = { gasPrice: minGasPrice, ...txParams };
|
46391
46701
|
const request = new ScriptTransactionRequest(params);
|
46392
46702
|
request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
|
46393
|
-
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request
|
46703
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
46704
|
+
estimateTxDependencies: true,
|
46705
|
+
resourcesOwner: this
|
46706
|
+
});
|
46394
46707
|
request.gasPrice = bn(txParams.gasPrice ?? minGasPrice);
|
46395
46708
|
request.gasLimit = bn(txParams.gasLimit ?? gasUsed);
|
46396
46709
|
this.validateGas({
|
@@ -46400,6 +46713,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46400
46713
|
minGasPrice
|
46401
46714
|
});
|
46402
46715
|
await this.fund(request, requiredQuantities, maxFee);
|
46716
|
+
request.updatePredicateInputs(estimatedInputs);
|
46403
46717
|
return request;
|
46404
46718
|
}
|
46405
46719
|
/**
|
@@ -46413,7 +46727,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46413
46727
|
*/
|
46414
46728
|
async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
|
46415
46729
|
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
46416
|
-
return this.sendTransaction(request);
|
46730
|
+
return this.sendTransaction(request, { estimateTxDependencies: false });
|
46417
46731
|
}
|
46418
46732
|
/**
|
46419
46733
|
* Transfers coins to a contract address.
|
@@ -46492,17 +46806,30 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46492
46806
|
await this.fund(request, requiredQuantities, maxFee);
|
46493
46807
|
return this.sendTransaction(request);
|
46494
46808
|
}
|
46809
|
+
async signMessage(message) {
|
46810
|
+
if (!this._connector) {
|
46811
|
+
throw new FuelError(ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
46812
|
+
}
|
46813
|
+
return this._connector.signMessage(this.address.toString(), message);
|
46814
|
+
}
|
46495
46815
|
/**
|
46496
46816
|
* Sends a transaction to the network.
|
46497
46817
|
*
|
46498
46818
|
* @param transactionRequestLike - The transaction request to be sent.
|
46499
46819
|
* @returns A promise that resolves to the transaction response.
|
46500
46820
|
*/
|
46501
|
-
async sendTransaction(transactionRequestLike,
|
46821
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
46822
|
+
if (this._connector) {
|
46823
|
+
return this.provider.getTransactionResponse(
|
46824
|
+
await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
|
46825
|
+
);
|
46826
|
+
}
|
46502
46827
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
46503
|
-
|
46828
|
+
if (estimateTxDependencies) {
|
46829
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
46830
|
+
}
|
46504
46831
|
return this.provider.sendTransaction(transactionRequest, {
|
46505
|
-
|
46832
|
+
awaitExecution,
|
46506
46833
|
estimateTxDependencies: false
|
46507
46834
|
});
|
46508
46835
|
}
|
@@ -46512,9 +46839,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46512
46839
|
* @param transactionRequestLike - The transaction request to be simulated.
|
46513
46840
|
* @returns A promise that resolves to the call result.
|
46514
46841
|
*/
|
46515
|
-
async simulateTransaction(transactionRequestLike) {
|
46842
|
+
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
46516
46843
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
46517
|
-
|
46844
|
+
if (estimateTxDependencies) {
|
46845
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
46846
|
+
}
|
46518
46847
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
46519
46848
|
}
|
46520
46849
|
validateGas({
|
@@ -46543,11 +46872,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46543
46872
|
if (!Number.isSafeInteger(n) || n < 0)
|
46544
46873
|
throw new Error(`Wrong positive integer: ${n}`);
|
46545
46874
|
}
|
46546
|
-
function
|
46875
|
+
function isBytes2(a) {
|
46547
46876
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
46548
46877
|
}
|
46549
46878
|
function bytes3(b, ...lengths) {
|
46550
|
-
if (!
|
46879
|
+
if (!isBytes2(b))
|
46551
46880
|
throw new Error("Expected Uint8Array");
|
46552
46881
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
46553
46882
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
@@ -46577,7 +46906,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46577
46906
|
var crypto5 = nc2 && typeof nc2 === "object" && "webcrypto" in nc2 ? nc2.webcrypto : void 0;
|
46578
46907
|
|
46579
46908
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js
|
46580
|
-
function
|
46909
|
+
function isBytes3(a) {
|
46581
46910
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
46582
46911
|
}
|
46583
46912
|
var createView3 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
@@ -46585,23 +46914,23 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46585
46914
|
var isLE3 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
46586
46915
|
if (!isLE3)
|
46587
46916
|
throw new Error("Non little-endian hardware is not supported");
|
46588
|
-
function
|
46917
|
+
function utf8ToBytes4(str) {
|
46589
46918
|
if (typeof str !== "string")
|
46590
46919
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
46591
46920
|
return new Uint8Array(new TextEncoder().encode(str));
|
46592
46921
|
}
|
46593
46922
|
function toBytes4(data) {
|
46594
46923
|
if (typeof data === "string")
|
46595
|
-
data =
|
46596
|
-
if (!
|
46924
|
+
data = utf8ToBytes4(data);
|
46925
|
+
if (!isBytes3(data))
|
46597
46926
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
46598
46927
|
return data;
|
46599
46928
|
}
|
46600
|
-
function
|
46929
|
+
function concatBytes4(...arrays) {
|
46601
46930
|
let sum = 0;
|
46602
46931
|
for (let i = 0; i < arrays.length; i++) {
|
46603
46932
|
const a = arrays[i];
|
46604
|
-
if (!
|
46933
|
+
if (!isBytes3(a))
|
46605
46934
|
throw new Error("Uint8Array expected");
|
46606
46935
|
sum += a.length;
|
46607
46936
|
}
|
@@ -46887,242 +47216,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
46887
47216
|
};
|
46888
47217
|
var sha2563 = /* @__PURE__ */ wrapConstructor3(() => new SHA2562());
|
46889
47218
|
|
46890
|
-
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/utils.js
|
46891
|
-
var utils_exports = {};
|
46892
|
-
__export(utils_exports, {
|
46893
|
-
bitGet: () => bitGet,
|
46894
|
-
bitLen: () => bitLen,
|
46895
|
-
bitMask: () => bitMask,
|
46896
|
-
bitSet: () => bitSet,
|
46897
|
-
bytesToHex: () => bytesToHex2,
|
46898
|
-
bytesToNumberBE: () => bytesToNumberBE,
|
46899
|
-
bytesToNumberLE: () => bytesToNumberLE,
|
46900
|
-
concatBytes: () => concatBytes4,
|
46901
|
-
createHmacDrbg: () => createHmacDrbg,
|
46902
|
-
ensureBytes: () => ensureBytes,
|
46903
|
-
equalBytes: () => equalBytes,
|
46904
|
-
hexToBytes: () => hexToBytes2,
|
46905
|
-
hexToNumber: () => hexToNumber,
|
46906
|
-
isBytes: () => isBytes3,
|
46907
|
-
numberToBytesBE: () => numberToBytesBE,
|
46908
|
-
numberToBytesLE: () => numberToBytesLE,
|
46909
|
-
numberToHexUnpadded: () => numberToHexUnpadded,
|
46910
|
-
numberToVarBytesBE: () => numberToVarBytesBE,
|
46911
|
-
utf8ToBytes: () => utf8ToBytes4,
|
46912
|
-
validateObject: () => validateObject
|
46913
|
-
});
|
46914
|
-
var _0n3 = BigInt(0);
|
46915
|
-
var _1n3 = BigInt(1);
|
46916
|
-
var _2n3 = BigInt(2);
|
46917
|
-
function isBytes3(a) {
|
46918
|
-
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
46919
|
-
}
|
46920
|
-
var hexes3 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
46921
|
-
function bytesToHex2(bytes4) {
|
46922
|
-
if (!isBytes3(bytes4))
|
46923
|
-
throw new Error("Uint8Array expected");
|
46924
|
-
let hex = "";
|
46925
|
-
for (let i = 0; i < bytes4.length; i++) {
|
46926
|
-
hex += hexes3[bytes4[i]];
|
46927
|
-
}
|
46928
|
-
return hex;
|
46929
|
-
}
|
46930
|
-
function numberToHexUnpadded(num) {
|
46931
|
-
const hex = num.toString(16);
|
46932
|
-
return hex.length & 1 ? `0${hex}` : hex;
|
46933
|
-
}
|
46934
|
-
function hexToNumber(hex) {
|
46935
|
-
if (typeof hex !== "string")
|
46936
|
-
throw new Error("hex string expected, got " + typeof hex);
|
46937
|
-
return BigInt(hex === "" ? "0" : `0x${hex}`);
|
46938
|
-
}
|
46939
|
-
var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };
|
46940
|
-
function asciiToBase16(char) {
|
46941
|
-
if (char >= asciis._0 && char <= asciis._9)
|
46942
|
-
return char - asciis._0;
|
46943
|
-
if (char >= asciis._A && char <= asciis._F)
|
46944
|
-
return char - (asciis._A - 10);
|
46945
|
-
if (char >= asciis._a && char <= asciis._f)
|
46946
|
-
return char - (asciis._a - 10);
|
46947
|
-
return;
|
46948
|
-
}
|
46949
|
-
function hexToBytes2(hex) {
|
46950
|
-
if (typeof hex !== "string")
|
46951
|
-
throw new Error("hex string expected, got " + typeof hex);
|
46952
|
-
const hl = hex.length;
|
46953
|
-
const al = hl / 2;
|
46954
|
-
if (hl % 2)
|
46955
|
-
throw new Error("padded hex string expected, got unpadded hex of length " + hl);
|
46956
|
-
const array = new Uint8Array(al);
|
46957
|
-
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
46958
|
-
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
46959
|
-
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
46960
|
-
if (n1 === void 0 || n2 === void 0) {
|
46961
|
-
const char = hex[hi] + hex[hi + 1];
|
46962
|
-
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
46963
|
-
}
|
46964
|
-
array[ai] = n1 * 16 + n2;
|
46965
|
-
}
|
46966
|
-
return array;
|
46967
|
-
}
|
46968
|
-
function bytesToNumberBE(bytes4) {
|
46969
|
-
return hexToNumber(bytesToHex2(bytes4));
|
46970
|
-
}
|
46971
|
-
function bytesToNumberLE(bytes4) {
|
46972
|
-
if (!isBytes3(bytes4))
|
46973
|
-
throw new Error("Uint8Array expected");
|
46974
|
-
return hexToNumber(bytesToHex2(Uint8Array.from(bytes4).reverse()));
|
46975
|
-
}
|
46976
|
-
function numberToBytesBE(n, len) {
|
46977
|
-
return hexToBytes2(n.toString(16).padStart(len * 2, "0"));
|
46978
|
-
}
|
46979
|
-
function numberToBytesLE(n, len) {
|
46980
|
-
return numberToBytesBE(n, len).reverse();
|
46981
|
-
}
|
46982
|
-
function numberToVarBytesBE(n) {
|
46983
|
-
return hexToBytes2(numberToHexUnpadded(n));
|
46984
|
-
}
|
46985
|
-
function ensureBytes(title, hex, expectedLength) {
|
46986
|
-
let res;
|
46987
|
-
if (typeof hex === "string") {
|
46988
|
-
try {
|
46989
|
-
res = hexToBytes2(hex);
|
46990
|
-
} catch (e) {
|
46991
|
-
throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
|
46992
|
-
}
|
46993
|
-
} else if (isBytes3(hex)) {
|
46994
|
-
res = Uint8Array.from(hex);
|
46995
|
-
} else {
|
46996
|
-
throw new Error(`${title} must be hex string or Uint8Array`);
|
46997
|
-
}
|
46998
|
-
const len = res.length;
|
46999
|
-
if (typeof expectedLength === "number" && len !== expectedLength)
|
47000
|
-
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
47001
|
-
return res;
|
47002
|
-
}
|
47003
|
-
function concatBytes4(...arrays) {
|
47004
|
-
let sum = 0;
|
47005
|
-
for (let i = 0; i < arrays.length; i++) {
|
47006
|
-
const a = arrays[i];
|
47007
|
-
if (!isBytes3(a))
|
47008
|
-
throw new Error("Uint8Array expected");
|
47009
|
-
sum += a.length;
|
47010
|
-
}
|
47011
|
-
let res = new Uint8Array(sum);
|
47012
|
-
let pad3 = 0;
|
47013
|
-
for (let i = 0; i < arrays.length; i++) {
|
47014
|
-
const a = arrays[i];
|
47015
|
-
res.set(a, pad3);
|
47016
|
-
pad3 += a.length;
|
47017
|
-
}
|
47018
|
-
return res;
|
47019
|
-
}
|
47020
|
-
function equalBytes(a, b) {
|
47021
|
-
if (a.length !== b.length)
|
47022
|
-
return false;
|
47023
|
-
let diff = 0;
|
47024
|
-
for (let i = 0; i < a.length; i++)
|
47025
|
-
diff |= a[i] ^ b[i];
|
47026
|
-
return diff === 0;
|
47027
|
-
}
|
47028
|
-
function utf8ToBytes4(str) {
|
47029
|
-
if (typeof str !== "string")
|
47030
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
47031
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
47032
|
-
}
|
47033
|
-
function bitLen(n) {
|
47034
|
-
let len;
|
47035
|
-
for (len = 0; n > _0n3; n >>= _1n3, len += 1)
|
47036
|
-
;
|
47037
|
-
return len;
|
47038
|
-
}
|
47039
|
-
function bitGet(n, pos) {
|
47040
|
-
return n >> BigInt(pos) & _1n3;
|
47041
|
-
}
|
47042
|
-
var bitSet = (n, pos, value) => {
|
47043
|
-
return n | (value ? _1n3 : _0n3) << BigInt(pos);
|
47044
|
-
};
|
47045
|
-
var bitMask = (n) => (_2n3 << BigInt(n - 1)) - _1n3;
|
47046
|
-
var u8n = (data) => new Uint8Array(data);
|
47047
|
-
var u8fr = (arr) => Uint8Array.from(arr);
|
47048
|
-
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
47049
|
-
if (typeof hashLen !== "number" || hashLen < 2)
|
47050
|
-
throw new Error("hashLen must be a number");
|
47051
|
-
if (typeof qByteLen !== "number" || qByteLen < 2)
|
47052
|
-
throw new Error("qByteLen must be a number");
|
47053
|
-
if (typeof hmacFn !== "function")
|
47054
|
-
throw new Error("hmacFn must be a function");
|
47055
|
-
let v = u8n(hashLen);
|
47056
|
-
let k = u8n(hashLen);
|
47057
|
-
let i = 0;
|
47058
|
-
const reset = () => {
|
47059
|
-
v.fill(1);
|
47060
|
-
k.fill(0);
|
47061
|
-
i = 0;
|
47062
|
-
};
|
47063
|
-
const h = (...b) => hmacFn(k, v, ...b);
|
47064
|
-
const reseed = (seed = u8n()) => {
|
47065
|
-
k = h(u8fr([0]), seed);
|
47066
|
-
v = h();
|
47067
|
-
if (seed.length === 0)
|
47068
|
-
return;
|
47069
|
-
k = h(u8fr([1]), seed);
|
47070
|
-
v = h();
|
47071
|
-
};
|
47072
|
-
const gen3 = () => {
|
47073
|
-
if (i++ >= 1e3)
|
47074
|
-
throw new Error("drbg: tried 1000 values");
|
47075
|
-
let len = 0;
|
47076
|
-
const out = [];
|
47077
|
-
while (len < qByteLen) {
|
47078
|
-
v = h();
|
47079
|
-
const sl = v.slice();
|
47080
|
-
out.push(sl);
|
47081
|
-
len += v.length;
|
47082
|
-
}
|
47083
|
-
return concatBytes4(...out);
|
47084
|
-
};
|
47085
|
-
const genUntil = (seed, pred) => {
|
47086
|
-
reset();
|
47087
|
-
reseed(seed);
|
47088
|
-
let res = void 0;
|
47089
|
-
while (!(res = pred(gen3())))
|
47090
|
-
reseed();
|
47091
|
-
reset();
|
47092
|
-
return res;
|
47093
|
-
};
|
47094
|
-
return genUntil;
|
47095
|
-
}
|
47096
|
-
var validatorFns = {
|
47097
|
-
bigint: (val) => typeof val === "bigint",
|
47098
|
-
function: (val) => typeof val === "function",
|
47099
|
-
boolean: (val) => typeof val === "boolean",
|
47100
|
-
string: (val) => typeof val === "string",
|
47101
|
-
stringOrUint8Array: (val) => typeof val === "string" || isBytes3(val),
|
47102
|
-
isSafeInteger: (val) => Number.isSafeInteger(val),
|
47103
|
-
array: (val) => Array.isArray(val),
|
47104
|
-
field: (val, object) => object.Fp.isValid(val),
|
47105
|
-
hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
|
47106
|
-
};
|
47107
|
-
function validateObject(object, validators, optValidators = {}) {
|
47108
|
-
const checkField = (fieldName, type3, isOptional) => {
|
47109
|
-
const checkVal = validatorFns[type3];
|
47110
|
-
if (typeof checkVal !== "function")
|
47111
|
-
throw new Error(`Invalid validator "${type3}", expected function`);
|
47112
|
-
const val = object[fieldName];
|
47113
|
-
if (isOptional && val === void 0)
|
47114
|
-
return;
|
47115
|
-
if (!checkVal(val, object)) {
|
47116
|
-
throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type3}`);
|
47117
|
-
}
|
47118
|
-
};
|
47119
|
-
for (const [fieldName, type3] of Object.entries(validators))
|
47120
|
-
checkField(fieldName, type3, false);
|
47121
|
-
for (const [fieldName, type3] of Object.entries(optValidators))
|
47122
|
-
checkField(fieldName, type3, true);
|
47123
|
-
return object;
|
47124
|
-
}
|
47125
|
-
|
47126
47219
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/modular.js
|
47127
47220
|
var _0n4 = BigInt(0);
|
47128
47221
|
var _1n4 = BigInt(1);
|
@@ -47558,7 +47651,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47558
47651
|
toSig(hex) {
|
47559
47652
|
const { Err: E } = DER;
|
47560
47653
|
const data = typeof hex === "string" ? h2b(hex) : hex;
|
47561
|
-
if (!
|
47654
|
+
if (!isBytes(data))
|
47562
47655
|
throw new Error("ui8a expected");
|
47563
47656
|
let l = data.length;
|
47564
47657
|
if (l < 2 || data[0] != 48)
|
@@ -47596,7 +47689,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47596
47689
|
const { Fp: Fp2 } = CURVE;
|
47597
47690
|
const toBytes5 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
47598
47691
|
const a = point.toAffine();
|
47599
|
-
return
|
47692
|
+
return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
47600
47693
|
});
|
47601
47694
|
const fromBytes = CURVE.fromBytes || ((bytes4) => {
|
47602
47695
|
const tail = bytes4.subarray(1);
|
@@ -47622,7 +47715,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47622
47715
|
function normPrivateKeyToScalar(key) {
|
47623
47716
|
const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;
|
47624
47717
|
if (lengths && typeof key !== "bigint") {
|
47625
|
-
if (
|
47718
|
+
if (isBytes(key))
|
47626
47719
|
key = bytesToHex2(key);
|
47627
47720
|
if (typeof key !== "string" || !lengths.includes(key.length))
|
47628
47721
|
throw new Error("Invalid key");
|
@@ -48012,7 +48105,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48012
48105
|
toBytes(_c, point, isCompressed) {
|
48013
48106
|
const a = point.toAffine();
|
48014
48107
|
const x = Fp2.toBytes(a.x);
|
48015
|
-
const cat =
|
48108
|
+
const cat = concatBytes3;
|
48016
48109
|
if (isCompressed) {
|
48017
48110
|
return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
|
48018
48111
|
} else {
|
@@ -48157,7 +48250,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48157
48250
|
return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed);
|
48158
48251
|
}
|
48159
48252
|
function isProbPub(item) {
|
48160
|
-
const arr =
|
48253
|
+
const arr = isBytes(item);
|
48161
48254
|
const str = typeof item === "string";
|
48162
48255
|
const len = (arr || str) && item.length;
|
48163
48256
|
if (arr)
|
@@ -48209,7 +48302,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48209
48302
|
const e = ent === true ? randomBytes5(Fp2.BYTES) : ent;
|
48210
48303
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
48211
48304
|
}
|
48212
|
-
const seed =
|
48305
|
+
const seed = concatBytes3(...seedArgs);
|
48213
48306
|
const m = h1int;
|
48214
48307
|
function k2sig(kBytes) {
|
48215
48308
|
const k = bits2int(kBytes);
|
@@ -48252,7 +48345,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48252
48345
|
let _sig = void 0;
|
48253
48346
|
let P;
|
48254
48347
|
try {
|
48255
|
-
if (typeof sg === "string" ||
|
48348
|
+
if (typeof sg === "string" || isBytes(sg)) {
|
48256
48349
|
try {
|
48257
48350
|
_sig = Signature2.fromDER(sg);
|
48258
48351
|
} catch (derError) {
|
@@ -48368,7 +48461,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48368
48461
|
function getHash(hash5) {
|
48369
48462
|
return {
|
48370
48463
|
hash: hash5,
|
48371
|
-
hmac: (key, ...msgs) => hmac2(hash5, key,
|
48464
|
+
hmac: (key, ...msgs) => hmac2(hash5, key, concatBytes4(...msgs)),
|
48372
48465
|
randomBytes: randomBytes4
|
48373
48466
|
};
|
48374
48467
|
}
|
@@ -48767,12 +48860,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48767
48860
|
* @param transactionRequestLike - The transaction request to send.
|
48768
48861
|
* @returns A promise that resolves to the TransactionResponse object.
|
48769
48862
|
*/
|
48770
|
-
async sendTransaction(transactionRequestLike,
|
48863
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
48771
48864
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48772
|
-
|
48865
|
+
if (estimateTxDependencies) {
|
48866
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
48867
|
+
}
|
48773
48868
|
return this.provider.sendTransaction(
|
48774
48869
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
48775
|
-
{
|
48870
|
+
{ awaitExecution, estimateTxDependencies: false }
|
48776
48871
|
);
|
48777
48872
|
}
|
48778
48873
|
/**
|
@@ -48781,9 +48876,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48781
48876
|
* @param transactionRequestLike - The transaction request to simulate.
|
48782
48877
|
* @returns A promise that resolves to the CallResult object.
|
48783
48878
|
*/
|
48784
|
-
async simulateTransaction(transactionRequestLike) {
|
48879
|
+
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
48785
48880
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
48786
|
-
|
48881
|
+
if (estimateTxDependencies) {
|
48882
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
48883
|
+
}
|
48787
48884
|
return this.provider.call(
|
48788
48885
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
48789
48886
|
{
|
@@ -51767,12 +51864,12 @@ mime-types/index.js:
|
|
51767
51864
|
@noble/hashes/esm/utils.js:
|
51768
51865
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
51769
51866
|
|
51770
|
-
@noble/hashes/esm/utils.js:
|
51771
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
51772
|
-
|
51773
51867
|
@noble/curves/esm/abstract/utils.js:
|
51774
51868
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
51775
51869
|
|
51870
|
+
@noble/hashes/esm/utils.js:
|
51871
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
51872
|
+
|
51776
51873
|
@noble/curves/esm/abstract/modular.js:
|
51777
51874
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
51778
51875
|
|