@zubari/sdk 0.3.2 → 0.3.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/README.md +7 -0
- package/dist/{WalletManager-CEjN-YBF.d.ts → WalletManager-CmiNyapl.d.ts} +1 -1
- package/dist/{WalletManager-bo35aHOJ.d.mts → WalletManager-DXt6vihp.d.mts} +1 -1
- package/dist/{index-BpjMiC3n.d.ts → index-CGsF4p5I.d.ts} +1 -1
- package/dist/{index-DJnsirV5.d.mts → index-DwC0brJU.d.mts} +1 -1
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -241
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -241
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/wallet/index.d.mts +2 -2
- package/dist/wallet/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -317,8 +317,15 @@ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md)
|
|
|
317
317
|
|
|
318
318
|
MIT - see [LICENSE](LICENSE) for details.
|
|
319
319
|
|
|
320
|
+
## Architecture
|
|
321
|
+
|
|
322
|
+
For detailed architecture documentation including WDK integration, protocol design, and API patterns, see **[ARCHITECTURE.md](./ARCHITECTURE.md)**.
|
|
323
|
+
|
|
320
324
|
## Links
|
|
321
325
|
|
|
326
|
+
- [Architecture Documentation](./ARCHITECTURE.md)
|
|
322
327
|
- [GitHub Repository](https://github.com/zubaridev/Zubari-wallet)
|
|
323
328
|
- [Documentation](https://zubari-wallet-api.vercel.app/demo)
|
|
324
329
|
- [Tether WDK](https://docs.wallet.tether.io)
|
|
330
|
+
- [Zubari Frontend](../../../Zubari-frontend/ARCHITECTURE.md)
|
|
331
|
+
- [Zubari Backend](../../../Zubari-backend/backend/ARCHITECTURE.md)
|
|
@@ -6067,4 +6067,4 @@ declare class WalletManager {
|
|
|
6067
6067
|
}>;
|
|
6068
6068
|
}
|
|
6069
6069
|
|
|
6070
|
-
export { type ChainBalance as C, DERIVATION_PATHS as D, type MultiChainAddresses as M, NETWORKS as N, SUPPORTED_CHAINS as S, TESTNET_NETWORKS as T,
|
|
6070
|
+
export { type ChainBalance as C, DERIVATION_PATHS as D, type MultiChainAddresses as M, NETWORKS as N, SUPPORTED_CHAINS as S, TESTNET_NETWORKS as T, type WalletManagerConfig as W, type WalletState as a, WalletManager as b, getNetworkConfig as g };
|
|
@@ -6067,4 +6067,4 @@ declare class WalletManager {
|
|
|
6067
6067
|
}>;
|
|
6068
6068
|
}
|
|
6069
6069
|
|
|
6070
|
-
export { type ChainBalance as C, DERIVATION_PATHS as D, type MultiChainAddresses as M, NETWORKS as N, SUPPORTED_CHAINS as S, TESTNET_NETWORKS as T,
|
|
6070
|
+
export { type ChainBalance as C, DERIVATION_PATHS as D, type MultiChainAddresses as M, NETWORKS as N, SUPPORTED_CHAINS as S, TESTNET_NETWORKS as T, type WalletManagerConfig as W, type WalletState as a, WalletManager as b, getNetworkConfig as g };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as ZubariWalletConfig, a as NetworkType, A as Account, b as NetworkBalance, S as SendParams, c as TxResult } from './index-DF0Gf8NK.js';
|
|
2
|
-
import './WalletManager-
|
|
2
|
+
import './WalletManager-CmiNyapl.js';
|
|
3
3
|
|
|
4
4
|
interface ContractAddresses {
|
|
5
5
|
registry: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as ZubariWalletConfig, a as NetworkType, A as Account, b as NetworkBalance, S as SendParams, c as TxResult } from './index-DF0Gf8NK.mjs';
|
|
2
|
-
import './WalletManager-
|
|
2
|
+
import './WalletManager-DXt6vihp.mjs';
|
|
3
3
|
|
|
4
4
|
interface ContractAddresses {
|
|
5
5
|
registry: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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-
|
|
2
|
-
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS,
|
|
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-DwC0brJU.mjs';
|
|
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-DXt6vihp.mjs';
|
|
3
3
|
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
|
|
4
4
|
export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.mjs';
|
|
5
5
|
export { B as BrowserAddressDerivation, l as ChainAddress, m as ChainBalance, v as FeeEstimate, F as FeeRates, M as MultiChainAddresses, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, W as WdkApiClient, Z as ZubariWdkService, o as ZubariWdkServiceConfig, r as createTransactionService, i as createZubariWdkService, q as getTransactionService, g as getWdkApiClient, h as getZubariWdkService, j as isBrowser } from './TransactionService-DuMJmrG3.mjs';
|
|
6
6
|
export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, N as NFTCurrency, e as NFTMetadata, b as NetworkBalance, a as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, c as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-DF0Gf8NK.mjs';
|
|
7
|
-
export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.mjs';
|
|
8
7
|
import 'abitype';
|
|
9
8
|
import 'viem';
|
|
10
9
|
import 'ethers';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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-
|
|
2
|
-
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS,
|
|
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-CGsF4p5I.js';
|
|
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-CmiNyapl.js';
|
|
3
3
|
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
|
|
4
4
|
export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.js';
|
|
5
5
|
export { B as BrowserAddressDerivation, l as ChainAddress, m as ChainBalance, v as FeeEstimate, F as FeeRates, M as MultiChainAddresses, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, W as WdkApiClient, Z as ZubariWdkService, o as ZubariWdkServiceConfig, r as createTransactionService, i as createZubariWdkService, q as getTransactionService, g as getWdkApiClient, h as getZubariWdkService, j as isBrowser } from './TransactionService-DURp3bRL.js';
|
|
6
6
|
export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, N as NFTCurrency, e as NFTMetadata, b as NetworkBalance, a as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, c as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-DF0Gf8NK.js';
|
|
7
|
-
export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.js';
|
|
8
7
|
import 'abitype';
|
|
9
8
|
import 'viem';
|
|
10
9
|
import 'ethers';
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var sha256 = require('@noble/hashes/sha256');
|
|
|
9
9
|
var ripemd160 = require('@noble/hashes/ripemd160');
|
|
10
10
|
var viem = require('viem');
|
|
11
11
|
var chains = require('viem/chains');
|
|
12
|
-
var react = require('react');
|
|
13
12
|
|
|
14
13
|
var __defProp = Object.defineProperty;
|
|
15
14
|
var __export = (target, all) => {
|
|
@@ -7452,245 +7451,6 @@ var ZubariError = class extends Error {
|
|
|
7452
7451
|
this.name = "ZubariError";
|
|
7453
7452
|
}
|
|
7454
7453
|
};
|
|
7455
|
-
function useWalletManager(options = {}) {
|
|
7456
|
-
const { autoCheckWallet = true, ...config } = options;
|
|
7457
|
-
const manager = react.useMemo(() => new WalletManager(config), [
|
|
7458
|
-
config.network,
|
|
7459
|
-
config.rpcUrl
|
|
7460
|
-
]);
|
|
7461
|
-
const [state, setState] = react.useState({
|
|
7462
|
-
isInitialized: false,
|
|
7463
|
-
isLocked: true,
|
|
7464
|
-
address: null,
|
|
7465
|
-
balance: null
|
|
7466
|
-
});
|
|
7467
|
-
const [isLoading, setIsLoading] = react.useState(false);
|
|
7468
|
-
const [error, setError] = react.useState(null);
|
|
7469
|
-
const [selectedChain, setSelectedChainState] = react.useState("ethereum");
|
|
7470
|
-
const [chainBalances, setChainBalances] = react.useState([]);
|
|
7471
|
-
const updateState = react.useCallback(() => {
|
|
7472
|
-
setState(manager.getExtendedState());
|
|
7473
|
-
}, [manager]);
|
|
7474
|
-
react.useEffect(() => {
|
|
7475
|
-
if (autoCheckWallet) {
|
|
7476
|
-
manager.hasWallet().then((exists) => {
|
|
7477
|
-
if (exists) {
|
|
7478
|
-
setState((prev) => ({
|
|
7479
|
-
...prev,
|
|
7480
|
-
isInitialized: true,
|
|
7481
|
-
isLocked: true
|
|
7482
|
-
}));
|
|
7483
|
-
}
|
|
7484
|
-
});
|
|
7485
|
-
}
|
|
7486
|
-
}, [manager, autoCheckWallet]);
|
|
7487
|
-
const createWallet = react.useCallback(
|
|
7488
|
-
async (password) => {
|
|
7489
|
-
setIsLoading(true);
|
|
7490
|
-
setError(null);
|
|
7491
|
-
try {
|
|
7492
|
-
await manager.initializeStorage(password);
|
|
7493
|
-
const result = await manager.createWallet(password);
|
|
7494
|
-
try {
|
|
7495
|
-
await manager.deriveAllAddressesAsync();
|
|
7496
|
-
} catch {
|
|
7497
|
-
manager.deriveAllAddresses();
|
|
7498
|
-
}
|
|
7499
|
-
updateState();
|
|
7500
|
-
try {
|
|
7501
|
-
const balances = await manager.fetchAllBalances();
|
|
7502
|
-
setChainBalances(balances);
|
|
7503
|
-
} catch (err) {
|
|
7504
|
-
console.warn("Failed to fetch balances after create:", err);
|
|
7505
|
-
}
|
|
7506
|
-
return result;
|
|
7507
|
-
} catch (err) {
|
|
7508
|
-
const message = err instanceof Error ? err.message : "Failed to create wallet";
|
|
7509
|
-
setError(message);
|
|
7510
|
-
throw err;
|
|
7511
|
-
} finally {
|
|
7512
|
-
setIsLoading(false);
|
|
7513
|
-
}
|
|
7514
|
-
},
|
|
7515
|
-
[manager, updateState]
|
|
7516
|
-
);
|
|
7517
|
-
const importWallet = react.useCallback(
|
|
7518
|
-
async (seed, password) => {
|
|
7519
|
-
setIsLoading(true);
|
|
7520
|
-
setError(null);
|
|
7521
|
-
try {
|
|
7522
|
-
await manager.initializeStorage(password);
|
|
7523
|
-
await manager.importWallet(seed, password);
|
|
7524
|
-
try {
|
|
7525
|
-
await manager.deriveAllAddressesAsync();
|
|
7526
|
-
} catch {
|
|
7527
|
-
manager.deriveAllAddresses();
|
|
7528
|
-
}
|
|
7529
|
-
updateState();
|
|
7530
|
-
try {
|
|
7531
|
-
const balances = await manager.fetchAllBalances();
|
|
7532
|
-
setChainBalances(balances);
|
|
7533
|
-
} catch (err) {
|
|
7534
|
-
console.warn("Failed to fetch balances after import:", err);
|
|
7535
|
-
}
|
|
7536
|
-
} catch (err) {
|
|
7537
|
-
const message = err instanceof Error ? err.message : "Failed to import wallet";
|
|
7538
|
-
setError(message);
|
|
7539
|
-
throw err;
|
|
7540
|
-
} finally {
|
|
7541
|
-
setIsLoading(false);
|
|
7542
|
-
}
|
|
7543
|
-
},
|
|
7544
|
-
[manager, updateState]
|
|
7545
|
-
);
|
|
7546
|
-
const unlock = react.useCallback(
|
|
7547
|
-
async (password) => {
|
|
7548
|
-
setIsLoading(true);
|
|
7549
|
-
setError(null);
|
|
7550
|
-
try {
|
|
7551
|
-
await manager.initializeStorage(password);
|
|
7552
|
-
await manager.unlock(password);
|
|
7553
|
-
try {
|
|
7554
|
-
await manager.deriveAllAddressesAsync();
|
|
7555
|
-
} catch {
|
|
7556
|
-
manager.deriveAllAddresses();
|
|
7557
|
-
}
|
|
7558
|
-
updateState();
|
|
7559
|
-
try {
|
|
7560
|
-
const balances = await manager.fetchAllBalances();
|
|
7561
|
-
setChainBalances(balances);
|
|
7562
|
-
} catch (err) {
|
|
7563
|
-
console.warn("Failed to fetch balances after unlock:", err);
|
|
7564
|
-
}
|
|
7565
|
-
} catch (err) {
|
|
7566
|
-
const message = err instanceof Error ? err.message : "Invalid password";
|
|
7567
|
-
setError(message);
|
|
7568
|
-
throw err;
|
|
7569
|
-
} finally {
|
|
7570
|
-
setIsLoading(false);
|
|
7571
|
-
}
|
|
7572
|
-
},
|
|
7573
|
-
[manager, updateState]
|
|
7574
|
-
);
|
|
7575
|
-
const lock = react.useCallback(() => {
|
|
7576
|
-
manager.lock();
|
|
7577
|
-
setChainBalances([]);
|
|
7578
|
-
updateState();
|
|
7579
|
-
}, [manager, updateState]);
|
|
7580
|
-
const deleteWallet = react.useCallback(async () => {
|
|
7581
|
-
setIsLoading(true);
|
|
7582
|
-
setError(null);
|
|
7583
|
-
try {
|
|
7584
|
-
await manager.deleteWallet();
|
|
7585
|
-
setChainBalances([]);
|
|
7586
|
-
setState({
|
|
7587
|
-
isInitialized: false,
|
|
7588
|
-
isLocked: true,
|
|
7589
|
-
address: null,
|
|
7590
|
-
balance: null
|
|
7591
|
-
});
|
|
7592
|
-
} catch (err) {
|
|
7593
|
-
const message = err instanceof Error ? err.message : "Failed to delete wallet";
|
|
7594
|
-
setError(message);
|
|
7595
|
-
throw err;
|
|
7596
|
-
} finally {
|
|
7597
|
-
setIsLoading(false);
|
|
7598
|
-
}
|
|
7599
|
-
}, [manager]);
|
|
7600
|
-
const fetchBalance = react.useCallback(async () => {
|
|
7601
|
-
setIsLoading(true);
|
|
7602
|
-
try {
|
|
7603
|
-
const balance = await manager.fetchBalance();
|
|
7604
|
-
setState((prev) => ({ ...prev, balance }));
|
|
7605
|
-
return balance;
|
|
7606
|
-
} catch (err) {
|
|
7607
|
-
console.warn("Failed to fetch balance:", err);
|
|
7608
|
-
setState((prev) => ({ ...prev, balance: "0" }));
|
|
7609
|
-
return "0";
|
|
7610
|
-
} finally {
|
|
7611
|
-
setIsLoading(false);
|
|
7612
|
-
}
|
|
7613
|
-
}, [manager]);
|
|
7614
|
-
const fetchAllBalances = react.useCallback(async () => {
|
|
7615
|
-
setIsLoading(true);
|
|
7616
|
-
try {
|
|
7617
|
-
const balances = await manager.fetchAllBalances();
|
|
7618
|
-
setChainBalances(balances);
|
|
7619
|
-
return balances;
|
|
7620
|
-
} catch (err) {
|
|
7621
|
-
console.warn("Failed to fetch all balances:", err);
|
|
7622
|
-
return [];
|
|
7623
|
-
} finally {
|
|
7624
|
-
setIsLoading(false);
|
|
7625
|
-
}
|
|
7626
|
-
}, [manager]);
|
|
7627
|
-
const setSelectedChain = react.useCallback((chain) => {
|
|
7628
|
-
manager.setSelectedChain(chain);
|
|
7629
|
-
setSelectedChainState(chain);
|
|
7630
|
-
}, [manager]);
|
|
7631
|
-
const getAddressForChain = react.useCallback(
|
|
7632
|
-
(chain) => manager.getAddressForChain(chain),
|
|
7633
|
-
[manager]
|
|
7634
|
-
);
|
|
7635
|
-
const getAllAddresses = react.useCallback(
|
|
7636
|
-
() => manager.getAllAddresses(),
|
|
7637
|
-
[manager]
|
|
7638
|
-
);
|
|
7639
|
-
const hasWallet = react.useCallback(() => manager.hasWallet(), [manager]);
|
|
7640
|
-
const getSeed = react.useCallback(() => manager.getSeed(), [manager]);
|
|
7641
|
-
const sendTransaction = react.useCallback(
|
|
7642
|
-
async (chain, to, amount, token) => {
|
|
7643
|
-
setIsLoading(true);
|
|
7644
|
-
try {
|
|
7645
|
-
const result = await manager.sendTransaction(chain, to, amount, token);
|
|
7646
|
-
if (result.success) {
|
|
7647
|
-
try {
|
|
7648
|
-
const balances = await manager.fetchAllBalances();
|
|
7649
|
-
setChainBalances(balances);
|
|
7650
|
-
} catch (err) {
|
|
7651
|
-
console.warn("Failed to refresh balances after transaction:", err);
|
|
7652
|
-
}
|
|
7653
|
-
}
|
|
7654
|
-
return result;
|
|
7655
|
-
} finally {
|
|
7656
|
-
setIsLoading(false);
|
|
7657
|
-
}
|
|
7658
|
-
},
|
|
7659
|
-
[manager]
|
|
7660
|
-
);
|
|
7661
|
-
const estimateFee = react.useCallback(
|
|
7662
|
-
async (chain, to, amount, token) => {
|
|
7663
|
-
return manager.estimateFee(chain, to, amount, token);
|
|
7664
|
-
},
|
|
7665
|
-
[manager]
|
|
7666
|
-
);
|
|
7667
|
-
return {
|
|
7668
|
-
state,
|
|
7669
|
-
isLoading,
|
|
7670
|
-
error,
|
|
7671
|
-
createWallet,
|
|
7672
|
-
importWallet,
|
|
7673
|
-
unlock,
|
|
7674
|
-
lock,
|
|
7675
|
-
deleteWallet,
|
|
7676
|
-
fetchBalance,
|
|
7677
|
-
// Multi-chain
|
|
7678
|
-
selectedChain,
|
|
7679
|
-
setSelectedChain,
|
|
7680
|
-
chainBalances,
|
|
7681
|
-
fetchAllBalances,
|
|
7682
|
-
getAddressForChain,
|
|
7683
|
-
getAllAddresses,
|
|
7684
|
-
supportedChains: SUPPORTED_CHAINS,
|
|
7685
|
-
// Transaction Actions (Powered by Tether WDK)
|
|
7686
|
-
sendTransaction,
|
|
7687
|
-
estimateFee,
|
|
7688
|
-
// Utilities
|
|
7689
|
-
hasWallet,
|
|
7690
|
-
getSeed,
|
|
7691
|
-
manager
|
|
7692
|
-
};
|
|
7693
|
-
}
|
|
7694
7454
|
|
|
7695
7455
|
// src/utils/index.ts
|
|
7696
7456
|
function formatAddress(address, chars = 4) {
|
|
@@ -7752,6 +7512,5 @@ exports.getZubariWdkService = getZubariWdkService;
|
|
|
7752
7512
|
exports.isBrowser = isBrowser;
|
|
7753
7513
|
exports.isValidAddress = isValidAddress;
|
|
7754
7514
|
exports.normalizeAddress = normalizeAddress;
|
|
7755
|
-
exports.useWalletManager = useWalletManager;
|
|
7756
7515
|
//# sourceMappingURL=index.js.map
|
|
7757
7516
|
//# sourceMappingURL=index.js.map
|