@zama-fhe/relayer-sdk 0.4.0 → 0.4.1

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.
@@ -18,6 +18,7 @@ export async function inputProofCommand(options) {
18
18
 
19
19
  const { publicKey, publicParams } = await loadFhevmPublicKeyConfig(
20
20
  config,
21
+ zamaFhevmApiKey,
21
22
  options,
22
23
  );
23
24
 
@@ -3,7 +3,7 @@ import { loadFhevmPublicKeyConfig } from '../pubkeyCache.js';
3
3
 
4
4
  // npx . pubkey fetch
5
5
  export async function pubkeyFetchCommand(options) {
6
- const { config } = parseCommonOptions(options);
6
+ const { config, zamaFhevmApiKey } = parseCommonOptions(options);
7
7
 
8
- await loadFhevmPublicKeyConfig(config, options);
8
+ await loadFhevmPublicKeyConfig(config, zamaFhevmApiKey, options);
9
9
  }
@@ -41,6 +41,7 @@ export async function testFHETestAddCommand(options) {
41
41
 
42
42
  const { publicKey, publicParams } = await loadFhevmPublicKeyConfig(
43
43
  config,
44
+ zamaFhevmApiKey,
44
45
  options,
45
46
  );
46
47
 
@@ -14,13 +14,14 @@ import {
14
14
  // npx . zkproof generate --values 123:euint32 true:ebool 1234567890123456789:euint256 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9:eaddress
15
15
  // npx . zkproof generate --contract-address 0xb2a8A265dD5A27026693Aa6cE87Fb21Ac197b6b9 --user-address 0x37AC010c1c566696326813b840319B58Bb5840E4 --values 123:euint32
16
16
  export async function zkProofGenerateCommand(options) {
17
- const { config } = parseCommonOptions(options);
17
+ const { config, zamaFhevmApiKey } = parseCommonOptions(options);
18
18
 
19
19
  const fheTypedValues = valueColumnTypeListToFheTypedValues(options.values);
20
20
  const arr = fheTypedValuesToBuilderFunctionWithArg(fheTypedValues);
21
21
 
22
22
  const { publicKey, publicParams } = await loadFhevmPublicKeyConfig(
23
23
  config,
24
+ zamaFhevmApiKey,
24
25
  options,
25
26
  );
26
27
 
@@ -19,7 +19,16 @@ export function getFhevmPubKeyCacheInfo(name) {
19
19
  };
20
20
  }
21
21
 
22
- export async function loadFhevmPublicKeyConfig(config, options) {
22
+ export async function loadFhevmPublicKeyConfig(
23
+ config,
24
+ zamaFhevmApiKey,
25
+ options,
26
+ ) {
27
+ const instanceOptions = {
28
+ //...(options.verbose === true ? { debug: true } : {}),
29
+ auth: { __type: 'ApiKeyHeader', value: zamaFhevmApiKey },
30
+ };
31
+
23
32
  const res = loadFhevmPubKeyFromCache({ ...options, name: config.name });
24
33
  if (res) {
25
34
  const pk = res.pk.toBytes();
@@ -48,6 +57,7 @@ export async function loadFhevmPublicKeyConfig(config, options) {
48
57
  const fhevm = await createRelayerFhevm({
49
58
  ...config.fhevmInstanceConfig,
50
59
  defaultRelayerVersion: config.version,
60
+ ...instanceOptions,
51
61
  });
52
62
 
53
63
  logCLI(`Relayer url: ${fhevm.relayerVersionUrl}`, options);
@@ -5,17 +5,18 @@ import { logCLI } from './utils.js';
5
5
  export async function publicDecrypt(handles, config, zamaFhevmApiKey, options) {
6
6
  const { publicKey, publicParams } = await loadFhevmPublicKeyConfig(
7
7
  config,
8
+ zamaFhevmApiKey,
8
9
  options,
9
10
  );
10
11
 
12
+ const timeout =
13
+ options.timeout !== undefined ? Number(options.timeout) : undefined;
14
+
11
15
  const instanceOptions = {
12
16
  //...(options.verbose === true ? { debug: true } : {}),
13
17
  auth: { __type: 'ApiKeyHeader', value: zamaFhevmApiKey },
14
18
  };
15
19
 
16
- const timeout =
17
- options.timeout !== undefined ? Number(options.timeout) : undefined;
18
-
19
20
  try {
20
21
  const instance = await getInstance(
21
22
  {
@@ -13,6 +13,7 @@ export async function userDecrypt({
13
13
  }) {
14
14
  const { publicKey, publicParams } = await loadFhevmPublicKeyConfig(
15
15
  config,
16
+ zamaFhevmApiKey,
16
17
  options,
17
18
  );
18
19
 
@@ -35461,7 +35461,7 @@ async function Z1(i) {
35461
35461
  const { instance: e, module: r } = await um(await i, t);
35462
35462
  return wm(e, r);
35463
35463
  }
35464
- const eo = "0.4.0", Vo = "@zama-fhe/relayer-sdk";
35464
+ const eo = "0.4.1", Vo = "@zama-fhe/relayer-sdk";
35465
35465
  class st extends Error {
35466
35466
  name = "RelayerErrorBase";
35467
35467
  _details;
@@ -39373,9 +39373,11 @@ function WA(i, t) {
39373
39373
  function ZA(i, t) {
39374
39374
  L(i, "label", t, [
39375
39375
  "protocol_paused",
39376
+ "insufficient_balance",
39377
+ "insufficient_allowance",
39376
39378
  "gateway_not_reachable",
39377
- "readiness_check_timedout",
39378
- "response_timedout"
39379
+ "readiness_check_timed_out",
39380
+ "response_timed_out"
39379
39381
  ]), L(i, "message", t);
39380
39382
  }
39381
39383
  function ca(i, t) {
@@ -39392,7 +39394,7 @@ function $R(i, t) {
39392
39394
  QA(i, t);
39393
39395
  else if (i.label === "internal_server_error")
39394
39396
  $A(i, t);
39395
- else if (i.label === "readiness_check_timedout" || i.label === "response_timedout" || i.label === "protocol_paused" || i.label === "gateway_not_reachable")
39397
+ else if (i.label === "readiness_check_timed_out" || i.label === "response_timed_out" || i.label === "protocol_paused" || i.label === "insufficient_balance" || i.label === "insufficient_allowance" || i.label === "gateway_not_reachable")
39396
39398
  ZA(i, t);
39397
39399
  else
39398
39400
  throw new ct({
@@ -39408,10 +39410,12 @@ function $R(i, t) {
39408
39410
  "rate_limited",
39409
39411
  "internal_server_error",
39410
39412
  "protocol_paused",
39413
+ "insufficient_balance",
39414
+ "insufficient_allowance",
39411
39415
  "protocol_overload",
39412
39416
  "gateway_not_reachable",
39413
- "readiness_check_timedout",
39414
- "response_timedout"
39417
+ "readiness_check_timed_out",
39418
+ "response_timed_out"
39415
39419
  ],
39416
39420
  type: typeof i.label,
39417
39421
  value: i.label