@zubari/sdk 0.4.2 → 0.4.4

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.
@@ -1,88 +1,6 @@
1
1
  import { Z as ZubariWalletConfig, b as NetworkType, A as Account, c as NetworkBalance, e as SendParams, T as TxResult } from './index-CTyZlHKg.mjs';
2
2
  import './WalletManager-j0tgNIKi.mjs';
3
3
 
4
- interface ContractAddresses {
5
- registry: string;
6
- nft: string;
7
- nft1155: string;
8
- marketplace: string;
9
- tips: string;
10
- subscriptions: string;
11
- subscriptionsV2: string;
12
- subscriptionsSimple: string;
13
- creatorRegistry: string;
14
- payouts: string;
15
- entryPoint: string;
16
- paymaster: string;
17
- accountFactory: string;
18
- usdt: string;
19
- weth: string;
20
- }
21
- declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
22
- declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
23
- declare const PLATFORM_CONFIG: {
24
- readonly platformFeeBps: 1000;
25
- readonly tipFeeBps: 1000;
26
- readonly maxRoyaltyBps: 1000;
27
- readonly defaultSlippageBps: 50;
28
- readonly voucherValiditySecs: number;
29
- readonly swapDeadlineSecs: number;
30
- };
31
- declare const NFT_VOUCHER_DOMAIN: {
32
- readonly name: "ZubariNFT";
33
- readonly version: "1";
34
- };
35
- declare const NFT_VOUCHER_TYPES: {
36
- readonly NFTVoucher: readonly [{
37
- readonly name: "tokenId";
38
- readonly type: "bytes32";
39
- }, {
40
- readonly name: "uri";
41
- readonly type: "string";
42
- }, {
43
- readonly name: "creator";
44
- readonly type: "address";
45
- }, {
46
- readonly name: "royaltyBps";
47
- readonly type: "uint256";
48
- }, {
49
- readonly name: "deadline";
50
- readonly type: "uint256";
51
- }, {
52
- readonly name: "price";
53
- readonly type: "uint256";
54
- }, {
55
- readonly name: "currency";
56
- readonly type: "address";
57
- }, {
58
- readonly name: "nonce";
59
- readonly type: "uint256";
60
- }, {
61
- readonly name: "contentHash";
62
- readonly type: "bytes32";
63
- }, {
64
- readonly name: "userId";
65
- readonly type: "bytes32";
66
- }, {
67
- readonly name: "watermarkTimestamp";
68
- readonly type: "uint256";
69
- }, {
70
- readonly name: "sessionId";
71
- readonly type: "bytes32";
72
- }];
73
- };
74
- declare const CURRENCY_ADDRESSES: {
75
- readonly testnet: {
76
- readonly ETH: "0x0000000000000000000000000000000000000000";
77
- readonly USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
78
- };
79
- readonly mainnet: {
80
- readonly ETH: "0x0000000000000000000000000000000000000000";
81
- readonly USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
82
- };
83
- };
84
- declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
85
-
86
4
  /**
87
5
  * ZubariWallet - Multi-chain self-custodial wallet
88
6
  *
@@ -202,4 +120,154 @@ declare class ZubariWallet {
202
120
  getContractAddresses(): ContractAddresses;
203
121
  }
204
122
 
205
- export { CURRENCY_ADDRESSES as C, NFT_VOUCHER_DOMAIN as N, PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, ZERO_ADDRESS as b, NFT_VOUCHER_TYPES as c, getContractAddresses as g };
123
+ interface ContractAddresses {
124
+ registry: string;
125
+ nft: string;
126
+ nft1155: string;
127
+ marketplace: string;
128
+ tips: string;
129
+ subscriptions: string;
130
+ subscriptionsV2: string;
131
+ subscriptionsSimple: string;
132
+ creatorRegistry: string;
133
+ payouts: string;
134
+ entryPoint: string;
135
+ paymaster: string;
136
+ accountFactory: string;
137
+ usdt: string;
138
+ weth: string;
139
+ }
140
+ declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
141
+ declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
142
+ declare const PLATFORM_CONFIG: {
143
+ readonly platformFeeBps: 1000;
144
+ readonly tipFeeBps: 1000;
145
+ readonly maxRoyaltyBps: 1000;
146
+ readonly defaultSlippageBps: 50;
147
+ readonly voucherValiditySecs: number;
148
+ readonly swapDeadlineSecs: number;
149
+ };
150
+ declare const NFT_VOUCHER_DOMAIN: {
151
+ readonly name: "ZubariNFT";
152
+ readonly version: "1";
153
+ };
154
+ declare const NFT_VOUCHER_TYPES: {
155
+ readonly NFTVoucher: readonly [{
156
+ readonly name: "tokenId";
157
+ readonly type: "bytes32";
158
+ }, {
159
+ readonly name: "uri";
160
+ readonly type: "string";
161
+ }, {
162
+ readonly name: "creator";
163
+ readonly type: "address";
164
+ }, {
165
+ readonly name: "royaltyBps";
166
+ readonly type: "uint256";
167
+ }, {
168
+ readonly name: "deadline";
169
+ readonly type: "uint256";
170
+ }, {
171
+ readonly name: "price";
172
+ readonly type: "uint256";
173
+ }, {
174
+ readonly name: "currency";
175
+ readonly type: "address";
176
+ }, {
177
+ readonly name: "nonce";
178
+ readonly type: "uint256";
179
+ }, {
180
+ readonly name: "contentHash";
181
+ readonly type: "bytes32";
182
+ }, {
183
+ readonly name: "userId";
184
+ readonly type: "bytes32";
185
+ }, {
186
+ readonly name: "watermarkTimestamp";
187
+ readonly type: "uint256";
188
+ }, {
189
+ readonly name: "sessionId";
190
+ readonly type: "bytes32";
191
+ }];
192
+ };
193
+ declare const CURRENCY_ADDRESSES: {
194
+ readonly testnet: {
195
+ readonly ETH: "0x0000000000000000000000000000000000000000";
196
+ readonly USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
197
+ };
198
+ readonly mainnet: {
199
+ readonly ETH: "0x0000000000000000000000000000000000000000";
200
+ readonly USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
201
+ };
202
+ };
203
+ declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
204
+ interface FeeWalletConfig {
205
+ address: string;
206
+ name: string;
207
+ network: string;
208
+ chainId?: number;
209
+ }
210
+ type SupportedFeeChain = 'ETH' | 'BTC' | 'SOLANA' | 'TON' | 'TRON';
211
+ /**
212
+ * Mainnet Fee Wallet Addresses
213
+ * These are the production treasury wallets for collecting platform fees (10%)
214
+ * Updated: 2025-01-18
215
+ */
216
+ declare const MAINNET_FEE_WALLETS: Record<SupportedFeeChain, FeeWalletConfig>;
217
+ /**
218
+ * Testnet Fee Wallet Addresses
219
+ * These are used for development and testing
220
+ */
221
+ declare const TESTNET_FEE_WALLETS: Record<SupportedFeeChain, FeeWalletConfig>;
222
+ /**
223
+ * Get fee wallet address for a specific chain
224
+ * @param chain - The blockchain network
225
+ * @param isMainnet - Whether to use mainnet addresses (default: false for testnet)
226
+ */
227
+ declare function getFeeWallet(chain: SupportedFeeChain, isMainnet?: boolean): FeeWalletConfig;
228
+ /**
229
+ * Get all fee wallets for a network type
230
+ * @param isMainnet - Whether to use mainnet addresses
231
+ */
232
+ declare function getAllFeeWallets(useMainnet?: boolean): Record<SupportedFeeChain, FeeWalletConfig>;
233
+ /**
234
+ * Default contract to use for subscriptions
235
+ * subscriptionsSimple is the recommended contract as it works on both networks
236
+ */
237
+ declare const DEFAULT_CONTRACTS: {
238
+ readonly subscriptions: "subscriptionsSimple";
239
+ };
240
+ /**
241
+ * Get contract addresses for the current network environment
242
+ * Reads ZUBARI_NETWORK from environment variables
243
+ * @returns Contract addresses for testnet or mainnet based on env
244
+ */
245
+ declare function getCurrentContractAddresses(): ContractAddresses;
246
+ /**
247
+ * Get the default subscription contract address (subscriptionsSimple)
248
+ * This is the recommended contract for subscriptions as it works on both networks
249
+ * @returns The subscriptionsSimple contract address for the current network
250
+ */
251
+ declare function getDefaultSubscriptionAddress(): string;
252
+ /**
253
+ * Get fee wallets for the current network environment
254
+ * Reads ZUBARI_NETWORK from environment variables
255
+ * @returns Fee wallet configurations for the current network
256
+ */
257
+ declare function getCurrentFeeWallets(): Record<SupportedFeeChain, FeeWalletConfig>;
258
+ /**
259
+ * Get a specific fee wallet for the current network environment
260
+ * @param chain - The blockchain to get the fee wallet for
261
+ * @returns Fee wallet configuration for the specified chain
262
+ */
263
+ declare function getCurrentFeeWallet(chain: SupportedFeeChain): FeeWalletConfig;
264
+ /**
265
+ * Get currency addresses for the current network environment
266
+ * @returns Currency addresses (ETH, USDT) for the current network
267
+ */
268
+ declare function getCurrentCurrencyAddresses(): {
269
+ ETH: string;
270
+ USDT: string;
271
+ };
272
+
273
+ export { CURRENCY_ADDRESSES as C, DEFAULT_CONTRACTS as D, type FeeWalletConfig as F, MAINNET_FEE_WALLETS as M, NFT_VOUCHER_DOMAIN as N, PLATFORM_CONFIG as P, type SupportedFeeChain as S, TESTNET_FEE_WALLETS as T, ZubariWallet as Z, ZUBARI_CONTRACTS as a, ZERO_ADDRESS as b, NFT_VOUCHER_TYPES as c, getCurrentContractAddresses as d, getDefaultSubscriptionAddress as e, getCurrentFeeWallets as f, getContractAddresses as g, getCurrentFeeWallet as h, getCurrentCurrencyAddresses as i, getFeeWallet as j, getAllFeeWallets as k, type ContractAddresses as l };
@@ -1,88 +1,6 @@
1
1
  import { Z as ZubariWalletConfig, b as NetworkType, A as Account, c as NetworkBalance, e as SendParams, T as TxResult } from './index-CTyZlHKg.js';
