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.js
CHANGED
|
@@ -2449,6 +2449,7 @@ __export(hash_exports, {
|
|
|
2449
2449
|
formatSpaces: () => formatSpaces,
|
|
2450
2450
|
getSelector: () => getSelector,
|
|
2451
2451
|
getSelectorFromName: () => getSelectorFromName,
|
|
2452
|
+
hashByteCodeSegments: () => hashByteCodeSegments,
|
|
2452
2453
|
keccakBn: () => keccakBn,
|
|
2453
2454
|
poseidon: () => poseidon,
|
|
2454
2455
|
starknetKeccak: () => starknetKeccak
|
|
@@ -2835,13 +2836,23 @@ function hashEntryPoint(data) {
|
|
|
2835
2836
|
});
|
|
2836
2837
|
return (0, import_starknet3.poseidonHashMany)(base);
|
|
2837
2838
|
}
|
|
2839
|
+
function hashByteCodeSegments(casm) {
|
|
2840
|
+
const byteCode = casm.bytecode.map((n) => BigInt(n));
|
|
2841
|
+
const bytecodeSegmentLengths = casm.bytecode_segment_lengths ?? [];
|
|
2842
|
+
let segmentStart = 0;
|
|
2843
|
+
const hashLeaves = bytecodeSegmentLengths.flatMap((len) => {
|
|
2844
|
+
const segment = byteCode.slice(segmentStart, segmentStart += len);
|
|
2845
|
+
return [BigInt(len), (0, import_starknet3.poseidonHashMany)(segment)];
|
|
2846
|
+
});
|
|
2847
|
+
return 1n + (0, import_starknet3.poseidonHashMany)(hashLeaves);
|
|
2848
|
+
}
|
|
2838
2849
|
function computeCompiledClassHash(casm) {
|
|
2839
2850
|
const COMPILED_CLASS_VERSION = "COMPILED_CLASS_V1";
|
|
2840
2851
|
const compiledClassVersion = BigInt(encodeShortString(COMPILED_CLASS_VERSION));
|
|
2841
2852
|
const externalEntryPointsHash = hashEntryPoint(casm.entry_points_by_type.EXTERNAL);
|
|
2842
2853
|
const l1Handlers = hashEntryPoint(casm.entry_points_by_type.L1_HANDLER);
|
|
2843
2854
|
const constructor = hashEntryPoint(casm.entry_points_by_type.CONSTRUCTOR);
|
|
2844
|
-
const bytecode = (0, import_starknet3.poseidonHashMany)(casm.bytecode.map((it) => BigInt(it)));
|
|
2855
|
+
const bytecode = casm.bytecode_segment_lengths ? hashByteCodeSegments(casm) : (0, import_starknet3.poseidonHashMany)(casm.bytecode.map((it) => BigInt(it)));
|
|
2845
2856
|
return toHex(
|
|
2846
2857
|
(0, import_starknet3.poseidonHashMany)([
|
|
2847
2858
|
compiledClassVersion,
|
|
@@ -4598,7 +4609,20 @@ var import_ts_mixer = require("ts-mixer");
|
|
|
4598
4609
|
var starknetId_exports = {};
|
|
4599
4610
|
__export(starknetId_exports, {
|
|
4600
4611
|
StarknetIdContract: () => StarknetIdContract,
|
|
4612
|
+
StarknetIdIdentityContract: () => StarknetIdIdentityContract,
|
|
4613
|
+
StarknetIdMulticallContract: () => StarknetIdMulticallContract,
|
|
4614
|
+
StarknetIdPfpContract: () => StarknetIdPfpContract,
|
|
4615
|
+
StarknetIdPopContract: () => StarknetIdPopContract,
|
|
4616
|
+
StarknetIdVerifierContract: () => StarknetIdVerifierContract,
|
|
4617
|
+
dynamicCallData: () => dynamicCallData,
|
|
4618
|
+
dynamicFelt: () => dynamicFelt,
|
|
4619
|
+
execution: () => execution,
|
|
4601
4620
|
getStarknetIdContract: () => getStarknetIdContract,
|
|
4621
|
+
getStarknetIdIdentityContract: () => getStarknetIdIdentityContract,
|
|
4622
|
+
getStarknetIdMulticallContract: () => getStarknetIdMulticallContract,
|
|
4623
|
+
getStarknetIdPfpContract: () => getStarknetIdPfpContract,
|
|
4624
|
+
getStarknetIdPopContract: () => getStarknetIdPopContract,
|
|
4625
|
+
getStarknetIdVerifierContract: () => getStarknetIdVerifierContract,
|
|
4602
4626
|
useDecoded: () => useDecoded,
|
|
4603
4627
|
useEncoded: () => useEncoded
|
|
4604
4628
|
});
|
|
@@ -4686,6 +4710,7 @@ function useEncoded(decoded) {
|
|
|
4686
4710
|
var StarknetIdContract = /* @__PURE__ */ ((StarknetIdContract2) => {
|
|
4687
4711
|
StarknetIdContract2["MAINNET"] = "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";
|
|
4688
4712
|
StarknetIdContract2["TESTNET"] = "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";
|
|
4713
|
+
StarknetIdContract2["TESTNET_SEPOLIA"] = "0x5847d20f9757de24395a7b3b47303684003753858737bf288716855dfb0aaf2";
|
|
4689
4714
|
return StarknetIdContract2;
|
|
4690
4715
|
})(StarknetIdContract || {});
|
|
4691
4716
|
function getStarknetIdContract(chainId) {
|
|
@@ -4694,10 +4719,121 @@ function getStarknetIdContract(chainId) {
|
|
|
4694
4719
|
return "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678" /* MAINNET */;
|
|
4695
4720
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4696
4721
|
return "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce" /* TESTNET */;
|
|
4722
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4723
|
+
return "0x5847d20f9757de24395a7b3b47303684003753858737bf288716855dfb0aaf2" /* TESTNET_SEPOLIA */;
|
|
4697
4724
|
default:
|
|
4698
4725
|
throw new Error("Starknet.id is not yet deployed on this network");
|
|
4699
4726
|
}
|
|
4700
4727
|
}
|
|
4728
|
+
var StarknetIdIdentityContract = /* @__PURE__ */ ((StarknetIdIdentityContract2) => {
|
|
4729
|
+
StarknetIdIdentityContract2["MAINNET"] = "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af";
|
|
4730
|
+
StarknetIdIdentityContract2["TESTNET"] = "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d";
|
|
4731
|
+
StarknetIdIdentityContract2["TESTNET_SEPOLIA"] = "0x718d9172f6e36183abeeff1a0db76a1851cef4ed9b9c13896da79ef4bfcb4d0";
|
|
4732
|
+
return StarknetIdIdentityContract2;
|
|
4733
|
+
})(StarknetIdIdentityContract || {});
|
|
4734
|
+
function getStarknetIdIdentityContract(chainId) {
|
|
4735
|
+
switch (chainId) {
|
|
4736
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4737
|
+
return "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af" /* MAINNET */;
|
|
4738
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4739
|
+
return "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d" /* TESTNET */;
|
|
4740
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4741
|
+
return "0x718d9172f6e36183abeeff1a0db76a1851cef4ed9b9c13896da79ef4bfcb4d0" /* TESTNET_SEPOLIA */;
|
|
4742
|
+
default:
|
|
4743
|
+
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
var StarknetIdMulticallContract = "0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";
|
|
4747
|
+
function getStarknetIdMulticallContract(chainId) {
|
|
4748
|
+
switch (chainId) {
|
|
4749
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4750
|
+
return StarknetIdMulticallContract;
|
|
4751
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4752
|
+
return StarknetIdMulticallContract;
|
|
4753
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4754
|
+
return StarknetIdMulticallContract;
|
|
4755
|
+
default:
|
|
4756
|
+
throw new Error("Starknet.id multicall contract is not yet deployed on this network");
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4759
|
+
var StarknetIdVerifierContract = /* @__PURE__ */ ((StarknetIdVerifierContract2) => {
|
|
4760
|
+
StarknetIdVerifierContract2["MAINNET"] = "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf";
|
|
4761
|
+
StarknetIdVerifierContract2["TESTNET"] = "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11";
|
|
4762
|
+
StarknetIdVerifierContract2["TESTNET_SEPOLIA"] = "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf";
|
|
4763
|
+
return StarknetIdVerifierContract2;
|
|
4764
|
+
})(StarknetIdVerifierContract || {});
|
|
4765
|
+
function getStarknetIdVerifierContract(chainId) {
|
|
4766
|
+
switch (chainId) {
|
|
4767
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4768
|
+
return "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf" /* MAINNET */;
|
|
4769
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4770
|
+
return "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11" /* TESTNET */;
|
|
4771
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4772
|
+
return "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf" /* TESTNET_SEPOLIA */;
|
|
4773
|
+
default:
|
|
4774
|
+
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
var StarknetIdPfpContract = /* @__PURE__ */ ((StarknetIdPfpContract2) => {
|
|
4778
|
+
StarknetIdPfpContract2["MAINNET"] = "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7";
|
|
4779
|
+
StarknetIdPfpContract2["TESTNET"] = "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698";
|
|
4780
|
+
StarknetIdPfpContract2["TESTNET_SEPOLIA"] = "0x070c035557d6fed57eed2ed7fa861616b487f8a95439347b805639ca076f29f0";
|
|
4781
|
+
return StarknetIdPfpContract2;
|
|
4782
|
+
})(StarknetIdPfpContract || {});
|
|
4783
|
+
function getStarknetIdPfpContract(chainId) {
|
|
4784
|
+
switch (chainId) {
|
|
4785
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4786
|
+
return "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7" /* MAINNET */;
|
|
4787
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4788
|
+
return "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698" /* TESTNET */;
|
|
4789
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4790
|
+
return "0x070c035557d6fed57eed2ed7fa861616b487f8a95439347b805639ca076f29f0" /* TESTNET_SEPOLIA */;
|
|
4791
|
+
default:
|
|
4792
|
+
throw new Error(
|
|
4793
|
+
"Starknet.id profile picture verifier contract is not yet deployed on this network"
|
|
4794
|
+
);
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
var StarknetIdPopContract = /* @__PURE__ */ ((StarknetIdPopContract2) => {
|
|
4798
|
+
StarknetIdPopContract2["MAINNET"] = "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4";
|
|
4799
|
+
StarknetIdPopContract2["TESTNET"] = "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106";
|
|
4800
|
+
StarknetIdPopContract2["TESTNET_SEPOLIA"] = "0x00f80f68443becd0e0a4a08ff5734e36dd8028507333e4a0ec034dcfdf1b793e";
|
|
4801
|
+
return StarknetIdPopContract2;
|
|
4802
|
+
})(StarknetIdPopContract || {});
|
|
4803
|
+
function getStarknetIdPopContract(chainId) {
|
|
4804
|
+
switch (chainId) {
|
|
4805
|
+
case "0x534e5f4d41494e" /* SN_MAIN */:
|
|
4806
|
+
return "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4" /* MAINNET */;
|
|
4807
|
+
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4808
|
+
return "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106" /* TESTNET */;
|
|
4809
|
+
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4810
|
+
return "0x00f80f68443becd0e0a4a08ff5734e36dd8028507333e4a0ec034dcfdf1b793e" /* TESTNET_SEPOLIA */;
|
|
4811
|
+
default:
|
|
4812
|
+
throw new Error(
|
|
4813
|
+
"Starknet.id proof of personhood verifier contract is not yet deployed on this network"
|
|
4814
|
+
);
|
|
4815
|
+
}
|
|
4816
|
+
}
|
|
4817
|
+
function execution(staticEx, ifEqual = void 0, ifNotEqual = void 0) {
|
|
4818
|
+
return new CairoCustomEnum({
|
|
4819
|
+
Static: staticEx,
|
|
4820
|
+
IfEqual: ifEqual ? tuple(ifEqual[0], ifEqual[1], ifEqual[2]) : void 0,
|
|
4821
|
+
IfNotEqual: ifNotEqual ? tuple(ifNotEqual[0], ifNotEqual[1], ifNotEqual[2]) : void 0
|
|
4822
|
+
});
|
|
4823
|
+
}
|
|
4824
|
+
function dynamicFelt(hardcoded, reference = void 0) {
|
|
4825
|
+
return new CairoCustomEnum({
|
|
4826
|
+
Hardcoded: hardcoded,
|
|
4827
|
+
Reference: reference ? tuple(reference[0], reference[1]) : void 0
|
|
4828
|
+
});
|
|
4829
|
+
}
|
|
4830
|
+
function dynamicCallData(hardcoded, reference = void 0, arrayReference = void 0) {
|
|
4831
|
+
return new CairoCustomEnum({
|
|
4832
|
+
Hardcoded: hardcoded,
|
|
4833
|
+
Reference: reference ? tuple(reference[0], reference[1]) : void 0,
|
|
4834
|
+
ArrayReference: arrayReference ? tuple(arrayReference[0], arrayReference[1]) : void 0
|
|
4835
|
+
});
|
|
4836
|
+
}
|
|
4701
4837
|
|
|
4702
4838
|
// src/provider/extensions/starknetId.ts
|
|
4703
4839
|
var StarknetId = class _StarknetId {
|
|
@@ -4717,6 +4853,19 @@ var StarknetId = class _StarknetId {
|
|
|
4717
4853
|
StarknetIdContract2
|
|
4718
4854
|
);
|
|
4719
4855
|
}
|
|
4856
|
+
async getStarkProfile(address, StarknetIdContract2, StarknetIdIdentityContract2, StarknetIdVerifierContract2, StarknetIdPfpContract2, StarknetIdPopContract2, StarknetIdMulticallContract2) {
|
|
4857
|
+
return _StarknetId.getStarkProfile(
|
|
4858
|
+
// After Mixin, this is ProviderInterface
|
|
4859
|
+
this,
|
|
4860
|
+
address,
|
|
4861
|
+
StarknetIdContract2,
|
|
4862
|
+
StarknetIdIdentityContract2,
|
|
4863
|
+
StarknetIdVerifierContract2,
|
|
4864
|
+
StarknetIdPfpContract2,
|
|
4865
|
+
StarknetIdPopContract2,
|
|
4866
|
+
StarknetIdMulticallContract2
|
|
4867
|
+
);
|
|
4868
|
+
}
|
|
4720
4869
|
static async getStarkName(provider, address, StarknetIdContract2) {
|
|
4721
4870
|
const chainId = await provider.getChainId();
|
|
4722
4871
|
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
@@ -4745,18 +4894,159 @@ var StarknetId = class _StarknetId {
|
|
|
4745
4894
|
const chainId = await provider.getChainId();
|
|
4746
4895
|
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
4747
4896
|
try {
|
|
4897
|
+
const encodedDomain = name.replace(".stark", "").split(".").map((part) => useEncoded(part).toString(10));
|
|
4748
4898
|
const addressData = await provider.callContract({
|
|
4749
4899
|
contractAddress: contract,
|
|
4750
4900
|
entrypoint: "domain_to_address",
|
|
4751
|
-
calldata: CallData.compile({
|
|
4752
|
-
domain: [useEncoded(name.replace(".stark", "")).toString(10)]
|
|
4753
|
-
})
|
|
4901
|
+
calldata: CallData.compile({ domain: encodedDomain, hint: [] })
|
|
4754
4902
|
});
|
|
4755
4903
|
return addressData[0];
|
|
4756
4904
|
} catch {
|
|
4757
4905
|
throw Error("Could not get address from stark name");
|
|
4758
4906
|
}
|
|
4759
4907
|
}
|
|
4908
|
+
static async getStarkProfile(provider, address, StarknetIdContract2, StarknetIdIdentityContract2, StarknetIdVerifierContract2, StarknetIdPfpContract2, StarknetIdPopContract2, StarknetIdMulticallContract2) {
|
|
4909
|
+
const chainId = await provider.getChainId();
|
|
4910
|
+
const contract = StarknetIdContract2 ?? getStarknetIdContract(chainId);
|
|
4911
|
+
const identityContract = StarknetIdIdentityContract2 ?? getStarknetIdIdentityContract(chainId);
|
|
4912
|
+
const verifierContract = StarknetIdVerifierContract2 ?? getStarknetIdVerifierContract(chainId);
|
|
4913
|
+
const pfpContract = StarknetIdPfpContract2 ?? getStarknetIdPfpContract(chainId);
|
|
4914
|
+
const popContract = StarknetIdPopContract2 ?? getStarknetIdPopContract(chainId);
|
|
4915
|
+
const multicallAddress = StarknetIdMulticallContract2 ?? getStarknetIdMulticallContract(chainId);
|
|
4916
|
+
try {
|
|
4917
|
+
const data = await provider.callContract({
|
|
4918
|
+
contractAddress: multicallAddress,
|
|
4919
|
+
entrypoint: "aggregate",
|
|
4920
|
+
calldata: CallData.compile({
|
|
4921
|
+
calls: [
|
|
4922
|
+
{
|
|
4923
|
+
execution: execution({}),
|
|
4924
|
+
to: dynamicFelt(contract),
|
|
4925
|
+
selector: dynamicFelt(getSelectorFromName("address_to_domain")),
|
|
4926
|
+
calldata: [dynamicCallData(address)]
|
|
4927
|
+
},
|
|
4928
|
+
{
|
|
4929
|
+
execution: execution({}),
|
|
4930
|
+
to: dynamicFelt(contract),
|
|
4931
|
+
selector: dynamicFelt(getSelectorFromName("domain_to_id")),
|
|
4932
|
+
calldata: [dynamicCallData(void 0, void 0, [0, 0])]
|
|
4933
|
+
},
|
|
4934
|
+
{
|
|
4935
|
+
execution: execution({}),
|
|
4936
|
+
to: dynamicFelt(identityContract),
|
|
4937
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4938
|
+
calldata: [
|
|
4939
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4940
|
+
dynamicCallData(encodeShortString("twitter")),
|
|
4941
|
+
dynamicCallData(verifierContract),
|
|
4942
|
+
dynamicCallData("0")
|
|
4943
|
+
]
|
|
4944
|
+
},
|
|
4945
|
+
{
|
|
4946
|
+
execution: execution({}),
|
|
4947
|
+
to: dynamicFelt(identityContract),
|
|
4948
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4949
|
+
calldata: [
|
|
4950
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4951
|
+
dynamicCallData(encodeShortString("github")),
|
|
4952
|
+
dynamicCallData(verifierContract),
|
|
4953
|
+
dynamicCallData("0")
|
|
4954
|
+
]
|
|
4955
|
+
},
|
|
4956
|
+
{
|
|
4957
|
+
execution: execution({}),
|
|
4958
|
+
to: dynamicFelt(identityContract),
|
|
4959
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4960
|
+
calldata: [
|
|
4961
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4962
|
+
dynamicCallData(encodeShortString("discord")),
|
|
4963
|
+
dynamicCallData(verifierContract),
|
|
4964
|
+
dynamicCallData("0")
|
|
4965
|
+
]
|
|
4966
|
+
},
|
|
4967
|
+
{
|
|
4968
|
+
execution: execution({}),
|
|
4969
|
+
to: dynamicFelt(identityContract),
|
|
4970
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4971
|
+
calldata: [
|
|
4972
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4973
|
+
dynamicCallData(encodeShortString("proof_of_personhood")),
|
|
4974
|
+
dynamicCallData(popContract),
|
|
4975
|
+
dynamicCallData("0")
|
|
4976
|
+
]
|
|
4977
|
+
},
|
|
4978
|
+
// PFP
|
|
4979
|
+
{
|
|
4980
|
+
execution: execution({}),
|
|
4981
|
+
to: dynamicFelt(identityContract),
|
|
4982
|
+
selector: dynamicFelt(getSelectorFromName("get_verifier_data")),
|
|
4983
|
+
calldata: [
|
|
4984
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4985
|
+
dynamicCallData(encodeShortString("nft_pp_contract")),
|
|
4986
|
+
dynamicCallData(pfpContract),
|
|
4987
|
+
dynamicCallData("0")
|
|
4988
|
+
]
|
|
4989
|
+
},
|
|
4990
|
+
{
|
|
4991
|
+
execution: execution({}),
|
|
4992
|
+
to: dynamicFelt(identityContract),
|
|
4993
|
+
selector: dynamicFelt(getSelectorFromName("get_extended_verifier_data")),
|
|
4994
|
+
calldata: [
|
|
4995
|
+
dynamicCallData(void 0, [1, 0]),
|
|
4996
|
+
dynamicCallData(encodeShortString("nft_pp_id")),
|
|
4997
|
+
dynamicCallData("2"),
|
|
4998
|
+
dynamicCallData(pfpContract),
|
|
4999
|
+
dynamicCallData("0")
|
|
5000
|
+
]
|
|
5001
|
+
},
|
|
5002
|
+
{
|
|
5003
|
+
execution: execution(void 0, void 0, [6, 0, 0]),
|
|
5004
|
+
to: dynamicFelt(void 0, [6, 0]),
|
|
5005
|
+
selector: dynamicFelt(getSelectorFromName("tokenURI")),
|
|
5006
|
+
calldata: [dynamicCallData(void 0, [7, 1]), dynamicCallData(void 0, [7, 2])]
|
|
5007
|
+
}
|
|
5008
|
+
]
|
|
5009
|
+
})
|
|
5010
|
+
});
|
|
5011
|
+
if (Array.isArray(data)) {
|
|
5012
|
+
const size = parseInt(data[0], 16);
|
|
5013
|
+
const finalArray = [];
|
|
5014
|
+
let index = 1;
|
|
5015
|
+
for (let i = 0; i < size; i += 1) {
|
|
5016
|
+
if (index < data.length) {
|
|
5017
|
+
const subArraySize = parseInt(data[index], 16);
|
|
5018
|
+
index += 1;
|
|
5019
|
+
const subArray = data.slice(index, index + subArraySize);
|
|
5020
|
+
finalArray.push(subArray);
|
|
5021
|
+
index += subArraySize;
|
|
5022
|
+
} else {
|
|
5023
|
+
break;
|
|
5024
|
+
}
|
|
5025
|
+
}
|
|
5026
|
+
const name = useDecoded(finalArray[0].slice(1).map((hexString) => BigInt(hexString)));
|
|
5027
|
+
const twitter = finalArray[2][0] !== "0x0" ? BigInt(finalArray[2][0]).toString() : void 0;
|
|
5028
|
+
const github = finalArray[3][0] !== "0x0" ? BigInt(finalArray[3][0]).toString() : void 0;
|
|
5029
|
+
const discord = finalArray[4][0] !== "0x0" ? BigInt(finalArray[4][0]).toString() : void 0;
|
|
5030
|
+
const proofOfPersonhood = finalArray[5][0] === "0x1";
|
|
5031
|
+
const profilePictureMetadata = data[0] === "0x9" ? finalArray[8].slice(1).map((val) => decodeShortString(val)).join("") : void 0;
|
|
5032
|
+
const profilePicture = profilePictureMetadata || `https://starknet.id/api/identicons/${BigInt(finalArray[1][0]).toString()}`;
|
|
5033
|
+
return {
|
|
5034
|
+
name,
|
|
5035
|
+
twitter,
|
|
5036
|
+
github,
|
|
5037
|
+
discord,
|
|
5038
|
+
proofOfPersonhood,
|
|
5039
|
+
profilePicture
|
|
5040
|
+
};
|
|
5041
|
+
}
|
|
5042
|
+
throw Error("Error while calling aggregate function");
|
|
5043
|
+
} catch (e) {
|
|
5044
|
+
if (e instanceof Error) {
|
|
5045
|
+
throw e;
|
|
5046
|
+
}
|
|
5047
|
+
throw Error("Could not get user stark profile data from address");
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
4760
5050
|
};
|
|
4761
5051
|
|
|
4762
5052
|
// src/provider/extensions/default.ts
|
|
@@ -4979,11 +5269,18 @@ function getMerkleTreeType(types, ctx) {
|
|
|
4979
5269
|
return "raw";
|
|
4980
5270
|
}
|
|
4981
5271
|
function encodeType(types, type, revision = "0" /* Legacy */) {
|
|
4982
|
-
const
|
|
5272
|
+
const allTypes = revision === "1" /* Active */ ? { ...types, ...revisionConfiguration[revision].presetTypes } : types;
|
|
5273
|
+
const [primary, ...dependencies] = getDependencies(
|
|
5274
|
+
allTypes,
|
|
5275
|
+
type,
|
|
5276
|
+
void 0,
|
|
5277
|
+
void 0,
|
|
5278
|
+
revision
|
|
5279
|
+
);
|
|
4983
5280
|
const newTypes = !primary ? [] : [primary, ...dependencies.sort()];
|
|
4984
5281
|
const esc = revisionConfiguration[revision].escapeTypeString;
|
|
4985
5282
|
return newTypes.map((dependency) => {
|
|
4986
|
-
const dependencyElements =
|
|
5283
|
+
const dependencyElements = allTypes[dependency].map((t) => {
|
|
4987
5284
|
const targetType = t.type === "enum" && revision === "1" /* Active */ ? t.contains : t.type;
|
|
4988
5285
|
const typeString = targetType.match(/^\(.*\)$/) ? `(${targetType.slice(1, -1).split(",").map((e) => e ? esc(e) : e).join(",")})` : esc(targetType);
|
|
4989
5286
|
return `${esc(t.name)}:${typeString}`;
|
|
@@ -5381,7 +5678,12 @@ var Account = class extends RpcProvider2 {
|
|
|
5381
5678
|
return this.estimateInvokeFee(calls, estimateFeeDetails);
|
|
5382
5679
|
}
|
|
5383
5680
|
async estimateInvokeFee(calls, details = {}) {
|
|
5384
|
-
const {
|
|
5681
|
+
const {
|
|
5682
|
+
nonce: providedNonce,
|
|
5683
|
+
blockIdentifier,
|
|
5684
|
+
version: providedVersion,
|
|
5685
|
+
skipValidate = true
|
|
5686
|
+
} = details;
|
|
5385
5687
|
const transactions = Array.isArray(calls) ? calls : [calls];
|
|
5386
5688
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
5387
5689
|
const version = toTransactionVersion(
|
|
@@ -5396,7 +5698,8 @@ var Account = class extends RpcProvider2 {
|
|
|
5396
5698
|
maxFee: ZERO,
|
|
5397
5699
|
version,
|
|
5398
5700
|
chainId,
|
|
5399
|
-
cairoVersion: await this.getCairoVersion()
|
|
5701
|
+
cairoVersion: await this.getCairoVersion(),
|
|
5702
|
+
skipValidate
|
|
5400
5703
|
};
|
|
5401
5704
|
const invocation = await this.buildInvocation(transactions, signerDetails);
|
|
5402
5705
|
return super.getInvokeEstimateFee(
|
|
@@ -5407,7 +5710,12 @@ var Account = class extends RpcProvider2 {
|
|
|
5407
5710
|
);
|
|
5408
5711
|
}
|
|
5409
5712
|
async estimateDeclareFee(payload, details = {}) {
|
|
5410
|
-
const {
|
|
5713
|
+
const {
|
|
5714
|
+
blockIdentifier,
|
|
5715
|
+
nonce: providedNonce,
|
|
5716
|
+
version: providedVersion,
|
|
5717
|
+
skipValidate = true
|
|
5718
|
+
} = details;
|
|
5411
5719
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
5412
5720
|
const version = toTransactionVersion(
|
|
5413
5721
|
!isSierra(payload.contract) ? "0x100000000000000000000000000000001" /* F1 */ : this.getPreferredVersion("0x100000000000000000000000000000002" /* F2 */, "0x100000000000000000000000000000003" /* F3 */),
|
|
@@ -5421,8 +5729,9 @@ var Account = class extends RpcProvider2 {
|
|
|
5421
5729
|
version,
|
|
5422
5730
|
walletAddress: this.address,
|
|
5423
5731
|
maxFee: ZERO,
|
|
5424
|
-
cairoVersion: void 0
|
|
5732
|
+
cairoVersion: void 0,
|
|
5425
5733
|
// unused parameter
|
|
5734
|
+
skipValidate
|
|
5426
5735
|
});
|
|
5427
5736
|
return super.getDeclareEstimateFee(
|
|
5428
5737
|
declareContractTransaction,
|
|
@@ -5437,7 +5746,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5437
5746
|
constructorCalldata = [],
|
|
5438
5747
|
contractAddress
|
|
5439
5748
|
}, details = {}) {
|
|
5440
|
-
const { blockIdentifier, version: providedVersion } = details;
|
|
5749
|
+
const { blockIdentifier, version: providedVersion, skipValidate = true } = details;
|
|
5441
5750
|
const version = toTransactionVersion(
|
|
5442
5751
|
this.getPreferredVersion("0x100000000000000000000000000000001" /* F1 */, "0x100000000000000000000000000000003" /* F3 */),
|
|
5443
5752
|
toFeeVersion(providedVersion)
|
|
@@ -5454,8 +5763,9 @@ var Account = class extends RpcProvider2 {
|
|
|
5454
5763
|
walletAddress: this.address,
|
|
5455
5764
|
// unused parameter
|
|
5456
5765
|
maxFee: ZERO,
|
|
5457
|
-
cairoVersion: void 0
|
|
5766
|
+
cairoVersion: void 0,
|
|
5458
5767
|
// unused parameter,
|
|
5768
|
+
skipValidate
|
|
5459
5769
|
}
|
|
5460
5770
|
);
|
|
5461
5771
|
return super.getDeployAccountEstimateFee(
|
|
@@ -5491,7 +5801,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5491
5801
|
});
|
|
5492
5802
|
}
|
|
5493
5803
|
async simulateTransaction(invocations, details = {}) {
|
|
5494
|
-
const { nonce, blockIdentifier, skipValidate, skipExecute, version } = details;
|
|
5804
|
+
const { nonce, blockIdentifier, skipValidate = true, skipExecute, version } = details;
|
|
5495
5805
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
5496
5806
|
...v3Details(details),
|
|
5497
5807
|
versions: [
|
|
@@ -5503,7 +5813,8 @@ var Account = class extends RpcProvider2 {
|
|
|
5503
5813
|
)
|
|
5504
5814
|
],
|
|
5505
5815
|
nonce,
|
|
5506
|
-
blockIdentifier
|
|
5816
|
+
blockIdentifier,
|
|
5817
|
+
skipValidate
|
|
5507
5818
|
});
|
|
5508
5819
|
return super.getSimulateTransaction(accountInvocations, {
|
|
5509
5820
|
blockIdentifier,
|
|
@@ -5789,7 +6100,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5789
6100
|
}
|
|
5790
6101
|
async buildInvocation(call, details) {
|
|
5791
6102
|
const calldata = getExecuteCalldata(call, await this.getCairoVersion());
|
|
5792
|
-
const signature = await this.signer.signTransaction(call, details);
|
|
6103
|
+
const signature = !details.skipValidate ? await this.signer.signTransaction(call, details) : [];
|
|
5793
6104
|
return {
|
|
5794
6105
|
...v3Details(details),
|
|
5795
6106
|
contractAddress: this.address,
|
|
@@ -5803,14 +6114,14 @@ var Account = class extends RpcProvider2 {
|
|
|
5803
6114
|
if (typeof compiledClassHash === "undefined" && (details.version === "0x100000000000000000000000000000003" /* F3 */ || details.version === "0x3" /* V3 */)) {
|
|
5804
6115
|
throw Error("V3 Transaction work with Cairo1 Contracts and require compiledClassHash");
|
|
5805
6116
|
}
|
|
5806
|
-
const signature = await this.signer.signDeclareTransaction({
|
|
6117
|
+
const signature = !details.skipValidate ? await this.signer.signDeclareTransaction({
|
|
5807
6118
|
...details,
|
|
5808
6119
|
...v3Details(details),
|
|
5809
6120
|
classHash,
|
|
5810
6121
|
compiledClassHash,
|
|
5811
|
-
// TODO: TS
|
|
6122
|
+
// TODO: TS, cast because optional for v2 and required for v3, thrown if not present
|
|
5812
6123
|
senderAddress: details.walletAddress
|
|
5813
|
-
});
|
|
6124
|
+
}) : [];
|
|
5814
6125
|
return {
|
|
5815
6126
|
senderAddress: details.walletAddress,
|
|
5816
6127
|
signature,
|
|
@@ -5826,14 +6137,14 @@ var Account = class extends RpcProvider2 {
|
|
|
5826
6137
|
}, details) {
|
|
5827
6138
|
const compiledCalldata = CallData.compile(constructorCalldata);
|
|
5828
6139
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, compiledCalldata, 0);
|
|
5829
|
-
const signature = await this.signer.signDeployAccountTransaction({
|
|
6140
|
+
const signature = !details.skipValidate ? await this.signer.signDeployAccountTransaction({
|
|
5830
6141
|
...details,
|
|
5831
6142
|
...v3Details(details),
|
|
5832
6143
|
classHash,
|
|
5833
6144
|
contractAddress,
|
|
5834
6145
|
addressSalt,
|
|
5835
6146
|
constructorCalldata: compiledCalldata
|
|
5836
|
-
});
|
|
6147
|
+
}) : [];
|
|
5837
6148
|
return {
|
|
5838
6149
|
...v3Details(details),
|
|
5839
6150
|
classHash,
|
|
@@ -5866,7 +6177,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5866
6177
|
return calls;
|
|
5867
6178
|
}
|
|
5868
6179
|
async accountInvocationsFactory(invocations, details) {
|
|
5869
|
-
const { nonce, blockIdentifier } = details;
|
|
6180
|
+
const { nonce, blockIdentifier, skipValidate = true } = details;
|
|
5870
6181
|
const safeNonce = await this.getNonceSafe(nonce);
|
|
5871
6182
|
const chainId = await this.getChainId();
|
|
5872
6183
|
const versions = details.versions.map((it) => toTransactionVersion(it));
|
|
@@ -5882,7 +6193,8 @@ var Account = class extends RpcProvider2 {
|
|
|
5882
6193
|
maxFee: ZERO,
|
|
5883
6194
|
chainId,
|
|
5884
6195
|
cairoVersion,
|
|
5885
|
-
version: ""
|
|
6196
|
+
version: "",
|
|
6197
|
+
skipValidate
|
|
5886
6198
|
};
|
|
5887
6199
|
const common = {
|
|
5888
6200
|
type: transaction.type,
|