@campnetwork/origin 1.2.1 → 1.2.2
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.cjs +126 -101
- package/dist/core.d.ts +150 -131
- package/dist/core.esm.d.ts +150 -131
- package/dist/core.esm.js +133 -117
- package/dist/react/index.esm.d.ts +17 -3
- package/dist/react/index.esm.js +330 -183
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,135 @@
|
|
|
1
|
-
import {
|
|
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;
|
|
@@ -210,12 +341,12 @@ declare class Origin {
|
|
|
210
341
|
buyAccess: typeof buyAccess;
|
|
211
342
|
hasAccess: typeof hasAccess;
|
|
212
343
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
213
|
-
private jwt
|
|
344
|
+
private jwt?;
|
|
214
345
|
environment: Environment;
|
|
215
346
|
private viemClient?;
|
|
216
347
|
baseParentId?: bigint;
|
|
217
|
-
constructor(
|
|
218
|
-
getJwt(): string;
|
|
348
|
+
constructor(environment: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint);
|
|
349
|
+
getJwt(): string | undefined;
|
|
219
350
|
setViemClient(client: WalletClient): void;
|
|
220
351
|
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
221
352
|
progressCallback?: (percent: number) => void;
|
|
@@ -238,7 +369,21 @@ declare class Origin {
|
|
|
238
369
|
* @returns {Promise<any>} The result of the buyAccess call.
|
|
239
370
|
*/
|
|
240
371
|
buyAccessSmart(tokenId: bigint): Promise<any>;
|
|
372
|
+
/**
|
|
373
|
+
* Fetch the underlying data associated with a specific token ID.
|
|
374
|
+
* @param {bigint} tokenId - The token ID to fetch data for.
|
|
375
|
+
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
376
|
+
* @throws {Error} Throws an error if the data cannot be fetched.
|
|
377
|
+
*/
|
|
241
378
|
getData(tokenId: bigint): Promise<any>;
|
|
379
|
+
/**
|
|
380
|
+
* Fetch data with X402 payment handling.
|
|
381
|
+
* @param {bigint} tokenId The token ID to fetch data for.
|
|
382
|
+
* @param {any} [signer] Optional signer object for signing the X402 intent.
|
|
383
|
+
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
384
|
+
* @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
|
|
385
|
+
*/
|
|
386
|
+
getDataWithX402(tokenId: bigint, signer?: any): Promise<any>;
|
|
242
387
|
/**
|
|
243
388
|
* Get the Token Bound Account (TBA) address for a specific token ID.
|
|
244
389
|
* @param {bigint} tokenId - The token ID to get the TBA address for.
|
|
@@ -286,30 +431,6 @@ declare class Origin {
|
|
|
286
431
|
claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
|
|
287
432
|
}
|
|
288
433
|
|
|
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
434
|
declare global {
|
|
314
435
|
interface Window {
|
|
315
436
|
ethereum?: any;
|
|
@@ -524,106 +645,4 @@ declare class Auth {
|
|
|
524
645
|
unlinkTelegram(): Promise<any>;
|
|
525
646
|
}
|
|
526
647
|
|
|
527
|
-
|
|
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 };
|
|
648
|
+
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 };
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -1,4 +1,135 @@
|
|
|
1
|
-
import {
|
|
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;
|
|
@@ -210,12 +341,12 @@ declare class Origin {
|
|
|
210
341
|
buyAccess: typeof buyAccess;
|
|
211
342
|
hasAccess: typeof hasAccess;
|
|
212
343
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
213
|
-
private jwt
|
|
344
|
+
private jwt?;
|
|
214
345
|
environment: Environment;
|
|
215
346
|
private viemClient?;
|
|
216
347
|
baseParentId?: bigint;
|
|
217
|
-
constructor(
|
|
218
|
-
getJwt(): string;
|
|
348
|
+
constructor(environment: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint);
|
|
349
|
+
getJwt(): string | undefined;
|
|
219
350
|
setViemClient(client: WalletClient): void;
|
|
220
351
|
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
221
352
|
progressCallback?: (percent: number) => void;
|
|
@@ -238,7 +369,21 @@ declare class Origin {
|
|
|
238
369
|
* @returns {Promise<any>} The result of the buyAccess call.
|
|
239
370
|
*/
|
|
240
371
|
buyAccessSmart(tokenId: bigint): Promise<any>;
|
|
372
|
+
/**
|
|
373
|
+
* Fetch the underlying data associated with a specific token ID.
|
|
374
|
+
* @param {bigint} tokenId - The token ID to fetch data for.
|
|
375
|
+
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
376
|
+
* @throws {Error} Throws an error if the data cannot be fetched.
|
|
377
|
+
*/
|
|
241
378
|
getData(tokenId: bigint): Promise<any>;
|
|
379
|
+
/**
|
|
380
|
+
* Fetch data with X402 payment handling.
|
|
381
|
+
* @param {bigint} tokenId The token ID to fetch data for.
|
|
382
|
+
* @param {any} [signer] Optional signer object for signing the X402 intent.
|
|
383
|
+
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
384
|
+
* @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
|
|
385
|
+
*/
|
|
386
|
+
getDataWithX402(tokenId: bigint, signer?: any): Promise<any>;
|
|
242
387
|
/**
|
|
243
388
|
* Get the Token Bound Account (TBA) address for a specific token ID.
|
|
244
389
|
* @param {bigint} tokenId - The token ID to get the TBA address for.
|
|
@@ -286,30 +431,6 @@ declare class Origin {
|
|
|
286
431
|
claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
|
|
287
432
|
}
|
|
288
433
|
|
|
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
434
|
declare global {
|
|
314
435
|
interface Window {
|
|
315
436
|
ethereum?: any;
|
|
@@ -524,106 +645,4 @@ declare class Auth {
|
|
|
524
645
|
unlinkTelegram(): Promise<any>;
|
|
525
646
|
}
|
|
526
647
|
|
|
527
|
-
|
|
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 };
|
|
648
|
+
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 };
|