x402z-shared-web 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 +94 -5
- package/dist/index.d.ts +94 -5
- package/dist/index.js +54 -5
- package/dist/index.mjs +54 -5
- package/package.json +1 -1
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: "
|
|
171
|
+
readonly internalType: "externalEuint64";
|
|
154
172
|
readonly name: "encryptedAmountInput";
|
|
155
|
-
readonly type: "
|
|
173
|
+
readonly type: "bytes32";
|
|
156
174
|
}, {
|
|
157
175
|
readonly internalType: "bytes";
|
|
158
176
|
readonly name: "inputProof";
|
|
@@ -168,7 +186,7 @@ declare const confidentialTokenAbi: readonly [{
|
|
|
168
186
|
readonly type: "function";
|
|
169
187
|
}, {
|
|
170
188
|
readonly inputs: readonly [{
|
|
171
|
-
readonly internalType: "
|
|
189
|
+
readonly internalType: "euint64";
|
|
172
190
|
readonly name: "burntAmount";
|
|
173
191
|
readonly type: "bytes32";
|
|
174
192
|
}, {
|
|
@@ -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";
|
|
@@ -325,7 +414,7 @@ declare function getBrowserEthereumProvider(): BrowserEthereumProvider;
|
|
|
325
414
|
declare function createBrowserSigner(provider?: BrowserEthereumProvider): Promise<BrowserSigner>;
|
|
326
415
|
|
|
327
416
|
interface RelayerInstance {
|
|
328
|
-
createEncryptedInput: (contractAddress: string,
|
|
417
|
+
createEncryptedInput: (contractAddress: string, callerAddress: string) => {
|
|
329
418
|
add64: (amount: number) => {
|
|
330
419
|
encrypt: () => Promise<{
|
|
331
420
|
handles: Array<string | Uint8Array>;
|
|
@@ -382,7 +471,7 @@ type RelayerSigner = {
|
|
|
382
471
|
};
|
|
383
472
|
declare function createRelayer(config: FhevmInstanceConfig): Promise<RelayerInstance>;
|
|
384
473
|
declare function initSDK(params?: Parameters<RelayerSdkModule["initSDK"]>[0]): Promise<boolean>;
|
|
385
|
-
declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string,
|
|
474
|
+
declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string, callerAddress: string, amount: number): Promise<{
|
|
386
475
|
handle: `0x${string}`;
|
|
387
476
|
inputProof: `0x${string}`;
|
|
388
477
|
}>;
|
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: "
|
|
171
|
+
readonly internalType: "externalEuint64";
|
|
154
172
|
readonly name: "encryptedAmountInput";
|
|
155
|
-
readonly type: "
|
|
173
|
+
readonly type: "bytes32";
|
|
156
174
|
}, {
|
|
157
175
|
readonly internalType: "bytes";
|
|
158
176
|
readonly name: "inputProof";
|
|
@@ -168,7 +186,7 @@ declare const confidentialTokenAbi: readonly [{
|
|
|
168
186
|
readonly type: "function";
|
|
169
187
|
}, {
|
|
170
188
|
readonly inputs: readonly [{
|
|
171
|
-
readonly internalType: "
|
|
189
|
+
readonly internalType: "euint64";
|
|
172
190
|
readonly name: "burntAmount";
|
|
173
191
|
readonly type: "bytes32";
|
|
174
192
|
}, {
|
|
@@ -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";
|
|
@@ -325,7 +414,7 @@ declare function getBrowserEthereumProvider(): BrowserEthereumProvider;
|
|
|
325
414
|
declare function createBrowserSigner(provider?: BrowserEthereumProvider): Promise<BrowserSigner>;
|
|
326
415
|
|
|
327
416
|
interface RelayerInstance {
|
|
328
|
-
createEncryptedInput: (contractAddress: string,
|
|
417
|
+
createEncryptedInput: (contractAddress: string, callerAddress: string) => {
|
|
329
418
|
add64: (amount: number) => {
|
|
330
419
|
encrypt: () => Promise<{
|
|
331
420
|
handles: Array<string | Uint8Array>;
|
|
@@ -382,7 +471,7 @@ type RelayerSigner = {
|
|
|
382
471
|
};
|
|
383
472
|
declare function createRelayer(config: FhevmInstanceConfig): Promise<RelayerInstance>;
|
|
384
473
|
declare function initSDK(params?: Parameters<RelayerSdkModule["initSDK"]>[0]): Promise<boolean>;
|
|
385
|
-
declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string,
|
|
474
|
+
declare function createEncryptedAmountInput(relayer: RelayerInstance, contractAddress: string, callerAddress: string, amount: number): Promise<{
|
|
386
475
|
handle: `0x${string}`;
|
|
387
476
|
inputProof: `0x${string}`;
|
|
388
477
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -111,6 +111,17 @@ var confidentialTokenAbi = [
|
|
|
111
111
|
stateMutability: "nonpayable",
|
|
112
112
|
type: "function"
|
|
113
113
|
},
|
|
114
|
+
{
|
|
115
|
+
inputs: [
|
|
116
|
+
{ internalType: "address", name: "from", type: "address" },
|
|
117
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
118
|
+
{ internalType: "euint64", name: "amount", type: "bytes32" }
|
|
119
|
+
],
|
|
120
|
+
name: "unwrap",
|
|
121
|
+
outputs: [],
|
|
122
|
+
stateMutability: "nonpayable",
|
|
123
|
+
type: "function"
|
|
124
|
+
},
|
|
114
125
|
{
|
|
115
126
|
inputs: [
|
|
116
127
|
{
|
|
@@ -126,7 +137,11 @@ var confidentialTokenAbi = [
|
|
|
126
137
|
name: "p",
|
|
127
138
|
type: "tuple"
|
|
128
139
|
},
|
|
129
|
-
{
|
|
140
|
+
{
|
|
141
|
+
internalType: "externalEuint64",
|
|
142
|
+
name: "encryptedAmountInput",
|
|
143
|
+
type: "bytes32"
|
|
144
|
+
},
|
|
130
145
|
{ internalType: "bytes", name: "inputProof", type: "bytes" },
|
|
131
146
|
{ internalType: "bytes", name: "sig", type: "bytes" }
|
|
132
147
|
],
|
|
@@ -137,7 +152,7 @@ var confidentialTokenAbi = [
|
|
|
137
152
|
},
|
|
138
153
|
{
|
|
139
154
|
inputs: [
|
|
140
|
-
{ internalType: "
|
|
155
|
+
{ internalType: "euint64", name: "burntAmount", type: "bytes32" },
|
|
141
156
|
{ internalType: "uint64", name: "burntAmountCleartext", type: "uint64" },
|
|
142
157
|
{ internalType: "bytes", name: "decryptionProof", type: "bytes" }
|
|
143
158
|
],
|
|
@@ -146,6 +161,13 @@ var confidentialTokenAbi = [
|
|
|
146
161
|
stateMutability: "nonpayable",
|
|
147
162
|
type: "function"
|
|
148
163
|
},
|
|
164
|
+
{
|
|
165
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
166
|
+
name: "confidentialBalanceOf",
|
|
167
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
168
|
+
stateMutability: "view",
|
|
169
|
+
type: "function"
|
|
170
|
+
},
|
|
149
171
|
{
|
|
150
172
|
anonymous: false,
|
|
151
173
|
inputs: [
|
|
@@ -159,6 +181,33 @@ var confidentialTokenAbi = [
|
|
|
159
181
|
name: "ConfidentialPaymentExecuted",
|
|
160
182
|
type: "event"
|
|
161
183
|
},
|
|
184
|
+
{
|
|
185
|
+
inputs: [
|
|
186
|
+
{ indexed: true, internalType: "address", name: "receiver", type: "address" },
|
|
187
|
+
{ indexed: false, internalType: "bytes32", name: "encryptedAmount", type: "bytes32" },
|
|
188
|
+
{ indexed: false, internalType: "uint64", name: "cleartextAmount", type: "uint64" }
|
|
189
|
+
],
|
|
190
|
+
name: "UnwrapFinalized",
|
|
191
|
+
type: "event"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
inputs: [
|
|
195
|
+
{ indexed: true, internalType: "address", name: "receiver", type: "address" },
|
|
196
|
+
{ indexed: false, internalType: "bytes32", name: "amount", type: "bytes32" }
|
|
197
|
+
],
|
|
198
|
+
name: "UnwrapRequested",
|
|
199
|
+
type: "event"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
inputs: [
|
|
203
|
+
{ indexed: true, internalType: "address", name: "holder", type: "address" },
|
|
204
|
+
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
205
|
+
{ indexed: false, internalType: "bytes32", name: "nonce", type: "bytes32" },
|
|
206
|
+
{ indexed: false, internalType: "bytes32", name: "encryptedAmountHandle", type: "bytes32" }
|
|
207
|
+
],
|
|
208
|
+
name: "UnwrapWithAuthorizationExecuted",
|
|
209
|
+
type: "event"
|
|
210
|
+
},
|
|
162
211
|
{
|
|
163
212
|
inputs: [
|
|
164
213
|
{ internalType: "address", name: "", type: "address" },
|
|
@@ -304,10 +353,10 @@ async function initSDK2(params) {
|
|
|
304
353
|
sdkInitialized = true;
|
|
305
354
|
return result;
|
|
306
355
|
}
|
|
307
|
-
async function createEncryptedAmountInput(relayer, contractAddress,
|
|
356
|
+
async function createEncryptedAmountInput(relayer, contractAddress, callerAddress, amount) {
|
|
308
357
|
const normalizedContract = (0, import_viem2.getAddress)(contractAddress);
|
|
309
|
-
const
|
|
310
|
-
const encrypted = await relayer.createEncryptedInput(normalizedContract,
|
|
358
|
+
const normalizedCaller = (0, import_viem2.getAddress)(callerAddress);
|
|
359
|
+
const encrypted = await relayer.createEncryptedInput(normalizedContract, normalizedCaller).add64(amount).encrypt();
|
|
311
360
|
const handle = typeof encrypted.handles[0] === "string" ? encrypted.handles[0] : (0, import_viem2.toHex)(encrypted.handles[0]);
|
|
312
361
|
const inputProof = typeof encrypted.inputProof === "string" ? encrypted.inputProof : (0, import_viem2.toHex)(encrypted.inputProof);
|
|
313
362
|
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
|
-
{
|
|
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
|
],
|
|
@@ -85,7 +100,7 @@ var confidentialTokenAbi = [
|
|
|
85
100
|
},
|
|
86
101
|
{
|
|
87
102
|
inputs: [
|
|
88
|
-
{ internalType: "
|
|
103
|
+
{ internalType: "euint64", name: "burntAmount", type: "bytes32" },
|
|
89
104
|
{ internalType: "uint64", name: "burntAmountCleartext", type: "uint64" },
|
|
90
105
|
{ internalType: "bytes", name: "decryptionProof", type: "bytes" }
|
|
91
106
|
],
|
|
@@ -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" },
|
|
@@ -252,10 +301,10 @@ async function initSDK2(params) {
|
|
|
252
301
|
sdkInitialized = true;
|
|
253
302
|
return result;
|
|
254
303
|
}
|
|
255
|
-
async function createEncryptedAmountInput(relayer, contractAddress,
|
|
304
|
+
async function createEncryptedAmountInput(relayer, contractAddress, callerAddress, amount) {
|
|
256
305
|
const normalizedContract = getAddress(contractAddress);
|
|
257
|
-
const
|
|
258
|
-
const encrypted = await relayer.createEncryptedInput(normalizedContract,
|
|
306
|
+
const normalizedCaller = getAddress(callerAddress);
|
|
307
|
+
const encrypted = await relayer.createEncryptedInput(normalizedContract, normalizedCaller).add64(amount).encrypt();
|
|
259
308
|
const handle = typeof encrypted.handles[0] === "string" ? encrypted.handles[0] : toHex2(encrypted.handles[0]);
|
|
260
309
|
const inputProof = typeof encrypted.inputProof === "string" ? encrypted.inputProof : toHex2(encrypted.inputProof);
|
|
261
310
|
return {
|