starknet 6.7.0 → 6.9.0
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.
- package/CHANGELOG.md +30 -0
- package/README.md +2 -0
- package/dist/index.d.ts +1064 -1420
- package/dist/index.global.js +1335 -964
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +529 -518
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +512 -489
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -4
package/dist/index.global.js
CHANGED
|
@@ -12324,9 +12324,9 @@ var starknet = (() => {
|
|
|
12324
12324
|
var form = new FormData();
|
|
12325
12325
|
body.trim().split("&").forEach(function(bytes3) {
|
|
12326
12326
|
if (bytes3) {
|
|
12327
|
-
var
|
|
12328
|
-
var name =
|
|
12329
|
-
var value =
|
|
12327
|
+
var split3 = bytes3.split("=");
|
|
12328
|
+
var name = split3.shift().replace(/\+/g, " ");
|
|
12329
|
+
var value = split3.join("=").replace(/\+/g, " ");
|
|
12330
12330
|
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
12331
12331
|
}
|
|
12332
12332
|
});
|
|
@@ -12696,13 +12696,12 @@ var starknet = (() => {
|
|
|
12696
12696
|
Literal: () => Literal,
|
|
12697
12697
|
Provider: () => RpcProvider2,
|
|
12698
12698
|
ProviderInterface: () => ProviderInterface,
|
|
12699
|
-
RPC: () =>
|
|
12699
|
+
RPC: () => api_exports2,
|
|
12700
12700
|
RPC06: () => rpc_0_6_exports,
|
|
12701
12701
|
RPC07: () => rpc_0_7_exports,
|
|
12702
12702
|
ReceiptTx: () => ReceiptTx,
|
|
12703
12703
|
RpcChannel: () => RpcChannel2,
|
|
12704
12704
|
RpcProvider: () => RpcProvider2,
|
|
12705
|
-
SIMULATION_FLAG: () => SIMULATION_FLAG,
|
|
12706
12705
|
Signer: () => Signer,
|
|
12707
12706
|
SignerInterface: () => SignerInterface,
|
|
12708
12707
|
TransactionExecutionStatus: () => TransactionExecutionStatus,
|
|
@@ -12746,6 +12745,7 @@ var starknet = (() => {
|
|
|
12746
12745
|
merkle: () => merkle_exports,
|
|
12747
12746
|
num: () => num_exports,
|
|
12748
12747
|
number: () => number3,
|
|
12748
|
+
parseCalldataField: () => parseCalldataField,
|
|
12749
12749
|
parseUDCEvent: () => parseUDCEvent,
|
|
12750
12750
|
provider: () => provider_exports,
|
|
12751
12751
|
selector: () => selector_exports,
|
|
@@ -12790,8 +12790,9 @@ var starknet = (() => {
|
|
|
12790
12790
|
});
|
|
12791
12791
|
|
|
12792
12792
|
// src/types/api/index.ts
|
|
12793
|
-
var
|
|
12794
|
-
__export(
|
|
12793
|
+
var api_exports2 = {};
|
|
12794
|
+
__export(api_exports2, {
|
|
12795
|
+
API: () => api_exports,
|
|
12795
12796
|
EBlockTag: () => EBlockTag2,
|
|
12796
12797
|
EDAMode: () => EDAMode2,
|
|
12797
12798
|
EDataAvailabilityMode: () => EDataAvailabilityMode2,
|
|
@@ -12805,9 +12806,12 @@ var starknet = (() => {
|
|
|
12805
12806
|
ETransactionVersion3: () => ETransactionVersion32,
|
|
12806
12807
|
Errors: () => errors_exports2,
|
|
12807
12808
|
JRPC: () => jsonrpc_exports,
|
|
12809
|
+
Permission: () => Permission,
|
|
12808
12810
|
RPCSPEC06: () => rpcspec_0_6_exports,
|
|
12809
|
-
RPCSPEC07: () =>
|
|
12810
|
-
SPEC: () => components_exports2
|
|
12811
|
+
RPCSPEC07: () => esm_exports,
|
|
12812
|
+
SPEC: () => components_exports2,
|
|
12813
|
+
TypedDataRevision: () => TypedDataRevision,
|
|
12814
|
+
WALLET_API: () => wallet_api_exports
|
|
12811
12815
|
});
|
|
12812
12816
|
|
|
12813
12817
|
// src/types/api/jsonrpc/index.ts
|
|
@@ -12909,9 +12913,31 @@ var starknet = (() => {
|
|
|
12909
12913
|
return ETransactionVersion34;
|
|
12910
12914
|
})(ETransactionVersion3 || {});
|
|
12911
12915
|
|
|
12912
|
-
//
|
|
12913
|
-
var
|
|
12914
|
-
__export(
|
|
12916
|
+
// node_modules/starknet-types-07/dist/esm/index.js
|
|
12917
|
+
var esm_exports = {};
|
|
12918
|
+
__export(esm_exports, {
|
|
12919
|
+
API: () => api_exports,
|
|
12920
|
+
EBlockTag: () => EBlockTag2,
|
|
12921
|
+
EDAMode: () => EDAMode2,
|
|
12922
|
+
EDataAvailabilityMode: () => EDataAvailabilityMode2,
|
|
12923
|
+
ESimulationFlag: () => ESimulationFlag2,
|
|
12924
|
+
ETransactionExecutionStatus: () => ETransactionExecutionStatus2,
|
|
12925
|
+
ETransactionFinalityStatus: () => ETransactionFinalityStatus2,
|
|
12926
|
+
ETransactionStatus: () => ETransactionStatus2,
|
|
12927
|
+
ETransactionType: () => ETransactionType2,
|
|
12928
|
+
ETransactionVersion: () => ETransactionVersion4,
|
|
12929
|
+
ETransactionVersion2: () => ETransactionVersion22,
|
|
12930
|
+
ETransactionVersion3: () => ETransactionVersion32,
|
|
12931
|
+
Errors: () => errors_exports2,
|
|
12932
|
+
Permission: () => Permission,
|
|
12933
|
+
SPEC: () => components_exports2,
|
|
12934
|
+
TypedDataRevision: () => TypedDataRevision,
|
|
12935
|
+
WALLET_API: () => wallet_api_exports
|
|
12936
|
+
});
|
|
12937
|
+
|
|
12938
|
+
// node_modules/starknet-types-07/dist/esm/api/index.js
|
|
12939
|
+
var api_exports = {};
|
|
12940
|
+
__export(api_exports, {
|
|
12915
12941
|
EBlockTag: () => EBlockTag2,
|
|
12916
12942
|
EDAMode: () => EDAMode2,
|
|
12917
12943
|
EDataAvailabilityMode: () => EDataAvailabilityMode2,
|
|
@@ -12927,59 +12953,60 @@ var starknet = (() => {
|
|
|
12927
12953
|
SPEC: () => components_exports2
|
|
12928
12954
|
});
|
|
12929
12955
|
|
|
12930
|
-
//
|
|
12956
|
+
// node_modules/starknet-types-07/dist/esm/api/errors.js
|
|
12931
12957
|
var errors_exports2 = {};
|
|
12932
12958
|
|
|
12933
|
-
//
|
|
12959
|
+
// node_modules/starknet-types-07/dist/esm/api/components.js
|
|
12934
12960
|
var components_exports2 = {};
|
|
12935
12961
|
|
|
12936
|
-
//
|
|
12937
|
-
var ETransactionType2
|
|
12962
|
+
// node_modules/starknet-types-07/dist/esm/api/nonspec.js
|
|
12963
|
+
var ETransactionType2;
|
|
12964
|
+
(function(ETransactionType3) {
|
|
12938
12965
|
ETransactionType3["DECLARE"] = "DECLARE";
|
|
12939
12966
|
ETransactionType3["DEPLOY"] = "DEPLOY";
|
|
12940
12967
|
ETransactionType3["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
|
|
12941
12968
|
ETransactionType3["INVOKE"] = "INVOKE";
|
|
12942
12969
|
ETransactionType3["L1_HANDLER"] = "L1_HANDLER";
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
|
|
12970
|
+
})(ETransactionType2 || (ETransactionType2 = {}));
|
|
12971
|
+
var ESimulationFlag2;
|
|
12972
|
+
(function(ESimulationFlag3) {
|
|
12946
12973
|
ESimulationFlag3["SKIP_VALIDATE"] = "SKIP_VALIDATE";
|
|
12947
12974
|
ESimulationFlag3["SKIP_FEE_CHARGE"] = "SKIP_FEE_CHARGE";
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12975
|
+
})(ESimulationFlag2 || (ESimulationFlag2 = {}));
|
|
12976
|
+
var ETransactionStatus2;
|
|
12977
|
+
(function(ETransactionStatus3) {
|
|
12951
12978
|
ETransactionStatus3["RECEIVED"] = "RECEIVED";
|
|
12952
12979
|
ETransactionStatus3["REJECTED"] = "REJECTED";
|
|
12953
12980
|
ETransactionStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
12954
12981
|
ETransactionStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12982
|
+
})(ETransactionStatus2 || (ETransactionStatus2 = {}));
|
|
12983
|
+
var ETransactionFinalityStatus2;
|
|
12984
|
+
(function(ETransactionFinalityStatus3) {
|
|
12958
12985
|
ETransactionFinalityStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
12959
12986
|
ETransactionFinalityStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12987
|
+
})(ETransactionFinalityStatus2 || (ETransactionFinalityStatus2 = {}));
|
|
12988
|
+
var ETransactionExecutionStatus2;
|
|
12989
|
+
(function(ETransactionExecutionStatus3) {
|
|
12963
12990
|
ETransactionExecutionStatus3["SUCCEEDED"] = "SUCCEEDED";
|
|
12964
12991
|
ETransactionExecutionStatus3["REVERTED"] = "REVERTED";
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12992
|
+
})(ETransactionExecutionStatus2 || (ETransactionExecutionStatus2 = {}));
|
|
12993
|
+
var EBlockTag2;
|
|
12994
|
+
(function(EBlockTag3) {
|
|
12968
12995
|
EBlockTag3["LATEST"] = "latest";
|
|
12969
12996
|
EBlockTag3["PENDING"] = "pending";
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12997
|
+
})(EBlockTag2 || (EBlockTag2 = {}));
|
|
12998
|
+
var EDataAvailabilityMode2;
|
|
12999
|
+
(function(EDataAvailabilityMode3) {
|
|
12973
13000
|
EDataAvailabilityMode3["L1"] = "L1";
|
|
12974
13001
|
EDataAvailabilityMode3["L2"] = "L2";
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
13002
|
+
})(EDataAvailabilityMode2 || (EDataAvailabilityMode2 = {}));
|
|
13003
|
+
var EDAMode2;
|
|
13004
|
+
(function(EDAMode4) {
|
|
12978
13005
|
EDAMode4[EDAMode4["L1"] = 0] = "L1";
|
|
12979
13006
|
EDAMode4[EDAMode4["L2"] = 1] = "L2";
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
13007
|
+
})(EDAMode2 || (EDAMode2 = {}));
|
|
13008
|
+
var ETransactionVersion4;
|
|
13009
|
+
(function(ETransactionVersion5) {
|
|
12983
13010
|
ETransactionVersion5["V0"] = "0x0";
|
|
12984
13011
|
ETransactionVersion5["V1"] = "0x1";
|
|
12985
13012
|
ETransactionVersion5["V2"] = "0x2";
|
|
@@ -12988,22 +13015,41 @@ var starknet = (() => {
|
|
|
12988
13015
|
ETransactionVersion5["F1"] = "0x100000000000000000000000000000001";
|
|
12989
13016
|
ETransactionVersion5["F2"] = "0x100000000000000000000000000000002";
|
|
12990
13017
|
ETransactionVersion5["F3"] = "0x100000000000000000000000000000003";
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
13018
|
+
})(ETransactionVersion4 || (ETransactionVersion4 = {}));
|
|
13019
|
+
var ETransactionVersion22;
|
|
13020
|
+
(function(ETransactionVersion24) {
|
|
12994
13021
|
ETransactionVersion24["V0"] = "0x0";
|
|
12995
13022
|
ETransactionVersion24["V1"] = "0x1";
|
|
12996
13023
|
ETransactionVersion24["V2"] = "0x2";
|
|
12997
13024
|
ETransactionVersion24["F0"] = "0x100000000000000000000000000000000";
|
|
12998
13025
|
ETransactionVersion24["F1"] = "0x100000000000000000000000000000001";
|
|
12999
13026
|
ETransactionVersion24["F2"] = "0x100000000000000000000000000000002";
|
|
13000
|
-
|
|
13001
|
-
|
|
13002
|
-
|
|
13027
|
+
})(ETransactionVersion22 || (ETransactionVersion22 = {}));
|
|
13028
|
+
var ETransactionVersion32;
|
|
13029
|
+
(function(ETransactionVersion34) {
|
|
13003
13030
|
ETransactionVersion34["V3"] = "0x3";
|
|
13004
13031
|
ETransactionVersion34["F3"] = "0x100000000000000000000000000000003";
|
|
13005
|
-
|
|
13006
|
-
|
|
13032
|
+
})(ETransactionVersion32 || (ETransactionVersion32 = {}));
|
|
13033
|
+
|
|
13034
|
+
// node_modules/starknet-types-07/dist/esm/wallet-api/index.js
|
|
13035
|
+
var wallet_api_exports = {};
|
|
13036
|
+
__export(wallet_api_exports, {
|
|
13037
|
+
Permission: () => Permission,
|
|
13038
|
+
TypedDataRevision: () => TypedDataRevision
|
|
13039
|
+
});
|
|
13040
|
+
|
|
13041
|
+
// node_modules/starknet-types-07/dist/esm/wallet-api/constants.js
|
|
13042
|
+
var Permission;
|
|
13043
|
+
(function(Permission2) {
|
|
13044
|
+
Permission2["Accounts"] = "accounts";
|
|
13045
|
+
})(Permission || (Permission = {}));
|
|
13046
|
+
|
|
13047
|
+
// node_modules/starknet-types-07/dist/esm/wallet-api/typedData.js
|
|
13048
|
+
var TypedDataRevision;
|
|
13049
|
+
(function(TypedDataRevision2) {
|
|
13050
|
+
TypedDataRevision2["Active"] = "1";
|
|
13051
|
+
TypedDataRevision2["Legacy"] = "0";
|
|
13052
|
+
})(TypedDataRevision || (TypedDataRevision = {}));
|
|
13007
13053
|
|
|
13008
13054
|
// src/utils/encode.ts
|
|
13009
13055
|
var encode_exports = {};
|
|
@@ -13252,19 +13298,16 @@ var starknet = (() => {
|
|
|
13252
13298
|
var RANGE_U128 = range(ZERO, 2n ** 128n - 1n);
|
|
13253
13299
|
var BaseUrl = /* @__PURE__ */ ((BaseUrl2) => {
|
|
13254
13300
|
BaseUrl2["SN_MAIN"] = "https://alpha-mainnet.starknet.io";
|
|
13255
|
-
BaseUrl2["SN_GOERLI"] = "https://alpha4.starknet.io";
|
|
13256
13301
|
BaseUrl2["SN_SEPOLIA"] = "https://alpha-sepolia.starknet.io";
|
|
13257
13302
|
return BaseUrl2;
|
|
13258
13303
|
})(BaseUrl || {});
|
|
13259
13304
|
var NetworkName = /* @__PURE__ */ ((NetworkName2) => {
|
|
13260
13305
|
NetworkName2["SN_MAIN"] = "SN_MAIN";
|
|
13261
|
-
NetworkName2["SN_GOERLI"] = "SN_GOERLI";
|
|
13262
13306
|
NetworkName2["SN_SEPOLIA"] = "SN_SEPOLIA";
|
|
13263
13307
|
return NetworkName2;
|
|
13264
13308
|
})(NetworkName || {});
|
|
13265
13309
|
var StarknetChainId = /* @__PURE__ */ ((StarknetChainId6) => {
|
|
13266
13310
|
StarknetChainId6["SN_MAIN"] = "0x534e5f4d41494e";
|
|
13267
|
-
StarknetChainId6["SN_GOERLI"] = "0x534e5f474f45524c49";
|
|
13268
13311
|
StarknetChainId6["SN_SEPOLIA"] = "0x534e5f5345504f4c4941";
|
|
13269
13312
|
return StarknetChainId6;
|
|
13270
13313
|
})(StarknetChainId || {});
|
|
@@ -13288,10 +13331,6 @@ var starknet = (() => {
|
|
|
13288
13331
|
};
|
|
13289
13332
|
var RPC_DEFAULT_VERSION = "v0_7";
|
|
13290
13333
|
var RPC_NODES = {
|
|
13291
|
-
SN_GOERLI: [
|
|
13292
|
-
`https://starknet-testnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
|
|
13293
|
-
`https://free-rpc.nethermind.io/goerli-juno/${RPC_DEFAULT_VERSION}`
|
|
13294
|
-
],
|
|
13295
13334
|
SN_MAIN: [
|
|
13296
13335
|
`https://starknet-mainnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
|
|
13297
13336
|
`https://free-rpc.nethermind.io/mainnet-juno/${RPC_DEFAULT_VERSION}`
|
|
@@ -13302,188 +13341,6 @@ var starknet = (() => {
|
|
|
13302
13341
|
]
|
|
13303
13342
|
};
|
|
13304
13343
|
|
|
13305
|
-
// src/provider/errors.ts
|
|
13306
|
-
function fixStack(target, fn = target.constructor) {
|
|
13307
|
-
const { captureStackTrace } = Error;
|
|
13308
|
-
captureStackTrace && captureStackTrace(target, fn);
|
|
13309
|
-
}
|
|
13310
|
-
function fixProto(target, prototype) {
|
|
13311
|
-
const { setPrototypeOf } = Object;
|
|
13312
|
-
setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
13313
|
-
}
|
|
13314
|
-
var CustomError = class extends Error {
|
|
13315
|
-
name;
|
|
13316
|
-
constructor(message) {
|
|
13317
|
-
super(message);
|
|
13318
|
-
Object.defineProperty(this, "name", {
|
|
13319
|
-
value: new.target.name,
|
|
13320
|
-
enumerable: false,
|
|
13321
|
-
configurable: true
|
|
13322
|
-
});
|
|
13323
|
-
fixProto(this, new.target.prototype);
|
|
13324
|
-
fixStack(this);
|
|
13325
|
-
}
|
|
13326
|
-
};
|
|
13327
|
-
var LibraryError = class extends CustomError {
|
|
13328
|
-
};
|
|
13329
|
-
var GatewayError = class extends LibraryError {
|
|
13330
|
-
constructor(message, errorCode) {
|
|
13331
|
-
super(message);
|
|
13332
|
-
this.errorCode = errorCode;
|
|
13333
|
-
}
|
|
13334
|
-
};
|
|
13335
|
-
var HttpError = class extends LibraryError {
|
|
13336
|
-
constructor(message, errorCode) {
|
|
13337
|
-
super(message);
|
|
13338
|
-
this.errorCode = errorCode;
|
|
13339
|
-
}
|
|
13340
|
-
};
|
|
13341
|
-
|
|
13342
|
-
// src/channel/rpc_0_6.ts
|
|
13343
|
-
var rpc_0_6_exports = {};
|
|
13344
|
-
__export(rpc_0_6_exports, {
|
|
13345
|
-
RpcChannel: () => RpcChannel
|
|
13346
|
-
});
|
|
13347
|
-
|
|
13348
|
-
// src/types/index.ts
|
|
13349
|
-
var types_exports = {};
|
|
13350
|
-
__export(types_exports, {
|
|
13351
|
-
BlockStatus: () => BlockStatus,
|
|
13352
|
-
BlockTag: () => BlockTag,
|
|
13353
|
-
EntryPointType: () => EntryPointType,
|
|
13354
|
-
Literal: () => Literal,
|
|
13355
|
-
RPC: () => api_exports,
|
|
13356
|
-
SIMULATION_FLAG: () => SIMULATION_FLAG,
|
|
13357
|
-
TransactionExecutionStatus: () => TransactionExecutionStatus,
|
|
13358
|
-
TransactionFinalityStatus: () => TransactionFinalityStatus,
|
|
13359
|
-
TransactionStatus: () => TransactionStatus,
|
|
13360
|
-
TransactionType: () => TransactionType,
|
|
13361
|
-
TypedDataRevision: () => TypedDataRevision,
|
|
13362
|
-
Uint: () => Uint,
|
|
13363
|
-
ValidateType: () => ValidateType
|
|
13364
|
-
});
|
|
13365
|
-
|
|
13366
|
-
// src/types/account.ts
|
|
13367
|
-
var SIMULATION_FLAG = /* @__PURE__ */ ((SIMULATION_FLAG2) => {
|
|
13368
|
-
SIMULATION_FLAG2["SKIP_VALIDATE"] = "SKIP_VALIDATE";
|
|
13369
|
-
SIMULATION_FLAG2["SKIP_EXECUTE"] = "SKIP_EXECUTE";
|
|
13370
|
-
return SIMULATION_FLAG2;
|
|
13371
|
-
})(SIMULATION_FLAG || {});
|
|
13372
|
-
|
|
13373
|
-
// src/types/calldata.ts
|
|
13374
|
-
var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
13375
|
-
ValidateType2["DEPLOY"] = "DEPLOY";
|
|
13376
|
-
ValidateType2["CALL"] = "CALL";
|
|
13377
|
-
ValidateType2["INVOKE"] = "INVOKE";
|
|
13378
|
-
return ValidateType2;
|
|
13379
|
-
})(ValidateType || {});
|
|
13380
|
-
var Uint = /* @__PURE__ */ ((Uint2) => {
|
|
13381
|
-
Uint2["u8"] = "core::integer::u8";
|
|
13382
|
-
Uint2["u16"] = "core::integer::u16";
|
|
13383
|
-
Uint2["u32"] = "core::integer::u32";
|
|
13384
|
-
Uint2["u64"] = "core::integer::u64";
|
|
13385
|
-
Uint2["u128"] = "core::integer::u128";
|
|
13386
|
-
Uint2["u256"] = "core::integer::u256";
|
|
13387
|
-
Uint2["u512"] = "core::integer::u512";
|
|
13388
|
-
return Uint2;
|
|
13389
|
-
})(Uint || {});
|
|
13390
|
-
var Literal = /* @__PURE__ */ ((Literal2) => {
|
|
13391
|
-
Literal2["ClassHash"] = "core::starknet::class_hash::ClassHash";
|
|
13392
|
-
Literal2["ContractAddress"] = "core::starknet::contract_address::ContractAddress";
|
|
13393
|
-
Literal2["Secp256k1Point"] = "core::starknet::secp256k1::Secp256k1Point";
|
|
13394
|
-
return Literal2;
|
|
13395
|
-
})(Literal || {});
|
|
13396
|
-
|
|
13397
|
-
// src/types/lib/contract/index.ts
|
|
13398
|
-
var EntryPointType = /* @__PURE__ */ ((EntryPointType2) => {
|
|
13399
|
-
EntryPointType2["EXTERNAL"] = "EXTERNAL";
|
|
13400
|
-
EntryPointType2["L1_HANDLER"] = "L1_HANDLER";
|
|
13401
|
-
EntryPointType2["CONSTRUCTOR"] = "CONSTRUCTOR";
|
|
13402
|
-
return EntryPointType2;
|
|
13403
|
-
})(EntryPointType || {});
|
|
13404
|
-
|
|
13405
|
-
// src/types/lib/index.ts
|
|
13406
|
-
var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
13407
|
-
TransactionType2["DECLARE"] = "DECLARE";
|
|
13408
|
-
TransactionType2["DEPLOY"] = "DEPLOY";
|
|
13409
|
-
TransactionType2["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
|
|
13410
|
-
TransactionType2["INVOKE"] = "INVOKE_FUNCTION";
|
|
13411
|
-
return TransactionType2;
|
|
13412
|
-
})(TransactionType || {});
|
|
13413
|
-
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
13414
|
-
TransactionStatus2["NOT_RECEIVED"] = "NOT_RECEIVED";
|
|
13415
|
-
TransactionStatus2["RECEIVED"] = "RECEIVED";
|
|
13416
|
-
TransactionStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
13417
|
-
TransactionStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
13418
|
-
TransactionStatus2["REJECTED"] = "REJECTED";
|
|
13419
|
-
TransactionStatus2["REVERTED"] = "REVERTED";
|
|
13420
|
-
return TransactionStatus2;
|
|
13421
|
-
})(TransactionStatus || {});
|
|
13422
|
-
var TransactionFinalityStatus = /* @__PURE__ */ ((TransactionFinalityStatus2) => {
|
|
13423
|
-
TransactionFinalityStatus2["NOT_RECEIVED"] = "NOT_RECEIVED";
|
|
13424
|
-
TransactionFinalityStatus2["RECEIVED"] = "RECEIVED";
|
|
13425
|
-
TransactionFinalityStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
13426
|
-
TransactionFinalityStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
13427
|
-
return TransactionFinalityStatus2;
|
|
13428
|
-
})(TransactionFinalityStatus || {});
|
|
13429
|
-
var TransactionExecutionStatus = /* @__PURE__ */ ((TransactionExecutionStatus2) => {
|
|
13430
|
-
TransactionExecutionStatus2["REJECTED"] = "REJECTED";
|
|
13431
|
-
TransactionExecutionStatus2["REVERTED"] = "REVERTED";
|
|
13432
|
-
TransactionExecutionStatus2["SUCCEEDED"] = "SUCCEEDED";
|
|
13433
|
-
return TransactionExecutionStatus2;
|
|
13434
|
-
})(TransactionExecutionStatus || {});
|
|
13435
|
-
var BlockStatus = /* @__PURE__ */ ((BlockStatus2) => {
|
|
13436
|
-
BlockStatus2["PENDING"] = "PENDING";
|
|
13437
|
-
BlockStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
13438
|
-
BlockStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
13439
|
-
BlockStatus2["REJECTED"] = "REJECTED";
|
|
13440
|
-
return BlockStatus2;
|
|
13441
|
-
})(BlockStatus || {});
|
|
13442
|
-
var BlockTag = /* @__PURE__ */ ((BlockTag2) => {
|
|
13443
|
-
BlockTag2["pending"] = "pending";
|
|
13444
|
-
BlockTag2["latest"] = "latest";
|
|
13445
|
-
return BlockTag2;
|
|
13446
|
-
})(BlockTag || {});
|
|
13447
|
-
|
|
13448
|
-
// node_modules/starknet-types/dist/esm/common/typedData.js
|
|
13449
|
-
var TypedDataRevision;
|
|
13450
|
-
(function(TypedDataRevision2) {
|
|
13451
|
-
TypedDataRevision2["Active"] = "1";
|
|
13452
|
-
TypedDataRevision2["Legacy"] = "0";
|
|
13453
|
-
})(TypedDataRevision || (TypedDataRevision = {}));
|
|
13454
|
-
|
|
13455
|
-
// src/utils/assert.ts
|
|
13456
|
-
function assert(condition, message) {
|
|
13457
|
-
if (!condition) {
|
|
13458
|
-
throw new Error(message || "Assertion failure");
|
|
13459
|
-
}
|
|
13460
|
-
}
|
|
13461
|
-
|
|
13462
|
-
// src/utils/num.ts
|
|
13463
|
-
var num_exports = {};
|
|
13464
|
-
__export(num_exports, {
|
|
13465
|
-
addPercent: () => addPercent,
|
|
13466
|
-
assertInRange: () => assertInRange,
|
|
13467
|
-
bigNumberishArrayToDecimalStringArray: () => bigNumberishArrayToDecimalStringArray,
|
|
13468
|
-
bigNumberishArrayToHexadecimalStringArray: () => bigNumberishArrayToHexadecimalStringArray,
|
|
13469
|
-
cleanHex: () => cleanHex,
|
|
13470
|
-
getDecimalString: () => getDecimalString,
|
|
13471
|
-
getHexString: () => getHexString,
|
|
13472
|
-
getHexStringArray: () => getHexStringArray,
|
|
13473
|
-
hexToBytes: () => hexToBytes2,
|
|
13474
|
-
hexToDecimalString: () => hexToDecimalString,
|
|
13475
|
-
isBigInt: () => isBigInt,
|
|
13476
|
-
isBoolean: () => isBoolean,
|
|
13477
|
-
isHex: () => isHex,
|
|
13478
|
-
isNumber: () => isNumber,
|
|
13479
|
-
isStringWholeNumber: () => isStringWholeNumber,
|
|
13480
|
-
toBigInt: () => toBigInt,
|
|
13481
|
-
toCairoBool: () => toCairoBool,
|
|
13482
|
-
toHex: () => toHex,
|
|
13483
|
-
toHexString: () => toHexString,
|
|
13484
|
-
toStorageKey: () => toStorageKey
|
|
13485
|
-
});
|
|
13486
|
-
|
|
13487
13344
|
// node_modules/@noble/curves/esm/abstract/utils.js
|
|
13488
13345
|
var utils_exports = {};
|
|
13489
13346
|
__export(utils_exports, {
|
|
@@ -13667,7 +13524,7 @@ var starknet = (() => {
|
|
|
13667
13524
|
k = h(u8fr([1]), seed);
|
|
13668
13525
|
v = h();
|
|
13669
13526
|
};
|
|
13670
|
-
const
|
|
13527
|
+
const gen3 = () => {
|
|
13671
13528
|
if (i++ >= 1e3)
|
|
13672
13529
|
throw new Error("drbg: tried 1000 values");
|
|
13673
13530
|
let len = 0;
|
|
@@ -13684,7 +13541,7 @@ var starknet = (() => {
|
|
|
13684
13541
|
reset();
|
|
13685
13542
|
reseed(seed);
|
|
13686
13543
|
let res = void 0;
|
|
13687
|
-
while (!(res = pred(
|
|
13544
|
+
while (!(res = pred(gen3())))
|
|
13688
13545
|
reseed();
|
|
13689
13546
|
reset();
|
|
13690
13547
|
return res;
|
|
@@ -13721,7 +13578,484 @@ var starknet = (() => {
|
|
|
13721
13578
|
return object;
|
|
13722
13579
|
}
|
|
13723
13580
|
|
|
13581
|
+
// node_modules/@noble/hashes/esm/_assert.js
|
|
13582
|
+
function number(n) {
|
|
13583
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
13584
|
+
throw new Error(`positive integer expected, not ${n}`);
|
|
13585
|
+
}
|
|
13586
|
+
function isBytes3(a) {
|
|
13587
|
+
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
13588
|
+
}
|
|
13589
|
+
function bytes(b, ...lengths) {
|
|
13590
|
+
if (!isBytes3(b))
|
|
13591
|
+
throw new Error("Uint8Array expected");
|
|
13592
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
13593
|
+
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
|
13594
|
+
}
|
|
13595
|
+
function hash(h) {
|
|
13596
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
|
13597
|
+
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
13598
|
+
number(h.outputLen);
|
|
13599
|
+
number(h.blockLen);
|
|
13600
|
+
}
|
|
13601
|
+
function exists(instance, checkFinished = true) {
|
|
13602
|
+
if (instance.destroyed)
|
|
13603
|
+
throw new Error("Hash instance has been destroyed");
|
|
13604
|
+
if (checkFinished && instance.finished)
|
|
13605
|
+
throw new Error("Hash#digest() has already been called");
|
|
13606
|
+
}
|
|
13607
|
+
function output(out, instance) {
|
|
13608
|
+
bytes(out);
|
|
13609
|
+
const min = instance.outputLen;
|
|
13610
|
+
if (out.length < min) {
|
|
13611
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
13612
|
+
}
|
|
13613
|
+
}
|
|
13614
|
+
|
|
13615
|
+
// node_modules/@noble/hashes/esm/_u64.js
|
|
13616
|
+
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
13617
|
+
var _32n = /* @__PURE__ */ BigInt(32);
|
|
13618
|
+
function fromBig(n, le = false) {
|
|
13619
|
+
if (le)
|
|
13620
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
13621
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
13622
|
+
}
|
|
13623
|
+
function split(lst, le = false) {
|
|
13624
|
+
let Ah = new Uint32Array(lst.length);
|
|
13625
|
+
let Al = new Uint32Array(lst.length);
|
|
13626
|
+
for (let i = 0; i < lst.length; i++) {
|
|
13627
|
+
const { h, l } = fromBig(lst[i], le);
|
|
13628
|
+
[Ah[i], Al[i]] = [h, l];
|
|
13629
|
+
}
|
|
13630
|
+
return [Ah, Al];
|
|
13631
|
+
}
|
|
13632
|
+
var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
13633
|
+
var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
13634
|
+
var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
13635
|
+
var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
13636
|
+
|
|
13637
|
+
// node_modules/@noble/hashes/esm/crypto.js
|
|
13638
|
+
var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
13639
|
+
|
|
13640
|
+
// node_modules/@noble/hashes/esm/utils.js
|
|
13641
|
+
var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
13642
|
+
var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
13643
|
+
var rotr = (word, shift) => word << 32 - shift | word >>> shift;
|
|
13644
|
+
var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
13645
|
+
var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
13646
|
+
function byteSwap32(arr) {
|
|
13647
|
+
for (let i = 0; i < arr.length; i++) {
|
|
13648
|
+
arr[i] = byteSwap(arr[i]);
|
|
13649
|
+
}
|
|
13650
|
+
}
|
|
13651
|
+
function utf8ToBytes2(str) {
|
|
13652
|
+
if (typeof str !== "string")
|
|
13653
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
13654
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
13655
|
+
}
|
|
13656
|
+
function toBytes(data) {
|
|
13657
|
+
if (typeof data === "string")
|
|
13658
|
+
data = utf8ToBytes2(data);
|
|
13659
|
+
bytes(data);
|
|
13660
|
+
return data;
|
|
13661
|
+
}
|
|
13662
|
+
function concatBytes2(...arrays) {
|
|
13663
|
+
let sum = 0;
|
|
13664
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
13665
|
+
const a = arrays[i];
|
|
13666
|
+
bytes(a);
|
|
13667
|
+
sum += a.length;
|
|
13668
|
+
}
|
|
13669
|
+
const res = new Uint8Array(sum);
|
|
13670
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
13671
|
+
const a = arrays[i];
|
|
13672
|
+
res.set(a, pad);
|
|
13673
|
+
pad += a.length;
|
|
13674
|
+
}
|
|
13675
|
+
return res;
|
|
13676
|
+
}
|
|
13677
|
+
var Hash = class {
|
|
13678
|
+
// Safe version that clones internal state
|
|
13679
|
+
clone() {
|
|
13680
|
+
return this._cloneInto();
|
|
13681
|
+
}
|
|
13682
|
+
};
|
|
13683
|
+
var toStr = {}.toString;
|
|
13684
|
+
function wrapConstructor(hashCons) {
|
|
13685
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
13686
|
+
const tmp = hashCons();
|
|
13687
|
+
hashC.outputLen = tmp.outputLen;
|
|
13688
|
+
hashC.blockLen = tmp.blockLen;
|
|
13689
|
+
hashC.create = () => hashCons();
|
|
13690
|
+
return hashC;
|
|
13691
|
+
}
|
|
13692
|
+
function wrapXOFConstructorWithOpts(hashCons) {
|
|
13693
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
13694
|
+
const tmp = hashCons({});
|
|
13695
|
+
hashC.outputLen = tmp.outputLen;
|
|
13696
|
+
hashC.blockLen = tmp.blockLen;
|
|
13697
|
+
hashC.create = (opts) => hashCons(opts);
|
|
13698
|
+
return hashC;
|
|
13699
|
+
}
|
|
13700
|
+
function randomBytes(bytesLength = 32) {
|
|
13701
|
+
if (crypto && typeof crypto.getRandomValues === "function") {
|
|
13702
|
+
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
13703
|
+
}
|
|
13704
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
13705
|
+
}
|
|
13706
|
+
|
|
13707
|
+
// node_modules/@noble/hashes/esm/sha3.js
|
|
13708
|
+
var SHA3_PI = [];
|
|
13709
|
+
var SHA3_ROTL = [];
|
|
13710
|
+
var _SHA3_IOTA = [];
|
|
13711
|
+
var _0n2 = /* @__PURE__ */ BigInt(0);
|
|
13712
|
+
var _1n2 = /* @__PURE__ */ BigInt(1);
|
|
13713
|
+
var _2n2 = /* @__PURE__ */ BigInt(2);
|
|
13714
|
+
var _7n = /* @__PURE__ */ BigInt(7);
|
|
13715
|
+
var _256n = /* @__PURE__ */ BigInt(256);
|
|
13716
|
+
var _0x71n = /* @__PURE__ */ BigInt(113);
|
|
13717
|
+
for (let round = 0, R = _1n2, x = 1, y = 0; round < 24; round++) {
|
|
13718
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
13719
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
13720
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
13721
|
+
let t = _0n2;
|
|
13722
|
+
for (let j = 0; j < 7; j++) {
|
|
13723
|
+
R = (R << _1n2 ^ (R >> _7n) * _0x71n) % _256n;
|
|
13724
|
+
if (R & _2n2)
|
|
13725
|
+
t ^= _1n2 << (_1n2 << /* @__PURE__ */ BigInt(j)) - _1n2;
|
|
13726
|
+
}
|
|
13727
|
+
_SHA3_IOTA.push(t);
|
|
13728
|
+
}
|
|
13729
|
+
var [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
|
13730
|
+
var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
|
|
13731
|
+
var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
|
|
13732
|
+
function keccakP(s, rounds = 24) {
|
|
13733
|
+
const B = new Uint32Array(5 * 2);
|
|
13734
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
13735
|
+
for (let x = 0; x < 10; x++)
|
|
13736
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
13737
|
+
for (let x = 0; x < 10; x += 2) {
|
|
13738
|
+
const idx1 = (x + 8) % 10;
|
|
13739
|
+
const idx0 = (x + 2) % 10;
|
|
13740
|
+
const B0 = B[idx0];
|
|
13741
|
+
const B1 = B[idx0 + 1];
|
|
13742
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
13743
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
13744
|
+
for (let y = 0; y < 50; y += 10) {
|
|
13745
|
+
s[x + y] ^= Th;
|
|
13746
|
+
s[x + y + 1] ^= Tl;
|
|
13747
|
+
}
|
|
13748
|
+
}
|
|
13749
|
+
let curH = s[2];
|
|
13750
|
+
let curL = s[3];
|
|
13751
|
+
for (let t = 0; t < 24; t++) {
|
|
13752
|
+
const shift = SHA3_ROTL[t];
|
|
13753
|
+
const Th = rotlH(curH, curL, shift);
|
|
13754
|
+
const Tl = rotlL(curH, curL, shift);
|
|
13755
|
+
const PI = SHA3_PI[t];
|
|
13756
|
+
curH = s[PI];
|
|
13757
|
+
curL = s[PI + 1];
|
|
13758
|
+
s[PI] = Th;
|
|
13759
|
+
s[PI + 1] = Tl;
|
|
13760
|
+
}
|
|
13761
|
+
for (let y = 0; y < 50; y += 10) {
|
|
13762
|
+
for (let x = 0; x < 10; x++)
|
|
13763
|
+
B[x] = s[y + x];
|
|
13764
|
+
for (let x = 0; x < 10; x++)
|
|
13765
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
13766
|
+
}
|
|
13767
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
13768
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
13769
|
+
}
|
|
13770
|
+
B.fill(0);
|
|
13771
|
+
}
|
|
13772
|
+
var Keccak = class _Keccak extends Hash {
|
|
13773
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
13774
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
13775
|
+
super();
|
|
13776
|
+
this.blockLen = blockLen;
|
|
13777
|
+
this.suffix = suffix;
|
|
13778
|
+
this.outputLen = outputLen;
|
|
13779
|
+
this.enableXOF = enableXOF;
|
|
13780
|
+
this.rounds = rounds;
|
|
13781
|
+
this.pos = 0;
|
|
13782
|
+
this.posOut = 0;
|
|
13783
|
+
this.finished = false;
|
|
13784
|
+
this.destroyed = false;
|
|
13785
|
+
number(outputLen);
|
|
13786
|
+
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
13787
|
+
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
13788
|
+
this.state = new Uint8Array(200);
|
|
13789
|
+
this.state32 = u32(this.state);
|
|
13790
|
+
}
|
|
13791
|
+
keccak() {
|
|
13792
|
+
if (!isLE)
|
|
13793
|
+
byteSwap32(this.state32);
|
|
13794
|
+
keccakP(this.state32, this.rounds);
|
|
13795
|
+
if (!isLE)
|
|
13796
|
+
byteSwap32(this.state32);
|
|
13797
|
+
this.posOut = 0;
|
|
13798
|
+
this.pos = 0;
|
|
13799
|
+
}
|
|
13800
|
+
update(data) {
|
|
13801
|
+
exists(this);
|
|
13802
|
+
const { blockLen, state } = this;
|
|
13803
|
+
data = toBytes(data);
|
|
13804
|
+
const len = data.length;
|
|
13805
|
+
for (let pos = 0; pos < len; ) {
|
|
13806
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
13807
|
+
for (let i = 0; i < take; i++)
|
|
13808
|
+
state[this.pos++] ^= data[pos++];
|
|
13809
|
+
if (this.pos === blockLen)
|
|
13810
|
+
this.keccak();
|
|
13811
|
+
}
|
|
13812
|
+
return this;
|
|
13813
|
+
}
|
|
13814
|
+
finish() {
|
|
13815
|
+
if (this.finished)
|
|
13816
|
+
return;
|
|
13817
|
+
this.finished = true;
|
|
13818
|
+
const { state, suffix, pos, blockLen } = this;
|
|
13819
|
+
state[pos] ^= suffix;
|
|
13820
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
13821
|
+
this.keccak();
|
|
13822
|
+
state[blockLen - 1] ^= 128;
|
|
13823
|
+
this.keccak();
|
|
13824
|
+
}
|
|
13825
|
+
writeInto(out) {
|
|
13826
|
+
exists(this, false);
|
|
13827
|
+
bytes(out);
|
|
13828
|
+
this.finish();
|
|
13829
|
+
const bufferOut = this.state;
|
|
13830
|
+
const { blockLen } = this;
|
|
13831
|
+
for (let pos = 0, len = out.length; pos < len; ) {
|
|
13832
|
+
if (this.posOut >= blockLen)
|
|
13833
|
+
this.keccak();
|
|
13834
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
13835
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
13836
|
+
this.posOut += take;
|
|
13837
|
+
pos += take;
|
|
13838
|
+
}
|
|
13839
|
+
return out;
|
|
13840
|
+
}
|
|
13841
|
+
xofInto(out) {
|
|
13842
|
+
if (!this.enableXOF)
|
|
13843
|
+
throw new Error("XOF is not possible for this instance");
|
|
13844
|
+
return this.writeInto(out);
|
|
13845
|
+
}
|
|
13846
|
+
xof(bytes3) {
|
|
13847
|
+
number(bytes3);
|
|
13848
|
+
return this.xofInto(new Uint8Array(bytes3));
|
|
13849
|
+
}
|
|
13850
|
+
digestInto(out) {
|
|
13851
|
+
output(out, this);
|
|
13852
|
+
if (this.finished)
|
|
13853
|
+
throw new Error("digest() was already called");
|
|
13854
|
+
this.writeInto(out);
|
|
13855
|
+
this.destroy();
|
|
13856
|
+
return out;
|
|
13857
|
+
}
|
|
13858
|
+
digest() {
|
|
13859
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
13860
|
+
}
|
|
13861
|
+
destroy() {
|
|
13862
|
+
this.destroyed = true;
|
|
13863
|
+
this.state.fill(0);
|
|
13864
|
+
}
|
|
13865
|
+
_cloneInto(to) {
|
|
13866
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
13867
|
+
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
13868
|
+
to.state32.set(this.state32);
|
|
13869
|
+
to.pos = this.pos;
|
|
13870
|
+
to.posOut = this.posOut;
|
|
13871
|
+
to.finished = this.finished;
|
|
13872
|
+
to.rounds = rounds;
|
|
13873
|
+
to.suffix = suffix;
|
|
13874
|
+
to.outputLen = outputLen;
|
|
13875
|
+
to.enableXOF = enableXOF;
|
|
13876
|
+
to.destroyed = this.destroyed;
|
|
13877
|
+
return to;
|
|
13878
|
+
}
|
|
13879
|
+
};
|
|
13880
|
+
var gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
|
13881
|
+
var sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8);
|
|
13882
|
+
var sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8);
|
|
13883
|
+
var sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8);
|
|
13884
|
+
var sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8);
|
|
13885
|
+
var keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8);
|
|
13886
|
+
var keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
|
|
13887
|
+
var keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8);
|
|
13888
|
+
var keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8);
|
|
13889
|
+
var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
|
|
13890
|
+
var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
|
|
13891
|
+
var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
|
|
13892
|
+
|
|
13893
|
+
// src/channel/rpc_0_6.ts
|
|
13894
|
+
var rpc_0_6_exports = {};
|
|
13895
|
+
__export(rpc_0_6_exports, {
|
|
13896
|
+
RpcChannel: () => RpcChannel
|
|
13897
|
+
});
|
|
13898
|
+
|
|
13899
|
+
// src/provider/errors.ts
|
|
13900
|
+
function fixStack(target, fn = target.constructor) {
|
|
13901
|
+
const { captureStackTrace } = Error;
|
|
13902
|
+
captureStackTrace && captureStackTrace(target, fn);
|
|
13903
|
+
}
|
|
13904
|
+
function fixProto(target, prototype) {
|
|
13905
|
+
const { setPrototypeOf } = Object;
|
|
13906
|
+
setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
13907
|
+
}
|
|
13908
|
+
var CustomError = class extends Error {
|
|
13909
|
+
name;
|
|
13910
|
+
constructor(message) {
|
|
13911
|
+
super(message);
|
|
13912
|
+
Object.defineProperty(this, "name", {
|
|
13913
|
+
value: new.target.name,
|
|
13914
|
+
enumerable: false,
|
|
13915
|
+
configurable: true
|
|
13916
|
+
});
|
|
13917
|
+
fixProto(this, new.target.prototype);
|
|
13918
|
+
fixStack(this);
|
|
13919
|
+
}
|
|
13920
|
+
};
|
|
13921
|
+
var LibraryError = class extends CustomError {
|
|
13922
|
+
};
|
|
13923
|
+
var GatewayError = class extends LibraryError {
|
|
13924
|
+
constructor(message, errorCode) {
|
|
13925
|
+
super(message);
|
|
13926
|
+
this.errorCode = errorCode;
|
|
13927
|
+
}
|
|
13928
|
+
};
|
|
13929
|
+
var HttpError = class extends LibraryError {
|
|
13930
|
+
constructor(message, errorCode) {
|
|
13931
|
+
super(message);
|
|
13932
|
+
this.errorCode = errorCode;
|
|
13933
|
+
}
|
|
13934
|
+
};
|
|
13935
|
+
|
|
13936
|
+
// src/types/index.ts
|
|
13937
|
+
var types_exports = {};
|
|
13938
|
+
__export(types_exports, {
|
|
13939
|
+
BlockStatus: () => BlockStatus,
|
|
13940
|
+
BlockTag: () => BlockTag,
|
|
13941
|
+
EntryPointType: () => EntryPointType,
|
|
13942
|
+
Literal: () => Literal,
|
|
13943
|
+
RPC: () => api_exports2,
|
|
13944
|
+
TransactionExecutionStatus: () => TransactionExecutionStatus,
|
|
13945
|
+
TransactionFinalityStatus: () => TransactionFinalityStatus,
|
|
13946
|
+
TransactionStatus: () => TransactionStatus,
|
|
13947
|
+
TransactionType: () => TransactionType,
|
|
13948
|
+
TypedDataRevision: () => TypedDataRevision,
|
|
13949
|
+
Uint: () => Uint,
|
|
13950
|
+
ValidateType: () => ValidateType
|
|
13951
|
+
});
|
|
13952
|
+
|
|
13953
|
+
// src/types/calldata.ts
|
|
13954
|
+
var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
13955
|
+
ValidateType2["DEPLOY"] = "DEPLOY";
|
|
13956
|
+
ValidateType2["CALL"] = "CALL";
|
|
13957
|
+
ValidateType2["INVOKE"] = "INVOKE";
|
|
13958
|
+
return ValidateType2;
|
|
13959
|
+
})(ValidateType || {});
|
|
13960
|
+
var Uint = /* @__PURE__ */ ((Uint2) => {
|
|
13961
|
+
Uint2["u8"] = "core::integer::u8";
|
|
13962
|
+
Uint2["u16"] = "core::integer::u16";
|
|
13963
|
+
Uint2["u32"] = "core::integer::u32";
|
|
13964
|
+
Uint2["u64"] = "core::integer::u64";
|
|
13965
|
+
Uint2["u128"] = "core::integer::u128";
|
|
13966
|
+
Uint2["u256"] = "core::integer::u256";
|
|
13967
|
+
Uint2["u512"] = "core::integer::u512";
|
|
13968
|
+
return Uint2;
|
|
13969
|
+
})(Uint || {});
|
|
13970
|
+
var Literal = /* @__PURE__ */ ((Literal2) => {
|
|
13971
|
+
Literal2["ClassHash"] = "core::starknet::class_hash::ClassHash";
|
|
13972
|
+
Literal2["ContractAddress"] = "core::starknet::contract_address::ContractAddress";
|
|
13973
|
+
Literal2["Secp256k1Point"] = "core::starknet::secp256k1::Secp256k1Point";
|
|
13974
|
+
return Literal2;
|
|
13975
|
+
})(Literal || {});
|
|
13976
|
+
|
|
13977
|
+
// src/types/lib/contract/index.ts
|
|
13978
|
+
var EntryPointType = /* @__PURE__ */ ((EntryPointType2) => {
|
|
13979
|
+
EntryPointType2["EXTERNAL"] = "EXTERNAL";
|
|
13980
|
+
EntryPointType2["L1_HANDLER"] = "L1_HANDLER";
|
|
13981
|
+
EntryPointType2["CONSTRUCTOR"] = "CONSTRUCTOR";
|
|
13982
|
+
return EntryPointType2;
|
|
13983
|
+
})(EntryPointType || {});
|
|
13984
|
+
|
|
13985
|
+
// src/types/lib/index.ts
|
|
13986
|
+
var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
13987
|
+
TransactionType2["DECLARE"] = "DECLARE";
|
|
13988
|
+
TransactionType2["DEPLOY"] = "DEPLOY";
|
|
13989
|
+
TransactionType2["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
|
|
13990
|
+
TransactionType2["INVOKE"] = "INVOKE_FUNCTION";
|
|
13991
|
+
return TransactionType2;
|
|
13992
|
+
})(TransactionType || {});
|
|
13993
|
+
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
13994
|
+
TransactionStatus2["NOT_RECEIVED"] = "NOT_RECEIVED";
|
|
13995
|
+
TransactionStatus2["RECEIVED"] = "RECEIVED";
|
|
13996
|
+
TransactionStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
13997
|
+
TransactionStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
13998
|
+
TransactionStatus2["REJECTED"] = "REJECTED";
|
|
13999
|
+
TransactionStatus2["REVERTED"] = "REVERTED";
|
|
14000
|
+
return TransactionStatus2;
|
|
14001
|
+
})(TransactionStatus || {});
|
|
14002
|
+
var TransactionFinalityStatus = /* @__PURE__ */ ((TransactionFinalityStatus2) => {
|
|
14003
|
+
TransactionFinalityStatus2["NOT_RECEIVED"] = "NOT_RECEIVED";
|
|
14004
|
+
TransactionFinalityStatus2["RECEIVED"] = "RECEIVED";
|
|
14005
|
+
TransactionFinalityStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
14006
|
+
TransactionFinalityStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
14007
|
+
return TransactionFinalityStatus2;
|
|
14008
|
+
})(TransactionFinalityStatus || {});
|
|
14009
|
+
var TransactionExecutionStatus = /* @__PURE__ */ ((TransactionExecutionStatus2) => {
|
|
14010
|
+
TransactionExecutionStatus2["REJECTED"] = "REJECTED";
|
|
14011
|
+
TransactionExecutionStatus2["REVERTED"] = "REVERTED";
|
|
14012
|
+
TransactionExecutionStatus2["SUCCEEDED"] = "SUCCEEDED";
|
|
14013
|
+
return TransactionExecutionStatus2;
|
|
14014
|
+
})(TransactionExecutionStatus || {});
|
|
14015
|
+
var BlockStatus = /* @__PURE__ */ ((BlockStatus2) => {
|
|
14016
|
+
BlockStatus2["PENDING"] = "PENDING";
|
|
14017
|
+
BlockStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
14018
|
+
BlockStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
14019
|
+
BlockStatus2["REJECTED"] = "REJECTED";
|
|
14020
|
+
return BlockStatus2;
|
|
14021
|
+
})(BlockStatus || {});
|
|
14022
|
+
var BlockTag = /* @__PURE__ */ ((BlockTag2) => {
|
|
14023
|
+
BlockTag2["pending"] = "pending";
|
|
14024
|
+
BlockTag2["latest"] = "latest";
|
|
14025
|
+
return BlockTag2;
|
|
14026
|
+
})(BlockTag || {});
|
|
14027
|
+
|
|
14028
|
+
// src/utils/assert.ts
|
|
14029
|
+
function assert(condition, message) {
|
|
14030
|
+
if (!condition) {
|
|
14031
|
+
throw new Error(message || "Assertion failure");
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
|
|
13724
14035
|
// src/utils/num.ts
|
|
14036
|
+
var num_exports = {};
|
|
14037
|
+
__export(num_exports, {
|
|
14038
|
+
addPercent: () => addPercent,
|
|
14039
|
+
assertInRange: () => assertInRange,
|
|
14040
|
+
bigNumberishArrayToDecimalStringArray: () => bigNumberishArrayToDecimalStringArray,
|
|
14041
|
+
bigNumberishArrayToHexadecimalStringArray: () => bigNumberishArrayToHexadecimalStringArray,
|
|
14042
|
+
cleanHex: () => cleanHex,
|
|
14043
|
+
getDecimalString: () => getDecimalString,
|
|
14044
|
+
getHexString: () => getHexString,
|
|
14045
|
+
getHexStringArray: () => getHexStringArray,
|
|
14046
|
+
hexToBytes: () => hexToBytes2,
|
|
14047
|
+
hexToDecimalString: () => hexToDecimalString,
|
|
14048
|
+
isBigInt: () => isBigInt,
|
|
14049
|
+
isBoolean: () => isBoolean,
|
|
14050
|
+
isHex: () => isHex,
|
|
14051
|
+
isNumber: () => isNumber,
|
|
14052
|
+
isStringWholeNumber: () => isStringWholeNumber,
|
|
14053
|
+
toBigInt: () => toBigInt,
|
|
14054
|
+
toCairoBool: () => toCairoBool,
|
|
14055
|
+
toHex: () => toHex,
|
|
14056
|
+
toHexString: () => toHexString,
|
|
14057
|
+
toStorageKey: () => toStorageKey
|
|
14058
|
+
});
|
|
13725
14059
|
function isHex(hex) {
|
|
13726
14060
|
return /^0x[0-9a-f]*$/i.test(hex);
|
|
13727
14061
|
}
|
|
@@ -13812,8 +14146,8 @@ var starknet = (() => {
|
|
|
13812
14146
|
});
|
|
13813
14147
|
|
|
13814
14148
|
// node_modules/@scure/starknet/lib/esm/index.js
|
|
13815
|
-
var
|
|
13816
|
-
__export(
|
|
14149
|
+
var esm_exports2 = {};
|
|
14150
|
+
__export(esm_exports2, {
|
|
13817
14151
|
CURVE: () => CURVE,
|
|
13818
14152
|
Fp251: () => Fp251,
|
|
13819
14153
|
MAX_VALUE: () => MAX_VALUE,
|
|
@@ -13842,92 +14176,92 @@ var starknet = (() => {
|
|
|
13842
14176
|
verify: () => verify
|
|
13843
14177
|
});
|
|
13844
14178
|
|
|
13845
|
-
// node_modules/@noble/hashes/esm/_assert.js
|
|
13846
|
-
function
|
|
14179
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/_assert.js
|
|
14180
|
+
function number2(n) {
|
|
13847
14181
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
13848
14182
|
throw new Error(`Wrong positive integer: ${n}`);
|
|
13849
14183
|
}
|
|
13850
|
-
function
|
|
14184
|
+
function isBytes4(a) {
|
|
13851
14185
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
13852
14186
|
}
|
|
13853
|
-
function
|
|
13854
|
-
if (!
|
|
14187
|
+
function bytes2(b, ...lengths) {
|
|
14188
|
+
if (!isBytes4(b))
|
|
13855
14189
|
throw new Error("Expected Uint8Array");
|
|
13856
14190
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
13857
14191
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
|
13858
14192
|
}
|
|
13859
|
-
function
|
|
14193
|
+
function hash2(hash3) {
|
|
13860
14194
|
if (typeof hash3 !== "function" || typeof hash3.create !== "function")
|
|
13861
14195
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
13862
|
-
|
|
13863
|
-
|
|
14196
|
+
number2(hash3.outputLen);
|
|
14197
|
+
number2(hash3.blockLen);
|
|
13864
14198
|
}
|
|
13865
|
-
function
|
|
14199
|
+
function exists2(instance, checkFinished = true) {
|
|
13866
14200
|
if (instance.destroyed)
|
|
13867
14201
|
throw new Error("Hash instance has been destroyed");
|
|
13868
14202
|
if (checkFinished && instance.finished)
|
|
13869
14203
|
throw new Error("Hash#digest() has already been called");
|
|
13870
14204
|
}
|
|
13871
|
-
function
|
|
13872
|
-
|
|
14205
|
+
function output2(out, instance) {
|
|
14206
|
+
bytes2(out);
|
|
13873
14207
|
const min = instance.outputLen;
|
|
13874
14208
|
if (out.length < min) {
|
|
13875
14209
|
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
13876
14210
|
}
|
|
13877
14211
|
}
|
|
13878
14212
|
|
|
13879
|
-
// node_modules/@noble/hashes/esm/_u64.js
|
|
13880
|
-
var
|
|
13881
|
-
var
|
|
13882
|
-
function
|
|
14213
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/_u64.js
|
|
14214
|
+
var U32_MASK642 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
14215
|
+
var _32n2 = /* @__PURE__ */ BigInt(32);
|
|
14216
|
+
function fromBig2(n, le = false) {
|
|
13883
14217
|
if (le)
|
|
13884
|
-
return { h: Number(n &
|
|
13885
|
-
return { h: Number(n >>
|
|
14218
|
+
return { h: Number(n & U32_MASK642), l: Number(n >> _32n2 & U32_MASK642) };
|
|
14219
|
+
return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 };
|
|
13886
14220
|
}
|
|
13887
|
-
function
|
|
14221
|
+
function split2(lst, le = false) {
|
|
13888
14222
|
let Ah = new Uint32Array(lst.length);
|
|
13889
14223
|
let Al = new Uint32Array(lst.length);
|
|
13890
14224
|
for (let i = 0; i < lst.length; i++) {
|
|
13891
|
-
const { h, l } =
|
|
14225
|
+
const { h, l } = fromBig2(lst[i], le);
|
|
13892
14226
|
[Ah[i], Al[i]] = [h, l];
|
|
13893
14227
|
}
|
|
13894
14228
|
return [Ah, Al];
|
|
13895
14229
|
}
|
|
13896
|
-
var
|
|
13897
|
-
var
|
|
13898
|
-
var
|
|
13899
|
-
var
|
|
14230
|
+
var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
|
|
14231
|
+
var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
|
|
14232
|
+
var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
14233
|
+
var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
13900
14234
|
|
|
13901
|
-
// node_modules/@noble/hashes/esm/crypto.js
|
|
13902
|
-
var
|
|
14235
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/crypto.js
|
|
14236
|
+
var crypto2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
13903
14237
|
|
|
13904
|
-
// node_modules/@noble/hashes/esm/utils.js
|
|
13905
|
-
var
|
|
13906
|
-
function
|
|
14238
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/utils.js
|
|
14239
|
+
var u322 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
14240
|
+
function isBytes5(a) {
|
|
13907
14241
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
13908
14242
|
}
|
|
13909
|
-
var
|
|
13910
|
-
var
|
|
13911
|
-
var
|
|
13912
|
-
if (!
|
|
14243
|
+
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
14244
|
+
var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
|
|
14245
|
+
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
14246
|
+
if (!isLE2)
|
|
13913
14247
|
throw new Error("Non little-endian hardware is not supported");
|
|
13914
|
-
function
|
|
14248
|
+
function utf8ToBytes3(str) {
|
|
13915
14249
|
if (typeof str !== "string")
|
|
13916
14250
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
13917
14251
|
return new Uint8Array(new TextEncoder().encode(str));
|
|
13918
14252
|
}
|
|
13919
|
-
function
|
|
14253
|
+
function toBytes2(data) {
|
|
13920
14254
|
if (typeof data === "string")
|
|
13921
|
-
data =
|
|
13922
|
-
if (!
|
|
14255
|
+
data = utf8ToBytes3(data);
|
|
14256
|
+
if (!isBytes5(data))
|
|
13923
14257
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
|
13924
14258
|
return data;
|
|
13925
14259
|
}
|
|
13926
|
-
function
|
|
14260
|
+
function concatBytes3(...arrays) {
|
|
13927
14261
|
let sum = 0;
|
|
13928
14262
|
for (let i = 0; i < arrays.length; i++) {
|
|
13929
14263
|
const a = arrays[i];
|
|
13930
|
-
if (!
|
|
14264
|
+
if (!isBytes5(a))
|
|
13931
14265
|
throw new Error("Uint8Array expected");
|
|
13932
14266
|
sum += a.length;
|
|
13933
14267
|
}
|
|
@@ -13939,60 +14273,60 @@ var starknet = (() => {
|
|
|
13939
14273
|
}
|
|
13940
14274
|
return res;
|
|
13941
14275
|
}
|
|
13942
|
-
var
|
|
14276
|
+
var Hash2 = class {
|
|
13943
14277
|
// Safe version that clones internal state
|
|
13944
14278
|
clone() {
|
|
13945
14279
|
return this._cloneInto();
|
|
13946
14280
|
}
|
|
13947
14281
|
};
|
|
13948
|
-
var
|
|
13949
|
-
function
|
|
13950
|
-
const hashC = (msg) => hashCons().update(
|
|
14282
|
+
var toStr2 = {}.toString;
|
|
14283
|
+
function wrapConstructor2(hashCons) {
|
|
14284
|
+
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
|
|
13951
14285
|
const tmp = hashCons();
|
|
13952
14286
|
hashC.outputLen = tmp.outputLen;
|
|
13953
14287
|
hashC.blockLen = tmp.blockLen;
|
|
13954
14288
|
hashC.create = () => hashCons();
|
|
13955
14289
|
return hashC;
|
|
13956
14290
|
}
|
|
13957
|
-
function
|
|
13958
|
-
const hashC = (msg, opts) => hashCons(opts).update(
|
|
14291
|
+
function wrapXOFConstructorWithOpts2(hashCons) {
|
|
14292
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
|
|
13959
14293
|
const tmp = hashCons({});
|
|
13960
14294
|
hashC.outputLen = tmp.outputLen;
|
|
13961
14295
|
hashC.blockLen = tmp.blockLen;
|
|
13962
14296
|
hashC.create = (opts) => hashCons(opts);
|
|
13963
14297
|
return hashC;
|
|
13964
14298
|
}
|
|
13965
|
-
function
|
|
13966
|
-
if (
|
|
13967
|
-
return
|
|
14299
|
+
function randomBytes2(bytesLength = 32) {
|
|
14300
|
+
if (crypto2 && typeof crypto2.getRandomValues === "function") {
|
|
14301
|
+
return crypto2.getRandomValues(new Uint8Array(bytesLength));
|
|
13968
14302
|
}
|
|
13969
14303
|
throw new Error("crypto.getRandomValues must be defined");
|
|
13970
14304
|
}
|
|
13971
14305
|
|
|
13972
|
-
// node_modules/@noble/hashes/esm/sha3.js
|
|
13973
|
-
var [
|
|
13974
|
-
var
|
|
13975
|
-
var
|
|
13976
|
-
var
|
|
13977
|
-
var
|
|
13978
|
-
var
|
|
13979
|
-
var
|
|
13980
|
-
for (let round = 0, R =
|
|
14306
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/sha3.js
|
|
14307
|
+
var [SHA3_PI2, SHA3_ROTL2, _SHA3_IOTA2] = [[], [], []];
|
|
14308
|
+
var _0n3 = /* @__PURE__ */ BigInt(0);
|
|
14309
|
+
var _1n3 = /* @__PURE__ */ BigInt(1);
|
|
14310
|
+
var _2n3 = /* @__PURE__ */ BigInt(2);
|
|
14311
|
+
var _7n2 = /* @__PURE__ */ BigInt(7);
|
|
14312
|
+
var _256n2 = /* @__PURE__ */ BigInt(256);
|
|
14313
|
+
var _0x71n2 = /* @__PURE__ */ BigInt(113);
|
|
14314
|
+
for (let round = 0, R = _1n3, x = 1, y = 0; round < 24; round++) {
|
|
13981
14315
|
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
let t =
|
|
14316
|
+
SHA3_PI2.push(2 * (5 * y + x));
|
|
14317
|
+
SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
|
|
14318
|
+
let t = _0n3;
|
|
13985
14319
|
for (let j = 0; j < 7; j++) {
|
|
13986
|
-
R = (R <<
|
|
13987
|
-
if (R &
|
|
13988
|
-
t ^=
|
|
14320
|
+
R = (R << _1n3 ^ (R >> _7n2) * _0x71n2) % _256n2;
|
|
14321
|
+
if (R & _2n3)
|
|
14322
|
+
t ^= _1n3 << (_1n3 << /* @__PURE__ */ BigInt(j)) - _1n3;
|
|
13989
14323
|
}
|
|
13990
|
-
|
|
14324
|
+
_SHA3_IOTA2.push(t);
|
|
13991
14325
|
}
|
|
13992
|
-
var [
|
|
13993
|
-
var
|
|
13994
|
-
var
|
|
13995
|
-
function
|
|
14326
|
+
var [SHA3_IOTA_H2, SHA3_IOTA_L2] = /* @__PURE__ */ split2(_SHA3_IOTA2, true);
|
|
14327
|
+
var rotlH2 = (h, l, s) => s > 32 ? rotlBH2(h, l, s) : rotlSH2(h, l, s);
|
|
14328
|
+
var rotlL2 = (h, l, s) => s > 32 ? rotlBL2(h, l, s) : rotlSL2(h, l, s);
|
|
14329
|
+
function keccakP2(s, rounds = 24) {
|
|
13996
14330
|
const B = new Uint32Array(5 * 2);
|
|
13997
14331
|
for (let round = 24 - rounds; round < 24; round++) {
|
|
13998
14332
|
for (let x = 0; x < 10; x++)
|
|
@@ -14002,8 +14336,8 @@ var starknet = (() => {
|
|
|
14002
14336
|
const idx0 = (x + 2) % 10;
|
|
14003
14337
|
const B0 = B[idx0];
|
|
14004
14338
|
const B1 = B[idx0 + 1];
|
|
14005
|
-
const Th =
|
|
14006
|
-
const Tl =
|
|
14339
|
+
const Th = rotlH2(B0, B1, 1) ^ B[idx1];
|
|
14340
|
+
const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
|
|
14007
14341
|
for (let y = 0; y < 50; y += 10) {
|
|
14008
14342
|
s[x + y] ^= Th;
|
|
14009
14343
|
s[x + y + 1] ^= Tl;
|
|
@@ -14012,10 +14346,10 @@ var starknet = (() => {
|
|
|
14012
14346
|
let curH = s[2];
|
|
14013
14347
|
let curL = s[3];
|
|
14014
14348
|
for (let t = 0; t < 24; t++) {
|
|
14015
|
-
const shift =
|
|
14016
|
-
const Th =
|
|
14017
|
-
const Tl =
|
|
14018
|
-
const PI =
|
|
14349
|
+
const shift = SHA3_ROTL2[t];
|
|
14350
|
+
const Th = rotlH2(curH, curL, shift);
|
|
14351
|
+
const Tl = rotlL2(curH, curL, shift);
|
|
14352
|
+
const PI = SHA3_PI2[t];
|
|
14019
14353
|
curH = s[PI];
|
|
14020
14354
|
curL = s[PI + 1];
|
|
14021
14355
|
s[PI] = Th;
|
|
@@ -14027,12 +14361,12 @@ var starknet = (() => {
|
|
|
14027
14361
|
for (let x = 0; x < 10; x++)
|
|
14028
14362
|
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
14029
14363
|
}
|
|
14030
|
-
s[0] ^=
|
|
14031
|
-
s[1] ^=
|
|
14364
|
+
s[0] ^= SHA3_IOTA_H2[round];
|
|
14365
|
+
s[1] ^= SHA3_IOTA_L2[round];
|
|
14032
14366
|
}
|
|
14033
14367
|
B.fill(0);
|
|
14034
14368
|
}
|
|
14035
|
-
var
|
|
14369
|
+
var Keccak2 = class _Keccak extends Hash2 {
|
|
14036
14370
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
14037
14371
|
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
14038
14372
|
super();
|
|
@@ -14045,21 +14379,21 @@ var starknet = (() => {
|
|
|
14045
14379
|
this.posOut = 0;
|
|
14046
14380
|
this.finished = false;
|
|
14047
14381
|
this.destroyed = false;
|
|
14048
|
-
|
|
14382
|
+
number2(outputLen);
|
|
14049
14383
|
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
14050
14384
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
14051
14385
|
this.state = new Uint8Array(200);
|
|
14052
|
-
this.state32 =
|
|
14386
|
+
this.state32 = u322(this.state);
|
|
14053
14387
|
}
|
|
14054
14388
|
keccak() {
|
|
14055
|
-
|
|
14389
|
+
keccakP2(this.state32, this.rounds);
|
|
14056
14390
|
this.posOut = 0;
|
|
14057
14391
|
this.pos = 0;
|
|
14058
14392
|
}
|
|
14059
14393
|
update(data) {
|
|
14060
|
-
|
|
14394
|
+
exists2(this);
|
|
14061
14395
|
const { blockLen, state } = this;
|
|
14062
|
-
data =
|
|
14396
|
+
data = toBytes2(data);
|
|
14063
14397
|
const len = data.length;
|
|
14064
14398
|
for (let pos = 0; pos < len; ) {
|
|
14065
14399
|
const take = Math.min(blockLen - this.pos, len - pos);
|
|
@@ -14082,8 +14416,8 @@ var starknet = (() => {
|
|
|
14082
14416
|
this.keccak();
|
|
14083
14417
|
}
|
|
14084
14418
|
writeInto(out) {
|
|
14085
|
-
|
|
14086
|
-
|
|
14419
|
+
exists2(this, false);
|
|
14420
|
+
bytes2(out);
|
|
14087
14421
|
this.finish();
|
|
14088
14422
|
const bufferOut = this.state;
|
|
14089
14423
|
const { blockLen } = this;
|
|
@@ -14103,11 +14437,11 @@ var starknet = (() => {
|
|
|
14103
14437
|
return this.writeInto(out);
|
|
14104
14438
|
}
|
|
14105
14439
|
xof(bytes3) {
|
|
14106
|
-
|
|
14440
|
+
number2(bytes3);
|
|
14107
14441
|
return this.xofInto(new Uint8Array(bytes3));
|
|
14108
14442
|
}
|
|
14109
14443
|
digestInto(out) {
|
|
14110
|
-
|
|
14444
|
+
output2(out, this);
|
|
14111
14445
|
if (this.finished)
|
|
14112
14446
|
throw new Error("digest() was already called");
|
|
14113
14447
|
this.writeInto(out);
|
|
@@ -14136,33 +14470,33 @@ var starknet = (() => {
|
|
|
14136
14470
|
return to;
|
|
14137
14471
|
}
|
|
14138
14472
|
};
|
|
14139
|
-
var
|
|
14140
|
-
var
|
|
14141
|
-
var
|
|
14142
|
-
var
|
|
14143
|
-
var
|
|
14144
|
-
var
|
|
14145
|
-
var
|
|
14146
|
-
var
|
|
14147
|
-
var
|
|
14148
|
-
var
|
|
14149
|
-
var
|
|
14150
|
-
var
|
|
14473
|
+
var gen2 = (suffix, blockLen, outputLen) => wrapConstructor2(() => new Keccak2(blockLen, suffix, outputLen));
|
|
14474
|
+
var sha3_2242 = /* @__PURE__ */ gen2(6, 144, 224 / 8);
|
|
14475
|
+
var sha3_2562 = /* @__PURE__ */ gen2(6, 136, 256 / 8);
|
|
14476
|
+
var sha3_3842 = /* @__PURE__ */ gen2(6, 104, 384 / 8);
|
|
14477
|
+
var sha3_5122 = /* @__PURE__ */ gen2(6, 72, 512 / 8);
|
|
14478
|
+
var keccak_2242 = /* @__PURE__ */ gen2(1, 144, 224 / 8);
|
|
14479
|
+
var keccak_2562 = /* @__PURE__ */ gen2(1, 136, 256 / 8);
|
|
14480
|
+
var keccak_3842 = /* @__PURE__ */ gen2(1, 104, 384 / 8);
|
|
14481
|
+
var keccak_5122 = /* @__PURE__ */ gen2(1, 72, 512 / 8);
|
|
14482
|
+
var genShake2 = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts2((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
|
|
14483
|
+
var shake1282 = /* @__PURE__ */ genShake2(31, 168, 128 / 8);
|
|
14484
|
+
var shake2562 = /* @__PURE__ */ genShake2(31, 136, 256 / 8);
|
|
14151
14485
|
|
|
14152
|
-
// node_modules/@noble/hashes/esm/_sha2.js
|
|
14486
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/_sha2.js
|
|
14153
14487
|
function setBigUint64(view, byteOffset, value, isLE3) {
|
|
14154
14488
|
if (typeof view.setBigUint64 === "function")
|
|
14155
14489
|
return view.setBigUint64(byteOffset, value, isLE3);
|
|
14156
|
-
const
|
|
14490
|
+
const _32n3 = BigInt(32);
|
|
14157
14491
|
const _u32_max = BigInt(4294967295);
|
|
14158
|
-
const wh = Number(value >>
|
|
14492
|
+
const wh = Number(value >> _32n3 & _u32_max);
|
|
14159
14493
|
const wl = Number(value & _u32_max);
|
|
14160
14494
|
const h = isLE3 ? 4 : 0;
|
|
14161
14495
|
const l = isLE3 ? 0 : 4;
|
|
14162
14496
|
view.setUint32(byteOffset + h, wh, isLE3);
|
|
14163
14497
|
view.setUint32(byteOffset + l, wl, isLE3);
|
|
14164
14498
|
}
|
|
14165
|
-
var SHA2 = class extends
|
|
14499
|
+
var SHA2 = class extends Hash2 {
|
|
14166
14500
|
constructor(blockLen, outputLen, padOffset, isLE3) {
|
|
14167
14501
|
super();
|
|
14168
14502
|
this.blockLen = blockLen;
|
|
@@ -14174,17 +14508,17 @@ var starknet = (() => {
|
|
|
14174
14508
|
this.pos = 0;
|
|
14175
14509
|
this.destroyed = false;
|
|
14176
14510
|
this.buffer = new Uint8Array(blockLen);
|
|
14177
|
-
this.view =
|
|
14511
|
+
this.view = createView2(this.buffer);
|
|
14178
14512
|
}
|
|
14179
14513
|
update(data) {
|
|
14180
|
-
|
|
14514
|
+
exists2(this);
|
|
14181
14515
|
const { view, buffer, blockLen } = this;
|
|
14182
|
-
data =
|
|
14516
|
+
data = toBytes2(data);
|
|
14183
14517
|
const len = data.length;
|
|
14184
14518
|
for (let pos = 0; pos < len; ) {
|
|
14185
14519
|
const take = Math.min(blockLen - this.pos, len - pos);
|
|
14186
14520
|
if (take === blockLen) {
|
|
14187
|
-
const dataView =
|
|
14521
|
+
const dataView = createView2(data);
|
|
14188
14522
|
for (; blockLen <= len - pos; pos += blockLen)
|
|
14189
14523
|
this.process(dataView, pos);
|
|
14190
14524
|
continue;
|
|
@@ -14202,8 +14536,8 @@ var starknet = (() => {
|
|
|
14202
14536
|
return this;
|
|
14203
14537
|
}
|
|
14204
14538
|
digestInto(out) {
|
|
14205
|
-
|
|
14206
|
-
|
|
14539
|
+
exists2(this);
|
|
14540
|
+
output2(out, this);
|
|
14207
14541
|
this.finished = true;
|
|
14208
14542
|
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
|
14209
14543
|
let { pos } = this;
|
|
@@ -14217,7 +14551,7 @@ var starknet = (() => {
|
|
|
14217
14551
|
buffer[i] = 0;
|
|
14218
14552
|
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
|
14219
14553
|
this.process(view, 0);
|
|
14220
|
-
const oview =
|
|
14554
|
+
const oview = createView2(out);
|
|
14221
14555
|
const len = this.outputLen;
|
|
14222
14556
|
if (len % 4)
|
|
14223
14557
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
@@ -14249,7 +14583,7 @@ var starknet = (() => {
|
|
|
14249
14583
|
}
|
|
14250
14584
|
};
|
|
14251
14585
|
|
|
14252
|
-
// node_modules/@noble/hashes/esm/sha256.js
|
|
14586
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/sha256.js
|
|
14253
14587
|
var Chi = (a, b, c) => a & b ^ ~a & c;
|
|
14254
14588
|
var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
|
|
14255
14589
|
var SHA256_K = /* @__PURE__ */ new Uint32Array([
|
|
@@ -14362,15 +14696,15 @@ var starknet = (() => {
|
|
|
14362
14696
|
for (let i = 16; i < 64; i++) {
|
|
14363
14697
|
const W15 = SHA256_W[i - 15];
|
|
14364
14698
|
const W2 = SHA256_W[i - 2];
|
|
14365
|
-
const s0 =
|
|
14366
|
-
const s1 =
|
|
14699
|
+
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
|
14700
|
+
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
|
14367
14701
|
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
14368
14702
|
}
|
|
14369
14703
|
let { A, B, C, D, E, F, G, H } = this;
|
|
14370
14704
|
for (let i = 0; i < 64; i++) {
|
|
14371
|
-
const sigma1 =
|
|
14705
|
+
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
|
14372
14706
|
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
14373
|
-
const sigma0 =
|
|
14707
|
+
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
|
14374
14708
|
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
14375
14709
|
H = G;
|
|
14376
14710
|
G = F;
|
|
@@ -14399,7 +14733,7 @@ var starknet = (() => {
|
|
|
14399
14733
|
this.buffer.fill(0);
|
|
14400
14734
|
}
|
|
14401
14735
|
};
|
|
14402
|
-
var sha256 = /* @__PURE__ */
|
|
14736
|
+
var sha256 = /* @__PURE__ */ wrapConstructor2(() => new SHA256());
|
|
14403
14737
|
|
|
14404
14738
|
// node_modules/@scure/starknet/node_modules/@noble/curves/esm/abstract/utils.js
|
|
14405
14739
|
var utils_exports2 = {};
|
|
@@ -14411,29 +14745,29 @@ var starknet = (() => {
|
|
|
14411
14745
|
bytesToHex: () => bytesToHex2,
|
|
14412
14746
|
bytesToNumberBE: () => bytesToNumberBE2,
|
|
14413
14747
|
bytesToNumberLE: () => bytesToNumberLE2,
|
|
14414
|
-
concatBytes: () =>
|
|
14748
|
+
concatBytes: () => concatBytes4,
|
|
14415
14749
|
createHmacDrbg: () => createHmacDrbg2,
|
|
14416
14750
|
ensureBytes: () => ensureBytes2,
|
|
14417
14751
|
equalBytes: () => equalBytes2,
|
|
14418
14752
|
hexToBytes: () => hexToBytes3,
|
|
14419
14753
|
hexToNumber: () => hexToNumber2,
|
|
14420
|
-
isBytes: () =>
|
|
14754
|
+
isBytes: () => isBytes6,
|
|
14421
14755
|
numberToBytesBE: () => numberToBytesBE2,
|
|
14422
14756
|
numberToBytesLE: () => numberToBytesLE2,
|
|
14423
14757
|
numberToHexUnpadded: () => numberToHexUnpadded2,
|
|
14424
14758
|
numberToVarBytesBE: () => numberToVarBytesBE2,
|
|
14425
|
-
utf8ToBytes: () =>
|
|
14759
|
+
utf8ToBytes: () => utf8ToBytes4,
|
|
14426
14760
|
validateObject: () => validateObject2
|
|
14427
14761
|
});
|
|
14428
|
-
var
|
|
14429
|
-
var
|
|
14430
|
-
var
|
|
14431
|
-
function
|
|
14762
|
+
var _0n4 = BigInt(0);
|
|
14763
|
+
var _1n4 = BigInt(1);
|
|
14764
|
+
var _2n4 = BigInt(2);
|
|
14765
|
+
function isBytes6(a) {
|
|
14432
14766
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
14433
14767
|
}
|
|
14434
14768
|
var hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
14435
14769
|
function bytesToHex2(bytes3) {
|
|
14436
|
-
if (!
|
|
14770
|
+
if (!isBytes6(bytes3))
|
|
14437
14771
|
throw new Error("Uint8Array expected");
|
|
14438
14772
|
let hex = "";
|
|
14439
14773
|
for (let i = 0; i < bytes3.length; i++) {
|
|
@@ -14483,7 +14817,7 @@ var starknet = (() => {
|
|
|
14483
14817
|
return hexToNumber2(bytesToHex2(bytes3));
|
|
14484
14818
|
}
|
|
14485
14819
|
function bytesToNumberLE2(bytes3) {
|
|
14486
|
-
if (!
|
|
14820
|
+
if (!isBytes6(bytes3))
|
|
14487
14821
|
throw new Error("Uint8Array expected");
|
|
14488
14822
|
return hexToNumber2(bytesToHex2(Uint8Array.from(bytes3).reverse()));
|
|
14489
14823
|
}
|
|
@@ -14504,7 +14838,7 @@ var starknet = (() => {
|
|
|
14504
14838
|
} catch (e) {
|
|
14505
14839
|
throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
|
|
14506
14840
|
}
|
|
14507
|
-
} else if (
|
|
14841
|
+
} else if (isBytes6(hex)) {
|
|
14508
14842
|
res = Uint8Array.from(hex);
|
|
14509
14843
|
} else {
|
|
14510
14844
|
throw new Error(`${title} must be hex string or Uint8Array`);
|
|
@@ -14514,11 +14848,11 @@ var starknet = (() => {
|
|
|
14514
14848
|
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
|
14515
14849
|
return res;
|
|
14516
14850
|
}
|
|
14517
|
-
function
|
|
14851
|
+
function concatBytes4(...arrays) {
|
|
14518
14852
|
let sum = 0;
|
|
14519
14853
|
for (let i = 0; i < arrays.length; i++) {
|
|
14520
14854
|
const a = arrays[i];
|
|
14521
|
-
if (!
|
|
14855
|
+
if (!isBytes6(a))
|
|
14522
14856
|
throw new Error("Uint8Array expected");
|
|
14523
14857
|
sum += a.length;
|
|
14524
14858
|
}
|
|
@@ -14539,24 +14873,24 @@ var starknet = (() => {
|
|
|
14539
14873
|
diff |= a[i] ^ b[i];
|
|
14540
14874
|
return diff === 0;
|
|
14541
14875
|
}
|
|
14542
|
-
function
|
|
14876
|
+
function utf8ToBytes4(str) {
|
|
14543
14877
|
if (typeof str !== "string")
|
|
14544
14878
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
14545
14879
|
return new Uint8Array(new TextEncoder().encode(str));
|
|
14546
14880
|
}
|
|
14547
14881
|
function bitLen2(n) {
|
|
14548
14882
|
let len;
|
|
14549
|
-
for (len = 0; n >
|
|
14883
|
+
for (len = 0; n > _0n4; n >>= _1n4, len += 1)
|
|
14550
14884
|
;
|
|
14551
14885
|
return len;
|
|
14552
14886
|
}
|
|
14553
14887
|
function bitGet2(n, pos) {
|
|
14554
|
-
return n >> BigInt(pos) &
|
|
14888
|
+
return n >> BigInt(pos) & _1n4;
|
|
14555
14889
|
}
|
|
14556
14890
|
var bitSet2 = (n, pos, value) => {
|
|
14557
|
-
return n | (value ?
|
|
14891
|
+
return n | (value ? _1n4 : _0n4) << BigInt(pos);
|
|
14558
14892
|
};
|
|
14559
|
-
var bitMask2 = (n) => (
|
|
14893
|
+
var bitMask2 = (n) => (_2n4 << BigInt(n - 1)) - _1n4;
|
|
14560
14894
|
var u8n2 = (data) => new Uint8Array(data);
|
|
14561
14895
|
var u8fr2 = (arr) => Uint8Array.from(arr);
|
|
14562
14896
|
function createHmacDrbg2(hashLen, qByteLen, hmacFn) {
|
|
@@ -14583,7 +14917,7 @@ var starknet = (() => {
|
|
|
14583
14917
|
k = h(u8fr2([1]), seed);
|
|
14584
14918
|
v = h();
|
|
14585
14919
|
};
|
|
14586
|
-
const
|
|
14920
|
+
const gen3 = () => {
|
|
14587
14921
|
if (i++ >= 1e3)
|
|
14588
14922
|
throw new Error("drbg: tried 1000 values");
|
|
14589
14923
|
let len = 0;
|
|
@@ -14594,13 +14928,13 @@ var starknet = (() => {
|
|
|
14594
14928
|
out.push(sl);
|
|
14595
14929
|
len += v.length;
|
|
14596
14930
|
}
|
|
14597
|
-
return
|
|
14931
|
+
return concatBytes4(...out);
|
|
14598
14932
|
};
|
|
14599
14933
|
const genUntil = (seed, pred) => {
|
|
14600
14934
|
reset();
|
|
14601
14935
|
reseed(seed);
|
|
14602
14936
|
let res = void 0;
|
|
14603
|
-
while (!(res = pred(
|
|
14937
|
+
while (!(res = pred(gen3())))
|
|
14604
14938
|
reseed();
|
|
14605
14939
|
reset();
|
|
14606
14940
|
return res;
|
|
@@ -14612,7 +14946,7 @@ var starknet = (() => {
|
|
|
14612
14946
|
function: (val) => typeof val === "function",
|
|
14613
14947
|
boolean: (val) => typeof val === "boolean",
|
|
14614
14948
|
string: (val) => typeof val === "string",
|
|
14615
|
-
stringOrUint8Array: (val) => typeof val === "string" ||
|
|
14949
|
+
stringOrUint8Array: (val) => typeof val === "string" || isBytes6(val),
|
|
14616
14950
|
isSafeInteger: (val) => Number.isSafeInteger(val),
|
|
14617
14951
|
array: (val) => Array.isArray(val),
|
|
14618
14952
|
field: (val, object) => object.Fp.isValid(val),
|
|
@@ -14638,9 +14972,9 @@ var starknet = (() => {
|
|
|
14638
14972
|
}
|
|
14639
14973
|
|
|
14640
14974
|
// node_modules/@scure/starknet/node_modules/@noble/curves/esm/abstract/modular.js
|
|
14641
|
-
var
|
|
14642
|
-
var
|
|
14643
|
-
var
|
|
14975
|
+
var _0n5 = BigInt(0);
|
|
14976
|
+
var _1n5 = BigInt(1);
|
|
14977
|
+
var _2n5 = BigInt(2);
|
|
14644
14978
|
var _3n = BigInt(3);
|
|
14645
14979
|
var _4n = BigInt(4);
|
|
14646
14980
|
var _5n = BigInt(5);
|
|
@@ -14649,30 +14983,30 @@ var starknet = (() => {
|
|
|
14649
14983
|
var _16n = BigInt(16);
|
|
14650
14984
|
function mod(a, b) {
|
|
14651
14985
|
const result = a % b;
|
|
14652
|
-
return result >=
|
|
14986
|
+
return result >= _0n5 ? result : b + result;
|
|
14653
14987
|
}
|
|
14654
14988
|
function pow(num, power, modulo) {
|
|
14655
|
-
if (modulo <=
|
|
14989
|
+
if (modulo <= _0n5 || power < _0n5)
|
|
14656
14990
|
throw new Error("Expected power/modulo > 0");
|
|
14657
|
-
if (modulo ===
|
|
14658
|
-
return
|
|
14659
|
-
let res =
|
|
14660
|
-
while (power >
|
|
14661
|
-
if (power &
|
|
14991
|
+
if (modulo === _1n5)
|
|
14992
|
+
return _0n5;
|
|
14993
|
+
let res = _1n5;
|
|
14994
|
+
while (power > _0n5) {
|
|
14995
|
+
if (power & _1n5)
|
|
14662
14996
|
res = res * num % modulo;
|
|
14663
14997
|
num = num * num % modulo;
|
|
14664
|
-
power >>=
|
|
14998
|
+
power >>= _1n5;
|
|
14665
14999
|
}
|
|
14666
15000
|
return res;
|
|
14667
15001
|
}
|
|
14668
15002
|
function invert(number4, modulo) {
|
|
14669
|
-
if (number4 ===
|
|
15003
|
+
if (number4 === _0n5 || modulo <= _0n5) {
|
|
14670
15004
|
throw new Error(`invert: expected positive integers, got n=${number4} mod=${modulo}`);
|
|
14671
15005
|
}
|
|
14672
15006
|
let a = mod(number4, modulo);
|
|
14673
15007
|
let b = modulo;
|
|
14674
|
-
let x =
|
|
14675
|
-
while (a !==
|
|
15008
|
+
let x = _0n5, y = _1n5, u = _1n5, v = _0n5;
|
|
15009
|
+
while (a !== _0n5) {
|
|
14676
15010
|
const q = b / a;
|
|
14677
15011
|
const r = b % a;
|
|
14678
15012
|
const m = x - u * q;
|
|
@@ -14680,19 +15014,19 @@ var starknet = (() => {
|
|
|
14680
15014
|
b = a, a = r, x = u, y = v, u = m, v = n;
|
|
14681
15015
|
}
|
|
14682
15016
|
const gcd2 = b;
|
|
14683
|
-
if (gcd2 !==
|
|
15017
|
+
if (gcd2 !== _1n5)
|
|
14684
15018
|
throw new Error("invert: does not exist");
|
|
14685
15019
|
return mod(x, modulo);
|
|
14686
15020
|
}
|
|
14687
15021
|
function tonelliShanks(P) {
|
|
14688
|
-
const legendreC = (P -
|
|
15022
|
+
const legendreC = (P - _1n5) / _2n5;
|
|
14689
15023
|
let Q, S, Z;
|
|
14690
|
-
for (Q = P -
|
|
15024
|
+
for (Q = P - _1n5, S = 0; Q % _2n5 === _0n5; Q /= _2n5, S++)
|
|
14691
15025
|
;
|
|
14692
|
-
for (Z =
|
|
15026
|
+
for (Z = _2n5; Z < P && pow(Z, legendreC, P) !== P - _1n5; Z++)
|
|
14693
15027
|
;
|
|
14694
15028
|
if (S === 1) {
|
|
14695
|
-
const p1div4 = (P +
|
|
15029
|
+
const p1div4 = (P + _1n5) / _4n;
|
|
14696
15030
|
return function tonelliFast(Fp2, n) {
|
|
14697
15031
|
const root = Fp2.pow(n, p1div4);
|
|
14698
15032
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
|
@@ -14700,7 +15034,7 @@ var starknet = (() => {
|
|
|
14700
15034
|
return root;
|
|
14701
15035
|
};
|
|
14702
15036
|
}
|
|
14703
|
-
const Q1div2 = (Q +
|
|
15037
|
+
const Q1div2 = (Q + _1n5) / _2n5;
|
|
14704
15038
|
return function tonelliSlow(Fp2, n) {
|
|
14705
15039
|
if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
|
|
14706
15040
|
throw new Error("Cannot find square root");
|
|
@@ -14717,7 +15051,7 @@ var starknet = (() => {
|
|
|
14717
15051
|
break;
|
|
14718
15052
|
t2 = Fp2.sqr(t2);
|
|
14719
15053
|
}
|
|
14720
|
-
const ge = Fp2.pow(g2,
|
|
15054
|
+
const ge = Fp2.pow(g2, _1n5 << BigInt(r - m - 1));
|
|
14721
15055
|
g2 = Fp2.sqr(ge);
|
|
14722
15056
|
x = Fp2.mul(x, ge);
|
|
14723
15057
|
b = Fp2.mul(b, g2);
|
|
@@ -14728,7 +15062,7 @@ var starknet = (() => {
|
|
|
14728
15062
|
}
|
|
14729
15063
|
function FpSqrt(P) {
|
|
14730
15064
|
if (P % _4n === _3n) {
|
|
14731
|
-
const p1div4 = (P +
|
|
15065
|
+
const p1div4 = (P + _1n5) / _4n;
|
|
14732
15066
|
return function sqrt3mod4(Fp2, n) {
|
|
14733
15067
|
const root = Fp2.pow(n, p1div4);
|
|
14734
15068
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
|
@@ -14739,10 +15073,10 @@ var starknet = (() => {
|
|
|
14739
15073
|
if (P % _8n === _5n) {
|
|
14740
15074
|
const c1 = (P - _5n) / _8n;
|
|
14741
15075
|
return function sqrt5mod8(Fp2, n) {
|
|
14742
|
-
const n2 = Fp2.mul(n,
|
|
15076
|
+
const n2 = Fp2.mul(n, _2n5);
|
|
14743
15077
|
const v = Fp2.pow(n2, c1);
|
|
14744
15078
|
const nv = Fp2.mul(n, v);
|
|
14745
|
-
const i = Fp2.mul(Fp2.mul(nv,
|
|
15079
|
+
const i = Fp2.mul(Fp2.mul(nv, _2n5), v);
|
|
14746
15080
|
const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
|
|
14747
15081
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
|
14748
15082
|
throw new Error("Cannot find square root");
|
|
@@ -14786,19 +15120,19 @@ var starknet = (() => {
|
|
|
14786
15120
|
return validateObject2(field, opts);
|
|
14787
15121
|
}
|
|
14788
15122
|
function FpPow(f, num, power) {
|
|
14789
|
-
if (power <
|
|
15123
|
+
if (power < _0n5)
|
|
14790
15124
|
throw new Error("Expected power > 0");
|
|
14791
|
-
if (power ===
|
|
15125
|
+
if (power === _0n5)
|
|
14792
15126
|
return f.ONE;
|
|
14793
|
-
if (power ===
|
|
15127
|
+
if (power === _1n5)
|
|
14794
15128
|
return num;
|
|
14795
15129
|
let p = f.ONE;
|
|
14796
15130
|
let d = num;
|
|
14797
|
-
while (power >
|
|
14798
|
-
if (power &
|
|
15131
|
+
while (power > _0n5) {
|
|
15132
|
+
if (power & _1n5)
|
|
14799
15133
|
p = f.mul(p, d);
|
|
14800
15134
|
d = f.sqr(d);
|
|
14801
|
-
power >>=
|
|
15135
|
+
power >>= _1n5;
|
|
14802
15136
|
}
|
|
14803
15137
|
return p;
|
|
14804
15138
|
}
|
|
@@ -14825,7 +15159,7 @@ var starknet = (() => {
|
|
|
14825
15159
|
return { nBitLength: _nBitLength, nByteLength };
|
|
14826
15160
|
}
|
|
14827
15161
|
function Field(ORDER, bitLen3, isLE3 = false, redef = {}) {
|
|
14828
|
-
if (ORDER <=
|
|
15162
|
+
if (ORDER <= _0n5)
|
|
14829
15163
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
|
14830
15164
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen3);
|
|
14831
15165
|
if (BYTES > 2048)
|
|
@@ -14836,16 +15170,16 @@ var starknet = (() => {
|
|
|
14836
15170
|
BITS,
|
|
14837
15171
|
BYTES,
|
|
14838
15172
|
MASK: bitMask2(BITS),
|
|
14839
|
-
ZERO:
|
|
14840
|
-
ONE:
|
|
15173
|
+
ZERO: _0n5,
|
|
15174
|
+
ONE: _1n5,
|
|
14841
15175
|
create: (num) => mod(num, ORDER),
|
|
14842
15176
|
isValid: (num) => {
|
|
14843
15177
|
if (typeof num !== "bigint")
|
|
14844
15178
|
throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
|
|
14845
|
-
return
|
|
15179
|
+
return _0n5 <= num && num < ORDER;
|
|
14846
15180
|
},
|
|
14847
|
-
is0: (num) => num ===
|
|
14848
|
-
isOdd: (num) => (num &
|
|
15181
|
+
is0: (num) => num === _0n5,
|
|
15182
|
+
isOdd: (num) => (num & _1n5) === _1n5,
|
|
14849
15183
|
neg: (num) => mod(-num, ORDER),
|
|
14850
15184
|
eql: (lhs, rhs) => lhs === rhs,
|
|
14851
15185
|
sqr: (num) => mod(num * num, ORDER),
|
|
@@ -14891,7 +15225,7 @@ var starknet = (() => {
|
|
|
14891
15225
|
if (len < 16 || len < minLen || len > 1024)
|
|
14892
15226
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
|
14893
15227
|
const num = isLE3 ? bytesToNumberBE2(key) : bytesToNumberLE2(key);
|
|
14894
|
-
const reduced = mod(num, fieldOrder -
|
|
15228
|
+
const reduced = mod(num, fieldOrder - _1n5) + _1n5;
|
|
14895
15229
|
return isLE3 ? numberToBytesLE2(reduced, fieldLen) : numberToBytesBE2(reduced, fieldLen);
|
|
14896
15230
|
}
|
|
14897
15231
|
|
|
@@ -14979,8 +15313,8 @@ var starknet = (() => {
|
|
|
14979
15313
|
}
|
|
14980
15314
|
|
|
14981
15315
|
// node_modules/@scure/starknet/node_modules/@noble/curves/esm/abstract/curve.js
|
|
14982
|
-
var
|
|
14983
|
-
var
|
|
15316
|
+
var _0n6 = BigInt(0);
|
|
15317
|
+
var _1n6 = BigInt(1);
|
|
14984
15318
|
function wNAF(c, bits) {
|
|
14985
15319
|
const constTimeNegate = (condition, item) => {
|
|
14986
15320
|
const neg = item.negate();
|
|
@@ -14997,11 +15331,11 @@ var starknet = (() => {
|
|
|
14997
15331
|
unsafeLadder(elm, n) {
|
|
14998
15332
|
let p = c.ZERO;
|
|
14999
15333
|
let d = elm;
|
|
15000
|
-
while (n >
|
|
15001
|
-
if (n &
|
|
15334
|
+
while (n > _0n6) {
|
|
15335
|
+
if (n & _1n6)
|
|
15002
15336
|
p = p.add(d);
|
|
15003
15337
|
d = d.double();
|
|
15004
|
-
n >>=
|
|
15338
|
+
n >>= _1n6;
|
|
15005
15339
|
}
|
|
15006
15340
|
return p;
|
|
15007
15341
|
},
|
|
@@ -15051,7 +15385,7 @@ var starknet = (() => {
|
|
|
15051
15385
|
n >>= shiftBy;
|
|
15052
15386
|
if (wbits > windowSize) {
|
|
15053
15387
|
wbits -= maxNumber;
|
|
15054
|
-
n +=
|
|
15388
|
+
n += _1n6;
|
|
15055
15389
|
}
|
|
15056
15390
|
const offset1 = offset;
|
|
15057
15391
|
const offset2 = offset + Math.abs(wbits) - 1;
|
|
@@ -15147,7 +15481,7 @@ var starknet = (() => {
|
|
|
15147
15481
|
toSig(hex) {
|
|
15148
15482
|
const { Err: E } = DER;
|
|
15149
15483
|
const data = typeof hex === "string" ? h2b(hex) : hex;
|
|
15150
|
-
if (!
|
|
15484
|
+
if (!isBytes6(data))
|
|
15151
15485
|
throw new Error("ui8a expected");
|
|
15152
15486
|
let l = data.length;
|
|
15153
15487
|
if (l < 2 || data[0] != 48)
|
|
@@ -15175,9 +15509,9 @@ var starknet = (() => {
|
|
|
15175
15509
|
return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
|
|
15176
15510
|
}
|
|
15177
15511
|
};
|
|
15178
|
-
var
|
|
15179
|
-
var
|
|
15180
|
-
var
|
|
15512
|
+
var _0n7 = BigInt(0);
|
|
15513
|
+
var _1n7 = BigInt(1);
|
|
15514
|
+
var _2n6 = BigInt(2);
|
|
15181
15515
|
var _3n2 = BigInt(3);
|
|
15182
15516
|
var _4n2 = BigInt(4);
|
|
15183
15517
|
function weierstrassPoints(opts) {
|
|
@@ -15185,7 +15519,7 @@ var starknet = (() => {
|
|
|
15185
15519
|
const { Fp: Fp2 } = CURVE2;
|
|
15186
15520
|
const toBytes3 = CURVE2.toBytes || ((_c, point, _isCompressed) => {
|
|
15187
15521
|
const a = point.toAffine();
|
|
15188
|
-
return
|
|
15522
|
+
return concatBytes4(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
|
15189
15523
|
});
|
|
15190
15524
|
const fromBytes = CURVE2.fromBytes || ((bytes3) => {
|
|
15191
15525
|
const tail = bytes3.subarray(1);
|
|
@@ -15202,7 +15536,7 @@ var starknet = (() => {
|
|
|
15202
15536
|
if (!Fp2.eql(Fp2.sqr(CURVE2.Gy), weierstrassEquation(CURVE2.Gx)))
|
|
15203
15537
|
throw new Error("bad generator point: equation left != right");
|
|
15204
15538
|
function isWithinCurveOrder(num) {
|
|
15205
|
-
return typeof num === "bigint" &&
|
|
15539
|
+
return typeof num === "bigint" && _0n7 < num && num < CURVE2.n;
|
|
15206
15540
|
}
|
|
15207
15541
|
function assertGE(num) {
|
|
15208
15542
|
if (!isWithinCurveOrder(num))
|
|
@@ -15211,7 +15545,7 @@ var starknet = (() => {
|
|
|
15211
15545
|
function normPrivateKeyToScalar(key) {
|
|
15212
15546
|
const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE2;
|
|
15213
15547
|
if (lengths && typeof key !== "bigint") {
|
|
15214
|
-
if (
|
|
15548
|
+
if (isBytes6(key))
|
|
15215
15549
|
key = bytesToHex2(key);
|
|
15216
15550
|
if (typeof key !== "string" || !lengths.includes(key.length))
|
|
15217
15551
|
throw new Error("Invalid key");
|
|
@@ -15446,10 +15780,10 @@ var starknet = (() => {
|
|
|
15446
15780
|
*/
|
|
15447
15781
|
multiplyUnsafe(n) {
|
|
15448
15782
|
const I = Point2.ZERO;
|
|
15449
|
-
if (n ===
|
|
15783
|
+
if (n === _0n7)
|
|
15450
15784
|
return I;
|
|
15451
15785
|
assertGE(n);
|
|
15452
|
-
if (n ===
|
|
15786
|
+
if (n === _1n7)
|
|
15453
15787
|
return this;
|
|
15454
15788
|
const { endo } = CURVE2;
|
|
15455
15789
|
if (!endo)
|
|
@@ -15458,14 +15792,14 @@ var starknet = (() => {
|
|
|
15458
15792
|
let k1p = I;
|
|
15459
15793
|
let k2p = I;
|
|
15460
15794
|
let d = this;
|
|
15461
|
-
while (k1 >
|
|
15462
|
-
if (k1 &
|
|
15795
|
+
while (k1 > _0n7 || k2 > _0n7) {
|
|
15796
|
+
if (k1 & _1n7)
|
|
15463
15797
|
k1p = k1p.add(d);
|
|
15464
|
-
if (k2 &
|
|
15798
|
+
if (k2 & _1n7)
|
|
15465
15799
|
k2p = k2p.add(d);
|
|
15466
15800
|
d = d.double();
|
|
15467
|
-
k1 >>=
|
|
15468
|
-
k2 >>=
|
|
15801
|
+
k1 >>= _1n7;
|
|
15802
|
+
k2 >>= _1n7;
|
|
15469
15803
|
}
|
|
15470
15804
|
if (k1neg)
|
|
15471
15805
|
k1p = k1p.negate();
|
|
@@ -15512,7 +15846,7 @@ var starknet = (() => {
|
|
|
15512
15846
|
*/
|
|
15513
15847
|
multiplyAndAddUnsafe(Q, a, b) {
|
|
15514
15848
|
const G = Point2.BASE;
|
|
15515
|
-
const mul = (P, a2) => a2 ===
|
|
15849
|
+
const mul = (P, a2) => a2 === _0n7 || a2 === _1n7 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
|
|
15516
15850
|
const sum = mul(this, a).add(mul(Q, b));
|
|
15517
15851
|
return sum.is0() ? void 0 : sum;
|
|
15518
15852
|
}
|
|
@@ -15535,7 +15869,7 @@ var starknet = (() => {
|
|
|
15535
15869
|
}
|
|
15536
15870
|
isTorsionFree() {
|
|
15537
15871
|
const { h: cofactor, isTorsionFree } = CURVE2;
|
|
15538
|
-
if (cofactor ===
|
|
15872
|
+
if (cofactor === _1n7)
|
|
15539
15873
|
return true;
|
|
15540
15874
|
if (isTorsionFree)
|
|
15541
15875
|
return isTorsionFree(Point2, this);
|
|
@@ -15543,7 +15877,7 @@ var starknet = (() => {
|
|
|
15543
15877
|
}
|
|
15544
15878
|
clearCofactor() {
|
|
15545
15879
|
const { h: cofactor, clearCofactor } = CURVE2;
|
|
15546
|
-
if (cofactor ===
|
|
15880
|
+
if (cofactor === _1n7)
|
|
15547
15881
|
return this;
|
|
15548
15882
|
if (clearCofactor)
|
|
15549
15883
|
return clearCofactor(Point2, this);
|
|
@@ -15588,7 +15922,7 @@ var starknet = (() => {
|
|
|
15588
15922
|
const compressedLen = Fp2.BYTES + 1;
|
|
15589
15923
|
const uncompressedLen = 2 * Fp2.BYTES + 1;
|
|
15590
15924
|
function isValidFieldElement(num) {
|
|
15591
|
-
return
|
|
15925
|
+
return _0n7 < num && num < Fp2.ORDER;
|
|
15592
15926
|
}
|
|
15593
15927
|
function modN(a) {
|
|
15594
15928
|
return mod(a, CURVE_ORDER2);
|
|
@@ -15601,7 +15935,7 @@ var starknet = (() => {
|
|
|
15601
15935
|
toBytes(_c, point, isCompressed) {
|
|
15602
15936
|
const a = point.toAffine();
|
|
15603
15937
|
const x = Fp2.toBytes(a.x);
|
|
15604
|
-
const cat =
|
|
15938
|
+
const cat = concatBytes4;
|
|
15605
15939
|
if (isCompressed) {
|
|
15606
15940
|
return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
|
|
15607
15941
|
} else {
|
|
@@ -15618,7 +15952,7 @@ var starknet = (() => {
|
|
|
15618
15952
|
throw new Error("Point is not on curve");
|
|
15619
15953
|
const y2 = weierstrassEquation(x);
|
|
15620
15954
|
let y = Fp2.sqrt(y2);
|
|
15621
|
-
const isYOdd = (y &
|
|
15955
|
+
const isYOdd = (y & _1n7) === _1n7;
|
|
15622
15956
|
const isHeadOdd = (head & 1) === 1;
|
|
15623
15957
|
if (isHeadOdd !== isYOdd)
|
|
15624
15958
|
y = Fp2.neg(y);
|
|
@@ -15634,7 +15968,7 @@ var starknet = (() => {
|
|
|
15634
15968
|
});
|
|
15635
15969
|
const numToNByteStr = (num) => bytesToHex2(numberToBytesBE2(num, CURVE2.nByteLength));
|
|
15636
15970
|
function isBiggerThanHalfOrder(number4) {
|
|
15637
|
-
const HALF = CURVE_ORDER2 >>
|
|
15971
|
+
const HALF = CURVE_ORDER2 >> _1n7;
|
|
15638
15972
|
return number4 > HALF;
|
|
15639
15973
|
}
|
|
15640
15974
|
function normalizeS(s) {
|
|
@@ -15746,7 +16080,7 @@ var starknet = (() => {
|
|
|
15746
16080
|
return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed);
|
|
15747
16081
|
}
|
|
15748
16082
|
function isProbPub(item) {
|
|
15749
|
-
const arr =
|
|
16083
|
+
const arr = isBytes6(item);
|
|
15750
16084
|
const str = typeof item === "string";
|
|
15751
16085
|
const len = (arr || str) && item.length;
|
|
15752
16086
|
if (arr)
|
|
@@ -15777,7 +16111,7 @@ var starknet = (() => {
|
|
|
15777
16111
|
function int2octets(num) {
|
|
15778
16112
|
if (typeof num !== "bigint")
|
|
15779
16113
|
throw new Error("bigint expected");
|
|
15780
|
-
if (!(
|
|
16114
|
+
if (!(_0n7 <= num && num < ORDER_MASK))
|
|
15781
16115
|
throw new Error(`bigint expected < 2^${CURVE2.nBitLength}`);
|
|
15782
16116
|
return numberToBytesBE2(num, CURVE2.nByteLength);
|
|
15783
16117
|
}
|
|
@@ -15798,7 +16132,7 @@ var starknet = (() => {
|
|
|
15798
16132
|
const e = ent === true ? randomBytes3(Fp2.BYTES) : ent;
|
|
15799
16133
|
seedArgs.push(ensureBytes2("extraEntropy", e));
|
|
15800
16134
|
}
|
|
15801
|
-
const seed =
|
|
16135
|
+
const seed = concatBytes4(...seedArgs);
|
|
15802
16136
|
const m = h1int;
|
|
15803
16137
|
function k2sig(kBytes) {
|
|
15804
16138
|
const k = bits2int2(kBytes);
|
|
@@ -15807,12 +16141,12 @@ var starknet = (() => {
|
|
|
15807
16141
|
const ik = invN(k);
|
|
15808
16142
|
const q = Point2.BASE.multiply(k).toAffine();
|
|
15809
16143
|
const r = modN(q.x);
|
|
15810
|
-
if (r ===
|
|
16144
|
+
if (r === _0n7)
|
|
15811
16145
|
return;
|
|
15812
16146
|
const s = modN(ik * modN(m + r * d));
|
|
15813
|
-
if (s ===
|
|
16147
|
+
if (s === _0n7)
|
|
15814
16148
|
return;
|
|
15815
|
-
let recovery = (q.x === r ? 0 : 2) | Number(q.y &
|
|
16149
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n7);
|
|
15816
16150
|
let normS = s;
|
|
15817
16151
|
if (lowS && isBiggerThanHalfOrder(s)) {
|
|
15818
16152
|
normS = normalizeS(s);
|
|
@@ -15841,7 +16175,7 @@ var starknet = (() => {
|
|
|
15841
16175
|
let _sig = void 0;
|
|
15842
16176
|
let P;
|
|
15843
16177
|
try {
|
|
15844
|
-
if (typeof sg === "string" ||
|
|
16178
|
+
if (typeof sg === "string" || isBytes6(sg)) {
|
|
15845
16179
|
try {
|
|
15846
16180
|
_sig = Signature3.fromDER(sg);
|
|
15847
16181
|
} catch (derError) {
|
|
@@ -15888,14 +16222,14 @@ var starknet = (() => {
|
|
|
15888
16222
|
};
|
|
15889
16223
|
}
|
|
15890
16224
|
|
|
15891
|
-
// node_modules/@noble/hashes/esm/hmac.js
|
|
15892
|
-
var HMAC = class extends
|
|
16225
|
+
// node_modules/@scure/starknet/node_modules/@noble/hashes/esm/hmac.js
|
|
16226
|
+
var HMAC = class extends Hash2 {
|
|
15893
16227
|
constructor(hash3, _key) {
|
|
15894
16228
|
super();
|
|
15895
16229
|
this.finished = false;
|
|
15896
16230
|
this.destroyed = false;
|
|
15897
|
-
|
|
15898
|
-
const key =
|
|
16231
|
+
hash2(hash3);
|
|
16232
|
+
const key = toBytes2(_key);
|
|
15899
16233
|
this.iHash = hash3.create();
|
|
15900
16234
|
if (typeof this.iHash.update !== "function")
|
|
15901
16235
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
@@ -15914,13 +16248,13 @@ var starknet = (() => {
|
|
|
15914
16248
|
pad.fill(0);
|
|
15915
16249
|
}
|
|
15916
16250
|
update(buf) {
|
|
15917
|
-
|
|
16251
|
+
exists2(this);
|
|
15918
16252
|
this.iHash.update(buf);
|
|
15919
16253
|
return this;
|
|
15920
16254
|
}
|
|
15921
16255
|
digestInto(out) {
|
|
15922
|
-
|
|
15923
|
-
|
|
16256
|
+
exists2(this);
|
|
16257
|
+
bytes2(out, this.outputLen);
|
|
15924
16258
|
this.finished = true;
|
|
15925
16259
|
this.iHash.digestInto(out);
|
|
15926
16260
|
this.oHash.update(out);
|
|
@@ -15957,8 +16291,8 @@ var starknet = (() => {
|
|
|
15957
16291
|
function getHash(hash3) {
|
|
15958
16292
|
return {
|
|
15959
16293
|
hash: hash3,
|
|
15960
|
-
hmac: (key, ...msgs) => hmac(hash3, key,
|
|
15961
|
-
randomBytes
|
|
16294
|
+
hmac: (key, ...msgs) => hmac(hash3, key, concatBytes3(...msgs)),
|
|
16295
|
+
randomBytes: randomBytes2
|
|
15962
16296
|
};
|
|
15963
16297
|
}
|
|
15964
16298
|
|
|
@@ -16061,7 +16395,7 @@ var starknet = (() => {
|
|
|
16061
16395
|
const sha256mask = 2n ** 256n;
|
|
16062
16396
|
const limit = sha256mask - mod(sha256mask, CURVE_ORDER);
|
|
16063
16397
|
for (let i = 0; ; i++) {
|
|
16064
|
-
const key = sha256Num(
|
|
16398
|
+
const key = sha256Num(concatBytes4(_seed, numberToVarBytesBE2(BigInt(i))));
|
|
16065
16399
|
if (key < limit)
|
|
16066
16400
|
return mod(key, CURVE_ORDER).toString(16);
|
|
16067
16401
|
if (i === 1e5)
|
|
@@ -16143,11 +16477,11 @@ var starknet = (() => {
|
|
|
16143
16477
|
}
|
|
16144
16478
|
var computeHashOnElements = (data, fn = pedersen) => [0, ...data, data.length].reduce((x, y) => fn(x, y));
|
|
16145
16479
|
var MASK_2502 = bitMask2(250);
|
|
16146
|
-
var keccak = (data) => bytesToNumberBE2(
|
|
16480
|
+
var keccak = (data) => bytesToNumberBE2(keccak_2562(data)) & MASK_2502;
|
|
16147
16481
|
var sha256Num = (data) => bytesToNumberBE2(sha256(data));
|
|
16148
16482
|
var Fp251 = Field(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
|
|
16149
16483
|
function poseidonRoundConstant(Fp2, name, idx) {
|
|
16150
|
-
const val = Fp2.fromBytes(sha256(
|
|
16484
|
+
const val = Fp2.fromBytes(sha256(utf8ToBytes3(`${name}${idx}`)));
|
|
16151
16485
|
return Fp2.create(val);
|
|
16152
16486
|
}
|
|
16153
16487
|
function _poseidonMDS(Fp2, name, m, attempt = 0) {
|
|
@@ -16845,46 +17179,49 @@ var starknet = (() => {
|
|
|
16845
17179
|
}
|
|
16846
17180
|
};
|
|
16847
17181
|
function formatter(data, type, sameType) {
|
|
16848
|
-
return Object.entries(data).reduce(
|
|
16849
|
-
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
|
|
16853
|
-
}
|
|
16854
|
-
if (elType === "string") {
|
|
16855
|
-
if (Array.isArray(data[key])) {
|
|
16856
|
-
const arrayStr = formatter(
|
|
16857
|
-
data[key],
|
|
16858
|
-
data[key].map((_) => elType)
|
|
16859
|
-
);
|
|
16860
|
-
acc[key] = Object.values(arrayStr).join("");
|
|
17182
|
+
return Object.entries(data).reduce(
|
|
17183
|
+
(acc, [key, value]) => {
|
|
17184
|
+
const elType = sameType ?? type[key];
|
|
17185
|
+
if (!(key in type) && !sameType) {
|
|
17186
|
+
acc[key] = value;
|
|
16861
17187
|
return acc;
|
|
16862
17188
|
}
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
|
|
16881
|
-
|
|
16882
|
-
|
|
17189
|
+
if (elType === "string") {
|
|
17190
|
+
if (Array.isArray(data[key])) {
|
|
17191
|
+
const arrayStr = formatter(
|
|
17192
|
+
data[key],
|
|
17193
|
+
data[key].map((_) => elType)
|
|
17194
|
+
);
|
|
17195
|
+
acc[key] = Object.values(arrayStr).join("");
|
|
17196
|
+
return acc;
|
|
17197
|
+
}
|
|
17198
|
+
guard.isBN(data, type, key);
|
|
17199
|
+
acc[key] = decodeShortString(value);
|
|
17200
|
+
return acc;
|
|
17201
|
+
}
|
|
17202
|
+
if (elType === "number") {
|
|
17203
|
+
guard.isBN(data, type, key);
|
|
17204
|
+
acc[key] = Number(value);
|
|
17205
|
+
return acc;
|
|
17206
|
+
}
|
|
17207
|
+
if (typeof elType === "function") {
|
|
17208
|
+
acc[key] = elType(value);
|
|
17209
|
+
return acc;
|
|
17210
|
+
}
|
|
17211
|
+
if (Array.isArray(elType)) {
|
|
17212
|
+
const arrayObj = formatter(data[key], elType, elType[0]);
|
|
17213
|
+
acc[key] = Object.values(arrayObj);
|
|
17214
|
+
return acc;
|
|
17215
|
+
}
|
|
17216
|
+
if (typeof elType === "object") {
|
|
17217
|
+
acc[key] = formatter(data[key], elType);
|
|
17218
|
+
return acc;
|
|
17219
|
+
}
|
|
17220
|
+
guard.unknown(data, type, key);
|
|
16883
17221
|
return acc;
|
|
16884
|
-
}
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
}, {});
|
|
17222
|
+
},
|
|
17223
|
+
{}
|
|
17224
|
+
);
|
|
16888
17225
|
}
|
|
16889
17226
|
|
|
16890
17227
|
// src/utils/calldata/parser/parser-0-1.1.0.ts
|
|
@@ -16939,7 +17276,9 @@ var starknet = (() => {
|
|
|
16939
17276
|
* @returns FunctionAbi | undefined
|
|
16940
17277
|
*/
|
|
16941
17278
|
getMethod(name) {
|
|
16942
|
-
const intf = this.abi.find(
|
|
17279
|
+
const intf = this.abi.find(
|
|
17280
|
+
(it) => it.type === "interface"
|
|
17281
|
+
);
|
|
16943
17282
|
return intf.items.find((it) => it.name === name);
|
|
16944
17283
|
}
|
|
16945
17284
|
/**
|
|
@@ -17909,7 +18248,7 @@ var starknet = (() => {
|
|
|
17909
18248
|
* Compile contract callData with abi
|
|
17910
18249
|
* Parse the calldata by using input fields from the abi for that method
|
|
17911
18250
|
* @param method string - method name
|
|
17912
|
-
* @param
|
|
18251
|
+
* @param argsCalldata RawArgs - arguments passed to the method. Can be an array of arguments (in the order of abi definition), or an object constructed in conformity with abi (in this case, the parameter can be in a wrong order).
|
|
17913
18252
|
* @return Calldata - parsed arguments in format that contract is expecting
|
|
17914
18253
|
* @example
|
|
17915
18254
|
* ```typescript
|
|
@@ -18154,9 +18493,9 @@ var starknet = (() => {
|
|
|
18154
18493
|
});
|
|
18155
18494
|
|
|
18156
18495
|
// node_modules/@noble/curves/esm/abstract/modular.js
|
|
18157
|
-
var
|
|
18158
|
-
var
|
|
18159
|
-
var
|
|
18496
|
+
var _0n8 = BigInt(0);
|
|
18497
|
+
var _1n8 = BigInt(1);
|
|
18498
|
+
var _2n7 = BigInt(2);
|
|
18160
18499
|
var _3n3 = BigInt(3);
|
|
18161
18500
|
var _4n3 = BigInt(4);
|
|
18162
18501
|
var _5n2 = BigInt(5);
|
|
@@ -18165,38 +18504,38 @@ var starknet = (() => {
|
|
|
18165
18504
|
var _16n2 = BigInt(16);
|
|
18166
18505
|
function mod2(a, b) {
|
|
18167
18506
|
const result = a % b;
|
|
18168
|
-
return result >=
|
|
18507
|
+
return result >= _0n8 ? result : b + result;
|
|
18169
18508
|
}
|
|
18170
18509
|
function pow2(num, power, modulo) {
|
|
18171
|
-
if (modulo <=
|
|
18510
|
+
if (modulo <= _0n8 || power < _0n8)
|
|
18172
18511
|
throw new Error("Expected power/modulo > 0");
|
|
18173
|
-
if (modulo ===
|
|
18174
|
-
return
|
|
18175
|
-
let res =
|
|
18176
|
-
while (power >
|
|
18177
|
-
if (power &
|
|
18512
|
+
if (modulo === _1n8)
|
|
18513
|
+
return _0n8;
|
|
18514
|
+
let res = _1n8;
|
|
18515
|
+
while (power > _0n8) {
|
|
18516
|
+
if (power & _1n8)
|
|
18178
18517
|
res = res * num % modulo;
|
|
18179
18518
|
num = num * num % modulo;
|
|
18180
|
-
power >>=
|
|
18519
|
+
power >>= _1n8;
|
|
18181
18520
|
}
|
|
18182
18521
|
return res;
|
|
18183
18522
|
}
|
|
18184
18523
|
function pow22(x, power, modulo) {
|
|
18185
18524
|
let res = x;
|
|
18186
|
-
while (power-- >
|
|
18525
|
+
while (power-- > _0n8) {
|
|
18187
18526
|
res *= res;
|
|
18188
18527
|
res %= modulo;
|
|
18189
18528
|
}
|
|
18190
18529
|
return res;
|
|
18191
18530
|
}
|
|
18192
18531
|
function invert2(number4, modulo) {
|
|
18193
|
-
if (number4 ===
|
|
18532
|
+
if (number4 === _0n8 || modulo <= _0n8) {
|
|
18194
18533
|
throw new Error(`invert: expected positive integers, got n=${number4} mod=${modulo}`);
|
|
18195
18534
|
}
|
|
18196
18535
|
let a = mod2(number4, modulo);
|
|
18197
18536
|
let b = modulo;
|
|
18198
|
-
let x =
|
|
18199
|
-
while (a !==
|
|
18537
|
+
let x = _0n8, y = _1n8, u = _1n8, v = _0n8;
|
|
18538
|
+
while (a !== _0n8) {
|
|
18200
18539
|
const q = b / a;
|
|
18201
18540
|
const r = b % a;
|
|
18202
18541
|
const m = x - u * q;
|
|
@@ -18204,19 +18543,19 @@ var starknet = (() => {
|
|
|
18204
18543
|
b = a, a = r, x = u, y = v, u = m, v = n;
|
|
18205
18544
|
}
|
|
18206
18545
|
const gcd2 = b;
|
|
18207
|
-
if (gcd2 !==
|
|
18546
|
+
if (gcd2 !== _1n8)
|
|
18208
18547
|
throw new Error("invert: does not exist");
|
|
18209
18548
|
return mod2(x, modulo);
|
|
18210
18549
|
}
|
|
18211
18550
|
function tonelliShanks2(P) {
|
|
18212
|
-
const legendreC = (P -
|
|
18551
|
+
const legendreC = (P - _1n8) / _2n7;
|
|
18213
18552
|
let Q, S, Z;
|
|
18214
|
-
for (Q = P -
|
|
18553
|
+
for (Q = P - _1n8, S = 0; Q % _2n7 === _0n8; Q /= _2n7, S++)
|
|
18215
18554
|
;
|
|
18216
|
-
for (Z =
|
|
18555
|
+
for (Z = _2n7; Z < P && pow2(Z, legendreC, P) !== P - _1n8; Z++)
|
|
18217
18556
|
;
|
|
18218
18557
|
if (S === 1) {
|
|
18219
|
-
const p1div4 = (P +
|
|
18558
|
+
const p1div4 = (P + _1n8) / _4n3;
|
|
18220
18559
|
return function tonelliFast(Fp2, n) {
|
|
18221
18560
|
const root = Fp2.pow(n, p1div4);
|
|
18222
18561
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
|
@@ -18224,7 +18563,7 @@ var starknet = (() => {
|
|
|
18224
18563
|
return root;
|
|
18225
18564
|
};
|
|
18226
18565
|
}
|
|
18227
|
-
const Q1div2 = (Q +
|
|
18566
|
+
const Q1div2 = (Q + _1n8) / _2n7;
|
|
18228
18567
|
return function tonelliSlow(Fp2, n) {
|
|
18229
18568
|
if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
|
|
18230
18569
|
throw new Error("Cannot find square root");
|
|
@@ -18241,7 +18580,7 @@ var starknet = (() => {
|
|
|
18241
18580
|
break;
|
|
18242
18581
|
t2 = Fp2.sqr(t2);
|
|
18243
18582
|
}
|
|
18244
|
-
const ge = Fp2.pow(g2,
|
|
18583
|
+
const ge = Fp2.pow(g2, _1n8 << BigInt(r - m - 1));
|
|
18245
18584
|
g2 = Fp2.sqr(ge);
|
|
18246
18585
|
x = Fp2.mul(x, ge);
|
|
18247
18586
|
b = Fp2.mul(b, g2);
|
|
@@ -18252,7 +18591,7 @@ var starknet = (() => {
|
|
|
18252
18591
|
}
|
|
18253
18592
|
function FpSqrt2(P) {
|
|
18254
18593
|
if (P % _4n3 === _3n3) {
|
|
18255
|
-
const p1div4 = (P +
|
|
18594
|
+
const p1div4 = (P + _1n8) / _4n3;
|
|
18256
18595
|
return function sqrt3mod4(Fp2, n) {
|
|
18257
18596
|
const root = Fp2.pow(n, p1div4);
|
|
18258
18597
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
|
@@ -18263,10 +18602,10 @@ var starknet = (() => {
|
|
|
18263
18602
|
if (P % _8n2 === _5n2) {
|
|
18264
18603
|
const c1 = (P - _5n2) / _8n2;
|
|
18265
18604
|
return function sqrt5mod8(Fp2, n) {
|
|
18266
|
-
const n2 = Fp2.mul(n,
|
|
18605
|
+
const n2 = Fp2.mul(n, _2n7);
|
|
18267
18606
|
const v = Fp2.pow(n2, c1);
|
|
18268
18607
|
const nv = Fp2.mul(n, v);
|
|
18269
|
-
const i = Fp2.mul(Fp2.mul(nv,
|
|
18608
|
+
const i = Fp2.mul(Fp2.mul(nv, _2n7), v);
|
|
18270
18609
|
const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
|
|
18271
18610
|
if (!Fp2.eql(Fp2.sqr(root), n))
|
|
18272
18611
|
throw new Error("Cannot find square root");
|
|
@@ -18310,19 +18649,19 @@ var starknet = (() => {
|
|
|
18310
18649
|
return validateObject(field, opts);
|
|
18311
18650
|
}
|
|
18312
18651
|
function FpPow2(f, num, power) {
|
|
18313
|
-
if (power <
|
|
18652
|
+
if (power < _0n8)
|
|
18314
18653
|
throw new Error("Expected power > 0");
|
|
18315
|
-
if (power ===
|
|
18654
|
+
if (power === _0n8)
|
|
18316
18655
|
return f.ONE;
|
|
18317
|
-
if (power ===
|
|
18656
|
+
if (power === _1n8)
|
|
18318
18657
|
return num;
|
|
18319
18658
|
let p = f.ONE;
|
|
18320
18659
|
let d = num;
|
|
18321
|
-
while (power >
|
|
18322
|
-
if (power &
|
|
18660
|
+
while (power > _0n8) {
|
|
18661
|
+
if (power & _1n8)
|
|
18323
18662
|
p = f.mul(p, d);
|
|
18324
18663
|
d = f.sqr(d);
|
|
18325
|
-
power >>=
|
|
18664
|
+
power >>= _1n8;
|
|
18326
18665
|
}
|
|
18327
18666
|
return p;
|
|
18328
18667
|
}
|
|
@@ -18349,7 +18688,7 @@ var starknet = (() => {
|
|
|
18349
18688
|
return { nBitLength: _nBitLength, nByteLength };
|
|
18350
18689
|
}
|
|
18351
18690
|
function Field2(ORDER, bitLen3, isLE3 = false, redef = {}) {
|
|
18352
|
-
if (ORDER <=
|
|
18691
|
+
if (ORDER <= _0n8)
|
|
18353
18692
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
|
18354
18693
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength2(ORDER, bitLen3);
|
|
18355
18694
|
if (BYTES > 2048)
|
|
@@ -18360,16 +18699,16 @@ var starknet = (() => {
|
|
|
18360
18699
|
BITS,
|
|
18361
18700
|
BYTES,
|
|
18362
18701
|
MASK: bitMask(BITS),
|
|
18363
|
-
ZERO:
|
|
18364
|
-
ONE:
|
|
18702
|
+
ZERO: _0n8,
|
|
18703
|
+
ONE: _1n8,
|
|
18365
18704
|
create: (num) => mod2(num, ORDER),
|
|
18366
18705
|
isValid: (num) => {
|
|
18367
18706
|
if (typeof num !== "bigint")
|
|
18368
18707
|
throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
|
|
18369
|
-
return
|
|
18708
|
+
return _0n8 <= num && num < ORDER;
|
|
18370
18709
|
},
|
|
18371
|
-
is0: (num) => num ===
|
|
18372
|
-
isOdd: (num) => (num &
|
|
18710
|
+
is0: (num) => num === _0n8,
|
|
18711
|
+
isOdd: (num) => (num & _1n8) === _1n8,
|
|
18373
18712
|
neg: (num) => mod2(-num, ORDER),
|
|
18374
18713
|
eql: (lhs, rhs) => lhs === rhs,
|
|
18375
18714
|
sqr: (num) => mod2(num * num, ORDER),
|
|
@@ -18415,7 +18754,7 @@ var starknet = (() => {
|
|
|
18415
18754
|
if (len < 16 || len < minLen || len > 1024)
|
|
18416
18755
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
|
18417
18756
|
const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
|
18418
|
-
const reduced = mod2(num, fieldOrder -
|
|
18757
|
+
const reduced = mod2(num, fieldOrder - _1n8) + _1n8;
|
|
18419
18758
|
return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
|
18420
18759
|
}
|
|
18421
18760
|
|
|
@@ -18531,7 +18870,7 @@ var starknet = (() => {
|
|
|
18531
18870
|
// src/utils/ec.ts
|
|
18532
18871
|
var ec_exports = {};
|
|
18533
18872
|
__export(ec_exports, {
|
|
18534
|
-
starkCurve: () =>
|
|
18873
|
+
starkCurve: () => esm_exports2,
|
|
18535
18874
|
weierstrass: () => weierstrass_exports
|
|
18536
18875
|
});
|
|
18537
18876
|
|
|
@@ -18546,8 +18885,8 @@ var starknet = (() => {
|
|
|
18546
18885
|
});
|
|
18547
18886
|
|
|
18548
18887
|
// node_modules/@noble/curves/esm/abstract/curve.js
|
|
18549
|
-
var
|
|
18550
|
-
var
|
|
18888
|
+
var _0n9 = BigInt(0);
|
|
18889
|
+
var _1n9 = BigInt(1);
|
|
18551
18890
|
function wNAF2(c, bits) {
|
|
18552
18891
|
const constTimeNegate = (condition, item) => {
|
|
18553
18892
|
const neg = item.negate();
|
|
@@ -18564,11 +18903,11 @@ var starknet = (() => {
|
|
|
18564
18903
|
unsafeLadder(elm, n) {
|
|
18565
18904
|
let p = c.ZERO;
|
|
18566
18905
|
let d = elm;
|
|
18567
|
-
while (n >
|
|
18568
|
-
if (n &
|
|
18906
|
+
while (n > _0n9) {
|
|
18907
|
+
if (n & _1n9)
|
|
18569
18908
|
p = p.add(d);
|
|
18570
18909
|
d = d.double();
|
|
18571
|
-
n >>=
|
|
18910
|
+
n >>= _1n9;
|
|
18572
18911
|
}
|
|
18573
18912
|
return p;
|
|
18574
18913
|
},
|
|
@@ -18618,7 +18957,7 @@ var starknet = (() => {
|
|
|
18618
18957
|
n >>= shiftBy;
|
|
18619
18958
|
if (wbits > windowSize) {
|
|
18620
18959
|
wbits -= maxNumber;
|
|
18621
|
-
n +=
|
|
18960
|
+
n += _1n9;
|
|
18622
18961
|
}
|
|
18623
18962
|
const offset1 = offset;
|
|
18624
18963
|
const offset2 = offset + Math.abs(wbits) - 1;
|
|
@@ -18741,9 +19080,9 @@ var starknet = (() => {
|
|
|
18741
19080
|
return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
|
|
18742
19081
|
}
|
|
18743
19082
|
};
|
|
18744
|
-
var
|
|
18745
|
-
var
|
|
18746
|
-
var
|
|
19083
|
+
var _0n10 = BigInt(0);
|
|
19084
|
+
var _1n10 = BigInt(1);
|
|
19085
|
+
var _2n8 = BigInt(2);
|
|
18747
19086
|
var _3n4 = BigInt(3);
|
|
18748
19087
|
var _4n4 = BigInt(4);
|
|
18749
19088
|
function weierstrassPoints2(opts) {
|
|
@@ -18768,7 +19107,7 @@ var starknet = (() => {
|
|
|
18768
19107
|
if (!Fp2.eql(Fp2.sqr(CURVE2.Gy), weierstrassEquation(CURVE2.Gx)))
|
|
18769
19108
|
throw new Error("bad generator point: equation left != right");
|
|
18770
19109
|
function isWithinCurveOrder(num) {
|
|
18771
|
-
return typeof num === "bigint" &&
|
|
19110
|
+
return typeof num === "bigint" && _0n10 < num && num < CURVE2.n;
|
|
18772
19111
|
}
|
|
18773
19112
|
function assertGE(num) {
|
|
18774
19113
|
if (!isWithinCurveOrder(num))
|
|
@@ -19012,10 +19351,10 @@ var starknet = (() => {
|
|
|
19012
19351
|
*/
|
|
19013
19352
|
multiplyUnsafe(n) {
|
|
19014
19353
|
const I = Point2.ZERO;
|
|
19015
|
-
if (n ===
|
|
19354
|
+
if (n === _0n10)
|
|
19016
19355
|
return I;
|
|
19017
19356
|
assertGE(n);
|
|
19018
|
-
if (n ===
|
|
19357
|
+
if (n === _1n10)
|
|
19019
19358
|
return this;
|
|
19020
19359
|
const { endo } = CURVE2;
|
|
19021
19360
|
if (!endo)
|
|
@@ -19024,14 +19363,14 @@ var starknet = (() => {
|
|
|
19024
19363
|
let k1p = I;
|
|
19025
19364
|
let k2p = I;
|
|
19026
19365
|
let d = this;
|
|
19027
|
-
while (k1 >
|
|
19028
|
-
if (k1 &
|
|
19366
|
+
while (k1 > _0n10 || k2 > _0n10) {
|
|
19367
|
+
if (k1 & _1n10)
|
|
19029
19368
|
k1p = k1p.add(d);
|
|
19030
|
-
if (k2 &
|
|
19369
|
+
if (k2 & _1n10)
|
|
19031
19370
|
k2p = k2p.add(d);
|
|
19032
19371
|
d = d.double();
|
|
19033
|
-
k1 >>=
|
|
19034
|
-
k2 >>=
|
|
19372
|
+
k1 >>= _1n10;
|
|
19373
|
+
k2 >>= _1n10;
|
|
19035
19374
|
}
|
|
19036
19375
|
if (k1neg)
|
|
19037
19376
|
k1p = k1p.negate();
|
|
@@ -19078,7 +19417,7 @@ var starknet = (() => {
|
|
|
19078
19417
|
*/
|
|
19079
19418
|
multiplyAndAddUnsafe(Q, a, b) {
|
|
19080
19419
|
const G = Point2.BASE;
|
|
19081
|
-
const mul = (P, a2) => a2 ===
|
|
19420
|
+
const mul = (P, a2) => a2 === _0n10 || a2 === _1n10 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
|
|
19082
19421
|
const sum = mul(this, a).add(mul(Q, b));
|
|
19083
19422
|
return sum.is0() ? void 0 : sum;
|
|
19084
19423
|
}
|
|
@@ -19101,7 +19440,7 @@ var starknet = (() => {
|
|
|
19101
19440
|
}
|
|
19102
19441
|
isTorsionFree() {
|
|
19103
19442
|
const { h: cofactor, isTorsionFree } = CURVE2;
|
|
19104
|
-
if (cofactor ===
|
|
19443
|
+
if (cofactor === _1n10)
|
|
19105
19444
|
return true;
|
|
19106
19445
|
if (isTorsionFree)
|
|
19107
19446
|
return isTorsionFree(Point2, this);
|
|
@@ -19109,7 +19448,7 @@ var starknet = (() => {
|
|
|
19109
19448
|
}
|
|
19110
19449
|
clearCofactor() {
|
|
19111
19450
|
const { h: cofactor, clearCofactor } = CURVE2;
|
|
19112
|
-
if (cofactor ===
|
|
19451
|
+
if (cofactor === _1n10)
|
|
19113
19452
|
return this;
|
|
19114
19453
|
if (clearCofactor)
|
|
19115
19454
|
return clearCofactor(Point2, this);
|
|
@@ -19154,7 +19493,7 @@ var starknet = (() => {
|
|
|
19154
19493
|
const compressedLen = Fp2.BYTES + 1;
|
|
19155
19494
|
const uncompressedLen = 2 * Fp2.BYTES + 1;
|
|
19156
19495
|
function isValidFieldElement(num) {
|
|
19157
|
-
return
|
|
19496
|
+
return _0n10 < num && num < Fp2.ORDER;
|
|
19158
19497
|
}
|
|
19159
19498
|
function modN(a) {
|
|
19160
19499
|
return mod2(a, CURVE_ORDER2);
|
|
@@ -19190,7 +19529,7 @@ var starknet = (() => {
|
|
|
19190
19529
|
const suffix = sqrtError instanceof Error ? ": " + sqrtError.message : "";
|
|
19191
19530
|
throw new Error("Point is not on curve" + suffix);
|
|
19192
19531
|
}
|
|
19193
|
-
const isYOdd = (y &
|
|
19532
|
+
const isYOdd = (y & _1n10) === _1n10;
|
|
19194
19533
|
const isHeadOdd = (head & 1) === 1;
|
|
19195
19534
|
if (isHeadOdd !== isYOdd)
|
|
19196
19535
|
y = Fp2.neg(y);
|
|
@@ -19206,7 +19545,7 @@ var starknet = (() => {
|
|
|
19206
19545
|
});
|
|
19207
19546
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE2.nByteLength));
|
|
19208
19547
|
function isBiggerThanHalfOrder(number4) {
|
|
19209
|
-
const HALF = CURVE_ORDER2 >>
|
|
19548
|
+
const HALF = CURVE_ORDER2 >> _1n10;
|
|
19210
19549
|
return number4 > HALF;
|
|
19211
19550
|
}
|
|
19212
19551
|
function normalizeS(s) {
|
|
@@ -19349,7 +19688,7 @@ var starknet = (() => {
|
|
|
19349
19688
|
function int2octets(num) {
|
|
19350
19689
|
if (typeof num !== "bigint")
|
|
19351
19690
|
throw new Error("bigint expected");
|
|
19352
|
-
if (!(
|
|
19691
|
+
if (!(_0n10 <= num && num < ORDER_MASK))
|
|
19353
19692
|
throw new Error(`bigint expected < 2^${CURVE2.nBitLength}`);
|
|
19354
19693
|
return numberToBytesBE(num, CURVE2.nByteLength);
|
|
19355
19694
|
}
|
|
@@ -19379,12 +19718,12 @@ var starknet = (() => {
|
|
|
19379
19718
|
const ik = invN(k);
|
|
19380
19719
|
const q = Point2.BASE.multiply(k).toAffine();
|
|
19381
19720
|
const r = modN(q.x);
|
|
19382
|
-
if (r ===
|
|
19721
|
+
if (r === _0n10)
|
|
19383
19722
|
return;
|
|
19384
19723
|
const s = modN(ik * modN(m + r * d));
|
|
19385
|
-
if (s ===
|
|
19724
|
+
if (s === _0n10)
|
|
19386
19725
|
return;
|
|
19387
|
-
let recovery = (q.x === r ? 0 : 2) | Number(q.y &
|
|
19726
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n10);
|
|
19388
19727
|
let normS = s;
|
|
19389
19728
|
if (lowS && isBiggerThanHalfOrder(s)) {
|
|
19390
19729
|
normS = normalizeS(s);
|
|
@@ -19461,18 +19800,18 @@ var starknet = (() => {
|
|
|
19461
19800
|
}
|
|
19462
19801
|
function SWUFpSqrtRatio(Fp2, Z) {
|
|
19463
19802
|
const q = Fp2.ORDER;
|
|
19464
|
-
let l =
|
|
19465
|
-
for (let o = q -
|
|
19466
|
-
l +=
|
|
19803
|
+
let l = _0n10;
|
|
19804
|
+
for (let o = q - _1n10; o % _2n8 === _0n10; o /= _2n8)
|
|
19805
|
+
l += _1n10;
|
|
19467
19806
|
const c1 = l;
|
|
19468
|
-
const _2n_pow_c1_1 =
|
|
19469
|
-
const _2n_pow_c1 = _2n_pow_c1_1 *
|
|
19470
|
-
const c2 = (q -
|
|
19471
|
-
const c3 = (c2 -
|
|
19472
|
-
const c4 = _2n_pow_c1 -
|
|
19807
|
+
const _2n_pow_c1_1 = _2n8 << c1 - _1n10 - _1n10;
|
|
19808
|
+
const _2n_pow_c1 = _2n_pow_c1_1 * _2n8;
|
|
19809
|
+
const c2 = (q - _1n10) / _2n_pow_c1;
|
|
19810
|
+
const c3 = (c2 - _1n10) / _2n8;
|
|
19811
|
+
const c4 = _2n_pow_c1 - _1n10;
|
|
19473
19812
|
const c5 = _2n_pow_c1_1;
|
|
19474
19813
|
const c6 = Fp2.pow(Z, c2);
|
|
19475
|
-
const c7 = Fp2.pow(Z, (c2 +
|
|
19814
|
+
const c7 = Fp2.pow(Z, (c2 + _1n10) / _2n8);
|
|
19476
19815
|
let sqrtRatio = (u, v) => {
|
|
19477
19816
|
let tv1 = c6;
|
|
19478
19817
|
let tv2 = Fp2.pow(v, c4);
|
|
@@ -19490,9 +19829,9 @@ var starknet = (() => {
|
|
|
19490
19829
|
tv5 = Fp2.mul(tv4, tv1);
|
|
19491
19830
|
tv3 = Fp2.cmov(tv2, tv3, isQR);
|
|
19492
19831
|
tv4 = Fp2.cmov(tv5, tv4, isQR);
|
|
19493
|
-
for (let i = c1; i >
|
|
19494
|
-
let tv52 = i -
|
|
19495
|
-
tv52 =
|
|
19832
|
+
for (let i = c1; i > _1n10; i--) {
|
|
19833
|
+
let tv52 = i - _2n8;
|
|
19834
|
+
tv52 = _2n8 << tv52 - _1n10;
|
|
19496
19835
|
let tvv5 = Fp2.pow(tv4, tv52);
|
|
19497
19836
|
const e1 = Fp2.eql(tvv5, Fp2.ONE);
|
|
19498
19837
|
tv2 = Fp2.mul(tv3, tv1);
|
|
@@ -19561,7 +19900,7 @@ var starknet = (() => {
|
|
|
19561
19900
|
|
|
19562
19901
|
// src/utils/hash/transactionHash/v2.ts
|
|
19563
19902
|
function computeHashOnElements2(data) {
|
|
19564
|
-
return [...data, data.length].reduce((x, y) =>
|
|
19903
|
+
return [...data, data.length].reduce((x, y) => esm_exports2.pedersen(toBigInt(x), toBigInt(y)), 0).toString();
|
|
19565
19904
|
}
|
|
19566
19905
|
function calculateTransactionHashCommon(txHashPrefix, version, contractAddress, entryPointSelector, calldata, maxFee, chainId, additionalData = []) {
|
|
19567
19906
|
const calldataHash = computeHashOnElements2(calldata);
|
|
@@ -19704,7 +20043,7 @@ var starknet = (() => {
|
|
|
19704
20043
|
|
|
19705
20044
|
// src/utils/hash/transactionHash/index.ts
|
|
19706
20045
|
function isV3InvokeTx(args) {
|
|
19707
|
-
return [
|
|
20046
|
+
return [ETransactionVersion4.V3, ETransactionVersion4.F3].includes(
|
|
19708
20047
|
args.version
|
|
19709
20048
|
);
|
|
19710
20049
|
}
|
|
@@ -19734,7 +20073,7 @@ var starknet = (() => {
|
|
|
19734
20073
|
);
|
|
19735
20074
|
}
|
|
19736
20075
|
function isV3DeclareTx(args) {
|
|
19737
|
-
return [
|
|
20076
|
+
return [ETransactionVersion4.V3, ETransactionVersion4.F3].includes(
|
|
19738
20077
|
args.version
|
|
19739
20078
|
);
|
|
19740
20079
|
}
|
|
@@ -19766,7 +20105,7 @@ var starknet = (() => {
|
|
|
19766
20105
|
);
|
|
19767
20106
|
}
|
|
19768
20107
|
function isV3DeployAccountTx(args) {
|
|
19769
|
-
return [
|
|
20108
|
+
return [ETransactionVersion4.V3, ETransactionVersion4.F3].includes(
|
|
19770
20109
|
args.version
|
|
19771
20110
|
);
|
|
19772
20111
|
}
|
|
@@ -20363,13 +20702,13 @@ var starknet = (() => {
|
|
|
20363
20702
|
|
|
20364
20703
|
// src/utils/hash/classHash.ts
|
|
20365
20704
|
function computePedersenHash(a, b) {
|
|
20366
|
-
return
|
|
20705
|
+
return esm_exports2.pedersen(BigInt(a), BigInt(b));
|
|
20367
20706
|
}
|
|
20368
20707
|
function computePoseidonHash(a, b) {
|
|
20369
|
-
return toHex(
|
|
20708
|
+
return toHex(esm_exports2.poseidonHash(BigInt(a), BigInt(b)));
|
|
20370
20709
|
}
|
|
20371
20710
|
function computeHashOnElements3(data) {
|
|
20372
|
-
return [...data, data.length].reduce((x, y) =>
|
|
20711
|
+
return [...data, data.length].reduce((x, y) => esm_exports2.pedersen(BigInt(x), BigInt(y)), 0).toString();
|
|
20373
20712
|
}
|
|
20374
20713
|
var computePedersenHashOnElements = computeHashOnElements3;
|
|
20375
20714
|
function computePoseidonHashOnElements(data) {
|
|
@@ -20416,7 +20755,7 @@ var starknet = (() => {
|
|
|
20416
20755
|
const { abi, program } = compiledContract;
|
|
20417
20756
|
const contractClass = { abi, program };
|
|
20418
20757
|
const serializedJson = formatSpaces(stringify2(contractClass, nullSkipReplacer));
|
|
20419
|
-
return addHexPrefix(
|
|
20758
|
+
return addHexPrefix(esm_exports2.keccak(utf8ToArray(serializedJson)).toString(16));
|
|
20420
20759
|
}
|
|
20421
20760
|
function computeLegacyContractClassHash(contract) {
|
|
20422
20761
|
const compiledContract = isString(contract) ? parse2(contract) : contract;
|
|
@@ -20493,7 +20832,7 @@ var starknet = (() => {
|
|
|
20493
20832
|
}
|
|
20494
20833
|
function hashAbi(sierra) {
|
|
20495
20834
|
const indentString = formatSpaces(stringify2(sierra.abi, null));
|
|
20496
|
-
return BigInt(addHexPrefix(
|
|
20835
|
+
return BigInt(addHexPrefix(esm_exports2.keccak(utf8ToArray(indentString)).toString(16)));
|
|
20497
20836
|
}
|
|
20498
20837
|
function computeSierraContractClassHash(sierra) {
|
|
20499
20838
|
const CONTRACT_CLASS_VERSION = "CONTRACT_CLASS_V0.1.0";
|
|
@@ -24763,10 +25102,10 @@ var starknet = (() => {
|
|
|
24763
25102
|
};
|
|
24764
25103
|
}
|
|
24765
25104
|
function intDAM(dam) {
|
|
24766
|
-
if (dam ===
|
|
24767
|
-
return
|
|
24768
|
-
if (dam ===
|
|
24769
|
-
return
|
|
25105
|
+
if (dam === EDataAvailabilityMode2.L1)
|
|
25106
|
+
return EDAMode2.L1;
|
|
25107
|
+
if (dam === EDataAvailabilityMode2.L2)
|
|
25108
|
+
return EDAMode2.L2;
|
|
24770
25109
|
throw Error("EDAM conversion");
|
|
24771
25110
|
}
|
|
24772
25111
|
function toTransactionVersion(defaultVersion, providedVersion) {
|
|
@@ -24784,14 +25123,14 @@ var starknet = (() => {
|
|
|
24784
25123
|
if (!providedVersion)
|
|
24785
25124
|
return void 0;
|
|
24786
25125
|
const version = toHex(providedVersion);
|
|
24787
|
-
if (version ===
|
|
24788
|
-
return
|
|
24789
|
-
if (version ===
|
|
24790
|
-
return
|
|
24791
|
-
if (version ===
|
|
24792
|
-
return
|
|
24793
|
-
if (version ===
|
|
24794
|
-
return
|
|
25126
|
+
if (version === ETransactionVersion4.V0)
|
|
25127
|
+
return ETransactionVersion4.F0;
|
|
25128
|
+
if (version === ETransactionVersion4.V1)
|
|
25129
|
+
return ETransactionVersion4.F1;
|
|
25130
|
+
if (version === ETransactionVersion4.V2)
|
|
25131
|
+
return ETransactionVersion4.F2;
|
|
25132
|
+
if (version === ETransactionVersion4.V3)
|
|
25133
|
+
return ETransactionVersion4.F3;
|
|
24795
25134
|
throw Error(`toFeeVersion: ${version} is not supported`);
|
|
24796
25135
|
}
|
|
24797
25136
|
function v3Details(details) {
|
|
@@ -24799,16 +25138,16 @@ var starknet = (() => {
|
|
|
24799
25138
|
tip: details.tip || 0,
|
|
24800
25139
|
paymasterData: details.paymasterData || [],
|
|
24801
25140
|
accountDeploymentData: details.accountDeploymentData || [],
|
|
24802
|
-
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode ||
|
|
24803
|
-
feeDataAvailabilityMode: details.feeDataAvailabilityMode ||
|
|
25141
|
+
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode || EDataAvailabilityMode2.L1,
|
|
25142
|
+
feeDataAvailabilityMode: details.feeDataAvailabilityMode || EDataAvailabilityMode2.L1,
|
|
24804
25143
|
resourceBounds: details.resourceBounds ?? estimateFeeToBounds(ZERO)
|
|
24805
25144
|
};
|
|
24806
25145
|
}
|
|
24807
25146
|
function reduceV2(providedVersion) {
|
|
24808
|
-
if (providedVersion ===
|
|
24809
|
-
return
|
|
24810
|
-
if (providedVersion ===
|
|
24811
|
-
return
|
|
25147
|
+
if (providedVersion === ETransactionVersion4.F2)
|
|
25148
|
+
return ETransactionVersion4.F1;
|
|
25149
|
+
if (providedVersion === ETransactionVersion4.V2)
|
|
25150
|
+
return ETransactionVersion4.V1;
|
|
24812
25151
|
return providedVersion;
|
|
24813
25152
|
}
|
|
24814
25153
|
|
|
@@ -24848,102 +25187,13 @@ var starknet = (() => {
|
|
|
24848
25187
|
validateAndParseEthAddress: () => validateAndParseEthAddress
|
|
24849
25188
|
});
|
|
24850
25189
|
|
|
24851
|
-
// node_modules/@noble/
|
|
24852
|
-
function number2(n) {
|
|
24853
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
24854
|
-
throw new Error(`positive integer expected, not ${n}`);
|
|
24855
|
-
}
|
|
24856
|
-
function isBytes6(a) {
|
|
24857
|
-
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
24858
|
-
}
|
|
24859
|
-
function bytes2(b, ...lengths) {
|
|
24860
|
-
if (!isBytes6(b))
|
|
24861
|
-
throw new Error("Uint8Array expected");
|
|
24862
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
24863
|
-
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
|
24864
|
-
}
|
|
24865
|
-
function hash2(h) {
|
|
24866
|
-
if (typeof h !== "function" || typeof h.create !== "function")
|
|
24867
|
-
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
24868
|
-
number2(h.outputLen);
|
|
24869
|
-
number2(h.blockLen);
|
|
24870
|
-
}
|
|
24871
|
-
function exists2(instance, checkFinished = true) {
|
|
24872
|
-
if (instance.destroyed)
|
|
24873
|
-
throw new Error("Hash instance has been destroyed");
|
|
24874
|
-
if (checkFinished && instance.finished)
|
|
24875
|
-
throw new Error("Hash#digest() has already been called");
|
|
24876
|
-
}
|
|
24877
|
-
function output2(out, instance) {
|
|
24878
|
-
bytes2(out);
|
|
24879
|
-
const min = instance.outputLen;
|
|
24880
|
-
if (out.length < min) {
|
|
24881
|
-
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
24882
|
-
}
|
|
24883
|
-
}
|
|
24884
|
-
|
|
24885
|
-
// node_modules/@noble/curves/node_modules/@noble/hashes/esm/crypto.js
|
|
24886
|
-
var crypto2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
24887
|
-
|
|
24888
|
-
// node_modules/@noble/curves/node_modules/@noble/hashes/esm/utils.js
|
|
24889
|
-
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
24890
|
-
var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
|
|
24891
|
-
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
24892
|
-
function utf8ToBytes4(str) {
|
|
24893
|
-
if (typeof str !== "string")
|
|
24894
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
24895
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
|
24896
|
-
}
|
|
24897
|
-
function toBytes2(data) {
|
|
24898
|
-
if (typeof data === "string")
|
|
24899
|
-
data = utf8ToBytes4(data);
|
|
24900
|
-
bytes2(data);
|
|
24901
|
-
return data;
|
|
24902
|
-
}
|
|
24903
|
-
function concatBytes4(...arrays) {
|
|
24904
|
-
let sum = 0;
|
|
24905
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
24906
|
-
const a = arrays[i];
|
|
24907
|
-
bytes2(a);
|
|
24908
|
-
sum += a.length;
|
|
24909
|
-
}
|
|
24910
|
-
const res = new Uint8Array(sum);
|
|
24911
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
24912
|
-
const a = arrays[i];
|
|
24913
|
-
res.set(a, pad);
|
|
24914
|
-
pad += a.length;
|
|
24915
|
-
}
|
|
24916
|
-
return res;
|
|
24917
|
-
}
|
|
24918
|
-
var Hash2 = class {
|
|
24919
|
-
// Safe version that clones internal state
|
|
24920
|
-
clone() {
|
|
24921
|
-
return this._cloneInto();
|
|
24922
|
-
}
|
|
24923
|
-
};
|
|
24924
|
-
var toStr2 = {}.toString;
|
|
24925
|
-
function wrapConstructor2(hashCons) {
|
|
24926
|
-
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
|
|
24927
|
-
const tmp = hashCons();
|
|
24928
|
-
hashC.outputLen = tmp.outputLen;
|
|
24929
|
-
hashC.blockLen = tmp.blockLen;
|
|
24930
|
-
hashC.create = () => hashCons();
|
|
24931
|
-
return hashC;
|
|
24932
|
-
}
|
|
24933
|
-
function randomBytes2(bytesLength = 32) {
|
|
24934
|
-
if (crypto2 && typeof crypto2.getRandomValues === "function") {
|
|
24935
|
-
return crypto2.getRandomValues(new Uint8Array(bytesLength));
|
|
24936
|
-
}
|
|
24937
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
24938
|
-
}
|
|
24939
|
-
|
|
24940
|
-
// node_modules/@noble/curves/node_modules/@noble/hashes/esm/_md.js
|
|
25190
|
+
// node_modules/@noble/hashes/esm/_md.js
|
|
24941
25191
|
function setBigUint642(view, byteOffset, value, isLE3) {
|
|
24942
25192
|
if (typeof view.setBigUint64 === "function")
|
|
24943
25193
|
return view.setBigUint64(byteOffset, value, isLE3);
|
|
24944
|
-
const
|
|
25194
|
+
const _32n3 = BigInt(32);
|
|
24945
25195
|
const _u32_max = BigInt(4294967295);
|
|
24946
|
-
const wh = Number(value >>
|
|
25196
|
+
const wh = Number(value >> _32n3 & _u32_max);
|
|
24947
25197
|
const wl = Number(value & _u32_max);
|
|
24948
25198
|
const h = isLE3 ? 4 : 0;
|
|
24949
25199
|
const l = isLE3 ? 0 : 4;
|
|
@@ -24952,7 +25202,7 @@ var starknet = (() => {
|
|
|
24952
25202
|
}
|
|
24953
25203
|
var Chi2 = (a, b, c) => a & b ^ ~a & c;
|
|
24954
25204
|
var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c;
|
|
24955
|
-
var HashMD = class extends
|
|
25205
|
+
var HashMD = class extends Hash {
|
|
24956
25206
|
constructor(blockLen, outputLen, padOffset, isLE3) {
|
|
24957
25207
|
super();
|
|
24958
25208
|
this.blockLen = blockLen;
|
|
@@ -24964,17 +25214,17 @@ var starknet = (() => {
|
|
|
24964
25214
|
this.pos = 0;
|
|
24965
25215
|
this.destroyed = false;
|
|
24966
25216
|
this.buffer = new Uint8Array(blockLen);
|
|
24967
|
-
this.view =
|
|
25217
|
+
this.view = createView(this.buffer);
|
|
24968
25218
|
}
|
|
24969
25219
|
update(data) {
|
|
24970
|
-
|
|
25220
|
+
exists(this);
|
|
24971
25221
|
const { view, buffer, blockLen } = this;
|
|
24972
|
-
data =
|
|
25222
|
+
data = toBytes(data);
|
|
24973
25223
|
const len = data.length;
|
|
24974
25224
|
for (let pos = 0; pos < len; ) {
|
|
24975
25225
|
const take = Math.min(blockLen - this.pos, len - pos);
|
|
24976
25226
|
if (take === blockLen) {
|
|
24977
|
-
const dataView =
|
|
25227
|
+
const dataView = createView(data);
|
|
24978
25228
|
for (; blockLen <= len - pos; pos += blockLen)
|
|
24979
25229
|
this.process(dataView, pos);
|
|
24980
25230
|
continue;
|
|
@@ -24992,8 +25242,8 @@ var starknet = (() => {
|
|
|
24992
25242
|
return this;
|
|
24993
25243
|
}
|
|
24994
25244
|
digestInto(out) {
|
|
24995
|
-
|
|
24996
|
-
|
|
25245
|
+
exists(this);
|
|
25246
|
+
output(out, this);
|
|
24997
25247
|
this.finished = true;
|
|
24998
25248
|
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
|
24999
25249
|
let { pos } = this;
|
|
@@ -25007,7 +25257,7 @@ var starknet = (() => {
|
|
|
25007
25257
|
buffer[i] = 0;
|
|
25008
25258
|
setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
|
25009
25259
|
this.process(view, 0);
|
|
25010
|
-
const oview =
|
|
25260
|
+
const oview = createView(out);
|
|
25011
25261
|
const len = this.outputLen;
|
|
25012
25262
|
if (len % 4)
|
|
25013
25263
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
@@ -25039,7 +25289,7 @@ var starknet = (() => {
|
|
|
25039
25289
|
}
|
|
25040
25290
|
};
|
|
25041
25291
|
|
|
25042
|
-
// node_modules/@noble/
|
|
25292
|
+
// node_modules/@noble/hashes/esm/sha256.js
|
|
25043
25293
|
var SHA256_K2 = /* @__PURE__ */ new Uint32Array([
|
|
25044
25294
|
1116352408,
|
|
25045
25295
|
1899447441,
|
|
@@ -25150,15 +25400,15 @@ var starknet = (() => {
|
|
|
25150
25400
|
for (let i = 16; i < 64; i++) {
|
|
25151
25401
|
const W15 = SHA256_W2[i - 15];
|
|
25152
25402
|
const W2 = SHA256_W2[i - 2];
|
|
25153
|
-
const s0 =
|
|
25154
|
-
const s1 =
|
|
25403
|
+
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
25404
|
+
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
25155
25405
|
SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
|
|
25156
25406
|
}
|
|
25157
25407
|
let { A, B, C, D, E, F, G, H } = this;
|
|
25158
25408
|
for (let i = 0; i < 64; i++) {
|
|
25159
|
-
const sigma1 =
|
|
25409
|
+
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
25160
25410
|
const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
|
|
25161
|
-
const sigma0 =
|
|
25411
|
+
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
25162
25412
|
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
|
25163
25413
|
H = G;
|
|
25164
25414
|
G = F;
|
|
@@ -25187,16 +25437,16 @@ var starknet = (() => {
|
|
|
25187
25437
|
this.buffer.fill(0);
|
|
25188
25438
|
}
|
|
25189
25439
|
};
|
|
25190
|
-
var sha2562 = /* @__PURE__ */
|
|
25440
|
+
var sha2562 = /* @__PURE__ */ wrapConstructor(() => new SHA2562());
|
|
25191
25441
|
|
|
25192
|
-
// node_modules/@noble/
|
|
25193
|
-
var HMAC2 = class extends
|
|
25442
|
+
// node_modules/@noble/hashes/esm/hmac.js
|
|
25443
|
+
var HMAC2 = class extends Hash {
|
|
25194
25444
|
constructor(hash3, _key) {
|
|
25195
25445
|
super();
|
|
25196
25446
|
this.finished = false;
|
|
25197
25447
|
this.destroyed = false;
|
|
25198
|
-
|
|
25199
|
-
const key =
|
|
25448
|
+
hash(hash3);
|
|
25449
|
+
const key = toBytes(_key);
|
|
25200
25450
|
this.iHash = hash3.create();
|
|
25201
25451
|
if (typeof this.iHash.update !== "function")
|
|
25202
25452
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
@@ -25215,13 +25465,13 @@ var starknet = (() => {
|
|
|
25215
25465
|
pad.fill(0);
|
|
25216
25466
|
}
|
|
25217
25467
|
update(buf) {
|
|
25218
|
-
|
|
25468
|
+
exists(this);
|
|
25219
25469
|
this.iHash.update(buf);
|
|
25220
25470
|
return this;
|
|
25221
25471
|
}
|
|
25222
25472
|
digestInto(out) {
|
|
25223
|
-
|
|
25224
|
-
|
|
25473
|
+
exists(this);
|
|
25474
|
+
bytes(out, this.outputLen);
|
|
25225
25475
|
this.finished = true;
|
|
25226
25476
|
this.iHash.digestInto(out);
|
|
25227
25477
|
this.oHash.update(out);
|
|
@@ -25258,8 +25508,8 @@ var starknet = (() => {
|
|
|
25258
25508
|
function getHash2(hash3) {
|
|
25259
25509
|
return {
|
|
25260
25510
|
hash: hash3,
|
|
25261
|
-
hmac: (key, ...msgs) => hmac2(hash3, key,
|
|
25262
|
-
randomBytes
|
|
25511
|
+
hmac: (key, ...msgs) => hmac2(hash3, key, concatBytes2(...msgs)),
|
|
25512
|
+
randomBytes
|
|
25263
25513
|
};
|
|
25264
25514
|
}
|
|
25265
25515
|
function createCurve(curveDef, defHash) {
|
|
@@ -25270,9 +25520,9 @@ var starknet = (() => {
|
|
|
25270
25520
|
// node_modules/@noble/curves/esm/secp256k1.js
|
|
25271
25521
|
var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
|
|
25272
25522
|
var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
|
25273
|
-
var
|
|
25274
|
-
var
|
|
25275
|
-
var divNearest = (a, b) => (a + b /
|
|
25523
|
+
var _1n11 = BigInt(1);
|
|
25524
|
+
var _2n9 = BigInt(2);
|
|
25525
|
+
var divNearest = (a, b) => (a + b / _2n9) / b;
|
|
25276
25526
|
function sqrtMod(y) {
|
|
25277
25527
|
const P = secp256k1P;
|
|
25278
25528
|
const _3n5 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
|
|
@@ -25281,7 +25531,7 @@ var starknet = (() => {
|
|
|
25281
25531
|
const b3 = b2 * b2 * y % P;
|
|
25282
25532
|
const b6 = pow22(b3, _3n5, P) * b3 % P;
|
|
25283
25533
|
const b9 = pow22(b6, _3n5, P) * b3 % P;
|
|
25284
|
-
const b11 = pow22(b9,
|
|
25534
|
+
const b11 = pow22(b9, _2n9, P) * b2 % P;
|
|
25285
25535
|
const b22 = pow22(b11, _11n, P) * b11 % P;
|
|
25286
25536
|
const b44 = pow22(b22, _22n, P) * b22 % P;
|
|
25287
25537
|
const b88 = pow22(b44, _44n, P) * b44 % P;
|
|
@@ -25290,7 +25540,7 @@ var starknet = (() => {
|
|
|
25290
25540
|
const b223 = pow22(b220, _3n5, P) * b3 % P;
|
|
25291
25541
|
const t1 = pow22(b223, _23n, P) * b22 % P;
|
|
25292
25542
|
const t2 = pow22(t1, _6n, P) * b2 % P;
|
|
25293
|
-
const root = pow22(t2,
|
|
25543
|
+
const root = pow22(t2, _2n9, P);
|
|
25294
25544
|
if (!Fp.eql(Fp.sqr(root), y))
|
|
25295
25545
|
throw new Error("Cannot find square root");
|
|
25296
25546
|
return root;
|
|
@@ -25323,7 +25573,7 @@ var starknet = (() => {
|
|
|
25323
25573
|
splitScalar: (k) => {
|
|
25324
25574
|
const n = secp256k1N;
|
|
25325
25575
|
const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
|
|
25326
|
-
const b1 = -
|
|
25576
|
+
const b1 = -_1n11 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
|
|
25327
25577
|
const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
|
|
25328
25578
|
const b2 = a1;
|
|
25329
25579
|
const POW_2_128 = BigInt("0x100000000000000000000000000000000");
|
|
@@ -25344,7 +25594,7 @@ var starknet = (() => {
|
|
|
25344
25594
|
}
|
|
25345
25595
|
}
|
|
25346
25596
|
}, sha2562);
|
|
25347
|
-
var
|
|
25597
|
+
var _0n11 = BigInt(0);
|
|
25348
25598
|
var Point = secp256k1.ProjectivePoint;
|
|
25349
25599
|
|
|
25350
25600
|
// src/utils/eth.ts
|
|
@@ -25354,7 +25604,7 @@ var starknet = (() => {
|
|
|
25354
25604
|
function validateAndParseEthAddress(address) {
|
|
25355
25605
|
assertInRange(address, ZERO, 2n ** 160n - 1n, "Ethereum Address ");
|
|
25356
25606
|
const result = addHexPrefix(removeHexPrefix(toHex(address)).padStart(40, "0"));
|
|
25357
|
-
assert(result.match(/^(0x)?[0-9a-f]{40}$/), "Invalid Ethereum Address Format");
|
|
25607
|
+
assert(Boolean(result.match(/^(0x)?[0-9a-f]{40}$/)), "Invalid Ethereum Address Format");
|
|
25358
25608
|
return result;
|
|
25359
25609
|
}
|
|
25360
25610
|
|
|
@@ -25565,9 +25815,10 @@ var starknet = (() => {
|
|
|
25565
25815
|
return createSierraContractClass(parsedContract);
|
|
25566
25816
|
}
|
|
25567
25817
|
var getDefaultNodeUrl = (networkName, mute = false) => {
|
|
25568
|
-
if (!mute)
|
|
25818
|
+
if (!mute) {
|
|
25569
25819
|
console.warn("Using default public node url, please provide nodeUrl in provider options!");
|
|
25570
|
-
|
|
25820
|
+
}
|
|
25821
|
+
const nodes = RPC_NODES[networkName ?? "SN_SEPOLIA" /* SN_SEPOLIA */];
|
|
25571
25822
|
const randIdx = Math.floor(Math.random() * nodes.length);
|
|
25572
25823
|
return nodes[randIdx];
|
|
25573
25824
|
};
|
|
@@ -25590,10 +25841,14 @@ var starknet = (() => {
|
|
|
25590
25841
|
tag = null;
|
|
25591
25842
|
setIdentifier(__identifier) {
|
|
25592
25843
|
if (isString(__identifier)) {
|
|
25593
|
-
if (
|
|
25844
|
+
if (isDecimalString(__identifier)) {
|
|
25845
|
+
this.number = parseInt(__identifier, 10);
|
|
25846
|
+
} else if (isHex(__identifier)) {
|
|
25594
25847
|
this.hash = __identifier;
|
|
25595
25848
|
} else if (validBlockTags.includes(__identifier)) {
|
|
25596
25849
|
this.tag = __identifier;
|
|
25850
|
+
} else {
|
|
25851
|
+
throw TypeError(`Block identifier unmanaged: ${__identifier}`);
|
|
25597
25852
|
}
|
|
25598
25853
|
} else if (isBigInt(__identifier)) {
|
|
25599
25854
|
this.hash = toHex(__identifier);
|
|
@@ -25602,6 +25857,9 @@ var starknet = (() => {
|
|
|
25602
25857
|
} else {
|
|
25603
25858
|
this.tag = "pending" /* pending */;
|
|
25604
25859
|
}
|
|
25860
|
+
if (isNumber(this.number) && this.number < 0) {
|
|
25861
|
+
throw TypeError(`Block number (${this.number}) can't be negative`);
|
|
25862
|
+
}
|
|
25605
25863
|
}
|
|
25606
25864
|
constructor(_identifier) {
|
|
25607
25865
|
this.setIdentifier(_identifier);
|
|
@@ -25631,15 +25889,10 @@ var starknet = (() => {
|
|
|
25631
25889
|
}
|
|
25632
25890
|
valueOf = () => this.number;
|
|
25633
25891
|
toString = () => this.hash;
|
|
25634
|
-
/* get sequencerIdentifier(): SequencerIdentifier {
|
|
25635
|
-
return this.hash !== null
|
|
25636
|
-
? { blockHash: this.hash as string }
|
|
25637
|
-
: { blockNumber: (this.number ?? this.tag) as BlockNumber };
|
|
25638
|
-
} */
|
|
25639
25892
|
};
|
|
25640
25893
|
function isV3Tx(details) {
|
|
25641
|
-
const version = details.version ? toHex(details.version) :
|
|
25642
|
-
return version ===
|
|
25894
|
+
const version = details.version ? toHex(details.version) : ETransactionVersion4.V3;
|
|
25895
|
+
return version === ETransactionVersion4.V3 || version === ETransactionVersion4.F3;
|
|
25643
25896
|
}
|
|
25644
25897
|
function isVersion(version, response) {
|
|
25645
25898
|
const [majorS, minorS] = version.split(".");
|
|
@@ -25740,7 +25993,7 @@ var starknet = (() => {
|
|
|
25740
25993
|
]
|
|
25741
25994
|
},
|
|
25742
25995
|
address: calculateContractAddressFromHash(
|
|
25743
|
-
unique2 ?
|
|
25996
|
+
unique2 ? esm_exports2.pedersen(address, deploySalt) : deploySalt,
|
|
25744
25997
|
classHash,
|
|
25745
25998
|
compiledConstructorCallData,
|
|
25746
25999
|
unique2 ? UDC.ADDRESS : 0
|
|
@@ -25754,10 +26007,10 @@ var starknet = (() => {
|
|
|
25754
26007
|
}
|
|
25755
26008
|
function getVersionsByType(versionType) {
|
|
25756
26009
|
return versionType === "fee" ? {
|
|
25757
|
-
v1:
|
|
25758
|
-
v2:
|
|
25759
|
-
v3:
|
|
25760
|
-
} : { v1:
|
|
26010
|
+
v1: ETransactionVersion4.F1,
|
|
26011
|
+
v2: ETransactionVersion4.F2,
|
|
26012
|
+
v3: ETransactionVersion4.F3
|
|
26013
|
+
} : { v1: ETransactionVersion4.V1, v2: ETransactionVersion4.V2, v3: ETransactionVersion4.V3 };
|
|
25761
26014
|
}
|
|
25762
26015
|
|
|
25763
26016
|
// src/channel/rpc_0_6.ts
|
|
@@ -25918,11 +26171,12 @@ var starknet = (() => {
|
|
|
25918
26171
|
* - skipValidate (default false)<br/>
|
|
25919
26172
|
* - skipFeeCharge (default true)<br/>
|
|
25920
26173
|
*/
|
|
25921
|
-
simulateTransaction(invocations, {
|
|
25922
|
-
|
|
25923
|
-
|
|
25924
|
-
|
|
25925
|
-
|
|
26174
|
+
simulateTransaction(invocations, simulateTransactionOptions = {}) {
|
|
26175
|
+
const {
|
|
26176
|
+
blockIdentifier = this.blockIdentifier,
|
|
26177
|
+
skipValidate = true,
|
|
26178
|
+
skipFeeCharge = true
|
|
26179
|
+
} = simulateTransactionOptions;
|
|
25926
26180
|
const block_id = new Block(blockIdentifier).identifier;
|
|
25927
26181
|
const simulationFlags = [];
|
|
25928
26182
|
if (skipValidate)
|
|
@@ -26245,7 +26499,6 @@ var starknet = (() => {
|
|
|
26245
26499
|
return {
|
|
26246
26500
|
// v0 v1 v3
|
|
26247
26501
|
type: rpcspec_0_6_exports.ETransactionType.INVOKE,
|
|
26248
|
-
// TODO: Diff between sequencer and rpc invoke type
|
|
26249
26502
|
sender_address: invocation.contractAddress,
|
|
26250
26503
|
calldata: CallData.toHex(invocation.calldata),
|
|
26251
26504
|
version: toHex(invocation.version || defaultVersions.v3),
|
|
@@ -26308,10 +26561,20 @@ var starknet = (() => {
|
|
|
26308
26561
|
blockIdentifier;
|
|
26309
26562
|
chainId;
|
|
26310
26563
|
specVersion;
|
|
26564
|
+
transactionRetryIntervalFallback;
|
|
26311
26565
|
waitMode;
|
|
26312
26566
|
// behave like web2 rpc and return when tx is processed
|
|
26313
26567
|
constructor(optionsOrProvider) {
|
|
26314
|
-
const {
|
|
26568
|
+
const {
|
|
26569
|
+
nodeUrl,
|
|
26570
|
+
retries,
|
|
26571
|
+
headers,
|
|
26572
|
+
blockIdentifier,
|
|
26573
|
+
chainId,
|
|
26574
|
+
specVersion,
|
|
26575
|
+
waitMode,
|
|
26576
|
+
transactionRetryIntervalFallback
|
|
26577
|
+
} = optionsOrProvider || {};
|
|
26315
26578
|
if (Object.values(NetworkName).includes(nodeUrl)) {
|
|
26316
26579
|
this.nodeUrl = getDefaultNodeUrl(nodeUrl, optionsOrProvider?.default);
|
|
26317
26580
|
} else if (nodeUrl) {
|
|
@@ -26326,6 +26589,10 @@ var starknet = (() => {
|
|
|
26326
26589
|
this.specVersion = specVersion;
|
|
26327
26590
|
this.waitMode = waitMode || false;
|
|
26328
26591
|
this.requestId = 0;
|
|
26592
|
+
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
|
|
26593
|
+
}
|
|
26594
|
+
get transactionRetryIntervalDefault() {
|
|
26595
|
+
return this.transactionRetryIntervalFallback ?? 5e3;
|
|
26329
26596
|
}
|
|
26330
26597
|
setChainId(chainId) {
|
|
26331
26598
|
this.chainId = chainId;
|
|
@@ -26456,17 +26723,18 @@ var starknet = (() => {
|
|
|
26456
26723
|
* - skipValidate (default false)<br/>
|
|
26457
26724
|
* - skipFeeCharge (default true)<br/>
|
|
26458
26725
|
*/
|
|
26459
|
-
simulateTransaction(invocations, {
|
|
26460
|
-
|
|
26461
|
-
|
|
26462
|
-
|
|
26463
|
-
|
|
26726
|
+
simulateTransaction(invocations, simulateTransactionOptions = {}) {
|
|
26727
|
+
const {
|
|
26728
|
+
blockIdentifier = this.blockIdentifier,
|
|
26729
|
+
skipValidate = true,
|
|
26730
|
+
skipFeeCharge = true
|
|
26731
|
+
} = simulateTransactionOptions;
|
|
26464
26732
|
const block_id = new Block(blockIdentifier).identifier;
|
|
26465
26733
|
const simulationFlags = [];
|
|
26466
26734
|
if (skipValidate)
|
|
26467
|
-
simulationFlags.push(
|
|
26735
|
+
simulationFlags.push(esm_exports.ESimulationFlag.SKIP_VALIDATE);
|
|
26468
26736
|
if (skipFeeCharge)
|
|
26469
|
-
simulationFlags.push(
|
|
26737
|
+
simulationFlags.push(esm_exports.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
26470
26738
|
return this.fetchEndpoint("starknet_simulateTransactions", {
|
|
26471
26739
|
block_id,
|
|
26472
26740
|
transactions: invocations.map((it) => this.buildTransaction(it)),
|
|
@@ -26478,17 +26746,17 @@ var starknet = (() => {
|
|
|
26478
26746
|
let { retries } = this;
|
|
26479
26747
|
let onchain = false;
|
|
26480
26748
|
let isErrorState = false;
|
|
26481
|
-
const retryInterval = options?.retryInterval ??
|
|
26749
|
+
const retryInterval = options?.retryInterval ?? this.transactionRetryIntervalDefault;
|
|
26482
26750
|
const errorStates = options?.errorStates ?? [
|
|
26483
|
-
|
|
26751
|
+
esm_exports.ETransactionStatus.REJECTED
|
|
26484
26752
|
// TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
|
|
26485
26753
|
// should decide which behavior to keep in the future
|
|
26486
26754
|
// RPC.ETransactionExecutionStatus.REVERTED,
|
|
26487
26755
|
];
|
|
26488
26756
|
const successStates = options?.successStates ?? [
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26757
|
+
esm_exports.ETransactionExecutionStatus.SUCCEEDED,
|
|
26758
|
+
esm_exports.ETransactionStatus.ACCEPTED_ON_L2,
|
|
26759
|
+
esm_exports.ETransactionStatus.ACCEPTED_ON_L1
|
|
26492
26760
|
];
|
|
26493
26761
|
let txStatus;
|
|
26494
26762
|
while (!onchain) {
|
|
@@ -26573,7 +26841,7 @@ var starknet = (() => {
|
|
|
26573
26841
|
let flags = {};
|
|
26574
26842
|
if (!isVersion("0.5", await this.getSpecVersion())) {
|
|
26575
26843
|
flags = {
|
|
26576
|
-
simulation_flags: skipValidate ? [
|
|
26844
|
+
simulation_flags: skipValidate ? [esm_exports.ESimulationFlag.SKIP_VALIDATE] : []
|
|
26577
26845
|
};
|
|
26578
26846
|
}
|
|
26579
26847
|
return this.fetchEndpoint("starknet_estimateFee", {
|
|
@@ -26589,9 +26857,9 @@ var starknet = (() => {
|
|
|
26589
26857
|
invoke_transaction: {
|
|
26590
26858
|
sender_address: functionInvocation.contractAddress,
|
|
26591
26859
|
calldata: CallData.toHex(functionInvocation.calldata),
|
|
26592
|
-
type:
|
|
26860
|
+
type: esm_exports.ETransactionType.INVOKE,
|
|
26593
26861
|
max_fee: toHex(details.maxFee || 0),
|
|
26594
|
-
version:
|
|
26862
|
+
version: esm_exports.ETransactionVersion.V1,
|
|
26595
26863
|
signature: signatureToHexArray(functionInvocation.signature),
|
|
26596
26864
|
nonce: toHex(details.nonce)
|
|
26597
26865
|
}
|
|
@@ -26599,10 +26867,10 @@ var starknet = (() => {
|
|
|
26599
26867
|
} else {
|
|
26600
26868
|
promise = this.fetchEndpoint("starknet_addInvokeTransaction", {
|
|
26601
26869
|
invoke_transaction: {
|
|
26602
|
-
type:
|
|
26870
|
+
type: esm_exports.ETransactionType.INVOKE,
|
|
26603
26871
|
sender_address: functionInvocation.contractAddress,
|
|
26604
26872
|
calldata: CallData.toHex(functionInvocation.calldata),
|
|
26605
|
-
version:
|
|
26873
|
+
version: esm_exports.ETransactionVersion.V3,
|
|
26606
26874
|
signature: signatureToHexArray(functionInvocation.signature),
|
|
26607
26875
|
nonce: toHex(details.nonce),
|
|
26608
26876
|
resource_bounds: details.resourceBounds,
|
|
@@ -26621,13 +26889,13 @@ var starknet = (() => {
|
|
|
26621
26889
|
if (!isSierra(contract) && !isV3Tx(details)) {
|
|
26622
26890
|
promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
|
|
26623
26891
|
declare_transaction: {
|
|
26624
|
-
type:
|
|
26892
|
+
type: esm_exports.ETransactionType.DECLARE,
|
|
26625
26893
|
contract_class: {
|
|
26626
26894
|
program: contract.program,
|
|
26627
26895
|
entry_points_by_type: contract.entry_points_by_type,
|
|
26628
26896
|
abi: contract.abi
|
|
26629
26897
|
},
|
|
26630
|
-
version:
|
|
26898
|
+
version: esm_exports.ETransactionVersion.V1,
|
|
26631
26899
|
max_fee: toHex(details.maxFee || 0),
|
|
26632
26900
|
signature: signatureToHexArray(signature),
|
|
26633
26901
|
sender_address: senderAddress,
|
|
@@ -26637,7 +26905,7 @@ var starknet = (() => {
|
|
|
26637
26905
|
} else if (isSierra(contract) && !isV3Tx(details)) {
|
|
26638
26906
|
promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
|
|
26639
26907
|
declare_transaction: {
|
|
26640
|
-
type:
|
|
26908
|
+
type: esm_exports.ETransactionType.DECLARE,
|
|
26641
26909
|
contract_class: {
|
|
26642
26910
|
sierra_program: decompressProgram(contract.sierra_program),
|
|
26643
26911
|
contract_class_version: contract.contract_class_version,
|
|
@@ -26645,7 +26913,7 @@ var starknet = (() => {
|
|
|
26645
26913
|
abi: contract.abi
|
|
26646
26914
|
},
|
|
26647
26915
|
compiled_class_hash: compiledClassHash || "",
|
|
26648
|
-
version:
|
|
26916
|
+
version: esm_exports.ETransactionVersion.V2,
|
|
26649
26917
|
max_fee: toHex(details.maxFee || 0),
|
|
26650
26918
|
signature: signatureToHexArray(signature),
|
|
26651
26919
|
sender_address: senderAddress,
|
|
@@ -26655,10 +26923,10 @@ var starknet = (() => {
|
|
|
26655
26923
|
} else if (isSierra(contract) && isV3Tx(details)) {
|
|
26656
26924
|
promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
|
|
26657
26925
|
declare_transaction: {
|
|
26658
|
-
type:
|
|
26926
|
+
type: esm_exports.ETransactionType.DECLARE,
|
|
26659
26927
|
sender_address: senderAddress,
|
|
26660
26928
|
compiled_class_hash: compiledClassHash || "",
|
|
26661
|
-
version:
|
|
26929
|
+
version: esm_exports.ETransactionVersion.V3,
|
|
26662
26930
|
signature: signatureToHexArray(signature),
|
|
26663
26931
|
nonce: toHex(details.nonce),
|
|
26664
26932
|
contract_class: {
|
|
@@ -26688,9 +26956,9 @@ var starknet = (() => {
|
|
|
26688
26956
|
constructor_calldata: CallData.toHex(constructorCalldata || []),
|
|
26689
26957
|
class_hash: toHex(classHash),
|
|
26690
26958
|
contract_address_salt: toHex(addressSalt || 0),
|
|
26691
|
-
type:
|
|
26959
|
+
type: esm_exports.ETransactionType.DEPLOY_ACCOUNT,
|
|
26692
26960
|
max_fee: toHex(details.maxFee || 0),
|
|
26693
|
-
version:
|
|
26961
|
+
version: esm_exports.ETransactionVersion.V1,
|
|
26694
26962
|
signature: signatureToHexArray(signature),
|
|
26695
26963
|
nonce: toHex(details.nonce)
|
|
26696
26964
|
}
|
|
@@ -26698,8 +26966,8 @@ var starknet = (() => {
|
|
|
26698
26966
|
} else {
|
|
26699
26967
|
promise = this.fetchEndpoint("starknet_addDeployAccountTransaction", {
|
|
26700
26968
|
deploy_account_transaction: {
|
|
26701
|
-
type:
|
|
26702
|
-
version:
|
|
26969
|
+
type: esm_exports.ETransactionType.DEPLOY_ACCOUNT,
|
|
26970
|
+
version: esm_exports.ETransactionVersion.V3,
|
|
26703
26971
|
signature: signatureToHexArray(signature),
|
|
26704
26972
|
nonce: toHex(details.nonce),
|
|
26705
26973
|
contract_address_salt: toHex(addressSalt || 0),
|
|
@@ -26782,8 +27050,7 @@ var starknet = (() => {
|
|
|
26782
27050
|
if (invocation.type === "INVOKE_FUNCTION" /* INVOKE */) {
|
|
26783
27051
|
return {
|
|
26784
27052
|
// v0 v1 v3
|
|
26785
|
-
type:
|
|
26786
|
-
// TODO: Diff between sequencer and rpc invoke type
|
|
27053
|
+
type: esm_exports.ETransactionType.INVOKE,
|
|
26787
27054
|
sender_address: invocation.contractAddress,
|
|
26788
27055
|
calldata: CallData.toHex(invocation.calldata),
|
|
26789
27056
|
version: toHex(invocation.version || defaultVersions.v3),
|
|
@@ -26899,6 +27166,9 @@ var starknet = (() => {
|
|
|
26899
27166
|
abi: isString(res.abi) ? JSON.parse(res.abi) : res.abi
|
|
26900
27167
|
};
|
|
26901
27168
|
}
|
|
27169
|
+
parseL1GasPriceResponse(res) {
|
|
27170
|
+
return res.l1_gas_price.price_in_wei;
|
|
27171
|
+
}
|
|
26902
27172
|
};
|
|
26903
27173
|
|
|
26904
27174
|
// src/utils/transactionReceipt.ts
|
|
@@ -26997,6 +27267,63 @@ var starknet = (() => {
|
|
|
26997
27267
|
async getBlockWithTxs(blockIdentifier) {
|
|
26998
27268
|
return this.channel.getBlockWithTxs(blockIdentifier);
|
|
26999
27269
|
}
|
|
27270
|
+
/**
|
|
27271
|
+
* Pause the execution of the script until a specified block is created.
|
|
27272
|
+
* @param {BlockIdentifier} blockIdentifier bloc number (BigNumberisk) or 'pending' or 'latest'.
|
|
27273
|
+
* Use of 'latest" or of a block already created will generate no pause.
|
|
27274
|
+
* @param {number} [retryInterval] number of milliseconds between 2 requests to the node
|
|
27275
|
+
* @example
|
|
27276
|
+
* ```typescript
|
|
27277
|
+
* await myProvider.waitForBlock();
|
|
27278
|
+
* // wait the creation of the pending block
|
|
27279
|
+
* ```
|
|
27280
|
+
*/
|
|
27281
|
+
async waitForBlock(blockIdentifier = "pending", retryInterval = 5e3) {
|
|
27282
|
+
if (blockIdentifier === "latest" /* latest */)
|
|
27283
|
+
return;
|
|
27284
|
+
const currentBlock = await this.getBlockNumber();
|
|
27285
|
+
const targetBlock = blockIdentifier === "pending" /* pending */ ? currentBlock + 1 : Number(toHex(blockIdentifier));
|
|
27286
|
+
if (targetBlock <= currentBlock)
|
|
27287
|
+
return;
|
|
27288
|
+
const { retries } = this.channel;
|
|
27289
|
+
let retriesCount = retries;
|
|
27290
|
+
let isTargetBlock = false;
|
|
27291
|
+
while (!isTargetBlock) {
|
|
27292
|
+
const currBlock = await this.getBlockNumber();
|
|
27293
|
+
if (currBlock === targetBlock) {
|
|
27294
|
+
isTargetBlock = true;
|
|
27295
|
+
} else {
|
|
27296
|
+
await wait(retryInterval);
|
|
27297
|
+
}
|
|
27298
|
+
retriesCount -= 1;
|
|
27299
|
+
if (retriesCount <= 0) {
|
|
27300
|
+
throw new Error(`waitForBlock() timed-out after ${retries} tries.`);
|
|
27301
|
+
}
|
|
27302
|
+
}
|
|
27303
|
+
}
|
|
27304
|
+
async getL1GasPrice(blockIdentifier) {
|
|
27305
|
+
return this.channel.getBlockWithTxHashes(blockIdentifier).then(this.responseParser.parseL1GasPriceResponse);
|
|
27306
|
+
}
|
|
27307
|
+
async getL1MessageHash(l2TxHash) {
|
|
27308
|
+
const transaction = await this.channel.getTransactionByHash(l2TxHash);
|
|
27309
|
+
assert(transaction.type === "L1_HANDLER", "This L2 transaction is not a L1 message.");
|
|
27310
|
+
const { calldata, contract_address, entry_point_selector, nonce } = transaction;
|
|
27311
|
+
const params = [
|
|
27312
|
+
calldata[0],
|
|
27313
|
+
contract_address,
|
|
27314
|
+
nonce,
|
|
27315
|
+
entry_point_selector,
|
|
27316
|
+
calldata.length - 1,
|
|
27317
|
+
...calldata.slice(1)
|
|
27318
|
+
];
|
|
27319
|
+
const myEncode = addHexPrefix(
|
|
27320
|
+
params.reduce(
|
|
27321
|
+
(res, par) => res + removeHexPrefix(toHex(par)).padStart(64, "0"),
|
|
27322
|
+
""
|
|
27323
|
+
)
|
|
27324
|
+
);
|
|
27325
|
+
return addHexPrefix(bytesToHex(keccak_256(hexToBytes2(myEncode))));
|
|
27326
|
+
}
|
|
27000
27327
|
async getBlockWithReceipts(blockIdentifier) {
|
|
27001
27328
|
if (this.channel instanceof rpc_0_6_exports.RpcChannel)
|
|
27002
27329
|
throw new LibraryError("Unsupported method for RPC version");
|
|
@@ -27048,7 +27375,7 @@ var starknet = (() => {
|
|
|
27048
27375
|
}
|
|
27049
27376
|
/**
|
|
27050
27377
|
* @param invocations AccountInvocations
|
|
27051
|
-
* @param
|
|
27378
|
+
* @param options blockIdentifier and flags to skip validation and fee charge<br/>
|
|
27052
27379
|
* - blockIdentifier<br/>
|
|
27053
27380
|
* - skipValidate (default false)<br/>
|
|
27054
27381
|
* - skipFeeCharge (default true)<br/>
|
|
@@ -27510,7 +27837,6 @@ var starknet = (() => {
|
|
|
27510
27837
|
}
|
|
27511
27838
|
var StarknetIdContract = /* @__PURE__ */ ((StarknetIdContract2) => {
|
|
27512
27839
|
StarknetIdContract2["MAINNET"] = "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";
|
|
27513
|
-
StarknetIdContract2["TESTNET"] = "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";
|
|
27514
27840
|
StarknetIdContract2["TESTNET_SEPOLIA"] = "0x0707f09bc576bd7cfee59694846291047e965f4184fe13dac62c56759b3b6fa7";
|
|
27515
27841
|
return StarknetIdContract2;
|
|
27516
27842
|
})(StarknetIdContract || {});
|
|
@@ -27518,8 +27844,6 @@ var starknet = (() => {
|
|
|
27518
27844
|
switch (chainId) {
|
|
27519
27845
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
27520
27846
|
return "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678" /* MAINNET */;
|
|
27521
|
-
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
27522
|
-
return "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce" /* TESTNET */;
|
|
27523
27847
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
27524
27848
|
return "0x0707f09bc576bd7cfee59694846291047e965f4184fe13dac62c56759b3b6fa7" /* TESTNET_SEPOLIA */;
|
|
27525
27849
|
default:
|
|
@@ -27528,7 +27852,6 @@ var starknet = (() => {
|
|
|
27528
27852
|
}
|
|
27529
27853
|
var StarknetIdIdentityContract = /* @__PURE__ */ ((StarknetIdIdentityContract2) => {
|
|
27530
27854
|
StarknetIdIdentityContract2["MAINNET"] = "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af";
|
|
27531
|
-
StarknetIdIdentityContract2["TESTNET"] = "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d";
|
|
27532
27855
|
StarknetIdIdentityContract2["TESTNET_SEPOLIA"] = "0x070DF8B4F5cb2879f8592849fA8f3134da39d25326B8558cc9C8FE8D47EA3A90";
|
|
27533
27856
|
return StarknetIdIdentityContract2;
|
|
27534
27857
|
})(StarknetIdIdentityContract || {});
|
|
@@ -27536,8 +27859,6 @@ var starknet = (() => {
|
|
|
27536
27859
|
switch (chainId) {
|
|
27537
27860
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
27538
27861
|
return "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af" /* MAINNET */;
|
|
27539
|
-
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
27540
|
-
return "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d" /* TESTNET */;
|
|
27541
27862
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
27542
27863
|
return "0x070DF8B4F5cb2879f8592849fA8f3134da39d25326B8558cc9C8FE8D47EA3A90" /* TESTNET_SEPOLIA */;
|
|
27543
27864
|
default:
|
|
@@ -27549,8 +27870,6 @@ var starknet = (() => {
|
|
|
27549
27870
|
switch (chainId) {
|
|
27550
27871
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
27551
27872
|
return StarknetIdMulticallContract;
|
|
27552
|
-
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
27553
|
-
return StarknetIdMulticallContract;
|
|
27554
27873
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
27555
27874
|
return StarknetIdMulticallContract;
|
|
27556
27875
|
default:
|
|
@@ -27559,7 +27878,6 @@ var starknet = (() => {
|
|
|
27559
27878
|
}
|
|
27560
27879
|
var StarknetIdVerifierContract = /* @__PURE__ */ ((StarknetIdVerifierContract2) => {
|
|
27561
27880
|
StarknetIdVerifierContract2["MAINNET"] = "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf";
|
|
27562
|
-
StarknetIdVerifierContract2["TESTNET"] = "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11";
|
|
27563
27881
|
StarknetIdVerifierContract2["TESTNET_SEPOLIA"] = "0x0182EcE8173C216A395f4828e1523541b7e3600bf190CB252E1a1A0cE219d184";
|
|
27564
27882
|
return StarknetIdVerifierContract2;
|
|
27565
27883
|
})(StarknetIdVerifierContract || {});
|
|
@@ -27567,8 +27885,6 @@ var starknet = (() => {
|
|
|
27567
27885
|
switch (chainId) {
|
|
27568
27886
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
27569
27887
|
return "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf" /* MAINNET */;
|
|
27570
|
-
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
27571
|
-
return "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11" /* TESTNET */;
|
|
27572
27888
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
27573
27889
|
return "0x0182EcE8173C216A395f4828e1523541b7e3600bf190CB252E1a1A0cE219d184" /* TESTNET_SEPOLIA */;
|
|
27574
27890
|
default:
|
|
@@ -27577,7 +27893,6 @@ var starknet = (() => {
|
|
|
27577
27893
|
}
|
|
27578
27894
|
var StarknetIdPfpContract = /* @__PURE__ */ ((StarknetIdPfpContract2) => {
|
|
27579
27895
|
StarknetIdPfpContract2["MAINNET"] = "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7";
|
|
27580
|
-
StarknetIdPfpContract2["TESTNET"] = "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698";
|
|
27581
27896
|
StarknetIdPfpContract2["TESTNET_SEPOLIA"] = "0x058061bb6bdc501eE215172c9f87d557C1E0f466dC498cA81b18f998Bf1362b2";
|
|
27582
27897
|
return StarknetIdPfpContract2;
|
|
27583
27898
|
})(StarknetIdPfpContract || {});
|
|
@@ -27585,8 +27900,6 @@ var starknet = (() => {
|
|
|
27585
27900
|
switch (chainId) {
|
|
27586
27901
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
27587
27902
|
return "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7" /* MAINNET */;
|
|
27588
|
-
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
27589
|
-
return "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698" /* TESTNET */;
|
|
27590
27903
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
27591
27904
|
return "0x058061bb6bdc501eE215172c9f87d557C1E0f466dC498cA81b18f998Bf1362b2" /* TESTNET_SEPOLIA */;
|
|
27592
27905
|
default:
|
|
@@ -27597,7 +27910,6 @@ var starknet = (() => {
|
|
|
27597
27910
|
}
|
|
27598
27911
|
var StarknetIdPopContract = /* @__PURE__ */ ((StarknetIdPopContract2) => {
|
|
27599
27912
|
StarknetIdPopContract2["MAINNET"] = "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4";
|
|
27600
|
-
StarknetIdPopContract2["TESTNET"] = "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106";
|
|
27601
27913
|
StarknetIdPopContract2["TESTNET_SEPOLIA"] = "0x0023FE3b845ed5665a9eb3792bbB17347B490EE4090f855C1298d03BB5F49B49";
|
|
27602
27914
|
return StarknetIdPopContract2;
|
|
27603
27915
|
})(StarknetIdPopContract || {});
|
|
@@ -27605,8 +27917,6 @@ var starknet = (() => {
|
|
|
27605
27917
|
switch (chainId) {
|
|
27606
27918
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
27607
27919
|
return "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4" /* MAINNET */;
|
|
27608
|
-
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
27609
|
-
return "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106" /* TESTNET */;
|
|
27610
27920
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
27611
27921
|
return "0x0023FE3b845ed5665a9eb3792bbB17347B490EE4090f855C1298d03BB5F49B49" /* TESTNET_SEPOLIA */;
|
|
27612
27922
|
default:
|
|
@@ -27671,13 +27981,7 @@ var starknet = (() => {
|
|
|
27671
27981
|
const chainId = await provider.getChainId();
|
|
27672
27982
|
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
27673
27983
|
try {
|
|
27674
|
-
const hexDomain = await
|
|
27675
|
-
contractAddress: contract,
|
|
27676
|
-
entrypoint: "address_to_domain",
|
|
27677
|
-
calldata: CallData.compile({
|
|
27678
|
-
address
|
|
27679
|
-
})
|
|
27680
|
-
});
|
|
27984
|
+
const hexDomain = await this.executeStarkName(provider, address, contract);
|
|
27681
27985
|
const decimalDomain = hexDomain.map((element) => BigInt(element)).slice(1);
|
|
27682
27986
|
const stringDomain = useDecoded(decimalDomain);
|
|
27683
27987
|
if (!stringDomain) {
|
|
@@ -27691,6 +27995,26 @@ var starknet = (() => {
|
|
|
27691
27995
|
throw Error("Could not get stark name");
|
|
27692
27996
|
}
|
|
27693
27997
|
}
|
|
27998
|
+
static async executeStarkName(provider, address, contract) {
|
|
27999
|
+
try {
|
|
28000
|
+
return await provider.callContract({
|
|
28001
|
+
contractAddress: contract,
|
|
28002
|
+
entrypoint: "address_to_domain",
|
|
28003
|
+
calldata: CallData.compile({
|
|
28004
|
+
address,
|
|
28005
|
+
hint: []
|
|
28006
|
+
})
|
|
28007
|
+
});
|
|
28008
|
+
} catch (initialError) {
|
|
28009
|
+
return await provider.callContract({
|
|
28010
|
+
contractAddress: contract,
|
|
28011
|
+
entrypoint: "address_to_domain",
|
|
28012
|
+
calldata: CallData.compile({
|
|
28013
|
+
address
|
|
28014
|
+
})
|
|
28015
|
+
});
|
|
28016
|
+
}
|
|
28017
|
+
}
|
|
27694
28018
|
static async getAddressFromStarkName(provider, name, StarknetIdContract2) {
|
|
27695
28019
|
const chainId = await provider.getChainId();
|
|
27696
28020
|
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
@@ -27715,100 +28039,111 @@ var starknet = (() => {
|
|
|
27715
28039
|
const popContract = StarknetIdPopContract2 ?? getStarknetIdPopContract(chainId);
|
|
27716
28040
|
const multicallAddress = StarknetIdMulticallContract2 ?? getStarknetIdMulticallContract(chainId);
|
|
27717
28041
|
try {
|
|
27718
|
-
const
|
|
27719
|
-
|
|
27720
|
-
|
|
27721
|
-
|
|
27722
|
-
|
|
27723
|
-
|
|
27724
|
-
|
|
27725
|
-
|
|
27726
|
-
|
|
27727
|
-
|
|
27728
|
-
|
|
27729
|
-
|
|
27730
|
-
|
|
27731
|
-
to: dynamicFelt(contract),
|
|
27732
|
-
selector: dynamicFelt(getSelectorFromName("domain_to_id")),
|
|
27733
|
-
calldata: [dynamicCallData(void 0, void 0, [0, 0])]
|
|
27734
|
-
},
|
|
27735
|
-
{
|
|
27736
|
-
execution: execution({}),
|
|
27737
|
-
to: dynamicFelt(identityContract),
|
|
27738
|
-
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
27739
|
-
calldata: [
|
|
27740
|
-
dynamicCallData(void 0, [1, 0]),
|
|
27741
|
-
dynamicCallData(encodeShortString("twitter")),
|
|
27742
|
-
dynamicCallData(verifierContract),
|
|
27743
|
-
dynamicCallData("0")
|
|
27744
|
-
]
|
|
27745
|
-
},
|
|
27746
|
-
{
|
|
27747
|
-
execution: execution({}),
|
|
27748
|
-
to: dynamicFelt(identityContract),
|
|
27749
|
-
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
27750
|
-
calldata: [
|
|
27751
|
-
dynamicCallData(void 0, [1, 0]),
|
|
27752
|
-
dynamicCallData(encodeShortString("github")),
|
|
27753
|
-
dynamicCallData(verifierContract),
|
|
27754
|
-
dynamicCallData("0")
|
|
27755
|
-
]
|
|
27756
|
-
},
|
|
27757
|
-
{
|
|
27758
|
-
execution: execution({}),
|
|
27759
|
-
to: dynamicFelt(identityContract),
|
|
27760
|
-
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
27761
|
-
calldata: [
|
|
27762
|
-
dynamicCallData(void 0, [1, 0]),
|
|
27763
|
-
dynamicCallData(encodeShortString("discord")),
|
|
27764
|
-
dynamicCallData(verifierContract),
|
|
27765
|
-
dynamicCallData("0")
|
|
27766
|
-
]
|
|
27767
|
-
},
|
|
27768
|
-
{
|
|
27769
|
-
execution: execution({}),
|
|
27770
|
-
to: dynamicFelt(identityContract),
|
|
27771
|
-
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
27772
|
-
calldata: [
|
|
27773
|
-
dynamicCallData(void 0, [1, 0]),
|
|
27774
|
-
dynamicCallData(encodeShortString("proof_of_personhood")),
|
|
27775
|
-
dynamicCallData(popContract),
|
|
27776
|
-
dynamicCallData("0")
|
|
27777
|
-
]
|
|
27778
|
-
},
|
|
27779
|
-
// PFP
|
|
27780
|
-
{
|
|
27781
|
-
execution: execution({}),
|
|
27782
|
-
to: dynamicFelt(identityContract),
|
|
27783
|
-
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
27784
|
-
calldata: [
|
|
27785
|
-
dynamicCallData(void 0, [1, 0]),
|
|
27786
|
-
dynamicCallData(encodeShortString("nft_pp_contract")),
|
|
27787
|
-
dynamicCallData(pfpContract),
|
|
27788
|
-
dynamicCallData("0")
|
|
27789
|
-
]
|
|
27790
|
-
},
|
|
27791
|
-
{
|
|
27792
|
-
execution: execution({}),
|
|
27793
|
-
to: dynamicFelt(identityContract),
|
|
27794
|
-
selector: dynamicFelt(getSelectorFromName("get_extended_verifier_data")),
|
|
27795
|
-
calldata: [
|
|
27796
|
-
dynamicCallData(void 0, [1, 0]),
|
|
27797
|
-
dynamicCallData(encodeShortString("nft_pp_id")),
|
|
27798
|
-
dynamicCallData("2"),
|
|
27799
|
-
dynamicCallData(pfpContract),
|
|
27800
|
-
dynamicCallData("0")
|
|
27801
|
-
]
|
|
27802
|
-
},
|
|
27803
|
-
{
|
|
27804
|
-
execution: execution(void 0, void 0, [6, 0, 0]),
|
|
27805
|
-
to: dynamicFelt(void 0, [6, 0]),
|
|
27806
|
-
selector: dynamicFelt(getSelectorFromName("tokenURI")),
|
|
27807
|
-
calldata: [dynamicCallData(void 0, [7, 1]), dynamicCallData(void 0, [7, 2])]
|
|
27808
|
-
}
|
|
27809
|
-
]
|
|
27810
|
-
})
|
|
28042
|
+
const initialCalldata = [];
|
|
28043
|
+
const fallbackCalldata = [];
|
|
28044
|
+
initialCalldata.push({
|
|
28045
|
+
execution: execution({}),
|
|
28046
|
+
to: dynamicCallData(contract),
|
|
28047
|
+
selector: dynamicCallData(getSelectorFromName("address_to_domain")),
|
|
28048
|
+
calldata: [dynamicCallData(address), dynamicCallData("0")]
|
|
28049
|
+
});
|
|
28050
|
+
fallbackCalldata.push({
|
|
28051
|
+
execution: execution({}),
|
|
28052
|
+
to: dynamicCallData(contract),
|
|
28053
|
+
selector: dynamicFelt(getSelectorFromName("address_to_domain")),
|
|
28054
|
+
calldata: [dynamicCallData(address)]
|
|
27811
28055
|
});
|
|
28056
|
+
const calls = [
|
|
28057
|
+
{
|
|
28058
|
+
execution: execution({}),
|
|
28059
|
+
to: dynamicFelt(contract),
|
|
28060
|
+
selector: dynamicFelt(getSelectorFromName("domain_to_id")),
|
|
28061
|
+
calldata: [dynamicCallData(void 0, void 0, [0, 0])]
|
|
28062
|
+
},
|
|
28063
|
+
{
|
|
28064
|
+
execution: execution({}),
|
|
28065
|
+
to: dynamicFelt(identityContract),
|
|
28066
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
28067
|
+
calldata: [
|
|
28068
|
+
dynamicCallData(void 0, [1, 0]),
|
|
28069
|
+
dynamicCallData(encodeShortString("twitter")),
|
|
28070
|
+
dynamicCallData(verifierContract),
|
|
28071
|
+
dynamicCallData("0")
|
|
28072
|
+
]
|
|
28073
|
+
},
|
|
28074
|
+
{
|
|
28075
|
+
execution: execution({}),
|
|
28076
|
+
to: dynamicFelt(identityContract),
|
|
28077
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
28078
|
+
calldata: [
|
|
28079
|
+
dynamicCallData(void 0, [1, 0]),
|
|
28080
|
+
dynamicCallData(encodeShortString("github")),
|
|
28081
|
+
dynamicCallData(verifierContract),
|
|
28082
|
+
dynamicCallData("0")
|
|
28083
|
+
]
|
|
28084
|
+
},
|
|
28085
|
+
{
|
|
28086
|
+
execution: execution({}),
|
|
28087
|
+
to: dynamicFelt(identityContract),
|
|
28088
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
28089
|
+
calldata: [
|
|
28090
|
+
dynamicCallData(void 0, [1, 0]),
|
|
28091
|
+
dynamicCallData(encodeShortString("discord")),
|
|
28092
|
+
dynamicCallData(verifierContract),
|
|
28093
|
+
dynamicCallData("0")
|
|
28094
|
+
]
|
|
28095
|
+
},
|
|
28096
|
+
{
|
|
28097
|
+
execution: execution({}),
|
|
28098
|
+
to: dynamicFelt(identityContract),
|
|
28099
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
28100
|
+
calldata: [
|
|
28101
|
+
dynamicCallData(void 0, [1, 0]),
|
|
28102
|
+
dynamicCallData(encodeShortString("proof_of_personhood")),
|
|
28103
|
+
dynamicCallData(popContract),
|
|
28104
|
+
dynamicCallData("0")
|
|
28105
|
+
]
|
|
28106
|
+
},
|
|
28107
|
+
// PFP
|
|
28108
|
+
{
|
|
28109
|
+
execution: execution({}),
|
|
28110
|
+
to: dynamicFelt(identityContract),
|
|
28111
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
28112
|
+
calldata: [
|
|
28113
|
+
dynamicCallData(void 0, [1, 0]),
|
|
28114
|
+
dynamicCallData(encodeShortString("nft_pp_contract")),
|
|
28115
|
+
dynamicCallData(pfpContract),
|
|
28116
|
+
dynamicCallData("0")
|
|
28117
|
+
]
|
|
28118
|
+
},
|
|
28119
|
+
{
|
|
28120
|
+
execution: execution({}),
|
|
28121
|
+
to: dynamicFelt(identityContract),
|
|
28122
|
+
selector: dynamicFelt(getSelectorFromName("get_extended_verifier_data")),
|
|
28123
|
+
calldata: [
|
|
28124
|
+
dynamicCallData(void 0, [1, 0]),
|
|
28125
|
+
dynamicCallData(encodeShortString("nft_pp_id")),
|
|
28126
|
+
dynamicCallData("2"),
|
|
28127
|
+
dynamicCallData(pfpContract),
|
|
28128
|
+
dynamicCallData("0")
|
|
28129
|
+
]
|
|
28130
|
+
},
|
|
28131
|
+
{
|
|
28132
|
+
execution: execution(void 0, void 0, [6, 0, 0]),
|
|
28133
|
+
to: dynamicFelt(void 0, [6, 0]),
|
|
28134
|
+
selector: dynamicFelt(getSelectorFromName("tokenURI")),
|
|
28135
|
+
calldata: [dynamicCallData(void 0, [7, 1]), dynamicCallData(void 0, [7, 2])]
|
|
28136
|
+
}
|
|
28137
|
+
];
|
|
28138
|
+
initialCalldata.push(...calls);
|
|
28139
|
+
fallbackCalldata.push(...calls);
|
|
28140
|
+
const data = await this.executeStarkProfile(
|
|
28141
|
+
provider,
|
|
28142
|
+
multicallAddress,
|
|
28143
|
+
"aggregate",
|
|
28144
|
+
initialCalldata,
|
|
28145
|
+
fallbackCalldata
|
|
28146
|
+
);
|
|
27812
28147
|
if (Array.isArray(data)) {
|
|
27813
28148
|
const size = parseInt(data[0], 16);
|
|
27814
28149
|
const finalArray = [];
|
|
@@ -27848,6 +28183,25 @@ var starknet = (() => {
|
|
|
27848
28183
|
throw Error("Could not get user stark profile data from address");
|
|
27849
28184
|
}
|
|
27850
28185
|
}
|
|
28186
|
+
static async executeStarkProfile(provider, contract, functionName, initialCalldata, fallbackCalldata) {
|
|
28187
|
+
try {
|
|
28188
|
+
return await provider.callContract({
|
|
28189
|
+
contractAddress: contract,
|
|
28190
|
+
entrypoint: functionName,
|
|
28191
|
+
calldata: CallData.compile({
|
|
28192
|
+
calls: initialCalldata
|
|
28193
|
+
})
|
|
28194
|
+
});
|
|
28195
|
+
} catch (initialError) {
|
|
28196
|
+
return await provider.callContract({
|
|
28197
|
+
contractAddress: contract,
|
|
28198
|
+
entrypoint: functionName,
|
|
28199
|
+
calldata: CallData.compile({
|
|
28200
|
+
calls: fallbackCalldata
|
|
28201
|
+
})
|
|
28202
|
+
});
|
|
28203
|
+
}
|
|
28204
|
+
}
|
|
27851
28205
|
};
|
|
27852
28206
|
|
|
27853
28207
|
// src/provider/extensions/default.ts
|
|
@@ -28236,11 +28590,11 @@ var starknet = (() => {
|
|
|
28236
28590
|
// src/signer/default.ts
|
|
28237
28591
|
var Signer = class {
|
|
28238
28592
|
pk;
|
|
28239
|
-
constructor(pk =
|
|
28593
|
+
constructor(pk = esm_exports2.utils.randomPrivateKey()) {
|
|
28240
28594
|
this.pk = pk instanceof Uint8Array ? buf2hex(pk) : toHex(pk);
|
|
28241
28595
|
}
|
|
28242
28596
|
async getPubKey() {
|
|
28243
|
-
return
|
|
28597
|
+
return esm_exports2.getStarkKey(this.pk);
|
|
28244
28598
|
}
|
|
28245
28599
|
async signMessage(typedData, accountAddress) {
|
|
28246
28600
|
const msgHash = getMessageHash(typedData, accountAddress);
|
|
@@ -28320,7 +28674,7 @@ var starknet = (() => {
|
|
|
28320
28674
|
return this.signRaw(msgHash);
|
|
28321
28675
|
}
|
|
28322
28676
|
async signRaw(msgHash) {
|
|
28323
|
-
return
|
|
28677
|
+
return esm_exports2.sign(msgHash, this.pk);
|
|
28324
28678
|
}
|
|
28325
28679
|
};
|
|
28326
28680
|
|
|
@@ -28499,7 +28853,7 @@ var starknet = (() => {
|
|
|
28499
28853
|
address;
|
|
28500
28854
|
cairoVersion;
|
|
28501
28855
|
transactionVersion;
|
|
28502
|
-
constructor(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion =
|
|
28856
|
+
constructor(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion = ETransactionVersion4.V2) {
|
|
28503
28857
|
super(providerOrOptions);
|
|
28504
28858
|
this.address = address.toLowerCase();
|
|
28505
28859
|
this.signer = isString(pkOrSigner) || pkOrSigner instanceof Uint8Array ? new Signer(pkOrSigner) : pkOrSigner;
|
|
@@ -28510,11 +28864,11 @@ var starknet = (() => {
|
|
|
28510
28864
|
}
|
|
28511
28865
|
// provided version or contract based preferred transactionVersion
|
|
28512
28866
|
getPreferredVersion(type12, type3) {
|
|
28513
|
-
if (this.transactionVersion ===
|
|
28867
|
+
if (this.transactionVersion === ETransactionVersion4.V3)
|
|
28514
28868
|
return type3;
|
|
28515
|
-
if (this.transactionVersion ===
|
|
28869
|
+
if (this.transactionVersion === ETransactionVersion4.V2)
|
|
28516
28870
|
return type12;
|
|
28517
|
-
return
|
|
28871
|
+
return ETransactionVersion4.V3;
|
|
28518
28872
|
}
|
|
28519
28873
|
async getNonce(blockIdentifier) {
|
|
28520
28874
|
return super.getNonceForAddress(this.address, blockIdentifier);
|
|
@@ -28527,7 +28881,7 @@ var starknet = (() => {
|
|
|
28527
28881
|
}
|
|
28528
28882
|
}
|
|
28529
28883
|
/**
|
|
28530
|
-
* Retrieves the Cairo version from the network and sets `cairoVersion` if not already set in the constructor
|
|
28884
|
+
* Retrieves the Cairo version from the network and sets `cairoVersion` if not already set in the constructor.
|
|
28531
28885
|
* @param classHash if provided detects Cairo version from classHash, otherwise from the account address
|
|
28532
28886
|
*/
|
|
28533
28887
|
async getCairoVersion(classHash) {
|
|
@@ -28550,7 +28904,7 @@ var starknet = (() => {
|
|
|
28550
28904
|
const transactions = Array.isArray(calls) ? calls : [calls];
|
|
28551
28905
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
28552
28906
|
const version = toTransactionVersion(
|
|
28553
|
-
this.getPreferredVersion(
|
|
28907
|
+
this.getPreferredVersion(ETransactionVersion4.F1, ETransactionVersion4.F3),
|
|
28554
28908
|
toFeeVersion(providedVersion)
|
|
28555
28909
|
);
|
|
28556
28910
|
const chainId = await this.getChainId();
|
|
@@ -28581,7 +28935,7 @@ var starknet = (() => {
|
|
|
28581
28935
|
} = details;
|
|
28582
28936
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
28583
28937
|
const version = toTransactionVersion(
|
|
28584
|
-
!isSierra(payload.contract) ?
|
|
28938
|
+
!isSierra(payload.contract) ? ETransactionVersion4.F1 : this.getPreferredVersion(ETransactionVersion4.F2, ETransactionVersion4.F3),
|
|
28585
28939
|
toFeeVersion(providedVersion)
|
|
28586
28940
|
);
|
|
28587
28941
|
const chainId = await this.getChainId();
|
|
@@ -28611,7 +28965,7 @@ var starknet = (() => {
|
|
|
28611
28965
|
}, details = {}) {
|
|
28612
28966
|
const { blockIdentifier, version: providedVersion, skipValidate = true } = details;
|
|
28613
28967
|
const version = toTransactionVersion(
|
|
28614
|
-
this.getPreferredVersion(
|
|
28968
|
+
this.getPreferredVersion(ETransactionVersion4.F1, ETransactionVersion4.F3),
|
|
28615
28969
|
toFeeVersion(providedVersion)
|
|
28616
28970
|
);
|
|
28617
28971
|
const nonce = ZERO;
|
|
@@ -28647,10 +29001,10 @@ var starknet = (() => {
|
|
|
28647
29001
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
28648
29002
|
...v3Details(details),
|
|
28649
29003
|
versions: [
|
|
28650
|
-
|
|
29004
|
+
ETransactionVersion4.F1,
|
|
28651
29005
|
// non-sierra
|
|
28652
29006
|
toTransactionVersion(
|
|
28653
|
-
this.getPreferredVersion(
|
|
29007
|
+
this.getPreferredVersion(ETransactionVersion4.F2, ETransactionVersion4.F3),
|
|
28654
29008
|
version
|
|
28655
29009
|
)
|
|
28656
29010
|
// sierra
|
|
@@ -28669,10 +29023,10 @@ var starknet = (() => {
|
|
|
28669
29023
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
28670
29024
|
...v3Details(details),
|
|
28671
29025
|
versions: [
|
|
28672
|
-
|
|
29026
|
+
ETransactionVersion4.V1,
|
|
28673
29027
|
// non-sierra
|
|
28674
29028
|
toTransactionVersion(
|
|
28675
|
-
this.getPreferredVersion(
|
|
29029
|
+
this.getPreferredVersion(ETransactionVersion4.V2, ETransactionVersion4.V3),
|
|
28676
29030
|
version
|
|
28677
29031
|
)
|
|
28678
29032
|
],
|
|
@@ -28691,7 +29045,7 @@ var starknet = (() => {
|
|
|
28691
29045
|
const calls = Array.isArray(transactions) ? transactions : [transactions];
|
|
28692
29046
|
const nonce = toBigInt(details.nonce ?? await this.getNonce());
|
|
28693
29047
|
const version = toTransactionVersion(
|
|
28694
|
-
this.getPreferredVersion(
|
|
29048
|
+
this.getPreferredVersion(ETransactionVersion4.V1, ETransactionVersion4.V3),
|
|
28695
29049
|
// TODO: does this depend on cairo version ?
|
|
28696
29050
|
details.version
|
|
28697
29051
|
);
|
|
@@ -28749,7 +29103,7 @@ var starknet = (() => {
|
|
|
28749
29103
|
const declareContractPayload = extractContractHashes(payload);
|
|
28750
29104
|
const { nonce, version: providedVersion } = details;
|
|
28751
29105
|
const version = toTransactionVersion(
|
|
28752
|
-
!isSierra(payload.contract) ?
|
|
29106
|
+
!isSierra(payload.contract) ? ETransactionVersion4.V1 : this.getPreferredVersion(ETransactionVersion4.V2, ETransactionVersion4.V3),
|
|
28753
29107
|
providedVersion
|
|
28754
29108
|
);
|
|
28755
29109
|
const estimate = await this.getUniversalSuggestedFee(
|
|
@@ -28813,7 +29167,7 @@ var starknet = (() => {
|
|
|
28813
29167
|
contractAddress: providedContractAddress
|
|
28814
29168
|
}, details = {}) {
|
|
28815
29169
|
const version = toTransactionVersion(
|
|
28816
|
-
this.getPreferredVersion(
|
|
29170
|
+
this.getPreferredVersion(ETransactionVersion4.V1, ETransactionVersion4.V3),
|
|
28817
29171
|
details.version
|
|
28818
29172
|
);
|
|
28819
29173
|
const nonce = ZERO;
|
|
@@ -28862,32 +29216,64 @@ var starknet = (() => {
|
|
|
28862
29216
|
async hashMessage(typedData) {
|
|
28863
29217
|
return getMessageHash(typedData, this.address);
|
|
28864
29218
|
}
|
|
28865
|
-
async verifyMessageHash(hash3, signature) {
|
|
28866
|
-
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
|
|
28874
|
-
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
28878
|
-
|
|
28879
|
-
|
|
28880
|
-
|
|
28881
|
-
|
|
28882
|
-
|
|
28883
|
-
|
|
29219
|
+
async verifyMessageHash(hash3, signature, signatureVerificationFunctionName, signatureVerificationResponse) {
|
|
29220
|
+
const knownSigVerificationFName = signatureVerificationFunctionName ? [signatureVerificationFunctionName] : ["isValidSignature", "is_valid_signature"];
|
|
29221
|
+
const knownSignatureResponse = signatureVerificationResponse || {
|
|
29222
|
+
okResponse: [
|
|
29223
|
+
// any non-nok response is true
|
|
29224
|
+
],
|
|
29225
|
+
nokResponse: [
|
|
29226
|
+
"0x0",
|
|
29227
|
+
// Devnet
|
|
29228
|
+
"0x00"
|
|
29229
|
+
// OpenZeppelin 0.7.0 to 0.9.0 invalid signature
|
|
29230
|
+
],
|
|
29231
|
+
error: [
|
|
29232
|
+
"argent/invalid-signature",
|
|
29233
|
+
// ArgentX 0.3.0 to 0.3.1
|
|
29234
|
+
"is invalid, with respect to the public key",
|
|
29235
|
+
// OpenZeppelin until 0.6.1, Braavos 0.0.11
|
|
29236
|
+
"INVALID_SIG"
|
|
29237
|
+
// Braavos 1.0.0
|
|
29238
|
+
]
|
|
29239
|
+
};
|
|
29240
|
+
let error2;
|
|
29241
|
+
for (const SigVerificationFName of knownSigVerificationFName) {
|
|
29242
|
+
try {
|
|
29243
|
+
const resp = await this.callContract({
|
|
29244
|
+
contractAddress: this.address,
|
|
29245
|
+
entrypoint: SigVerificationFName,
|
|
29246
|
+
calldata: CallData.compile({
|
|
29247
|
+
hash: toBigInt(hash3).toString(),
|
|
29248
|
+
signature: formatSignature(signature)
|
|
29249
|
+
})
|
|
29250
|
+
});
|
|
29251
|
+
if (knownSignatureResponse.nokResponse.includes(resp[0].toString())) {
|
|
29252
|
+
return false;
|
|
29253
|
+
}
|
|
29254
|
+
if (knownSignatureResponse.okResponse.length === 0 || knownSignatureResponse.okResponse.includes(resp[0].toString())) {
|
|
29255
|
+
return true;
|
|
29256
|
+
}
|
|
29257
|
+
throw Error("signatureVerificationResponse Error: response is not part of known responses");
|
|
29258
|
+
} catch (err2) {
|
|
29259
|
+
if (knownSignatureResponse.error.some(
|
|
29260
|
+
(errMessage) => err2.message.includes(errMessage)
|
|
29261
|
+
)) {
|
|
29262
|
+
return false;
|
|
29263
|
+
}
|
|
29264
|
+
error2 = err2;
|
|
28884
29265
|
}
|
|
28885
|
-
throw Error(`Signature verification request is rejected by the network: ${err2}`);
|
|
28886
29266
|
}
|
|
29267
|
+
throw Error(`Signature verification Error: ${error2}`);
|
|
28887
29268
|
}
|
|
28888
|
-
async verifyMessage(typedData, signature) {
|
|
29269
|
+
async verifyMessage(typedData, signature, signatureVerificationFunctionName, signatureVerificationResponse) {
|
|
28889
29270
|
const hash3 = await this.hashMessage(typedData);
|
|
28890
|
-
return this.verifyMessageHash(
|
|
29271
|
+
return this.verifyMessageHash(
|
|
29272
|
+
hash3,
|
|
29273
|
+
signature,
|
|
29274
|
+
signatureVerificationFunctionName,
|
|
29275
|
+
signatureVerificationResponse
|
|
29276
|
+
);
|
|
28891
29277
|
}
|
|
28892
29278
|
/*
|
|
28893
29279
|
* Support methods
|
|
@@ -28895,7 +29281,7 @@ var starknet = (() => {
|
|
|
28895
29281
|
async getUniversalSuggestedFee(version, { type, payload }, details) {
|
|
28896
29282
|
let maxFee = 0;
|
|
28897
29283
|
let resourceBounds = estimateFeeToBounds(ZERO);
|
|
28898
|
-
if (version ===
|
|
29284
|
+
if (version === ETransactionVersion4.V3) {
|
|
28899
29285
|
resourceBounds = details.resourceBounds ?? (await this.getSuggestedFee({ type, payload }, details)).resourceBounds;
|
|
28900
29286
|
} else {
|
|
28901
29287
|
maxFee = details.maxFee ?? (await this.getSuggestedFee({ type, payload }, details)).suggestedMaxFee;
|
|
@@ -28948,7 +29334,7 @@ var starknet = (() => {
|
|
|
28948
29334
|
async buildDeclarePayload(payload, details) {
|
|
28949
29335
|
const { classHash, contract, compiledClassHash } = extractContractHashes(payload);
|
|
28950
29336
|
const compressedCompiledContract = parseContract(contract);
|
|
28951
|
-
if (typeof compiledClassHash === "undefined" && (details.version ===
|
|
29337
|
+
if (typeof compiledClassHash === "undefined" && (details.version === ETransactionVersion32.F3 || details.version === ETransactionVersion32.V3)) {
|
|
28952
29338
|
throw Error("V3 Transaction work with Cairo1 Contracts and require compiledClassHash");
|
|
28953
29339
|
}
|
|
28954
29340
|
const signature = !details.skipValidate ? await this.signer.signDeclareTransaction({
|
|
@@ -29101,7 +29487,6 @@ var starknet = (() => {
|
|
|
29101
29487
|
var connect_exports = {};
|
|
29102
29488
|
__export(connect_exports, {
|
|
29103
29489
|
addDeclareTransaction: () => addDeclareTransaction,
|
|
29104
|
-
addDeployAccountTransaction: () => addDeployAccountTransaction,
|
|
29105
29490
|
addInvokeTransaction: () => addInvokeTransaction,
|
|
29106
29491
|
addStarknetChain: () => addStarknetChain,
|
|
29107
29492
|
deploymentData: () => deploymentData,
|
|
@@ -29115,11 +29500,11 @@ var starknet = (() => {
|
|
|
29115
29500
|
switchStarknetChain: () => switchStarknetChain,
|
|
29116
29501
|
watchAsset: () => watchAsset
|
|
29117
29502
|
});
|
|
29118
|
-
function requestAccounts(swo,
|
|
29503
|
+
function requestAccounts(swo, silent_mode = false) {
|
|
29119
29504
|
return swo.request({
|
|
29120
29505
|
type: "wallet_requestAccounts",
|
|
29121
29506
|
params: {
|
|
29122
|
-
|
|
29507
|
+
silent_mode
|
|
29123
29508
|
}
|
|
29124
29509
|
});
|
|
29125
29510
|
}
|
|
@@ -29154,30 +29539,24 @@ var starknet = (() => {
|
|
|
29154
29539
|
}
|
|
29155
29540
|
function addInvokeTransaction(swo, params) {
|
|
29156
29541
|
return swo.request({
|
|
29157
|
-
type: "
|
|
29542
|
+
type: "wallet_addInvokeTransaction",
|
|
29158
29543
|
params
|
|
29159
29544
|
});
|
|
29160
29545
|
}
|
|
29161
29546
|
function addDeclareTransaction(swo, params) {
|
|
29162
29547
|
return swo.request({
|
|
29163
|
-
type: "
|
|
29164
|
-
params
|
|
29165
|
-
});
|
|
29166
|
-
}
|
|
29167
|
-
function addDeployAccountTransaction(swo, params) {
|
|
29168
|
-
return swo.request({
|
|
29169
|
-
type: "starknet_addDeployAccountTransaction",
|
|
29548
|
+
type: "wallet_addDeclareTransaction",
|
|
29170
29549
|
params
|
|
29171
29550
|
});
|
|
29172
29551
|
}
|
|
29173
29552
|
function signMessage(swo, typedData) {
|
|
29174
29553
|
return swo.request({
|
|
29175
|
-
type: "
|
|
29554
|
+
type: "wallet_signTypedData",
|
|
29176
29555
|
params: typedData
|
|
29177
29556
|
});
|
|
29178
29557
|
}
|
|
29179
29558
|
function supportedSpecs(swo) {
|
|
29180
|
-
return swo.request({ type: "
|
|
29559
|
+
return swo.request({ type: "wallet_supportedSpecs" });
|
|
29181
29560
|
}
|
|
29182
29561
|
function onAccountChange(swo, callback) {
|
|
29183
29562
|
swo.on("accountsChanged", callback);
|
|
@@ -29206,7 +29585,7 @@ var starknet = (() => {
|
|
|
29206
29585
|
walletProvider.request({
|
|
29207
29586
|
type: "wallet_requestAccounts",
|
|
29208
29587
|
params: {
|
|
29209
|
-
|
|
29588
|
+
silent_mode: false
|
|
29210
29589
|
}
|
|
29211
29590
|
}).then((res) => {
|
|
29212
29591
|
this.address = res[0].toLowerCase();
|
|
@@ -29247,7 +29626,7 @@ var starknet = (() => {
|
|
|
29247
29626
|
const { contractAddress, entrypoint, calldata } = it;
|
|
29248
29627
|
return {
|
|
29249
29628
|
contract_address: contractAddress,
|
|
29250
|
-
entrypoint,
|
|
29629
|
+
entry_point: entrypoint,
|
|
29251
29630
|
calldata
|
|
29252
29631
|
};
|
|
29253
29632
|
});
|
|
@@ -29280,14 +29659,6 @@ var starknet = (() => {
|
|
|
29280
29659
|
contract_address: addresses
|
|
29281
29660
|
};
|
|
29282
29661
|
}
|
|
29283
|
-
deployAccount(payload) {
|
|
29284
|
-
const params = {
|
|
29285
|
-
contract_address_salt: payload.addressSalt?.toString() || "0",
|
|
29286
|
-
constructor_calldata: payload.constructorCalldata ? CallData.compile(payload.constructorCalldata) : [],
|
|
29287
|
-
class_hash: payload.classHash
|
|
29288
|
-
};
|
|
29289
|
-
return addDeployAccountTransaction(this.walletProvider, params);
|
|
29290
|
-
}
|
|
29291
29662
|
signMessage(typedData) {
|
|
29292
29663
|
return signMessage(this.walletProvider, typedData);
|
|
29293
29664
|
}
|
|
@@ -29307,7 +29678,7 @@ var starknet = (() => {
|
|
|
29307
29678
|
abiEntryMod.name = entryName;
|
|
29308
29679
|
return {
|
|
29309
29680
|
...acc,
|
|
29310
|
-
[addHexPrefix(
|
|
29681
|
+
[addHexPrefix(esm_exports2.keccak(utf8ToArray(entryName)).toString(16))]: abiEntryMod
|
|
29311
29682
|
};
|
|
29312
29683
|
}, {});
|
|
29313
29684
|
}
|
|
@@ -29951,6 +30322,9 @@ tough-cookie/lib/cookie.js:
|
|
|
29951
30322
|
@noble/hashes/esm/utils.js:
|
|
29952
30323
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
29953
30324
|
|
|
30325
|
+
@noble/hashes/esm/utils.js:
|
|
30326
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
30327
|
+
|
|
29954
30328
|
@noble/curves/esm/abstract/utils.js:
|
|
29955
30329
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
29956
30330
|
|
|
@@ -29984,9 +30358,6 @@ tough-cookie/lib/cookie.js:
|
|
|
29984
30358
|
pako/dist/pako.esm.mjs:
|
|
29985
30359
|
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
|
|
29986
30360
|
|
|
29987
|
-
@noble/hashes/esm/utils.js:
|
|
29988
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
29989
|
-
|
|
29990
30361
|
@noble/curves/esm/_shortw_utils.js:
|
|
29991
30362
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
29992
30363
|
|