x402z-shared 0.0.13 → 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
@@ -168,9 +168,9 @@ declare const confidentialTokenAbi: readonly [{
168
168
  readonly name: "p";
169
169
  readonly type: "tuple";
170
170
  }, {
171
- readonly internalType: "bytes";
171
+ readonly internalType: "externalEuint64";
172
172
  readonly name: "encryptedAmountInput";
173
- readonly type: "bytes";
173
+ readonly type: "bytes32";
174
174
  }, {
175
175
  readonly internalType: "bytes";
176
176
  readonly name: "inputProof";
@@ -186,7 +186,7 @@ declare const confidentialTokenAbi: readonly [{
186
186
  readonly type: "function";
187
187
  }, {
188
188
  readonly inputs: readonly [{
189
- readonly internalType: "bytes32";
189
+ readonly internalType: "euint64";
190
190
  readonly name: "burntAmount";
191
191
  readonly type: "bytes32";
192
192
  }, {
@@ -411,13 +411,13 @@ type RelayerSigner = {
411
411
 
412
412
  declare function createRelayer(config: FhevmInstanceConfig): Promise<RelayerInstance>;
413
413
 
414
- declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string, senderAddress: string, amount: number): Promise<{
414
+ declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string, callerAddress: string, amount: number): Promise<{
415
415
  handle: `0x${string}`;
416
416
  inputProof: `0x${string}`;
417
417
  }>;
418
418
  declare function decryptEuint64(relayer: RelayerInstance, handle: string, contractAddress: string, signer: RelayerSigner, options?: {
419
- durationDays?: string;
420
- startTimestamp?: string;
419
+ durationDays?: number;
420
+ startTimestamp?: number;
421
421
  }): Promise<bigint>;
422
422
  declare function publicDecrypt(relayer: RelayerInstance, handles: string[]): Promise<{
423
423
  clearValues: Record<string, bigint>;
package/dist/index.d.ts CHANGED
@@ -168,9 +168,9 @@ declare const confidentialTokenAbi: readonly [{
168
168
  readonly name: "p";
169
169
  readonly type: "tuple";
170
170
  }, {
171
- readonly internalType: "bytes";
171
+ readonly internalType: "externalEuint64";
172
172
  readonly name: "encryptedAmountInput";
173
- readonly type: "bytes";
173
+ readonly type: "bytes32";
174
174
  }, {
175
175
  readonly internalType: "bytes";
176
176
  readonly name: "inputProof";
@@ -186,7 +186,7 @@ declare const confidentialTokenAbi: readonly [{
186
186
  readonly type: "function";
187
187
  }, {
188
188
  readonly inputs: readonly [{
189
- readonly internalType: "bytes32";
189
+ readonly internalType: "euint64";
190
190
  readonly name: "burntAmount";
191
191
  readonly type: "bytes32";
192
192
  }, {
@@ -411,13 +411,13 @@ type RelayerSigner = {
411
411
 
412
412
  declare function createRelayer(config: FhevmInstanceConfig): Promise<RelayerInstance>;
413
413
 
414
- declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string, senderAddress: string, amount: number): Promise<{
414
+ declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string, callerAddress: string, amount: number): Promise<{
415
415
  handle: `0x${string}`;
416
416
  inputProof: `0x${string}`;
417
417
  }>;
418
418
  declare function decryptEuint64(relayer: RelayerInstance, handle: string, contractAddress: string, signer: RelayerSigner, options?: {
419
- durationDays?: string;
420
- startTimestamp?: string;
419
+ durationDays?: number;
420
+ startTimestamp?: number;
421
421
  }): Promise<bigint>;
422
422
  declare function publicDecrypt(relayer: RelayerInstance, handles: string[]): Promise<{
423
423
  clearValues: Record<string, bigint>;
package/dist/index.js CHANGED
@@ -123,7 +123,11 @@ var confidentialTokenAbi = [
123
123
  name: "p",
124
124
  type: "tuple"
125
125
  },
126
- { internalType: "bytes", name: "encryptedAmountInput", type: "bytes" },
126
+ {
127
+ internalType: "externalEuint64",
128
+ name: "encryptedAmountInput",
129
+ type: "bytes32"
130
+ },
127
131
  { internalType: "bytes", name: "inputProof", type: "bytes" },
128
132
  { internalType: "bytes", name: "sig", type: "bytes" }
129
133
  ],
@@ -134,7 +138,7 @@ var confidentialTokenAbi = [
134
138
  },
135
139
  {
136
140
  inputs: [
137
- { internalType: "bytes32", name: "burntAmount", type: "bytes32" },
141
+ { internalType: "euint64", name: "burntAmount", type: "bytes32" },
138
142
  { internalType: "uint64", name: "burntAmountCleartext", type: "uint64" },
139
143
  { internalType: "bytes", name: "decryptionProof", type: "bytes" }
140
144
  ],
@@ -273,10 +277,10 @@ async function createRelayer(config) {
273
277
  }
274
278
  return instance;
275
279
  }
276
- async function createEncryptedAmountInput(relayer, contractAddress, senderAddress, amount) {
280
+ async function createEncryptedAmountInput(relayer, contractAddress, callerAddress, amount) {
277
281
  const normalizedContract = (0, import_viem2.getAddress)(contractAddress);
278
- const normalizedSender = (0, import_viem2.getAddress)(senderAddress);
279
- const encrypted = await relayer.createEncryptedInput(normalizedContract, normalizedSender).add64(amount).encrypt();
282
+ const normalizedCaller = (0, import_viem2.getAddress)(callerAddress);
283
+ const encrypted = await relayer.createEncryptedInput(normalizedContract, normalizedCaller).add64(amount).encrypt();
280
284
  const handle = typeof encrypted.handles[0] === "string" ? encrypted.handles[0] : (0, import_viem2.toHex)(encrypted.handles[0]);
281
285
  const inputProof = typeof encrypted.inputProof === "string" ? encrypted.inputProof : (0, import_viem2.toHex)(encrypted.inputProof);
282
286
  return {
@@ -286,8 +290,8 @@ async function createEncryptedAmountInput(relayer, contractAddress, senderAddres
286
290
  }
287
291
  async function decryptEuint64(relayer, handle, contractAddress, signer, options) {
288
292
  const keypair = relayer.generateKeypair();
289
- const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3).toString();
290
- const durationDays = options?.durationDays ?? "10";
293
+ const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3);
294
+ const durationDays = options?.durationDays ?? 10;
291
295
  const contractAddresses = [contractAddress];
292
296
  const eip712 = relayer.createEIP712(keypair.publicKey, contractAddresses, startTimestamp, durationDays);
293
297
  const types = { UserDecryptRequestVerification: eip712.types.UserDecryptRequestVerification };
package/dist/index.mjs CHANGED
@@ -85,7 +85,11 @@ var confidentialTokenAbi = [
85
85
  name: "p",
86
86
  type: "tuple"
87
87
  },
88
- { internalType: "bytes", name: "encryptedAmountInput", type: "bytes" },
88
+ {
89
+ internalType: "externalEuint64",
90
+ name: "encryptedAmountInput",
91
+ type: "bytes32"
92
+ },
89
93
  { internalType: "bytes", name: "inputProof", type: "bytes" },
90
94
  { internalType: "bytes", name: "sig", type: "bytes" }
91
95
  ],
@@ -96,7 +100,7 @@ var confidentialTokenAbi = [
96
100
  },
97
101
  {
98
102
  inputs: [
99
- { internalType: "bytes32", name: "burntAmount", type: "bytes32" },
103
+ { internalType: "euint64", name: "burntAmount", type: "bytes32" },
100
104
  { internalType: "uint64", name: "burntAmountCleartext", type: "uint64" },
101
105
  { internalType: "bytes", name: "decryptionProof", type: "bytes" }
102
106
  ],
@@ -235,10 +239,10 @@ async function createRelayer(config) {
235
239
  }
236
240
  return instance;
237
241
  }
238
- async function createEncryptedAmountInput(relayer, contractAddress, senderAddress, amount) {
242
+ async function createEncryptedAmountInput(relayer, contractAddress, callerAddress, amount) {
239
243
  const normalizedContract = getAddress(contractAddress);
240
- const normalizedSender = getAddress(senderAddress);
241
- const encrypted = await relayer.createEncryptedInput(normalizedContract, normalizedSender).add64(amount).encrypt();
244
+ const normalizedCaller = getAddress(callerAddress);
245
+ const encrypted = await relayer.createEncryptedInput(normalizedContract, normalizedCaller).add64(amount).encrypt();
242
246
  const handle = typeof encrypted.handles[0] === "string" ? encrypted.handles[0] : toHex2(encrypted.handles[0]);
243
247
  const inputProof = typeof encrypted.inputProof === "string" ? encrypted.inputProof : toHex2(encrypted.inputProof);
244
248
  return {
@@ -248,8 +252,8 @@ async function createEncryptedAmountInput(relayer, contractAddress, senderAddres
248
252
  }
249
253
  async function decryptEuint64(relayer, handle, contractAddress, signer, options) {
250
254
  const keypair = relayer.generateKeypair();
251
- const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3).toString();
252
- const durationDays = options?.durationDays ?? "10";
255
+ const startTimestamp = options?.startTimestamp ?? Math.floor(Date.now() / 1e3);
256
+ const durationDays = options?.durationDays ?? 10;
253
257
  const contractAddresses = [contractAddress];
254
258
  const eip712 = relayer.createEIP712(keypair.publicKey, contractAddresses, startTimestamp, durationDays);
255
259
  const types = { UserDecryptRequestVerification: eip712.types.UserDecryptRequestVerification };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402z-shared",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@x402/core": "^2.0.0",
19
19
  "viem": "^2.39.3",
20
- "@zama-fhe/relayer-sdk": "0.3.0-8"
20
+ "@zama-fhe/relayer-sdk": "0.4.0-3"
21
21
  },
22
22
  "devDependencies": {
23
23
  "jest": "^29.7.0",