@campnetwork/origin 1.2.1 → 1.2.3

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/core.d.ts CHANGED
@@ -1,4 +1,135 @@
1
- import { Address, Hex, WalletClient, Abi, Account, Chain } from 'viem';
1
+ import { WalletClient, Account, Chain, Address, Hex, Abi } from 'viem';
2
+
3
+ interface BaseSigner {
4
+ getAddress(): Promise<string>;
5
+ signMessage(message: string): Promise<string>;
6
+ signTypedData?(domain: any, types: any, value: any): Promise<string>;
7
+ getChainId(): Promise<number>;
8
+ }
9
+ type SignerType = "viem" | "ethers" | "custom";
10
+ interface SignerAdapter {
11
+ type: SignerType;
12
+ signer: any;
13
+ getAddress(): Promise<string>;
14
+ signMessage(message: string): Promise<string>;
15
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
16
+ getChainId(): Promise<number>;
17
+ }
18
+
19
+ /**
20
+ * Adapter for viem WalletClient
21
+ */
22
+ declare class ViemSignerAdapter implements SignerAdapter {
23
+ type: SignerType;
24
+ signer: WalletClient;
25
+ constructor(signer: WalletClient);
26
+ getAddress(): Promise<string>;
27
+ signMessage(message: string): Promise<string>;
28
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
29
+ getChainId(): Promise<number>;
30
+ }
31
+ /**
32
+ * Adapter for ethers Signer (v5 and v6)
33
+ */
34
+ declare class EthersSignerAdapter implements SignerAdapter {
35
+ type: SignerType;
36
+ signer: any;
37
+ constructor(signer: any);
38
+ getAddress(): Promise<string>;
39
+ signMessage(message: string): Promise<string>;
40
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
41
+ getChainId(): Promise<number>;
42
+ }
43
+ /**
44
+ * Adapter for custom signer implementations
45
+ */
46
+ declare class CustomSignerAdapter implements SignerAdapter {
47
+ type: SignerType;
48
+ signer: any;
49
+ constructor(signer: any);
50
+ getAddress(): Promise<string>;
51
+ signMessage(message: string): Promise<string>;
52
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
53
+ getChainId(): Promise<number>;
54
+ }
55
+ /**
56
+ * Factory function to create appropriate adapter based on signer type
57
+ */
58
+ declare function createSignerAdapter(signer: any): SignerAdapter;
59
+
60
+ interface StorageAdapter {
61
+ getItem(key: string): Promise<string | null>;
62
+ setItem(key: string, value: string): Promise<void>;
63
+ removeItem(key: string): Promise<void>;
64
+ }
65
+ /**
66
+ * Browser localStorage adapter
67
+ */
68
+ declare class BrowserStorage implements StorageAdapter {
69
+ getItem(key: string): Promise<string | null>;
70
+ setItem(key: string, value: string): Promise<void>;
71
+ removeItem(key: string): Promise<void>;
72
+ }
73
+ /**
74
+ * In-memory storage adapter for Node.js
75
+ */
76
+ declare class MemoryStorage implements StorageAdapter {
77
+ private storage;
78
+ getItem(key: string): Promise<string | null>;
79
+ setItem(key: string, value: string): Promise<void>;
80
+ removeItem(key: string): Promise<void>;
81
+ clear(): void;
82
+ }
83
+
84
+ /**
85
+ * Create a wallet client for Node.js environment
86
+ * @param account The viem account
87
+ * @param chain The chain to use
88
+ * @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
89
+ * @returns WalletClient
90
+ */
91
+ declare function createNodeWalletClient(account: Account, chain: Chain, rpcUrl?: string): WalletClient;
92
+
93
+ declare const testnet: {
94
+ id: number;
95
+ name: string;
96
+ nativeCurrency: {
97
+ decimals: number;
98
+ name: string;
99
+ symbol: string;
100
+ };
101
+ rpcUrls: {
102
+ default: {
103
+ http: string[];
104
+ };
105
+ };
106
+ blockExplorers: {
107
+ default: {
108
+ name: string;
109
+ url: string;
110
+ };
111
+ };
112
+ };
113
+ declare const mainnet: {
114
+ id: number;
115
+ name: string;
116
+ nativeCurrency: {
117
+ decimals: number;
118
+ name: string;
119
+ symbol: string;
120
+ };
121
+ rpcUrls: {
122
+ default: {
123
+ http: string[];
124
+ };
125
+ };
126
+ blockExplorers: {
127
+ default: {
128
+ name: string;
129
+ url: string;
130
+ };
131
+ };
132
+ };
2
133
 
