dop-wallet-v6 1.3.31 → 1.3.33

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.
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ /**
3
+ * User-Configurable Rapidsnark Adapter for React Native
4
+ *
5
+ * This module provides a way for React Native developers to configure
6
+ * their own Rapidsnark prover implementation, bypassing SDK limitations.
7
+ *
8
+ * The user is responsible for:
9
+ * 1. Installing @iden3/react-native-rapidsnark
10
+ * 2. Managing circuit files (.zkey files)
11
+ * 3. Implementing witness generation
12
+ * 4. Calling setCustomRapidsnarkProver() after engine initialization
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.createRapidsnarkProverTemplate = exports.clearCustomRapidsnarkProver = exports.setCustomRapidsnarkProver = exports.CIRCUIT_IDS = exports.saveBufferToFile = exports.uint8ArrayToBase64 = void 0;
16
+ const prover_1 = require("../core/prover");
17
+ const runtime_1 = require("../util/runtime");
18
+ /**
19
+ * Helper function to convert Uint8Array to base64 string
20
+ */
21
+ const uint8ArrayToBase64 = (buffer) => {
22
+ if (typeof Buffer !== 'undefined') {
23
+ return Buffer.from(buffer).toString('base64');
24
+ }
25
+ // Fallback for environments without Buffer
26
+ let binary = '';
27
+ for (let i = 0; i < buffer.length; i += 1) {
28
+ binary += String.fromCharCode(buffer[i]);
29
+ }
30
+ return btoa(binary);
31
+ };
32
+ exports.uint8ArrayToBase64 = uint8ArrayToBase64;
33
+ /**
34
+ * Helper function to save buffer to file system (React Native)
35
+ * Users should implement their own version using react-native-fs or similar
36
+ */
37
+ const saveBufferToFile = async (_buffer, _filename) => {
38
+ throw new Error('saveBufferToFile must be implemented by the user. ' +
39
+ 'Use react-native-fs or similar library to save buffer to file system.');
40
+ };
41
+ exports.saveBufferToFile = saveBufferToFile;
42
+ /**
43
+ * Set a custom Rapidsnark prover implementation
44
+ *
45
+ * This function allows React Native developers to provide their own
46
+ * Rapidsnark implementation, giving them full control over proof generation.
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * import { setCustomRapidsnarkProver } from 'dop-wallet-v6';
51
+ * import { groth16Prove } from '@iden3/react-native-rapidsnark';
52
+ * import RNFS from 'react-native-fs';
53
+ *
54
+ * // Implement your own prover adapter
55
+ * const myRapidsnarkAdapter = {
56
+ * async generateProof(circuitId, zkeyBuffer, jsonInputs, progressCallback) {
57
+ * // 1. Save zkey to file
58
+ * const zkeyPath = `${RNFS.DocumentDirectoryPath}/${circuitId}.zkey`;
59
+ * await RNFS.writeFile(zkeyPath, uint8ArrayToBase64(zkeyBuffer), 'base64');
60
+ *
61
+ * // 2. Generate witness (implement your own witness generation)
62
+ * const witnessBase64 = await generateWitness(circuitId, jsonInputs);
63
+ *
64
+ * // 3. Generate proof with Rapidsnark
65
+ * const rapidsnarkProof = await groth16Prove(zkeyPath, witnessBase64);
66
+ *
67
+ * // 4. Convert to DOP Engine proof format
68
+ * return {
69
+ * pi_a: rapidsnarkProof.proof.a,
70
+ * pi_b: rapidsnarkProof.proof.b,
71
+ * pi_c: rapidsnarkProof.proof.c,
72
+ * publicSignals: rapidsnarkProof.pub_signals
73
+ * };
74
+ * }
75
+ * };
76
+ *
77
+ * // Set it after engine initialization
78
+ * await startDopEngineReactNative(...);
79
+ * setCustomRapidsnarkProver(myRapidsnarkAdapter);
80
+ * ```
81
+ */
82
+ /**
83
+ * Circuit ID mapping for DOP Engine
84
+ * These IDs are used internally by DOP Engine's native prover interface
85
+ */
86
+ exports.CIRCUIT_IDS = {
87
+ dop: 0,
88
+ decrypt: 1,
89
+ nullify: 2 // Nullifier circuit
90
+ };
91
+ const setCustomRapidsnarkProver = (userProver) => {
92
+ if (!runtime_1.isReactNative) {
93
+ // eslint-disable-next-line no-console
94
+ console.warn('⚠️ Custom Rapidsnark prover is only needed in React Native environment');
95
+ return;
96
+ }
97
+ try {
98
+ const prover = (0, prover_1.getProver)();
99
+ // Wrap user's prover to match DOP Engine's expected interface
100
+ // DOP Engine expects: (circuitId: number, datBuffer, zkeyBuffer, inputJson, progressCallback)
101
+ const wrappedProver = (circuitId, datBuffer, zkeyBuffer, jsonInputs, progressCallback) => {
102
+ // Convert numeric circuit ID to string name for user's convenience
103
+ const circuitName = Object.keys(exports.CIRCUIT_IDS).find(key => exports.CIRCUIT_IDS[key] === circuitId);
104
+ const circuitDisplayName = circuitName ?? `circuit_${circuitId}`;
105
+ // eslint-disable-next-line no-console
106
+ console.log(`🔄 Generating proof for circuit: ${circuitDisplayName} (ID: ${circuitId})`);
107
+ try {
108
+ const proof = userProver.generateProof(circuitDisplayName, zkeyBuffer, jsonInputs, progressCallback);
109
+ // eslint-disable-next-line no-console
110
+ console.log(`✅ Proof generated successfully for circuit: ${circuitDisplayName}`);
111
+ return proof;
112
+ }
113
+ catch (error) {
114
+ // eslint-disable-next-line no-console
115
+ console.error(`❌ Proof generation failed for circuit ${circuitDisplayName}:`, error);
116
+ throw error;
117
+ }
118
+ };
119
+ // Set the native prover in DOP Engine with circuit ID mapping
120
+ prover.setNativeProverGroth16(wrappedProver, exports.CIRCUIT_IDS);
121
+ // eslint-disable-next-line no-console
122
+ console.log('✅ Custom Rapidsnark prover configured successfully');
123
+ // eslint-disable-next-line no-console
124
+ console.log('🚀 React Native proof generation is now enabled');
125
+ }
126
+ catch (error) {
127
+ // eslint-disable-next-line no-console
128
+ console.error('❌ Failed to set custom Rapidsnark prover:', error);
129
+ throw new Error(`Failed to set custom Rapidsnark prover: ${String(error)}`);
130
+ }
131
+ };
132
+ exports.setCustomRapidsnarkProver = setCustomRapidsnarkProver;
133
+ /**
134
+ * Remove custom prover and revert to default behavior
135
+ */
136
+ const clearCustomRapidsnarkProver = () => {
137
+ try {
138
+ const prover = (0, prover_1.getProver)();
139
+ prover.setNativeProverGroth16(undefined, {});
140
+ // eslint-disable-next-line no-console
141
+ console.log('✅ Custom Rapidsnark prover cleared');
142
+ }
143
+ catch (error) {
144
+ // eslint-disable-next-line no-console
145
+ console.error('❌ Failed to clear custom prover:', error);
146
+ }
147
+ };
148
+ exports.clearCustomRapidsnarkProver = clearCustomRapidsnarkProver;
149
+ /**
150
+ * Example implementation template for users to customize
151
+ *
152
+ * This is a reference implementation that users should copy and modify
153
+ * according to their specific needs and file system setup.
154
+ */
155
+ const createRapidsnarkProverTemplate = () => {
156
+ return `
157
+ // Example Rapidsnark Prover Implementation Template
158
+ // Copy this and customize for your app's needs
159
+
160
+ import { setCustomRapidsnarkProver, uint8ArrayToBase64 } from 'dop-wallet-v6';
161
+ import { groth16Prove } from '@iden3/react-native-rapidsnark';
162
+ import RNFS from 'react-native-fs';
163
+
164
+ // 1. Implement witness generation (specific to your circuit setup)
165
+ const generateWitness = async (circuitId: string, inputs: any): Promise<string> => {
166
+ // TODO: Implement witness generation
167
+ // This depends on your circuit setup and how you handle .wasm files
168
+
169
+ // Option A: Use a witness generator service
170
+ const response = await fetch('https://your-backend.com/generate-witness', {
171
+ method: 'POST',
172
+ body: JSON.stringify({ circuitId, inputs })
173
+ });
174
+ const { witnessBase64 } = await response.json();
175
+ return witnessBase64;
176
+
177
+ // Option B: Generate locally if you have witness generator
178
+ // const witnessBuffer = await yourWitnessGenerator(circuitId, inputs);
179
+ // return uint8ArrayToBase64(witnessBuffer);
180
+ };
181
+
182
+ // 2. Create your prover adapter
183
+ const myRapidsnarkProver = {
184
+ async generateProof(circuitId, zkeyBuffer, jsonInputs, progressCallback) {
185
+ try {
186
+ // Save zkey to file system
187
+ const zkeyPath = \`\${RNFS.DocumentDirectoryPath}/circuits/\${circuitId}.zkey\`;
188
+ await RNFS.mkdir(\`\${RNFS.DocumentDirectoryPath}/circuits\`);
189
+ await RNFS.writeFile(zkeyPath, uint8ArrayToBase64(zkeyBuffer), 'base64');
190
+
191
+ if (progressCallback) progressCallback(0.3);
192
+
193
+ // Generate witness
194
+ const witnessBase64 = await generateWitness(circuitId, jsonInputs);
195
+
196
+ if (progressCallback) progressCallback(0.6);
197
+
198
+ // Generate proof with Rapidsnark
199
+ const rapidsnarkProof = await groth16Prove(zkeyPath, witnessBase64);
200
+
201
+ if (progressCallback) progressCallback(0.9);
202
+
203
+ // Convert to DOP Engine proof format
204
+ return {
205
+ pi_a: rapidsnarkProof.proof.a,
206
+ pi_b: rapidsnarkProof.proof.b,
207
+ pi_c: rapidsnarkProof.proof.c,
208
+ publicSignals: rapidsnarkProof.pub_signals
209
+ };
210
+
211
+ } catch (error) {
212
+ console.error('Proof generation failed:', error);
213
+ throw error;
214
+ }
215
+ }
216
+ };
217
+
218
+ // 3. Set it up after DOP Engine initialization
219
+ export const setupMyRapidsnarkProver = () => {
220
+ setCustomRapidsnarkProver(myRapidsnarkProver);
221
+ console.log('✅ My custom Rapidsnark prover is ready!');
222
+ };
223
+ `;
224
+ };
225
+ exports.createRapidsnarkProverTemplate = createRapidsnarkProverTemplate;
226
+ //# sourceMappingURL=user-rapidsnark-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-rapidsnark-adapter.js","sourceRoot":"","sources":["../../../../src/services/dop/crypto/user-rapidsnark-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,2CAA2C;AAE3C,6CAAgD;AAuBhD;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,MAAkB,EAAU,EAAE;IAC/D,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC/C;IAED,2CAA2C;IAC3C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACzC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAXW,QAAA,kB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;;;;;;;;;;;;;;CAmER,CAAC;AACF,CAAC,CAAC;AArEW,QAAA,8BAA8B,kCAqEzC","sourcesContent":["/**\n * User-Configurable Rapidsnark Adapter for React Native\n * \n * This module provides a way for React Native developers to configure\n * their own Rapidsnark prover implementation, bypassing SDK limitations.\n * \n * The user is responsible for:\n * 1. Installing @iden3/react-native-rapidsnark\n * 2. Managing circuit files (.zkey files)\n * 3. Implementing witness generation\n * 4. Calling setCustomRapidsnarkProver() after engine initialization\n */\n\nimport { getProver } from '../core/prover';\nimport type { FormattedCircuitInputsDop, Proof } from 'dop-engine-v3';\nimport { isReactNative } from '../util/runtime';\n\n/**\n * Interface that users must implement for their Rapidsnark prover\n */\nexport interface UserRapidsnarkProver {\n /**\n * Generate a zero-knowledge proof using Rapidsnark\n * \n * @param circuitId - The circuit identifier (e.g., 'dop', 'decrypt', 'nullify')\n * @param zkeyBuffer - The zkey file buffer (or path to zkey file in user's implementation)\n * @param jsonInputs - The circuit inputs as JSON object\n * @param progressCallback - Optional callback for progress updates\n * @returns Promise containing the generated proof\n */\n generateProof(\n circuitId: string,\n zkeyBuffer: Uint8Array,\n jsonInputs: FormattedCircuitInputsDop,\n progressCallback?: (progress: number) => void\n ): Promise<Proof>;\n}\n\n/**\n * Helper function to convert Uint8Array to base64 string\n */\nexport const uint8ArrayToBase64 = (buffer: Uint8Array): string => {\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(buffer).toString('base64');\n }\n \n // Fallback for environments without Buffer\n let binary = '';\n for (let i = 0; i < buffer.length; i += 1) {\n binary += String.fromCharCode(buffer[i]);\n }\n return btoa(binary);\n};\n\n/**\n * Helper function to save buffer to file system (React Native)\n * Users should implement their own version using react-native-fs or similar\n */\nexport const saveBufferToFile = async (\n _buffer: Uint8Array,\n _filename: string\n): Promise<string> => {\n throw new Error(\n 'saveBufferToFile must be implemented by the user. ' +\n 'Use react-native-fs or similar library to save buffer to file system.'\n );\n};\n\n/**\n * Set a custom Rapidsnark prover implementation\n * \n * This function allows React Native developers to provide their own\n * Rapidsnark implementation, giving them full control over proof generation.\n * \n * @example\n * ```typescript\n * import { setCustomRapidsnarkProver } from 'dop-wallet-v6';\n * import { groth16Prove } from '@iden3/react-native-rapidsnark';\n * import RNFS from 'react-native-fs';\n * \n * // Implement your own prover adapter\n * const myRapidsnarkAdapter = {\n * async generateProof(circuitId, zkeyBuffer, jsonInputs, progressCallback) {\n * // 1. Save zkey to file\n * const zkeyPath = `${RNFS.DocumentDirectoryPath}/${circuitId}.zkey`;\n * await RNFS.writeFile(zkeyPath, uint8ArrayToBase64(zkeyBuffer), 'base64');\n * \n * // 2. Generate witness (implement your own witness generation)\n * const witnessBase64 = await generateWitness(circuitId, jsonInputs);\n * \n * // 3. Generate proof with Rapidsnark\n * const rapidsnarkProof = await groth16Prove(zkeyPath, witnessBase64);\n * \n * // 4. Convert to DOP Engine proof format\n * return {\n * pi_a: rapidsnarkProof.proof.a,\n * pi_b: rapidsnarkProof.proof.b,\n * pi_c: rapidsnarkProof.proof.c,\n * publicSignals: rapidsnarkProof.pub_signals\n * };\n * }\n * };\n * \n * // Set it after engine initialization\n * await startDopEngineReactNative(...);\n * setCustomRapidsnarkProver(myRapidsnarkAdapter);\n * ```\n */\n/**\n * Circuit ID mapping for DOP Engine\n * These IDs are used internally by DOP Engine's native prover interface\n */\nexport const CIRCUIT_IDS = {\n dop: 0, // Main DOP transfer circuit\n decrypt: 1, // Decrypt circuit\n nullify: 2 // Nullifier circuit\n} as const;\n\nexport const setCustomRapidsnarkProver = (userProver: UserRapidsnarkProver): void => {\n if (!isReactNative) {\n // eslint-disable-next-line no-console\n console.warn('⚠️ Custom Rapidsnark prover is only needed in React Native environment');\n return;\n }\n\n try {\n const prover = getProver();\n \n // Wrap user's prover to match DOP Engine's expected interface\n // DOP Engine expects: (circuitId: number, datBuffer, zkeyBuffer, inputJson, progressCallback)\n const wrappedProver = (\n circuitId: number,\n datBuffer: Uint8Array,\n zkeyBuffer: Uint8Array,\n jsonInputs: FormattedCircuitInputsDop,\n progressCallback?: (progress: number) => void\n ): Promise<Proof> => {\n // Convert numeric circuit ID to string name for user's convenience\n const circuitName = Object.keys(CIRCUIT_IDS).find(\n key => CIRCUIT_IDS[key as keyof typeof CIRCUIT_IDS] === circuitId\n );\n const circuitDisplayName = circuitName ?? `circuit_${circuitId}`;\n \n // eslint-disable-next-line no-console\n console.log(`🔄 Generating proof for circuit: ${circuitDisplayName} (ID: ${circuitId})`);\n \n try {\n const proof = userProver.generateProof(\n circuitDisplayName,\n zkeyBuffer,\n jsonInputs,\n progressCallback\n );\n \n // eslint-disable-next-line no-console\n console.log(`✅ Proof generated successfully for circuit: ${circuitDisplayName}`);\n return proof;\n \n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`❌ Proof generation failed for circuit ${circuitDisplayName}:`, error);\n throw error;\n }\n };\n \n // Set the native prover in DOP Engine with circuit ID mapping\n prover.setNativeProverGroth16(wrappedProver as any, CIRCUIT_IDS);\n \n // eslint-disable-next-line no-console\n console.log('✅ Custom Rapidsnark prover configured successfully');\n // eslint-disable-next-line no-console\n console.log('🚀 React Native proof generation is now enabled');\n \n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('❌ Failed to set custom Rapidsnark prover:', error);\n throw new Error(`Failed to set custom Rapidsnark prover: ${String(error)}`);\n }\n};\n\n/**\n * Remove custom prover and revert to default behavior\n */\nexport const clearCustomRapidsnarkProver = (): void => {\n try {\n const prover = getProver();\n prover.setNativeProverGroth16(undefined as any, {});\n // eslint-disable-next-line no-console\n console.log('✅ Custom Rapidsnark prover cleared');\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('❌ Failed to clear custom prover:', error);\n }\n};\n\n/**\n * Example implementation template for users to customize\n * \n * This is a reference implementation that users should copy and modify\n * according to their specific needs and file system setup.\n */\nexport const createRapidsnarkProverTemplate = (): string => {\n return `\n// Example Rapidsnark Prover Implementation Template\n// Copy this and customize for your app's needs\n\nimport { setCustomRapidsnarkProver, uint8ArrayToBase64 } from 'dop-wallet-v6';\nimport { groth16Prove } from '@iden3/react-native-rapidsnark';\nimport RNFS from 'react-native-fs';\n\n// 1. Implement witness generation (specific to your circuit setup)\nconst generateWitness = async (circuitId: string, inputs: any): Promise<string> => {\n // TODO: Implement witness generation\n // This depends on your circuit setup and how you handle .wasm files\n \n // Option A: Use a witness generator service\n const response = await fetch('https://your-backend.com/generate-witness', {\n method: 'POST',\n body: JSON.stringify({ circuitId, inputs })\n });\n const { witnessBase64 } = await response.json();\n return witnessBase64;\n \n // Option B: Generate locally if you have witness generator\n // const witnessBuffer = await yourWitnessGenerator(circuitId, inputs);\n // return uint8ArrayToBase64(witnessBuffer);\n};\n\n// 2. Create your prover adapter\nconst myRapidsnarkProver = {\n async generateProof(circuitId, zkeyBuffer, jsonInputs, progressCallback) {\n try {\n // Save zkey to file system\n const zkeyPath = \\`\\${RNFS.DocumentDirectoryPath}/circuits/\\${circuitId}.zkey\\`;\n await RNFS.mkdir(\\`\\${RNFS.DocumentDirectoryPath}/circuits\\`);\n await RNFS.writeFile(zkeyPath, uint8ArrayToBase64(zkeyBuffer), 'base64');\n \n if (progressCallback) progressCallback(0.3);\n \n // Generate witness\n const witnessBase64 = await generateWitness(circuitId, jsonInputs);\n \n if (progressCallback) progressCallback(0.6);\n \n // Generate proof with Rapidsnark\n const rapidsnarkProof = await groth16Prove(zkeyPath, witnessBase64);\n \n if (progressCallback) progressCallback(0.9);\n \n // Convert to DOP Engine proof format\n return {\n pi_a: rapidsnarkProof.proof.a,\n pi_b: rapidsnarkProof.proof.b,\n pi_c: rapidsnarkProof.proof.c,\n publicSignals: rapidsnarkProof.pub_signals\n };\n \n } catch (error) {\n console.error('Proof generation failed:', error);\n throw error;\n }\n }\n};\n\n// 3. Set it up after DOP Engine initialization\nexport const setupMyRapidsnarkProver = () => {\n setCustomRapidsnarkProver(myRapidsnarkProver);\n console.log('✅ My custom Rapidsnark prover is ready!');\n};\n`;\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { DopPopulateTransactionResponse, DopTransactionGasEstimateResponse, NetworkName, DopERC20AmountRecipient, DopNFTAmountRecipient, TransactionGasDetails, TXIDVersion } from 'dop-sharedmodels-v3';
2
+ import { ContractTransaction } from 'ethers';
3
+ export declare const getEncryptPrivateKeySignatureMessage: () => string;
4
+ export declare const generateEncryptTransactionWithRelayer: (txidVersion: TXIDVersion, networkName: NetworkName, encryptPrivateKey: string, erc20AmountRecipients: DopERC20AmountRecipient[], nftAmountRecipients: DopNFTAmountRecipient[], fromWalletAddress: string) => Promise<ContractTransaction>;
5
+ export declare const populateEncryptWithRelayer: (txidVersion: TXIDVersion, networkName: NetworkName, encryptPrivateKey: string, erc20AmountRecipients: DopERC20AmountRecipient[], nftAmountRecipients: DopNFTAmountRecipient[], fromWalletAddress: string, gasDetails?: TransactionGasDetails) => Promise<DopPopulateTransactionResponse>;
6
+ export declare const gasEstimateForEncryptWithRelayer: (txidVersion: TXIDVersion, networkName: NetworkName, encryptPrivateKey: string, erc20AmountRecipients: DopERC20AmountRecipient[], nftAmountRecipients: DopNFTAmountRecipient[], fromWalletAddress: string) => Promise<DopTransactionGasEstimateResponse>;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gasEstimateForEncryptWithRelayer = exports.populateEncryptWithRelayer = exports.generateEncryptTransactionWithRelayer = exports.getEncryptPrivateKeySignatureMessage = void 0;
4
+ const dop_sharedmodels_v3_1 = require("dop-sharedmodels-v3");
5
+ const dop_engine_v3_1 = require("dop-engine-v3");
6
+ const tx_gas_details_1 = require("./tx-gas-details");
7
+ const blocked_address_1 = require("../../utils/blocked-address");
8
+ const tx_cross_contract_calls_1 = require("./tx-cross-contract-calls");
9
+ const error_1 = require("../../utils/error");
10
+ const wallets_1 = require("../dop/wallets");
11
+ const getEncryptPrivateKeySignatureMessage = () => {
12
+ return dop_engine_v3_1.EncryptNote.getEncryptPrivateKeySignatureMessage();
13
+ };
14
+ exports.getEncryptPrivateKeySignatureMessage = getEncryptPrivateKeySignatureMessage;
15
+ const generateERC20EncryptRequests = async (erc20AmountRecipient, random, encryptPrivateKey) => {
16
+ const dopAddress = erc20AmountRecipient.recipientAddress;
17
+ (0, wallets_1.assertValidDopAddress)(dopAddress);
18
+ const { masterPublicKey, viewingPublicKey } = dop_engine_v3_1.DopEngine.decodeAddress(dopAddress);
19
+ const encrypt = new dop_engine_v3_1.EncryptNoteERC20(masterPublicKey, random, erc20AmountRecipient.amount, erc20AmountRecipient.tokenAddress);
20
+ return encrypt.serialize(dop_engine_v3_1.ByteUtils.hexToBytes(encryptPrivateKey), viewingPublicKey);
21
+ };
22
+ const generateNFTEncryptRequests = async (nftAmountRecipient, random, encryptPrivateKey) => {
23
+ const dopAddress = nftAmountRecipient.recipientAddress;
24
+ (0, wallets_1.assertValidDopAddress)(dopAddress);
25
+ const { masterPublicKey, viewingPublicKey } = dop_engine_v3_1.DopEngine.decodeAddress(dopAddress);
26
+ const value = nftAmountRecipient.nftTokenType === dop_sharedmodels_v3_1.NFTTokenType.ERC721
27
+ ? dop_engine_v3_1.ERC721_NOTE_VALUE
28
+ : nftAmountRecipient.amount;
29
+ const nftTokenData = (0, tx_cross_contract_calls_1.createNFTTokenDataFromDopNFTAmount)(nftAmountRecipient);
30
+ const encrypt = new dop_engine_v3_1.EncryptNoteNFT(masterPublicKey, random, value, nftTokenData);
31
+ return encrypt.serialize(dop_engine_v3_1.ByteUtils.hexToBytes(encryptPrivateKey), viewingPublicKey);
32
+ };
33
+ const generateEncryptTransactionWithRelayer = async (txidVersion, networkName, encryptPrivateKey, erc20AmountRecipients, nftAmountRecipients, fromWalletAddress) => {
34
+ try {
35
+ const random = dop_engine_v3_1.ByteUtils.randomHex(16);
36
+ const encryptInputs = await Promise.all([
37
+ ...erc20AmountRecipients.map(erc20AmountRecipient => generateERC20EncryptRequests(erc20AmountRecipient, random, encryptPrivateKey)),
38
+ ...nftAmountRecipients.map(nftAmountRecipient => generateNFTEncryptRequests(nftAmountRecipient, random, encryptPrivateKey)),
39
+ ]);
40
+ const chain = dop_sharedmodels_v3_1.NETWORK_CONFIG[networkName].chain;
41
+ const relayAdaptContract = dop_engine_v3_1.DopVersionedSmartContracts.getRelayAdaptContract(txidVersion, chain);
42
+ const transaction = await relayAdaptContract.populateRelayEncrypts(encryptInputs, fromWalletAddress);
43
+ return transaction;
44
+ }
45
+ catch (err) {
46
+ throw (0, error_1.reportAndSanitizeError)(exports.generateEncryptTransactionWithRelayer.name, err);
47
+ }
48
+ };
49
+ exports.generateEncryptTransactionWithRelayer = generateEncryptTransactionWithRelayer;
50
+ const populateEncryptWithRelayer = async (txidVersion, networkName, encryptPrivateKey, erc20AmountRecipients, nftAmountRecipients, fromWalletAddress, gasDetails) => {
51
+ try {
52
+ const transaction = await (0, exports.generateEncryptTransactionWithRelayer)(txidVersion, networkName, encryptPrivateKey, erc20AmountRecipients, nftAmountRecipients, fromWalletAddress);
53
+ if (gasDetails) {
54
+ const sendWithPublicWallet = true;
55
+ (0, tx_gas_details_1.setGasDetailsForTransaction)(networkName, transaction, gasDetails, sendWithPublicWallet);
56
+ }
57
+ return {
58
+ transaction,
59
+ };
60
+ }
61
+ catch (err) {
62
+ throw (0, error_1.reportAndSanitizeError)(exports.populateEncryptWithRelayer.name, err);
63
+ }
64
+ };
65
+ exports.populateEncryptWithRelayer = populateEncryptWithRelayer;
66
+ const gasEstimateForEncryptWithRelayer = async (txidVersion, networkName, encryptPrivateKey, erc20AmountRecipients, nftAmountRecipients, fromWalletAddress) => {
67
+ try {
68
+ (0, blocked_address_1.assertNotBlockedAddress)(fromWalletAddress);
69
+ const transaction = await (0, exports.generateEncryptTransactionWithRelayer)(txidVersion, networkName, encryptPrivateKey, erc20AmountRecipients, nftAmountRecipients, fromWalletAddress);
70
+ const sendWithPublicWallet = true;
71
+ const isGasEstimateWithDummyProof = false;
72
+ return (0, tx_gas_details_1.gasEstimateResponse)(await (0, tx_gas_details_1.getGasEstimate)(txidVersion, networkName, transaction, fromWalletAddress, sendWithPublicWallet, true), undefined, // broadcasterFeeCommitment
73
+ isGasEstimateWithDummyProof);
74
+ }
75
+ catch (err) {
76
+ throw (0, error_1.reportAndSanitizeError)(exports.gasEstimateForEncryptWithRelayer.name, err);
77
+ }
78
+ };
79
+ exports.gasEstimateForEncryptWithRelayer = gasEstimateForEncryptWithRelayer;
80
+ //# sourceMappingURL=tx-encrypt-relayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx-encrypt-relayer.js","sourceRoot":"","sources":["../../../src/services/transactions/tx-encrypt-relayer.ts"],"names":[],"mappings":";;;AAAA,6DAU6B;AAC7B,iDASuB;AACvB,qDAI0B;AAC1B,iEAAsE;AACtE,uEAA+E;AAC/E,6CAA2D;AAE3D,4CAAuD;AAEhD,MAAM,oCAAoC,GAAG,GAAG,EAAE;IACvD,OAAO,2BAAW,CAAC,oCAAoC,EAAE,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,oCAAoC,wCAE/C;AAEF,MAAM,4BAA4B,GAAG,KAAK,EACxC,oBAA6C,EAC7C,MAAc,EACd,iBAAyB,EACM,EAAE;IACjC,MAAM,UAAU,GAAG,oBAAoB,CAAC,gBAAgB,CAAC;IAEzD,IAAA,+BAAqB,EAAC,UAAU,CAAC,CAAC;IAElC,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GACzC,yBAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,IAAI,gCAAgB,CAClC,eAAe,EACf,MAAM,EACN,oBAAoB,CAAC,MAAM,EAC3B,oBAAoB,CAAC,YAAY,CAClC,CAAC;IACF,OAAO,OAAO,CAAC,SAAS,CACtB,yBAAS,CAAC,UAAU,CAAC,iBAAiB,CAAC,EACvC,gBAAgB,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,KAAK,EACtC,kBAAyC,EACzC,MAAc,EACd,iBAAyB,EACM,EAAE;IACjC,MAAM,UAAU,GA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AAqB,EACrB,mBAAmB,EACnB,iBAAiB,CAClB,CAAC;QAEF,MAAM,oBAAoB,GAAG,IAAI,CAAC;QAClC,MAAM,2BAA2B,GAAG,KAAK,CAAC;QAC1C,OAAO,IAAA,oCAAmB,EACxB,MAAM,IAAA,+BAAc,EAClB,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,IAAI,CACL,EACD,SAAS,EAAE,2BAA2B;QACtC,2BAA2B,CAC5B,CAAC;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAA,8BAAsB,EAAC,wCAAgC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KAC1E;AACH,CAAC,CAAC;AArCW,QAAA,gCAAgC,oCAqC3C","sourcesContent":["import {\n DopPopulateTransactionResponse,\n DopTransactionGasEstimateResponse,\n NetworkName,\n DopERC20AmountRecipient,\n DopNFTAmountRecipient,\n NFTTokenType,\n TransactionGasDetails,\n NETWORK_CONFIG,\n TXIDVersion,\n} from 'dop-sharedmodels-v3';\nimport {\n EncryptNote,\n DopEngine,\n EncryptRequestStruct,\n ByteUtils,\n EncryptNoteERC20,\n EncryptNoteNFT,\n ERC721_NOTE_VALUE,\n DopVersionedSmartContracts,\n} from 'dop-engine-v3';\nimport {\n gasEstimateResponse,\n getGasEstimate,\n setGasDetailsForTransaction,\n} from './tx-gas-details';\nimport { assertNotBlockedAddress } from '../../utils/blocked-address';\nimport { createNFTTokenDataFromDopNFTAmount } from './tx-cross-contract-calls';\nimport { reportAndSanitizeError } from '../../utils/error';\nimport { ContractTransaction } from 'ethers';\nimport { assertValidDopAddress } from '../dop/wallets';\n\nexport const getEncryptPrivateKeySignatureMessage = () => {\n return EncryptNote.getEncryptPrivateKeySignatureMessage();\n};\n\nconst generateERC20EncryptRequests = async (\n erc20AmountRecipient: DopERC20AmountRecipient,\n random: string,\n encryptPrivateKey: string,\n): Promise<EncryptRequestStruct> => {\n const dopAddress = erc20AmountRecipient.recipientAddress;\n\n assertValidDopAddress(dopAddress);\n\n const { masterPublicKey, viewingPublicKey } =\n DopEngine.decodeAddress(dopAddress);\n\n const encrypt = new EncryptNoteERC20(\n masterPublicKey,\n random,\n erc20AmountRecipient.amount,\n erc20AmountRecipient.tokenAddress,\n );\n return encrypt.serialize(\n ByteUtils.hexToBytes(encryptPrivateKey),\n viewingPublicKey,\n );\n};\n\nconst generateNFTEncryptRequests = async (\n nftAmountRecipient: DopNFTAmountRecipient,\n random: string,\n encryptPrivateKey: string,\n): Promise<EncryptRequestStruct> => {\n const dopAddress = nftAmountRecipient.recipientAddress;\n\n assertValidDopAddress(dopAddress);\n\n const { masterPublicKey, viewingPublicKey } =\n DopEngine.decodeAddress(dopAddress);\n\n const value =\n nftAmountRecipient.nftTokenType === NFTTokenType.ERC721\n ? ERC721_NOTE_VALUE\n : nftAmountRecipient.amount;\n\n const nftTokenData =\n createNFTTokenDataFromDopNFTAmount(nftAmountRecipient);\n\n const encrypt = new EncryptNoteNFT(\n masterPublicKey,\n random,\n value,\n nftTokenData,\n );\n return encrypt.serialize(\n ByteUtils.hexToBytes(encryptPrivateKey),\n viewingPublicKey,\n );\n};\n\nexport const generateEncryptTransactionWithRelayer = async (\n txidVersion: TXIDVersion,\n networkName: NetworkName,\n encryptPrivateKey: string,\n erc20AmountRecipients: DopERC20AmountRecipient[],\n nftAmountRecipients: DopNFTAmountRecipient[],\n fromWalletAddress: string,\n): Promise<ContractTransaction> => {\n try {\n const random = ByteUtils.randomHex(16);\n\n const encryptInputs: EncryptRequestStruct[] = await Promise.all([\n ...erc20AmountRecipients.map(erc20AmountRecipient =>\n generateERC20EncryptRequests(\n erc20AmountRecipient,\n random,\n encryptPrivateKey,\n ),\n ),\n ...nftAmountRecipients.map(nftAmountRecipient =>\n generateNFTEncryptRequests(nftAmountRecipient, random, encryptPrivateKey),\n ),\n ]);\n\n const chain = NETWORK_CONFIG[networkName].chain;\n \n const relayAdaptContract = DopVersionedSmartContracts.getRelayAdaptContract(\n txidVersion,\n chain,\n ) as any;\n\n const transaction = await relayAdaptContract.populateRelayEncrypts(\n encryptInputs,\n fromWalletAddress,\n );\n \n return transaction;\n } catch (err) {\n throw reportAndSanitizeError(generateEncryptTransactionWithRelayer.name, err);\n }\n};\n\nexport const populateEncryptWithRelayer = async (\n txidVersion: TXIDVersion,\n networkName: NetworkName,\n encryptPrivateKey: string,\n erc20AmountRecipients: DopERC20AmountRecipient[],\n nftAmountRecipients: DopNFTAmountRecipient[],\n fromWalletAddress: string,\n gasDetails?: TransactionGasDetails,\n): Promise<DopPopulateTransactionResponse> => {\n try {\n const transaction = await generateEncryptTransactionWithRelayer(\n txidVersion,\n networkName,\n encryptPrivateKey,\n erc20AmountRecipients,\n nftAmountRecipients,\n fromWalletAddress,\n );\n\n if (gasDetails) {\n const sendWithPublicWallet = true;\n setGasDetailsForTransaction(\n networkName,\n transaction,\n gasDetails,\n sendWithPublicWallet,\n );\n }\n\n return {\n transaction,\n };\n } catch (err) {\n throw reportAndSanitizeError(populateEncryptWithRelayer.name, err);\n }\n};\n\nexport const gasEstimateForEncryptWithRelayer = async (\n txidVersion: TXIDVersion,\n networkName: NetworkName,\n encryptPrivateKey: string,\n erc20AmountRecipients: DopERC20AmountRecipient[],\n nftAmountRecipients: DopNFTAmountRecipient[],\n fromWalletAddress: string,\n): Promise<DopTransactionGasEstimateResponse> => {\n try {\n assertNotBlockedAddress(fromWalletAddress);\n\n const transaction = await generateEncryptTransactionWithRelayer(\n txidVersion,\n networkName,\n encryptPrivateKey,\n erc20AmountRecipients,\n nftAmountRecipients,\n fromWalletAddress,\n );\n\n const sendWithPublicWallet = true;\n const isGasEstimateWithDummyProof = false;\n return gasEstimateResponse(\n await getGasEstimate(\n txidVersion,\n networkName,\n transaction,\n fromWalletAddress,\n sendWithPublicWallet,\n true, // isCrossContractCall - Relayer is a cross-contract call\n ),\n undefined, // broadcasterFeeCommitment\n isGasEstimateWithDummyProof,\n );\n } catch (err) {\n throw reportAndSanitizeError(gasEstimateForEncryptWithRelayer.name, err);\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dop-wallet-v6",
3
- "version": "1.3.31",
3
+ "version": "1.3.33",
4
4
  "description": "DOP Wallet SDK, compatible with mobile, browser and nodejs environments.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
package/react-native.js CHANGED
@@ -9,4 +9,9 @@
9
9
  require('./react-native-shims');
10
10
 
11
11
  // Re-export the main SDK
12
- module.exports = require('./dist/index.js');
12
+ const sdk = require('./dist/index.js');
13
+
14
+ // Export React Native-specific prover utilities
15
+ sdk.reactNativeRapidsnark = require('./dist/services/dop/crypto/react-native-rapidsnark-prover.js');
16
+
17
+ module.exports = sdk;