2
2
  import './WalletManager-DfvFJ-mk.js';
3
3
 
4
- interface ContractAddresses {
5
- registry: string;
6
- nft: string;
7
- nft1155: string;
8
- marketplace: string;
9
- tips: string;
10
- subscriptions: string;
11
- subscriptionsV2: string;
12
- subscriptionsSimple: string;
13
- creatorRegistry: string;
14
- payouts: string;
15
- entryPoint: string;
16
- paymaster: string;
17
- accountFactory: string;
18
- usdt: string;
19
- weth: string;
20
- }
21
- declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
22
- declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
23
- declare const PLATFORM_CONFIG: {
24
- readonly platformFeeBps: 1000;
25
- readonly tipFeeBps: 1000;
26
- readonly maxRoyaltyBps: 1000;
27
- readonly defaultSlippageBps: 50;
28
- readonly voucherValiditySecs: number;
29
- readonly swapDeadlineSecs: number;
30
- };
31
- declare const NFT_VOUCHER_DOMAIN: {
32
- readonly name: "ZubariNFT";
33
- readonly version: "1";
34
- };
35
- declare const NFT_VOUCHER_TYPES: {
36
- readonly NFTVoucher: readonly [{
37
- readonly name: "tokenId";
38
- readonly type: "bytes32";
39
- }, {
40
- readonly name: "uri";
41
- readonly type: "string";
42
- }, {
43
- readonly name: "creator";
44
- readonly type: "address";
45
- }, {
46
- readonly name: "royaltyBps";
47
- readonly type: "uint256";
48
- }, {
49
- readonly name: "deadline";
50
- readonly type: "uint256";
51
- }, {
52
- readonly name: "price";
53
- readonly type: "uint256";
54
- }, {
55
- readonly name: "currency";
56
- readonly type: "address";
57
- }, {
58
- readonly name: "nonce";
59
- readonly type: "uint256";
60
- }, {
61
- readonly name: "contentHash";
62
- readonly type: "bytes32";
63
- }, {
64
- readonly name: "userId";
65
- readonly type: "bytes32";
66
- }, {
67
- readonly name: "watermarkTimestamp";
68
- readonly type: "uint256";
69
- }, {
70
- readonly name: "sessionId";
71
- readonly type: "bytes32";
72
- }];
73
- };
74
- declare const CURRENCY_ADDRESSES: {
75
- readonly testnet: {
76
- readonly ETH: "0x0000000000000000000000000000000000000000";
77
- readonly USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
78
- };
79
- readonly mainnet: {
80
- readonly ETH: "0x0000000000000000000000000000000000000000";
81
- readonly USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
82
- };
83
- };
84
- declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
85
-
86
4
  /**
87
5
  * ZubariWallet - Multi-chain self-custodial wallet
88
6
  *
@@ -202,4 +120,154 @@ declare class ZubariWallet {
202
120
  getContractAddresses(): ContractAddresses;
203
121
  }
204
122
 
205
- export { CURRENCY_ADDRESSES as C, NFT_VOUCHER_DOMAIN as N, PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, ZERO_ADDRESS as b, NFT_VOUCHER_TYPES as c, getContractAddresses as g };
123
+ interface ContractAddresses {
124
+ registry: string;
125
+ nft: string;
126
+ nft1155: string;
127
+ marketplace: string;
128
+ tips: string;
129
+ subscriptions: string;
130
+ subscriptionsV2: string;
131
+ subscriptionsSimple: string;
132
+ creatorRegistry: string;
133
+ payouts: string;
134
+ entryPoint: string;
135
+ paymaster: string;
136
+ accountFactory: string;
137
+ usdt: string;
138
+ weth: string;
139
+ }
140
+ declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
141
+ declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
142
+ declare const PLATFORM_CONFIG: {
143
+ readonly platformFeeBps: 1000;
144
+ readonly tipFeeBps: 1000;
145
+ readonly maxRoyaltyBps: 1000;
146
+ readonly defaultSlippageBps: 50;
147
+ readonly voucherValiditySecs: number;
148
+ readonly swapDeadlineSecs: number;
149
+ };
150
+ declare const NFT_VOUCHER_DOMAIN: {
151
+ readonly name: "ZubariNFT";
152
+ readonly version: "1";
153
+ };
154
+ declare const NFT_VOUCHER_TYPES: {
155
+ readonly NFTVoucher: readonly [{
156
+ readonly name: "tokenId";
157
+ readonly type: "bytes32";
158
+ }, {
159
+ readonly name: "uri";
160
+ readonly type: "string";
161
+ }, {
162
+ readonly name: "creator";
163
+ readonly type: "address";
164
+ }, {
165
+ readonly name: "royaltyBps";
166
+ readonly type: "uint256";
167
+ }, {
168
+ readonly name: "deadline";
169
+ readonly type: "uint256";
170
+ }, {
171
+ readonly name: "price";
172
+ readonly type: "uint256";
173
+ }, {
174
+ readonly name: "currency";
175
+ readonly type: "address";
176
+ }, {
177
+ readonly name: "nonce";
178
+ readonly type: "uint256";
179
+ }, {
180
+ readonly name: "contentHash";
181
+ readonly type: "bytes32";
182
+ }, {
183
+ readonly name: "userId";
184
+ readonly type: "bytes32";
185
+ }, {
186
+ readonly name: "watermarkTimestamp";
187
+ readonly type: "uint256";
188
+ }, {
189
+ readonly name: "sessionId";
190
+ readonly type: "bytes32";
191
+ }];
192
+ };
193
+ declare const CURRENCY_ADDRESSES: {
194
+ readonly testnet: {
195
+ readonly ETH: "0x0000000000000000000000000000000000000000";
196
+ readonly USDT: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
197
+ };
198
+ readonly mainnet: {
199
+ readonly ETH: "0x0000000000000000000000000000000000000000";
200
+ readonly USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
201
+ };
202
+ };
203
+ declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
204
+ interface FeeWalletConfig {
205
+ address: string;
206
+ name: string;
207
+ network: string;
208
+ chainId?: number;
209
+ }
210
+ type SupportedFeeChain = 'ETH' | 'BTC' | 'SOLANA' | 'TON' | 'TRON';
211
+ /**
212
+ * Mainnet Fee Wallet Addresses
213
+ * These are the production treasury wallets for collecting platform fees (10%)
214
+ * Updated: 2025-01-18
215
+ */
216
+ declare const MAINNET_FEE_WALLETS: Record<SupportedFeeChain, FeeWalletConfig>;
217
+ /**
218
+ * Testnet Fee Wallet Addresses
219
+ * These are used for development and testing
220
+ */
221
+ declare const TESTNET_FEE_WALLETS: Record<SupportedFeeChain, FeeWalletConfig>;
222
+ /**
223
+ * Get fee wallet address for a specific chain
224
+ * @param chain - The blockchain network
225
+ * @param isMainnet - Whether to use mainnet addresses (default: false for testnet)
226
+ */
227
+ declare function getFeeWallet(chain: SupportedFeeChain, isMainnet?: boolean): FeeWalletConfig;
228
+ /**
229
+ * Get all fee wallets for a network type
230
+ * @param isMainnet - Whether to use mainnet addresses
231
+ */
232
+ declare function getAllFeeWallets(useMainnet?: boolean): Record<SupportedFeeChain, FeeWalletConfig>;
233
+ /**
234
+ * Default contract to use for subscriptions
235
+ * subscriptionsSimple is the recommended contract as it works on both networks
236
+ */
237
+ declare const DEFAULT_CONTRACTS: {
238
+ readonly subscriptions: "subscriptionsSimple";
239
+ };
240
+ /**
241
+ * Get contract addresses for the current network environment
242
+ * Reads ZUBARI_NETWORK from environment variables
243
+ * @returns Contract addresses for testnet or mainnet based on env
244
+ */
245
+ declare function getCurrentContractAddresses(): ContractAddresses;
246
+ /**
247
+ * Get the default subscription contract address (subscriptionsSimple)
248
+ * This is the recommended contract for subscriptions as it works on both networks
249
+ * @returns The subscriptionsSimple contract address for the current network
250
+ */
251
+ declare function getDefaultSubscriptionAddress(): string;
252
+ /**
253
+ * Get fee wallets for the current network environment
254
+ * Reads ZUBARI_NETWORK from environment variables
255
+ * @returns Fee wallet configurations for the current network
256
+ */
257
+ declare function getCurrentFeeWallets(): Record<SupportedFeeChain, FeeWalletConfig>;
258
+ /**
259
+ * Get a specific fee wallet for the current network environment
260
+ * @param chain - The blockchain to get the fee wallet for
261
+ * @returns Fee wallet configuration for the specified chain
262
+ */
263
+ declare function getCurrentFeeWallet(chain: SupportedFeeChain): FeeWalletConfig;
264
+ /**
265
+ * Get currency addresses for the current network environment
266
+ * @returns Currency addresses (ETH, USDT) for the current network
267
+ */
268
+ declare function getCurrentCurrencyAddresses(): {
269
+ ETH: string;
270
+ USDT: string;
271
+ };
272
+
273
+ export { CURRENCY_ADDRESSES as C, DEFAULT_CONTRACTS as D, type FeeWalletConfig as F, MAINNET_FEE_WALLETS as M, NFT_VOUCHER_DOMAIN as N, PLATFORM_CONFIG as P, type SupportedFeeChain as S, TESTNET_FEE_WALLETS as T, ZubariWallet as Z, ZUBARI_CONTRACTS as a, ZERO_ADDRESS as b, NFT_VOUCHER_TYPES as c, getCurrentContractAddresses as d, getDefaultSubscriptionAddress as e, getCurrentFeeWallets as f, getContractAddresses as g, getCurrentFeeWallet as h, getCurrentCurrencyAddresses as i, getFeeWallet as j, getAllFeeWallets as k, type ContractAddresses as l };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-QLZi5YRN.mjs';
1
+ export { C as CURRENCY_ADDRESSES, l as ContractAddresses, D as DEFAULT_CONTRACTS, F as FeeWalletConfig, M as MAINNET_FEE_WALLETS, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, S as SupportedFeeChain, T as TESTNET_FEE_WALLETS, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, k as getAllFeeWallets, g as getContractAddresses, d as getCurrentContractAddresses, i as getCurrentCurrencyAddresses, h as getCurrentFeeWallet, f as getCurrentFeeWallets, e as getDefaultSubscriptionAddress, j as getFeeWallet } from './contracts-BahTuxZj.mjs';
2
2
  export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, b as WalletManager, W as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-j0tgNIKi.mjs';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