3
134
  interface Environment {
4
135
  NAME: string;
@@ -175,6 +306,52 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
175
306
 
176
307
  declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
177
308
 
309
+ /**
310
+ * Response from getDataWithX402 when payment is required
311
+ */
312
+ interface X402Response {
313
+ error: string;
314
+ marketplaceAction?: {
315
+ kind: string;
316
+ contract: Address;
317
+ network: string;
318
+ chainId: number;
319
+ method: string;
320
+ payer: Address;
321
+ payTo: Address;
322
+ tokenId: string;
323
+ duration: number;
324
+ asset: Address;
325
+ amount: string;
326
+ amountFormatted: string;
327
+ };
328
+ }
329
+ interface TransactionResult {
330
+ txHash: string;
331
+ receipt?: any;
332
+ }
333
+ /**
334
+ * Settles an X402 payment response by purchasing access if needed.
335
+ * This method checks if the user already has access to the item, and if not,
336
+ * it calls buyAccess with the parameters from the X402 response.
337
+ * Supports viem WalletClient, ethers Signer, and custom signer implementations.
338
+ *
339
+ * @param x402Response - The response from getDataWithX402 containing payment details.
340
+ * @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
341
+ * @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
342
+ * @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
343
+ */
344
+ declare function settleX402(this: Origin, x402Response: X402Response, signer?: any): Promise<TransactionResult | null>;
345
+
346
+ /**
347
+ * Fetch data with X402 payment handling.
348
+ * @param {bigint} tokenId The token ID to fetch data for.
349
+ * @param {any} [signer] Optional signer object for signing the X402 intent.
350
+ * @returns {Promise<any>} A promise that resolves with the fetched data.
351
+ * @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
352
+ */
353
+ declare function getDataWithX402(this: Origin, tokenId: bigint, signer?: any): Promise<any>;
354
+
178
355
  interface RoyaltyInfo {
179
356
  tokenBoundAccount: Address;
180
357
  balance: bigint;
@@ -210,12 +387,14 @@ declare class Origin {
210
387
  buyAccess: typeof buyAccess;
211
388
  hasAccess: typeof hasAccess;
212
389
  subscriptionExpiry: typeof subscriptionExpiry;
213
- private jwt;
390
+ settleX402: typeof settleX402;
391
+ getDataWithX402: typeof getDataWithX402;
392
+ private jwt?;
214
393
  environment: Environment;
215
394
  private viemClient?;
216
395
  baseParentId?: bigint;
217
- constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
218
- getJwt(): string;
396
+ constructor(environment: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint);
397
+ getJwt(): string | undefined;
219
398
  setViemClient(client: WalletClient): void;
220
399
  mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
221
400
  progressCallback?: (percent: number) => void;
@@ -238,6 +417,12 @@ declare class Origin {
238
417
  * @returns {Promise<any>} The result of the buyAccess call.
239
418
  */
240
419
  buyAccessSmart(tokenId: bigint): Promise<any>;
420
+ /**
421
+ * Fetch the underlying data associated with a specific token ID.
422
+ * @param {bigint} tokenId - The token ID to fetch data for.
423
+ * @returns {Promise<any>} A promise that resolves with the fetched data.
424
+ * @throws {Error} Throws an error if the data cannot be fetched.
425
+ */
241
426
  getData(tokenId: bigint): Promise<any>;
242
427
  /**
243
428
  * Get the Token Bound Account (TBA) address for a specific token ID.
@@ -286,30 +471,6 @@ declare class Origin {
286
471
  claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
287
472
  }
288
473
 
289
- interface StorageAdapter {
290
- getItem(key: string): Promise<string | null>;
291
- setItem(key: string, value: string): Promise<void>;
292
- removeItem(key: string): Promise<void>;
293
- }
294
- /**
295
- * Browser localStorage adapter
296
- */
297
- declare class BrowserStorage implements StorageAdapter {
298
- getItem(key: string): Promise<string | null>;
299
- setItem(key: string, value: string): Promise<void>;
300
- removeItem(key: string): Promise<void>;
301
- }
302
- /**
303
- * In-memory storage adapter for Node.js
304
- */
305
- declare class MemoryStorage implements StorageAdapter {
306
- private storage;
307
- getItem(key: string): Promise<string | null>;
308
- setItem(key: string, value: string): Promise<void>;
309
- removeItem(key: string): Promise<void>;
310
- clear(): void;
311
- }
312
-
313
474
  declare global {
314
475
  interface Window {
315
476
  ethereum?: any;
@@ -524,106 +685,4 @@ declare class Auth {
524
685
  unlinkTelegram(): Promise<any>;
525
686
  }
526
687
 
527
- interface BaseSigner {
528
- getAddress(): Promise<string>;
529
- signMessage(message: string): Promise<string>;
530
- getChainId(): Promise<number>;
531
- }
532
- type SignerType = "viem" | "ethers" | "custom";
533
- interface SignerAdapter {
534
- type: SignerType;
535
- signer: any;
536
- getAddress(): Promise<string>;
537
- signMessage(message: string): Promise<string>;
538
- getChainId(): Promise<number>;
539
- }
540
-
541
- /**
542
- * Adapter for viem WalletClient
543
- */
544
- declare class ViemSignerAdapter implements SignerAdapter {
545
- type: SignerType;
546
- signer: WalletClient;
547
- constructor(signer: WalletClient);
548
- getAddress(): Promise<string>;
549
- signMessage(message: string): Promise<string>;
550
- getChainId(): Promise<number>;
551
- }
552
- /**
553
- * Adapter for ethers Signer (v5 and v6)
554
- */
555
- declare class EthersSignerAdapter implements SignerAdapter {
556
- type: SignerType;
557
- signer: any;
558
- constructor(signer: any);
559
- getAddress(): Promise<string>;
560
- signMessage(message: string): Promise<string>;
561
- getChainId(): Promise<number>;
562
- }
563
- /**
564
- * Adapter for custom signer implementations
565
- */
566
- declare class CustomSignerAdapter implements SignerAdapter {
567
- type: SignerType;
568
- signer: any;
569
- constructor(signer: any);
570
- getAddress(): Promise<string>;
571
- signMessage(message: string): Promise<string>;
572
- getChainId(): Promise<number>;
573
- }
574
- /**
575
- * Factory function to create appropriate adapter based on signer type
576
- */
577
- declare function createSignerAdapter(signer: any): SignerAdapter;
578
-
579
- /**
580
- * Create a wallet client for Node.js environment
581
- * @param account The viem account
582
- * @param chain The chain to use
583
- * @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
584
- * @returns WalletClient
585
- */
586
- declare function createNodeWalletClient(account: Account, chain: Chain, rpcUrl?: string): WalletClient;
587
-
588
- declare const testnet: {
589
- id: number;
590
- name: string;
591
- nativeCurrency: {
592
- decimals: number;
593
- name: string;
594
- symbol: string;
595
- };
596
- rpcUrls: {
597
- default: {
598
- http: string[];
599
- };
600
- };
601
- blockExplorers: {
602
- default: {
603
- name: string;
604
- url: string;
605
- };
606
- };
607
- };
608
- declare const mainnet: {
609
- id: number;
610
- name: string;
611
- nativeCurrency: {
612
- decimals: number;
613
- name: string;
614
- symbol: string;
615
- };
616
- rpcUrls: {
617
- default: {
618
- http: string[];
619
- };
620
- };
621
- blockExplorers: {
622
- default: {
623
- name: string;
624
- url: string;
625
- };
626
- };
627
- };
628
-
629
- export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType, type StorageAdapter, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
688
+ export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
@@ -1,4 +1,135 @@
1
- import { Address, Hex, WalletClient, Abi, Account, Chain } from 'viem';
1
+ import { WalletClient, Account, Chain, Address, Hex, Abi } from 'viem';
2
+
3
+ interface BaseSigner {
4
+ getAddress(): Promise<string>;
5
+ signMessage(message: string): Promise<string>;
6
+ signTypedData?(domain: any, types: any, value: any): Promise<string>;
7
+ getChainId(): Promise<number>;
8
+ }
9
+ type SignerType = "viem" | "ethers" | "custom";
10
+ interface SignerAdapter {
11
+ type: SignerType;
12
+ signer: any;
13
+ getAddress(): Promise<string>;
14
+ signMessage(message: string): Promise<string>;
15
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
16
+ getChainId(): Promise<number>;
17
+ }
18
+
19
+ /**
20
+ * Adapter for viem WalletClient
21
+ */
22
+ declare class ViemSignerAdapter implements SignerAdapter {
23
+ type: SignerType;
24
+ signer: WalletClient;
25
+ constructor(signer: WalletClient);
26
+ getAddress(): Promise<string>;
27
+ signMessage(message: string): Promise<string>;
28
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
29
+ getChainId(): Promise<number>;
30
+ }
31
+ /**
32
+ * Adapter for ethers Signer (v5 and v6)
33
+ */
34
+ declare class EthersSignerAdapter implements SignerAdapter {
35
+ type: SignerType;
36
+ signer: any;
37
+ constructor(signer: any);
38
+ getAddress(): Promise<string>;
39
+ signMessage(message: string): Promise<string>;
40
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
41
+ getChainId(): Promise<number>;
42
+ }
43
+ /**
44
+ * Adapter for custom signer implementations
45
+ */
46
+ declare class CustomSignerAdapter implements SignerAdapter {
47
+ type: SignerType;
48
+ signer: any;
49
+ constructor(signer: any);
50
+ getAddress(): Promise<string>;
51
+ signMessage(message: string): Promise<string>;
52
+ signTypedData(domain: any, types: any, value: any): Promise<string>;
53
+ getChainId(): Promise<number>;
54
+ }
55
+ /**
56
+ * Factory function to create appropriate adapter based on signer type
57
+ */
58
+ declare function createSignerAdapter(signer: any): SignerAdapter;
59
+
60
+ interface StorageAdapter {
61
+ getItem(key: string): Promise<string | null>;
62
+ setItem(key: string, value: string): Promise<void>;
63
+ removeItem(key: string): Promise<void>;
64
+ }
65
+ /**
66
+ * Browser localStorage adapter
67
+ */
68
+ declare class BrowserStorage implements StorageAdapter {
69
+ getItem(key: string): Promise<string | null>;
70
+ setItem(key: string, value: string): Promise<void>;
71
+ removeItem(key: string): Promise<void>;
72
+ }
73
+ /**
74
+ * In-memory storage adapter for Node.js
75
+ */
76
+ declare class MemoryStorage implements StorageAdapter {
77
+ private storage;
78
+ getItem(key: string): Promise<string | null>;
79
+ setItem(key: string, value: string): Promise<void>;
80
+ removeItem(key: string): Promise<void>;
81
+ clear(): void;
82
+ }
83
+
84
+ /**
85
+ * Create a wallet client for Node.js environment
86
+ * @param account The viem account
87
+ * @param chain The chain to use
88
+ * @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
89
+ * @returns WalletClient
90
+ */
91
+ declare function createNodeWalletClient(account: Account, chain: Chain, rpcUrl?: string): WalletClient;
92
+
93
+ declare const testnet: {
94
+ id: number;
95
+ name: string;
96
+ nativeCurrency: {
97
+ decimals: number;
98
+ name: string;
99
+ symbol: string;
100
+ };
101
+ rpcUrls: {
102
+ default: {
103
+ http: string[];
104
+ };
105
+ };
106
+ blockExplorers: {
107
+ default: {
108
+ name: string;
109
+ url: string;
110
+ };
111
+ };
112
+ };
113
+ declare const mainnet: {
114
+ id: number;
115
+ name: string;
116
+ nativeCurrency: {
117
+ decimals: number;
118
+ name: string;
119
+ symbol: string;
120
+ };
121
+ rpcUrls: {
122
+ default: {
123
+ http: string[];
124
+ };
125
+ };
126
+ blockExplorers: {
127
+ default: {
128
+ name: string;
129
+ url: string;
130
+ };
131
+ };
132
+ };
2
133
 
3
134
  interface Environment {
4
135
  NAME: string;
@@ -175,6 +306,52 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
175
306
 
176
307
  declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
177
308
 
309
+ /**
310
+ * Response from getDataWithX402 when payment is required
311
+ */
312
+ interface X402Response {
313
+ error: string;
314
+ marketplaceAction?: {
315
+ kind: string;
316
+ contract: Address;
317
+ network: string;
318
+ chainId: number;
319
+ method: string;
320
+ payer: Address;
321
+ payTo: Address;
322
+ tokenId: string;
323
+ duration: number;
324
+ asset: Address;
325
+ amount: string;
326
+ amountFormatted: string;
327
+ };
328
+ }
329
+ interface TransactionResult {
330
+ txHash: string;
331
+ receipt?: any;
332
+ }
333
+ /**
334
+ * Settles an X402 payment response by purchasing access if needed.
335
+ * This method checks if the user already has access to the item, and if not,
336
+ * it calls buyAccess with the parameters from the X402 response.
337
+ * Supports viem WalletClient, ethers Signer, and custom signer implementations.
338
+ *
339
+ * @param x402Response - The response from getDataWithX402 containing payment details.
340
+ * @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
341
+ * @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
342
+ * @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
343
+ */
344
+ declare function settleX402(this: Origin, x402Response: X402Response, signer?: any): Promise<TransactionResult | null>;
345
+
346
+ /**
347
+ * Fetch data with X402 payment handling.
348
+ * @param {bigint} tokenId The token ID to fetch data for.
349
+ * @param {any} [signer] Optional signer object for signing the X402 intent.
350
+ * @returns {Promise<any>} A promise that resolves with the fetched data.
351
+ * @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
352
+ */
353
+ declare function getDataWithX402(this: Origin, tokenId: bigint, signer?: any): Promise<any>;
354
+
178
355
  interface RoyaltyInfo {
179
356
  tokenBoundAccount: Address;
180
357
  balance: bigint;
@@ -210,12 +387,14 @@ declare class Origin {
210
387
  buyAccess: typeof buyAccess;
211
388
  hasAccess: typeof hasAccess;
212
389
  subscriptionExpiry: typeof subscriptionExpiry;
213
- private jwt;
390
+ settleX402: typeof settleX402;
391
+ getDataWithX402: typeof getDataWithX402;
392
+ private jwt?;
214
393
  environment: Environment;
215
394
  private viemClient?;
216
395
  baseParentId?: bigint;
217
- constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
218
- getJwt(): string;
396
+ constructor(environment: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint);
397
+ getJwt(): string | undefined;
219
398
  setViemClient(client: WalletClient): void;
220
399
  mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
221
400
  progressCallback?: (percent: number) => void;
@@ -238,6 +417,12 @@ declare class Origin {
238
417
  * @returns {Promise<any>} The result of the buyAccess call.
239
418
  */
240
419
  buyAccessSmart(tokenId: bigint): Promise<any>;
420
+ /**
421
+ * Fetch the underlying data associated with a specific token ID.
422
+ * @param {bigint} tokenId - The token ID to fetch data for.
423
+ * @returns {Promise<any>} A promise that resolves with the fetched data.
424
+ * @throws {Error} Throws an error if the data cannot be fetched.
425
+ */
241
426
  getData(tokenId: bigint): Promise<any>;
242
427
  /**
243
428
  * Get the Token Bound Account (TBA) address for a specific token ID.
@@ -286,30 +471,6 @@ declare class Origin {
286
471
  claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
287
472
  }
288
473
 
289
- interface StorageAdapter {
290
- getItem(key: string): Promise<string | null>;
291
- setItem(key: string, value: string): Promise<void>;
292
- removeItem(key: string): Promise<void>;
293
- }
294
- /**
295
- * Browser localStorage adapter
296
- */
297
- declare class BrowserStorage implements StorageAdapter {
298
- getItem(key: string): Promise<string | null>;
299
- setItem(key: string, value: string): Promise<void>;
300
- removeItem(key: string): Promise<void>;
301
- }
302
- /**
303
- * In-memory storage adapter for Node.js
304
- */
305
- declare class MemoryStorage implements StorageAdapter {
306
- private storage;
307
- getItem(key: string): Promise<string | null>;
308
- setItem(key: string, value: string): Promise<void>;
309
- removeItem(key: string): Promise<void>;
310
- clear(): void;
311
- }
312
-
313
474
  declare global {
314
475
  interface Window {
315
476
  ethereum?: any;
@@ -524,106 +685,4 @@ declare class Auth {
524
685
  unlinkTelegram(): Promise<any>;
525
686
  }
526
687
 
527
- interface BaseSigner {
528
- getAddress(): Promise<string>;
529
- signMessage(message: string): Promise<string>;
530
- getChainId(): Promise<number>;
531
- }
532
- type SignerType = "viem" | "ethers" | "custom";
533
- interface SignerAdapter {
534
- type: SignerType;
535
- signer: any;
536
- getAddress(): Promise<string>;
537
- signMessage(message: string): Promise<string>;
538
- getChainId(): Promise<number>;
539
- }
540
-
541
- /**
542
- * Adapter for viem WalletClient
543
- */
544
- declare class ViemSignerAdapter implements SignerAdapter {
545
- type: SignerType;
546
- signer: WalletClient;
547
- constructor(signer: WalletClient);
548
- getAddress(): Promise<string>;
549
- signMessage(message: string): Promise<string>;
550
- getChainId(): Promise<number>;
551
- }
552
- /**
553
- * Adapter for ethers Signer (v5 and v6)
554
- */
555
- declare class EthersSignerAdapter implements SignerAdapter {
556
- type: SignerType;
557
- signer: any;
558
- constructor(signer: any);
559
- getAddress(): Promise<string>;
560
- signMessage(message: string): Promise<string>;
561
- getChainId(): Promise<number>;
562
- }
563
- /**
564
- * Adapter for custom signer implementations
565
- */
566
- declare class CustomSignerAdapter implements SignerAdapter {
567
- type: SignerType;
568
- signer: any;
569
- constructor(signer: any);
570
- getAddress(): Promise<string>;
571
- signMessage(message: string): Promise<string>;
572
- getChainId(): Promise<number>;
573
- }
574
- /**
575
- * Factory function to create appropriate adapter based on signer type
576
- */
577
- declare function createSignerAdapter(signer: any): SignerAdapter;
578
-
579
- /**
580
- * Create a wallet client for Node.js environment
581
- * @param account The viem account
582
- * @param chain The chain to use
583
- * @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
584
- * @returns WalletClient
585
- */
586
- declare function createNodeWalletClient(account: Account, chain: Chain, rpcUrl?: string): WalletClient;
587
-
588
- declare const testnet: {
589
- id: number;
590
- name: string;
591
- nativeCurrency: {
592
- decimals: number;
593
- name: string;
594
- symbol: string;
595
- };
596
- rpcUrls: {
597
- default: {
598
- http: string[];
599
- };
600
- };
601
- blockExplorers: {
602
- default: {
603
- name: string;
604
- url: string;
605
- };
606
- };
607
- };
608
- declare const mainnet: {
609
- id: number;
610
- name: string;
611
- nativeCurrency: {
612
- decimals: number;
613
- name: string;
614
- symbol: string;
615
- };
616
- rpcUrls: {
617
- default: {
618
- http: string[];
619
- };
620
- };
621
- blockExplorers: {
622
- default: {
623
- name: string;
624
- url: string;
625
- };
626
- };
627
- };
628
-
629
- export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType, type StorageAdapter, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
688
+ export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };