@zubari/sdk 0.5.8 → 0.5.10
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-i2BBu6uz.d.mts → WalletManager-DOjsIbb1.d.mts} +2 -0
- package/dist/{WalletManager-Csfokchy.d.ts → WalletManager-n5KdhSRd.d.ts} +2 -0
- package/dist/{contracts-ITj7CkiV.d.mts → contracts-BWEndqf6.d.mts} +1 -1
- package/dist/{contracts-BHI5gorb.d.ts → contracts-DtN5ys2L.d.ts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +42 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -5
- 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/react/index.js +39 -4
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +39 -4
- package/dist/react/index.mjs.map +1 -1
- package/dist/services/index.js +6 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +6 -2
- package/dist/services/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 +39 -4
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +39 -4
- 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 '../contracts-
|
|
2
|
-
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-
|
|
1
|
+
export { Z as ZubariWallet } from '../contracts-BWEndqf6.mjs';
|
|
2
|
+
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-DOjsIbb1.mjs';
|
|
3
3
|
import '../index-c90msmwW.mjs';
|
|
4
4
|
import 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
|
|
5
5
|
import 'node_modules/viem/_types/utils/ccip';
|
package/dist/wallet/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Z as ZubariWallet } from '../contracts-
|
|
2
|
-
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-
|
|
1
|
+
export { Z as ZubariWallet } from '../contracts-DtN5ys2L.js';
|
|
2
|
+
export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-n5KdhSRd.js';
|
|
3
3
|
import '../index-c90msmwW.js';
|
|
4
4
|
import 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
|
|
5
5
|
import 'node_modules/viem/_types/utils/ccip';
|
package/dist/wallet/index.js
CHANGED
|
@@ -631,7 +631,9 @@ function parseChainError(chain, errorMessage) {
|
|
|
631
631
|
function isBrowser() {
|
|
632
632
|
return typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
633
633
|
}
|
|
634
|
-
|
|
634
|
+
async function dynamicImport(specifier) {
|
|
635
|
+
return import(specifier);
|
|
636
|
+
}
|
|
635
637
|
async function canUseNativeWdk() {
|
|
636
638
|
if (isBrowser()) {
|
|
637
639
|
return false;
|
|
@@ -2011,7 +2013,8 @@ var WalletManager = class _WalletManager {
|
|
|
2011
2013
|
apiUrl: config.apiUrl || process.env.NEXT_PUBLIC_API_URL || "https://ckgwifsxka.us-east-2.awsapprunner.com",
|
|
2012
2014
|
accessToken: config.accessToken,
|
|
2013
2015
|
chainRpcUrls: config.chainRpcUrls || {},
|
|
2014
|
-
tronApiKey: config.tronApiKey
|
|
2016
|
+
tronApiKey: config.tronApiKey,
|
|
2017
|
+
tonApiKey: config.tonApiKey
|
|
2015
2018
|
};
|
|
2016
2019
|
this.storage = this.config.storage;
|
|
2017
2020
|
this.wdkService = getZubariWdkService({
|
|
@@ -2626,6 +2629,30 @@ var WalletManager = class _WalletManager {
|
|
|
2626
2629
|
console.warn("Failed to fetch Solana USDT balance:", error);
|
|
2627
2630
|
}
|
|
2628
2631
|
}
|
|
2632
|
+
if (balance === "0" && this.config.apiUrl && this.config.accessToken) {
|
|
2633
|
+
try {
|
|
2634
|
+
const fallbackResponse = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
|
|
2635
|
+
method: "POST",
|
|
2636
|
+
headers: {
|
|
2637
|
+
"Content-Type": "application/json",
|
|
2638
|
+
"Authorization": `Bearer ${this.config.accessToken}`
|
|
2639
|
+
},
|
|
2640
|
+
body: JSON.stringify({
|
|
2641
|
+
chain: "solana",
|
|
2642
|
+
address,
|
|
2643
|
+
network: this.config.network
|
|
2644
|
+
})
|
|
2645
|
+
});
|
|
2646
|
+
if (fallbackResponse.ok) {
|
|
2647
|
+
const fallbackData = await fallbackResponse.json();
|
|
2648
|
+
if (fallbackData.success && fallbackData.balance && fallbackData.balance !== "0") {
|
|
2649
|
+
balance = fallbackData.balance;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
} catch (fallbackError) {
|
|
2653
|
+
console.warn("Solana backend fallback failed:", fallbackError);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2629
2656
|
} else if (chain === "tron") {
|
|
2630
2657
|
const tronConfig = getNetworkConfig("tron", this.config.network !== "mainnet");
|
|
2631
2658
|
const baseUrl = tronConfig.rpcUrl;
|
|
@@ -2665,8 +2692,12 @@ var WalletManager = class _WalletManager {
|
|
|
2665
2692
|
const isTestnet = this.config.network !== "mainnet";
|
|
2666
2693
|
const baseUrl = isTestnet ? "https://testnet.toncenter.com/api/v2" : "https://toncenter.com/api/v2";
|
|
2667
2694
|
try {
|
|
2695
|
+
const tonHeaders = { "Accept": "application/json" };
|
|
2696
|
+
if (this.config.tonApiKey) {
|
|
2697
|
+
tonHeaders["X-API-Key"] = this.config.tonApiKey;
|
|
2698
|
+
}
|
|
2668
2699
|
const response = await fetch(`${baseUrl}/getAddressBalance?address=${address}`, {
|
|
2669
|
-
headers:
|
|
2700
|
+
headers: tonHeaders
|
|
2670
2701
|
});
|
|
2671
2702
|
if (response.ok) {
|
|
2672
2703
|
const data = await response.json();
|
|
@@ -2716,9 +2747,13 @@ var WalletManager = class _WalletManager {
|
|
|
2716
2747
|
}
|
|
2717
2748
|
} else if (chain === "spark") {
|
|
2718
2749
|
try {
|
|
2750
|
+
const sparkHeaders = { "Content-Type": "application/json" };
|
|
2751
|
+
if (this.config.accessToken) {
|
|
2752
|
+
sparkHeaders["Authorization"] = `Bearer ${this.config.accessToken}`;
|
|
2753
|
+
}
|
|
2719
2754
|
const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
|
|
2720
2755
|
method: "POST",
|
|
2721
|
-
headers:
|
|
2756
|
+
headers: sparkHeaders,
|
|
2722
2757
|
body: JSON.stringify({
|
|
2723
2758
|
chain: "spark",
|
|
2724
2759
|
address,
|