4
4
  export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from './PayoutsProtocol-CLiMFe54.mjs';
@@ -58,6 +58,66 @@ declare class KeyManager {
58
58
  static generateBackupKey(): string;
59
59
  }
60
60
 
61
+ /**
62
+ * Network environment configuration for Zubari SDK
63
+ *
64
+ * This module provides utilities to read the network environment from
65
+ * environment variables and determine whether to use testnet or mainnet
66
+ * configurations throughout the SDK.
67
+ *
68
+ * Usage:
69
+ * - Set ZUBARI_NETWORK=testnet for development (default)
70
+ * - Set ZUBARI_NETWORK=mainnet for production
71
+ * - For Next.js, use NEXT_PUBLIC_ZUBARI_NETWORK
72
+ */
73
+ type ZubariNetworkEnv = 'testnet' | 'mainnet';
74
+ /**
75
+ * Get current network from environment variables
76
+ *
77
+ * Priority order:
78
+ * 1. ZUBARI_NETWORK (Node.js / Backend)
79
+ * 2. NEXT_PUBLIC_ZUBARI_NETWORK (Next.js / Frontend)
80
+ * 3. 'testnet' (default - safe fallback)
81
+ *
82
+ * @returns The current network environment
83
+ */
84
+ declare function getZubariNetwork(): ZubariNetworkEnv;
85
+ /**
86
+ * Check if currently running on mainnet
87
+ * @returns true if ZUBARI_NETWORK is 'mainnet'
88
+ */
89
+ declare function isMainnet(): boolean;
90
+ /**
91
+ * Check if currently running on testnet
92
+ * @returns true if ZUBARI_NETWORK is 'testnet' or not set
93
+ */
94
+ declare function isTestnet(): boolean;
95
+ /**
96
+ * Get the Ethereum chain ID for the current network
97
+ * @returns 1 for mainnet, 11155111 for Sepolia testnet
98
+ */
99
+ declare function getChainId(): number;
100
+ /**
101
+ * Get the network name for display purposes
102
+ * @returns Human-readable network name
103
+ */
104
+ declare function getNetworkName(): string;
105
+ /**
106
+ * Get the block explorer URL for the current network
107
+ * @returns Etherscan URL for the current network
108
+ */
109
+ declare function getExplorerUrl(): string;
110
+ /**
111
+ * Get the RPC URL for the current network
112
+ * @returns Public RPC URL for the current network
113
+ */
114
+ declare function getRpcUrl(): string;
115
+ /**
116
+ * Log a warning about the current network environment
117
+ * Useful for debugging and ensuring correct network usage
118
+ */
119
+ declare function logNetworkStatus(): void;
120
+
61
121
  /**
62
122
  * Utility functions for wallet operations
63
123
  */
