x402z-shared 0.0.12 → 0.0.14

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
@@ -119,6 +119,24 @@ declare const confidentialTokenAbi: readonly [{
119
119
  readonly outputs: readonly [];
120
120
  readonly stateMutability: "nonpayable";
121
121
  readonly type: "function";
122
+ }, {
123
+ readonly inputs: readonly [{
124
+ readonly internalType: "address";
125
+ readonly name: "from";
126
+ readonly type: "address";
127
+ }, {
128
+ readonly internalType: "address";
129
+ readonly name: "to";
130
+ readonly type: "address";
131
+ }, {
132
+ readonly internalType: "euint64";
133
+ readonly name: "amount";
134
+ readonly type: "bytes32";
135
+ }];
136
+ readonly name: "unwrap";
137
+ readonly outputs: readonly [];
138
+ readonly stateMutability: "nonpayable";
139
+ readonly type: "function";
122
140
  }, {
123
141
  readonly inputs: readonly [{
124
142
  readonly components: readonly [{
@@ -150,9 +168,9 @@ declare const confidentialTokenAbi: readonly [{
150
168
  readonly name: "p";
151
169
  readonly type: "tuple";
152
170
  }, {
153
- readonly internalType: "bytes";
171
+ readonly internalType: "externalEuint64";
154
172
  readonly name: "encryptedAmountInput";
155
- readonly type: "bytes";
173
+ readonly type: "bytes32";
156
174
  }, {
157
175
  readonly internalType: "bytes";
158
176
  readonly name: "inputProof";
@@ -184,6 +202,20 @@ declare const confidentialTokenAbi: readonly [{
184
202
  readonly outputs: readonly [];
185
203
  readonly stateMutability: "nonpayable";
186
204
  readonly type: "function";
205
+ }, {
206
+ readonly inputs: readonly [{
207
+ readonly internalType: "address";
208
+ readonly name: "account";
209
+ readonly type: "address";
210
+ }];
211
+ readonly name: "confidentialBalanceOf";
212
+ readonly outputs: readonly [{
213
+ readonly internalType: "bytes32";
214
+ readonly name: "";
215
+ readonly type: "bytes32";
216
+ }];
217
+ readonly stateMutability: "view";
218
+ readonly type: "function";
187
219
  }, {
188
220
  readonly anonymous: false;
189
221
  readonly inputs: readonly [{
@@ -219,6 +251,63 @@ declare const confidentialTokenAbi: readonly [{
219
251
  }];
220
252
  readonly name: "ConfidentialPaymentExecuted";
221
253
  readonly type: "event";
254
+ }, {
255
+ readonly inputs: readonly [{
256
+ readonly indexed: true;
257
+ readonly internalType: "address";
258
+ readonly name: "receiver";
259
+ readonly type: "address";
260
+ }, {
261
+ readonly indexed: false;
262
+ readonly internalType: "bytes32";
263
+ readonly name: "encryptedAmount";
264
+ readonly type: "bytes32";
265
+ }, {
266
+ readonly indexed: false;
267
+ readonly internalType: "uint64";
268
+ readonly name: "cleartextAmount";
269
+ readonly type: "uint64";
270
+ }];
271
+ readonly name: "UnwrapFinalized";
272
+ readonly type: "event";
273
+ }, {
274
+ readonly inputs: readonly [{
275
+ readonly indexed: true;
276
+ readonly internalType: "address";
277
+ readonly name: "receiver";
278
+ readonly type: "address";
279
+ }, {
280
+ readonly indexed: false;
281
+ readonly internalType: "bytes32";
282
+ readonly name: "amount";
283
+ readonly type: "bytes32";
284
+ }];
285
+ readonly name: "UnwrapRequested";
286
+ readonly type: "event";
287
+ }, {
288
+ readonly inputs: readonly [{
289
+ readonly indexed: true;
290
+ readonly internalType: "address";
291
+ readonly name: "holder";
292
+ readonly type: "address";
293
+ }, {
294
+ readonly indexed: true;
295
+ readonly internalType: "address";
296
+ readonly name: "to";
297
+ readonly type: "address";
298
+ }, {
299
+ readonly indexed: false;
300
+ readonly internalType: "bytes32";
301
+ readonly name: "nonce";
302
+ readonly type: "bytes32";
303
+ }, {
304
+ readonly indexed: false;
305
+ readonly internalType: "bytes32";
306
+ readonly name: "encryptedAmountHandle";
307
+ readonly type: "bytes32";
308
+ }];
309
+ readonly name: "UnwrapWithAuthorizationExecuted";
310
+ readonly type: "event";
222
311
  }, {
223
312
  readonly inputs: readonly [{
224
313
  readonly internalType: "address";
@@ -322,7 +411,7 @@ type RelayerSigner = {
322
411
 
323
412
  declare function createRelayer(config: FhevmInstanceConfig): Promise<RelayerInstance>;
324
413
 
325
- 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<{
326
415
  handle: `0x${string}`;
327
416
  inputProof: `0x${string}`;
328
417
  }>;
package/dist/index.d.ts CHANGED
@@ -119,6 +119,24 @@ declare const confidentialTokenAbi: readonly [{
119
119
  readonly outputs: readonly [];
120
120
  readonly stateMutability: "nonpayable";
121
121
  readonly type: "function";
122
+ }, {
123
+ readonly inputs: readonly [{
124
+ readonly internalType: "address";
125
+ readonly name: "from";
126
+ readonly type: "address";
127
+ }, {
128
+ readonly internalType: "address";
129
+ readonly name: "to";
130
+ readonly type: "address";
131
+ }, {
132
+ readonly internalType: "euint64";
133
+ readonly name: "amount";
134
+ readonly type: "bytes32";
135
+ }];
136
+ readonly name: "unwrap";
137
+ readonly outputs: readonly [];
138
+ readonly stateMutability: "nonpayable";
139
+ readonly type: "function";
122
140
  }, {
123
141
  readonly inputs: readonly [{
124
142
  readonly components: readonly [{
@@ -150,9 +168,9 @@ declare const confidentialTokenAbi: readonly [{
150
168
  readonly name: "p";
151
169
  readonly type: "tuple";
152
170
  }, {
153
- readonly internalType: "bytes";
171
+ readonly internalType: "externalEuint64";
154
172
  readonly name: "encryptedAmountInput";
155
- readonly type: "bytes";
173
+ readonly type: "bytes32";
156
174
  }, {
157
175
  readonly internalType: "bytes";
158
176
  readonly name: "inputProof";
@@ -184,6 +202,20 @@ declare const confidentialTokenAbi: readonly [{
184
202
  readonly outputs: readonly [];
185
203
  readonly stateMutability: "nonpayable";
186
204
  readonly type: "function";
205
+ }, {
206
+ readonly inputs: readonly [{
207
+ readonly internalType: "address";
208
+ readonly name: "account";
209
+ readonly type: "address";
210
+ }];
211
+ readonly name: "confidentialBalanceOf";
212
+ readonly outputs: readonly [{
213
+ readonly internalType: "bytes32";
214
+ readonly name: "";
215
+ readonly type: "bytes32";
216
+ }];
217
+ readonly stateMutability: "view";
218
+ readonly type: "function";
187
219
  }, {
188
220
  readonly anonymous: false;
189
221
  readonly inputs: readonly [{
@@ -219,6 +251,63 @@ declare const confidentialTokenAbi: readonly [{
219
251
  }];
220
252
  readonly name: "ConfidentialPaymentExecuted";
221
253
  readonly type: "event";
254
+ }, {
255
+ readonly inputs: readonly [{
256
+ readonly indexed: true;
257
+ readonly internalType: "address";
258
+ readonly name: "receiver";
259
+ readonly type: "address";
260
+ }, {
261
+ readonly indexed: false;
262
+ readonly internalType: "bytes32";
263
+ readonly name: "encryptedAmount";
264
+ readonly type: "bytes32";
265
+ }, {
266
+ readonly indexed: false;
267
+ readonly internalType: "uint64";
268
+ readonly name: "cleartextAmount";
269
+ readonly type: "uint64";
270
+ }];
271
+ readonly name: "UnwrapFinalized";
272
+ readonly type: "event";
273
+ }, {
274
+ readonly inputs: readonly [{
275
+ readonly indexed: true;
276
+ readonly internalType: "address";
277
+ readonly name: "receiver";
278
+ readonly type: "address";
279
+ }, {
280
+ readonly indexed: false;
281
+ readonly internalType: "bytes32";
282
+ readonly name: "amount";
283
+ readonly type: "bytes32";
284
+ }];
285
+ readonly name: "UnwrapRequested";
286
+ readonly type: "event";
287
+ }, {
288
+ readonly inputs: readonly [{
289
+ readonly indexed: true;
290
+ readonly internalType: "address";
291
+ readonly name: "holder";
292
+ readonly type: "address";
293
+ }, {
294
+ readonly indexed: true;
295
+ readonly internalType: "address";
296
+ readonly name: "to";
297
+ readonly type: "address";
298
+ }, {
299
+ readonly indexed: false;
300
+ readonly internalType: "bytes32";
301
+ readonly name: "nonce";
302
+ readonly type: "bytes32";
303
+ }, {
304
+ readonly indexed: false;
305
+ readonly internalType: "bytes32";
306
+ readonly name: "encryptedAmountHandle";
307
+ readonly type: "bytes32";
308
+ }];
309
+ readonly name: "UnwrapWithAuthorizationExecuted";
310
+ readonly type: "event";
222
311
  }, {
223
312
  readonly inputs: readonly [{
224
313
  readonly internalType: "address";
@@ -322,7 +411,7 @@ type RelayerSigner = {
322
411
 
323
412
  declare function createRelayer(config: FhevmInstanceConfig): Promise<RelayerInstance>;
324
413
 
325
- 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<{
326
415
  handle: `0x${string}`;
327
416
  inputProof: `0x${string}`;
328
417
  }>;
package/dist/index.js CHANGED
@@ -97,6 +97,17 @@ var confidentialTokenAbi = [
97
97
  stateMutability: "nonpayable",
98
98
  type: "function"
99
99
  },
100
+ {
101
+ inputs: [
102
+ { internalType: "address", name: "from", type: "address" },
103
+ { internalType: "address", name: "to", type: "address" },
104
+ { internalType: "euint64", name: "amount", type: "bytes32" }
105
+ ],
106
+ name: "unwrap",
107
+ outputs: [],
108
+ stateMutability: "nonpayable",
109
+ type: "function"
110
+ },
100
111
  {
101
112
  inputs: [
102
113
  {
@@ -112,7 +123,11 @@ var confidentialTokenAbi = [
112
123
  name: "p",
113
124
  type: "tuple"
114
125
  },
115
- { internalType: "bytes", name: "encryptedAmountInput", type: "bytes" },
126
+ {
127
+ internalType: "externalEuint64",
128
+ name: "encryptedAmountInput",
129
+ type: "bytes32"
130
+ },
116
131
  { internalType: "bytes", name: "inputProof", type: "bytes" },
117
132
  { internalType: "bytes", name: "sig", type: "bytes" }
118
133
  ],
@@ -132,6 +147,13 @@ var confidentialTokenAbi = [
132
147
  stateMutability: "nonpayable",
133
148
  type: "function"
134
149
  },
150
+ {
151
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
152
+ name: "confidentialBalanceOf",
153
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
154
+ stateMutability: "view",
155
+ type: "function"
156
+ },
135
157
  {
136
158
  anonymous: false,
137
159
  inputs: [
@@ -145,6 +167,33 @@ var confidentialTokenAbi = [
145
167
  name: "ConfidentialPaymentExecuted",
146
168
  type: "event"
147
169
  },
170
+ {
171
+ inputs: [
172
+ { indexed: true, internalType: "address", name: "receiver", type: "address" },
173
+ { indexed: false, internalType: "bytes32", name: "encryptedAmount", type: "bytes32" },
174
+ { indexed: false, internalType: "uint64", name: "cleartextAmount", type: "uint64" }
175
+ ],
176
+ name: "UnwrapFinalized",
177
+ type: "event"
178
+ },
179
+ {
180
+ inputs: [
181
+ { indexed: true, internalType: "address", name: "receiver", type: "address" },
182
+ { indexed: false, internalType: "bytes32", name: "amount", type: "bytes32" }
183
+ ],
184
+ name: "UnwrapRequested",
185
+ type: "event"
186
+ },
187
+ {
188
+ inputs: [
189
+ { indexed: true, internalType: "address", name: "holder", type: "address" },
190
+ { indexed: true, internalType: "address", name: "to", type: "address" },
191
+ { indexed: false, internalType: "bytes32", name: "nonce", type: "bytes32" },
192
+ { indexed: false, internalType: "bytes32", name: "encryptedAmountHandle", type: "bytes32" }
193
+ ],
194
+ name: "UnwrapWithAuthorizationExecuted",
195
+ type: "event"
196
+ },
148
197
  {
149
198
  inputs: [
150
199
  { internalType: "address", name: "", type: "address" },
@@ -228,10 +277,10 @@ async function createRelayer(config) {
228
277
  }
229
278
  return instance;
230
279
  }
231
- async function createEncryptedAmountInput(relayer, contractAddress, senderAddress, amount) {
280
+ async function createEncryptedAmountInput(relayer, contractAddress, callerAddress, amount) {
232
281
  const normalizedContract = (0, import_viem2.getAddress)(contractAddress);
233
- const normalizedSender = (0, import_viem2.getAddress)(senderAddress);
234
- 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();
235
284
  const handle = typeof encrypted.handles[0] === "string" ? encrypted.handles[0] : (0, import_viem2.toHex)(encrypted.handles[0]);
236
285
  const inputProof = typeof encrypted.inputProof === "string" ? encrypted.inputProof : (0, import_viem2.toHex)(encrypted.inputProof);
237
286
  return {
package/dist/index.mjs CHANGED
@@ -59,6 +59,17 @@ var confidentialTokenAbi = [
59
59
  stateMutability: "nonpayable",
60
60
  type: "function"
61
61
  },
62
+ {
63
+ inputs: [
64
+ { internalType: "address", name: "from", type: "address" },
65
+ { internalType: "address", name: "to", type: "address" },
66
+ { internalType: "euint64", name: "amount", type: "bytes32" }
67
+ ],
68
+ name: "unwrap",
69
+ outputs: [],
70
+ stateMutability: "nonpayable",
71
+ type: "function"
72
+ },
62
73
  {
63
74
  inputs: [
64
75
  {
@@ -74,7 +85,11 @@ var confidentialTokenAbi = [
74
85
  name: "p",
75
86
  type: "tuple"
76
87
  },
77
- { internalType: "bytes", name: "encryptedAmountInput", type: "bytes" },
88
+ {
89
+ internalType: "externalEuint64",
90
+ name: "encryptedAmountInput",
91
+ type: "bytes32"
92
+ },
78
93
  { internalType: "bytes", name: "inputProof", type: "bytes" },
79
94
  { internalType: "bytes", name: "sig", type: "bytes" }
80
95
  ],
@@ -94,6 +109,13 @@ var confidentialTokenAbi = [
94
109
  stateMutability: "nonpayable",
95
110
  type: "function"
96
111
  },
112
+ {
113
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
114
+ name: "confidentialBalanceOf",
115
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
116
+ stateMutability: "view",
117
+ type: "function"
118
+ },
97
119
  {
98
120
  anonymous: false,
99
121
  inputs: [
@@ -107,6 +129,33 @@ var confidentialTokenAbi = [
107
129
  name: "ConfidentialPaymentExecuted",
108
130
  type: "event"
109
131
  },
132
+ {
133
+ inputs: [
134
+ { indexed: true, internalType: "address", name: "receiver", type: "address" },
135
+ { indexed: false, internalType: "bytes32", name: "encryptedAmount", type: "bytes32" },
136
+ { indexed: false, internalType: "uint64", name: "cleartextAmount", type: "uint64" }
137
+ ],
138
+ name: "UnwrapFinalized",
139
+ type: "event"
140
+ },
141
+ {
142
+ inputs: [
143
+ { indexed: true, internalType: "address", name: "receiver", type: "address" },
144
+ { indexed: false, internalType: "bytes32", name: "amount", type: "bytes32" }
145
+ ],
146
+ name: "UnwrapRequested",
147
+ type: "event"
148
+ },
149
+ {
150
+ inputs: [
151
+ { indexed: true, internalType: "address", name: "holder", type: "address" },
152
+ { indexed: true, internalType: "address", name: "to", type: "address" },
153
+ { indexed: false, internalType: "bytes32", name: "nonce", type: "bytes32" },
154
+ { indexed: false, internalType: "bytes32", name: "encryptedAmountHandle", type: "bytes32" }
155
+ ],
156
+ name: "UnwrapWithAuthorizationExecuted",
157
+ type: "event"
158
+ },
110
159
  {
111
160
  inputs: [
112
161
  { internalType: "address", name: "", type: "address" },
@@ -190,10 +239,10 @@ async function createRelayer(config) {
190
239
  }
191
240
  return instance;
192
241
  }
193
- async function createEncryptedAmountInput(relayer, contractAddress, senderAddress, amount) {
242
+ async function createEncryptedAmountInput(relayer, contractAddress, callerAddress, amount) {
194
243
  const normalizedContract = getAddress(contractAddress);
195
- const normalizedSender = getAddress(senderAddress);
196
- 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();
197
246
  const handle = typeof encrypted.handles[0] === "string" ? encrypted.handles[0] : toHex2(encrypted.handles[0]);
198
247
  const inputProof = typeof encrypted.inputProof === "string" ? encrypted.inputProof : toHex2(encrypted.inputProof);
199
248
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402z-shared",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",