x402z-shared 0.0.4 → 0.0.6

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.
@@ -0,0 +1,274 @@
1
+ declare const confidentialTokenAbi: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "to";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "bytes32";
8
+ readonly name: "encryptedAmountInput";
9
+ readonly type: "bytes32";
10
+ }, {
11
+ readonly internalType: "bytes";
12
+ readonly name: "inputProof";
13
+ readonly type: "bytes";
14
+ }];
15
+ readonly name: "confidentialTransfer";
16
+ readonly outputs: readonly [{
17
+ readonly internalType: "euint64";
18
+ readonly name: "transferred";
19
+ readonly type: "bytes32";
20
+ }];
21
+ readonly stateMutability: "nonpayable";
22
+ readonly type: "function";
23
+ }, {
24
+ readonly inputs: readonly [{
25
+ readonly components: readonly [{
26
+ readonly internalType: "address";
27
+ readonly name: "holder";
28
+ readonly type: "address";
29
+ }, {
30
+ readonly internalType: "address";
31
+ readonly name: "payee";
32
+ readonly type: "address";
33
+ }, {
34
+ readonly internalType: "uint256";
35
+ readonly name: "maxClearAmount";
36
+ readonly type: "uint256";
37
+ }, {
38
+ readonly internalType: "bytes32";
39
+ readonly name: "resourceHash";
40
+ readonly type: "bytes32";
41
+ }, {
42
+ readonly internalType: "uint48";
43
+ readonly name: "validAfter";
44
+ readonly type: "uint48";
45
+ }, {
46
+ readonly internalType: "uint48";
47
+ readonly name: "validBefore";
48
+ readonly type: "uint48";
49
+ }, {
50
+ readonly internalType: "bytes32";
51
+ readonly name: "nonce";
52
+ readonly type: "bytes32";
53
+ }, {
54
+ readonly internalType: "bytes32";
55
+ readonly name: "encryptedAmountHash";
56
+ readonly type: "bytes32";
57
+ }];
58
+ readonly internalType: "struct FHEToken.ConfidentialPayment";
59
+ readonly name: "p";
60
+ readonly type: "tuple";
61
+ }, {
62
+ readonly internalType: "externalEuint64";
63
+ readonly name: "encryptedAmountInput";
64
+ readonly type: "bytes32";
65
+ }, {
66
+ readonly internalType: "bytes";
67
+ readonly name: "inputProof";
68
+ readonly type: "bytes";
69
+ }, {
70
+ readonly internalType: "bytes";
71
+ readonly name: "sig";
72
+ readonly type: "bytes";
73
+ }];
74
+ readonly name: "confidentialTransferWithAuthorization";
75
+ readonly outputs: readonly [{
76
+ readonly internalType: "euint64";
77
+ readonly name: "transferred";
78
+ readonly type: "bytes32";
79
+ }];
80
+ readonly stateMutability: "nonpayable";
81
+ readonly type: "function";
82
+ }, {
83
+ readonly inputs: readonly [{
84
+ readonly internalType: "address";
85
+ readonly name: "to";
86
+ readonly type: "address";
87
+ }, {
88
+ readonly internalType: "uint256";
89
+ readonly name: "amount";
90
+ readonly type: "uint256";
91
+ }];
92
+ readonly name: "wrap";
93
+ readonly outputs: readonly [];
94
+ readonly stateMutability: "nonpayable";
95
+ readonly type: "function";
96
+ }, {
97
+ readonly inputs: readonly [{
98
+ readonly internalType: "address";
99
+ readonly name: "from";
100
+ readonly type: "address";
101
+ }, {
102
+ readonly internalType: "address";
103
+ readonly name: "to";
104
+ readonly type: "address";
105
+ }, {
106
+ readonly internalType: "bytes32";
107
+ readonly name: "encryptedAmountInput";
108
+ readonly type: "bytes32";
109
+ }, {
110
+ readonly internalType: "bytes";
111
+ readonly name: "inputProof";
112
+ readonly type: "bytes";
113
+ }];
114
+ readonly name: "unwrap";
115
+ readonly outputs: readonly [];
116
+ readonly stateMutability: "nonpayable";
117
+ readonly type: "function";
118
+ }, {
119
+ readonly anonymous: false;
120
+ readonly inputs: readonly [{
121
+ readonly indexed: true;
122
+ readonly internalType: "address";
123
+ readonly name: "holder";
124
+ readonly type: "address";
125
+ }, {
126
+ readonly indexed: true;
127
+ readonly internalType: "address";
128
+ readonly name: "payee";
129
+ readonly type: "address";
130
+ }, {
131
+ readonly indexed: false;
132
+ readonly internalType: "uint256";
133
+ readonly name: "maxClearAmount";
134
+ readonly type: "uint256";
135
+ }, {
136
+ readonly indexed: true;
137
+ readonly internalType: "bytes32";
138
+ readonly name: "resourceHash";
139
+ readonly type: "bytes32";
140
+ }, {
141
+ readonly indexed: false;
142
+ readonly internalType: "bytes32";
143
+ readonly name: "nonce";
144
+ readonly type: "bytes32";
145
+ }, {
146
+ readonly indexed: false;
147
+ readonly internalType: "bytes32";
148
+ readonly name: "transferredAmount";
149
+ readonly type: "bytes32";
150
+ }];
151
+ readonly name: "ConfidentialPaymentExecuted";
152
+ readonly type: "event";
153
+ }, {
154
+ readonly inputs: readonly [{
155
+ readonly internalType: "address";
156
+ readonly name: "";
157
+ readonly type: "address";
158
+ }, {
159
+ readonly internalType: "bytes32";
160
+ readonly name: "";
161
+ readonly type: "bytes32";
162
+ }];
163
+ readonly name: "usedNonces";
164
+ readonly outputs: readonly [{
165
+ readonly internalType: "bool";
166
+ readonly name: "";
167
+ readonly type: "bool";
168
+ }];
169
+ readonly stateMutability: "view";
170
+ readonly type: "function";
171
+ }, {
172
+ readonly inputs: readonly [{
173
+ readonly internalType: "address";
174
+ readonly name: "account";
175
+ readonly type: "address";
176
+ }];
177
+ readonly name: "observer";
178
+ readonly outputs: readonly [{
179
+ readonly internalType: "address";
180
+ readonly name: "";
181
+ readonly type: "address";
182
+ }];
183
+ readonly stateMutability: "view";
184
+ readonly type: "function";
185
+ }, {
186
+ readonly inputs: readonly [{
187
+ readonly internalType: "address";
188
+ readonly name: "account";
189
+ readonly type: "address";
190
+ }, {
191
+ readonly internalType: "address";
192
+ readonly name: "newObserver";
193
+ readonly type: "address";
194
+ }];
195
+ readonly name: "setObserver";
196
+ readonly outputs: readonly [];
197
+ readonly stateMutability: "nonpayable";
198
+ readonly type: "function";
199
+ }];
200
+
201
+ declare const confidentialPaymentTypes: {
202
+ readonly ConfidentialPayment: readonly [{
203
+ readonly name: "holder";
204
+ readonly type: "address";
205
+ }, {
206
+ readonly name: "payee";
207
+ readonly type: "address";
208
+ }, {
209
+ readonly name: "maxClearAmount";
210
+ readonly type: "uint256";
211
+ }, {
212
+ readonly name: "resourceHash";
213
+ readonly type: "bytes32";
214
+ }, {
215
+ readonly name: "validAfter";
216
+ readonly type: "uint48";
217
+ }, {
218
+ readonly name: "validBefore";
219
+ readonly type: "uint48";
220
+ }, {
221
+ readonly name: "nonce";
222
+ readonly type: "bytes32";
223
+ }, {
224
+ readonly name: "encryptedAmountHash";
225
+ readonly type: "bytes32";
226
+ }];
227
+ };
228
+ declare const confidentialErrorCodes: {
229
+ readonly observerNotAuthorized: "observer_not_authorized";
230
+ };
231
+ type ConfidentialErrorCode = (typeof confidentialErrorCodes)[keyof typeof confidentialErrorCodes];
232
+
233
+ declare function createNonce(): `0x${string}`;
234
+ declare function hashEncryptedAmountInput(encryptedAmountInput: `0x${string}`): `0x${string}`;
235
+ declare function normalizeAmount(amount: string | number | bigint): string;
236
+
237
+ type ConfidentialPaymentAuthorization = {
238
+ holder: `0x${string}`;
239
+ payee: `0x${string}`;
240
+ maxClearAmount: string;
241
+ resourceHash: `0x${string}`;
242
+ validAfter: string;
243
+ validBefore: string;
244
+ nonce: `0x${string}`;
245
+ encryptedAmountHash: `0x${string}`;
246
+ };
247
+ type ConfidentialPaymentPayload = {
248
+ authorization: ConfidentialPaymentAuthorization;
249
+ signature: `0x${string}`;
250
+ encryptedAmountInput: `0x${string}`;
251
+ inputProof: `0x${string}`;
252
+ };
253
+ type ConfidentialRequirementsExtra = {
254
+ eip712: {
255
+ name: string;
256
+ version: string;
257
+ };
258
+ confidential?: {
259
+ maxClearAmount?: string;
260
+ resourceHash?: `0x${string}`;
261
+ batcherAddress?: `0x${string}`;
262
+ };
263
+ };
264
+ type ConfidentialPaymentInput = {
265
+ encryptedAmountInput: `0x${string}`;
266
+ inputProof: `0x${string}`;
267
+ maxClearAmount?: string;
268
+ resourceHash?: `0x${string}`;
269
+ validAfter?: number;
270
+ validBefore?: number;
271
+ nonce?: `0x${string}`;
272
+ };
273
+
274
+ export { type ConfidentialErrorCode as C, confidentialPaymentTypes as a, confidentialErrorCodes as b, confidentialTokenAbi as c, createNonce as d, type ConfidentialPaymentAuthorization as e, type ConfidentialPaymentPayload as f, type ConfidentialRequirementsExtra as g, hashEncryptedAmountInput as h, type ConfidentialPaymentInput as i, normalizeAmount as n };
package/dist/web.d.mts CHANGED
@@ -1,9 +1,8 @@
1
- export { C as ConfidentialErrorCode, i as ConfidentialPaymentAuthorization, l as ConfidentialPaymentInput, j as ConfidentialPaymentPayload, k as ConfidentialRequirementsExtra, S as SetObserverOptions, d as confidentialErrorCodes, b as confidentialPaymentTypes, c as confidentialTokenAbi, e as createNonce, h as hashEncryptedAmountInput, n as normalizeAmount, s as setObserver } from './types-Cy4f8wJ6.mjs';
2
- import { createInstance } from '@zama-fhe/relayer-sdk/bundle';
3
- export { SepoliaConfig, initSDK } from '@zama-fhe/relayer-sdk/bundle';
1
+ export { C as ConfidentialErrorCode, e as ConfidentialPaymentAuthorization, i as ConfidentialPaymentInput, f as ConfidentialPaymentPayload, g as ConfidentialRequirementsExtra, b as confidentialErrorCodes, a as confidentialPaymentTypes, c as confidentialTokenAbi, d as createNonce, h as hashEncryptedAmountInput, n as normalizeAmount } from './types-I3K7qzdc.mjs';
2
+ import { createInstance } from '@zama-fhe/relayer-sdk/web';
3
+ export { SepoliaConfig, initSDK } from '@zama-fhe/relayer-sdk/web';
4
4
  import { WalletClient } from 'viem';
