starknet 6.13.0 → 6.14.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 +12 -0
- package/dist/index.d.ts +205 -185
- package/dist/index.global.js +358 -334
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +358 -334
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +358 -334
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -12827,76 +12827,65 @@ var starknet = (() => {
|
|
|
12827
12827
|
var components_exports = {};
|
|
12828
12828
|
|
|
12829
12829
|
// src/types/api/rpcspec_0_6/nonspec.ts
|
|
12830
|
-
var ETransactionType =
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
}
|
|
12855
|
-
var
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
ETransactionVersion24["V2"] = "0x2";
|
|
12890
|
-
ETransactionVersion24["F0"] = "0x100000000000000000000000000000000";
|
|
12891
|
-
ETransactionVersion24["F1"] = "0x100000000000000000000000000000001";
|
|
12892
|
-
ETransactionVersion24["F2"] = "0x100000000000000000000000000000002";
|
|
12893
|
-
return ETransactionVersion24;
|
|
12894
|
-
})(ETransactionVersion2 || {});
|
|
12895
|
-
var ETransactionVersion3 = /* @__PURE__ */ ((ETransactionVersion34) => {
|
|
12896
|
-
ETransactionVersion34["V3"] = "0x3";
|
|
12897
|
-
ETransactionVersion34["F3"] = "0x100000000000000000000000000000003";
|
|
12898
|
-
return ETransactionVersion34;
|
|
12899
|
-
})(ETransactionVersion3 || {});
|
|
12830
|
+
var ETransactionType = {
|
|
12831
|
+
DECLARE: "DECLARE",
|
|
12832
|
+
DEPLOY: "DEPLOY",
|
|
12833
|
+
DEPLOY_ACCOUNT: "DEPLOY_ACCOUNT",
|
|
12834
|
+
INVOKE: "INVOKE",
|
|
12835
|
+
L1_HANDLER: "L1_HANDLER"
|
|
12836
|
+
};
|
|
12837
|
+
var ESimulationFlag = {
|
|
12838
|
+
SKIP_VALIDATE: "SKIP_VALIDATE",
|
|
12839
|
+
SKIP_FEE_CHARGE: "SKIP_FEE_CHARGE"
|
|
12840
|
+
};
|
|
12841
|
+
var ETransactionStatus = {
|
|
12842
|
+
RECEIVED: "RECEIVED",
|
|
12843
|
+
REJECTED: "REJECTED",
|
|
12844
|
+
ACCEPTED_ON_L2: "ACCEPTED_ON_L2",
|
|
12845
|
+
ACCEPTED_ON_L1: "ACCEPTED_ON_L1"
|
|
12846
|
+
};
|
|
12847
|
+
var ETransactionFinalityStatus = {
|
|
12848
|
+
ACCEPTED_ON_L2: "ACCEPTED_ON_L2",
|
|
12849
|
+
ACCEPTED_ON_L1: "ACCEPTED_ON_L1"
|
|
12850
|
+
};
|
|
12851
|
+
var ETransactionExecutionStatus = {
|
|
12852
|
+
SUCCEEDED: "SUCCEEDED",
|
|
12853
|
+
REVERTED: "REVERTED"
|
|
12854
|
+
};
|
|
12855
|
+
var EBlockTag = {
|
|
12856
|
+
PENDING: "pending",
|
|
12857
|
+
LATEST: "latest"
|
|
12858
|
+
};
|
|
12859
|
+
var EDataAvailabilityMode = {
|
|
12860
|
+
L1: "L1",
|
|
12861
|
+
L2: "L2"
|
|
12862
|
+
};
|
|
12863
|
+
var EDAMode = {
|
|
12864
|
+
L1: 0,
|
|
12865
|
+
L2: 1
|
|
12866
|
+
};
|
|
12867
|
+
var ETransactionVersion = {
|
|
12868
|
+
V0: "0x0",
|
|
12869
|
+
V1: "0x1",
|
|
12870
|
+
V2: "0x2",
|
|
12871
|
+
V3: "0x3",
|
|
12872
|
+
F0: "0x100000000000000000000000000000000",
|
|
12873
|
+
F1: "0x100000000000000000000000000000001",
|
|
12874
|
+
F2: "0x100000000000000000000000000000002",
|
|
12875
|
+
F3: "0x100000000000000000000000000000003"
|
|
12876
|
+
};
|
|
12877
|
+
var ETransactionVersion2 = {
|
|
12878
|
+
V0: "0x0",
|
|
12879
|
+
V1: "0x1",
|
|
12880
|
+
V2: "0x2",
|
|
12881
|
+
F0: "0x100000000000000000000000000000000",
|
|
12882
|
+
F1: "0x100000000000000000000000000000001",
|
|
12883
|
+
F2: "0x100000000000000000000000000000002"
|
|
12884
|
+
};
|
|
12885
|
+
var ETransactionVersion3 = {
|
|
12886
|
+
V3: "0x3",
|
|
12887
|
+
F3: "0x100000000000000000000000000000003"
|
|
12888
|
+
};
|
|
12900
12889
|
|
|
12901
12890
|
// node_modules/starknet-types-07/dist/esm/index.js
|
|
12902
12891
|
var esm_exports = {};
|
|
@@ -13392,79 +13381,71 @@ var starknet = (() => {
|
|
|
13392
13381
|
});
|
|
13393
13382
|
|
|
13394
13383
|
// src/types/calldata.ts
|
|
13395
|
-
var ValidateType =
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
}
|
|
13411
|
-
var Literal =
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
})(Literal || {});
|
|
13384
|
+
var ValidateType = {
|
|
13385
|
+
DEPLOY: "DEPLOY",
|
|
13386
|
+
CALL: "CALL",
|
|
13387
|
+
INVOKE: "INVOKE"
|
|
13388
|
+
};
|
|
13389
|
+
var Uint = {
|
|
13390
|
+
u8: "core::integer::u8",
|
|
13391
|
+
u16: "core::integer::u16",
|
|
13392
|
+
u32: "core::integer::u32",
|
|
13393
|
+
u64: "core::integer::u64",
|
|
13394
|
+
u128: "core::integer::u128",
|
|
13395
|
+
u256: "core::integer::u256",
|
|
13396
|
+
// This one is struct
|
|
13397
|
+
u512: "core::integer::u512"
|
|
13398
|
+
// This one is struct
|
|
13399
|
+
};
|
|
13400
|
+
var Literal = {
|
|
13401
|
+
ClassHash: "core::starknet::class_hash::ClassHash",
|
|
13402
|
+
ContractAddress: "core::starknet::contract_address::ContractAddress",
|
|
13403
|
+
Secp256k1Point: "core::starknet::secp256k1::Secp256k1Point"
|
|
13404
|
+
};
|
|
13417
13405
|
|
|
13418
13406
|
// src/types/lib/contract/index.ts
|
|
13419
|
-
var EntryPointType =
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
})(EntryPointType || {});
|
|
13407
|
+
var EntryPointType = {
|
|
13408
|
+
EXTERNAL: "EXTERNAL",
|
|
13409
|
+
L1_HANDLER: "L1_HANDLER",
|
|
13410
|
+
CONSTRUCTOR: "CONSTRUCTOR"
|
|
13411
|
+
};
|
|
13425
13412
|
|
|
13426
13413
|
// src/types/lib/index.ts
|
|
13427
|
-
var TransactionType =
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
})(BlockStatus || {});
|
|
13463
|
-
var BlockTag = /* @__PURE__ */ ((BlockTag2) => {
|
|
13464
|
-
BlockTag2["PENDING"] = "pending";
|
|
13465
|
-
BlockTag2["LATEST"] = "latest";
|
|
13466
|
-
return BlockTag2;
|
|
13467
|
-
})(BlockTag || {});
|
|
13414
|
+
var TransactionType = {
|
|
13415
|
+
DECLARE: "DECLARE",
|
|
13416
|
+
DEPLOY: "DEPLOY",
|
|
13417
|
+
DEPLOY_ACCOUNT: "DEPLOY_ACCOUNT",
|
|
13418
|
+
INVOKE: "INVOKE_FUNCTION"
|
|
13419
|
+
};
|
|
13420
|
+
var TransactionStatus = {
|
|
13421
|
+
NOT_RECEIVED: "NOT_RECEIVED",
|
|
13422
|
+
RECEIVED: "RECEIVED",
|
|
13423
|
+
ACCEPTED_ON_L2: "ACCEPTED_ON_L2",
|
|
13424
|
+
ACCEPTED_ON_L1: "ACCEPTED_ON_L1",
|
|
13425
|
+
REJECTED: "REJECTED",
|
|
13426
|
+
REVERTED: "REVERTED"
|
|
13427
|
+
};
|
|
13428
|
+
var TransactionFinalityStatus = {
|
|
13429
|
+
NOT_RECEIVED: "NOT_RECEIVED",
|
|
13430
|
+
RECEIVED: "RECEIVED",
|
|
13431
|
+
ACCEPTED_ON_L2: "ACCEPTED_ON_L2",
|
|
13432
|
+
ACCEPTED_ON_L1: "ACCEPTED_ON_L1"
|
|
13433
|
+
};
|
|
13434
|
+
var TransactionExecutionStatus = {
|
|
13435
|
+
REJECTED: "REJECTED",
|
|
13436
|
+
REVERTED: "REVERTED",
|
|
13437
|
+
SUCCEEDED: "SUCCEEDED"
|
|
13438
|
+
};
|
|
13439
|
+
var BlockStatus = {
|
|
13440
|
+
PENDING: "PENDING",
|
|
13441
|
+
ACCEPTED_ON_L1: "ACCEPTED_ON_L1",
|
|
13442
|
+
ACCEPTED_ON_L2: "ACCEPTED_ON_L2",
|
|
13443
|
+
REJECTED: "REJECTED"
|
|
13444
|
+
};
|
|
13445
|
+
var BlockTag = {
|
|
13446
|
+
PENDING: "pending",
|
|
13447
|
+
LATEST: "latest"
|
|
13448
|
+
};
|
|
13468
13449
|
|
|
13469
13450
|
// src/types/outsideExecution.ts
|
|
13470
13451
|
var OutsideExecutionTypesV1 = {
|
|
@@ -17370,19 +17351,18 @@ var starknet = (() => {
|
|
|
17370
17351
|
};
|
|
17371
17352
|
|
|
17372
17353
|
// src/utils/calldata/enum/CairoOption.ts
|
|
17373
|
-
var CairoOptionVariant =
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
})(CairoOptionVariant || {});
|
|
17354
|
+
var CairoOptionVariant = {
|
|
17355
|
+
Some: 0,
|
|
17356
|
+
None: 1
|
|
17357
|
+
};
|
|
17378
17358
|
var CairoOption = class {
|
|
17379
17359
|
Some;
|
|
17380
17360
|
None;
|
|
17381
17361
|
constructor(variant, someContent) {
|
|
17382
|
-
if (!(variant in CairoOptionVariant)) {
|
|
17362
|
+
if (!(variant in Object.values(CairoOptionVariant))) {
|
|
17383
17363
|
throw new Error("Wrong variant : should be CairoOptionVariant.Some or .None.");
|
|
17384
17364
|
}
|
|
17385
|
-
if (variant ===
|
|
17365
|
+
if (variant === CairoOptionVariant.Some) {
|
|
17386
17366
|
if (typeof someContent === "undefined") {
|
|
17387
17367
|
throw new Error(
|
|
17388
17368
|
'The creation of a Cairo Option with "Some" variant needs a content as input.'
|
|
@@ -17423,19 +17403,18 @@ var starknet = (() => {
|
|
|
17423
17403
|
};
|
|
17424
17404
|
|
|
17425
17405
|
// src/utils/calldata/enum/CairoResult.ts
|
|
17426
|
-
var CairoResultVariant =
|
|
17427
|
-
|
|
17428
|
-
|
|
17429
|
-
|
|
17430
|
-
})(CairoResultVariant || {});
|
|
17406
|
+
var CairoResultVariant = {
|
|
17407
|
+
Ok: 0,
|
|
17408
|
+
Err: 1
|
|
17409
|
+
};
|
|
17431
17410
|
var CairoResult = class {
|
|
17432
17411
|
Ok;
|
|
17433
17412
|
Err;
|
|
17434
17413
|
constructor(variant, resultContent) {
|
|
17435
|
-
if (!(variant in CairoResultVariant)) {
|
|
17414
|
+
if (!(variant in Object.values(CairoResultVariant))) {
|
|
17436
17415
|
throw new Error("Wrong variant : should be CairoResultVariant.Ok or .Err.");
|
|
17437
17416
|
}
|
|
17438
|
-
if (variant ===
|
|
17417
|
+
if (variant === CairoResultVariant.Ok) {
|
|
17439
17418
|
this.Ok = resultContent;
|
|
17440
17419
|
this.Err = void 0;
|
|
17441
17420
|
} else {
|
|
@@ -17822,12 +17801,12 @@ var starknet = (() => {
|
|
|
17822
17801
|
);
|
|
17823
17802
|
if (unorderedResult.isOk()) {
|
|
17824
17803
|
return new CairoResult(
|
|
17825
|
-
|
|
17804
|
+
CairoResultVariant.Ok,
|
|
17826
17805
|
orderInput(unorderedObject2.unwrap(), resultOkType)
|
|
17827
17806
|
);
|
|
17828
17807
|
}
|
|
17829
17808
|
return new CairoResult(
|
|
17830
|
-
|
|
17809
|
+
CairoResultVariant.Err,
|
|
17831
17810
|
orderInput(unorderedObject2.unwrap(), resultErrType)
|
|
17832
17811
|
);
|
|
17833
17812
|
}
|
|
@@ -17839,11 +17818,11 @@ var starknet = (() => {
|
|
|
17839
17818
|
);
|
|
17840
17819
|
if (unorderedOption.isSome()) {
|
|
17841
17820
|
return new CairoOption(
|
|
17842
|
-
|
|
17821
|
+
CairoOptionVariant.Some,
|
|
17843
17822
|
orderInput(unorderedOption.unwrap(), resultSomeType)
|
|
17844
17823
|
);
|
|
17845
17824
|
}
|
|
17846
|
-
return new CairoOption(
|
|
17825
|
+
return new CairoOption(CairoOptionVariant.None, {});
|
|
17847
17826
|
}
|
|
17848
17827
|
const unorderedCustomEnum = unorderedObject2;
|
|
17849
17828
|
const variants = Object.entries(unorderedCustomEnum.variant);
|
|
@@ -17978,7 +17957,7 @@ var starknet = (() => {
|
|
|
17978
17957
|
}
|
|
17979
17958
|
const typeVariantSome = listTypeVariant2.type;
|
|
17980
17959
|
if (typeVariantSome === "()") {
|
|
17981
|
-
return
|
|
17960
|
+
return CairoOptionVariant.Some.toString();
|
|
17982
17961
|
}
|
|
17983
17962
|
const parsedParameter2 = parseCalldataValue(
|
|
17984
17963
|
myOption.unwrap(),
|
|
@@ -17987,11 +17966,11 @@ var starknet = (() => {
|
|
|
17987
17966
|
enums
|
|
17988
17967
|
);
|
|
17989
17968
|
if (Array.isArray(parsedParameter2)) {
|
|
17990
|
-
return [
|
|
17969
|
+
return [CairoOptionVariant.Some.toString(), ...parsedParameter2];
|
|
17991
17970
|
}
|
|
17992
|
-
return [
|
|
17971
|
+
return [CairoOptionVariant.Some.toString(), parsedParameter2];
|
|
17993
17972
|
}
|
|
17994
|
-
return
|
|
17973
|
+
return CairoOptionVariant.None.toString();
|
|
17995
17974
|
}
|
|
17996
17975
|
if (isTypeResult(type)) {
|
|
17997
17976
|
const myResult = element;
|
|
@@ -18002,7 +17981,7 @@ var starknet = (() => {
|
|
|
18002
17981
|
}
|
|
18003
17982
|
const typeVariantOk = listTypeVariant3.type;
|
|
18004
17983
|
if (typeVariantOk === "()") {
|
|
18005
|
-
return
|
|
17984
|
+
return CairoResultVariant.Ok.toString();
|
|
18006
17985
|
}
|
|
18007
17986
|
const parsedParameter3 = parseCalldataValue(
|
|
18008
17987
|
myResult.unwrap(),
|
|
@@ -18011,9 +17990,9 @@ var starknet = (() => {
|
|
|
18011
17990
|
enums
|
|
18012
17991
|
);
|
|
18013
17992
|
if (Array.isArray(parsedParameter3)) {
|
|
18014
|
-
return [
|
|
17993
|
+
return [CairoResultVariant.Ok.toString(), ...parsedParameter3];
|
|
18015
17994
|
}
|
|
18016
|
-
return [
|
|
17995
|
+
return [CairoResultVariant.Ok.toString(), parsedParameter3];
|
|
18017
17996
|
}
|
|
18018
17997
|
const listTypeVariant2 = variants.find((variant) => variant.name === "Err");
|
|
18019
17998
|
if (typeof listTypeVariant2 === "undefined") {
|
|
@@ -18021,13 +18000,13 @@ var starknet = (() => {
|
|
|
18021
18000
|
}
|
|
18022
18001
|
const typeVariantErr = listTypeVariant2.type;
|
|
18023
18002
|
if (typeVariantErr === "()") {
|
|
18024
|
-
return
|
|
18003
|
+
return CairoResultVariant.Err.toString();
|
|
18025
18004
|
}
|
|
18026
18005
|
const parsedParameter2 = parseCalldataValue(myResult.unwrap(), typeVariantErr, structs, enums);
|
|
18027
18006
|
if (Array.isArray(parsedParameter2)) {
|
|
18028
|
-
return [
|
|
18007
|
+
return [CairoResultVariant.Err.toString(), ...parsedParameter2];
|
|
18029
18008
|
}
|
|
18030
|
-
return [
|
|
18009
|
+
return [CairoResultVariant.Err.toString(), parsedParameter2];
|
|
18031
18010
|
}
|
|
18032
18011
|
const myEnum = element;
|
|
18033
18012
|
const activeVariant = myEnum.activeVariant();
|
|
@@ -18192,12 +18171,12 @@ var starknet = (() => {
|
|
|
18192
18171
|
return acc;
|
|
18193
18172
|
}, {});
|
|
18194
18173
|
if (element.type.startsWith("core::option::Option")) {
|
|
18195
|
-
const content = variantNum ===
|
|
18174
|
+
const content = variantNum === CairoOptionVariant.Some ? rawEnum.Some : void 0;
|
|
18196
18175
|
return new CairoOption(variantNum, content);
|
|
18197
18176
|
}
|
|
18198
18177
|
if (element.type.startsWith("core::result::Result")) {
|
|
18199
18178
|
let content;
|
|
18200
|
-
if (variantNum ===
|
|
18179
|
+
if (variantNum === CairoResultVariant.Ok) {
|
|
18201
18180
|
content = rawEnum.Ok;
|
|
18202
18181
|
} else {
|
|
18203
18182
|
content = rawEnum.Err;
|
|
@@ -18302,70 +18281,70 @@ var starknet = (() => {
|
|
|
18302
18281
|
);
|
|
18303
18282
|
let param;
|
|
18304
18283
|
switch (input.type) {
|
|
18305
|
-
case
|
|
18284
|
+
case Uint.u256:
|
|
18306
18285
|
param = new CairoUint256(parameter).toBigInt();
|
|
18307
18286
|
break;
|
|
18308
|
-
case
|
|
18287
|
+
case Uint.u512:
|
|
18309
18288
|
param = new CairoUint512(parameter).toBigInt();
|
|
18310
18289
|
break;
|
|
18311
18290
|
default:
|
|
18312
18291
|
param = toBigInt(parameter);
|
|
18313
18292
|
}
|
|
18314
18293
|
switch (input.type) {
|
|
18315
|
-
case
|
|
18294
|
+
case Uint.u8:
|
|
18316
18295
|
assert(
|
|
18317
18296
|
param >= 0n && param <= 255n,
|
|
18318
18297
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0 - 255]`
|
|
18319
18298
|
);
|
|
18320
18299
|
break;
|
|
18321
|
-
case
|
|
18300
|
+
case Uint.u16:
|
|
18322
18301
|
assert(
|
|
18323
18302
|
param >= 0n && param <= 65535n,
|
|
18324
18303
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 65535]`
|
|
18325
18304
|
);
|
|
18326
18305
|
break;
|
|
18327
|
-
case
|
|
18306
|
+
case Uint.u32:
|
|
18328
18307
|
assert(
|
|
18329
18308
|
param >= 0n && param <= 4294967295n,
|
|
18330
18309
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 4294967295]`
|
|
18331
18310
|
);
|
|
18332
18311
|
break;
|
|
18333
|
-
case
|
|
18312
|
+
case Uint.u64:
|
|
18334
18313
|
assert(
|
|
18335
18314
|
param >= 0n && param <= 2n ** 64n - 1n,
|
|
18336
18315
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^64-1]`
|
|
18337
18316
|
);
|
|
18338
18317
|
break;
|
|
18339
|
-
case
|
|
18318
|
+
case Uint.u128:
|
|
18340
18319
|
assert(
|
|
18341
18320
|
param >= 0n && param <= 2n ** 128n - 1n,
|
|
18342
18321
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^128-1]`
|
|
18343
18322
|
);
|
|
18344
18323
|
break;
|
|
18345
|
-
case
|
|
18324
|
+
case Uint.u256:
|
|
18346
18325
|
assert(
|
|
18347
18326
|
param >= 0n && param <= 2n ** 256n - 1n,
|
|
18348
18327
|
`Validate: arg ${input.name} is ${input.type} 0 - 2^256-1`
|
|
18349
18328
|
);
|
|
18350
18329
|
break;
|
|
18351
|
-
case
|
|
18330
|
+
case Uint.u512:
|
|
18352
18331
|
assert(CairoUint512.is(param), `Validate: arg ${input.name} is ${input.type} 0 - 2^512-1`);
|
|
18353
18332
|
break;
|
|
18354
|
-
case
|
|
18333
|
+
case Literal.ClassHash:
|
|
18355
18334
|
assert(
|
|
18356
18335
|
// from : https://github.com/starkware-libs/starknet-specs/blob/29bab650be6b1847c92d4461d4c33008b5e50b1a/api/starknet_api_openrpc.json#L1670
|
|
18357
18336
|
param >= 0n && param <= 2n ** 252n - 1n,
|
|
18358
18337
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^252-1]`
|
|
18359
18338
|
);
|
|
18360
18339
|
break;
|
|
18361
|
-
case
|
|
18340
|
+
case Literal.ContractAddress:
|
|
18362
18341
|
assert(
|
|
18363
18342
|
// from : https://github.com/starkware-libs/starknet-specs/blob/29bab650be6b1847c92d4461d4c33008b5e50b1a/api/starknet_api_openrpc.json#L1245
|
|
18364
18343
|
param >= 0n && param <= 2n ** 252n - 1n,
|
|
18365
18344
|
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^252-1]`
|
|
18366
18345
|
);
|
|
18367
18346
|
break;
|
|
18368
|
-
case
|
|
18347
|
+
case Literal.Secp256k1Point: {
|
|
18369
18348
|
assert(
|
|
18370
18349
|
param >= 0n && param <= 2n ** 512n - 1n,
|
|
18371
18350
|
`Validate: arg ${input.name} must be ${input.type} : a 512 bits number.`
|
|
@@ -18383,7 +18362,7 @@ var starknet = (() => {
|
|
|
18383
18362
|
);
|
|
18384
18363
|
};
|
|
18385
18364
|
var validateStruct = (parameter, input, structs) => {
|
|
18386
|
-
if (input.type ===
|
|
18365
|
+
if (input.type === Uint.u256 || input.type === Uint.u512) {
|
|
18387
18366
|
validateUint(parameter, input);
|
|
18388
18367
|
return;
|
|
18389
18368
|
}
|
|
@@ -18492,7 +18471,7 @@ var starknet = (() => {
|
|
|
18492
18471
|
case isTypeUint(baseType):
|
|
18493
18472
|
validateUint(parameter, { name: "", type: baseType });
|
|
18494
18473
|
switch (input.type) {
|
|
18495
|
-
case
|
|
18474
|
+
case Uint.u256:
|
|
18496
18475
|
assert(
|
|
18497
18476
|
new CairoUint256(parameter).toBigInt() > 0,
|
|
18498
18477
|
"Validate: value 0 is not authorized in NonZero uint256 type."
|
|
@@ -18575,19 +18554,19 @@ var starknet = (() => {
|
|
|
18575
18554
|
* @param args ArgsOrCalldata - arguments that are passed to the method
|
|
18576
18555
|
*/
|
|
18577
18556
|
validate(type, method, args = []) {
|
|
18578
|
-
if (type !==
|
|
18557
|
+
if (type !== ValidateType.DEPLOY) {
|
|
18579
18558
|
const invocableFunctionNames = this.abi.filter((abi) => {
|
|
18580
18559
|
if (abi.type !== "function") return false;
|
|
18581
18560
|
const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
|
|
18582
|
-
return type ===
|
|
18561
|
+
return type === ValidateType.INVOKE ? !isView : isView;
|
|
18583
18562
|
}).map((abi) => abi.name);
|
|
18584
18563
|
assert(
|
|
18585
18564
|
invocableFunctionNames.includes(method),
|
|
18586
|
-
`${type ===
|
|
18565
|
+
`${type === ValidateType.INVOKE ? "invocable" : "viewable"} method not found in abi`
|
|
18587
18566
|
);
|
|
18588
18567
|
}
|
|
18589
18568
|
const abiMethod = this.abi.find(
|
|
18590
|
-
(abi) => type ===
|
|
18569
|
+
(abi) => type === ValidateType.DEPLOY ? abi.name === method && abi.type === "constructor" : abi.name === method && abi.type === "function"
|
|
18591
18570
|
);
|
|
18592
18571
|
if (isNoConstructorValid(method, args, abiMethod)) {
|
|
18593
18572
|
return;
|
|
@@ -18664,14 +18643,14 @@ var starknet = (() => {
|
|
|
18664
18643
|
const keys = [...Object.getOwnPropertyNames(value), ...methodsKeys];
|
|
18665
18644
|
if (keys.includes("isSome") && keys.includes("isNone")) {
|
|
18666
18645
|
const myOption = value;
|
|
18667
|
-
const variantNb = myOption.isSome() ?
|
|
18646
|
+
const variantNb = myOption.isSome() ? CairoOptionVariant.Some : CairoOptionVariant.None;
|
|
18668
18647
|
if (myOption.isSome())
|
|
18669
18648
|
return getEntries({ 0: variantNb, 1: myOption.unwrap() }, `${prefix}${kk}.`);
|
|
18670
18649
|
return [[`${prefix}${kk}`, felt(variantNb)]];
|
|
18671
18650
|
}
|
|
18672
18651
|
if (keys.includes("isOk") && keys.includes("isErr")) {
|
|
18673
18652
|
const myResult = value;
|
|
18674
|
-
const variantNb = myResult.isOk() ?
|
|
18653
|
+
const variantNb = myResult.isOk() ? CairoResultVariant.Ok : CairoResultVariant.Err;
|
|
18675
18654
|
return getEntries({ 0: variantNb, 1: myResult.unwrap() }, `${prefix}${kk}.`);
|
|
18676
18655
|
}
|
|
18677
18656
|
if (keys.includes("variant") && keys.includes("activeVariant")) {
|
|
@@ -23933,7 +23912,7 @@ var starknet = (() => {
|
|
|
23933
23912
|
} else if (isNumber2(__identifier)) {
|
|
23934
23913
|
this.number = __identifier;
|
|
23935
23914
|
} else {
|
|
23936
|
-
this.tag =
|
|
23915
|
+
this.tag = BlockTag.PENDING;
|
|
23937
23916
|
}
|
|
23938
23917
|
if (isNumber2(this.number) && this.number < 0) {
|
|
23939
23918
|
throw TypeError(`Block number (${this.number}) can't be negative`);
|
|
@@ -24127,7 +24106,7 @@ var starknet = (() => {
|
|
|
24127
24106
|
// src/channel/rpc_0_6.ts
|
|
24128
24107
|
var defaultOptions = {
|
|
24129
24108
|
headers: { "Content-Type": "application/json" },
|
|
24130
|
-
blockIdentifier:
|
|
24109
|
+
blockIdentifier: BlockTag.PENDING,
|
|
24131
24110
|
retries: 200
|
|
24132
24111
|
};
|
|
24133
24112
|
var RpcChannel = class {
|
|
@@ -24621,7 +24600,7 @@ var starknet = (() => {
|
|
|
24621
24600
|
account_deployment_data: invocation.accountDeploymentData.map((it) => toHex(it))
|
|
24622
24601
|
};
|
|
24623
24602
|
}
|
|
24624
|
-
if (invocation.type ===
|
|
24603
|
+
if (invocation.type === TransactionType.INVOKE) {
|
|
24625
24604
|
return {
|
|
24626
24605
|
// v0 v1 v3
|
|
24627
24606
|
type: rpcspec_0_6_exports.ETransactionType.INVOKE,
|
|
@@ -24631,7 +24610,7 @@ var starknet = (() => {
|
|
|
24631
24610
|
...details
|
|
24632
24611
|
};
|
|
24633
24612
|
}
|
|
24634
|
-
if (invocation.type ===
|
|
24613
|
+
if (invocation.type === TransactionType.DECLARE) {
|
|
24635
24614
|
if (!isSierra(invocation.contract)) {
|
|
24636
24615
|
return {
|
|
24637
24616
|
type: invocation.type,
|
|
@@ -24654,7 +24633,7 @@ var starknet = (() => {
|
|
|
24654
24633
|
...details
|
|
24655
24634
|
};
|
|
24656
24635
|
}
|
|
24657
|
-
if (invocation.type ===
|
|
24636
|
+
if (invocation.type === TransactionType.DEPLOY_ACCOUNT) {
|
|
24658
24637
|
const { account_deployment_data, ...restDetails } = details;
|
|
24659
24638
|
return {
|
|
24660
24639
|
type: invocation.type,
|
|
@@ -24676,7 +24655,7 @@ var starknet = (() => {
|
|
|
24676
24655
|
});
|
|
24677
24656
|
var defaultOptions2 = {
|
|
24678
24657
|
headers: { "Content-Type": "application/json" },
|
|
24679
|
-
blockIdentifier:
|
|
24658
|
+
blockIdentifier: BlockTag.PENDING,
|
|
24680
24659
|
retries: 200
|
|
24681
24660
|
};
|
|
24682
24661
|
var RpcChannel2 = class {
|
|
@@ -25189,7 +25168,7 @@ var starknet = (() => {
|
|
|
25189
25168
|
account_deployment_data: invocation.accountDeploymentData.map((it) => toHex(it))
|
|
25190
25169
|
};
|
|
25191
25170
|
}
|
|
25192
|
-
if (invocation.type ===
|
|
25171
|
+
if (invocation.type === TransactionType.INVOKE) {
|
|
25193
25172
|
return {
|
|
25194
25173
|
// v0 v1 v3
|
|
25195
25174
|
type: esm_exports.ETransactionType.INVOKE,
|
|
@@ -25199,7 +25178,7 @@ var starknet = (() => {
|
|
|
25199
25178
|
...details
|
|
25200
25179
|
};
|
|
25201
25180
|
}
|
|
25202
|
-
if (invocation.type ===
|
|
25181
|
+
if (invocation.type === TransactionType.DECLARE) {
|
|
25203
25182
|
if (!isSierra(invocation.contract)) {
|
|
25204
25183
|
return {
|
|
25205
25184
|
type: invocation.type,
|
|
@@ -25222,7 +25201,7 @@ var starknet = (() => {
|
|
|
25222
25201
|
...details
|
|
25223
25202
|
};
|
|
25224
25203
|
}
|
|
25225
|
-
if (invocation.type ===
|
|
25204
|
+
if (invocation.type === TransactionType.DEPLOY_ACCOUNT) {
|
|
25226
25205
|
const { account_deployment_data, ...restDetails } = details;
|
|
25227
25206
|
return {
|
|
25228
25207
|
type: invocation.type,
|
|
@@ -25351,13 +25330,13 @@ var starknet = (() => {
|
|
|
25351
25330
|
return this.statusReceipt === "error";
|
|
25352
25331
|
}
|
|
25353
25332
|
static isSuccess(transactionReceipt) {
|
|
25354
|
-
return transactionReceipt.execution_status ===
|
|
25333
|
+
return transactionReceipt.execution_status === TransactionExecutionStatus.SUCCEEDED;
|
|
25355
25334
|
}
|
|
25356
25335
|
static isReverted(transactionReceipt) {
|
|
25357
|
-
return transactionReceipt.execution_status ===
|
|
25336
|
+
return transactionReceipt.execution_status === TransactionExecutionStatus.REVERTED;
|
|
25358
25337
|
}
|
|
25359
25338
|
static isRejected(transactionReceipt) {
|
|
25360
|
-
return transactionReceipt.status ===
|
|
25339
|
+
return transactionReceipt.status === TransactionExecutionStatus.REJECTED;
|
|
25361
25340
|
}
|
|
25362
25341
|
};
|
|
25363
25342
|
|
|
@@ -25848,9 +25827,9 @@ var starknet = (() => {
|
|
|
25848
25827
|
* ```
|
|
25849
25828
|
*/
|
|
25850
25829
|
async waitForBlock(blockIdentifier = "pending", retryInterval = 5e3) {
|
|
25851
|
-
if (blockIdentifier ===
|
|
25830
|
+
if (blockIdentifier === BlockTag.LATEST) return;
|
|
25852
25831
|
const currentBlock = await this.getBlockNumber();
|
|
25853
|
-
const targetBlock = blockIdentifier ===
|
|
25832
|
+
const targetBlock = blockIdentifier === BlockTag.PENDING ? currentBlock + 1 : Number(toHex(blockIdentifier));
|
|
25854
25833
|
if (targetBlock <= currentBlock) return;
|
|
25855
25834
|
const { retries } = this.channel;
|
|
25856
25835
|
let retriesCount = retries;
|
|
@@ -25906,7 +25885,7 @@ var starknet = (() => {
|
|
|
25906
25885
|
* Utility method, same result can be achieved using getBlockWithTxHashes(BlockTag.pending);
|
|
25907
25886
|
*/
|
|
25908
25887
|
async getPendingTransactions() {
|
|
25909
|
-
const { transactions } = await this.getBlockWithTxHashes(
|
|
25888
|
+
const { transactions } = await this.getBlockWithTxHashes(BlockTag.PENDING).then(
|
|
25910
25889
|
this.responseParser.parseGetBlockResponse
|
|
25911
25890
|
);
|
|
25912
25891
|
return Promise.all(transactions.map((it) => this.getTransactionByHash(it)));
|
|
@@ -25997,7 +25976,7 @@ var starknet = (() => {
|
|
|
25997
25976
|
return this.channel.getEstimateFee(
|
|
25998
25977
|
[
|
|
25999
25978
|
{
|
|
26000
|
-
type:
|
|
25979
|
+
type: TransactionType.INVOKE,
|
|
26001
25980
|
...invocation,
|
|
26002
25981
|
...invocationDetails
|
|
26003
25982
|
}
|
|
@@ -26009,7 +25988,7 @@ var starknet = (() => {
|
|
|
26009
25988
|
return this.channel.getEstimateFee(
|
|
26010
25989
|
[
|
|
26011
25990
|
{
|
|
26012
|
-
type:
|
|
25991
|
+
type: TransactionType.DECLARE,
|
|
26013
25992
|
...invocation,
|
|
26014
25993
|
...details
|
|
26015
25994
|
}
|
|
@@ -26021,7 +26000,7 @@ var starknet = (() => {
|
|
|
26021
26000
|
return this.channel.getEstimateFee(
|
|
26022
26001
|
[
|
|
26023
26002
|
{
|
|
26024
|
-
type:
|
|
26003
|
+
type: TransactionType.DEPLOY_ACCOUNT,
|
|
26025
26004
|
...invocation,
|
|
26026
26005
|
...details
|
|
26027
26006
|
}
|
|
@@ -26144,6 +26123,54 @@ var starknet = (() => {
|
|
|
26144
26123
|
}
|
|
26145
26124
|
throw Error(`Signature verification Error: ${error2}`);
|
|
26146
26125
|
}
|
|
26126
|
+
/**
|
|
26127
|
+
* Test if class is already declared from ContractClassIdentifier
|
|
26128
|
+
* Helper method using getClass
|
|
26129
|
+
* @param ContractClassIdentifier
|
|
26130
|
+
* @param blockIdentifier
|
|
26131
|
+
*/
|
|
26132
|
+
async isClassDeclared(contractClassIdentifier, blockIdentifier) {
|
|
26133
|
+
let classHash;
|
|
26134
|
+
if (!contractClassIdentifier.classHash && "contract" in contractClassIdentifier) {
|
|
26135
|
+
const hashes = extractContractHashes(contractClassIdentifier);
|
|
26136
|
+
classHash = hashes.classHash;
|
|
26137
|
+
} else if (contractClassIdentifier.classHash) {
|
|
26138
|
+
classHash = contractClassIdentifier.classHash;
|
|
26139
|
+
} else {
|
|
26140
|
+
throw Error("contractClassIdentifier type not satisfied");
|
|
26141
|
+
}
|
|
26142
|
+
try {
|
|
26143
|
+
const result = await this.getClass(classHash, blockIdentifier);
|
|
26144
|
+
return result instanceof Object;
|
|
26145
|
+
} catch (error2) {
|
|
26146
|
+
if (error2 instanceof LibraryError) {
|
|
26147
|
+
return false;
|
|
26148
|
+
}
|
|
26149
|
+
throw error2;
|
|
26150
|
+
}
|
|
26151
|
+
}
|
|
26152
|
+
/**
|
|
26153
|
+
* Build bulk invocations with auto-detect declared class
|
|
26154
|
+
* 1. Test if class is declared if not declare it preventing already declared class error and not declared class errors
|
|
26155
|
+
* 2. Order declarations first
|
|
26156
|
+
* @param invocations
|
|
26157
|
+
*/
|
|
26158
|
+
async prepareInvocations(invocations) {
|
|
26159
|
+
const bulk = [];
|
|
26160
|
+
for (const invocation of invocations) {
|
|
26161
|
+
if (invocation.type === TransactionType.DECLARE) {
|
|
26162
|
+
const isDeclared = await this.isClassDeclared(
|
|
26163
|
+
"payload" in invocation ? invocation.payload : invocation
|
|
26164
|
+
);
|
|
26165
|
+
if (!isDeclared) {
|
|
26166
|
+
bulk.unshift(invocation);
|
|
26167
|
+
}
|
|
26168
|
+
} else {
|
|
26169
|
+
bulk.push(invocation);
|
|
26170
|
+
}
|
|
26171
|
+
}
|
|
26172
|
+
return bulk;
|
|
26173
|
+
}
|
|
26147
26174
|
};
|
|
26148
26175
|
|
|
26149
26176
|
// node_modules/ts-mixer/dist/esm/index.js
|
|
@@ -26468,32 +26495,30 @@ var starknet = (() => {
|
|
|
26468
26495
|
}
|
|
26469
26496
|
return encoded;
|
|
26470
26497
|
}
|
|
26471
|
-
var StarknetIdContract =
|
|
26472
|
-
|
|
26473
|
-
|
|
26474
|
-
|
|
26475
|
-
})(StarknetIdContract || {});
|
|
26498
|
+
var StarknetIdContract = {
|
|
26499
|
+
MAINNET: "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",
|
|
26500
|
+
TESTNET_SEPOLIA: "0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"
|
|
26501
|
+
};
|
|
26476
26502
|
function getStarknetIdContract(chainId) {
|
|
26477
26503
|
switch (chainId) {
|
|
26478
26504
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
26479
|
-
return
|
|
26505
|
+
return StarknetIdContract.MAINNET;
|
|
26480
26506
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
26481
|
-
return
|
|
26507
|
+
return StarknetIdContract.TESTNET_SEPOLIA;
|
|
26482
26508
|
default:
|
|
26483
26509
|
throw new Error("Starknet.id is not yet deployed on this network");
|
|
26484
26510
|
}
|
|
26485
26511
|
}
|
|
26486
|
-
var StarknetIdIdentityContract =
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
})(StarknetIdIdentityContract || {});
|
|
26512
|
+
var StarknetIdIdentityContract = {
|
|
26513
|
+
MAINNET: "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",
|
|
26514
|
+
TESTNET_SEPOLIA: "0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"
|
|
26515
|
+
};
|
|
26491
26516
|
function getStarknetIdIdentityContract(chainId) {
|
|
26492
26517
|
switch (chainId) {
|
|
26493
26518
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
26494
|
-
return
|
|
26519
|
+
return StarknetIdIdentityContract.MAINNET;
|
|
26495
26520
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
26496
|
-
return
|
|
26521
|
+
return StarknetIdIdentityContract.TESTNET_SEPOLIA;
|
|
26497
26522
|
default:
|
|
26498
26523
|
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
26499
26524
|
}
|
|
@@ -26509,49 +26534,46 @@ var starknet = (() => {
|
|
|
26509
26534
|
throw new Error("Starknet.id multicall contract is not yet deployed on this network");
|
|
26510
26535
|
}
|
|
26511
26536
|
}
|
|
26512
|
-
var StarknetIdVerifierContract =
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
|
|
26516
|
-
})(StarknetIdVerifierContract || {});
|
|
26537
|
+
var StarknetIdVerifierContract = {
|
|
26538
|
+
MAINNET: "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",
|
|
26539
|
+
TESTNET_SEPOLIA: "0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"
|
|
26540
|
+
};
|
|
26517
26541
|
function getStarknetIdVerifierContract(chainId) {
|
|
26518
26542
|
switch (chainId) {
|
|
26519
26543
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
26520
|
-
return
|
|
26544
|
+
return StarknetIdVerifierContract.MAINNET;
|
|
26521
26545
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
26522
|
-
return
|
|
26546
|
+
return StarknetIdVerifierContract.TESTNET_SEPOLIA;
|
|
26523
26547
|
default:
|
|
26524
26548
|
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
26525
26549
|
}
|
|
26526
26550
|
}
|
|
26527
|
-
var StarknetIdPfpContract =
|
|
26528
|
-
|
|
26529
|
-
|
|
26530
|
-
|
|
26531
|
-
})(StarknetIdPfpContract || {});
|
|
26551
|
+
var StarknetIdPfpContract = {
|
|
26552
|
+
MAINNET: "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",
|
|
26553
|
+
TESTNET_SEPOLIA: "0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"
|
|
26554
|
+
};
|
|
26532
26555
|
function getStarknetIdPfpContract(chainId) {
|
|
26533
26556
|
switch (chainId) {
|
|
26534
26557
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
26535
|
-
return
|
|
26558
|
+
return StarknetIdPfpContract.MAINNET;
|
|
26536
26559
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
26537
|
-
return
|
|
26560
|
+
return StarknetIdPfpContract.TESTNET_SEPOLIA;
|
|
26538
26561
|
default:
|
|
26539
26562
|
throw new Error(
|
|
26540
26563
|
"Starknet.id profile picture verifier contract is not yet deployed on this network"
|
|
26541
26564
|
);
|
|
26542
26565
|
}
|
|
26543
26566
|
}
|
|
26544
|
-
var StarknetIdPopContract =
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
|
|
26548
|
-
})(StarknetIdPopContract || {});
|
|
26567
|
+
var StarknetIdPopContract = {
|
|
26568
|
+
MAINNET: "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",
|
|
26569
|
+
TESTNET_SEPOLIA: "0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"
|
|
26570
|
+
};
|
|
26549
26571
|
function getStarknetIdPopContract(chainId) {
|
|
26550
26572
|
switch (chainId) {
|
|
26551
26573
|
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
26552
|
-
return
|
|
26574
|
+
return StarknetIdPopContract.MAINNET;
|
|
26553
26575
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
26554
|
-
return
|
|
26576
|
+
return StarknetIdPopContract.TESTNET_SEPOLIA;
|
|
26555
26577
|
default:
|
|
26556
26578
|
throw new Error(
|
|
26557
26579
|
"Starknet.id proof of personhood verifier contract is not yet deployed on this network"
|
|
@@ -27239,81 +27261,6 @@ var starknet = (() => {
|
|
|
27239
27261
|
return pathBuff;
|
|
27240
27262
|
}
|
|
27241
27263
|
|
|
27242
|
-
// src/utils/outsideExecution.ts
|
|
27243
|
-
var outsideExecution_exports = {};
|
|
27244
|
-
__export(outsideExecution_exports, {
|
|
27245
|
-
buildExecuteFromOutsideCallData: () => buildExecuteFromOutsideCallData,
|
|
27246
|
-
getOutsideCall: () => getOutsideCall,
|
|
27247
|
-
getTypedData: () => getTypedData
|
|
27248
|
-
});
|
|
27249
|
-
function getOutsideCall(call) {
|
|
27250
|
-
const callData = call.calldata ?? [];
|
|
27251
|
-
const callDataCompiled = Array.isArray(callData) ? callData : CallData.compile(callData);
|
|
27252
|
-
return {
|
|
27253
|
-
to: call.contractAddress,
|
|
27254
|
-
selector: getSelectorFromName(call.entrypoint),
|
|
27255
|
-
calldata: callDataCompiled
|
|
27256
|
-
};
|
|
27257
|
-
}
|
|
27258
|
-
function callToTypedData(call, version) {
|
|
27259
|
-
const outsideCall = getOutsideCall(call);
|
|
27260
|
-
if (version === "1") {
|
|
27261
|
-
return {
|
|
27262
|
-
...outsideCall,
|
|
27263
|
-
calldata_len: outsideCall.calldata.length,
|
|
27264
|
-
calldata: outsideCall.calldata
|
|
27265
|
-
};
|
|
27266
|
-
}
|
|
27267
|
-
return {
|
|
27268
|
-
To: outsideCall.to,
|
|
27269
|
-
Selector: outsideCall.selector,
|
|
27270
|
-
Calldata: outsideCall.calldata
|
|
27271
|
-
};
|
|
27272
|
-
}
|
|
27273
|
-
function getDomain(chainId, version) {
|
|
27274
|
-
return {
|
|
27275
|
-
name: "Account.execute_from_outside",
|
|
27276
|
-
version,
|
|
27277
|
-
chainId,
|
|
27278
|
-
...version === "2" ? { revision: "1" } : {}
|
|
27279
|
-
};
|
|
27280
|
-
}
|
|
27281
|
-
function getTypedData(chainId, options, nonce, myCalls, version) {
|
|
27282
|
-
if (version === "1") {
|
|
27283
|
-
return {
|
|
27284
|
-
types: OutsideExecutionTypesV1,
|
|
27285
|
-
primaryType: "OutsideExecution",
|
|
27286
|
-
domain: getDomain(chainId, version),
|
|
27287
|
-
message: {
|
|
27288
|
-
...options,
|
|
27289
|
-
nonce,
|
|
27290
|
-
calls_len: myCalls.length,
|
|
27291
|
-
calls: myCalls.map((call) => callToTypedData(call, version))
|
|
27292
|
-
}
|
|
27293
|
-
};
|
|
27294
|
-
}
|
|
27295
|
-
return {
|
|
27296
|
-
types: OutsideExecutionTypesV2,
|
|
27297
|
-
primaryType: "OutsideExecution",
|
|
27298
|
-
domain: getDomain(chainId, version),
|
|
27299
|
-
message: {
|
|
27300
|
-
Caller: options.caller,
|
|
27301
|
-
Nonce: nonce,
|
|
27302
|
-
"Execute After": options.execute_after,
|
|
27303
|
-
"Execute Before": options.execute_before,
|
|
27304
|
-
Calls: myCalls.map((call) => callToTypedData(call, version))
|
|
27305
|
-
}
|
|
27306
|
-
};
|
|
27307
|
-
}
|
|
27308
|
-
function buildExecuteFromOutsideCallData(outsideTransaction) {
|
|
27309
|
-
const execution2 = outsideTransaction.outsideExecution;
|
|
27310
|
-
const formattedSignature = formatSignature(outsideTransaction.signature);
|
|
27311
|
-
return CallData.compile({
|
|
27312
|
-
outside_execution: execution2,
|
|
27313
|
-
signature: formattedSignature
|
|
27314
|
-
});
|
|
27315
|
-
}
|
|
27316
|
-
|
|
27317
27264
|
// src/utils/events/index.ts
|
|
27318
27265
|
var events_exports = {};
|
|
27319
27266
|
__export(events_exports, {
|
|
@@ -27453,6 +27400,81 @@ var starknet = (() => {
|
|
|
27453
27400
|
};
|
|
27454
27401
|
}
|
|
27455
27402
|
|
|
27403
|
+
// src/utils/outsideExecution.ts
|
|
27404
|
+
var outsideExecution_exports = {};
|
|
27405
|
+
__export(outsideExecution_exports, {
|
|
27406
|
+
buildExecuteFromOutsideCallData: () => buildExecuteFromOutsideCallData,
|
|
27407
|
+
getOutsideCall: () => getOutsideCall,
|
|
27408
|
+
getTypedData: () => getTypedData
|
|
27409
|
+
});
|
|
27410
|
+
function getOutsideCall(call) {
|
|
27411
|
+
const callData = call.calldata ?? [];
|
|
27412
|
+
const callDataCompiled = Array.isArray(callData) ? callData : CallData.compile(callData);
|
|
27413
|
+
return {
|
|
27414
|
+
to: call.contractAddress,
|
|
27415
|
+
selector: getSelectorFromName(call.entrypoint),
|
|
27416
|
+
calldata: callDataCompiled
|
|
27417
|
+
};
|
|
27418
|
+
}
|
|
27419
|
+
function callToTypedData(call, version) {
|
|
27420
|
+
const outsideCall = getOutsideCall(call);
|
|
27421
|
+
if (version === "1") {
|
|
27422
|
+
return {
|
|
27423
|
+
...outsideCall,
|
|
27424
|
+
calldata_len: outsideCall.calldata.length,
|
|
27425
|
+
calldata: outsideCall.calldata
|
|
27426
|
+
};
|
|
27427
|
+
}
|
|
27428
|
+
return {
|
|
27429
|
+
To: outsideCall.to,
|
|
27430
|
+
Selector: outsideCall.selector,
|
|
27431
|
+
Calldata: outsideCall.calldata
|
|
27432
|
+
};
|
|
27433
|
+
}
|
|
27434
|
+
function getDomain(chainId, version) {
|
|
27435
|
+
return {
|
|
27436
|
+
name: "Account.execute_from_outside",
|
|
27437
|
+
version,
|
|
27438
|
+
chainId,
|
|
27439
|
+
...version === "2" ? { revision: "1" } : {}
|
|
27440
|
+
};
|
|
27441
|
+
}
|
|
27442
|
+
function getTypedData(chainId, options, nonce, myCalls, version) {
|
|
27443
|
+
if (version === "1") {
|
|
27444
|
+
return {
|
|
27445
|
+
types: OutsideExecutionTypesV1,
|
|
27446
|
+
primaryType: "OutsideExecution",
|
|
27447
|
+
domain: getDomain(chainId, version),
|
|
27448
|
+
message: {
|
|
27449
|
+
...options,
|
|
27450
|
+
nonce,
|
|
27451
|
+
calls_len: myCalls.length,
|
|
27452
|
+
calls: myCalls.map((call) => callToTypedData(call, version))
|
|
27453
|
+
}
|
|
27454
|
+
};
|
|
27455
|
+
}
|
|
27456
|
+
return {
|
|
27457
|
+
types: OutsideExecutionTypesV2,
|
|
27458
|
+
primaryType: "OutsideExecution",
|
|
27459
|
+
domain: getDomain(chainId, version),
|
|
27460
|
+
message: {
|
|
27461
|
+
Caller: options.caller,
|
|
27462
|
+
Nonce: nonce,
|
|
27463
|
+
"Execute After": options.execute_after,
|
|
27464
|
+
"Execute Before": options.execute_before,
|
|
27465
|
+
Calls: myCalls.map((call) => callToTypedData(call, version))
|
|
27466
|
+
}
|
|
27467
|
+
};
|
|
27468
|
+
}
|
|
27469
|
+
function buildExecuteFromOutsideCallData(outsideTransaction) {
|
|
27470
|
+
const execution2 = outsideTransaction.outsideExecution;
|
|
27471
|
+
const formattedSignature = formatSignature(outsideTransaction.signature);
|
|
27472
|
+
return CallData.compile({
|
|
27473
|
+
outside_execution: execution2,
|
|
27474
|
+
signature: formattedSignature
|
|
27475
|
+
});
|
|
27476
|
+
}
|
|
27477
|
+
|
|
27456
27478
|
// src/utils/src5.ts
|
|
27457
27479
|
var src5_exports = {};
|
|
27458
27480
|
__export(src5_exports, {
|
|
@@ -27620,6 +27642,7 @@ var starknet = (() => {
|
|
|
27620
27642
|
return this.estimateInvokeFee(calls, details);
|
|
27621
27643
|
}
|
|
27622
27644
|
async estimateFeeBulk(invocations, details = {}) {
|
|
27645
|
+
if (!invocations.length) throw TypeError("Invocations should be non-empty array");
|
|
27623
27646
|
const { nonce, blockIdentifier, version, skipValidate } = details;
|
|
27624
27647
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
27625
27648
|
...v3Details(details),
|
|
@@ -27642,6 +27665,7 @@ var starknet = (() => {
|
|
|
27642
27665
|
});
|
|
27643
27666
|
}
|
|
27644
27667
|
async simulateTransaction(invocations, details = {}) {
|
|
27668
|
+
if (!invocations.length) throw TypeError("Invocations should be non-empty array");
|
|
27645
27669
|
const { nonce, blockIdentifier, skipValidate = true, skipExecute, version } = details;
|
|
27646
27670
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
27647
27671
|
...v3Details(details),
|
|
@@ -27674,7 +27698,7 @@ var starknet = (() => {
|
|
|
27674
27698
|
);
|
|
27675
27699
|
const estimate = await this.getUniversalSuggestedFee(
|
|
27676
27700
|
version,
|
|
27677
|
-
{ type:
|
|
27701
|
+
{ type: TransactionType.INVOKE, payload: transactions },
|
|
27678
27702
|
{
|
|
27679
27703
|
...details,
|
|
27680
27704
|
version
|
|
@@ -27732,7 +27756,7 @@ var starknet = (() => {
|
|
|
27732
27756
|
const estimate = await this.getUniversalSuggestedFee(
|
|
27733
27757
|
version,
|
|
27734
27758
|
{
|
|
27735
|
-
type:
|
|
27759
|
+
type: TransactionType.DECLARE,
|
|
27736
27760
|
payload: declareContractPayload
|
|
27737
27761
|
},
|
|
27738
27762
|
{
|
|
@@ -27800,7 +27824,7 @@ var starknet = (() => {
|
|
|
27800
27824
|
const estimate = await this.getUniversalSuggestedFee(
|
|
27801
27825
|
version,
|
|
27802
27826
|
{
|
|
27803
|
-
type:
|
|
27827
|
+
type: TransactionType.DEPLOY_ACCOUNT,
|
|
27804
27828
|
payload: {
|
|
27805
27829
|
classHash,
|
|
27806
27830
|
constructorCalldata: compiledCalldata,
|
|
@@ -28042,16 +28066,16 @@ var starknet = (() => {
|
|
|
28042
28066
|
async getSuggestedFee({ type, payload }, details) {
|
|
28043
28067
|
let feeEstimate;
|
|
28044
28068
|
switch (type) {
|
|
28045
|
-
case
|
|
28069
|
+
case TransactionType.INVOKE:
|
|
28046
28070
|
feeEstimate = await this.estimateInvokeFee(payload, details);
|
|
28047
28071
|
break;
|
|
28048
|
-
case
|
|
28072
|
+
case TransactionType.DECLARE:
|
|
28049
28073
|
feeEstimate = await this.estimateDeclareFee(payload, details);
|
|
28050
28074
|
break;
|
|
28051
|
-
case
|
|
28075
|
+
case TransactionType.DEPLOY_ACCOUNT:
|
|
28052
28076
|
feeEstimate = await this.estimateAccountDeployFee(payload, details);
|
|
28053
28077
|
break;
|
|
28054
|
-
case
|
|
28078
|
+
case TransactionType.DEPLOY:
|
|
28055
28079
|
feeEstimate = await this.estimateDeployFee(payload, details);
|
|
28056
28080
|
break;
|
|
28057
28081
|
default:
|
|
@@ -28153,7 +28177,7 @@ var starknet = (() => {
|
|
|
28153
28177
|
const chainId = await this.getChainId();
|
|
28154
28178
|
const versions = details.versions.map((it) => toTransactionVersion(it));
|
|
28155
28179
|
const tx0Payload = "payload" in invocations[0] ? invocations[0].payload : invocations[0];
|
|
28156
|
-
const cairoVersion = invocations[0].type ===
|
|
28180
|
+
const cairoVersion = invocations[0].type === TransactionType.DEPLOY_ACCOUNT ? await this.getCairoVersion(tx0Payload.classHash) : await this.getCairoVersion();
|
|
28157
28181
|
return Promise.all(
|
|
28158
28182
|
[].concat(invocations).map(async (transaction, index) => {
|
|
28159
28183
|
const txPayload = "payload" in transaction ? transaction.payload : transaction;
|
|
@@ -28173,7 +28197,7 @@ var starknet = (() => {
|
|
|
28173
28197
|
blockIdentifier,
|
|
28174
28198
|
version: ""
|
|
28175
28199
|
};
|
|
28176
|
-
if (transaction.type ===
|
|
28200
|
+
if (transaction.type === TransactionType.INVOKE) {
|
|
28177
28201
|
const versionX = reduceV2(versions[1]);
|
|
28178
28202
|
signerDetails.version = versionX;
|
|
28179
28203
|
common2.version = versionX;
|
|
@@ -28186,7 +28210,7 @@ var starknet = (() => {
|
|
|
28186
28210
|
...payload
|
|
28187
28211
|
};
|
|
28188
28212
|
}
|
|
28189
|
-
if (transaction.type ===
|
|
28213
|
+
if (transaction.type === TransactionType.DEPLOY) {
|
|
28190
28214
|
const versionX = reduceV2(versions[1]);
|
|
28191
28215
|
signerDetails.version = versionX;
|
|
28192
28216
|
common2.version = versionX;
|
|
@@ -28195,10 +28219,10 @@ var starknet = (() => {
|
|
|
28195
28219
|
return {
|
|
28196
28220
|
...common2,
|
|
28197
28221
|
...payload,
|
|
28198
|
-
type:
|
|
28222
|
+
type: TransactionType.INVOKE
|
|
28199
28223
|
};
|
|
28200
28224
|
}
|
|
28201
|
-
if (transaction.type ===
|
|
28225
|
+
if (transaction.type === TransactionType.DECLARE) {
|
|
28202
28226
|
const versionX = !isSierra(txPayload.contract) ? versions[0] : versions[1];
|
|
28203
28227
|
signerDetails.version = versionX;
|
|
28204
28228
|
common2.version = versionX;
|
|
@@ -28208,7 +28232,7 @@ var starknet = (() => {
|
|
|
28208
28232
|
...payload
|
|
28209
28233
|
};
|
|
28210
28234
|
}
|
|
28211
|
-
if (transaction.type ===
|
|
28235
|
+
if (transaction.type === TransactionType.DEPLOY_ACCOUNT) {
|
|
28212
28236
|
const versionX = reduceV2(versions[1]);
|
|
28213
28237
|
signerDetails.version = versionX;
|
|
28214
28238
|
common2.version = versionX;
|
|
@@ -28561,7 +28585,7 @@ var starknet = (() => {
|
|
|
28561
28585
|
assert(this.address !== null, "contract is not connected to an address");
|
|
28562
28586
|
const calldata = getCalldata(args, () => {
|
|
28563
28587
|
if (parseRequest) {
|
|
28564
|
-
this.callData.validate(
|
|
28588
|
+
this.callData.validate(ValidateType.CALL, method, args);
|
|
28565
28589
|
return this.callData.compile(method, args);
|
|
28566
28590
|
}
|
|
28567
28591
|
console.warn("Call skipped parsing but provided rawArgs, possible malfunction request");
|
|
@@ -28588,7 +28612,7 @@ var starknet = (() => {
|
|
|
28588
28612
|
assert(this.address !== null, "contract is not connected to an address");
|
|
28589
28613
|
const calldata = getCalldata(args, () => {
|
|
28590
28614
|
if (parseRequest) {
|
|
28591
|
-
this.callData.validate(
|
|
28615
|
+
this.callData.validate(ValidateType.INVOKE, method, args);
|
|
28592
28616
|
return this.callData.compile(method, args);
|
|
28593
28617
|
}
|
|
28594
28618
|
console.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request");
|
|
@@ -28620,7 +28644,7 @@ var starknet = (() => {
|
|
|
28620
28644
|
async estimate(method, args = []) {
|
|
28621
28645
|
assert(this.address !== null, "contract is not connected to an address");
|
|
28622
28646
|
if (!getCalldata(args, () => false)) {
|
|
28623
|
-
this.callData.validate(
|
|
28647
|
+
this.callData.validate(ValidateType.INVOKE, method, args);
|
|
28624
28648
|
}
|
|
28625
28649
|
const invocation = this.populate(method, args);
|
|
28626
28650
|
if ("estimateInvokeFee" in this.providerOrAccount) {
|
|
@@ -28702,7 +28726,7 @@ var starknet = (() => {
|
|
|
28702
28726
|
const { args: param, options = { parseRequest: true } } = splitArgsAndOptions(args);
|
|
28703
28727
|
const constructorCalldata = getCalldata(param, () => {
|
|
28704
28728
|
if (options.parseRequest) {
|
|
28705
|
-
this.CallData.validate(
|
|
28729
|
+
this.CallData.validate(ValidateType.DEPLOY, "constructor", param);
|
|
28706
28730
|
return this.CallData.compile("constructor", param);
|
|
28707
28731
|
}
|
|
28708
28732
|
console.warn("Call skipped parsing but provided rawArgs, possible malfunction request");
|