@zubari/sdk 0.1.10 → 0.1.11
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/{WalletManager-UG6taF_0.d.mts → WalletManager--UOBwXJp.d.mts} +28 -0
- package/dist/{WalletManager-CkGhJZDo.d.ts → WalletManager-DVq_PUZK.d.ts} +28 -0
- package/dist/{index-DS2d6LVD.d.mts → index-B19bUJSk.d.mts} +1 -1
- package/dist/{index-Dk_dYBbp.d.ts → index-r6aRsMfN.d.ts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +22 -3
- package/dist/react/index.d.ts +22 -3
- package/dist/react/index.js +117 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +117 -0
- package/dist/react/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +2 -2
- package/dist/wallet/index.d.ts +2 -2
- package/dist/wallet/index.js +88 -0
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +88 -0
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -6034,6 +6034,34 @@ declare class WalletManager {
|
|
|
6034
6034
|
* Get extended wallet state with multi-chain info
|
|
6035
6035
|
*/
|
|
6036
6036
|
getExtendedState(): WalletState;
|
|
6037
|
+
/**
|
|
6038
|
+
* Send a transaction using Tether WDK
|
|
6039
|
+
* Supports native tokens and USDT on all chains
|
|
6040
|
+
*
|
|
6041
|
+
* @param chain - Target blockchain (ethereum, bitcoin, ton, tron, solana, spark)
|
|
6042
|
+
* @param to - Recipient address
|
|
6043
|
+
* @param amount - Amount to send (in human-readable format)
|
|
6044
|
+
* @param token - Optional token symbol (e.g., 'USDT' for stablecoins)
|
|
6045
|
+
* @returns Transaction result with hash and status
|
|
6046
|
+
*/
|
|
6047
|
+
sendTransaction(chain: NetworkType, to: string, amount: string, token?: string): Promise<{
|
|
6048
|
+
success: boolean;
|
|
6049
|
+
txHash?: string;
|
|
6050
|
+
from?: string;
|
|
6051
|
+
to?: string;
|
|
6052
|
+
amount?: string;
|
|
6053
|
+
chain?: NetworkType;
|
|
6054
|
+
error?: string;
|
|
6055
|
+
}>;
|
|
6056
|
+
/**
|
|
6057
|
+
* Estimate transaction fee using Tether WDK
|
|
6058
|
+
*/
|
|
6059
|
+
estimateFee(chain: NetworkType, to: string, amount: string, token?: string): Promise<{
|
|
6060
|
+
success: boolean;
|
|
6061
|
+
fee?: string;
|
|
6062
|
+
feeUsd?: number;
|
|
6063
|
+
error?: string;
|
|
6064
|
+
}>;
|
|
6037
6065
|
}
|
|
6038
6066
|
|
|
6039
6067
|
export { type ChainBalance as C, DERIVATION_PATHS as D, type MultiChainAddresses as M, NETWORKS as N, SUPPORTED_CHAINS as S, TESTNET_NETWORKS as T, WalletManager as W, type WalletState as a, type WalletManagerConfig as b, getNetworkConfig as g };
|
|
@@ -6034,6 +6034,34 @@ declare class WalletManager {
|
|
|
6034
6034
|
* Get extended wallet state with multi-chain info
|
|
6035
6035
|
*/
|
|
6036
6036
|
getExtendedState(): WalletState;
|
|
6037
|
+
/**
|
|
6038
|
+
* Send a transaction using Tether WDK
|
|
6039
|
+
* Supports native tokens and USDT on all chains
|
|
6040
|
+
*
|
|
6041
|
+
* @param chain - Target blockchain (ethereum, bitcoin, ton, tron, solana, spark)
|
|
6042
|
+
* @param to - Recipient address
|
|
6043
|
+
* @param amount - Amount to send (in human-readable format)
|
|
6044
|
+
* @param token - Optional token symbol (e.g., 'USDT' for stablecoins)
|
|
6045
|
+
* @returns Transaction result with hash and status
|
|
6046
|
+
*/
|
|
6047
|
+
sendTransaction(chain: NetworkType, to: string, amount: string, token?: string): Promise<{
|
|
6048
|
+
success: boolean;
|
|
6049
|
+
txHash?: string;
|
|
6050
|
+
from?: string;
|
|
6051
|
+
to?: string;
|
|
6052
|
+
amount?: string;
|
|
6053
|
+
chain?: NetworkType;
|
|
6054
|
+
error?: string;
|
|
6055
|
+
}>;
|
|
6056
|
+
/**
|
|
6057
|
+
* Estimate transaction fee using Tether WDK
|
|
6058
|
+
*/
|
|
6059
|
+
estimateFee(chain: NetworkType, to: string, amount: string, token?: string): Promise<{
|
|
6060
|
+
success: boolean;
|
|
6061
|
+
fee?: string;
|
|
6062
|
+
feeUsd?: number;
|
|
6063
|
+
error?: string;
|
|
6064
|
+
}>;
|
|
6037
6065
|
}
|
|
6038
6066
|
|
|
6039
6067
|
export { type ChainBalance as C, DERIVATION_PATHS as D, type MultiChainAddresses as M, NETWORKS as N, SUPPORTED_CHAINS as S, TESTNET_NETWORKS as T, WalletManager as W, type WalletState as a, type WalletManagerConfig as b, getNetworkConfig as g };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-DhluuR9H.mjs';
|
|
2
|
-
import './WalletManager
|
|
2
|
+
import './WalletManager--UOBwXJp.mjs';
|
|
3
3
|
|
|
4
4
|
interface ContractAddresses {
|
|
5
5
|
registry: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-DhluuR9H.js';
|
|
2
|
-
import './WalletManager-
|
|
2
|
+
import './WalletManager-DVq_PUZK.js';
|
|
3
3
|
|
|
4
4
|
interface ContractAddresses {
|
|
5
5
|
registry: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { P as PLATFORM_CONFIG, 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, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager
|
|
1
|
+
export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-B19bUJSk.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--UOBwXJp.mjs';
|
|
3
3
|
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
|
|
4
4
|
export { ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.mjs';
|
|
5
5
|
export { BrowserAddressDerivation, ChainAddress, ChainBalance, FeeEstimate, FeeRates, MultiChainAddresses, SupportedChain, SwapService, TransactionHistoryItem, TransactionParams, TransactionResult, TransactionService, TransactionServiceConfig, WdkApiClient, ZubariWdkService, ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser } from './services/index.mjs';
|
|
6
6
|
export { A as Account, E as EarningsBreakdown, L as LazyMintVoucher, e as ListingParams, d as NFT, c as NFTMetadata, a as NetworkBalance, N as NetworkType, R as RevenueSplit, S as SendParams, j as Subscription, i as SubscriptionPlan, l as SwapParams, k as SwapQuote, f as TipData, g as TipResult, h as TipStats, T as TokenBalance, b as TxResult, n as ZubariError, m as ZubariErrorCode, Z as ZubariWalletConfig } from './index-DhluuR9H.mjs';
|
|
7
|
-
export { UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.mjs';
|
|
7
|
+
export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.mjs';
|
|
8
8
|
import 'abitype';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import 'ethers';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { P as PLATFORM_CONFIG, 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, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-
|
|
1
|
+
export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-r6aRsMfN.js';
|
|
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-DVq_PUZK.js';
|
|
3
3
|
export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
|
|
4
4
|
export { ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.js';
|
|
5
5
|
export { BrowserAddressDerivation, ChainAddress, ChainBalance, FeeEstimate, FeeRates, MultiChainAddresses, SupportedChain, SwapService, TransactionHistoryItem, TransactionParams, TransactionResult, TransactionService, TransactionServiceConfig, WdkApiClient, ZubariWdkService, ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser } from './services/index.js';
|
|
6
6
|
export { A as Account, E as EarningsBreakdown, L as LazyMintVoucher, e as ListingParams, d as NFT, c as NFTMetadata, a as NetworkBalance, N as NetworkType, R as RevenueSplit, S as SendParams, j as Subscription, i as SubscriptionPlan, l as SwapParams, k as SwapQuote, f as TipData, g as TipResult, h as TipStats, T as TokenBalance, b as TxResult, n as ZubariError, m as ZubariErrorCode, Z as ZubariWalletConfig } from './index-DhluuR9H.js';
|
|
7
|
-
export { UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.js';
|
|
7
|
+
export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.js';
|
|
8
8
|
import 'abitype';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import 'ethers';
|
package/dist/index.js
CHANGED
|
@@ -2130,6 +2130,94 @@ var WalletManager = class _WalletManager {
|
|
|
2130
2130
|
selectedChain: this.selectedChain
|
|
2131
2131
|
};
|
|
2132
2132
|
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Send a transaction using Tether WDK
|
|
2135
|
+
* Supports native tokens and USDT on all chains
|
|
2136
|
+
*
|
|
2137
|
+
* @param chain - Target blockchain (ethereum, bitcoin, ton, tron, solana, spark)
|
|
2138
|
+
* @param to - Recipient address
|
|
2139
|
+
* @param amount - Amount to send (in human-readable format)
|
|
2140
|
+
* @param token - Optional token symbol (e.g., 'USDT' for stablecoins)
|
|
2141
|
+
* @returns Transaction result with hash and status
|
|
2142
|
+
*/
|
|
2143
|
+
async sendTransaction(chain, to, amount, token) {
|
|
2144
|
+
if (!this.currentSeed) {
|
|
2145
|
+
return { success: false, error: "Wallet is locked" };
|
|
2146
|
+
}
|
|
2147
|
+
const fromAddress = this.getAddressForChain(chain);
|
|
2148
|
+
if (!fromAddress) {
|
|
2149
|
+
return { success: false, error: `No address for chain ${chain}` };
|
|
2150
|
+
}
|
|
2151
|
+
try {
|
|
2152
|
+
const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/send`, {
|
|
2153
|
+
method: "POST",
|
|
2154
|
+
headers: { "Content-Type": "application/json" },
|
|
2155
|
+
body: JSON.stringify({
|
|
2156
|
+
seed: this.currentSeed,
|
|
2157
|
+
chain,
|
|
2158
|
+
to,
|
|
2159
|
+
amount,
|
|
2160
|
+
token,
|
|
2161
|
+
network: this.config.network
|
|
2162
|
+
})
|
|
2163
|
+
});
|
|
2164
|
+
if (response.ok) {
|
|
2165
|
+
const data = await response.json();
|
|
2166
|
+
console.log(`Transaction sent on ${chain}:`, data);
|
|
2167
|
+
return {
|
|
2168
|
+
success: data.success,
|
|
2169
|
+
txHash: data.txHash,
|
|
2170
|
+
from: fromAddress,
|
|
2171
|
+
to,
|
|
2172
|
+
amount,
|
|
2173
|
+
chain
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
const errorData = await response.json().catch(() => ({}));
|
|
2177
|
+
return {
|
|
2178
|
+
success: false,
|
|
2179
|
+
error: errorData.error || `HTTP ${response.status}`
|
|
2180
|
+
};
|
|
2181
|
+
} catch (error) {
|
|
2182
|
+
console.error(`Transaction failed on ${chain}:`, error);
|
|
2183
|
+
return {
|
|
2184
|
+
success: false,
|
|
2185
|
+
error: error instanceof Error ? error.message : "Transaction failed"
|
|
2186
|
+
};
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Estimate transaction fee using Tether WDK
|
|
2191
|
+
*/
|
|
2192
|
+
async estimateFee(chain, to, amount, token) {
|
|
2193
|
+
try {
|
|
2194
|
+
const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/estimate-fee`, {
|
|
2195
|
+
method: "POST",
|
|
2196
|
+
headers: { "Content-Type": "application/json" },
|
|
2197
|
+
body: JSON.stringify({
|
|
2198
|
+
chain,
|
|
2199
|
+
to,
|
|
2200
|
+
amount,
|
|
2201
|
+
token,
|
|
2202
|
+
network: this.config.network
|
|
2203
|
+
})
|
|
2204
|
+
});
|
|
2205
|
+
if (response.ok) {
|
|
2206
|
+
const data = await response.json();
|
|
2207
|
+
return {
|
|
2208
|
+
success: true,
|
|
2209
|
+
fee: data.fee,
|
|
2210
|
+
feeUsd: data.feeUsd
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
return { success: false, error: "Failed to estimate fee" };
|
|
2214
|
+
} catch (error) {
|
|
2215
|
+
return {
|
|
2216
|
+
success: false,
|
|
2217
|
+
error: error instanceof Error ? error.message : "Fee estimation failed"
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2133
2221
|
};
|
|
2134
2222
|
|
|
2135
2223
|
// src/protocols/NFTProtocol.ts
|
|
@@ -3237,6 +3325,32 @@ function useWalletManager(options = {}) {
|
|
|
3237
3325
|
);
|
|
3238
3326
|
const hasWallet = react.useCallback(() => manager.hasWallet(), [manager]);
|
|
3239
3327
|
const getSeed = react.useCallback(() => manager.getSeed(), [manager]);
|
|
3328
|
+
const sendTransaction = react.useCallback(
|
|
3329
|
+
async (chain, to, amount, token) => {
|
|
3330
|
+
setIsLoading(true);
|
|
3331
|
+
try {
|
|
3332
|
+
const result = await manager.sendTransaction(chain, to, amount, token);
|
|
3333
|
+
if (result.success) {
|
|
3334
|
+
try {
|
|
3335
|
+
const balances = await manager.fetchAllBalances();
|
|
3336
|
+
setChainBalances(balances);
|
|
3337
|
+
} catch (err) {
|
|
3338
|
+
console.warn("Failed to refresh balances after transaction:", err);
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
return result;
|
|
3342
|
+
} finally {
|
|
3343
|
+
setIsLoading(false);
|
|
3344
|
+
}
|
|
3345
|
+
},
|
|
3346
|
+
[manager]
|
|
3347
|
+
);
|
|
3348
|
+
const estimateFee = react.useCallback(
|
|
3349
|
+
async (chain, to, amount, token) => {
|
|
3350
|
+
return manager.estimateFee(chain, to, amount, token);
|
|
3351
|
+
},
|
|
3352
|
+
[manager]
|
|
3353
|
+
);
|
|
3240
3354
|
return {
|
|
3241
3355
|
state,
|
|
3242
3356
|
isLoading,
|
|
@@ -3255,6 +3369,9 @@ function useWalletManager(options = {}) {
|
|
|
3255
3369
|
getAddressForChain,
|
|
3256
3370
|
getAllAddresses,
|
|
3257
3371
|
supportedChains: SUPPORTED_CHAINS,
|
|
3372
|
+
// Transaction Actions (Powered by Tether WDK)
|
|
3373
|
+
sendTransaction,
|
|
3374
|
+
estimateFee,
|
|
3258
3375
|
// Utilities
|
|
3259
3376
|
hasWallet,
|
|
3260
3377
|
getSeed,
|