@varity-labs/types 2.0.0-alpha.1
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/LICENSE +31 -0
- package/README.md +328 -0
- package/dist/api.d.ts +219 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +6 -0
- package/dist/auth.d.ts +457 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +222 -0
- package/dist/common.d.ts +130 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +47 -0
- package/dist/gcs-compatible.d.ts +500 -0
- package/dist/gcs-compatible.d.ts.map +1 -0
- package/dist/gcs-compatible.js +51 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/migration.d.ts +532 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/migration.js +90 -0
- package/dist/s3-compatible.d.ts +473 -0
- package/dist/s3-compatible.d.ts.map +1 -0
- package/dist/s3-compatible.js +63 -0
- package/dist/storage.d.ts +600 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +75 -0
- package/dist/thirdweb.d.ts +1182 -0
- package/dist/thirdweb.d.ts.map +1 -0
- package/dist/thirdweb.js +91 -0
- package/package.json +43 -0
|
@@ -0,0 +1,1182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thirdweb Type Definitions for Varity L3 Arbitrum Rollup
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive type definitions for Thirdweb SDK integration
|
|
5
|
+
* with the Varity L3 testnet (Chain ID: 33529).
|
|
6
|
+
*
|
|
7
|
+
* CRITICAL: Varity L3 uses USDC as the native gas token with 6 decimals.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export type { ThirdwebClient, Chain, PreparedTransaction, ThirdwebContract, PrepareContractCallOptions, ReadContractOptions, Hex, Address } from 'thirdweb';
|
|
12
|
+
/**
|
|
13
|
+
* Varity L3 Chain Configuration
|
|
14
|
+
*
|
|
15
|
+
* Defines the complete chain configuration for Varity L3 Testnet.
|
|
16
|
+
*
|
|
17
|
+
* CRITICAL: Native currency is USDC with 6 decimals, NOT 18!
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const varityChain: VarityChain = {
|
|
22
|
+
* id: 33529,
|
|
23
|
+
* name: "Varity Testnet",
|
|
24
|
+
* nativeCurrency: {
|
|
25
|
+
* name: "USDC",
|
|
26
|
+
* symbol: "USDC",
|
|
27
|
+
* decimals: 6 // CRITICAL: 6 decimals, not 18!
|
|
28
|
+
* },
|
|
29
|
+
* rpc: "https://varity-testnet-rpc.conduit.xyz",
|
|
30
|
+
* blockExplorer: "https://varity-testnet-explorer.conduit.xyz",
|
|
31
|
+
* testnet: true
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface VarityChain {
|
|
36
|
+
/**
|
|
37
|
+
* Chain ID for Varity L3 Testnet
|
|
38
|
+
* @constant 33529
|
|
39
|
+
*/
|
|
40
|
+
id: number;
|
|
41
|
+
/**
|
|
42
|
+
* Human-readable chain name
|
|
43
|
+
* @example "Varity Testnet"
|
|
44
|
+
*/
|
|
45
|
+
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* Native currency configuration
|
|
48
|
+
* CRITICAL: USDC with 6 decimals
|
|
49
|
+
*/
|
|
50
|
+
nativeCurrency: {
|
|
51
|
+
/**
|
|
52
|
+
* Full name of the native currency
|
|
53
|
+
* @constant "USDC"
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Currency symbol
|
|
58
|
+
* @constant "USDC"
|
|
59
|
+
*/
|
|
60
|
+
symbol: string;
|
|
61
|
+
/**
|
|
62
|
+
* Number of decimal places
|
|
63
|
+
* CRITICAL: USDC uses 6 decimals, NOT 18 like ETH!
|
|
64
|
+
* @constant 6
|
|
65
|
+
*/
|
|
66
|
+
decimals: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* RPC endpoint URL
|
|
70
|
+
* @example "https://varity-testnet-rpc.conduit.xyz"
|
|
71
|
+
*/
|
|
72
|
+
rpc: string;
|
|
73
|
+
/**
|
|
74
|
+
* Block explorer URL (optional)
|
|
75
|
+
* @example "https://varity-testnet-explorer.conduit.xyz"
|
|
76
|
+
*/
|
|
77
|
+
blockExplorer?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this is a testnet or mainnet
|
|
80
|
+
* @constant true for Varity L3 Testnet
|
|
81
|
+
*/
|
|
82
|
+
testnet: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Varity Chain Constants
|
|
86
|
+
*
|
|
87
|
+
* Pre-configured chain settings for Varity L3 Testnet.
|
|
88
|
+
*/
|
|
89
|
+
export interface VarityChainConstants {
|
|
90
|
+
/**
|
|
91
|
+
* Chain ID
|
|
92
|
+
* @constant 33529
|
|
93
|
+
*/
|
|
94
|
+
readonly CHAIN_ID: 33529;
|
|
95
|
+
/**
|
|
96
|
+
* Native currency symbol
|
|
97
|
+
* @constant "USDC"
|
|
98
|
+
*/
|
|
99
|
+
readonly NATIVE_CURRENCY_SYMBOL: 'USDC';
|
|
100
|
+
/**
|
|
101
|
+
* Native currency decimals
|
|
102
|
+
* CRITICAL: 6 decimals for USDC
|
|
103
|
+
* @constant 6
|
|
104
|
+
*/
|
|
105
|
+
readonly NATIVE_CURRENCY_DECIMALS: 6;
|
|
106
|
+
/**
|
|
107
|
+
* Testnet flag
|
|
108
|
+
* @constant true
|
|
109
|
+
*/
|
|
110
|
+
readonly IS_TESTNET: true;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Varity Wallet Configuration
|
|
114
|
+
*
|
|
115
|
+
* Configuration options for initializing a Thirdweb wallet on Varity L3.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const walletConfig: VarityWalletConfig = {
|
|
120
|
+
* clientId: "your-thirdweb-client-id",
|
|
121
|
+
* chain: varityChain,
|
|
122
|
+
* privateKey: "0x...", // optional for server-side wallets
|
|
123
|
+
* smartWalletOptions: {
|
|
124
|
+
* factoryAddress: "0x...",
|
|
125
|
+
* gasless: true
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export interface VarityWalletConfig {
|
|
131
|
+
/**
|
|
132
|
+
* Thirdweb client ID for API authentication
|
|
133
|
+
*/
|
|
134
|
+
clientId: string;
|
|
135
|
+
/**
|
|
136
|
+
* Varity L3 chain configuration
|
|
137
|
+
*/
|
|
138
|
+
chain: VarityChain;
|
|
139
|
+
/**
|
|
140
|
+
* Private key for wallet creation (optional, server-side only)
|
|
141
|
+
* SECURITY: Never expose private keys in client-side code!
|
|
142
|
+
*/
|
|
143
|
+
privateKey?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Smart wallet (Account Abstraction) configuration (optional)
|
|
146
|
+
*/
|
|
147
|
+
smartWalletOptions?: VaritySmartWalletOptions;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Varity Smart Wallet Options
|
|
151
|
+
*
|
|
152
|
+
* Configuration for Account Abstraction (AA) smart wallets on Varity L3.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const smartWalletOptions: VaritySmartWalletOptions = {
|
|
157
|
+
* factoryAddress: "0x1234567890123456789012345678901234567890",
|
|
158
|
+
* gasless: true,
|
|
159
|
+
* bundlerUrl: "https://varity-bundler.example.com",
|
|
160
|
+
* paymasterUrl: "https://varity-paymaster.example.com"
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export interface VaritySmartWalletOptions {
|
|
165
|
+
/**
|
|
166
|
+
* Smart wallet factory contract address (optional)
|
|
167
|
+
* If not provided, uses Thirdweb's default factory
|
|
168
|
+
*/
|
|
169
|
+
factoryAddress?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Enable gasless transactions (sponsor gas fees)
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
gasless: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Custom bundler URL for UserOperation submission (optional)
|
|
177
|
+
*/
|
|
178
|
+
bundlerUrl?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Custom paymaster URL for gas sponsorship (optional)
|
|
181
|
+
*/
|
|
182
|
+
paymasterUrl?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Account abstraction version
|
|
185
|
+
* @default "v0.7"
|
|
186
|
+
*/
|
|
187
|
+
version?: 'v0.6' | 'v0.7';
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Varity Wallet Connection Result
|
|
191
|
+
*
|
|
192
|
+
* Result returned after successfully connecting a wallet to Varity L3.
|
|
193
|
+
*/
|
|
194
|
+
export interface VarityWalletConnectionResult {
|
|
195
|
+
/**
|
|
196
|
+
* Connected wallet address
|
|
197
|
+
*/
|
|
198
|
+
address: string;
|
|
199
|
+
/**
|
|
200
|
+
* Chain ID the wallet is connected to
|
|
201
|
+
* @constant 33529
|
|
202
|
+
*/
|
|
203
|
+
chainId: number;
|
|
204
|
+
/**
|
|
205
|
+
* Whether this is a smart wallet
|
|
206
|
+
*/
|
|
207
|
+
isSmartWallet: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Smart wallet factory address (if applicable)
|
|
210
|
+
*/
|
|
211
|
+
factoryAddress?: string;
|
|
212
|
+
/**
|
|
213
|
+
* Current USDC balance (in smallest units, 6 decimals)
|
|
214
|
+
* @example 1000000 = 1 USDC
|
|
215
|
+
*/
|
|
216
|
+
balance?: bigint;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Varity Contract Configuration
|
|
220
|
+
*
|
|
221
|
+
* Configuration for interacting with deployed contracts on Varity L3.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const contractConfig: VarityContractConfig = {
|
|
226
|
+
* address: "0x1234567890123456789012345678901234567890",
|
|
227
|
+
* abi: ERC20_ABI,
|
|
228
|
+
* chainId: 33529
|
|
229
|
+
* }
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
export interface VarityContractConfig {
|
|
233
|
+
/**
|
|
234
|
+
* Deployed contract address
|
|
235
|
+
*/
|
|
236
|
+
address: string;
|
|
237
|
+
/**
|
|
238
|
+
* Contract ABI (Application Binary Interface)
|
|
239
|
+
*/
|
|
240
|
+
abi: any;
|
|
241
|
+
/**
|
|
242
|
+
* Chain ID where contract is deployed
|
|
243
|
+
* @constant 33529 for Varity L3 Testnet
|
|
244
|
+
*/
|
|
245
|
+
chainId: number;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Contract Deployment Parameters
|
|
249
|
+
*
|
|
250
|
+
* Parameters for deploying new contracts to Varity L3.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const deployParams: VarityDeploymentParams = {
|
|
255
|
+
* contractType: 'ERC20',
|
|
256
|
+
* name: 'MyToken',
|
|
257
|
+
* symbol: 'MTK',
|
|
258
|
+
* constructorParams: [1000000]
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
export interface VarityDeploymentParams {
|
|
263
|
+
/**
|
|
264
|
+
* Type of contract to deploy
|
|
265
|
+
*/
|
|
266
|
+
contractType: 'ERC20' | 'ERC721' | 'ERC1155' | 'Custom';
|
|
267
|
+
/**
|
|
268
|
+
* Contract name (for token contracts)
|
|
269
|
+
*/
|
|
270
|
+
name?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Contract symbol (for token contracts)
|
|
273
|
+
*/
|
|
274
|
+
symbol?: string;
|
|
275
|
+
/**
|
|
276
|
+
* Contract ABI (for custom contracts)
|
|
277
|
+
*/
|
|
278
|
+
abi?: any;
|
|
279
|
+
/**
|
|
280
|
+
* Contract bytecode (for custom contracts)
|
|
281
|
+
*/
|
|
282
|
+
bytecode?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Constructor parameters
|
|
285
|
+
*/
|
|
286
|
+
constructorParams?: any[];
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Contract Deployment Result
|
|
290
|
+
*
|
|
291
|
+
* Result returned after successful contract deployment.
|
|
292
|
+
*/
|
|
293
|
+
export interface VarityDeploymentResult {
|
|
294
|
+
/**
|
|
295
|
+
* Deployed contract address
|
|
296
|
+
*/
|
|
297
|
+
contractAddress: string;
|
|
298
|
+
/**
|
|
299
|
+
* Transaction hash of deployment
|
|
300
|
+
*/
|
|
301
|
+
transactionHash: string;
|
|
302
|
+
/**
|
|
303
|
+
* Block number where contract was deployed
|
|
304
|
+
*/
|
|
305
|
+
blockNumber: number;
|
|
306
|
+
/**
|
|
307
|
+
* Gas used for deployment (in USDC with 6 decimals)
|
|
308
|
+
*/
|
|
309
|
+
gasUsed: bigint;
|
|
310
|
+
/**
|
|
311
|
+
* Total deployment cost (in USDC with 6 decimals)
|
|
312
|
+
*/
|
|
313
|
+
totalCost: bigint;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Contract Read Options
|
|
317
|
+
*
|
|
318
|
+
* Options for reading contract state.
|
|
319
|
+
*/
|
|
320
|
+
export interface VarityContractReadOptions {
|
|
321
|
+
/**
|
|
322
|
+
* Contract configuration
|
|
323
|
+
*/
|
|
324
|
+
contract: VarityContractConfig;
|
|
325
|
+
/**
|
|
326
|
+
* Function name to call
|
|
327
|
+
*/
|
|
328
|
+
method: string;
|
|
329
|
+
/**
|
|
330
|
+
* Function parameters
|
|
331
|
+
*/
|
|
332
|
+
params?: any[];
|
|
333
|
+
/**
|
|
334
|
+
* Block number to query (optional, defaults to latest)
|
|
335
|
+
*/
|
|
336
|
+
blockNumber?: number;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Contract Write Options
|
|
340
|
+
*
|
|
341
|
+
* Options for writing to contract state.
|
|
342
|
+
*/
|
|
343
|
+
export interface VarityContractWriteOptions {
|
|
344
|
+
/**
|
|
345
|
+
* Contract configuration
|
|
346
|
+
*/
|
|
347
|
+
contract: VarityContractConfig;
|
|
348
|
+
/**
|
|
349
|
+
* Function name to call
|
|
350
|
+
*/
|
|
351
|
+
method: string;
|
|
352
|
+
/**
|
|
353
|
+
* Function parameters
|
|
354
|
+
*/
|
|
355
|
+
params?: any[];
|
|
356
|
+
/**
|
|
357
|
+
* USDC amount to send with transaction (6 decimals)
|
|
358
|
+
*/
|
|
359
|
+
value?: bigint;
|
|
360
|
+
/**
|
|
361
|
+
* Gas limit override
|
|
362
|
+
*/
|
|
363
|
+
gasLimit?: bigint;
|
|
364
|
+
/**
|
|
365
|
+
* Enable gasless transaction (if smart wallet)
|
|
366
|
+
*/
|
|
367
|
+
gasless?: boolean;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* SIWE Message Configuration
|
|
371
|
+
*
|
|
372
|
+
* Configuration for generating Sign-In With Ethereum (SIWE) messages.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const siweMessage: SIWEMessage = {
|
|
377
|
+
* address: "0x1234567890123456789012345678901234567890",
|
|
378
|
+
* chainId: 33529,
|
|
379
|
+
* domain: "app.varity.io",
|
|
380
|
+
* uri: "https://app.varity.io",
|
|
381
|
+
* nonce: "random-nonce-123",
|
|
382
|
+
* issuedAt: new Date().toISOString(),
|
|
383
|
+
* expirationTime: new Date(Date.now() + 3600000).toISOString()
|
|
384
|
+
* }
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
export interface SIWEMessage {
|
|
388
|
+
/**
|
|
389
|
+
* Wallet address signing the message
|
|
390
|
+
*/
|
|
391
|
+
address: string;
|
|
392
|
+
/**
|
|
393
|
+
* Chain ID
|
|
394
|
+
* @constant 33529 for Varity L3
|
|
395
|
+
*/
|
|
396
|
+
chainId: number;
|
|
397
|
+
/**
|
|
398
|
+
* Domain requesting the signature
|
|
399
|
+
* @example "app.varity.io"
|
|
400
|
+
*/
|
|
401
|
+
domain: string;
|
|
402
|
+
/**
|
|
403
|
+
* URI of the application
|
|
404
|
+
* @example "https://app.varity.io"
|
|
405
|
+
*/
|
|
406
|
+
uri: string;
|
|
407
|
+
/**
|
|
408
|
+
* Random nonce for security
|
|
409
|
+
*/
|
|
410
|
+
nonce: string;
|
|
411
|
+
/**
|
|
412
|
+
* Timestamp when message was issued (ISO 8601)
|
|
413
|
+
*/
|
|
414
|
+
issuedAt: string;
|
|
415
|
+
/**
|
|
416
|
+
* Timestamp when message expires (optional, ISO 8601)
|
|
417
|
+
*/
|
|
418
|
+
expirationTime?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Timestamp when message becomes valid (optional, ISO 8601)
|
|
421
|
+
*/
|
|
422
|
+
notBefore?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Human-readable statement (optional)
|
|
425
|
+
*/
|
|
426
|
+
statement?: string;
|
|
427
|
+
/**
|
|
428
|
+
* Request ID (optional)
|
|
429
|
+
*/
|
|
430
|
+
requestId?: string;
|
|
431
|
+
/**
|
|
432
|
+
* Resources the user is authorizing (optional)
|
|
433
|
+
*/
|
|
434
|
+
resources?: string[];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* SIWE Verification Result
|
|
438
|
+
*
|
|
439
|
+
* Result of verifying a SIWE signature.
|
|
440
|
+
*/
|
|
441
|
+
export interface SIWEVerifyResult {
|
|
442
|
+
/**
|
|
443
|
+
* Whether the signature is valid
|
|
444
|
+
*/
|
|
445
|
+
valid: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Verified wallet address (if valid)
|
|
448
|
+
*/
|
|
449
|
+
address?: string;
|
|
450
|
+
/**
|
|
451
|
+
* Error message (if invalid)
|
|
452
|
+
*/
|
|
453
|
+
error?: string;
|
|
454
|
+
/**
|
|
455
|
+
* Verified chain ID (if valid)
|
|
456
|
+
*/
|
|
457
|
+
chainId?: number;
|
|
458
|
+
/**
|
|
459
|
+
* Expiration timestamp (if valid)
|
|
460
|
+
*/
|
|
461
|
+
expiresAt?: string;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* SIWE Authentication Payload
|
|
465
|
+
*
|
|
466
|
+
* Complete payload for SIWE authentication.
|
|
467
|
+
*/
|
|
468
|
+
export interface SIWEAuthPayload {
|
|
469
|
+
/**
|
|
470
|
+
* SIWE message
|
|
471
|
+
*/
|
|
472
|
+
message: SIWEMessage;
|
|
473
|
+
/**
|
|
474
|
+
* Signature from wallet
|
|
475
|
+
*/
|
|
476
|
+
signature: string;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Gas Estimation Result
|
|
480
|
+
*
|
|
481
|
+
* Result of estimating gas for a transaction on Varity L3.
|
|
482
|
+
*
|
|
483
|
+
* CRITICAL: All values are in USDC with 6 decimals.
|
|
484
|
+
*/
|
|
485
|
+
export interface VarityGasEstimation {
|
|
486
|
+
/**
|
|
487
|
+
* Estimated gas units
|
|
488
|
+
*/
|
|
489
|
+
gasLimit: bigint;
|
|
490
|
+
/**
|
|
491
|
+
* Gas price in USDC per gas unit (6 decimals)
|
|
492
|
+
*/
|
|
493
|
+
gasPrice: bigint;
|
|
494
|
+
/**
|
|
495
|
+
* Maximum fee per gas (EIP-1559, 6 decimals)
|
|
496
|
+
*/
|
|
497
|
+
maxFeePerGas?: bigint;
|
|
498
|
+
/**
|
|
499
|
+
* Maximum priority fee per gas (EIP-1559, 6 decimals)
|
|
500
|
+
*/
|
|
501
|
+
maxPriorityFeePerGas?: bigint;
|
|
502
|
+
/**
|
|
503
|
+
* Estimated total cost in USDC (6 decimals)
|
|
504
|
+
* @example 1000000 = 1 USDC
|
|
505
|
+
*/
|
|
506
|
+
estimatedCost: bigint;
|
|
507
|
+
/**
|
|
508
|
+
* Estimated cost in human-readable format
|
|
509
|
+
* @example "0.50 USDC"
|
|
510
|
+
*/
|
|
511
|
+
estimatedCostFormatted: string;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Transaction Fee Options
|
|
515
|
+
*
|
|
516
|
+
* Options for customizing transaction fees.
|
|
517
|
+
*/
|
|
518
|
+
export interface VarityTransactionFeeOptions {
|
|
519
|
+
/**
|
|
520
|
+
* Gas limit override
|
|
521
|
+
*/
|
|
522
|
+
gasLimit?: bigint;
|
|
523
|
+
/**
|
|
524
|
+
* Gas price override (legacy transactions)
|
|
525
|
+
*/
|
|
526
|
+
gasPrice?: bigint;
|
|
527
|
+
/**
|
|
528
|
+
* Max fee per gas (EIP-1559)
|
|
529
|
+
*/
|
|
530
|
+
maxFeePerGas?: bigint;
|
|
531
|
+
/**
|
|
532
|
+
* Max priority fee per gas (EIP-1559)
|
|
533
|
+
*/
|
|
534
|
+
maxPriorityFeePerGas?: bigint;
|
|
535
|
+
/**
|
|
536
|
+
* Fee multiplier (1.0 = normal, 1.5 = 50% higher)
|
|
537
|
+
* @default 1.0
|
|
538
|
+
*/
|
|
539
|
+
feeMultiplier?: number;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Contract Event Filter
|
|
543
|
+
*
|
|
544
|
+
* Configuration for filtering contract events.
|
|
545
|
+
*/
|
|
546
|
+
export interface VarityEventFilter {
|
|
547
|
+
/**
|
|
548
|
+
* Contract address
|
|
549
|
+
*/
|
|
550
|
+
contractAddress: string;
|
|
551
|
+
/**
|
|
552
|
+
* Event name
|
|
553
|
+
*/
|
|
554
|
+
eventName: string;
|
|
555
|
+
/**
|
|
556
|
+
* Event parameters to filter by (optional)
|
|
557
|
+
*/
|
|
558
|
+
filters?: Record<string, any>;
|
|
559
|
+
/**
|
|
560
|
+
* Starting block number (optional)
|
|
561
|
+
*/
|
|
562
|
+
fromBlock?: number;
|
|
563
|
+
/**
|
|
564
|
+
* Ending block number (optional)
|
|
565
|
+
*/
|
|
566
|
+
toBlock?: number | 'latest';
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Contract Event
|
|
570
|
+
*
|
|
571
|
+
* Decoded contract event data.
|
|
572
|
+
*/
|
|
573
|
+
export interface VarityContractEvent {
|
|
574
|
+
/**
|
|
575
|
+
* Event name
|
|
576
|
+
*/
|
|
577
|
+
eventName: string;
|
|
578
|
+
/**
|
|
579
|
+
* Block number where event was emitted
|
|
580
|
+
*/
|
|
581
|
+
blockNumber: number;
|
|
582
|
+
/**
|
|
583
|
+
* Transaction hash
|
|
584
|
+
*/
|
|
585
|
+
transactionHash: string;
|
|
586
|
+
/**
|
|
587
|
+
* Log index
|
|
588
|
+
*/
|
|
589
|
+
logIndex: number;
|
|
590
|
+
/**
|
|
591
|
+
* Decoded event arguments
|
|
592
|
+
*/
|
|
593
|
+
args: Record<string, any>;
|
|
594
|
+
/**
|
|
595
|
+
* Raw log data
|
|
596
|
+
*/
|
|
597
|
+
raw: {
|
|
598
|
+
data: string;
|
|
599
|
+
topics: string[];
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Thirdweb-Ethers Hybrid Configuration
|
|
604
|
+
*
|
|
605
|
+
* Configuration for using Thirdweb SDK with optional ethers.js fallback.
|
|
606
|
+
* This pattern allows gradual migration from ethers.js to Thirdweb.
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
* ```typescript
|
|
610
|
+
* const hybridConfig: ThirdwebEthersHybrid = {
|
|
611
|
+
* useThirdweb: true,
|
|
612
|
+
* useFallback: true,
|
|
613
|
+
* preferredMethod: 'thirdweb'
|
|
614
|
+
* }
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
export interface ThirdwebEthersHybrid {
|
|
618
|
+
/**
|
|
619
|
+
* Enable Thirdweb SDK methods
|
|
620
|
+
* @default true
|
|
621
|
+
*/
|
|
622
|
+
useThirdweb: boolean;
|
|
623
|
+
/**
|
|
624
|
+
* Enable ethers.js fallback for unsupported operations
|
|
625
|
+
* @default false
|
|
626
|
+
*/
|
|
627
|
+
useFallback: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Preferred method when both are available
|
|
630
|
+
* @default 'thirdweb'
|
|
631
|
+
*/
|
|
632
|
+
preferredMethod: 'thirdweb' | 'ethers';
|
|
633
|
+
/**
|
|
634
|
+
* Ethers provider URL (optional, required if useFallback is true)
|
|
635
|
+
*/
|
|
636
|
+
ethersRpcUrl?: string;
|
|
637
|
+
/**
|
|
638
|
+
* Logging configuration for wrapper operations
|
|
639
|
+
*/
|
|
640
|
+
logging?: {
|
|
641
|
+
/**
|
|
642
|
+
* Enable debug logging
|
|
643
|
+
* @default false
|
|
644
|
+
*/
|
|
645
|
+
enabled: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Log method selections (which SDK is used)
|
|
648
|
+
* @default true
|
|
649
|
+
*/
|
|
650
|
+
logMethodSelection: boolean;
|
|
651
|
+
/**
|
|
652
|
+
* Log performance metrics
|
|
653
|
+
* @default false
|
|
654
|
+
*/
|
|
655
|
+
logPerformance: boolean;
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Wrapper SDK Configuration
|
|
660
|
+
*
|
|
661
|
+
* Complete configuration for Varity SDK wrapper that supports both
|
|
662
|
+
* Thirdweb and ethers.js operations.
|
|
663
|
+
*/
|
|
664
|
+
export interface ThirdwebWrapperConfig {
|
|
665
|
+
/**
|
|
666
|
+
* Thirdweb client configuration
|
|
667
|
+
*/
|
|
668
|
+
thirdwebClient: {
|
|
669
|
+
/**
|
|
670
|
+
* Thirdweb client ID
|
|
671
|
+
*/
|
|
672
|
+
clientId: string;
|
|
673
|
+
/**
|
|
674
|
+
* Secret key for server-side operations (optional)
|
|
675
|
+
*/
|
|
676
|
+
secretKey?: string;
|
|
677
|
+
/**
|
|
678
|
+
* Custom chain configuration
|
|
679
|
+
*/
|
|
680
|
+
chain: VarityChain;
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* Hybrid mode configuration
|
|
684
|
+
*/
|
|
685
|
+
hybridMode: ThirdwebEthersHybrid;
|
|
686
|
+
/**
|
|
687
|
+
* Account abstraction configuration (optional)
|
|
688
|
+
*/
|
|
689
|
+
accountAbstraction?: {
|
|
690
|
+
/**
|
|
691
|
+
* Enable smart wallet functionality
|
|
692
|
+
*/
|
|
693
|
+
enabled: boolean;
|
|
694
|
+
/**
|
|
695
|
+
* Smart wallet configuration
|
|
696
|
+
*/
|
|
697
|
+
options: VaritySmartWalletOptions;
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* Storage configuration for IPFS/decentralized storage
|
|
701
|
+
*/
|
|
702
|
+
storage?: {
|
|
703
|
+
/**
|
|
704
|
+
* IPFS gateway URL
|
|
705
|
+
* @example "https://gateway.pinata.cloud"
|
|
706
|
+
*/
|
|
707
|
+
gatewayUrl?: string;
|
|
708
|
+
/**
|
|
709
|
+
* Upload provider
|
|
710
|
+
* @default 'thirdweb'
|
|
711
|
+
*/
|
|
712
|
+
provider?: 'thirdweb' | 'pinata' | 'custom';
|
|
713
|
+
/**
|
|
714
|
+
* Custom upload endpoint (for 'custom' provider)
|
|
715
|
+
*/
|
|
716
|
+
customEndpoint?: string;
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Contract Deployment API Response
|
|
721
|
+
*
|
|
722
|
+
* Response from contract deployment API endpoint.
|
|
723
|
+
*/
|
|
724
|
+
export interface ContractDeployResponse {
|
|
725
|
+
/**
|
|
726
|
+
* Whether deployment was successful
|
|
727
|
+
*/
|
|
728
|
+
success: boolean;
|
|
729
|
+
/**
|
|
730
|
+
* Deployment result data (if successful)
|
|
731
|
+
*/
|
|
732
|
+
data?: VarityDeploymentResult;
|
|
733
|
+
/**
|
|
734
|
+
* Error details (if failed)
|
|
735
|
+
*/
|
|
736
|
+
error?: {
|
|
737
|
+
/**
|
|
738
|
+
* Error code
|
|
739
|
+
*/
|
|
740
|
+
code: string;
|
|
741
|
+
/**
|
|
742
|
+
* Human-readable error message
|
|
743
|
+
*/
|
|
744
|
+
message: string;
|
|
745
|
+
/**
|
|
746
|
+
* Technical error details
|
|
747
|
+
*/
|
|
748
|
+
details?: any;
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* Response timestamp
|
|
752
|
+
*/
|
|
753
|
+
timestamp: string;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Contract Call API Response
|
|
757
|
+
*
|
|
758
|
+
* Response from contract read/write operation API endpoint.
|
|
759
|
+
*/
|
|
760
|
+
export interface ContractCallResponse<T = any> {
|
|
761
|
+
/**
|
|
762
|
+
* Whether call was successful
|
|
763
|
+
*/
|
|
764
|
+
success: boolean;
|
|
765
|
+
/**
|
|
766
|
+
* Returned data from contract (if read operation)
|
|
767
|
+
*/
|
|
768
|
+
data?: T;
|
|
769
|
+
/**
|
|
770
|
+
* Transaction hash (if write operation)
|
|
771
|
+
*/
|
|
772
|
+
transactionHash?: string;
|
|
773
|
+
/**
|
|
774
|
+
* Transaction receipt (if write operation)
|
|
775
|
+
*/
|
|
776
|
+
receipt?: {
|
|
777
|
+
/**
|
|
778
|
+
* Block number
|
|
779
|
+
*/
|
|
780
|
+
blockNumber: number;
|
|
781
|
+
/**
|
|
782
|
+
* Gas used (USDC, 6 decimals)
|
|
783
|
+
*/
|
|
784
|
+
gasUsed: bigint;
|
|
785
|
+
/**
|
|
786
|
+
* Transaction status
|
|
787
|
+
*/
|
|
788
|
+
status: 'success' | 'reverted';
|
|
789
|
+
/**
|
|
790
|
+
* Emitted events
|
|
791
|
+
*/
|
|
792
|
+
events: VarityContractEvent[];
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* Error details (if failed)
|
|
796
|
+
*/
|
|
797
|
+
error?: {
|
|
798
|
+
/**
|
|
799
|
+
* Error code
|
|
800
|
+
*/
|
|
801
|
+
code: string;
|
|
802
|
+
/**
|
|
803
|
+
* Human-readable error message
|
|
804
|
+
*/
|
|
805
|
+
message: string;
|
|
806
|
+
/**
|
|
807
|
+
* Revert reason (if contract reverted)
|
|
808
|
+
*/
|
|
809
|
+
revertReason?: string;
|
|
810
|
+
};
|
|
811
|
+
/**
|
|
812
|
+
* Response timestamp
|
|
813
|
+
*/
|
|
814
|
+
timestamp: string;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* SIWE Authentication API Response
|
|
818
|
+
*
|
|
819
|
+
* Response from Sign-In With Ethereum authentication endpoint.
|
|
820
|
+
*/
|
|
821
|
+
export interface SIWEAuthResponse {
|
|
822
|
+
/**
|
|
823
|
+
* Whether authentication was successful
|
|
824
|
+
*/
|
|
825
|
+
success: boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Authentication result (if successful)
|
|
828
|
+
*/
|
|
829
|
+
data?: {
|
|
830
|
+
/**
|
|
831
|
+
* Verified wallet address
|
|
832
|
+
*/
|
|
833
|
+
address: string;
|
|
834
|
+
/**
|
|
835
|
+
* Session token (JWT)
|
|
836
|
+
*/
|
|
837
|
+
token: string;
|
|
838
|
+
/**
|
|
839
|
+
* Token expiration time (ISO 8601)
|
|
840
|
+
*/
|
|
841
|
+
expiresAt: string;
|
|
842
|
+
/**
|
|
843
|
+
* User profile data (optional)
|
|
844
|
+
*/
|
|
845
|
+
profile?: {
|
|
846
|
+
/**
|
|
847
|
+
* ENS name (if available)
|
|
848
|
+
*/
|
|
849
|
+
ensName?: string;
|
|
850
|
+
/**
|
|
851
|
+
* Avatar URL (if available)
|
|
852
|
+
*/
|
|
853
|
+
avatar?: string;
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
/**
|
|
857
|
+
* Error details (if failed)
|
|
858
|
+
*/
|
|
859
|
+
error?: {
|
|
860
|
+
/**
|
|
861
|
+
* Error code
|
|
862
|
+
*/
|
|
863
|
+
code: string;
|
|
864
|
+
/**
|
|
865
|
+
* Error message
|
|
866
|
+
*/
|
|
867
|
+
message: string;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Response timestamp
|
|
871
|
+
*/
|
|
872
|
+
timestamp: string;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Chain Information API Response
|
|
876
|
+
*
|
|
877
|
+
* Response containing current chain information.
|
|
878
|
+
*/
|
|
879
|
+
export interface ChainInfoResponse {
|
|
880
|
+
/**
|
|
881
|
+
* Chain ID
|
|
882
|
+
*/
|
|
883
|
+
chainId: number;
|
|
884
|
+
/**
|
|
885
|
+
* Chain name
|
|
886
|
+
*/
|
|
887
|
+
name: string;
|
|
888
|
+
/**
|
|
889
|
+
* Native currency information
|
|
890
|
+
*/
|
|
891
|
+
nativeCurrency: {
|
|
892
|
+
name: string;
|
|
893
|
+
symbol: string;
|
|
894
|
+
decimals: number;
|
|
895
|
+
};
|
|
896
|
+
/**
|
|
897
|
+
* Current block number
|
|
898
|
+
*/
|
|
899
|
+
blockNumber: number;
|
|
900
|
+
/**
|
|
901
|
+
* Current gas price (USDC, 6 decimals)
|
|
902
|
+
*/
|
|
903
|
+
gasPrice: bigint;
|
|
904
|
+
/**
|
|
905
|
+
* Network status
|
|
906
|
+
*/
|
|
907
|
+
status: 'healthy' | 'degraded' | 'down';
|
|
908
|
+
/**
|
|
909
|
+
* Response timestamp
|
|
910
|
+
*/
|
|
911
|
+
timestamp: string;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Wallet Balance API Response
|
|
915
|
+
*
|
|
916
|
+
* Response containing wallet balance information.
|
|
917
|
+
*/
|
|
918
|
+
export interface WalletBalanceResponse {
|
|
919
|
+
/**
|
|
920
|
+
* Wallet address
|
|
921
|
+
*/
|
|
922
|
+
address: string;
|
|
923
|
+
/**
|
|
924
|
+
* USDC balance information
|
|
925
|
+
*/
|
|
926
|
+
balance: USDCAmount;
|
|
927
|
+
/**
|
|
928
|
+
* Token balances (optional)
|
|
929
|
+
*/
|
|
930
|
+
tokens?: Array<{
|
|
931
|
+
/**
|
|
932
|
+
* Token contract address
|
|
933
|
+
*/
|
|
934
|
+
address: string;
|
|
935
|
+
/**
|
|
936
|
+
* Token symbol
|
|
937
|
+
*/
|
|
938
|
+
symbol: string;
|
|
939
|
+
/**
|
|
940
|
+
* Token name
|
|
941
|
+
*/
|
|
942
|
+
name: string;
|
|
943
|
+
/**
|
|
944
|
+
* Token balance (raw amount)
|
|
945
|
+
*/
|
|
946
|
+
balance: bigint;
|
|
947
|
+
/**
|
|
948
|
+
* Token decimals
|
|
949
|
+
*/
|
|
950
|
+
decimals: number;
|
|
951
|
+
/**
|
|
952
|
+
* Formatted balance
|
|
953
|
+
*/
|
|
954
|
+
formatted: string;
|
|
955
|
+
}>;
|
|
956
|
+
/**
|
|
957
|
+
* Response timestamp
|
|
958
|
+
*/
|
|
959
|
+
timestamp: string;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Thirdweb Client Configuration
|
|
963
|
+
*
|
|
964
|
+
* Complete configuration for initializing Thirdweb client.
|
|
965
|
+
*
|
|
966
|
+
* @example
|
|
967
|
+
* ```typescript
|
|
968
|
+
* const clientConfig: ThirdwebClientConfig = {
|
|
969
|
+
* clientId: "your-client-id",
|
|
970
|
+
* secretKey: "your-secret-key", // server-side only
|
|
971
|
+
* chains: [varityChain],
|
|
972
|
+
* supportedWallets: ['metamask', 'walletconnect', 'coinbase']
|
|
973
|
+
* }
|
|
974
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
export interface ThirdwebClientConfig {
|
|
977
|
+
/**
|
|
978
|
+
* Thirdweb client ID (required)
|
|
979
|
+
*/
|
|
980
|
+
clientId: string;
|
|
981
|
+
/**
|
|
982
|
+
* Thirdweb secret key (optional, server-side only)
|
|
983
|
+
* SECURITY: Never expose secret key in client-side code!
|
|
984
|
+
*/
|
|
985
|
+
secretKey?: string;
|
|
986
|
+
/**
|
|
987
|
+
* Supported chains
|
|
988
|
+
*/
|
|
989
|
+
chains: VarityChain[];
|
|
990
|
+
/**
|
|
991
|
+
* Supported wallet types
|
|
992
|
+
*/
|
|
993
|
+
supportedWallets?: Array<'metamask' | 'walletconnect' | 'coinbase' | 'injected' | 'smart-wallet' | 'embedded-wallet'>;
|
|
994
|
+
/**
|
|
995
|
+
* Default chain (optional, uses first chain if not specified)
|
|
996
|
+
*/
|
|
997
|
+
defaultChain?: VarityChain;
|
|
998
|
+
/**
|
|
999
|
+
* RPC options
|
|
1000
|
+
*/
|
|
1001
|
+
rpcOptions?: {
|
|
1002
|
+
/**
|
|
1003
|
+
* Request timeout in milliseconds
|
|
1004
|
+
* @default 30000
|
|
1005
|
+
*/
|
|
1006
|
+
timeout?: number;
|
|
1007
|
+
/**
|
|
1008
|
+
* Number of retry attempts
|
|
1009
|
+
* @default 3
|
|
1010
|
+
*/
|
|
1011
|
+
retries?: number;
|
|
1012
|
+
/**
|
|
1013
|
+
* Batch JSON-RPC requests
|
|
1014
|
+
* @default true
|
|
1015
|
+
*/
|
|
1016
|
+
batch?: boolean;
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Thirdweb Auth Configuration
|
|
1021
|
+
*
|
|
1022
|
+
* Configuration for Thirdweb authentication (SIWE).
|
|
1023
|
+
*/
|
|
1024
|
+
export interface ThirdwebAuthConfig {
|
|
1025
|
+
/**
|
|
1026
|
+
* Application domain
|
|
1027
|
+
* @example "app.varity.io"
|
|
1028
|
+
*/
|
|
1029
|
+
domain: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* Application URI
|
|
1032
|
+
* @example "https://app.varity.io"
|
|
1033
|
+
*/
|
|
1034
|
+
uri: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* Session duration in seconds
|
|
1037
|
+
* @default 86400 (24 hours)
|
|
1038
|
+
*/
|
|
1039
|
+
sessionDuration?: number;
|
|
1040
|
+
/**
|
|
1041
|
+
* Enable refresh tokens
|
|
1042
|
+
* @default false
|
|
1043
|
+
*/
|
|
1044
|
+
enableRefreshTokens?: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Custom nonce generator (optional)
|
|
1047
|
+
*/
|
|
1048
|
+
nonceGenerator?: () => string;
|
|
1049
|
+
/**
|
|
1050
|
+
* JWT signing secret (server-side only)
|
|
1051
|
+
*/
|
|
1052
|
+
jwtSecret?: string;
|
|
1053
|
+
/**
|
|
1054
|
+
* Additional SIWE resources
|
|
1055
|
+
*/
|
|
1056
|
+
resources?: string[];
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Thirdweb Storage Configuration
|
|
1060
|
+
*
|
|
1061
|
+
* Configuration for Thirdweb storage (IPFS/decentralized storage).
|
|
1062
|
+
*/
|
|
1063
|
+
export interface ThirdwebStorageConfig {
|
|
1064
|
+
/**
|
|
1065
|
+
* Storage gateway URL
|
|
1066
|
+
* @example "https://gateway.pinata.cloud"
|
|
1067
|
+
*/
|
|
1068
|
+
gatewayUrl: string;
|
|
1069
|
+
/**
|
|
1070
|
+
* Upload provider
|
|
1071
|
+
*/
|
|
1072
|
+
provider: 'thirdweb' | 'pinata' | 'ipfs' | 'custom';
|
|
1073
|
+
/**
|
|
1074
|
+
* Provider-specific credentials
|
|
1075
|
+
*/
|
|
1076
|
+
credentials?: {
|
|
1077
|
+
/**
|
|
1078
|
+
* API key
|
|
1079
|
+
*/
|
|
1080
|
+
apiKey?: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* API secret
|
|
1083
|
+
*/
|
|
1084
|
+
apiSecret?: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* Custom headers
|
|
1087
|
+
*/
|
|
1088
|
+
customHeaders?: Record<string, string>;
|
|
1089
|
+
};
|
|
1090
|
+
/**
|
|
1091
|
+
* Upload options
|
|
1092
|
+
*/
|
|
1093
|
+
uploadOptions?: {
|
|
1094
|
+
/**
|
|
1095
|
+
* Enable pinning on IPFS
|
|
1096
|
+
* @default true
|
|
1097
|
+
*/
|
|
1098
|
+
pin?: boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* Metadata to attach to uploads
|
|
1101
|
+
*/
|
|
1102
|
+
metadata?: Record<string, any>;
|
|
1103
|
+
/**
|
|
1104
|
+
* Wrap with directory (for multiple files)
|
|
1105
|
+
* @default false
|
|
1106
|
+
*/
|
|
1107
|
+
wrapWithDirectory?: boolean;
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* USDC Amount
|
|
1112
|
+
*
|
|
1113
|
+
* Represents a USDC amount with proper decimal handling.
|
|
1114
|
+
*
|
|
1115
|
+
* CRITICAL: Always uses 6 decimals.
|
|
1116
|
+
*/
|
|
1117
|
+
export interface USDCAmount {
|
|
1118
|
+
/**
|
|
1119
|
+
* Amount in smallest units (6 decimals)
|
|
1120
|
+
* @example 1000000n = 1 USDC
|
|
1121
|
+
*/
|
|
1122
|
+
raw: bigint;
|
|
1123
|
+
/**
|
|
1124
|
+
* Human-readable formatted amount
|
|
1125
|
+
* @example "1.50 USDC"
|
|
1126
|
+
*/
|
|
1127
|
+
formatted: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Numeric value (JavaScript number, may lose precision for large values)
|
|
1130
|
+
* @example 1.5
|
|
1131
|
+
*/
|
|
1132
|
+
value: number;
|
|
1133
|
+
/**
|
|
1134
|
+
* Number of decimals
|
|
1135
|
+
* @constant 6
|
|
1136
|
+
*/
|
|
1137
|
+
decimals: 6;
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Type guard to check if a value is a valid Varity chain configuration
|
|
1141
|
+
*/
|
|
1142
|
+
export declare function isVarityChain(chain: any): chain is VarityChain;
|
|
1143
|
+
/**
|
|
1144
|
+
* Type guard to check if a value is a valid SIWE message
|
|
1145
|
+
*/
|
|
1146
|
+
export declare function isSIWEMessage(message: any): message is SIWEMessage;
|
|
1147
|
+
/**
|
|
1148
|
+
* Varity L3 Testnet Chain Constants
|
|
1149
|
+
*/
|
|
1150
|
+
export declare const VARITY_L3_TESTNET: VarityChainConstants;
|
|
1151
|
+
/**
|
|
1152
|
+
* USDC Decimals Constant
|
|
1153
|
+
* CRITICAL: Always use this constant when handling USDC amounts
|
|
1154
|
+
*/
|
|
1155
|
+
export declare const USDC_DECIMALS: 6;
|
|
1156
|
+
/**
|
|
1157
|
+
* Helper to format USDC amounts
|
|
1158
|
+
*
|
|
1159
|
+
* @param amount - Raw USDC amount (6 decimals)
|
|
1160
|
+
* @returns Formatted USDC amount object
|
|
1161
|
+
*
|
|
1162
|
+
* @example
|
|
1163
|
+
* ```typescript
|
|
1164
|
+
* const formatted = formatUSDC(1500000n)
|
|
1165
|
+
* // Returns: { raw: 1500000n, formatted: "1.50 USDC", value: 1.5, decimals: 6 }
|
|
1166
|
+
* ```
|
|
1167
|
+
*/
|
|
1168
|
+
export declare function formatUSDC(amount: bigint): USDCAmount;
|
|
1169
|
+
/**
|
|
1170
|
+
* Helper to parse USDC amounts from human-readable format
|
|
1171
|
+
*
|
|
1172
|
+
* @param amount - Human-readable amount (e.g., "1.5" or 1.5)
|
|
1173
|
+
* @returns Raw USDC amount (6 decimals)
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* ```typescript
|
|
1177
|
+
* const raw = parseUSDC("1.5")
|
|
1178
|
+
* // Returns: 1500000n
|
|
1179
|
+
* ```
|
|
1180
|
+
*/
|
|
1181
|
+
export declare function parseUSDC(amount: string | number): bigint;
|
|
1182
|
+
//# sourceMappingURL=thirdweb.d.ts.map
|