@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.
- package/bin/commands/input-proof.js +1 -0
- package/bin/commands/pubkey-fetch.js +2 -2
- package/bin/commands/test/test-add.js +1 -0
- package/bin/commands/zkproof-generate.js +2 -1
- package/bin/pubkeyCache.js +11 -1
- package/bin/publicDecrypt.js +4 -3
- package/bin/userDecrypt.js +1 -0
- package/bundle/relayer-sdk-js.js +10 -6
- package/bundle/relayer-sdk-js.umd.cjs +5 -5
- package/lib/internal.js +18 -10
- package/lib/node.cjs +18 -10
- package/lib/node.d.ts +4 -2
- package/lib/node.js +18 -10
- package/lib/web.d.ts +4 -2
- package/lib/web.js +18 -10
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -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
|
|
package/bin/pubkeyCache.js
CHANGED
|
@@ -19,7 +19,16 @@ export function getFhevmPubKeyCacheInfo(name) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export async function loadFhevmPublicKeyConfig(
|
|
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);
|
package/bin/publicDecrypt.js
CHANGED
|
@@ -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
|
{
|
package/bin/userDecrypt.js
CHANGED
package/bundle/relayer-sdk-js.js
CHANGED
|
@@ -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.
|
|
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
|
-
"
|
|
39378
|
-
"
|
|
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 === "
|
|
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
|
-
"
|
|
39414
|
-
"
|
|
39417
|
+
"readiness_check_timed_out",
|
|
39418
|
+
"response_timed_out"
|
|
39415
39419
|
],
|
|
39416
39420
|
type: typeof i.label,
|
|
39417
39421
|
value: i.label
|