@zama-fhe/relayer-sdk 0.5.0-alpha.2 → 0.5.0-alpha.3

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.
@@ -8,11 +8,11 @@ import {
8
8
  valueColumnTypeListToFheTypedValues,
9
9
  } from '../utils.js';
10
10
 
11
- // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress --version 2 --network testnet --rpc-url https://sepolia.drpc.org
12
- // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress --version 2
13
- // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress --version 1
11
+ // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress --network testnet --rpc-url https://sepolia.drpc.org
12
+ // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress
13
+ // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress
14
14
  // npx . input-proof --contract-address 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9 --user-address 0x37AC010c1c566696326813b840319B58Bb5840E4 --values 123:euint32
15
- // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress --version 2 --network mainnet
15
+ // npx . input-proof --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress --network mainnet
16
16
  export async function inputProofCommand(options) {
17
17
  const { config, zamaFhevmApiKey } = parseCommonOptions(options);
18
18
 
@@ -10,10 +10,10 @@ import { parseCommonOptions, parseHandles } from '../utils.js';
10
10
  // 0xfd82b3d4bc3318f57189a5841e248e24b59453a168ff0000000000aa36a70400
11
11
 
12
12
  // npx . public-decrypt --handles 0xfd82b3d4bc3318f57189a5841e248e24b59453a168ff0000000000aa36a70400
13
- // npx . public-decrypt --version 2 --handles 0xfd82b3d4bc3318f57189a5841e248e24b59453a168ff0000000000aa36a70400
14
- // npx . public-decrypt --version 2 --handles 0xc49cf03ffa2768ee7ca49fb8b1fe930c6b43075ed0000000000000aa36a70000
15
- // npx . public-decrypt --version 2 --handles 0xe85c2a81338b8542a6c0a99a5a794f158f4fb0f6a2ff0000000000aa36a70400
16
- // npx . public-decrypt --version 2 --handles 0x7abb4a6c63af220fcd7da6bba4a0891fbe77e576efff00000000000000010500
13
+ // npx . public-decrypt --handles 0xfd82b3d4bc3318f57189a5841e248e24b59453a168ff0000000000aa36a70400
14
+ // npx . public-decrypt --handles 0xc49cf03ffa2768ee7ca49fb8b1fe930c6b43075ed0000000000000aa36a70000
15
+ // npx . public-decrypt --handles 0xe85c2a81338b8542a6c0a99a5a794f158f4fb0f6a2ff0000000000aa36a70400
16
+ // npx . public-decrypt --handles 0x7abb4a6c63af220fcd7da6bba4a0891fbe77e576efff00000000000000010500
17
17
  export async function publicDecryptCommand(options) {
18
18
  const { config, zamaFhevmApiKey } = parseCommonOptions(options);
19
19
 
@@ -15,7 +15,6 @@ export async function testFHETestAddCommand(options) {
15
15
  parseCommonOptions(options);
16
16
 
17
17
  logCLI('🚚 network: ' + config.name, options);
18
- logCLI('🚀 route: v' + config.version, options);
19
18
  logCLI(`🍔 signer: ${signer.address}`);
20
19
  logCLI(`🧀 value: ${BigInt(options.value)}`);
21
20
  logCLI(`🍉 type: ${options.type}`);
@@ -12,7 +12,6 @@ export async function testFHETestMakePubliclyDecryptableCommand(options) {
12
12
  const { config, provider, signer } = parseCommonOptions(options);
13
13
 
14
14
  logCLI('🚚 network: ' + config.name, options);
15
- logCLI('🚀 route: v' + config.version, options);
16
15
  logCLI(`🍔 signer: ${signer.address}`);
17
16
 
18
17
  if (!FHETestAddresses[config.name]) {
@@ -15,15 +15,14 @@ import { safeJSONstringify } from '../../../lib/internal.js';
15
15
  // 0x9d430a3e950560ba22013ce885d6d90f0da36efdf1ff0000000000aa36a70600 euint128 308429577281045301472547520724787086512
16
16
  // 0xf6751d547a5c06123575aad93f22f76b7d841c4cacff0000000000aa36a70000 ebool false
17
17
  //
18
- // npx . test public-decrypt --types euint32 --network testnet --version 1
19
- // npx . test public-decrypt --types euint32 --network testnet --version 2
20
- // npx . test public-decrypt --types euint32 --network mainnet --version 2
18
+ // npx . test public-decrypt --types euint32 --network testnet
19
+ // npx . test public-decrypt --types euint32 --network testnet
20
+ // npx . test public-decrypt --types euint32 --network mainnet
21
21
  export async function testFHETestPublicDecryptCommand(options) {
22
22
  const { config, provider, signer, zamaFhevmApiKey } =
23
23
  parseCommonOptions(options);
24
24
 
25
25
  logCLI('🚚 network: ' + config.name, options);
26
- logCLI('🚀 route: v' + config.version, options);
27
26
  logCLI(`🍔 signer: ${signer.address}`, options);
28
27
 
29
28
  if (!FHETestAddresses[config.name]) {
@@ -15,7 +15,6 @@ export async function testFHETestRandomCommand(options) {
15
15
  }
16
16
 
17
17
  logCLI('🚚 network: ' + config.name, options);
18
- logCLI('🚀 route: v' + config.version, options);
19
18
  logCLI(`🍔 signer: ${signer.address}`);
20
19
 
21
20
  if (!FHETestAddresses[config.name]) {
@@ -5,16 +5,15 @@ import { FHETestAddresses } from './fheTest.js';
5
5
  import { ethers } from 'ethers';
6
6
  import { userDecrypt } from '../../userDecrypt.js';
7
7
 
8
- // npx . test user-decrypt --types euint32 --network devnet --version 2
9
- // npx . test user-decrypt --types euint32 --network testnet --version 1
10
- // npx . test user-decrypt --types euint32 --network testnet --version 2
11
- // npx . test user-decrypt --types euint32 --network mainnet --version 2
8
+ // npx . test user-decrypt --types euint32 --network devnet
9
+ // npx . test user-decrypt --types euint32 --network testnet
10
+ // npx . test user-decrypt --types euint32 --network testnet
11
+ // npx . test user-decrypt --types euint32 --network mainnet
12
12
  export async function testFHETestUserDecryptCommand(options) {
13
13
  const { config, provider, signer, zamaFhevmApiKey } =
14
14
  parseCommonOptions(options);
15
15
 
16
16
  logCLI('🚚 network: ' + config.name, options);
17
- logCLI('🚀 route: v' + config.version, options);
18
17
  logCLI(`🍔 signer: ${signer.address}`);
19
18
 
20
19
  if (!FHETestAddresses[config.name]) {
@@ -3,12 +3,11 @@
3
3
  import { userDecrypt } from '../userDecrypt.js';
4
4
  import { logCLI, parseCommonOptions } from '../utils.js';
5
5
 
6
- // npx . user-decrypt --version 2 --handle 0xe85c2a81338b8542a6c0a99a5a794f158f4fb0f6a2ff0000000000aa36a70400 --contract-address 0x1E7eA8fE4877E6ea5dc8856f0dA92da8d5066241 --network testnet
6
+ // npx . user-decrypt --handle 0xe85c2a81338b8542a6c0a99a5a794f158f4fb0f6a2ff0000000000aa36a70400 --contract-address 0x1E7eA8fE4877E6ea5dc8856f0dA92da8d5066241 --network testnet
7
7
  export async function userDecryptCommand(options) {
8
8
  const { config, signer, zamaFhevmApiKey } = parseCommonOptions(options);
9
9
 
10
10
  logCLI('🚚 network: ' + config.name, options);
11
- logCLI('🚀 route: v' + config.version, options);
12
11
  logCLI(`🍔 signer: ${signer.address}`);
13
12
 
14
13
  const handle = options.handle;
@@ -56,7 +56,7 @@ export async function loadFhevmPublicKeyConfig(
56
56
 
57
57
  const fhevm = await createRelayerFhevm({
58
58
  ...config.fhevmInstanceConfig,
59
- defaultRelayerVersion: config.version,
59
+ defaultRelayerVersion: 2,
60
60
  ...instanceOptions,
61
61
  });
62
62
 
@@ -47,12 +47,14 @@ export async function userDecrypt({
47
47
 
48
48
  const startTimeStamp = Math.floor(Date.now() / 1000);
49
49
  const durationDays = 1;
50
+ const extraData = await instance.getExtraData();
50
51
 
51
52
  const eip712 = instance.createEIP712(
52
53
  keypair.publicKey,
53
54
  contractAddresses,
54
55
  startTimeStamp,
55
56
  durationDays,
57
+ extraData,
56
58
  );
57
59
 
58
60
  const signature = await signer.signTypedData(
@@ -73,6 +75,7 @@ export async function userDecrypt({
73
75
  signer.address,
74
76
  startTimeStamp,
75
77
  durationDays,
78
+ extraData,
76
79
  {
77
80
  timeout,
78
81
  //signal: abortController.signal,
package/bin/utils.js CHANGED
@@ -99,7 +99,6 @@ export function addCommonOptions(command) {
99
99
  .option('--rpc-url <rpc url>', 'The rpc url')
100
100
  .option('--relayer-url <relayer url>', 'The relayer url')
101
101
  .option('--mnemonic <word list>', 'Mnemonic word list')
102
- .option('--version <route v1 or v2>', 'The default route version: 1|2')
103
102
  .option('--clear-cache', 'Clear the FHEVM public key cache')
104
103
  .option('--json', 'Ouput in JSON format')
105
104
  .option('--verbose', 'Verbose output')
@@ -111,7 +110,6 @@ export function addCommonOptions(command) {
111
110
  * @returns {{
112
111
  * config: {
113
112
  * name: 'testnet' | 'devnet' | 'mainnet',
114
- * version: 1 | 2,
115
113
  * walletAddress: string,
116
114
  * userAddress: string,
117
115
  * contractAddress: string,
@@ -138,17 +136,6 @@ export function parseCommonOptions(options) {
138
136
  throwError(`Invalid network name '${name}'.`);
139
137
  }
140
138
 
141
- let version = options?.version ?? 1;
142
- if (version === 'v1' || version === '1') {
143
- version = 1;
144
- }
145
- if (version === 'v2' || version === '2') {
146
- version = 2;
147
- }
148
- if (version !== 1 && version !== 2) {
149
- throwError(`Invalid relayer route version '${version}'.`);
150
- }
151
-
152
139
  let rpcUrl = options?.rpcUrl;
153
140
  if (!rpcUrl) {
154
141
  rpcUrl = getEnv('RPC_URL', `.env.${name}`);
@@ -165,15 +152,8 @@ export function parseCommonOptions(options) {
165
152
  throwError(`Missing relayer Url.`);
166
153
  }
167
154
 
168
- if (version === 1) {
169
- if (!relayerUrl.endsWith('/v1')) {
170
- relayerUrl = relayerUrl + '/v1';
171
- }
172
- }
173
- if (version === 2) {
174
- if (!relayerUrl.endsWith('/v2')) {
175
- relayerUrl = relayerUrl + '/v2';
176
- }
155
+ if (!relayerUrl.endsWith('/v2')) {
156
+ relayerUrl = relayerUrl + '/v2';
177
157
  }
178
158
 
179
159
  let contractAddress = options?.contractAddress;
@@ -277,7 +257,6 @@ export function parseCommonOptions(options) {
277
257
 
278
258
  const config = {
279
259
  name: name,
280
- version,
281
260
  walletAddress: wallet?.address,
282
261
  userAddress: userAddress ?? wallet?.address,
283
262
  contractAddress,
Binary file