@@ -78,4 +138,4 @@ declare function isValidAddress(address: string): boolean;
78
138
  */
79
139
  declare function normalizeAddress(address: string): string;
80
140
 
81
- export { KeyManager, formatAddress, formatBalance, isValidAddress, normalizeAddress };
141
+ export { KeyManager, type ZubariNetworkEnv, formatAddress, formatBalance, getChainId, getExplorerUrl, getNetworkName, getRpcUrl, getZubariNetwork, isMainnet, isTestnet, isValidAddress, logNetworkStatus, normalizeAddress };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-BnlkQ9B6.js';
1
+ export { C as CURRENCY_ADDRESSES, l as ContractAddresses, D as DEFAULT_CONTRACTS, F as FeeWalletConfig, M as MAINNET_FEE_WALLETS, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, S as SupportedFeeChain, T as TESTNET_FEE_WALLETS, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, k as getAllFeeWallets, g as getContractAddresses, d as getCurrentContractAddresses, i as getCurrentCurrencyAddresses, h as getCurrentFeeWallet, f as getCurrentFeeWallets, e as getDefaultSubscriptionAddress, j as getFeeWallet } from './contracts-D7rVmNJy.js';
2
2
  export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, b as WalletManager, W as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DfvFJ-mk.js';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
4
4
  export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from './PayoutsProtocol-B5z8SEA-.js';
