@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
package/dist/wallet/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Z as ZubariWallet } from '../index-
|
|
2
|
-
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, W as WalletManager, b as WalletManagerConfig, a as WalletState } from '../WalletManager
|
|
1
|
+
export { Z as ZubariWallet } from '../index-B19bUJSk.mjs';
|
|
2
|
+
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, W as WalletManager, b as WalletManagerConfig, a as WalletState } from '../WalletManager--UOBwXJp.mjs';
|
|
3
3
|
import '../index-DhluuR9H.mjs';
|
|
4
4
|
import 'abitype';
|
|
5
5
|
import 'viem';
|
package/dist/wallet/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Z as ZubariWallet } from '../index-
|
|
2
|
-
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, W as WalletManager, b as WalletManagerConfig, a as WalletState } from '../WalletManager-
|
|
1
|
+
export { Z as ZubariWallet } from '../index-r6aRsMfN.js';
|
|
2
|
+
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, W as WalletManager, b as WalletManagerConfig, a as WalletState } from '../WalletManager-DVq_PUZK.js';
|
|
3
3
|
import '../index-DhluuR9H.js';
|
|
4
4
|
import 'abitype';
|
|
5
5
|
import 'viem';
|
package/dist/wallet/index.js
CHANGED
|
@@ -2081,6 +2081,94 @@ var WalletManager = class _WalletManager {
|
|
|
2081
2081
|
selectedChain: this.selectedChain
|
|
2082
2082
|
};
|
|
2083
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Send a transaction using Tether WDK
|
|
2086
|
+
* Supports native tokens and USDT on all chains
|
|
2087
|
+
*
|
|
2088
|
+
* @param chain - Target blockchain (ethereum, bitcoin, ton, tron, solana, spark)
|
|
2089
|
+
* @param to - Recipient address
|
|
2090
|
+
* @param amount - Amount to send (in human-readable format)
|
|
2091
|
+
* @param token - Optional token symbol (e.g., 'USDT' for stablecoins)
|
|
2092
|
+
* @returns Transaction result with hash and status
|
|
2093
|
+
*/
|
|
2094
|
+
async sendTransaction(chain, to, amount, token) {
|
|
2095
|
+
if (!this.currentSeed) {
|
|
2096
|
+
return { success: false, error: "Wallet is locked" };
|
|
2097
|
+
}
|
|
2098
|
+
const fromAddress = this.getAddressForChain(chain);
|
|
2099
|
+
if (!fromAddress) {
|
|
2100
|
+
return { success: false, error: `No address for chain ${chain}` };
|
|
2101
|
+
}
|
|
2102
|
+
try {
|
|
2103
|
+
const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/send`, {
|
|
2104
|
+
method: "POST",
|
|
2105
|
+
headers: { "Content-Type": "application/json" },
|
|
2106
|
+
body: JSON.stringify({
|
|
2107
|
+
seed: this.currentSeed,
|
|
2108
|
+
chain,
|
|
2109
|
+
to,
|
|
2110
|
+
amount,
|
|
2111
|
+
token,
|
|
2112
|
+
network: this.config.network
|
|
2113
|
+
})
|
|
2114
|
+
});
|
|
2115
|
+
if (response.ok) {
|
|
2116
|
+
const data = await response.json();
|
|
2117
|
+
console.log(`Transaction sent on ${chain}:`, data);
|
|
2118
|
+
return {
|
|
2119
|
+
success: data.success,
|
|
2120
|
+
txHash: data.txHash,
|
|
2121
|
+
from: fromAddress,
|
|
2122
|
+
to,
|
|
2123
|
+
amount,
|
|
2124
|
+
chain
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
const errorData = await response.json().catch(() => ({}));
|
|
2128
|
+
return {
|
|
2129
|
+
success: false,
|
|
2130
|
+
error: errorData.error || `HTTP ${response.status}`
|
|
2131
|
+
};
|
|
2132
|
+
} catch (error) {
|
|
2133
|
+
console.error(`Transaction failed on ${chain}:`, error);
|
|
2134
|
+
return {
|
|
2135
|
+
success: false,
|
|
2136
|
+
error: error instanceof Error ? error.message : "Transaction failed"
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Estimate transaction fee using Tether WDK
|
|
2142
|
+
*/
|
|
2143
|
+
async estimateFee(chain, to, amount, token) {
|
|
2144
|
+
try {
|
|
2145
|
+
const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/estimate-fee`, {
|
|
2146
|
+
method: "POST",
|
|
2147
|
+
headers: { "Content-Type": "application/json" },
|
|
2148
|
+
body: JSON.stringify({
|
|
2149
|
+
chain,
|
|
2150
|
+
to,
|
|
2151
|
+
amount,
|
|
2152
|
+
token,
|
|
2153
|
+
network: this.config.network
|
|
2154
|
+
})
|
|
2155
|
+
});
|
|
2156
|
+
if (response.ok) {
|
|
2157
|
+
const data = await response.json();
|
|
2158
|
+
return {
|
|
2159
|
+
success: true,
|
|
2160
|
+
fee: data.fee,
|
|
2161
|
+
feeUsd: data.feeUsd
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
return { success: false, error: "Failed to estimate fee" };
|
|
2165
|
+
} catch (error) {
|
|
2166
|
+
return {
|
|
2167
|
+
success: false,
|
|
2168
|
+
error: error instanceof Error ? error.message : "Fee estimation failed"
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2084
2172
|
};
|
|
2085
2173
|
|
|
2086
2174
|
exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS;
|