@trustware/sdk-staging 1.0.16-staging.13 → 1.0.17-staging.15
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/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/core-DRDMS5t3.d.ts +435 -0
- package/dist/core-DXxIIFgy.d.cts +435 -0
- package/dist/core.cjs +3107 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +3 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.mjs +3087 -0
- package/dist/core.mjs.map +1 -0
- package/dist/detect-BI5qLt5s.d.cts +34 -0
- package/dist/detect-GUvqS-mr.d.ts +34 -0
- package/dist/index.cjs +7570 -5867
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -682
- package/dist/index.d.ts +9 -682
- package/dist/index.mjs +7427 -5749
- package/dist/index.mjs.map +1 -1
- package/dist/manager-CgpuAzqn.d.cts +306 -0
- package/dist/manager-CgpuAzqn.d.ts +306 -0
- package/dist/types-BrVfNxND.d.cts +14 -0
- package/dist/types-BrVfNxND.d.ts +14 -0
- package/dist/wallet.cjs +2161 -0
- package/dist/wallet.cjs.map +1 -0
- package/dist/wallet.d.cts +37 -0
- package/dist/wallet.d.ts +37 -0
- package/dist/wallet.mjs +2117 -0
- package/dist/wallet.mjs.map +1 -0
- package/dist/widget.cjs +13388 -0
- package/dist/widget.cjs.map +1 -0
- package/dist/widget.d.cts +66 -0
- package/dist/widget.d.ts +66 -0
- package/dist/widget.mjs +13377 -0
- package/dist/widget.mjs.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
type WalletId = "metamask" | "coinbase" | "walletconnect" | "rainbow" | "phantom-evm" | "phantom-solana" | "solflare" | "backpack" | "rabby" | "brave" | "okx" | "zerion" | "taho" | "safe" | "imtoken" | "trust" | "bitget" | "kucoin";
|
|
2
|
+
type WalletCategory = "injected" | "walletconnect" | "app";
|
|
3
|
+
type WalletEcosystem = "evm" | "solana" | "multi";
|
|
4
|
+
type WalletMeta = {
|
|
5
|
+
id: WalletId;
|
|
6
|
+
name: string;
|
|
7
|
+
category: WalletCategory;
|
|
8
|
+
ecosystem: WalletEcosystem;
|
|
9
|
+
logo: string;
|
|
10
|
+
emoji?: string;
|
|
11
|
+
homepage?: string;
|
|
12
|
+
chromeWebStore?: string;
|
|
13
|
+
android?: string;
|
|
14
|
+
ios?: string;
|
|
15
|
+
deepLink?: (currentUrl: string) => string;
|
|
16
|
+
detectFlags?: string[];
|
|
17
|
+
};
|
|
18
|
+
type EIP1193 = {
|
|
19
|
+
request(args: {
|
|
20
|
+
method: string;
|
|
21
|
+
params?: unknown[] | object;
|
|
22
|
+
}): Promise<unknown>;
|
|
23
|
+
};
|
|
24
|
+
type EIP6963ProviderDetail = {
|
|
25
|
+
info: {
|
|
26
|
+
uuid: string;
|
|
27
|
+
name: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
rdns?: string;
|
|
30
|
+
version?: string;
|
|
31
|
+
wallets?: {
|
|
32
|
+
name: string;
|
|
33
|
+
version?: string;
|
|
34
|
+
}[];
|
|
35
|
+
features?: string[];
|
|
36
|
+
};
|
|
37
|
+
provider: any;
|
|
38
|
+
methods: string[];
|
|
39
|
+
events: string[];
|
|
40
|
+
};
|
|
41
|
+
type DetectedWallet = {
|
|
42
|
+
meta: WalletMeta;
|
|
43
|
+
via: "eip6963" | "injected-flag" | "walletconnect" | "solana-window";
|
|
44
|
+
detail?: EIP6963ProviderDetail;
|
|
45
|
+
provider?: any;
|
|
46
|
+
};
|
|
47
|
+
type SolanaProviderLike = {
|
|
48
|
+
isPhantom?: boolean;
|
|
49
|
+
isSolflare?: boolean;
|
|
50
|
+
isBackpack?: boolean;
|
|
51
|
+
isConnected?: boolean;
|
|
52
|
+
publicKey?: {
|
|
53
|
+
toString(): string;
|
|
54
|
+
};
|
|
55
|
+
connect?: (options?: Record<string, unknown>) => Promise<unknown>;
|
|
56
|
+
disconnect?: () => Promise<void>;
|
|
57
|
+
signAndSendTransaction?: (transaction: unknown, options?: Record<string, unknown>) => Promise<{
|
|
58
|
+
signature?: string;
|
|
59
|
+
} | string>;
|
|
60
|
+
signTransaction?: (transaction: unknown) => Promise<{
|
|
61
|
+
serialize: () => Uint8Array;
|
|
62
|
+
}>;
|
|
63
|
+
on?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
64
|
+
off?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
65
|
+
removeListener?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
66
|
+
};
|
|
67
|
+
type BaseWalletInterface = {
|
|
68
|
+
ecosystem: "evm" | "solana";
|
|
69
|
+
getAddress(): Promise<string>;
|
|
70
|
+
disconnect?(): Promise<void>;
|
|
71
|
+
};
|
|
72
|
+
type EvmWalletInterface = BaseWalletInterface & {
|
|
73
|
+
ecosystem: "evm";
|
|
74
|
+
getChainId(): Promise<number>;
|
|
75
|
+
switchChain(chainId: number): Promise<void>;
|
|
76
|
+
} & ({
|
|
77
|
+
type: "eip1193";
|
|
78
|
+
request(args: {
|
|
79
|
+
method: string;
|
|
80
|
+
params?: unknown[] | object;
|
|
81
|
+
}): Promise<unknown>;
|
|
82
|
+
} | {
|
|
83
|
+
type: "wagmi";
|
|
84
|
+
sendTransaction(tx: {
|
|
85
|
+
to: `0x${string}`;
|
|
86
|
+
data: `0x${string}`;
|
|
87
|
+
value?: bigint;
|
|
88
|
+
chainId?: number;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
hash: `0x${string}`;
|
|
91
|
+
}>;
|
|
92
|
+
});
|
|
93
|
+
type SolanaWalletInterface = BaseWalletInterface & {
|
|
94
|
+
ecosystem: "solana";
|
|
95
|
+
type: "solana";
|
|
96
|
+
getChainKey(): Promise<string>;
|
|
97
|
+
sendSerializedTransaction(serializedTransactionBase64: string, rpcUrl?: string): Promise<string>;
|
|
98
|
+
};
|
|
99
|
+
type WalletInterFaceAPI = EvmWalletInterface | SolanaWalletInterface;
|
|
100
|
+
type SimpleWalletInterface = {
|
|
101
|
+
getAddress(): Promise<string>;
|
|
102
|
+
disconnect?(): Promise<void>;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
type ChainMeta = {
|
|
106
|
+
id: string;
|
|
107
|
+
networkIdentifier: string;
|
|
108
|
+
nativeCurrency: {
|
|
109
|
+
symbol: string;
|
|
110
|
+
decimals: number;
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
type TokenMeta = {
|
|
115
|
+
chainId: string;
|
|
116
|
+
address: `0x${string}`;
|
|
117
|
+
symbol: string;
|
|
118
|
+
decimals: number;
|
|
119
|
+
visible?: boolean;
|
|
120
|
+
active?: boolean;
|
|
121
|
+
};
|
|
122
|
+
type BalanceRow = {
|
|
123
|
+
chain_key: string;
|
|
124
|
+
category: "native" | "erc20" | "spl" | "btc";
|
|
125
|
+
contract?: string;
|
|
126
|
+
address?: string;
|
|
127
|
+
symbol?: string;
|
|
128
|
+
decimals: number;
|
|
129
|
+
balance: string;
|
|
130
|
+
name?: string;
|
|
131
|
+
logoURI?: string;
|
|
132
|
+
usdPrice?: number;
|
|
133
|
+
};
|
|
134
|
+
type WalletAddressBalanceWrapper = {
|
|
135
|
+
chain_id: string;
|
|
136
|
+
balances: BalanceRow[];
|
|
137
|
+
count: number;
|
|
138
|
+
error: string | null;
|
|
139
|
+
source: string;
|
|
140
|
+
};
|
|
141
|
+
type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
|
|
142
|
+
interface NativeCurrency {
|
|
143
|
+
symbol: string;
|
|
144
|
+
name?: string;
|
|
145
|
+
decimals?: number;
|
|
146
|
+
icon?: string;
|
|
147
|
+
}
|
|
148
|
+
interface ChainDef {
|
|
149
|
+
/** API commonly sends both. We canonicalize on chainId as string. */
|
|
150
|
+
chainId: string | number;
|
|
151
|
+
id?: string | number;
|
|
152
|
+
/** Keys we use to resolve chains from presets / user input */
|
|
153
|
+
networkIdentifier?: string;
|
|
154
|
+
axelarChainName?: string;
|
|
155
|
+
networkName?: string;
|
|
156
|
+
/** UI/availability flags */
|
|
157
|
+
enabled?: boolean;
|
|
158
|
+
visible?: boolean;
|
|
159
|
+
isTestnet?: boolean;
|
|
160
|
+
/** Display */
|
|
161
|
+
chainIconURI?: string;
|
|
162
|
+
nativeCurrency?: NativeCurrency;
|
|
163
|
+
/** Kinds (some payloads use both) */
|
|
164
|
+
type?: ChainType;
|
|
165
|
+
chainType?: ChainType;
|
|
166
|
+
/** Nice-to-have extras we won't rely on but keep for completeness */
|
|
167
|
+
blockExplorerUrls?: string[];
|
|
168
|
+
rpc?: string;
|
|
169
|
+
rpcList?: string[];
|
|
170
|
+
}
|
|
171
|
+
type TokenType = "evm" | "solana" | "btc" | string;
|
|
172
|
+
interface TokenDef {
|
|
173
|
+
/** Core identity */
|
|
174
|
+
address: string;
|
|
175
|
+
chainId: string | number;
|
|
176
|
+
/** Display */
|
|
177
|
+
logoURI?: string;
|
|
178
|
+
name: string;
|
|
179
|
+
symbol: string;
|
|
180
|
+
/** Behavior / filtering */
|
|
181
|
+
decimals: number;
|
|
182
|
+
active?: boolean;
|
|
183
|
+
visible?: boolean;
|
|
184
|
+
type: TokenType;
|
|
185
|
+
/** Optional metadata */
|
|
186
|
+
usdPrice?: number;
|
|
187
|
+
coingeckoId?: string;
|
|
188
|
+
createdBy?: string;
|
|
189
|
+
subGraphIds?: string[];
|
|
190
|
+
subGraphOnly?: boolean;
|
|
191
|
+
}
|
|
192
|
+
type TokenWithBalance = TokenDef & {
|
|
193
|
+
balance?: bigint;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
type WalletAddressSource = "provider" | "manual" | "imported";
|
|
197
|
+
type WalletIdentityAddress = {
|
|
198
|
+
address: string;
|
|
199
|
+
chainType: ChainType;
|
|
200
|
+
chainKey?: string;
|
|
201
|
+
chainId?: string;
|
|
202
|
+
providerId?: string;
|
|
203
|
+
source: WalletAddressSource;
|
|
204
|
+
};
|
|
205
|
+
type WalletIdentity = {
|
|
206
|
+
addresses: WalletIdentityAddress[];
|
|
207
|
+
};
|
|
208
|
+
type WalletAddressResolution = {
|
|
209
|
+
status: "resolved";
|
|
210
|
+
address: string;
|
|
211
|
+
source: WalletAddressSource;
|
|
212
|
+
chainType: ChainType;
|
|
213
|
+
chainKey?: string;
|
|
214
|
+
chainId?: string;
|
|
215
|
+
} | {
|
|
216
|
+
status: "missing" | "invalid";
|
|
217
|
+
reason: string;
|
|
218
|
+
address?: string;
|
|
219
|
+
source?: WalletAddressSource;
|
|
220
|
+
chainType?: ChainType;
|
|
221
|
+
chainKey?: string;
|
|
222
|
+
chainId?: string;
|
|
223
|
+
};
|
|
224
|
+
type WalletIdentityChainLike = ChainDef | ChainType | string | null;
|
|
225
|
+
|
|
226
|
+
type WagmiConnector = {
|
|
227
|
+
/** Human label like "MetaMask", "WalletConnect" */
|
|
228
|
+
name: string;
|
|
229
|
+
/** Free-form type hint: "injected" | "walletConnect" | ... */
|
|
230
|
+
type?: string;
|
|
231
|
+
};
|
|
232
|
+
type WagmiBridge = {
|
|
233
|
+
/** Host app believes it’s connected (Wagmi state) */
|
|
234
|
+
isConnected(): boolean;
|
|
235
|
+
/** List of available connectors */
|
|
236
|
+
connectors(): WagmiConnector[];
|
|
237
|
+
/** Try connecting via a specific connector */
|
|
238
|
+
connect(connector: WagmiConnector): Promise<void>;
|
|
239
|
+
/** Disconnect current session */
|
|
240
|
+
disconnect(): Promise<void>;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
declare function createWalletIdentity(addresses?: WalletIdentityAddress[]): WalletIdentity;
|
|
244
|
+
declare function upsertWalletIdentityAddress(identity: WalletIdentity, next: WalletIdentityAddress): WalletIdentity;
|
|
245
|
+
declare function resolveWalletAddressForChain(identity: WalletIdentity, chain?: WalletIdentityChainLike): WalletAddressResolution;
|
|
246
|
+
declare function buildWalletIdentityAddress(params: {
|
|
247
|
+
address: string;
|
|
248
|
+
chain: WalletIdentityChainLike;
|
|
249
|
+
source: WalletAddressSource;
|
|
250
|
+
providerId?: string;
|
|
251
|
+
}): WalletIdentityAddress | null;
|
|
252
|
+
declare class IdentityStore {
|
|
253
|
+
private _identity;
|
|
254
|
+
get snapshot(): WalletIdentity;
|
|
255
|
+
reset(): void;
|
|
256
|
+
upsert(next: WalletIdentityAddress): WalletIdentity;
|
|
257
|
+
resolve(chain?: WalletIdentityChainLike): WalletAddressResolution;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
type Status = "idle" | "detecting" | "connecting" | "connected" | "error";
|
|
261
|
+
type Listener = (s: Status) => void;
|
|
262
|
+
declare class WalletManager {
|
|
263
|
+
private _status;
|
|
264
|
+
private _wallet;
|
|
265
|
+
private _detected;
|
|
266
|
+
private _listeners;
|
|
267
|
+
private _error;
|
|
268
|
+
private _identity;
|
|
269
|
+
private _providerCleanup;
|
|
270
|
+
private _connectedWalletId;
|
|
271
|
+
get status(): Status;
|
|
272
|
+
get error(): unknown;
|
|
273
|
+
get detected(): DetectedWallet[];
|
|
274
|
+
get wallet(): WalletInterFaceAPI | null;
|
|
275
|
+
get simple(): SimpleWalletInterface | null;
|
|
276
|
+
get identity(): WalletIdentity;
|
|
277
|
+
get connectedWalletId(): string | null;
|
|
278
|
+
onChange(fn: Listener): () => boolean;
|
|
279
|
+
private emit;
|
|
280
|
+
/** Provide detection results (from your hook or custom function). */
|
|
281
|
+
setDetected(list: DetectedWallet[]): void;
|
|
282
|
+
/** Optional: auto attach to the first/best detected wallet. */
|
|
283
|
+
autoAttach(opts?: {
|
|
284
|
+
wagmi?: WagmiBridge;
|
|
285
|
+
pick?: (list: DetectedWallet[]) => DetectedWallet | undefined;
|
|
286
|
+
}): Promise<void>;
|
|
287
|
+
connectDetected(target: DetectedWallet, opts?: {
|
|
288
|
+
wagmi?: WagmiBridge;
|
|
289
|
+
}): Promise<void>;
|
|
290
|
+
disconnect(wagmi?: WagmiBridge): Promise<void>;
|
|
291
|
+
/** Directly attach a pre-provided wallet interface (from old provider prop). */
|
|
292
|
+
attachWallet(api: WalletInterFaceAPI): void;
|
|
293
|
+
/** Optional helper to set explicit status (e.g., "initializing" UX). */
|
|
294
|
+
setStatus(s: Status): void;
|
|
295
|
+
addIdentityAddress(address: WalletIdentityAddress): void;
|
|
296
|
+
resolveAddressForChain(chain: Parameters<IdentityStore["resolve"]>[0]): WalletAddressResolution;
|
|
297
|
+
private clearProviderCleanup;
|
|
298
|
+
private clearConnectedWalletState;
|
|
299
|
+
private bindProviderEvents;
|
|
300
|
+
private syncIdentityFromWallet;
|
|
301
|
+
}
|
|
302
|
+
declare const walletManager: WalletManager;
|
|
303
|
+
/** If you’re in React, call this once near your widget to push detection results into the manager. */
|
|
304
|
+
declare function useWireDetectionIntoManager(): void;
|
|
305
|
+
|
|
306
|
+
export { walletManager as A, type BalanceRow as B, type ChainMeta as C, type DetectedWallet as D, type EIP1193 as E, IdentityStore as I, type NativeCurrency as N, type SolanaProviderLike as S, type TokenMeta as T, type WalletInterFaceAPI as W, type WagmiBridge as a, type WagmiConnector as b, createWalletIdentity as c, upsertWalletIdentityAddress as d, buildWalletIdentityAddress as e, type WalletId as f, type WalletCategory as g, type WalletEcosystem as h, type WalletMeta as i, type EIP6963ProviderDetail as j, type EvmWalletInterface as k, type SolanaWalletInterface as l, type SimpleWalletInterface as m, type WalletAddressBalanceWrapper as n, type ChainType as o, type ChainDef as p, type TokenType as q, resolveWalletAddressForChain as r, type TokenDef as s, type TokenWithBalance as t, useWireDetectionIntoManager as u, type WalletAddressSource as v, type WalletIdentityAddress as w, type WalletIdentity as x, type WalletAddressResolution as y, type WalletIdentityChainLike as z };
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
type WalletId = "metamask" | "coinbase" | "walletconnect" | "rainbow" | "phantom-evm" | "phantom-solana" | "solflare" | "backpack" | "rabby" | "brave" | "okx" | "zerion" | "taho" | "safe" | "imtoken" | "trust" | "bitget" | "kucoin";
|
|
2
|
+
type WalletCategory = "injected" | "walletconnect" | "app";
|
|
3
|
+
type WalletEcosystem = "evm" | "solana" | "multi";
|
|
4
|
+
type WalletMeta = {
|
|
5
|
+
id: WalletId;
|
|
6
|
+
name: string;
|
|
7
|
+
category: WalletCategory;
|
|
8
|
+
ecosystem: WalletEcosystem;
|
|
9
|
+
logo: string;
|
|
10
|
+
emoji?: string;
|
|
11
|
+
homepage?: string;
|
|
12
|
+
chromeWebStore?: string;
|
|
13
|
+
android?: string;
|
|
14
|
+
ios?: string;
|
|
15
|
+
deepLink?: (currentUrl: string) => string;
|
|
16
|
+
detectFlags?: string[];
|
|
17
|
+
};
|
|
18
|
+
type EIP1193 = {
|
|
19
|
+
request(args: {
|
|
20
|
+
method: string;
|
|
21
|
+
params?: unknown[] | object;
|
|
22
|
+
}): Promise<unknown>;
|
|
23
|
+
};
|
|
24
|
+
type EIP6963ProviderDetail = {
|
|
25
|
+
info: {
|
|
26
|
+
uuid: string;
|
|
27
|
+
name: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
rdns?: string;
|
|
30
|
+
version?: string;
|
|
31
|
+
wallets?: {
|
|
32
|
+
name: string;
|
|
33
|
+
version?: string;
|
|
34
|
+
}[];
|
|
35
|
+
features?: string[];
|
|
36
|
+
};
|
|
37
|
+
provider: any;
|
|
38
|
+
methods: string[];
|
|
39
|
+
events: string[];
|
|
40
|
+
};
|
|
41
|
+
type DetectedWallet = {
|
|
42
|
+
meta: WalletMeta;
|
|
43
|
+
via: "eip6963" | "injected-flag" | "walletconnect" | "solana-window";
|
|
44
|
+
detail?: EIP6963ProviderDetail;
|
|
45
|
+
provider?: any;
|
|
46
|
+
};
|
|
47
|
+
type SolanaProviderLike = {
|
|
48
|
+
isPhantom?: boolean;
|
|
49
|
+
isSolflare?: boolean;
|
|
50
|
+
isBackpack?: boolean;
|
|
51
|
+
isConnected?: boolean;
|
|
52
|
+
publicKey?: {
|
|
53
|
+
toString(): string;
|
|
54
|
+
};
|
|
55
|
+
connect?: (options?: Record<string, unknown>) => Promise<unknown>;
|
|
56
|
+
disconnect?: () => Promise<void>;
|
|
57
|
+
signAndSendTransaction?: (transaction: unknown, options?: Record<string, unknown>) => Promise<{
|
|
58
|
+
signature?: string;
|
|
59
|
+
} | string>;
|
|
60
|
+
signTransaction?: (transaction: unknown) => Promise<{
|
|
61
|
+
serialize: () => Uint8Array;
|
|
62
|
+
}>;
|
|
63
|
+
on?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
64
|
+
off?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
65
|
+
removeListener?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
66
|
+
};
|
|
67
|
+
type BaseWalletInterface = {
|
|
68
|
+
ecosystem: "evm" | "solana";
|
|
69
|
+
getAddress(): Promise<string>;
|
|
70
|
+
disconnect?(): Promise<void>;
|
|
71
|
+
};
|
|
72
|
+
type EvmWalletInterface = BaseWalletInterface & {
|
|
73
|
+
ecosystem: "evm";
|
|
74
|
+
getChainId(): Promise<number>;
|
|
75
|
+
switchChain(chainId: number): Promise<void>;
|
|
76
|
+
} & ({
|
|
77
|
+
type: "eip1193";
|
|
78
|
+
request(args: {
|
|
79
|
+
method: string;
|
|
80
|
+
params?: unknown[] | object;
|
|
81
|
+
}): Promise<unknown>;
|
|
82
|
+
} | {
|
|
83
|
+
type: "wagmi";
|
|
84
|
+
sendTransaction(tx: {
|
|
85
|
+
to: `0x${string}`;
|
|
86
|
+
data: `0x${string}`;
|
|
87
|
+
value?: bigint;
|
|
88
|
+
chainId?: number;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
hash: `0x${string}`;
|
|
91
|
+
}>;
|
|
92
|
+
});
|
|
93
|
+
type SolanaWalletInterface = BaseWalletInterface & {
|
|
94
|
+
ecosystem: "solana";
|
|
95
|
+
type: "solana";
|
|
96
|
+
getChainKey(): Promise<string>;
|
|
97
|
+
sendSerializedTransaction(serializedTransactionBase64: string, rpcUrl?: string): Promise<string>;
|
|
98
|
+
};
|
|
99
|
+
type WalletInterFaceAPI = EvmWalletInterface | SolanaWalletInterface;
|
|
100
|
+
type SimpleWalletInterface = {
|
|
101
|
+
getAddress(): Promise<string>;
|
|
102
|
+
disconnect?(): Promise<void>;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
type ChainMeta = {
|
|
106
|
+
id: string;
|
|
107
|
+
networkIdentifier: string;
|
|
108
|
+
nativeCurrency: {
|
|
109
|
+
symbol: string;
|
|
110
|
+
decimals: number;
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
type TokenMeta = {
|
|
115
|
+
chainId: string;
|
|
116
|
+
address: `0x${string}`;
|
|
117
|
+
symbol: string;
|
|
118
|
+
decimals: number;
|
|
119
|
+
visible?: boolean;
|
|
120
|
+
active?: boolean;
|
|
121
|
+
};
|
|
122
|
+
type BalanceRow = {
|
|
123
|
+
chain_key: string;
|
|
124
|
+
category: "native" | "erc20" | "spl" | "btc";
|
|
125
|
+
contract?: string;
|
|
126
|
+
address?: string;
|
|
127
|
+
symbol?: string;
|
|
128
|
+
decimals: number;
|
|
129
|
+
balance: string;
|
|
130
|
+
name?: string;
|
|
131
|
+
logoURI?: string;
|
|
132
|
+
usdPrice?: number;
|
|
133
|
+
};
|
|
134
|
+
type WalletAddressBalanceWrapper = {
|
|
135
|
+
chain_id: string;
|
|
136
|
+
balances: BalanceRow[];
|
|
137
|
+
count: number;
|
|
138
|
+
error: string | null;
|
|
139
|
+
source: string;
|
|
140
|
+
};
|
|
141
|
+
type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
|
|
142
|
+
interface NativeCurrency {
|
|
143
|
+
symbol: string;
|
|
144
|
+
name?: string;
|
|
145
|
+
decimals?: number;
|
|
146
|
+
icon?: string;
|
|
147
|
+
}
|
|
148
|
+
interface ChainDef {
|
|
149
|
+
/** API commonly sends both. We canonicalize on chainId as string. */
|
|
150
|
+
chainId: string | number;
|
|
151
|
+
id?: string | number;
|
|
152
|
+
/** Keys we use to resolve chains from presets / user input */
|
|
153
|
+
networkIdentifier?: string;
|
|
154
|
+
axelarChainName?: string;
|
|
155
|
+
networkName?: string;
|
|
156
|
+
/** UI/availability flags */
|
|
157
|
+
enabled?: boolean;
|
|
158
|
+
visible?: boolean;
|
|
159
|
+
isTestnet?: boolean;
|
|
160
|
+
/** Display */
|
|
161
|
+
chainIconURI?: string;
|
|
162
|
+
nativeCurrency?: NativeCurrency;
|
|
163
|
+
/** Kinds (some payloads use both) */
|
|
164
|
+
type?: ChainType;
|
|
165
|
+
chainType?: ChainType;
|
|
166
|
+
/** Nice-to-have extras we won't rely on but keep for completeness */
|
|
167
|
+
blockExplorerUrls?: string[];
|
|
168
|
+
rpc?: string;
|
|
169
|
+
rpcList?: string[];
|
|
170
|
+
}
|
|
171
|
+
type TokenType = "evm" | "solana" | "btc" | string;
|
|
172
|
+
interface TokenDef {
|
|
173
|
+
/** Core identity */
|
|
174
|
+
address: string;
|
|
175
|
+
chainId: string | number;
|
|
176
|
+
/** Display */
|
|
177
|
+
logoURI?: string;
|
|
178
|
+
name: string;
|
|
179
|
+
symbol: string;
|
|
180
|
+
/** Behavior / filtering */
|
|
181
|
+
decimals: number;
|
|
182
|
+
active?: boolean;
|
|
183
|
+
visible?: boolean;
|
|
184
|
+
type: TokenType;
|
|
185
|
+
/** Optional metadata */
|
|
186
|
+
usdPrice?: number;
|
|
187
|
+
coingeckoId?: string;
|
|
188
|
+
createdBy?: string;
|
|
189
|
+
subGraphIds?: string[];
|
|
190
|
+
subGraphOnly?: boolean;
|
|
191
|
+
}
|
|
192
|
+
type TokenWithBalance = TokenDef & {
|
|
193
|
+
balance?: bigint;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
type WalletAddressSource = "provider" | "manual" | "imported";
|
|
197
|
+
type WalletIdentityAddress = {
|
|
198
|
+
address: string;
|
|
199
|
+
chainType: ChainType;
|
|
200
|
+
chainKey?: string;
|
|
201
|
+
chainId?: string;
|
|
202
|
+
providerId?: string;
|
|
203
|
+
source: WalletAddressSource;
|
|
204
|
+
};
|
|
205
|
+
type WalletIdentity = {
|
|
206
|
+
addresses: WalletIdentityAddress[];
|
|
207
|
+
};
|
|
208
|
+
type WalletAddressResolution = {
|
|
209
|
+
status: "resolved";
|
|
210
|
+
address: string;
|
|
211
|
+
source: WalletAddressSource;
|
|
212
|
+
chainType: ChainType;
|
|
213
|
+
chainKey?: string;
|
|
214
|
+
chainId?: string;
|
|
215
|
+
} | {
|
|
216
|
+
status: "missing" | "invalid";
|
|
217
|
+
reason: string;
|
|
218
|
+
address?: string;
|
|
219
|
+
source?: WalletAddressSource;
|
|
220
|
+
chainType?: ChainType;
|
|
221
|
+
chainKey?: string;
|
|
222
|
+
chainId?: string;
|
|
223
|
+
};
|
|
224
|
+
type WalletIdentityChainLike = ChainDef | ChainType | string | null;
|
|
225
|
+
|
|
226
|
+
type WagmiConnector = {
|
|
227
|
+
/** Human label like "MetaMask", "WalletConnect" */
|
|
228
|
+
name: string;
|
|
229
|
+
/** Free-form type hint: "injected" | "walletConnect" | ... */
|
|
230
|
+
type?: string;
|
|
231
|
+
};
|
|
232
|
+
type WagmiBridge = {
|
|
233
|
+
/** Host app believes it’s connected (Wagmi state) */
|
|
234
|
+
isConnected(): boolean;
|
|
235
|
+
/** List of available connectors */
|
|
236
|
+
connectors(): WagmiConnector[];
|
|
237
|
+
/** Try connecting via a specific connector */
|
|
238
|
+
connect(connector: WagmiConnector): Promise<void>;
|
|
239
|
+
/** Disconnect current session */
|
|
240
|
+
disconnect(): Promise<void>;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
declare function createWalletIdentity(addresses?: WalletIdentityAddress[]): WalletIdentity;
|
|
244
|
+
declare function upsertWalletIdentityAddress(identity: WalletIdentity, next: WalletIdentityAddress): WalletIdentity;
|
|
245
|
+
declare function resolveWalletAddressForChain(identity: WalletIdentity, chain?: WalletIdentityChainLike): WalletAddressResolution;
|
|
246
|
+
declare function buildWalletIdentityAddress(params: {
|
|
247
|
+
address: string;
|
|
248
|
+
chain: WalletIdentityChainLike;
|
|
249
|
+
source: WalletAddressSource;
|
|
250
|
+
providerId?: string;
|
|
251
|
+
}): WalletIdentityAddress | null;
|
|
252
|
+
declare class IdentityStore {
|
|
253
|
+
private _identity;
|
|
254
|
+
get snapshot(): WalletIdentity;
|
|
255
|
+
reset(): void;
|
|
256
|
+
upsert(next: WalletIdentityAddress): WalletIdentity;
|
|
257
|
+
resolve(chain?: WalletIdentityChainLike): WalletAddressResolution;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
type Status = "idle" | "detecting" | "connecting" | "connected" | "error";
|
|
261
|
+
type Listener = (s: Status) => void;
|
|
262
|
+
declare class WalletManager {
|
|
263
|
+
private _status;
|
|
264
|
+
private _wallet;
|
|
265
|
+
private _detected;
|
|
266
|
+
private _listeners;
|
|
267
|
+
private _error;
|
|
268
|
+
private _identity;
|
|
269
|
+
private _providerCleanup;
|
|
270
|
+
private _connectedWalletId;
|
|
271
|
+
get status(): Status;
|
|
272
|
+
get error(): unknown;
|
|
273
|
+
get detected(): DetectedWallet[];
|
|
274
|
+
get wallet(): WalletInterFaceAPI | null;
|
|
275
|
+
get simple(): SimpleWalletInterface | null;
|
|
276
|
+
get identity(): WalletIdentity;
|
|
277
|
+
get connectedWalletId(): string | null;
|
|
278
|
+
onChange(fn: Listener): () => boolean;
|
|
279
|
+
private emit;
|
|
280
|
+
/** Provide detection results (from your hook or custom function). */
|
|
281
|
+
setDetected(list: DetectedWallet[]): void;
|
|
282
|
+
/** Optional: auto attach to the first/best detected wallet. */
|
|
283
|
+
autoAttach(opts?: {
|
|
284
|
+
wagmi?: WagmiBridge;
|
|
285
|
+
pick?: (list: DetectedWallet[]) => DetectedWallet | undefined;
|
|
286
|
+
}): Promise<void>;
|
|
287
|
+
connectDetected(target: DetectedWallet, opts?: {
|
|
288
|
+
wagmi?: WagmiBridge;
|
|
289
|
+
}): Promise<void>;
|
|
290
|
+
disconnect(wagmi?: WagmiBridge): Promise<void>;
|
|
291
|
+
/** Directly attach a pre-provided wallet interface (from old provider prop). */
|
|
292
|
+
attachWallet(api: WalletInterFaceAPI): void;
|
|
293
|
+
/** Optional helper to set explicit status (e.g., "initializing" UX). */
|
|
294
|
+
setStatus(s: Status): void;
|
|
295
|
+
addIdentityAddress(address: WalletIdentityAddress): void;
|
|
296
|
+
resolveAddressForChain(chain: Parameters<IdentityStore["resolve"]>[0]): WalletAddressResolution;
|
|
297
|
+
private clearProviderCleanup;
|
|
298
|
+
private clearConnectedWalletState;
|
|
299
|
+
private bindProviderEvents;
|
|
300
|
+
private syncIdentityFromWallet;
|
|
301
|
+
}
|
|
302
|
+
declare const walletManager: WalletManager;
|
|
303
|
+
/** If you’re in React, call this once near your widget to push detection results into the manager. */
|
|
304
|
+
declare function useWireDetectionIntoManager(): void;
|
|
305
|
+
|
|
306
|
+
export { walletManager as A, type BalanceRow as B, type ChainMeta as C, type DetectedWallet as D, type EIP1193 as E, IdentityStore as I, type NativeCurrency as N, type SolanaProviderLike as S, type TokenMeta as T, type WalletInterFaceAPI as W, type WagmiBridge as a, type WagmiConnector as b, createWalletIdentity as c, upsertWalletIdentityAddress as d, buildWalletIdentityAddress as e, type WalletId as f, type WalletCategory as g, type WalletEcosystem as h, type WalletMeta as i, type EIP6963ProviderDetail as j, type EvmWalletInterface as k, type SolanaWalletInterface as l, type SimpleWalletInterface as m, type WalletAddressBalanceWrapper as n, type ChainType as o, type ChainDef as p, type TokenType as q, resolveWalletAddressForChain as r, type TokenDef as s, type TokenWithBalance as t, useWireDetectionIntoManager as u, type WalletAddressSource as v, type WalletIdentityAddress as w, type WalletIdentity as x, type WalletAddressResolution as y, type WalletIdentityChainLike as z };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type NavigationStep = "home" | "select-token" | "crypto-pay" | "processing" | "success" | "error";
|
|
2
|
+
interface Token {
|
|
3
|
+
address: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
name: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
iconUrl?: string;
|
|
8
|
+
logoURI?: string;
|
|
9
|
+
balance?: string;
|
|
10
|
+
chainId: string | number;
|
|
11
|
+
usdPrice: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { NavigationStep as N, Token as T };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type NavigationStep = "home" | "select-token" | "crypto-pay" | "processing" | "success" | "error";
|
|
2
|
+
interface Token {
|
|
3
|
+
address: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
name: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
iconUrl?: string;
|
|
8
|
+
logoURI?: string;
|
|
9
|
+
balance?: string;
|
|
10
|
+
chainId: string | number;
|
|
11
|
+
usdPrice: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { NavigationStep as N, Token as T };
|