5
5
  export * from '@x402/core/types';
6
- import '@zama-fhe/relayer-sdk/node';
7
6
 
8
7
  type RelayerInstance = Awaited<ReturnType<typeof createInstance>>;
9
8
  type RelayerSigner = {
@@ -36,19 +35,6 @@ declare function publicDecrypt(relayer: RelayerInstance, handles: string[]): Pro
36
35
  decryptionProof: string;
37
36
  }>;
38
37
 
39
- type ViewConfidentialBalanceOptions = {
40
- rpcUrl: string;
41
- tokenAddress: `0x${string}`;
42
- account?: `0x${string}`;
43
- relayer: RelayerInstance;
44
- signer?: RelayerSigner;
45
- decrypt?: boolean;
46
- };
47
- declare function viewConfidentialBalance(options: ViewConfidentialBalanceOptions): Promise<{
48
- handle: `0x${string}`;
49
- balance?: bigint;
50
- }>;
51
-
52
38
  type ConfidentialTransferAmount = {
53
39
  holder: `0x${string}`;
54
40
  payee: `0x${string}`;
@@ -70,13 +56,25 @@ type ViewConfidentialTransferOptions = {
70
56
  };
71
57
  declare function viewConfidentialTransferAmounts(options: ViewConfidentialTransferOptions): Promise<ConfidentialTransferAmount[]>;
72
58
 
73
- type SetObserverWebOptions = {
59
+ type ConfidentialTokenWebConfig = {
60
+ rpcUrl: string;
74
61
  tokenAddress: `0x${string}`;
75
- account: `0x${string}`;
76
- observer: `0x${string}`;
77
- signer?: `0x${string}`;
62
+ relayer: RelayerInstance;
78
63
  walletClient: WalletClient;
64
+ signer?: RelayerSigner;
79
65
  };
80
- declare function setObserverWeb(options: SetObserverWebOptions): Promise<`0x${string}`>;
66
+ declare class ConfidentialTokenWeb {
67
+ private readonly rpcUrl;
68
+ private readonly tokenAddress;
69
+ private readonly relayer;
70
+ private readonly walletClient;
71
+ private readonly signer?;
72
+ constructor(config: ConfidentialTokenWebConfig);
73
+ balanceOf(account?: `0x${string}`): Promise<bigint>;
74
+ setObserver(account: `0x${string}`, observer: `0x${string}`): Promise<`0x${string}`>;
75
+ transfer(to: `0x${string}`, amount: number): Promise<`0x${string}`>;
76
+ wrap(to: `0x${string}`, amount: string | number | bigint): Promise<`0x${string}`>;
77
+ unwrap(from: `0x${string}`, to: `0x${string}`, amount: number): Promise<`0x${string}`>;
78
+ }
81
79
 
82
- export { type ConfidentialTransferAmount, type RelayerInstance, type RelayerSigner, type SetObserverWebOptions, type ViewConfidentialBalanceOptions, type ViewConfidentialTransferOptions, createEncryptedAmountInput, createRelayerInstance, publicDecrypt, setObserverWeb, userDecryptEuint64, viewConfidentialBalance, viewConfidentialTransferAmounts };
80
+ export { ConfidentialTokenWeb, type ConfidentialTokenWebConfig, type ConfidentialTransferAmount, type RelayerInstance, type RelayerSigner, type ViewConfidentialTransferOptions, ConfidentialTokenWeb as confidentialToken, createEncryptedAmountInput, createRelayerInstance, publicDecrypt, userDecryptEuint64, viewConfidentialTransferAmounts };
package/dist/web.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- export { C as ConfidentialErrorCode, i as ConfidentialPaymentAuthorization, l as ConfidentialPaymentInput, j as ConfidentialPaymentPayload, k as ConfidentialRequirementsExtra, S as SetObserverOptions, d as confidentialErrorCodes, b as confidentialPaymentTypes, c as confidentialTokenAbi, e as createNonce, h as hashEncryptedAmountInput, n as normalizeAmount, s as setObserver } from './types-Cy4f8wJ6.js';
2
- import { createInstance } from '@zama-fhe/relayer-sdk/bundle';
3
- export { SepoliaConfig, initSDK } from '@zama-fhe/relayer-sdk/bundle';
1
+ export { C as ConfidentialErrorCode, e as ConfidentialPaymentAuthorization, i as ConfidentialPaymentInput, f as ConfidentialPaymentPayload, g as ConfidentialRequirementsExtra, b as confidentialErrorCodes, a as confidentialPaymentTypes, c as confidentialTokenAbi, d as createNonce, h as hashEncryptedAmountInput, n as normalizeAmount } from './types-I3K7qzdc.js';
2
+ import { createInstance } from '@zama-fhe/relayer-sdk/web';
3
+ export { SepoliaConfig, initSDK } from '@zama-fhe/relayer-sdk/web';
4
4
  import { WalletClient } from 'viem';
5
5
  export * from '@x402/core/types';
6
- import '@zama-fhe/relayer-sdk/node';
7
6
 
8
7
  type RelayerInstance = Awaited<ReturnType<typeof createInstance>>;
9
8
  type RelayerSigner = {
@@ -36,19 +35,6 @@ declare function publicDecrypt(relayer: RelayerInstance, handles: string[]): Pro
36
35
  decryptionProof: string;
37
36
  }>;
38
37
 
39
- type ViewConfidentialBalanceOptions = {
40
- rpcUrl: string;
41
- tokenAddress: `0x${string}`;
42
- account?: `0x${string}`;
43
- relayer: RelayerInstance;
44
- signer?: RelayerSigner;
45
- decrypt?: boolean;
46
- };
47
- declare function viewConfidentialBalance(options: ViewConfidentialBalanceOptions): Promise<{
48
- handle: `0x${string}`;
49
- balance?: bigint;
50
- }>;
51
-
52
38
  type ConfidentialTransferAmount = {
53
39
  holder: `0x${string}`;
54
40
  payee: `0x${string}`;
@@ -70,13 +56,25 @@ type ViewConfidentialTransferOptions = {
70
56
  };
71
57
  declare function viewConfidentialTransferAmounts(options: ViewConfidentialTransferOptions): Promise<ConfidentialTransferAmount[]>;
72
58
 
73
- type SetObserverWebOptions = {
59
+ type ConfidentialTokenWebConfig = {
60
+ rpcUrl: string;
74
61
  tokenAddress: `0x${string}`;
75
- account: `0x${string}`;
76
- observer: `0x${string}`;
77
- signer?: `0x${string}`;
62
+ relayer: RelayerInstance;
78
63
  walletClient: WalletClient;
64
+ signer?: RelayerSigner;
79
65
  };
80
- declare function setObserverWeb(options: SetObserverWebOptions): Promise<`0x${string}`>;
66
+ declare class ConfidentialTokenWeb {
67
+ private readonly rpcUrl;
68
+ private readonly tokenAddress;
69
+ private readonly relayer;
70
+ private readonly walletClient;
71
+ private readonly signer?;
72
+ constructor(config: ConfidentialTokenWebConfig);
73
+ balanceOf(account?: `0x${string}`): Promise<bigint>;
74
+ setObserver(account: `0x${string}`, observer: `0x${string}`): Promise<`0x${string}`>;
75
+ transfer(to: `0x${string}`, amount: number): Promise<`0x${string}`>;
76
+ wrap(to: `0x${string}`, amount: string | number | bigint): Promise<`0x${string}`>;
77
+ unwrap(from: `0x${string}`, to: `0x${string}`, amount: number): Promise<`0x${string}`>;
78
+ }
81
79
 
82
- export { type ConfidentialTransferAmount, type RelayerInstance, type RelayerSigner, type SetObserverWebOptions, type ViewConfidentialBalanceOptions, type ViewConfidentialTransferOptions, createEncryptedAmountInput, createRelayerInstance, publicDecrypt, setObserverWeb, userDecryptEuint64, viewConfidentialBalance, viewConfidentialTransferAmounts };
80
+ export { ConfidentialTokenWeb, type ConfidentialTokenWebConfig, type ConfidentialTransferAmount, type RelayerInstance, type RelayerSigner, type ViewConfidentialTransferOptions, ConfidentialTokenWeb as confidentialToken, createEncryptedAmountInput, createRelayerInstance, publicDecrypt, userDecryptEuint64, viewConfidentialTransferAmounts };