@zubari/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +324 -0
- package/dist/SecureStorage-jO783AhC.d.mts +89 -0
- package/dist/SecureStorage-jO783AhC.d.ts +89 -0
- package/dist/SwapService-C0G8IXW2.d.mts +35 -0
- package/dist/SwapService-DZD0OJI_.d.ts +35 -0
- package/dist/WalletManager-DJjdq89b.d.mts +6106 -0
- package/dist/WalletManager-TiAdzqrn.d.ts +6106 -0
- package/dist/index-BLuxEdLp.d.mts +156 -0
- package/dist/index-BLuxEdLp.d.ts +156 -0
- package/dist/index-DO3T2HVe.d.ts +135 -0
- package/dist/index-fXVD8_D0.d.mts +135 -0
- package/dist/index.d.mts +67 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +2411 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2386 -0
- package/dist/index.mjs.map +1 -0
- package/dist/protocols/index.d.mts +181 -0
- package/dist/protocols/index.d.ts +181 -0
- package/dist/protocols/index.js +415 -0
- package/dist/protocols/index.js.map +1 -0
- package/dist/protocols/index.mjs +410 -0
- package/dist/protocols/index.mjs.map +1 -0
- package/dist/react/index.d.mts +49 -0
- package/dist/react/index.d.ts +49 -0
- package/dist/react/index.js +1573 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +1570 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/services/index.d.mts +198 -0
- package/dist/services/index.d.ts +198 -0
- package/dist/services/index.js +554 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/index.mjs +547 -0
- package/dist/services/index.mjs.map +1 -0
- package/dist/storage/index.d.mts +57 -0
- package/dist/storage/index.d.ts +57 -0
- package/dist/storage/index.js +442 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/index.mjs +435 -0
- package/dist/storage/index.mjs.map +1 -0
- package/dist/wallet/index.d.mts +8 -0
- package/dist/wallet/index.d.ts +8 -0
- package/dist/wallet/index.js +1678 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/index.mjs +1674 -0
- package/dist/wallet/index.mjs.map +1 -0
- package/package.json +136 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
type NetworkType = 'bitcoin' | 'ethereum' | 'ton' | 'tron' | 'solana' | 'spark';
|
|
2
|
+
interface ZubariWalletConfig {
|
|
3
|
+
network: 'mainnet' | 'testnet';
|
|
4
|
+
enabledNetworks: NetworkType[];
|
|
5
|
+
gasless: boolean;
|
|
6
|
+
paymasterUrl?: string;
|
|
7
|
+
bundlerUrl?: string;
|
|
8
|
+
rpcUrls?: Partial<Record<NetworkType, string>>;
|
|
9
|
+
}
|
|
10
|
+
interface TokenBalance {
|
|
11
|
+
symbol: string;
|
|
12
|
+
address: string;
|
|
13
|
+
balance: bigint;
|
|
14
|
+
balanceFormatted: string;
|
|
15
|
+
balanceUsd: number;
|
|
16
|
+
decimals: number;
|
|
17
|
+
}
|
|
18
|
+
interface NetworkBalance {
|
|
19
|
+
network: NetworkType;
|
|
20
|
+
native: {
|
|
21
|
+
symbol: string;
|
|
22
|
+
balance: bigint;
|
|
23
|
+
balanceFormatted: string;
|
|
24
|
+
balanceUsd: number;
|
|
25
|
+
};
|
|
26
|
+
tokens: TokenBalance[];
|
|
27
|
+
}
|
|
28
|
+
interface TxResult {
|
|
29
|
+
hash: string;
|
|
30
|
+
network: NetworkType;
|
|
31
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
32
|
+
blockNumber?: number;
|
|
33
|
+
gasUsed?: bigint;
|
|
34
|
+
error?: string;
|
|
35
|
+
metadata?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
interface SendParams {
|
|
38
|
+
to: string;
|
|
39
|
+
amount: bigint;
|
|
40
|
+
token?: string;
|
|
41
|
+
gasless?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface Account {
|
|
44
|
+
network: NetworkType;
|
|
45
|
+
address: string;
|
|
46
|
+
publicKey: string;
|
|
47
|
+
derivationPath: string;
|
|
48
|
+
}
|
|
49
|
+
interface NFTMetadata {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
image: string;
|
|
53
|
+
attributes?: Array<{
|
|
54
|
+
trait_type: string;
|
|
55
|
+
value: string | number;
|
|
56
|
+
}>;
|
|
57
|
+
royaltyBps: number;
|
|
58
|
+
}
|
|
59
|
+
interface LazyMintVoucher {
|
|
60
|
+
tokenId: string;
|
|
61
|
+
uri: string;
|
|
62
|
+
creator: string;
|
|
63
|
+
royaltyBps: number;
|
|
64
|
+
deadline: number;
|
|
65
|
+
signature: string;
|
|
66
|
+
}
|
|
67
|
+
interface NFT {
|
|
68
|
+
tokenId: string;
|
|
69
|
+
contractAddress: string;
|
|
70
|
+
owner: string;
|
|
71
|
+
creator: string;
|
|
72
|
+
uri: string;
|
|
73
|
+
metadata?: NFTMetadata;
|
|
74
|
+
isLazyMinted: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface ListingParams {
|
|
77
|
+
tokenId: string;
|
|
78
|
+
price: bigint;
|
|
79
|
+
paymentToken: string;
|
|
80
|
+
duration: number;
|
|
81
|
+
}
|
|
82
|
+
interface TipData {
|
|
83
|
+
recipient: string;
|
|
84
|
+
amount: bigint;
|
|
85
|
+
token: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
}
|
|
88
|
+
interface TipResult {
|
|
89
|
+
txHash: string;
|
|
90
|
+
tipId: string;
|
|
91
|
+
recipient: string;
|
|
92
|
+
amount: bigint;
|
|
93
|
+
platformFee: bigint;
|
|
94
|
+
timestamp: number;
|
|
95
|
+
}
|
|
96
|
+
interface TipStats {
|
|
97
|
+
totalReceived: bigint;
|
|
98
|
+
tipCount: number;
|
|
99
|
+
uniqueTippers: number;
|
|
100
|
+
}
|
|
101
|
+
interface SubscriptionPlan {
|
|
102
|
+
planId?: string;
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
price: bigint;
|
|
106
|
+
paymentToken: string;
|
|
107
|
+
duration: number;
|
|
108
|
+
perks: string[];
|
|
109
|
+
maxSubscribers?: number;
|
|
110
|
+
nftBadge: boolean;
|
|
111
|
+
}
|
|
112
|
+
interface Subscription {
|
|
113
|
+
subscriptionId: string;
|
|
114
|
+
planId: string;
|
|
115
|
+
creator: string;
|
|
116
|
+
subscriber: string;
|
|
117
|
+
startTime: number;
|
|
118
|
+
endTime: number;
|
|
119
|
+
autoRenew: boolean;
|
|
120
|
+
status: 'active' | 'expired' | 'cancelled';
|
|
121
|
+
}
|
|
122
|
+
interface EarningsBreakdown {
|
|
123
|
+
tips: bigint;
|
|
124
|
+
subscriptions: bigint;
|
|
125
|
+
nftSales: bigint;
|
|
126
|
+
royalties: bigint;
|
|
127
|
+
total: bigint;
|
|
128
|
+
}
|
|
129
|
+
interface RevenueSplit {
|
|
130
|
+
recipient: string;
|
|
131
|
+
basisPoints: number;
|
|
132
|
+
}
|
|
133
|
+
interface SwapQuote {
|
|
134
|
+
tokenIn: string;
|
|
135
|
+
tokenOut: string;
|
|
136
|
+
amountIn: bigint;
|
|
137
|
+
amountOut: bigint;
|
|
138
|
+
priceImpact: number;
|
|
139
|
+
route: string[];
|
|
140
|
+
estimatedGas: bigint;
|
|
141
|
+
}
|
|
142
|
+
interface SwapParams {
|
|
143
|
+
tokenIn: string;
|
|
144
|
+
tokenOut: string;
|
|
145
|
+
amountIn: bigint;
|
|
146
|
+
minAmountOut: bigint;
|
|
147
|
+
deadline: number;
|
|
148
|
+
}
|
|
149
|
+
type ZubariErrorCode = 'TX_FAILED' | 'AUTH_EXPIRED' | 'RPC_ERROR' | 'VOUCHER_EXPIRED' | 'SLIPPAGE_ERROR' | 'RATE_LIMITED' | 'UPLOAD_ERROR' | 'INSUFFICIENT_FUNDS' | 'INVALID_SIGNATURE' | 'UNSUPPORTED_NETWORK' | 'UNKNOWN_ERROR';
|
|
150
|
+
declare class ZubariError extends Error {
|
|
151
|
+
readonly code: ZubariErrorCode;
|
|
152
|
+
readonly details?: unknown | undefined;
|
|
153
|
+
constructor(code: ZubariErrorCode, message: string, details?: unknown | undefined);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { type Account as A, type EarningsBreakdown as E, type LazyMintVoucher as L, type NetworkType as N, type RevenueSplit as R, type SwapQuote as S, type TxResult as T, type ZubariWalletConfig as Z, type NetworkBalance as a, type TokenBalance as b, type SendParams as c, type NFTMetadata as d, type NFT as e, type ListingParams as f, type TipData as g, type TipResult as h, type TipStats as i, type SubscriptionPlan as j, type Subscription as k, type SwapParams as l, type ZubariErrorCode as m, ZubariError as n };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
type NetworkType = 'bitcoin' | 'ethereum' | 'ton' | 'tron' | 'solana' | 'spark';
|
|
2
|
+
interface ZubariWalletConfig {
|
|
3
|
+
network: 'mainnet' | 'testnet';
|
|
4
|
+
enabledNetworks: NetworkType[];
|
|
5
|
+
gasless: boolean;
|
|
6
|
+
paymasterUrl?: string;
|
|
7
|
+
bundlerUrl?: string;
|
|
8
|
+
rpcUrls?: Partial<Record<NetworkType, string>>;
|
|
9
|
+
}
|
|
10
|
+
interface TokenBalance {
|
|
11
|
+
symbol: string;
|
|
12
|
+
address: string;
|
|
13
|
+
balance: bigint;
|
|
14
|
+
balanceFormatted: string;
|
|
15
|
+
balanceUsd: number;
|
|
16
|
+
decimals: number;
|
|
17
|
+
}
|
|
18
|
+
interface NetworkBalance {
|
|
19
|
+
network: NetworkType;
|
|
20
|
+
native: {
|
|
21
|
+
symbol: string;
|
|
22
|
+
balance: bigint;
|
|
23
|
+
balanceFormatted: string;
|
|
24
|
+
balanceUsd: number;
|
|
25
|
+
};
|
|
26
|
+
tokens: TokenBalance[];
|
|
27
|
+
}
|
|
28
|
+
interface TxResult {
|
|
29
|
+
hash: string;
|
|
30
|
+
network: NetworkType;
|
|
31
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
32
|
+
blockNumber?: number;
|
|
33
|
+
gasUsed?: bigint;
|
|
34
|
+
error?: string;
|
|
35
|
+
metadata?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
interface SendParams {
|
|
38
|
+
to: string;
|
|
39
|
+
amount: bigint;
|
|
40
|
+
token?: string;
|
|
41
|
+
gasless?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface Account {
|
|
44
|
+
network: NetworkType;
|
|
45
|
+
address: string;
|
|
46
|
+
publicKey: string;
|
|
47
|
+
derivationPath: string;
|
|
48
|
+
}
|
|
49
|
+
interface NFTMetadata {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
image: string;
|
|
53
|
+
attributes?: Array<{
|
|
54
|
+
trait_type: string;
|
|
55
|
+
value: string | number;
|
|
56
|
+
}>;
|
|
57
|
+
royaltyBps: number;
|
|
58
|
+
}
|
|
59
|
+
interface LazyMintVoucher {
|
|
60
|
+
tokenId: string;
|
|
61
|
+
uri: string;
|
|
62
|
+
creator: string;
|
|
63
|
+
royaltyBps: number;
|
|
64
|
+
deadline: number;
|
|
65
|
+
signature: string;
|
|
66
|
+
}
|
|
67
|
+
interface NFT {
|
|
68
|
+
tokenId: string;
|
|
69
|
+
contractAddress: string;
|
|
70
|
+
owner: string;
|
|
71
|
+
creator: string;
|
|
72
|
+
uri: string;
|
|
73
|
+
metadata?: NFTMetadata;
|
|
74
|
+
isLazyMinted: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface ListingParams {
|
|
77
|
+
tokenId: string;
|
|
78
|
+
price: bigint;
|
|
79
|
+
paymentToken: string;
|
|
80
|
+
duration: number;
|
|
81
|
+
}
|
|
82
|
+
interface TipData {
|
|
83
|
+
recipient: string;
|
|
84
|
+
amount: bigint;
|
|
85
|
+
token: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
}
|
|
88
|
+
interface TipResult {
|
|
89
|
+
txHash: string;
|
|
90
|
+
tipId: string;
|
|
91
|
+
recipient: string;
|
|
92
|
+
amount: bigint;
|
|
93
|
+
platformFee: bigint;
|
|
94
|
+
timestamp: number;
|
|
95
|
+
}
|
|
96
|
+
interface TipStats {
|
|
97
|
+
totalReceived: bigint;
|
|
98
|
+
tipCount: number;
|
|
99
|
+
uniqueTippers: number;
|
|
100
|
+
}
|
|
101
|
+
interface SubscriptionPlan {
|
|
102
|
+
planId?: string;
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
price: bigint;
|
|
106
|
+
paymentToken: string;
|
|
107
|
+
duration: number;
|
|
108
|
+
perks: string[];
|
|
109
|
+
maxSubscribers?: number;
|
|
110
|
+
nftBadge: boolean;
|
|
111
|
+
}
|
|
112
|
+
interface Subscription {
|
|
113
|
+
subscriptionId: string;
|
|
114
|
+
planId: string;
|
|
115
|
+
creator: string;
|
|
116
|
+
subscriber: string;
|
|
117
|
+
startTime: number;
|
|
118
|
+
endTime: number;
|
|
119
|
+
autoRenew: boolean;
|
|
120
|
+
status: 'active' | 'expired' | 'cancelled';
|
|
121
|
+
}
|
|
122
|
+
interface EarningsBreakdown {
|
|
123
|
+
tips: bigint;
|
|
124
|
+
subscriptions: bigint;
|
|
125
|
+
nftSales: bigint;
|
|
126
|
+
royalties: bigint;
|
|
127
|
+
total: bigint;
|
|
128
|
+
}
|
|
129
|
+
interface RevenueSplit {
|
|
130
|
+
recipient: string;
|
|
131
|
+
basisPoints: number;
|
|
132
|
+
}
|
|
133
|
+
interface SwapQuote {
|
|
134
|
+
tokenIn: string;
|
|
135
|
+
tokenOut: string;
|
|
136
|
+
amountIn: bigint;
|
|
137
|
+
amountOut: bigint;
|
|
138
|
+
priceImpact: number;
|
|
139
|
+
route: string[];
|
|
140
|
+
estimatedGas: bigint;
|
|
141
|
+
}
|
|
142
|
+
interface SwapParams {
|
|
143
|
+
tokenIn: string;
|
|
144
|
+
tokenOut: string;
|
|
145
|
+
amountIn: bigint;
|
|
146
|
+
minAmountOut: bigint;
|
|
147
|
+
deadline: number;
|
|
148
|
+
}
|
|
149
|
+
type ZubariErrorCode = 'TX_FAILED' | 'AUTH_EXPIRED' | 'RPC_ERROR' | 'VOUCHER_EXPIRED' | 'SLIPPAGE_ERROR' | 'RATE_LIMITED' | 'UPLOAD_ERROR' | 'INSUFFICIENT_FUNDS' | 'INVALID_SIGNATURE' | 'UNSUPPORTED_NETWORK' | 'UNKNOWN_ERROR';
|
|
150
|
+
declare class ZubariError extends Error {
|
|
151
|
+
readonly code: ZubariErrorCode;
|
|
152
|
+
readonly details?: unknown | undefined;
|
|
153
|
+
constructor(code: ZubariErrorCode, message: string, details?: unknown | undefined);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { type Account as A, type EarningsBreakdown as E, type LazyMintVoucher as L, type NetworkType as N, type RevenueSplit as R, type SwapQuote as S, type TxResult as T, type ZubariWalletConfig as Z, type NetworkBalance as a, type TokenBalance as b, type SendParams as c, type NFTMetadata as d, type NFT as e, type ListingParams as f, type TipData as g, type TipResult as h, type TipStats as i, type SubscriptionPlan as j, type Subscription as k, type SwapParams as l, type ZubariErrorCode as m, ZubariError as n };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, c as SendParams, T as TxResult } from './index-BLuxEdLp.js';
|
|
2
|
+
import './WalletManager-TiAdzqrn.js';
|
|
3
|
+
|
|
4
|
+
interface ContractAddresses {
|
|
5
|
+
registry: string;
|
|
6
|
+
nft: string;
|
|
7
|
+
marketplace: string;
|
|
8
|
+
tips: string;
|
|
9
|
+
subscriptions: string;
|
|
10
|
+
payouts: string;
|
|
11
|
+
entryPoint: string;
|
|
12
|
+
paymaster: string;
|
|
13
|
+
accountFactory: string;
|
|
14
|
+
usdt: string;
|
|
15
|
+
weth: string;
|
|
16
|
+
}
|
|
17
|
+
declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
|
|
18
|
+
declare const PLATFORM_CONFIG: {
|
|
19
|
+
readonly tipFeeBps: 300;
|
|
20
|
+
readonly maxRoyaltyBps: 1000;
|
|
21
|
+
readonly defaultSlippageBps: 50;
|
|
22
|
+
readonly voucherValiditySecs: number;
|
|
23
|
+
readonly swapDeadlineSecs: number;
|
|
24
|
+
};
|
|
25
|
+
declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ZubariWallet - Multi-chain self-custodial wallet
|
|
29
|
+
*
|
|
30
|
+
* Core wallet class that manages accounts across multiple blockchain networks
|
|
31
|
+
* using Tether WDK as the underlying infrastructure layer.
|
|
32
|
+
*/
|
|
33
|
+
declare class ZubariWallet {
|
|
34
|
+
private readonly seed;
|
|
35
|
+
private readonly config;
|
|
36
|
+
private readonly accounts;
|
|
37
|
+
private initialized;
|
|
38
|
+
constructor(seed: string, config: ZubariWalletConfig);
|
|
39
|
+
/**
|
|
40
|
+
* Initialize the wallet by deriving accounts for all enabled networks
|
|
41
|
+
*/
|
|
42
|
+
initialize(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Derive account for a specific network using BIP-44
|
|
45
|
+
*/
|
|
46
|
+
private deriveAccount;
|
|
47
|
+
/**
|
|
48
|
+
* Get account for a specific network
|
|
49
|
+
*/
|
|
50
|
+
getAccount(network: NetworkType, index?: number): Promise<Account>;
|
|
51
|
+
/**
|
|
52
|
+
* Get address for a specific network
|
|
53
|
+
*/
|
|
54
|
+
getAddress(network: NetworkType): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Get all addresses for enabled networks
|
|
57
|
+
*/
|
|
58
|
+
getAllAddresses(): Promise<Record<NetworkType, string>>;
|
|
59
|
+
/**
|
|
60
|
+
* Get balance for a specific network
|
|
61
|
+
*/
|
|
62
|
+
getBalance(network: NetworkType): Promise<NetworkBalance>;
|
|
63
|
+
/**
|
|
64
|
+
* Get balances for all enabled networks
|
|
65
|
+
*/
|
|
66
|
+
getAllBalances(): Promise<NetworkBalance[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Get total portfolio value in USD
|
|
69
|
+
*/
|
|
70
|
+
getTotalPortfolioUsd(): Promise<number>;
|
|
71
|
+
/**
|
|
72
|
+
* Send native currency on a specific network
|
|
73
|
+
*/
|
|
74
|
+
send(network: NetworkType, params: SendParams): Promise<TxResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Send ERC-20 token on EVM networks
|
|
77
|
+
*/
|
|
78
|
+
sendToken(network: NetworkType, token: string, to: string, amount: bigint): Promise<TxResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Send Bitcoin on-chain using WalletManagerBtc
|
|
81
|
+
* @param to - Destination address (bc1q... for native segwit)
|
|
82
|
+
* @param amount - Amount in satoshis
|
|
83
|
+
*/
|
|
84
|
+
sendBitcoin(to: string, amount: bigint): Promise<TxResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Validate Bitcoin address format
|
|
87
|
+
*/
|
|
88
|
+
private isValidBitcoinAddress;
|
|
89
|
+
/**
|
|
90
|
+
* Get Bitcoin address (native segwit bc1q...)
|
|
91
|
+
*/
|
|
92
|
+
getBitcoinAddress(): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Pay Lightning invoice via Spark network
|
|
95
|
+
* Uses WDK WalletManagerSpark (m/44'/998')
|
|
96
|
+
* @param invoice - Lightning invoice string (lnbc...)
|
|
97
|
+
*/
|
|
98
|
+
sendLightning(invoice: string): Promise<TxResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Create Lightning invoice via Spark
|
|
101
|
+
* @param amount - Amount in millisatoshis
|
|
102
|
+
* @param memo - Optional payment memo
|
|
103
|
+
* @returns Lightning invoice string (lnbc...)
|
|
104
|
+
*/
|
|
105
|
+
createLightningInvoice(amount: bigint, memo?: string): Promise<string>;
|
|
106
|
+
/**
|
|
107
|
+
* Validate Lightning invoice format
|
|
108
|
+
*/
|
|
109
|
+
private isValidLightningInvoice;
|
|
110
|
+
/**
|
|
111
|
+
* Decode Lightning invoice (basic parsing)
|
|
112
|
+
*/
|
|
113
|
+
private decodeLightningInvoice;
|
|
114
|
+
/**
|
|
115
|
+
* Get Lightning (Spark) balance
|
|
116
|
+
*/
|
|
117
|
+
getLightningBalance(): Promise<{
|
|
118
|
+
available: bigint;
|
|
119
|
+
pending: bigint;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Get configuration
|
|
123
|
+
*/
|
|
124
|
+
getConfig(): ZubariWalletConfig;
|
|
125
|
+
/**
|
|
126
|
+
* Check if wallet is initialized
|
|
127
|
+
*/
|
|
128
|
+
isInitialized(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Get contract addresses for current network
|
|
131
|
+
*/
|
|
132
|
+
getContractAddresses(): ContractAddresses;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export { PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, getContractAddresses as g };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, c as SendParams, T as TxResult } from './index-BLuxEdLp.mjs';
|
|
2
|
+
import './WalletManager-DJjdq89b.mjs';
|
|
3
|
+
|
|
4
|
+
interface ContractAddresses {
|
|
5
|
+
registry: string;
|
|
6
|
+
nft: string;
|
|
7
|
+
marketplace: string;
|
|
8
|
+
tips: string;
|
|
9
|
+
subscriptions: string;
|
|
10
|
+
payouts: string;
|
|
11
|
+
entryPoint: string;
|
|
12
|
+
paymaster: string;
|
|
13
|
+
accountFactory: string;
|
|
14
|
+
usdt: string;
|
|
15
|
+
weth: string;
|
|
16
|
+
}
|
|
17
|
+
declare const ZUBARI_CONTRACTS: Record<'testnet' | 'mainnet', ContractAddresses>;
|
|
18
|
+
declare const PLATFORM_CONFIG: {
|
|
19
|
+
readonly tipFeeBps: 300;
|
|
20
|
+
readonly maxRoyaltyBps: 1000;
|
|
21
|
+
readonly defaultSlippageBps: 50;
|
|
22
|
+
readonly voucherValiditySecs: number;
|
|
23
|
+
readonly swapDeadlineSecs: number;
|
|
24
|
+
};
|
|
25
|
+
declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractAddresses;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ZubariWallet - Multi-chain self-custodial wallet
|
|
29
|
+
*
|
|
30
|
+
* Core wallet class that manages accounts across multiple blockchain networks
|
|
31
|
+
* using Tether WDK as the underlying infrastructure layer.
|
|
32
|
+
*/
|
|
33
|
+
declare class ZubariWallet {
|
|
34
|
+
private readonly seed;
|
|
35
|
+
private readonly config;
|
|
36
|
+
private readonly accounts;
|
|
37
|
+
private initialized;
|
|
38
|
+
constructor(seed: string, config: ZubariWalletConfig);
|
|
39
|
+
/**
|
|
40
|
+
* Initialize the wallet by deriving accounts for all enabled networks
|
|
41
|
+
*/
|
|
42
|
+
initialize(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Derive account for a specific network using BIP-44
|
|
45
|
+
*/
|
|
46
|
+
private deriveAccount;
|
|
47
|
+
/**
|
|
48
|
+
* Get account for a specific network
|
|
49
|
+
*/
|
|
50
|
+
getAccount(network: NetworkType, index?: number): Promise<Account>;
|
|
51
|
+
/**
|
|
52
|
+
* Get address for a specific network
|
|
53
|
+
*/
|
|
54
|
+
getAddress(network: NetworkType): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Get all addresses for enabled networks
|
|
57
|
+
*/
|
|
58
|
+
getAllAddresses(): Promise<Record<NetworkType, string>>;
|
|
59
|
+
/**
|
|
60
|
+
* Get balance for a specific network
|
|
61
|
+
*/
|
|
62
|
+
getBalance(network: NetworkType): Promise<NetworkBalance>;
|
|
63
|
+
/**
|
|
64
|
+
* Get balances for all enabled networks
|
|
65
|
+
*/
|
|
66
|
+
getAllBalances(): Promise<NetworkBalance[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Get total portfolio value in USD
|
|
69
|
+
*/
|
|
70
|
+
getTotalPortfolioUsd(): Promise<number>;
|
|
71
|
+
/**
|
|
72
|
+
* Send native currency on a specific network
|
|
73
|
+
*/
|
|
74
|
+
send(network: NetworkType, params: SendParams): Promise<TxResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Send ERC-20 token on EVM networks
|
|
77
|
+
*/
|
|
78
|
+
sendToken(network: NetworkType, token: string, to: string, amount: bigint): Promise<TxResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Send Bitcoin on-chain using WalletManagerBtc
|
|
81
|
+
* @param to - Destination address (bc1q... for native segwit)
|
|
82
|
+
* @param amount - Amount in satoshis
|
|
83
|
+
*/
|
|
84
|
+
sendBitcoin(to: string, amount: bigint): Promise<TxResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Validate Bitcoin address format
|
|
87
|
+
*/
|
|
88
|
+
private isValidBitcoinAddress;
|
|
89
|
+
/**
|
|
90
|
+
* Get Bitcoin address (native segwit bc1q...)
|
|
91
|
+
*/
|
|
92
|
+
getBitcoinAddress(): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Pay Lightning invoice via Spark network
|
|
95
|
+
* Uses WDK WalletManagerSpark (m/44'/998')
|
|
96
|
+
* @param invoice - Lightning invoice string (lnbc...)
|
|
97
|
+
*/
|
|
98
|
+
sendLightning(invoice: string): Promise<TxResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Create Lightning invoice via Spark
|
|
101
|
+
* @param amount - Amount in millisatoshis
|
|
102
|
+
* @param memo - Optional payment memo
|
|
103
|
+
* @returns Lightning invoice string (lnbc...)
|
|
104
|
+
*/
|
|
105
|
+
createLightningInvoice(amount: bigint, memo?: string): Promise<string>;
|
|
106
|
+
/**
|
|
107
|
+
* Validate Lightning invoice format
|
|
108
|
+
*/
|
|
109
|
+
private isValidLightningInvoice;
|
|
110
|
+
/**
|
|
111
|
+
* Decode Lightning invoice (basic parsing)
|
|
112
|
+
*/
|
|
113
|
+
private decodeLightningInvoice;
|
|
114
|
+
/**
|
|
115
|
+
* Get Lightning (Spark) balance
|
|
116
|
+
*/
|
|
117
|
+
getLightningBalance(): Promise<{
|
|
118
|
+
available: bigint;
|
|
119
|
+
pending: bigint;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Get configuration
|
|
123
|
+
*/
|
|
124
|
+
getConfig(): ZubariWalletConfig;
|
|
125
|
+
/**
|
|
126
|
+
* Check if wallet is initialized
|
|
127
|
+
*/
|
|
128
|
+
isInitialized(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Get contract addresses for current network
|
|
131
|
+
*/
|
|
132
|
+
getContractAddresses(): ContractAddresses;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export { PLATFORM_CONFIG as P, ZubariWallet as Z, ZUBARI_CONTRACTS as a, getContractAddresses as g };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-fXVD8_D0.mjs';
|
|
2
|
+
export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DJjdq89b.mjs';
|
|
3
|
+
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
|
|
4
|
+
export { ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.mjs';
|
|
5
|
+
export { S as SwapService } from './SwapService-C0G8IXW2.mjs';
|
|
6
|
+
export { A as Account, E as EarningsBreakdown, L as LazyMintVoucher, f as ListingParams, e as NFT, d as NFTMetadata, a as NetworkBalance, N as NetworkType, R as RevenueSplit, c as SendParams, k as Subscription, j as SubscriptionPlan, l as SwapParams, S as SwapQuote, g as TipData, h as TipResult, i as TipStats, b as TokenBalance, T as TxResult, n as ZubariError, m as ZubariErrorCode, Z as ZubariWalletConfig } from './index-BLuxEdLp.mjs';
|
|
7
|
+
export { UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.mjs';
|
|
8
|
+
import 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
|
|
9
|
+
import 'node_modules/viem/_types/utils/ccip';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import 'ethers';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* KeyManager - Secure key storage and encryption
|
|
15
|
+
*
|
|
16
|
+
* Handles seed phrase encryption using AES-256-GCM
|
|
17
|
+
* with PBKDF2 key derivation from user password.
|
|
18
|
+
*/
|
|
19
|
+
declare class KeyManager {
|
|
20
|
+
private static readonly ALGORITHM;
|
|
21
|
+
private static readonly KEY_LENGTH;
|
|
22
|
+
private static readonly IV_LENGTH;
|
|
23
|
+
private static readonly SALT_LENGTH;
|
|
24
|
+
private static readonly PBKDF2_ITERATIONS;
|
|
25
|
+
/**
|
|
26
|
+
* Encrypt a seed phrase with a password
|
|
27
|
+
*/
|
|
28
|
+
static encryptSeed(seed: string, password: string): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Decrypt a seed phrase with a password
|
|
31
|
+
*/
|
|
32
|
+
static decryptSeed(encryptedData: string, password: string): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Derive encryption key from password using PBKDF2
|
|
35
|
+
*/
|
|
36
|
+
private static deriveKey;
|
|
37
|
+
/**
|
|
38
|
+
* Validate a BIP-39 seed phrase (basic validation)
|
|
39
|
+
*/
|
|
40
|
+
static validateSeedPhrase(seed: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Generate a random encryption key (for backup purposes)
|
|
43
|
+
*/
|
|
44
|
+
static generateBackupKey(): string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Utility functions for wallet operations
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* Format address for display (truncate middle)
|
|
52
|
+
*/
|
|
53
|
+
declare function formatAddress(address: string, chars?: number): string;
|
|
54
|
+
/**
|
|
55
|
+
* Format balance for display
|
|
56
|
+
*/
|
|
57
|
+
declare function formatBalance(balance: bigint, decimals?: number, precision?: number): string;
|
|
58
|
+
/**
|
|
59
|
+
* Check if string is a valid Ethereum address
|
|
60
|
+
*/
|
|
61
|
+
declare function isValidAddress(address: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Normalize an Ethereum address to checksum format
|
|
64
|
+
*/
|
|
65
|
+
declare function normalizeAddress(address: string): string;
|
|
66
|
+
|
|
67
|
+
export { KeyManager, formatAddress, formatBalance, isValidAddress, normalizeAddress };
|