x402z-shared-web 0.0.14 → 0.0.15

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/index.d.mts CHANGED
@@ -413,46 +413,15 @@ type BrowserSigner = {
413
413
  declare function getBrowserEthereumProvider(): BrowserEthereumProvider;
414
414
  declare function createBrowserSigner(provider?: BrowserEthereumProvider): Promise<BrowserSigner>;
415
415
 
416
- interface RelayerInstance {
417
- createEncryptedInput: (contractAddress: string, callerAddress: string) => {
418
- add64: (amount: number) => {
419
- encrypt: () => Promise<{
420
- handles: Array<string | Uint8Array>;
421
- inputProof: string | Uint8Array;
422
- }>;
423
- };
424
- };
425
- generateKeypair: () => {
426
- publicKey: string;
427
- privateKey: string;
428
- };
429
- createEIP712: (publicKey: string, contractAddresses: string[], startTimestamp: string, durationDays: string) => {
430
- domain: Record<string, unknown>;
431
- types: Record<string, Array<{
432
- name: string;
433
- type: string;
434
- }>>;
435
- message: Record<string, unknown>;
436
- };
437
- userDecrypt: (handles: Array<{
438
- handle: string;
439
- contractAddress: string;
440
- }>, privateKey: string, publicKey: string, signature: string, contractAddresses: string[], address: string, startTimestamp: string, durationDays: string) => Promise<Record<string, bigint> | {
441
- clearValues?: Record<string, bigint>;
442
- }>;
443
- publicDecrypt: (handles: string[]) => Promise<{
444
- clearValues: Record<string, bigint>;
445
- decryptionProof: string;
446
- }>;
447
- }
448
416
  type RelayerWebModule = typeof relayerWeb;
417
+ type RelayerInstance = Awaited<ReturnType<RelayerWebModule["createInstance"]>>;
449
418
  type RelayerSdkModule = {
450
419
  createInstance: RelayerWebModule["createInstance"];
451
420
  initSDK: RelayerWebModule["initSDK"];
452
421
  SepoliaConfig: RelayerWebModule["SepoliaConfig"];
453
422
  };
454
423
  type FhevmInstanceConfig = Parameters<RelayerWebModule["createInstance"]>[0];
455
- declare const SepoliaConfig: relayerWeb.FhevmInstanceConfig;
424
+ declare const SepoliaConfig: RelayerWebModule["SepoliaConfig"];
456
425
  declare function getSepoliaConfig(): RelayerWebModule["SepoliaConfig"];
457
426
  type RelayerSigner = {
458
427
  address: string;
@@ -476,8 +445,8 @@ declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAd
476
445
  inputProof: `0x${string}`;
477
446
  }>;
478
447
  declare function decryptEuint64(relayer: RelayerInstance, handle: string, contractAddress: string, signer: RelayerSigner, options?: {
479
- durationDays?: string;
480
- startTimestamp?: string;
448
+ durationDays?: number;
449
+ startTimestamp?: number;
481
450
  }): Promise<bigint>;
482
451
  declare function publicDecrypt(relayer: RelayerInstance, handles: string[]): Promise<{
483
452
  clearValues: Record<string, bigint>;
package/dist/index.d.ts CHANGED
@@ -413,46 +413,15 @@ type BrowserSigner = {
413
413
  declare function getBrowserEthereumProvider(): BrowserEthereumProvider;
414
414
  declare function createBrowserSigner(provider?: BrowserEthereumProvider): Promise<BrowserSigner>;
415
415
 
416
- interface RelayerInstance {
417
- createEncryptedInput: (contractAddress: string, callerAddress: string) => {
418
- add64: (amount: number) => {
419
- encrypt: () => Promise<{
420
- handles: Array<string | Uint8Array>;
421
- inputProof: string | Uint8Array;
422
- }>;
423
- };
424
- };
425
- generateKeypair: () => {
426
- publicKey: string;
427
- privateKey: string;
428
- };
429
- createEIP712: (publicKey: string, contractAddresses: string[], startTimestamp: string, durationDays: string) => {
430
- domain: Record<string, unknown>;
431
- types: Record<string, Array<{
432
- name: string;
433
- type: string;
434
- }>>;
435
- message: Record<string, unknown>;
436
- };
437
- userDecrypt: (handles: Array<{
438
- handle: string;
439
- contractAddress: string;
440
- }>, privateKey: string, publicKey: string, signature: string, contractAddresses: string[], address: string, startTimestamp: string, durationDays: string) => Promise<Record<string, bigint> | {
441
- clearValues?: Record<string, bigint>;
442
- }>;
443
- publicDecrypt: (handles: string[]) => Promise<{
444
- clearValues: Record<string, bigint>;
445
- decryptionProof: string;
446
- }>;
447
- }
448
416
  type RelayerWebModule = typeof relayerWeb;
417
+ type RelayerInstance = Awaited<ReturnType<RelayerWebModule["createInstance"]>>;
449
418
  type RelayerSdkModule = {
450
419
  createInstance: RelayerWebModule["createInstance"];
451
420
  initSDK: RelayerWebModule["initSDK"];
452
421
  SepoliaConfig: RelayerWebModule["SepoliaConfig"];
453
422
  };
454
423
  type FhevmInstanceConfig = Parameters<RelayerWebModule["createInstance"]>[0];
455
- declare const SepoliaConfig: relayerWeb.FhevmInstanceConfig;
424
+ declare const SepoliaConfig: RelayerWebModule["SepoliaConfig"];
456
425
  declare function getSepoliaConfig(): RelayerWebModule["SepoliaConfig"];
457
426
  type RelayerSigner = {
458
427
  address: string;
@@ -476,8 +445,8 @@ declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAd
476
445
  inputProof: `0x${string}`;
477
446
  }>;
478
447
  declare function decryptEuint64(relayer: RelayerInstance, handle: string, contractAddress: string, signer: RelayerSigner, options?: {
479
- durationDays?: string;
480
- startTimestamp?: string;
448
+ durationDays?: number;
449
+ startTimestamp?: number;
481
450
  }): Promise<bigint>;
482
451
  declare function publicDecrypt(relayer: RelayerInstance, handles: string[]): Promise<{
483
452
  clearValues: Record<string, bigint>;
package/dist/index.js CHANGED
@@ -366,8 +366,8 @@ async function createEncryptedAmountInput(relayer, contractAddress, callerAddres
366
366
  }
367
367
  async function decryptEuint64(relayer, handle, contractAddress, signer, options) {
368
368
  const keypair = relayer.generateKeypair();
369
- const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3).toString();
370
- const durationDays = options?.durationDays ?? "10";
369
+ const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3);
370
+ const durationDays = options?.durationDays ?? 10;
371
371
  const contractAddresses = [contractAddress];
372
372
  const eip712 = relayer.createEIP712(keypair.publicKey, contractAddresses, startTimestamp, durationDays);
373
373
  const types = { UserDecryptRequestVerification: eip712.types.UserDecryptRequestVerification };
package/dist/index.mjs CHANGED
@@ -314,8 +314,8 @@ async function createEncryptedAmountInput(relayer, contractAddress, callerAddres
314
314
  }
315
315
  async function decryptEuint64(relayer, handle, contractAddress, signer, options) {
316
316
  const keypair = relayer.generateKeypair();
317
- const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3).toString();
318
- const durationDays = options?.durationDays ?? "10";
317
+ const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3);
318
+ const durationDays = options?.durationDays ?? 10;
319
319
  const contractAddresses = [contractAddress];
320
320
  const eip712 = relayer.createEIP712(keypair.publicKey, contractAddresses, startTimestamp, durationDays);
321
321
  const types = { UserDecryptRequestVerification: eip712.types.UserDecryptRequestVerification };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402z-shared-web",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@x402/core": "^2.0.0",
19
- "@zama-fhe/relayer-sdk": "0.3.0-8",
19
+ "@zama-fhe/relayer-sdk": "0.4.0-3",
20
20
  "viem": "^2.39.3"
21
21
  },
22
22
  "devDependencies": {