starknet 6.2.1 → 6.4.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 +17 -0
- package/dist/index.d.ts +75 -5
- package/dist/index.global.js +334 -22
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +334 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +334 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2345,6 +2345,7 @@ __export(hash_exports, {
|
|
|
2345
2345
|
formatSpaces: () => formatSpaces,
|
|
2346
2346
|
getSelector: () => getSelector,
|
|
2347
2347
|
getSelectorFromName: () => getSelectorFromName,
|
|
2348
|
+
hashByteCodeSegments: () => hashByteCodeSegments,
|
|
2348
2349
|
keccakBn: () => keccakBn,
|
|
2349
2350
|
poseidon: () => poseidon,
|
|
2350
2351
|
starknetKeccak: () => starknetKeccak
|
|
@@ -2731,13 +2732,23 @@ function hashEntryPoint(data) {
|
|
|
2731
2732
|
});
|
|
2732
2733
|
return poseidonHashMany2(base);
|
|
2733
2734
|
}
|
|
2735
|
+
function hashByteCodeSegments(casm) {
|
|
2736
|
+
const byteCode = casm.bytecode.map((n) => BigInt(n));
|
|
2737
|
+
const bytecodeSegmentLengths = casm.bytecode_segment_lengths ?? [];
|
|
2738
|
+
let segmentStart = 0;
|
|
2739
|
+
const hashLeaves = bytecodeSegmentLengths.flatMap((len) => {
|
|
2740
|
+
const segment = byteCode.slice(segmentStart, segmentStart += len);
|
|
2741
|
+
return [BigInt(len), poseidonHashMany2(segment)];
|
|
2742
|
+
});
|
|
2743
|
+
return 1n + poseidonHashMany2(hashLeaves);
|
|
2744
|
+
}
|
|
2734
2745
|
function computeCompiledClassHash(casm) {
|
|
2735
2746
|
const COMPILED_CLASS_VERSION = "COMPILED_CLASS_V1";
|
|
2736
2747
|
const compiledClassVersion = BigInt(encodeShortString(COMPILED_CLASS_VERSION));
|
|
2737
2748
|
const externalEntryPointsHash = hashEntryPoint(casm.entry_points_by_type.EXTERNAL);
|
|
2738
2749
|
const l1Handlers = hashEntryPoint(casm.entry_points_by_type.L1_HANDLER);
|
|
2739
2750
|
const constructor = hashEntryPoint(casm.entry_points_by_type.CONSTRUCTOR);
|
|
2740
|
-
const bytecode = poseidonHashMany2(casm.bytecode.map((it) => BigInt(it)));
|
|
2751
|
+
const bytecode = casm.bytecode_segment_lengths ? hashByteCodeSegments(casm) : poseidonHashMany2(casm.bytecode.map((it) => BigInt(it)));
|
|
2741
2752
|
return toHex(
|
|
2742
2753
|
poseidonHashMany2([
|
|
2743
2754
|
compiledClassVersion,
|
|
@@ -4494,7 +4505,20 @@ import { Mixin } from "ts-mixer";
|
|
|
4494
4505
|
var starknetId_exports = {};
|
|
4495
4506
|
__export(starknetId_exports, {
|
|
4496
4507
|
StarknetIdContract: () => StarknetIdContract,
|
|
4508
|
+
StarknetIdIdentityContract: () => StarknetIdIdentityContract,
|
|
4509
|
+
StarknetIdMulticallContract: () => StarknetIdMulticallContract,
|
|
4510
|
+
StarknetIdPfpContract: () => StarknetIdPfpContract,
|
|
4511
|
+
StarknetIdPopContract: () => StarknetIdPopContract,
|
|
4512
|
+
StarknetIdVerifierContract: () => StarknetIdVerifierContract,
|
|
4513
|
+
dynamicCallData: () => dynamicCallData,
|
|
4514
|
+
dynamicFelt: () => dynamicFelt,
|
|
4515
|
+
execution: () => execution,
|
|
4497
4516
|
getStarknetIdContract: () => getStarknetIdContract,
|
|
4517
|
+
getStarknetIdIdentityContract: () => getStarknetIdIdentityContract,
|
|
4518
|
+
getStarknetIdMulticallContract: () => getStarknetIdMulticallContract,
|
|
4519
|
+
getStarknetIdPfpContract: () => getStarknetIdPfpContract,
|
|
4520
|
+
getStarknetIdPopContract: () => getStarknetIdPopContract,
|
|
4521
|
+
getStarknetIdVerifierContract: () => getStarknetIdVerifierContract,
|
|
4498
4522
|
useDecoded: () => useDecoded,
|
|
4499
4523
|
useEncoded: () => useEncoded
|
|
4500
4524
|
});
|
|
@@ -4582,6 +4606,7 @@ function useEncoded(decoded) {
|
|
|
4582
4606
|
var StarknetIdContract = /* @__PURE__ */ ((StarknetIdContract2) => {
|
|
4583
4607
|
StarknetIdContract2["MAINNET"] = "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";
|
|
4584
4608
|
StarknetIdContract2["TESTNET"] = "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";
|
|
4609
|
+
StarknetIdContract2["TESTNET_SEPOLIA"] = "0x5847d20f9757de24395a7b3b47303684003753858737bf288716855dfb0aaf2";
|
|
4585
4610
|
return StarknetIdContract2;
|
|
4586
4611
|
})(StarknetIdContract || {});
|
|
4587
4612
|
function getStarknetIdContract(chainId) {
|
|
@@ -4590,10 +4615,121 @@ function getStarknetIdContract(chainId) {
|
|
|
4590
4615
|
return "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678" /* MAINNET */;
|
|
4591
4616
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4592
4617
|
return "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce" /* TESTNET */;
|
|
4618
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4619
|
+
return "0x5847d20f9757de24395a7b3b47303684003753858737bf288716855dfb0aaf2" /* TESTNET_SEPOLIA */;
|
|
4593
4620
|
default:
|
|
4594
4621
|
throw new Error("Starknet.id is not yet deployed on this network");
|
|
4595
4622
|
}
|
|
4596
4623
|
}
|
|
4624
|
+
var StarknetIdIdentityContract = /* @__PURE__ */ ((StarknetIdIdentityContract2) => {
|
|
4625
|
+
StarknetIdIdentityContract2["MAINNET"] = "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af";
|
|
4626
|
+
StarknetIdIdentityContract2["TESTNET"] = "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d";
|
|
4627
|
+
StarknetIdIdentityContract2["TESTNET_SEPOLIA"] = "0x718d9172f6e36183abeeff1a0db76a1851cef4ed9b9c13896da79ef4bfcb4d0";
|
|
4628
|
+
return StarknetIdIdentityContract2;
|
|
4629
|
+
})(StarknetIdIdentityContract || {});
|
|
4630
|
+
function getStarknetIdIdentityContract(chainId) {
|
|
4631
|
+
switch (chainId) {
|
|
4632
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4633
|
+
return "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af" /* MAINNET */;
|
|
4634
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4635
|
+
return "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d" /* TESTNET */;
|
|
4636
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4637
|
+
return "0x718d9172f6e36183abeeff1a0db76a1851cef4ed9b9c13896da79ef4bfcb4d0" /* TESTNET_SEPOLIA */;
|
|
4638
|
+
default:
|
|
4639
|
+
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
var StarknetIdMulticallContract = "0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";
|
|
4643
|
+
function getStarknetIdMulticallContract(chainId) {
|
|
4644
|
+
switch (chainId) {
|
|
4645
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4646
|
+
return StarknetIdMulticallContract;
|
|
4647
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4648
|
+
return StarknetIdMulticallContract;
|
|
4649
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4650
|
+
return StarknetIdMulticallContract;
|
|
4651
|
+
default:
|
|
4652
|
+
throw new Error("Starknet.id multicall contract is not yet deployed on this network");
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
var StarknetIdVerifierContract = /* @__PURE__ */ ((StarknetIdVerifierContract2) => {
|
|
4656
|
+
StarknetIdVerifierContract2["MAINNET"] = "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf";
|
|
4657
|
+
StarknetIdVerifierContract2["TESTNET"] = "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11";
|
|
4658
|
+
StarknetIdVerifierContract2["TESTNET_SEPOLIA"] = "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf";
|
|
4659
|
+
return StarknetIdVerifierContract2;
|
|
4660
|
+
})(StarknetIdVerifierContract || {});
|
|
4661
|
+
function getStarknetIdVerifierContract(chainId) {
|
|
4662
|
+
switch (chainId) {
|
|
4663
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4664
|
+
return "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf" /* MAINNET */;
|
|
4665
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4666
|
+
return "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11" /* TESTNET */;
|
|
4667
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4668
|
+
return "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf" /* TESTNET_SEPOLIA */;
|
|
4669
|
+
default:
|
|
4670
|
+
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
var StarknetIdPfpContract = /* @__PURE__ */ ((StarknetIdPfpContract2) => {
|
|
4674
|
+
StarknetIdPfpContract2["MAINNET"] = "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7";
|
|
4675
|
+
StarknetIdPfpContract2["TESTNET"] = "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698";
|
|
4676
|
+
StarknetIdPfpContract2["TESTNET_SEPOLIA"] = "0x070c035557d6fed57eed2ed7fa861616b487f8a95439347b805639ca076f29f0";
|
|
4677
|
+
return StarknetIdPfpContract2;
|
|
4678
|
+
})(StarknetIdPfpContract || {});
|
|
4679
|
+
function getStarknetIdPfpContract(chainId) {
|
|
4680
|
+
switch (chainId) {
|
|
4681
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4682
|
+
return "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7" /* MAINNET */;
|
|
4683
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4684
|
+
return "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698" /* TESTNET */;
|
|
4685
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4686
|
+
return "0x070c035557d6fed57eed2ed7fa861616b487f8a95439347b805639ca076f29f0" /* TESTNET_SEPOLIA */;
|
|
4687
|
+
default:
|
|
4688
|
+
throw new Error(
|
|
4689
|
+
"Starknet.id profile picture verifier contract is not yet deployed on this network"
|
|
4690
|
+
);
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
var StarknetIdPopContract = /* @__PURE__ */ ((StarknetIdPopContract2) => {
|
|
4694
|
+
StarknetIdPopContract2["MAINNET"] = "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4";
|
|
4695
|
+
StarknetIdPopContract2["TESTNET"] = "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106";
|
|
4696
|
+
StarknetIdPopContract2["TESTNET_SEPOLIA"] = "0x00f80f68443becd0e0a4a08ff5734e36dd8028507333e4a0ec034dcfdf1b793e";
|
|
4697
|
+
return StarknetIdPopContract2;
|
|
4698
|
+
})(StarknetIdPopContract || {});
|
|
4699
|
+
function getStarknetIdPopContract(chainId) {
|
|
4700
|
+
switch (chainId) {
|
|
4701
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4702
|
+
return "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4" /* MAINNET */;
|
|
4703
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4704
|
+
return "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106" /* TESTNET */;
|
|
4705
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4706
|
+
return "0x00f80f68443becd0e0a4a08ff5734e36dd8028507333e4a0ec034dcfdf1b793e" /* TESTNET_SEPOLIA */;
|
|
4707
|
+
default:
|
|
4708
|
+
throw new Error(
|
|
4709
|
+
"Starknet.id proof of personhood verifier contract is not yet deployed on this network"
|
|
4710
|
+
);
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
function execution(staticEx, ifEqual = void 0, ifNotEqual = void 0) {
|
|
4714
|
+
return new CairoCustomEnum({
|
|
4715
|
+
Static: staticEx,
|
|
4716
|
+
IfEqual: ifEqual ? tuple(ifEqual[0], ifEqual[1], ifEqual[2]) : void 0,
|
|
4717
|
+
IfNotEqual: ifNotEqual ? tuple(ifNotEqual[0], ifNotEqual[1], ifNotEqual[2]) : void 0
|
|
4718
|
+
});
|
|
4719
|
+
}
|
|
4720
|
+
function dynamicFelt(hardcoded, reference = void 0) {
|
|
4721
|
+
return new CairoCustomEnum({
|
|
4722
|
+
Hardcoded: hardcoded,
|
|
4723
|
+
Reference: reference ? tuple(reference[0], reference[1]) : void 0
|
|
4724
|
+
});
|
|
4725
|
+
}
|
|
4726
|
+
function dynamicCallData(hardcoded, reference = void 0, arrayReference = void 0) {
|
|
4727
|
+
return new CairoCustomEnum({
|
|
4728
|
+
Hardcoded: hardcoded,
|
|
4729
|
+
Reference: reference ? tuple(reference[0], reference[1]) : void 0,
|
|
4730
|
+
ArrayReference: arrayReference ? tuple(arrayReference[0], arrayReference[1]) : void 0
|
|
4731
|
+
});
|
|
4732
|
+
}
|
|
4597
4733
|
|
|
4598
4734
|
// src/provider/extensions/starknetId.ts
|
|
4599
4735
|
var StarknetId = class _StarknetId {
|
|
@@ -4613,6 +4749,19 @@ var StarknetId = class _StarknetId {
|
|
|
4613
4749
|
StarknetIdContract2
|
|
4614
4750
|
);
|
|
4615
4751
|
}
|
|
4752
|
+
async getStarkProfile(address, StarknetIdContract2, StarknetIdIdentityContract2, StarknetIdVerifierContract2, StarknetIdPfpContract2, StarknetIdPopContract2, StarknetIdMulticallContract2) {
|
|
4753
|
+
return _StarknetId.getStarkProfile(
|
|
4754
|
+
// After Mixin, this is ProviderInterface
|
|
4755
|
+
this,
|
|
4756
|
+
address,
|
|
4757
|
+
StarknetIdContract2,
|
|
4758
|
+
StarknetIdIdentityContract2,
|
|
4759
|
+
StarknetIdVerifierContract2,
|
|
4760
|
+
StarknetIdPfpContract2,
|
|
4761
|
+
StarknetIdPopContract2,
|
|
4762
|
+
StarknetIdMulticallContract2
|
|
4763
|
+
);
|
|
4764
|
+
}
|
|
4616
4765
|
static async getStarkName(provider, address, StarknetIdContract2) {
|
|
4617
4766
|
const chainId = await provider.getChainId();
|
|
4618
4767
|
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
@@ -4641,18 +4790,159 @@ var StarknetId = class _StarknetId {
|
|
|
4641
4790
|
const chainId = await provider.getChainId();
|
|
4642
4791
|
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
4643
4792
|
try {
|
|
4793
|
+
const encodedDomain = name.replace(".stark", "").split(".").map((part) => useEncoded(part).toString(10));
|
|
4644
4794
|
const addressData = await provider.callContract({
|
|
4645
4795
|
contractAddress: contract,
|
|
4646
4796
|
entrypoint: "domain_to_address",
|
|
4647
|
-
calldata: CallData.compile({
|
|
4648
|
-
domain: [useEncoded(name.replace(".stark", "")).toString(10)]
|
|
4649
|
-
})
|
|
4797
|
+
calldata: CallData.compile({ domain: encodedDomain, hint: [] })
|
|
4650
4798
|
});
|
|
4651
4799
|
return addressData[0];
|
|
4652
4800
|
} catch {
|
|
4653
4801
|
throw Error("Could not get address from stark name");
|
|
4654
4802
|
}
|
|
4655
4803
|
}
|
|
4804
|
+
static async getStarkProfile(provider, address, StarknetIdContract2, StarknetIdIdentityContract2, StarknetIdVerifierContract2, StarknetIdPfpContract2, StarknetIdPopContract2, StarknetIdMulticallContract2) {
|
|
4805
|
+
const chainId = await provider.getChainId();
|
|
4806
|
+
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
4807
|
+
const identityContract = StarknetIdIdentityContract2 ?? getStarknetIdIdentityContract(chainId);
|
|
4808
|
+
const verifierContract = StarknetIdVerifierContract2 ?? getStarknetIdVerifierContract(chainId);
|
|
4809
|
+
const pfpContract = StarknetIdPfpContract2 ?? getStarknetIdPfpContract(chainId);
|
|
4810
|
+
const popContract = StarknetIdPopContract2 ?? getStarknetIdPopContract(chainId);
|
|
4811
|
+
const multicallAddress = StarknetIdMulticallContract2 ?? getStarknetIdMulticallContract(chainId);
|
|
4812
|
+
try {
|
|
4813
|
+
const data = await provider.callContract({
|
|
4814
|
+
contractAddress: multicallAddress,
|
|
4815
|
+
entrypoint: "aggregate",
|
|
4816
|
+
calldata: CallData.compile({
|
|
4817
|
+
calls: [
|
|
4818
|
+
{
|
|
4819
|
+
execution: execution({}),
|
|
4820
|
+
to: dynamicFelt(contract),
|
|
4821
|
+
selector: dynamicFelt(getSelectorFromName("address_to_domain")),
|
|
4822
|
+
calldata: [dynamicCallData(address)]
|
|
4823
|
+
},
|
|
4824
|
+
{
|
|
4825
|
+
execution: execution({}),
|
|
4826
|
+
to: dynamicFelt(contract),
|
|
4827
|
+
selector: dynamicFelt(getSelectorFromName("domain_to_id")),
|
|
4828
|
+
calldata: [dynamicCallData(void 0, void 0, [0, 0])]
|
|
4829
|
+
},
|
|
4830
|
+
{
|
|
4831
|
+
execution: execution({}),
|
|
4832
|
+
to: dynamicFelt(identityContract),
|
|
4833
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4834
|
+
calldata: [
|
|
4835
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4836
|
+
dynamicCallData(encodeShortString("twitter")),
|
|
4837
|
+
dynamicCallData(verifierContract),
|
|
4838
|
+
dynamicCallData("0")
|
|
4839
|
+
]
|
|
4840
|
+
},
|
|
4841
|
+
{
|
|
4842
|
+
execution: execution({}),
|
|
4843
|
+
to: dynamicFelt(identityContract),
|
|
4844
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4845
|
+
calldata: [
|
|
4846
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4847
|
+
dynamicCallData(encodeShortString("github")),
|
|
4848
|
+
dynamicCallData(verifierContract),
|
|
4849
|
+
dynamicCallData("0")
|
|
4850
|
+
]
|
|
4851
|
+
},
|
|
4852
|
+
{
|
|
4853
|
+
execution: execution({}),
|
|
4854
|
+
to: dynamicFelt(identityContract),
|
|
4855
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4856
|
+
calldata: [
|
|
4857
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4858
|
+
dynamicCallData(encodeShortString("discord")),
|
|
4859
|
+
dynamicCallData(verifierContract),
|
|
4860
|
+
dynamicCallData("0")
|
|
4861
|
+
]
|
|
4862
|
+
},
|
|
4863
|
+
{
|
|
4864
|
+
execution: execution({}),
|
|
4865
|
+
to: dynamicFelt(identityContract),
|
|
4866
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4867
|
+
calldata: [
|
|
4868
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4869
|
+
dynamicCallData(encodeShortString("proof_of_personhood")),
|
|
4870
|
+
dynamicCallData(popContract),
|
|
4871
|
+
dynamicCallData("0")
|
|
4872
|
+
]
|
|
4873
|
+
},
|
|
4874
|
+
// PFP
|
|
4875
|
+
{
|
|
4876
|
+
execution: execution({}),
|
|
4877
|
+
to: dynamicFelt(identityContract),
|
|
4878
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4879
|
+
calldata: [
|
|
4880
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4881
|
+
dynamicCallData(encodeShortString("nft_pp_contract")),
|
|
4882
|
+
dynamicCallData(pfpContract),
|
|
4883
|
+
dynamicCallData("0")
|
|
4884
|
+
]
|
|
4885
|
+
},
|
|
4886
|
+
{
|
|
4887
|
+
execution: execution({}),
|
|
4888
|
+
to: dynamicFelt(identityContract),
|
|
4889
|
+
selector: dynamicFelt(getSelectorFromName("get_extended_verifier_data")),
|
|
4890
|
+
calldata: [
|
|
4891
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4892
|
+
dynamicCallData(encodeShortString("nft_pp_id")),
|
|
4893
|
+
dynamicCallData("2"),
|
|
4894
|
+
dynamicCallData(pfpContract),
|
|
4895
|
+
dynamicCallData("0")
|
|
4896
|
+
]
|
|
4897
|
+
},
|
|
4898
|
+
{
|
|
4899
|
+
execution: execution(void 0, void 0, [6, 0, 0]),
|
|
4900
|
+
to: dynamicFelt(void 0, [6, 0]),
|
|
4901
|
+
selector: dynamicFelt(getSelectorFromName("tokenURI")),
|
|
4902
|
+
calldata: [dynamicCallData(void 0, [7, 1]), dynamicCallData(void 0, [7, 2])]
|
|
4903
|
+
}
|
|
4904
|
+
]
|
|
4905
|
+
})
|
|
4906
|
+
});
|
|
4907
|
+
if (Array.isArray(data)) {
|
|
4908
|
+
const size = parseInt(data[0], 16);
|
|
4909
|
+
const finalArray = [];
|
|
4910
|
+
let index = 1;
|
|
4911
|
+
for (let i = 0; i < size; i += 1) {
|
|
4912
|
+
if (index < data.length) {
|
|
4913
|
+
const subArraySize = parseInt(data[index], 16);
|
|
4914
|
+
index += 1;
|
|
4915
|
+
const subArray = data.slice(index, index + subArraySize);
|
|
4916
|
+
finalArray.push(subArray);
|
|
4917
|
+
index += subArraySize;
|
|
4918
|
+
} else {
|
|
4919
|
+
break;
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4922
|
+
const name = useDecoded(finalArray[0].slice(1).map((hexString) => BigInt(hexString)));
|
|
4923
|
+
const twitter = finalArray[2][0] !== "0x0" ? BigInt(finalArray[2][0]).toString() : void 0;
|
|
4924
|
+
const github = finalArray[3][0] !== "0x0" ? BigInt(finalArray[3][0]).toString() : void 0;
|
|
4925
|
+
const discord = finalArray[4][0] !== "0x0" ? BigInt(finalArray[4][0]).toString() : void 0;
|
|
4926
|
+
const proofOfPersonhood = finalArray[5][0] === "0x1";
|
|
4927
|
+
const profilePictureMetadata = data[0] === "0x9" ? finalArray[8].slice(1).map((val) => decodeShortString(val)).join("") : void 0;
|
|
4928
|
+
const profilePicture = profilePictureMetadata || `https://starknet.id/api/identicons/${BigInt(finalArray[1][0]).toString()}`;
|
|
4929
|
+
return {
|
|
4930
|
+
name,
|
|
4931
|
+
twitter,
|
|
4932
|
+
github,
|
|
4933
|
+
discord,
|
|
4934
|
+
proofOfPersonhood,
|
|
4935
|
+
profilePicture
|
|
4936
|
+
};
|
|
4937
|
+
}
|
|
4938
|
+
throw Error("Error while calling aggregate function");
|
|
4939
|
+
} catch (e) {
|
|
4940
|
+
if (e instanceof Error) {
|
|
4941
|
+
throw e;
|
|
4942
|
+
}
|
|
4943
|
+
throw Error("Could not get user stark profile data from address");
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4656
4946
|
};
|
|
4657
4947
|
|
|
4658
4948
|
// src/provider/extensions/default.ts
|
|
@@ -4875,11 +5165,18 @@ function getMerkleTreeType(types, ctx) {
|
|
|
4875
5165
|
return "raw";
|
|
4876
5166
|
}
|
|
4877
5167
|
function encodeType(types, type, revision = "0" /* Legacy */) {
|
|
4878
|
-
const
|
|
5168
|
+
const allTypes = revision === "1" /* Active */ ? { ...types, ...revisionConfiguration[revision].presetTypes } : types;
|
|
5169
|
+
const [primary, ...dependencies] = getDependencies(
|
|
5170
|
+
allTypes,
|
|
5171
|
+
type,
|
|
5172
|
+
void 0,
|
|
5173
|
+
void 0,
|
|
5174
|
+
revision
|
|
5175
|
+
);
|
|
4879
5176
|
const newTypes = !primary ? [] : [primary, ...dependencies.sort()];
|
|
4880
5177
|
const esc = revisionConfiguration[revision].escapeTypeString;
|
|
4881
5178
|
return newTypes.map((dependency) => {
|
|
4882
|
-
const dependencyElements =
|
|
5179
|
+
const dependencyElements = allTypes[dependency].map((t) => {
|
|
4883
5180
|
const targetType = t.type === "enum" && revision === "1" /* Active */ ? t.contains : t.type;
|
|
4884
5181
|
const typeString = targetType.match(/^\(.*\)$/) ? `(${targetType.slice(1, -1).split(",").map((e) => e ? esc(e) : e).join(",")})` : esc(targetType);
|
|
4885
5182
|
return `${esc(t.name)}:${typeString}`;
|
|
@@ -5277,7 +5574,12 @@ var Account = class extends RpcProvider2 {
|
|
|
5277
5574
|
return this.estimateInvokeFee(calls, estimateFeeDetails);
|
|
5278
5575
|
}
|
|
5279
5576
|
async estimateInvokeFee(calls, details = {}) {
|
|
5280
|
-
const {
|
|
5577
|
+
const {
|
|
5578
|
+
nonce: providedNonce,
|
|
5579
|
+
blockIdentifier,
|
|
5580
|
+
version: providedVersion,
|
|
5581
|
+
skipValidate = true
|
|
5582
|
+
} = details;
|
|
5281
5583
|
const transactions = Array.isArray(calls) ? calls : [calls];
|
|
5282
5584
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
5283
5585
|
const version = toTransactionVersion(
|
|
@@ -5292,7 +5594,8 @@ var Account = class extends RpcProvider2 {
|
|
|
5292
5594
|
maxFee: ZERO,
|
|
5293
5595
|
version,
|
|
5294
5596
|
chainId,
|
|
5295
|
-
cairoVersion: await this.getCairoVersion()
|
|
5597
|
+
cairoVersion: await this.getCairoVersion(),
|
|
5598
|
+
skipValidate
|
|
5296
5599
|
};
|
|
5297
5600
|
const invocation = await this.buildInvocation(transactions, signerDetails);
|
|
5298
5601
|
return super.getInvokeEstimateFee(
|
|
@@ -5303,7 +5606,12 @@ var Account = class extends RpcProvider2 {
|
|
|
5303
5606
|
);
|
|
5304
5607
|
}
|
|
5305
5608
|
async estimateDeclareFee(payload, details = {}) {
|
|
5306
|
-
const {
|
|
5609
|
+
const {
|
|
5610
|
+
blockIdentifier,
|
|
5611
|
+
nonce: providedNonce,
|
|
5612
|
+
version: providedVersion,
|
|
5613
|
+
skipValidate = true
|
|
5614
|
+
} = details;
|
|
5307
5615
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
5308
5616
|
const version = toTransactionVersion(
|
|
5309
5617
|
!isSierra(payload.contract) ? "0x100000000000000000000000000000001" /* F1 */ : this.getPreferredVersion("0x100000000000000000000000000000002" /* F2 */, "0x100000000000000000000000000000003" /* F3 */),
|
|
@@ -5317,8 +5625,9 @@ var Account = class extends RpcProvider2 {
|
|
|
5317
5625
|
version,
|
|
5318
5626
|
walletAddress: this.address,
|
|
5319
5627
|
maxFee: ZERO,
|
|
5320
|
-
cairoVersion: void 0
|
|
5628
|
+
cairoVersion: void 0,
|
|
5321
5629
|
// unused parameter
|
|
5630
|
+
skipValidate
|
|
5322
5631
|
});
|
|
5323
5632
|
return super.getDeclareEstimateFee(
|
|
5324
5633
|
declareContractTransaction,
|
|
@@ -5333,7 +5642,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5333
5642
|
constructorCalldata = [],
|
|
5334
5643
|
contractAddress
|
|
5335
5644
|
}, details = {}) {
|
|
5336
|
-
const { blockIdentifier, version: providedVersion } = details;
|
|
5645
|
+
const { blockIdentifier, version: providedVersion, skipValidate = true } = details;
|
|
5337
5646
|
const version = toTransactionVersion(
|
|
5338
5647
|
this.getPreferredVersion("0x100000000000000000000000000000001" /* F1 */, "0x100000000000000000000000000000003" /* F3 */),
|
|
5339
5648
|
toFeeVersion(providedVersion)
|
|
@@ -5350,8 +5659,9 @@ var Account = class extends RpcProvider2 {
|
|
|
5350
5659
|
walletAddress: this.address,
|
|
5351
5660
|
// unused parameter
|
|
5352
5661
|
maxFee: ZERO,
|
|
5353
|
-
cairoVersion: void 0
|
|
5662
|
+
cairoVersion: void 0,
|
|
5354
5663
|
// unused parameter,
|
|
5664
|
+
skipValidate
|
|
5355
5665
|
}
|
|
5356
5666
|
);
|
|
5357
5667
|
return super.getDeployAccountEstimateFee(
|
|
@@ -5387,7 +5697,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5387
5697
|
});
|
|
5388
5698
|
}
|
|
5389
5699
|
async simulateTransaction(invocations, details = {}) {
|
|
5390
|
-
const { nonce, blockIdentifier, skipValidate, skipExecute, version } = details;
|
|
5700
|
+
const { nonce, blockIdentifier, skipValidate = true, skipExecute, version } = details;
|
|
5391
5701
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
5392
5702
|
...v3Details(details),
|
|
5393
5703
|
versions: [
|
|
@@ -5399,7 +5709,8 @@ var Account = class extends RpcProvider2 {
|
|
|
5399
5709
|
)
|
|
5400
5710
|
],
|
|
5401
5711
|
nonce,
|
|
5402
|
-
blockIdentifier
|
|
5712
|
+
blockIdentifier,
|
|
5713
|
+
skipValidate
|
|
5403
5714
|
});
|
|
5404
5715
|
return super.getSimulateTransaction(accountInvocations, {
|
|
5405
5716
|
blockIdentifier,
|
|
@@ -5685,7 +5996,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5685
5996
|
}
|
|
5686
5997
|
async buildInvocation(call, details) {
|
|
5687
5998
|
const calldata = getExecuteCalldata(call, await this.getCairoVersion());
|
|
5688
|
-
const signature = await this.signer.signTransaction(call, details);
|
|
5999
|
+
const signature = !details.skipValidate ? await this.signer.signTransaction(call, details) : [];
|
|
5689
6000
|
return {
|
|
5690
6001
|
...v3Details(details),
|
|
5691
6002
|
contractAddress: this.address,
|
|
@@ -5699,14 +6010,14 @@ var Account = class extends RpcProvider2 {
|
|
|
5699
6010
|
if (typeof compiledClassHash === "undefined" && (details.version === "0x100000000000000000000000000000003" /* F3 */ || details.version === "0x3" /* V3 */)) {
|
|
5700
6011
|
throw Error("V3 Transaction work with Cairo1 Contracts and require compiledClassHash");
|
|
5701
6012
|
}
|
|
5702
|
-
const signature = await this.signer.signDeclareTransaction({
|
|
6013
|
+
const signature = !details.skipValidate ? await this.signer.signDeclareTransaction({
|
|
5703
6014
|
...details,
|
|
5704
6015
|
...v3Details(details),
|
|
5705
6016
|
classHash,
|
|
5706
6017
|
compiledClassHash,
|
|
5707
|
-
// TODO: TS
|
|
6018
|
+
// TODO: TS, cast because optional for v2 and required for v3, thrown if not present
|
|
5708
6019
|
senderAddress: details.walletAddress
|
|
5709
|
-
});
|
|
6020
|
+
}) : [];
|
|
5710
6021
|
return {
|
|
5711
6022
|
senderAddress: details.walletAddress,
|
|
5712
6023
|
signature,
|
|
@@ -5722,14 +6033,14 @@ var Account = class extends RpcProvider2 {
|
|
|
5722
6033
|
}, details) {
|
|
5723
6034
|
const compiledCalldata = CallData.compile(constructorCalldata);
|
|
5724
6035
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, compiledCalldata, 0);
|
|
5725
|
-
const signature = await this.signer.signDeployAccountTransaction({
|
|
6036
|
+
const signature = !details.skipValidate ? await this.signer.signDeployAccountTransaction({
|
|
5726
6037
|
...details,
|
|
5727
6038
|
...v3Details(details),
|
|
5728
6039
|
classHash,
|
|
5729
6040
|
contractAddress,
|
|
5730
6041
|
addressSalt,
|
|
5731
6042
|
constructorCalldata: compiledCalldata
|
|
5732
|
-
});
|
|
6043
|
+
}) : [];
|
|
5733
6044
|
return {
|
|
5734
6045
|
...v3Details(details),
|
|
5735
6046
|
classHash,
|
|
@@ -5762,7 +6073,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5762
6073
|
return calls;
|
|
5763
6074
|
}
|
|
5764
6075
|
async accountInvocationsFactory(invocations, details) {
|
|
5765
|
-
const { nonce, blockIdentifier } = details;
|
|
6076
|
+
const { nonce, blockIdentifier, skipValidate = true } = details;
|
|
5766
6077
|
const safeNonce = await this.getNonceSafe(nonce);
|
|
5767
6078
|
const chainId = await this.getChainId();
|
|
5768
6079
|
const versions = details.versions.map((it) => toTransactionVersion(it));
|
|
@@ -5778,7 +6089,8 @@ var Account = class extends RpcProvider2 {
|
|
|
5778
6089
|
maxFee: ZERO,
|
|
5779
6090
|
chainId,
|
|
5780
6091
|
cairoVersion,
|
|
5781
|
-
version: ""
|
|
6092
|
+
version: "",
|
|
6093
|
+
skipValidate
|
|
5782
6094
|
};
|
|
5783
6095
|
const common = {
|
|
5784
6096
|
type: transaction.type,
|