@@ -58,6 +58,66 @@ declare class KeyManager {
58
58
  static generateBackupKey(): string;
59
59
  }
60
60
 
61
+ /**
62
+ * Network environment configuration for Zubari SDK
63
+ *
64
+ * This module provides utilities to read the network environment from
65
+ * environment variables and determine whether to use testnet or mainnet
66
+ * configurations throughout the SDK.
67
+ *
68
+ * Usage:
69
+ * - Set ZUBARI_NETWORK=testnet for development (default)
70
+ * - Set ZUBARI_NETWORK=mainnet for production
71
+ * - For Next.js, use NEXT_PUBLIC_ZUBARI_NETWORK
72
+ */
73
+ type ZubariNetworkEnv = 'testnet' | 'mainnet';
74
+ /**
75
+ * Get current network from environment variables
76
+ *
77
+ * Priority order:
78
+ * 1. ZUBARI_NETWORK (Node.js / Backend)
79
+ * 2. NEXT_PUBLIC_ZUBARI_NETWORK (Next.js / Frontend)
80
+ * 3. 'testnet' (default - safe fallback)
81
+ *
82
+ * @returns The current network environment
83
+ */
84
+ declare function getZubariNetwork(): ZubariNetworkEnv;
85
+ /**
86
+ * Check if currently running on mainnet
87
+ * @returns true if ZUBARI_NETWORK is 'mainnet'
88
+ */
89
+ declare function isMainnet(): boolean;
90
+ /**
91
+ * Check if currently running on testnet
92
+ * @returns true if ZUBARI_NETWORK is 'testnet' or not set
93
+ */
94
+ declare function isTestnet(): boolean;
95
+ /**
96
+ * Get the Ethereum chain ID for the current network
97
+ * @returns 1 for mainnet, 11155111 for Sepolia testnet
98
+ */
99
+ declare function getChainId(): number;
100
+ /**
101
+ * Get the network name for display purposes
102
+ * @returns Human-readable network name
103
+ */
104
+ declare function getNetworkName(): string;
105
+ /**
106
+ * Get the block explorer URL for the current network
107
+ * @returns Etherscan URL for the current network
108
+ */
109
+ declare function getExplorerUrl(): string;
110
+ /**
111
+ * Get the RPC URL for the current network
112
+ * @returns Public RPC URL for the current network
113
+ */
114
+ declare function getRpcUrl(): string;
115
+ /**
116
+ * Log a warning about the current network environment
117
+ * Useful for debugging and ensuring correct network usage
118
+ */
119
+ declare function logNetworkStatus(): void;
120
+
61
121
  /**
62
122
  * Utility functions for wallet operations
63
123
  */
@@ -78,4 +138,4 @@ declare function isValidAddress(address: string): boolean;
78
138
  */
79
139
  declare function normalizeAddress(address: string): string;
80
140
 
81
- export { KeyManager, formatAddress, formatBalance, isValidAddress, normalizeAddress };
141
+ export { KeyManager, type ZubariNetworkEnv, formatAddress, formatBalance, getChainId, getExplorerUrl, getNetworkName, getRpcUrl, getZubariNetwork, isMainnet, isTestnet, isValidAddress, logNetworkStatus, normalizeAddress };