@trustware/sdk-staging 1.1.5-staging.1 → 1.1.6-staging.2

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.
@@ -30,7 +30,7 @@ __export(constants_exports, {
30
30
  });
31
31
  module.exports = __toCommonJS(constants_exports);
32
32
  var SDK_NAME = "@trustware/sdk";
33
- var SDK_VERSION = "1.1.5-staging.1";
33
+ var SDK_VERSION = "1.1.6-staging.2";
34
34
  var API_ROOT = "https://bv-staging-api.trustware.io";
35
35
  var GTM_ID = "GTM-TZDGNCXB";
36
36
  var API_PREFIX = "/api";
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
2
  var SDK_NAME = "@trustware/sdk";
3
- var SDK_VERSION = "1.1.5-staging.1";
3
+ var SDK_VERSION = "1.1.6-staging.2";
4
4
  var API_ROOT = "https://bv-staging-api.trustware.io";
5
5
  var GTM_ID = "GTM-TZDGNCXB";
6
6
  var API_PREFIX = "/api";
@@ -0,0 +1,114 @@
1
+ import { C as ChainDef, g as ChainType, B as BalanceRow, d as BalanceStreamOptions, V as WalletAddressBalanceWrapper, e as BuildRouteResult, b as Transaction, T as TrustwareConfigOptions, W as WalletInterFaceAPI, r as ResolvedTrustwareConfig, a1 as WalletIdentity, ae as walletManager, X as WalletAddressResolution, af as buildRoute, ag as buildDepositAddress, ah as submitReceipt, ai as getStatus, aj as pollStatus } from './manager-CXSw1h5e.js';
2
+ import { T as Token } from './types-BrVfNxND.js';
3
+
4
+ type AddressValidationResult = {
5
+ isValid: boolean;
6
+ error?: string;
7
+ };
8
+ declare function validateEvmAddress(address: string): AddressValidationResult;
9
+ declare function validateSeiAddress(address: string): AddressValidationResult;
10
+ declare function validateSolanaAddress(address: string): AddressValidationResult;
11
+ declare function validateBtcAddress(address: string): AddressValidationResult;
12
+ declare function validateAddressForChain(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
13
+ declare function validateRouteAddresses(params: {
14
+ fromChain?: ChainDef | ChainType | string | null;
15
+ toChain?: ChainDef | ChainType | string | null;
16
+ fromAddress: string;
17
+ toAddress: string;
18
+ refundAddress?: string;
19
+ direction?: string;
20
+ }): AddressValidationResult;
21
+
22
+ /** Map chain reference -> backend chain_key and return enriched balances */
23
+ declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
24
+ declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
25
+ declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
26
+
27
+ declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string): Promise<string>;
28
+ declare function runTopUp(params: {
29
+ fromChain?: string;
30
+ toChain?: string;
31
+ fromToken?: string;
32
+ toToken?: string;
33
+ toAddress?: string;
34
+ fromAmount: string | number;
35
+ }): Promise<Transaction>;
36
+
37
+ interface UseChainsResult {
38
+ /** All available chains */
39
+ chains: ChainDef[];
40
+ /** Popular/featured chains (Ethereum, Polygon, Base) */
41
+ popularChains: ChainDef[];
42
+ /** Other chains (not in popular list) */
43
+ otherChains: ChainDef[];
44
+ /** Whether chains are currently loading */
45
+ isLoading: boolean;
46
+ /** Error message if loading failed */
47
+ error: string | null;
48
+ chainMap: Map<string, ChainDef>;
49
+ }
50
+ /**
51
+ * Hook to load available chains from the registry.
52
+ * Returns chains split into popular and other categories.
53
+ */
54
+ declare function useChains(): UseChainsResult;
55
+
56
+ interface UseTokensResult {
57
+ /** All available tokens for the selected chain */
58
+ tokens: Token[];
59
+ /** Filtered tokens based on search query */
60
+ filteredTokens: Token[];
61
+ /** Whether tokens are currently loading */
62
+ isLoading: boolean;
63
+ /** Error message if loading failed */
64
+ error: string | null;
65
+ /** Current search query */
66
+ searchQuery: string;
67
+ /** Set the search query to filter tokens */
68
+ setSearchQuery: (query: string) => void;
69
+ /** Whether more tokens can be loaded for the active query */
70
+ hasNextPage: boolean;
71
+ /** Load the next token page when pagination is enabled */
72
+ loadMore: () => Promise<void>;
73
+ /** Whether an additional page request is in flight */
74
+ isLoadingMore: boolean;
75
+ }
76
+ declare function useTokens(chainId: string | number | null | undefined): UseTokensResult;
77
+
78
+ declare const Trustware: {
79
+ /** Initialize config */
80
+ init(cfg: TrustwareConfigOptions): Promise</*elided*/ any>;
81
+ /** Attach a wallet interface directly (skips detection) */
82
+ useWallet(w: WalletInterFaceAPI): /*elided*/ any;
83
+ /** Best-effort background attach to detected wallet(s) (detection hook should be running in the app) */
84
+ autoDetect(_timeoutMs?: number): Promise<boolean>;
85
+ /** Read resolved config */
86
+ getConfig(): ResolvedTrustwareConfig;
87
+ setDestinationAddress(address?: string | null): /*elided*/ any;
88
+ setDestinationChain(chain: string): /*elided*/ any;
89
+ setDestinationToken(token: string): /*elided*/ any;
90
+ /** Read active wallet */
91
+ getWallet(): WalletInterFaceAPI | null;
92
+ getIdentity(): WalletIdentity;
93
+ resolveAddressForChain(chain: Parameters<typeof walletManager.resolveAddressForChain>[0]): WalletAddressResolution;
94
+ addIdentityAddress(address: Parameters<typeof walletManager.addIdentityAddress>[0]): /*elided*/ any;
95
+ /** Simple helpers */
96
+ getAddress(): Promise<string>;
97
+ buildRoute: typeof buildRoute;
98
+ buildDepositAddress: typeof buildDepositAddress;
99
+ submitReceipt: typeof submitReceipt;
100
+ getStatus: typeof getStatus;
101
+ pollStatus: typeof pollStatus;
102
+ getBalances: typeof getBalances;
103
+ getBalancesByAddress: typeof getBalancesByAddress;
104
+ getBalancesByAddressStream: typeof getBalancesByAddressStream;
105
+ useChains: typeof useChains;
106
+ useTokens: typeof useTokens;
107
+ validateAddressForChain: typeof validateAddressForChain;
108
+ validateRouteAddresses: typeof validateRouteAddresses;
109
+ sendRouteTransaction: typeof sendRouteTransaction;
110
+ runTopUp: typeof runTopUp;
111
+ };
112
+ type TrustwareCore = typeof Trustware;
113
+
114
+ export { Trustware as T, type TrustwareCore as a, validateBtcAddress as b, validateEvmAddress as c, validateRouteAddresses as d, validateSeiAddress as e, validateSolanaAddress as f, validateAddressForChain as v };
@@ -0,0 +1,114 @@
1
+ import { C as ChainDef, g as ChainType, B as BalanceRow, d as BalanceStreamOptions, V as WalletAddressBalanceWrapper, e as BuildRouteResult, b as Transaction, T as TrustwareConfigOptions, W as WalletInterFaceAPI, r as ResolvedTrustwareConfig, a1 as WalletIdentity, ae as walletManager, X as WalletAddressResolution, af as buildRoute, ag as buildDepositAddress, ah as submitReceipt, ai as getStatus, aj as pollStatus } from './manager-CXSw1h5e.cjs';
2
+ import { T as Token } from './types-BrVfNxND.cjs';
3
+
4
+ type AddressValidationResult = {
5
+ isValid: boolean;
6
+ error?: string;
7
+ };
8
+ declare function validateEvmAddress(address: string): AddressValidationResult;
9
+ declare function validateSeiAddress(address: string): AddressValidationResult;
10
+ declare function validateSolanaAddress(address: string): AddressValidationResult;
11
+ declare function validateBtcAddress(address: string): AddressValidationResult;
12
+ declare function validateAddressForChain(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
13
+ declare function validateRouteAddresses(params: {
14
+ fromChain?: ChainDef | ChainType | string | null;
15
+ toChain?: ChainDef | ChainType | string | null;
16
+ fromAddress: string;
17
+ toAddress: string;
18
+ refundAddress?: string;
19
+ direction?: string;
20
+ }): AddressValidationResult;
21
+
22
+ /** Map chain reference -> backend chain_key and return enriched balances */
23
+ declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
24
+ declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
25
+ declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
26
+
27
+ declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string): Promise<string>;
28
+ declare function runTopUp(params: {
29
+ fromChain?: string;
30
+ toChain?: string;
31
+ fromToken?: string;
32
+ toToken?: string;
33
+ toAddress?: string;
34
+ fromAmount: string | number;
35
+ }): Promise<Transaction>;
36
+
37
+ interface UseChainsResult {
38
+ /** All available chains */
39
+ chains: ChainDef[];
40
+ /** Popular/featured chains (Ethereum, Polygon, Base) */
41
+ popularChains: ChainDef[];
42
+ /** Other chains (not in popular list) */
43
+ otherChains: ChainDef[];
44
+ /** Whether chains are currently loading */
45
+ isLoading: boolean;
46
+ /** Error message if loading failed */
47
+ error: string | null;
48
+ chainMap: Map<string, ChainDef>;
49
+ }
50
+ /**
51
+ * Hook to load available chains from the registry.
52
+ * Returns chains split into popular and other categories.
53
+ */
54
+ declare function useChains(): UseChainsResult;
55
+
56
+ interface UseTokensResult {
57
+ /** All available tokens for the selected chain */
58
+ tokens: Token[];
59
+ /** Filtered tokens based on search query */
60
+ filteredTokens: Token[];
61
+ /** Whether tokens are currently loading */
62
+ isLoading: boolean;
63
+ /** Error message if loading failed */
64
+ error: string | null;
65
+ /** Current search query */
66
+ searchQuery: string;
67
+ /** Set the search query to filter tokens */
68
+ setSearchQuery: (query: string) => void;
69
+ /** Whether more tokens can be loaded for the active query */
70
+ hasNextPage: boolean;
71
+ /** Load the next token page when pagination is enabled */
72
+ loadMore: () => Promise<void>;
73
+ /** Whether an additional page request is in flight */
74
+ isLoadingMore: boolean;
75
+ }
76
+ declare function useTokens(chainId: string | number | null | undefined): UseTokensResult;
77
+
78
+ declare const Trustware: {
79
+ /** Initialize config */
80
+ init(cfg: TrustwareConfigOptions): Promise</*elided*/ any>;
81
+ /** Attach a wallet interface directly (skips detection) */
82
+ useWallet(w: WalletInterFaceAPI): /*elided*/ any;
83
+ /** Best-effort background attach to detected wallet(s) (detection hook should be running in the app) */
84
+ autoDetect(_timeoutMs?: number): Promise<boolean>;
85
+ /** Read resolved config */
86
+ getConfig(): ResolvedTrustwareConfig;
87
+ setDestinationAddress(address?: string | null): /*elided*/ any;
88
+ setDestinationChain(chain: string): /*elided*/ any;
89
+ setDestinationToken(token: string): /*elided*/ any;
90
+ /** Read active wallet */
91
+ getWallet(): WalletInterFaceAPI | null;
92
+ getIdentity(): WalletIdentity;
93
+ resolveAddressForChain(chain: Parameters<typeof walletManager.resolveAddressForChain>[0]): WalletAddressResolution;
94
+ addIdentityAddress(address: Parameters<typeof walletManager.addIdentityAddress>[0]): /*elided*/ any;
95
+ /** Simple helpers */
96
+ getAddress(): Promise<string>;
97
+ buildRoute: typeof buildRoute;
98
+ buildDepositAddress: typeof buildDepositAddress;
99
+ submitReceipt: typeof submitReceipt;
100
+ getStatus: typeof getStatus;
101
+ pollStatus: typeof pollStatus;
102
+ getBalances: typeof getBalances;
103
+ getBalancesByAddress: typeof getBalancesByAddress;
104
+ getBalancesByAddressStream: typeof getBalancesByAddressStream;
105
+ useChains: typeof useChains;
106
+ useTokens: typeof useTokens;
107
+ validateAddressForChain: typeof validateAddressForChain;
108
+ validateRouteAddresses: typeof validateRouteAddresses;
109
+ sendRouteTransaction: typeof sendRouteTransaction;
110
+ runTopUp: typeof runTopUp;
111
+ };
112
+ type TrustwareCore = typeof Trustware;
113
+
114
+ export { Trustware as T, type TrustwareCore as a, validateBtcAddress as b, validateEvmAddress as c, validateRouteAddresses as d, validateSeiAddress as e, validateSolanaAddress as f, validateAddressForChain as v };