dop-wallet-v6 1.1.8 → 1.1.9
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/dist/services/artifacts/artifact-util.js +13 -5
- package/dist/services/artifacts/artifact-util.js.map +1 -1
- package/dist/services/artifacts/json/artifact-v2-hashes.json +65 -0
- package/dist/services/dop/core/artifacts.d.ts +2 -2
- package/dist/services/dop/core/artifacts.js +3 -1
- package/dist/services/dop/core/artifacts.js.map +1 -1
- package/dist/services/dop/core/engine.js +3 -0
- package/dist/services/dop/core/engine.js.map +1 -1
- package/dist/services/dop/quick-sync/graphql/index.js +5 -5
- package/dist/services/dop/quick-sync/graphql/index.js.map +1 -1
- package/dist/services/dop/util/commitment.d.ts +1 -2
- package/dist/services/dop/util/commitment.js +3 -2
- package/dist/services/dop/util/commitment.js.map +1 -1
- package/dist/services/dop/wallets/wallets.d.ts +2 -0
- package/dist/services/dop/wallets/wallets.js +17 -2
- package/dist/services/dop/wallets/wallets.js.map +1 -1
- package/dist/services/transactions/tx-cross-contract-calls.d.ts +2 -4
- package/dist/services/transactions/tx-cross-contract-calls.js +260 -108
- package/dist/services/transactions/tx-cross-contract-calls.js.map +1 -1
- package/dist/services/transactions/tx-gas-details.js +14 -2
- package/dist/services/transactions/tx-gas-details.js.map +1 -1
- package/dist/services/transactions/tx-gas-relayer-fee-estimator.d.ts +1 -4
- package/dist/services/transactions/tx-gas-relayer-fee-estimator.js +185 -86
- package/dist/services/transactions/tx-gas-relayer-fee-estimator.js.map +1 -1
- package/dist/services/transactions/tx-generator.d.ts +2 -3
- package/dist/services/transactions/tx-generator.js +54 -25
- package/dist/services/transactions/tx-generator.js.map +1 -1
- package/dist/services/transactions/tx-proof-transfer.d.ts +2 -1
- package/dist/services/transactions/tx-proof-transfer.js +11 -17
- package/dist/services/transactions/tx-proof-transfer.js.map +1 -1
- package/dist/services/transactions/tx-proof-unshield.d.ts +2 -3
- package/dist/services/transactions/tx-proof-unshield.js +143 -84
- package/dist/services/transactions/tx-proof-unshield.js.map +1 -1
- package/dist/services/transactions/tx-shield-base-token.d.ts +1 -1
- package/dist/services/transactions/tx-shield-base-token.js +8 -5
- package/dist/services/transactions/tx-shield-base-token.js.map +1 -1
- package/dist/services/transactions/tx-shield.js +4 -0
- package/dist/services/transactions/tx-shield.js.map +1 -1
- package/dist/services/transactions/tx-transfer.d.ts +1 -2
- package/dist/services/transactions/tx-transfer.js +53 -14
- package/dist/services/transactions/tx-transfer.js.map +1 -1
- package/dist/services/transactions/tx-unshield.d.ts +1 -3
- package/dist/services/transactions/tx-unshield.js +116 -37
- package/dist/services/transactions/tx-unshield.js.map +1 -1
- package/package.json +3 -3
|
@@ -6,15 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getArtifactUrl = exports.decompressArtifact = exports.getArtifactDownloadsPaths = exports.artifactDownloadsPath = exports.getArtifactVariantString = exports.artifactDownloadsDir = void 0;
|
|
7
7
|
const dop_sharedmodel_v5_1 = require("dop-sharedmodel-v5");
|
|
8
8
|
const decompress_1 = __importDefault(require("brotli/decompress"));
|
|
9
|
-
const IPFS_GATEWAY = 'https://ipfs-lb.com';
|
|
10
9
|
// const IPFS_GATEWAY = 'https://ipfs-lb.com';
|
|
10
|
+
// const IPFS_GATEWAY = 'https://ipfs-lb.com';
|
|
11
|
+
const IPFS_GATEWAY = 'https://purple-abstract-dingo-439.mypinata.cloud';
|
|
11
12
|
// https://ipfs-lb.com/ipfs/QmPyk6hsbphY9hqBYzn1CPumAToLvSJ3zeQQVjZmicT6wQ/
|
|
12
13
|
// const MASTER_IPFS_HASH_ARTIFACTS = 'QmeBrG7pii1qTqsn7rusvDiqXopHPjCT9gR4PsmW7wXqZq';
|
|
13
14
|
// const MASTER_IPFS_HASH_ARTIFACTS = 'QmYsMzH1PkC8eQq8nZthZb4us6C9M2JYNjhBspUPHjpkdn';
|
|
14
15
|
// const MASTER_IPFS_HASH_ARTIFACTS = 'QmNqY8bHBEHgj96GSU1eyMtyZo1z5yTaM7yjQ7F1TbKE1W';
|
|
15
16
|
// const MASTER_IPFS_HASH_ARTIFACTS = 'QmX6t13wppf5pUobRpmwwnyGeSHux7ecTuoQXer376hips';
|
|
16
17
|
// const MASTER_IPFS_HASH_ARTIFACTS = 'Qmba1JgVSQDZKUWUi6DUs9ekqo2Ta1hN3moxC2Na1eAJyJ';
|
|
17
|
-
const MASTER_IPFS_HASH_ARTIFACTS = '
|
|
18
|
+
// const MASTER_IPFS_HASH_ARTIFACTS = 'QmNT44msrqeVj1WHFkWxi9Vg6KRoG573AVDBEsKmrSDyb5';
|
|
19
|
+
const MASTER_IPFS_HASH_ARTIFACTS = 'QmPKbQmGt17uic8xJLdA4wXSAZwSM4Aeg6dgqLohWrqB2Q';
|
|
18
20
|
// https://purple-abstract-dingo-439.mypinata.cloud/ipfs/Qmba1JgVSQDZKUWUi6DUs9ekqo2Ta1hN3moxC2Na1eAJyJ/
|
|
19
21
|
// return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/QmPyk6hsbphY9hqBYzn1CPumAToLvSJ3zeQQVjZmicT6wQ/${artifactFilepath}`
|
|
20
22
|
// QmRJrPzD2hUmsWr7fHLsrQAJZm5J1xwji1vE2u4VFgmQcx
|
|
@@ -23,7 +25,7 @@ const artifactDownloadsDir = (artifactVariantString) => {
|
|
|
23
25
|
};
|
|
24
26
|
exports.artifactDownloadsDir = artifactDownloadsDir;
|
|
25
27
|
const getArtifactVariantString = (nullifiers, commitments) => {
|
|
26
|
-
return `${nullifiers}
|
|
28
|
+
return `${nullifiers}x0`;
|
|
27
29
|
};
|
|
28
30
|
exports.getArtifactVariantString = getArtifactVariantString;
|
|
29
31
|
const artifactDownloadsPath = (artifactName, artifactVariantString) => {
|
|
@@ -68,8 +70,14 @@ const getArtifactIPFSFilepath = (artifactName, artifactVariantString) => {
|
|
|
68
70
|
};
|
|
69
71
|
const getArtifactUrl = (artifactName, artifactVariantString) => {
|
|
70
72
|
const artifactFilepath = getArtifactIPFSFilepath(artifactName, artifactVariantString);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
return `${IPFS_GATEWAY}/ipfs/${MASTER_IPFS_HASH_ARTIFACTS}/${artifactFilepath}`;
|
|
74
|
+
// Qma1ATexs5LxAyjN52FFFxGwxgp5swB9GAt54kyCt39Xgk
|
|
75
|
+
// return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/QmNT44msrqeVj1WHFkWxi9Vg6KRoG573AVDBEsKmrSDyb5/${artifactFilepath}`
|
|
76
|
+
// https://gateway.pinata.cloud/ipfs/QmVrZ9TtZt4ZNuV4RgDqt7M7ZrsZnDUEp8QzwjLLXCp6ye/
|
|
77
|
+
// return `https://gateway.pinata.cloud/ipfs/QmVrZ9TtZt4ZNuV4RgDqt7M7ZrsZnDUEp8QzwjLLXCp6ye/${artifactFilepath}`
|
|
78
|
+
// return `https://ipfs.tizzew.com/ipfs/Qma11AJv58vSBSzE3fhUYEVxfJZCAjkD1ixLtMsGFgPUXp/${artifactFilepath}`
|
|
79
|
+
// return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/QmeL38q7wK7W1nDajhS5zkZdqyrJ5HmiR477E3yrn6S8DJ/${artifactFilepath}`
|
|
80
|
+
// return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/Qma1ATexs5LxAyjN52FFFxGwxgp5swB9GAt54kyCt39Xgk/${artifactFilepath}`
|
|
73
81
|
};
|
|
74
82
|
exports.getArtifactUrl = getArtifactUrl;
|
|
75
83
|
//# sourceMappingURL=artifact-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-util.js","sourceRoot":"","sources":["../../../src/services/artifacts/artifact-util.ts"],"names":[],"mappings":";;;;;;AAAA,2DAG4B;AAC5B,mEAAiD;AAEjD,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"artifact-util.js","sourceRoot":"","sources":["../../../src/services/artifacts/artifact-util.ts"],"names":[],"mappings":";;;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GAAG,YAAY,SAAS,0BAA0B,IAAI,gBAAgB,EAAE,CAAC;IAChF,iDAAiD;IACjD,oIAAoI;IACpI,qFAAqF;IACrF,gHAAgH;IAChH,2GAA2G;IAC3G,oIAAoI;IAGpI,oIAAoI;AACtI,CAAC,CAAC;AAlBW,QAAA,cAAc,kBAkBzB","sourcesContent":["import {\n ArtifactName,\n ArtifactMapping,\n} from 'dop-sharedmodel-v5';\nimport brotliDecompress from 'brotli/decompress';\n\n// const IPFS_GATEWAY = 'https://ipfs-lb.com';\n// const IPFS_GATEWAY = 'https://ipfs-lb.com';\nconst IPFS_GATEWAY = 'https://purple-abstract-dingo-439.mypinata.cloud';\n\n// https://ipfs-lb.com/ipfs/QmPyk6hsbphY9hqBYzn1CPumAToLvSJ3zeQQVjZmicT6wQ/\n\n// const MASTER_IPFS_HASH_ARTIFACTS = 'QmeBrG7pii1qTqsn7rusvDiqXopHPjCT9gR4PsmW7wXqZq';\n// const MASTER_IPFS_HASH_ARTIFACTS = 'QmYsMzH1PkC8eQq8nZthZb4us6C9M2JYNjhBspUPHjpkdn';\n// const MASTER_IPFS_HASH_ARTIFACTS = 'QmNqY8bHBEHgj96GSU1eyMtyZo1z5yTaM7yjQ7F1TbKE1W';\n// const MASTER_IPFS_HASH_ARTIFACTS = 'QmX6t13wppf5pUobRpmwwnyGeSHux7ecTuoQXer376hips';\n// const MASTER_IPFS_HASH_ARTIFACTS = 'Qmba1JgVSQDZKUWUi6DUs9ekqo2Ta1hN3moxC2Na1eAJyJ';\n// const MASTER_IPFS_HASH_ARTIFACTS = 'QmNT44msrqeVj1WHFkWxi9Vg6KRoG573AVDBEsKmrSDyb5';\nconst MASTER_IPFS_HASH_ARTIFACTS = 'QmPKbQmGt17uic8xJLdA4wXSAZwSM4Aeg6dgqLohWrqB2Q';\n\n// https://purple-abstract-dingo-439.mypinata.cloud/ipfs/Qmba1JgVSQDZKUWUi6DUs9ekqo2Ta1hN3moxC2Na1eAJyJ/\n// return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/QmPyk6hsbphY9hqBYzn1CPumAToLvSJ3zeQQVjZmicT6wQ/${artifactFilepath}`\n\n// QmRJrPzD2hUmsWr7fHLsrQAJZm5J1xwji1vE2u4VFgmQcx\n\nexport const artifactDownloadsDir = (artifactVariantString: string) => {\n return `artifacts-v2.1/${artifactVariantString}`;\n};\n\nexport const getArtifactVariantString = (\n nullifiers: number,\n commitments: number,\n) => {\n return `${nullifiers}x0`;\n};\n\nexport const artifactDownloadsPath = (\n artifactName: ArtifactName,\n artifactVariantString: string,\n): string => {\n switch (artifactName) {\n case ArtifactName.WASM:\n return `${artifactDownloadsDir(artifactVariantString)}/wasm`;\n case ArtifactName.ZKEY:\n return `${artifactDownloadsDir(artifactVariantString)}/zkey`;\n case ArtifactName.VKEY:\n return `${artifactDownloadsDir(artifactVariantString)}/vkey.json`;\n case ArtifactName.DAT:\n return `${artifactDownloadsDir(artifactVariantString)}/dat`;\n }\n};\n\nexport const getArtifactDownloadsPaths = (\n artifactVariantString: string,\n): ArtifactMapping => {\n return {\n [ArtifactName.ZKEY]: artifactDownloadsPath(\n ArtifactName.ZKEY,\n artifactVariantString,\n ),\n [ArtifactName.WASM]: artifactDownloadsPath(\n ArtifactName.WASM,\n artifactVariantString,\n ),\n [ArtifactName.VKEY]: artifactDownloadsPath(\n ArtifactName.VKEY,\n artifactVariantString,\n ),\n [ArtifactName.DAT]: artifactDownloadsPath(\n ArtifactName.DAT,\n artifactVariantString,\n ),\n };\n};\n\nexport const decompressArtifact = (arrayBuffer: ArrayBuffer): Uint8Array => {\n const decompress = brotliDecompress as (input: Uint8Array) => Uint8Array;\n return decompress(Buffer.from(arrayBuffer));\n};\n\nconst getArtifactIPFSFilepath = (\n artifactName: ArtifactName,\n artifactVariantString: string,\n) => {\n switch (artifactName) {\n case ArtifactName.ZKEY:\n return `${artifactVariantString}/zkey.br`;\n case ArtifactName.WASM:\n return `prover/snarkjs/${artifactVariantString}.wasm.br`;\n case ArtifactName.VKEY:\n return `${artifactVariantString}/vkey.json`;\n case ArtifactName.DAT:\n return `prover/native/${artifactVariantString}.dat.br`;\n }\n throw new Error('Invalid artifact.');\n};\n\nexport const getArtifactUrl = (\n artifactName: ArtifactName,\n artifactVariantString: string,\n) => {\n const artifactFilepath = getArtifactIPFSFilepath(\n artifactName,\n artifactVariantString,\n );\n return `${IPFS_GATEWAY}/ipfs/${MASTER_IPFS_HASH_ARTIFACTS}/${artifactFilepath}`;\n // Qma1ATexs5LxAyjN52FFFxGwxgp5swB9GAt54kyCt39Xgk\n // return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/QmNT44msrqeVj1WHFkWxi9Vg6KRoG573AVDBEsKmrSDyb5/${artifactFilepath}`\n // https://gateway.pinata.cloud/ipfs/QmVrZ9TtZt4ZNuV4RgDqt7M7ZrsZnDUEp8QzwjLLXCp6ye/\n // return `https://gateway.pinata.cloud/ipfs/QmVrZ9TtZt4ZNuV4RgDqt7M7ZrsZnDUEp8QzwjLLXCp6ye/${artifactFilepath}`\n // return `https://ipfs.tizzew.com/ipfs/Qma11AJv58vSBSzE3fhUYEVxfJZCAjkD1ixLtMsGFgPUXp/${artifactFilepath}`\n // return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/QmeL38q7wK7W1nDajhS5zkZdqyrJ5HmiR477E3yrn6S8DJ/${artifactFilepath}`\n\n \n // return `https://purple-abstract-dingo-439.mypinata.cloud/ipfs/Qma1ATexs5LxAyjN52FFFxGwxgp5swB9GAt54kyCt39Xgk/${artifactFilepath}`\n};\n"]}
|
|
@@ -1,4 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
+
"1x0": {
|
|
3
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
4
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
5
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
6
|
+
},
|
|
7
|
+
"2x0": {
|
|
8
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
9
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
10
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
11
|
+
},
|
|
12
|
+
"3x0": {
|
|
13
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
14
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
15
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
16
|
+
},
|
|
17
|
+
"4x0": {
|
|
18
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
19
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
20
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
21
|
+
},
|
|
22
|
+
"5x0": {
|
|
23
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
24
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
25
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
26
|
+
},
|
|
27
|
+
"6x0": {
|
|
28
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
29
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
30
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
31
|
+
},
|
|
32
|
+
"7x0": {
|
|
33
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
34
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
35
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
36
|
+
},
|
|
37
|
+
"8x0": {
|
|
38
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
39
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
40
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
41
|
+
},
|
|
42
|
+
"9x0": {
|
|
43
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
44
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
45
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
46
|
+
},
|
|
47
|
+
"10x0": {
|
|
48
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
49
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
50
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
51
|
+
},
|
|
52
|
+
"11x0": {
|
|
53
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
54
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
55
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
56
|
+
},
|
|
57
|
+
"12x0": {
|
|
58
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
59
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
60
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
61
|
+
},
|
|
62
|
+
"13x0": {
|
|
63
|
+
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
64
|
+
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
65
|
+
"dat": "f5242d237381764dd5a20214846dd1c6a515f9eb7aa60a15e851c7ce681e2c62"
|
|
66
|
+
},
|
|
2
67
|
"10x1": {
|
|
3
68
|
"zkey": "f4a6dd3c59690d14d808b9bbe9a182b5a30df3828aadf28dfaaa129faecf2837",
|
|
4
69
|
"wasm": "13624c30f0ff503d638ad5cf42813cf2c305921e0d4dc709923db532b6cc5ed9",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ArtifactGetter,
|
|
1
|
+
import { ArtifactGetter, PublicInputsBalance } from 'dop-engine-v5';
|
|
2
2
|
import { Artifact } from 'dop-sharedmodel-v5';
|
|
3
3
|
import { ArtifactStore } from '../../artifacts/artifact-store';
|
|
4
4
|
export declare const artifactCache: MapType<Artifact>;
|
|
5
5
|
export declare const setArtifactStore: (store: ArtifactStore) => void;
|
|
6
6
|
export declare const setUseNativeArtifacts: (useNative: boolean) => void;
|
|
7
|
-
export declare const getArtifacts: (inputs:
|
|
7
|
+
export declare const getArtifacts: (inputs: PublicInputsBalance) => Promise<Artifact>;
|
|
8
8
|
export declare const artifactGetterDownloadJustInTime: ArtifactGetter;
|
|
9
9
|
export declare const overrideArtifact: (artifactVariant: string, artifact: Artifact) => void;
|
|
10
10
|
export declare const clearArtifactCache: () => void;
|
|
@@ -17,7 +17,9 @@ const setUseNativeArtifacts = (useNative) => {
|
|
|
17
17
|
exports.setUseNativeArtifacts = setUseNativeArtifacts;
|
|
18
18
|
const getArtifacts = async (inputs) => {
|
|
19
19
|
const nullifiers = inputs.nullifiers.length;
|
|
20
|
-
const
|
|
20
|
+
// const nullifiers = 0;
|
|
21
|
+
const commitments = 0;
|
|
22
|
+
// const commitments = inputs.commitmentsOut.length;
|
|
21
23
|
(0, dop_sharedmodel_v5_1.assertArtifactExists)(nullifiers, commitments);
|
|
22
24
|
if (useNativeArtifacts) {
|
|
23
25
|
if (commitments > 3) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../../src/services/dop/core/artifacts.ts"],"names":[],"mappings":";;;AACA,2DAI4B;AAC5B,6EAAyE;AAEzE,iEAAyE;AAEzE,IAAI,aAA4B,CAAC;AACjC,IAAI,kBAA2B,CAAC;AAEnB,QAAA,aAAa,GAAsB,EAAE,CAAC;AAE5C,MAAM,gBAAgB,GAAG,CAAC,KAAoB,EAAE,EAAE;IACvD,aAAa,GAAG,KAAK,CAAC;AACxB,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AACK,MAAM,qBAAqB,GAAG,CAAC,SAAkB,EAAE,EAAE;IAC1D,kBAAkB,GAAG,SAAS,CAAC;AACjC,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAEK,MAAM,YAAY,GAAG,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../../src/services/dop/core/artifacts.ts"],"names":[],"mappings":";;;AACA,2DAI4B;AAC5B,6EAAyE;AAEzE,iEAAyE;AAEzE,IAAI,aAA4B,CAAC;AACjC,IAAI,kBAA2B,CAAC;AAEnB,QAAA,aAAa,GAAsB,EAAE,CAAC;AAE5C,MAAM,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BAAiB,CAAC,qBAAqB,CAAC,CAAC;IAC1D,MAAM,mBAAmB,GAAG,MAAM,UAAU,CAAC,sBAAsB,CACjE,qBAAqB,CACtB,CAAC;IACF,qBAAa,CAAC,qBAAqB,CAAC,GAAG,mBAAmB,CAAC;IAC3D,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAhDW,QAAA,YAAY,gBAgDvB;AAEW,QAAA,gCAAgC,GAAmB;IAC9D,oBAAoB,EAApB,yCAAoB;IACpB,YAAY,EAAZ,oBAAY;CACb,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAC9B,eAAuB,EACvB,QAAkB,EAClB,EAAE;IACF,qBAAa,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC;AAC5C,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B;AAEK,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,KAAK,MAAM,GAAG,IAAI,qBAAa,EAAE;QAC/B,IAAI,IAAA,8BAAS,EAAC,qBAAa,CAAC,GAAG,CAAC,CAAC,EAAE;YACjC,OAAO,qBAAa,CAAC,GAAG,CAAC,CAAC;SAC3B;KACF;AACH,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B","sourcesContent":["import { ArtifactGetter, PublicInputs, PublicInputsBalance } from 'dop-engine-v5';\nimport {\n Artifact,\n assertArtifactExists,\n isDefined,\n} from 'dop-sharedmodel-v5';\nimport { ArtifactDownloader } from '../../artifacts/artifact-downloader';\nimport { ArtifactStore } from '../../artifacts/artifact-store';\nimport { getArtifactVariantString } from '../../artifacts/artifact-util';\n\nlet artifactStore: ArtifactStore;\nlet useNativeArtifacts: boolean;\n\nexport const artifactCache: MapType<Artifact> = {};\n\nexport const setArtifactStore = (store: ArtifactStore) => {\n artifactStore = store;\n};\nexport const setUseNativeArtifacts = (useNative: boolean) => {\n useNativeArtifacts = useNative;\n};\n\nexport const getArtifacts = async (inputs: PublicInputsBalance): Promise<Artifact> => {\n const nullifiers = inputs.nullifiers.length;\n // const nullifiers = 0;\n const commitments = 0;\n // const commitments = inputs.commitmentsOut.length;\n\n assertArtifactExists(nullifiers, commitments);\n\n if (useNativeArtifacts) {\n if (commitments > 3) {\n // native-prover-small only has INPUTS (1-10) and OUTPUTS (1-3)\n throw new Error(\n `Native artifacts (small) only support up to 3 circuit outputs. Cannot get artifacts for circuit: ${nullifiers}x${commitments}.`,\n );\n }\n }\n\n const artifactVariantString = getArtifactVariantString(\n nullifiers,\n commitments,\n );\n\n // Use artifact in cache if available.\n const cachedArtifact = artifactCache[artifactVariantString];\n if (isDefined(cachedArtifact)) {\n return cachedArtifact;\n }\n\n const downloader = new ArtifactDownloader(artifactStore, useNativeArtifacts);\n\n // Try to pull previously downloaded from storage.\n try {\n const downloadedArtifacts = await downloader.getDownloadedArtifacts(\n artifactVariantString,\n );\n artifactCache[artifactVariantString] = downloadedArtifacts;\n return downloadedArtifacts;\n } catch (err) {\n // No op. Artifacts not yet downloaded.\n }\n\n // Download anew. Throws upon error.\n await downloader.downloadArtifacts(artifactVariantString);\n const downloadedArtifacts = await downloader.getDownloadedArtifacts(\n artifactVariantString,\n );\n artifactCache[artifactVariantString] = downloadedArtifacts;\n return downloadedArtifacts;\n};\n\nexport const artifactGetterDownloadJustInTime: ArtifactGetter = {\n assertArtifactExists,\n getArtifacts,\n};\n\nexport const overrideArtifact = (\n artifactVariant: string,\n artifact: Artifact,\n) => {\n artifactCache[artifactVariant] = artifact;\n};\n\nexport const clearArtifactCache = () => {\n for (const key in artifactCache) {\n if (isDefined(artifactCache[key])) {\n delete artifactCache[key];\n }\n }\n};\n"]}
|
|
@@ -97,4 +97,7 @@ const stopDopEngine = async () => {
|
|
|
97
97
|
engine = undefined;
|
|
98
98
|
};
|
|
99
99
|
exports.stopDopEngine = stopDopEngine;
|
|
100
|
+
// 0zk1qy8latj5k07p689yvv7syynynhsqya49fpc7rdxduejcu5kjmgz9pxus3llllllll7y42drr9smwxaxzfu0dhafyn55a9c33tkj2y4sjff7svrcs6djnums8cds
|
|
101
|
+
// 0zk1qy8latj5k07p689yvv7syynynhsqya49fpc7rdxduejcu5kjmgz9pxus3llllllll7y42drr9smwxaxzfu0dhafyn55a9c33tkj2y4sjff7svrcs6djnums8cds
|
|
102
|
+
// 0zk1qyzta4s56qmtuskjsz67rqfdzjudl4kj4rjcd5z69qvytag4hgcraxus3llllllll7dqm9dnmewju0f92s0qsxme2fd3tpvumywc28zszs797jha57jmwclluwl
|
|
100
103
|
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../../src/services/dop/core/engine.ts"],"names":[],"mappings":";;;AACA,iDAQuB;AACvB,2DAG4B;AAC5B,kDAAsE;AACtE,2CAIqB;AAErB,gDAA8D;AAC9D,qEAAgE;AAEhE,IAAI,MAA2B,CAAC;AAOzB,MAAM,SAAS,GAAG,GAAc,EAAE;IACvC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEK,MAAM,WAAW,GAAG,CAAC,EAAU,EAAkB,EAAE;IACxD,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB;AAEK,MAAM,eAAe,GAAG,CAAC,EAAU,EAAa,EAAE;IACvD,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,CAAC,CAAC,MAAM,YAAY,yBAAS,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IACD,OAAO,MAAM,CAAE;AACj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E,yCAAoB,CAAC,QAAQ;QACzC,KAAK;QACL,QAAQ,EAAE,GAAG;KACd,CAAC,CACL,CAAC;IACF,MAAM,CAAC,EAAE,CACP,2BAAW,CAAC,+BAA+B,EAC3C,CAAC,EAAE,KAAK,EAAkC,EAAE,EAAE,CAC5C,wBAAwB,CAAC;QACvB,UAAU,EAAE,yCAAoB,CAAC,UAAU;QAC3C,KAAK;QACL,QAAQ,EAAE,GAAG;KACd,CAAC,CACL,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,2BAA2B,+BAwCtC;AAEF;;;;;;;;;GASG;AACI,MAAM,cAAc,GAAG,CAC5B,YAAoB,EACpB,EAAqB,EACrB,WAAoB,EACpB,aAA4B,EAC5B,kBAA2B,EAC3B,mBAA4B,EACtB,EAAE;IACR,IAAI,MAAM;QAAE,OAAO;IACnB,IAAI;QACF,MAAM,GAAG,IAAI,yBAAS,CACpB,YAAY,EACZ,EAAE,EACF,4CAAgC,EAChC,iCAAc,EACd,WAAW,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,SAAS,EAChD,mBAAmB,CACpB,CAAC;QACF,IAAA,4BAAgB,EAAC,aAAa,CAAC,CAAC;QAChC,IAAA,iCAAqB,EAAC,kBAAkB,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAA,8BAAsB,EAAC,sBAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACxD;AACH,CAAC,CAAC;AAvBW,QAAA,cAAc,kBAuBzB;AAEK,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,GAAG,SAAS,CAAC;AACrB,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB","sourcesContent":["import type { AbstractLevelDOWN } from 'abstract-leveldown';\nimport {\n DopEngine,\n DopWallet,\n ViewOnlyWallet,\n AbstractWallet,\n EngineEvent,\n MerkletreeHistoryScanEventData,\n MerkletreeHistoryScanUpdateData,\n} from 'dop-engine-v5';\nimport {\n MerkletreeScanUpdateEvent,\n MerkletreeScanStatus,\n} from 'dop-sharedmodel-v5';\nimport { sendErrorMessage, sendMessage } from '../../../utils/logger';\nimport {\n artifactGetterDownloadJustInTime,\n setArtifactStore,\n setUseNativeArtifacts,\n} from './artifacts';\nimport { ArtifactStore } from '../../artifacts/artifact-store';\nimport { reportAndSanitizeError } from '../../../utils/error';\nimport { quickSyncGraph } from '../quick-sync/quick-sync-graph';\n\nlet engine: Optional<DopEngine>;\n\nexport type EngineDebugger = {\n log: (msg: string) => void;\n error: (error: Error) => void;\n};\n\nexport const getEngine = (): DopEngine => {\n if (!engine) {\n throw new Error('DOP Engine not yet initialized.');\n }\n return engine;\n};\n\nexport const walletForID = (id: string): AbstractWallet => {\n const wallet = engine?.wallets[id];\n if (!wallet) {\n throw new Error('No DOP wallet for ID');\n }\n return wallet;\n};\n\nexport const fullWalletForID = (id: string): DopWallet => {\n const wallet = walletForID(id);\n if (!(wallet instanceof DopWallet)) {\n throw new Error('Can not load View-Only wallet.');\n }\n return wallet ;\n};\n\nexport const viewOnlyWalletForID = (id: string): DopWallet => {\n const wallet = walletForID(id);\n if (!(wallet instanceof ViewOnlyWallet)) {\n throw new Error('Can only load View-Only wallet.');\n }\n return wallet as DopWallet;\n};\n\nconst createEngineDebugger = (): EngineDebugger => {\n return {\n log: (msg: string) => sendMessage(msg),\n error: (error: Error) => sendErrorMessage(error),\n };\n};\n\nexport const setOnMerkletreeScanCallback = (\n onMerkletreeScanCallback: (scanData: MerkletreeScanUpdateEvent) => void,\n) => {\n const engine = getEngine();\n engine.on(\n EngineEvent.MerkletreeHistoryScanStarted,\n ({ chain }: MerkletreeHistoryScanEventData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Started,\n chain,\n progress: 0.0,\n }),\n );\n engine.on(\n EngineEvent.MerkletreeHistoryScanUpdate,\n ({ chain, progress }: MerkletreeHistoryScanUpdateData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Updated,\n chain,\n progress,\n }),\n );\n engine.on(\n EngineEvent.MerkletreeHistoryScanComplete,\n ({ chain }: MerkletreeHistoryScanEventData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Complete,\n chain,\n progress: 1.0,\n }),\n );\n engine.on(\n EngineEvent.MerkletreeHistoryScanIncomplete,\n ({ chain }: MerkletreeHistoryScanEventData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Incomplete,\n chain,\n progress: 1.0,\n }),\n );\n};\n\n/**\n *\n * @param walletSource - Name for your wallet implementation. Encrypted and viewable in private transaction history. Maximum of 16 characters, lowercase.\n * @param db - LevelDOWN compatible database for storing encrypted wallets.\n * @param shouldDebug - Whether to forward Engine debug logs to Logger.\n * @param artifactStore - Persistent store for downloading large artifact files. See Wallet SDK Developer Guide for platform implementations.\n * @param useNativeArtifacts - Whether to download native C++ or web-assembly artifacts. TRUE for mobile. FALSE for nodejs and browser.\n * @param skipMerkletreeScans - Whether to skip merkletree syncs and private balance scans. Only set to TRUE in shield-only applications that don't load private wallets or balances.\n * @returns\n */\nexport const startDopEngine = (\n walletSource: string,\n db: AbstractLevelDOWN,\n shouldDebug: boolean,\n artifactStore: ArtifactStore,\n useNativeArtifacts: boolean,\n skipMerkletreeScans: boolean,\n): void => {\n if (engine) return;\n try {\n engine = new DopEngine(\n walletSource,\n db,\n artifactGetterDownloadJustInTime,\n quickSyncGraph,\n shouldDebug ? createEngineDebugger() : undefined,\n skipMerkletreeScans,\n );\n setArtifactStore(artifactStore);\n setUseNativeArtifacts(useNativeArtifacts);\n } catch (err) {\n throw reportAndSanitizeError(startDopEngine.name, err);\n }\n};\n\nexport const stopDopEngine = async () => {\n await engine?.unload();\n engine = undefined;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../../src/services/dop/core/engine.ts"],"names":[],"mappings":";;;AACA,iDAQ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oB,EACpB,aAA4B,EAC5B,kBAA2B,EAC3B,mBAA4B,EACtB,EAAE;IACR,IAAI,MAAM;QAAE,OAAO;IACnB,IAAI;QACF,MAAM,GAAG,IAAI,yBAAS,CACpB,YAAY,EACZ,EAAE,EACF,4CAAgC,EAChC,iCAAc,EACd,WAAW,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,SAAS,EAChD,mBAAmB,CACpB,CAAC;QACF,IAAA,4BAAgB,EAAC,aAAa,CAAC,CAAC;QAChC,IAAA,iCAAqB,EAAC,kBAAkB,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAA,8BAAsB,EAAC,sBAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACxD;AACH,CAAC,CAAC;AAvBW,QAAA,cAAc,kBAuBzB;AAEK,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,GAAG,SAAS,CAAC;AACrB,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB;AAGF,kIAAkI;AAClI,kIAAkI;AAClI,kIAAkI","sourcesContent":["import type { AbstractLevelDOWN } from 'abstract-leveldown';\nimport {\n DopEngine,\n DopWallet,\n ViewOnlyWallet,\n AbstractWallet,\n EngineEvent,\n MerkletreeHistoryScanEventData,\n MerkletreeHistoryScanUpdateData,\n} from 'dop-engine-v5';\nimport {\n MerkletreeScanUpdateEvent,\n MerkletreeScanStatus,\n} from 'dop-sharedmodel-v5';\nimport { sendErrorMessage, sendMessage } from '../../../utils/logger';\nimport {\n artifactGetterDownloadJustInTime,\n setArtifactStore,\n setUseNativeArtifacts,\n} from './artifacts';\nimport { ArtifactStore } from '../../artifacts/artifact-store';\nimport { reportAndSanitizeError } from '../../../utils/error';\nimport { quickSyncGraph } from '../quick-sync/quick-sync-graph';\n\nlet engine: Optional<DopEngine>;\n\nexport type EngineDebugger = {\n log: (msg: string) => void;\n error: (error: Error) => void;\n};\n\nexport const getEngine = (): DopEngine => {\n if (!engine) {\n throw new Error('DOP Engine not yet initialized.');\n }\n return engine;\n};\n\nexport const walletForID = (id: string): AbstractWallet => {\n const wallet = engine?.wallets[id];\n if (!wallet) {\n throw new Error('No DOP wallet for ID');\n }\n return wallet;\n};\n\nexport const fullWalletForID = (id: string): DopWallet => {\n const wallet = walletForID(id);\n if (!(wallet instanceof DopWallet)) {\n throw new Error('Can not load View-Only wallet.');\n }\n return wallet ;\n};\n\nexport const viewOnlyWalletForID = (id: string): DopWallet => {\n const wallet = walletForID(id);\n if (!(wallet instanceof ViewOnlyWallet)) {\n throw new Error('Can only load View-Only wallet.');\n }\n return wallet as DopWallet;\n};\n\nconst createEngineDebugger = (): EngineDebugger => {\n return {\n log: (msg: string) => sendMessage(msg),\n error: (error: Error) => sendErrorMessage(error),\n };\n};\n\nexport const setOnMerkletreeScanCallback = (\n onMerkletreeScanCallback: (scanData: MerkletreeScanUpdateEvent) => void,\n) => {\n const engine = getEngine();\n engine.on(\n EngineEvent.MerkletreeHistoryScanStarted,\n ({ chain }: MerkletreeHistoryScanEventData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Started,\n chain,\n progress: 0.0,\n }),\n );\n engine.on(\n EngineEvent.MerkletreeHistoryScanUpdate,\n ({ chain, progress }: MerkletreeHistoryScanUpdateData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Updated,\n chain,\n progress,\n }),\n );\n engine.on(\n EngineEvent.MerkletreeHistoryScanComplete,\n ({ chain }: MerkletreeHistoryScanEventData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Complete,\n chain,\n progress: 1.0,\n }),\n );\n engine.on(\n EngineEvent.MerkletreeHistoryScanIncomplete,\n ({ chain }: MerkletreeHistoryScanEventData) =>\n onMerkletreeScanCallback({\n scanStatus: MerkletreeScanStatus.Incomplete,\n chain,\n progress: 1.0,\n }),\n );\n};\n\n/**\n *\n * @param walletSource - Name for your wallet implementation. Encrypted and viewable in private transaction history. Maximum of 16 characters, lowercase.\n * @param db - LevelDOWN compatible database for storing encrypted wallets.\n * @param shouldDebug - Whether to forward Engine debug logs to Logger.\n * @param artifactStore - Persistent store for downloading large artifact files. See Wallet SDK Developer Guide for platform implementations.\n * @param useNativeArtifacts - Whether to download native C++ or web-assembly artifacts. TRUE for mobile. FALSE for nodejs and browser.\n * @param skipMerkletreeScans - Whether to skip merkletree syncs and private balance scans. Only set to TRUE in shield-only applications that don't load private wallets or balances.\n * @returns\n */\nexport const startDopEngine = (\n walletSource: string,\n db: AbstractLevelDOWN,\n shouldDebug: boolean,\n artifactStore: ArtifactStore,\n useNativeArtifacts: boolean,\n skipMerkletreeScans: boolean,\n): void => {\n if (engine) return;\n try {\n engine = new DopEngine(\n walletSource,\n db,\n artifactGetterDownloadJustInTime,\n quickSyncGraph,\n shouldDebug ? createEngineDebugger() : undefined,\n skipMerkletreeScans,\n );\n setArtifactStore(artifactStore);\n setUseNativeArtifacts(useNativeArtifacts);\n } catch (err) {\n throw reportAndSanitizeError(startDopEngine.name, err);\n }\n};\n\nexport const stopDopEngine = async () => {\n await engine?.unload();\n engine = undefined;\n};\n\n\n// 0zk1qy8latj5k07p689yvv7syynynhsqya49fpc7rdxduejcu5kjmgz9pxus3llllllll7y42drr9smwxaxzfu0dhafyn55a9c33tkj2y4sjff7svrcs6djnums8cds\n// 0zk1qy8latj5k07p689yvv7syynynhsqya49fpc7rdxduejcu5kjmgz9pxus3llllllll7y42drr9smwxaxzfu0dhafyn55a9c33tkj2y4sjff7svrcs6djnums8cds\n// 0zk1qyzta4s56qmtuskjsz67rqfdzjudl4kj4rjcd5z69qvytag4hgcraxus3llllllll7dqm9dnmewju0f92s0qsxme2fd3tpvumywc28zszs797jha57jmwclluwl"]}
|
|
@@ -111,7 +111,7 @@ async function getMeshOptions() {
|
|
|
111
111
|
const ethereumHandler = new graphql_1.default({
|
|
112
112
|
name: 'ethereum',
|
|
113
113
|
config: {
|
|
114
|
-
endpoint: 'https://
|
|
114
|
+
endpoint: 'https://subgraph.satsuma-prod.com/323ce71d2cc0/usman--186639/dopmainnetethv2/api',
|
|
115
115
|
},
|
|
116
116
|
baseDir,
|
|
117
117
|
cache,
|
|
@@ -148,7 +148,7 @@ async function getMeshOptions() {
|
|
|
148
148
|
const maticHandler = new graphql_1.default({
|
|
149
149
|
name: 'matic',
|
|
150
150
|
config: {
|
|
151
|
-
endpoint: 'https://
|
|
151
|
+
endpoint: 'https://subgraph.satsuma-prod.com/323ce71d2cc0/usman--186639/dopmainnetpolygonv2/api',
|
|
152
152
|
},
|
|
153
153
|
baseDir,
|
|
154
154
|
cache,
|
|
@@ -160,7 +160,7 @@ async function getMeshOptions() {
|
|
|
160
160
|
const mumbaiHandler = new graphql_1.default({
|
|
161
161
|
name: 'mumbai',
|
|
162
162
|
config: {
|
|
163
|
-
endpoint: 'https://
|
|
163
|
+
endpoint: 'https://subgraph.satsuma-prod.com/323ce71d2cc0/usman--186639/dopmainnetpolygonv2/api',
|
|
164
164
|
},
|
|
165
165
|
baseDir,
|
|
166
166
|
cache,
|
|
@@ -196,7 +196,7 @@ async function getMeshOptions() {
|
|
|
196
196
|
const xlayerHandler = new graphql_1.default({
|
|
197
197
|
name: 'xlayer',
|
|
198
198
|
config: {
|
|
199
|
-
endpoint: 'https://api.studio.thegraph.com/query/75971/
|
|
199
|
+
endpoint: 'https://api.studio.thegraph.com/query/75971/xlayermainnetv2/version/latest',
|
|
200
200
|
},
|
|
201
201
|
baseDir,
|
|
202
202
|
cache,
|
|
@@ -208,7 +208,7 @@ async function getMeshOptions() {
|
|
|
208
208
|
const xlayerTestnetHandler = new graphql_1.default({
|
|
209
209
|
name: 'xlayer-testnet',
|
|
210
210
|
config: {
|
|
211
|
-
endpoint: 'https://api.studio.thegraph.com/query/75971/
|
|
211
|
+
endpoint: 'https://api.studio.thegraph.com/query/75971/xlayermainnetv2/version/latest',
|
|
212
212
|
},
|
|
213
213
|
baseDir,
|
|
214
214
|
cache,
|