@naculus/connect-appkit-vue 0.2.4 → 0.2.5
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/index.cjs +1154 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +376 -4
- package/dist/index.d.ts +376 -4
- package/dist/index.js +1154 -40
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StencilVueComponent } from '@stencil/vue-output-target/runtime';
|
|
2
2
|
import { JSX } from '@naculus/connect-appkit-wc';
|
|
3
|
-
import { ComputedRef, MaybeRefOrGetter, shallowRef, ref
|
|
4
|
-
import { WalletChain, ChainInfo, ChainCapabilities, AtomicSupport, SolanaRoles, SolanaRolesAbsence, SolanaIdentity, SolanaSigner, SolanaPayer, SolanaRolesSource } from '@naculus/connect-appkit-core';
|
|
3
|
+
import { ComputedRef, MaybeRefOrGetter, MaybeRef, ShallowRef, shallowRef, ref } from 'vue';
|
|
4
|
+
import { NotificationSettingsStorage, RouteQuote, RouteQuoteInput, GetRouteQuotes, CostComparison, CompareCostsInput, CompareCosts, ExecutableQuote, ExecuteRouteOptions, ExecuteRouteResult, ExecuteRouteError, ExecuteRoute, DestinationValidation, WalletChain, ChainInfo, ChainCapabilities, AtomicSupport, SolanaRoles, SolanaRolesAbsence, SolanaIdentity, SolanaSigner, SolanaPayer, SolanaRolesSource } from '@naculus/connect-appkit-core';
|
|
5
5
|
export { AtomicSupport, ChainCapabilities, SolanaIdentity, SolanaPayer, SolanaRoles, SolanaRolesAbsence, SolanaRolesSource, SolanaSigner, SolanaWalletFeatures } from '@naculus/connect-appkit-core';
|
|
6
|
-
import { PassphraseGate } from '@naculus/connect-core';
|
|
6
|
+
import { InAppChannel, NotificationItem, NotificationSettings, ActiveSessionBundle, ChainSession, SessionManager, WalletError, TokenListSource, TokenListManager, TokenListEntry, TokenSearchResult, ERC20_MIN_ABI, AddressResult, NameResolverConfig, NameResult, PassphraseGate } from '@naculus/connect-core';
|
|
7
7
|
|
|
8
8
|
declare const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion>;
|
|
9
9
|
declare const AppkitAccountButton: StencilVueComponent<JSX.AppkitAccountButton>;
|
|
@@ -56,6 +56,303 @@ interface UseAccountsReturn {
|
|
|
56
56
|
*/
|
|
57
57
|
declare function useAccounts(accounts: MaybeRefOrGetter<string[] | null | undefined>): UseAccountsReturn;
|
|
58
58
|
|
|
59
|
+
interface UseNotificationOptions {
|
|
60
|
+
channel?: MaybeRef<InAppChannel>;
|
|
61
|
+
storage?: MaybeRef<NotificationSettingsStorage>;
|
|
62
|
+
}
|
|
63
|
+
interface UseNotificationReturn {
|
|
64
|
+
notifications: ShallowRef<NotificationItem[]>;
|
|
65
|
+
unreadCount: ComputedRef<number>;
|
|
66
|
+
settings: ShallowRef<NotificationSettings>;
|
|
67
|
+
addNotification: (item: Omit<NotificationItem, "id" | "timestamp">) => void;
|
|
68
|
+
clear: () => void;
|
|
69
|
+
clearOne: (id: string) => void;
|
|
70
|
+
markAsRead: (id: string) => void;
|
|
71
|
+
markAllAsRead: () => void;
|
|
72
|
+
updateSettings: (update: Partial<NotificationSettings>) => void;
|
|
73
|
+
setChannels: (channels: string[]) => void;
|
|
74
|
+
muteChain: (chainId: string) => void;
|
|
75
|
+
unmuteChain: (chainId: string) => void;
|
|
76
|
+
}
|
|
77
|
+
/** Vue state shell over the shared in-app notification actions. */
|
|
78
|
+
declare function useNotification(options?: UseNotificationOptions): UseNotificationReturn;
|
|
79
|
+
|
|
80
|
+
interface UseAccountReturn {
|
|
81
|
+
accounts: ComputedRef<AccountEntry[] | null>;
|
|
82
|
+
evmAccount: ComputedRef<string | null>;
|
|
83
|
+
primaryAccount: ComputedRef<string | null>;
|
|
84
|
+
isConnected: ComputedRef<boolean>;
|
|
85
|
+
count: ComputedRef<number>;
|
|
86
|
+
}
|
|
87
|
+
/** React useAccount's connected-state view of the shared account parser. */
|
|
88
|
+
declare function useAccount(accounts: MaybeRefOrGetter<string[] | null | undefined>, connected: MaybeRefOrGetter<boolean>): UseAccountReturn;
|
|
89
|
+
|
|
90
|
+
interface UseSessionReturn {
|
|
91
|
+
session: ComputedRef<ActiveSessionBundle["walletSession"] | null>;
|
|
92
|
+
chainSessions: ComputedRef<ChainSession[]>;
|
|
93
|
+
activeChainId: ComputedRef<string | null>;
|
|
94
|
+
isConnected: ComputedRef<boolean>;
|
|
95
|
+
connectorId: ComputedRef<string | null>;
|
|
96
|
+
}
|
|
97
|
+
/** Reactively expose a caller-owned SessionManager's active bundle. */
|
|
98
|
+
declare function useSession(manager: MaybeRefOrGetter<SessionManager | null | undefined>): UseSessionReturn;
|
|
99
|
+
|
|
100
|
+
interface UseConnectReturn {
|
|
101
|
+
connect: () => Promise<void>;
|
|
102
|
+
isConnecting: ComputedRef<boolean>;
|
|
103
|
+
error: ShallowRef<Error | null>;
|
|
104
|
+
}
|
|
105
|
+
/** Connection state around a caller-owned action; never connects on mount. */
|
|
106
|
+
declare function useConnect(action: MaybeRef<() => Promise<void>>, status: MaybeRefOrGetter<string>): UseConnectReturn;
|
|
107
|
+
|
|
108
|
+
interface UseDisconnectReturn {
|
|
109
|
+
disconnect: () => Promise<void>;
|
|
110
|
+
isDisconnecting: ShallowRef<boolean>;
|
|
111
|
+
error: ShallowRef<Error | null>;
|
|
112
|
+
cleanup: () => void;
|
|
113
|
+
}
|
|
114
|
+
/** Disconnect through a caller-owned action, preserving React's no-op when already disconnected. */
|
|
115
|
+
declare function useDisconnect(action: MaybeRef<() => Promise<void>>, status: MaybeRefOrGetter<string>): UseDisconnectReturn;
|
|
116
|
+
|
|
117
|
+
interface UseSwitchChainReturn {
|
|
118
|
+
switchChain: (chainId: string) => Promise<void>;
|
|
119
|
+
isSwitching: ShallowRef<boolean>;
|
|
120
|
+
currentChainId: ComputedRef<string | null>;
|
|
121
|
+
error: ShallowRef<WalletError | null>;
|
|
122
|
+
clearError: () => void;
|
|
123
|
+
}
|
|
124
|
+
/** Vue counterpart of React useSwitchChain around a caller-owned action. */
|
|
125
|
+
declare function useSwitchChain(action: MaybeRef<(chainId: string) => Promise<void>>, chainId: MaybeRefOrGetter<string | null | undefined>): UseSwitchChainReturn;
|
|
126
|
+
|
|
127
|
+
/** Minimal read-only contract; a viem PublicClient satisfies it. */
|
|
128
|
+
interface NativeBalanceReader {
|
|
129
|
+
getBalance(args: {
|
|
130
|
+
address: `0x${string}`;
|
|
131
|
+
}): Promise<bigint>;
|
|
132
|
+
}
|
|
133
|
+
interface UseBalanceOptions {
|
|
134
|
+
/** Native currency decimals. Default 18. */
|
|
135
|
+
decimals?: MaybeRefOrGetter<number | null | undefined>;
|
|
136
|
+
/**
|
|
137
|
+
* Native currency symbol, or null when it is not known. Null rather than
|
|
138
|
+
* "ETH": a wrong unit beside the number is worse than no unit.
|
|
139
|
+
*/
|
|
140
|
+
symbol?: MaybeRefOrGetter<string | null | undefined>;
|
|
141
|
+
/** Auto-refresh interval in milliseconds. Default: no auto-refresh. */
|
|
142
|
+
refreshInterval?: MaybeRefOrGetter<number | null | undefined>;
|
|
143
|
+
}
|
|
144
|
+
interface UseBalanceReturn {
|
|
145
|
+
/** Raw balance in wei as a decimal string, or null when unread. */
|
|
146
|
+
balance: ShallowRef<string | null>;
|
|
147
|
+
/** Human-readable balance in the native unit, or null when unread. */
|
|
148
|
+
formatted: ComputedRef<string | null>;
|
|
149
|
+
symbol: ComputedRef<string | null>;
|
|
150
|
+
isFetching: ShallowRef<boolean>;
|
|
151
|
+
error: ShallowRef<Error | null>;
|
|
152
|
+
refetch: () => Promise<void>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Native balance of an EVM account through a caller-owned reader.
|
|
156
|
+
*
|
|
157
|
+
* Vue has no AppKit provider, so the client is explicit. Unlike the React
|
|
158
|
+
* hook this does not fetch a USD price: that is an outward HTTP call the
|
|
159
|
+
* caller did not hand us, and it belongs beside the reader they did.
|
|
160
|
+
*/
|
|
161
|
+
declare function useBalance(account: MaybeRefOrGetter<string | null | undefined>, client: MaybeRefOrGetter<NativeBalanceReader | null | undefined>, options?: UseBalanceOptions): UseBalanceReturn;
|
|
162
|
+
|
|
163
|
+
interface UseRouteQuoteOptions {
|
|
164
|
+
/** Debounce before auto-fetching after an input change (default 300 ms). */
|
|
165
|
+
debounceMs?: number;
|
|
166
|
+
}
|
|
167
|
+
interface UseRouteQuoteReturn {
|
|
168
|
+
quotes: ShallowRef<RouteQuote[]>;
|
|
169
|
+
loading: ShallowRef<boolean>;
|
|
170
|
+
error: ShallowRef<Error | null>;
|
|
171
|
+
refresh: () => Promise<void>;
|
|
172
|
+
clear: () => void;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Debounced cross-chain route quotes through a caller-supplied quote
|
|
176
|
+
* function, mirroring the React hook. Which inputs are quotable is decided
|
|
177
|
+
* in appkit-core; this file debounces and drops late results.
|
|
178
|
+
*/
|
|
179
|
+
declare function useRouteQuote(input: MaybeRefOrGetter<RouteQuoteInput>, getQuotes?: MaybeRef<GetRouteQuotes | null | undefined>, options?: UseRouteQuoteOptions): UseRouteQuoteReturn;
|
|
180
|
+
|
|
181
|
+
interface UseCompareCostsReturn {
|
|
182
|
+
comparisons: ShallowRef<CostComparison[]>;
|
|
183
|
+
loading: ShallowRef<boolean>;
|
|
184
|
+
error: ShallowRef<Error | null>;
|
|
185
|
+
refresh: () => Promise<void>;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Compare an operation's cost across chains through a caller-supplied
|
|
189
|
+
* function, mirroring the React hook. Re-fetches when the input's *value*
|
|
190
|
+
* changes (appkit-core's `compareCostsKey`), not when a new array or object
|
|
191
|
+
* with the same content is passed; only the newest request may write.
|
|
192
|
+
*/
|
|
193
|
+
declare function useCompareCosts(input: MaybeRefOrGetter<CompareCostsInput>, compareCosts?: MaybeRef<CompareCosts | null | undefined>): UseCompareCostsReturn;
|
|
194
|
+
|
|
195
|
+
interface UseExecuteRouteReturn {
|
|
196
|
+
execute: (quote: ExecutableQuote, recipient: string, options?: ExecuteRouteOptions) => Promise<ExecuteRouteResult | null>;
|
|
197
|
+
executing: ShallowRef<boolean>;
|
|
198
|
+
result: ShallowRef<ExecuteRouteResult | null>;
|
|
199
|
+
error: ShallowRef<ExecuteRouteError | null>;
|
|
200
|
+
reset: () => void;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Execute a quoted route once through a caller-supplied executor, mirroring
|
|
204
|
+
* the React hook. The recipient check and error shape are appkit-core's. A
|
|
205
|
+
* second call while one is in flight is refused, and `reset()` deliberately
|
|
206
|
+
* does not unlock that guard: the first request is still out there.
|
|
207
|
+
*/
|
|
208
|
+
declare function useExecuteRoute(executeRoute?: MaybeRef<ExecuteRoute | null | undefined>): UseExecuteRouteReturn;
|
|
209
|
+
|
|
210
|
+
interface UseTokenListOptions {
|
|
211
|
+
/** Load on creation (default: true). */
|
|
212
|
+
autoLoad?: boolean;
|
|
213
|
+
/** Custom sources; the manager's defaults otherwise. */
|
|
214
|
+
sources?: TokenListSource[];
|
|
215
|
+
/** Reuse a caller-owned manager instead of creating one. */
|
|
216
|
+
manager?: TokenListManager;
|
|
217
|
+
}
|
|
218
|
+
interface UseTokenListReturn {
|
|
219
|
+
/** Tokens for the given chain, or all chains when none is given. */
|
|
220
|
+
tokens: ShallowRef<TokenListEntry[]>;
|
|
221
|
+
isLoading: ShallowRef<boolean>;
|
|
222
|
+
/** True once a load has completed at least once. */
|
|
223
|
+
isLoaded: ShallowRef<boolean>;
|
|
224
|
+
error: ShallowRef<Error | null>;
|
|
225
|
+
/** Force a refresh from all sources. */
|
|
226
|
+
refetch: () => Promise<void>;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Token list for a chain, mirroring the React hook. The list logic, caching
|
|
230
|
+
* and chain filtering are `TokenListManager`'s; this file is Vue plumbing.
|
|
231
|
+
* The chain id is CAIP-2; a non-EVM chain yields the unfiltered list rather
|
|
232
|
+
* than a bogus numeric filter.
|
|
233
|
+
*/
|
|
234
|
+
declare function useTokenList(chainId?: MaybeRefOrGetter<string | null | undefined>, options?: UseTokenListOptions): UseTokenListReturn;
|
|
235
|
+
|
|
236
|
+
interface UseTokenSearchOptions {
|
|
237
|
+
/** Reuse a caller-owned manager; otherwise one shared instance per page. */
|
|
238
|
+
manager?: TokenListManager;
|
|
239
|
+
/** Debounce in ms (default 300). */
|
|
240
|
+
debounceMs?: number;
|
|
241
|
+
/** Max results per bucket (default 20). */
|
|
242
|
+
limit?: number;
|
|
243
|
+
}
|
|
244
|
+
interface UseTokenSearchReturn {
|
|
245
|
+
results: ShallowRef<TokenSearchResult>;
|
|
246
|
+
/** True from the first keystroke until the debounced search has run. */
|
|
247
|
+
isSearching: ShallowRef<boolean>;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Debounced token search by symbol, name or address, mirroring the React
|
|
251
|
+
* hook. Matching lives in `TokenListManager.search`; this file only debounces
|
|
252
|
+
* and keeps a late timer from writing after the query moved on.
|
|
253
|
+
*/
|
|
254
|
+
declare function useTokenSearch(query: MaybeRefOrGetter<string | null | undefined>, chainId?: MaybeRefOrGetter<string | null | undefined>, options?: UseTokenSearchOptions): UseTokenSearchReturn;
|
|
255
|
+
|
|
256
|
+
interface UseValidateDestinationReturn {
|
|
257
|
+
validation: ComputedRef<DestinationValidation>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Syntactic destination checks, shared with the React hook through
|
|
261
|
+
* `@naculus/connect-appkit-core`. Returns a machine-readable `issue`; the
|
|
262
|
+
* Vue package carries no locale table, so the caller maps it to a string.
|
|
263
|
+
* `level: "ok"` means nothing wrong was found — not that it is safe.
|
|
264
|
+
*/
|
|
265
|
+
declare function useValidateDestination(address: MaybeRefOrGetter<string | null | undefined>): UseValidateDestinationReturn;
|
|
266
|
+
|
|
267
|
+
interface TokenInfo {
|
|
268
|
+
/** ERC-20 token contract address */
|
|
269
|
+
address: `0x${string}`;
|
|
270
|
+
symbol: string;
|
|
271
|
+
decimals: number;
|
|
272
|
+
name?: string;
|
|
273
|
+
}
|
|
274
|
+
/** Minimal read-only contract; a viem PublicClient satisfies it. */
|
|
275
|
+
interface TokenBalanceReader {
|
|
276
|
+
readContract(args: {
|
|
277
|
+
address: `0x${string}`;
|
|
278
|
+
abi: typeof ERC20_MIN_ABI;
|
|
279
|
+
functionName: "balanceOf";
|
|
280
|
+
args: readonly [`0x${string}`];
|
|
281
|
+
}): Promise<unknown>;
|
|
282
|
+
}
|
|
283
|
+
interface TokenBalanceResult extends TokenInfo {
|
|
284
|
+
/** Raw balance in the smallest unit as a decimal string, or null if unread. */
|
|
285
|
+
balance: string | null;
|
|
286
|
+
/** Human-readable balance, or null if unread. */
|
|
287
|
+
formatted: string | null;
|
|
288
|
+
}
|
|
289
|
+
interface UseTokenBalanceOptions {
|
|
290
|
+
/** Auto-refresh interval in milliseconds. Default: no auto-refresh. */
|
|
291
|
+
refreshInterval?: MaybeRefOrGetter<number | null | undefined>;
|
|
292
|
+
}
|
|
293
|
+
interface UseTokenBalanceReturn {
|
|
294
|
+
tokenBalances: ShallowRef<TokenBalanceResult[]>;
|
|
295
|
+
isFetching: ShallowRef<boolean>;
|
|
296
|
+
error: ShallowRef<Error | null>;
|
|
297
|
+
refetch: () => Promise<void>;
|
|
298
|
+
getTokenBalance: (tokenAddress: `0x${string}`) => TokenBalanceResult | undefined;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* ERC-20 balances of an EVM account through a caller-owned reader.
|
|
302
|
+
*
|
|
303
|
+
* Mirrors the React hook: one token failing to read leaves that entry with a
|
|
304
|
+
* null balance and does not fail the others. A late response for a previous
|
|
305
|
+
* account, reader or token list is dropped.
|
|
306
|
+
*/
|
|
307
|
+
declare function useTokenBalance(account: MaybeRefOrGetter<string | null | undefined>, client: MaybeRefOrGetter<TokenBalanceReader | null | undefined>, tokens: MaybeRefOrGetter<readonly TokenInfo[] | null | undefined>, options?: UseTokenBalanceOptions): UseTokenBalanceReturn;
|
|
308
|
+
|
|
309
|
+
/** Minimal read-only contract; a viem PublicClient can supply getCode. */
|
|
310
|
+
interface DelegationCodeReader {
|
|
311
|
+
getCode(args: {
|
|
312
|
+
address: `0x${string}`;
|
|
313
|
+
}): Promise<`0x${string}` | undefined>;
|
|
314
|
+
}
|
|
315
|
+
interface UseDelegationReturn {
|
|
316
|
+
delegated: ComputedRef<boolean | null>;
|
|
317
|
+
delegate: ComputedRef<`0x${string}` | null>;
|
|
318
|
+
isFetching: ShallowRef<boolean>;
|
|
319
|
+
error: ShallowRef<Error | null>;
|
|
320
|
+
refetch: () => Promise<void>;
|
|
321
|
+
}
|
|
322
|
+
/** Read current EIP-7702 delegation without treating an unread account as undelegated. */
|
|
323
|
+
declare function useDelegation(account: MaybeRefOrGetter<string | null | undefined>, client: MaybeRefOrGetter<DelegationCodeReader | null | undefined>, chainId?: MaybeRefOrGetter<string | null | undefined>): UseDelegationReturn;
|
|
324
|
+
|
|
325
|
+
interface NameLookupReturn<T> {
|
|
326
|
+
data: ShallowRef<T | null>;
|
|
327
|
+
isLoading: ComputedRef<boolean>;
|
|
328
|
+
error: ShallowRef<Error | null>;
|
|
329
|
+
refetch: () => void;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
type UseResolveNameReturn = NameLookupReturn<AddressResult>;
|
|
333
|
+
/** Resolve a reactive ENS or SNS name to an address. */
|
|
334
|
+
declare function useResolveName(name: MaybeRefOrGetter<string>, options?: {
|
|
335
|
+
skip?: MaybeRefOrGetter<boolean | undefined>;
|
|
336
|
+
resolverConfig?: MaybeRefOrGetter<NameResolverConfig | undefined>;
|
|
337
|
+
}): UseResolveNameReturn;
|
|
338
|
+
|
|
339
|
+
type UseLookupAddressReturn = NameLookupReturn<NameResult>;
|
|
340
|
+
/** Reverse-resolve a reactive address, optionally scoped to a CAIP-2 chain. */
|
|
341
|
+
declare function useLookupAddress(address: MaybeRefOrGetter<string>, options?: {
|
|
342
|
+
chainId?: MaybeRefOrGetter<string | undefined>;
|
|
343
|
+
skip?: MaybeRefOrGetter<boolean | undefined>;
|
|
344
|
+
resolverConfig?: MaybeRefOrGetter<NameResolverConfig | undefined>;
|
|
345
|
+
}): UseLookupAddressReturn;
|
|
346
|
+
|
|
347
|
+
interface UseSolanaAccountReturn {
|
|
348
|
+
address: ComputedRef<string | null>;
|
|
349
|
+
caip10: ComputedRef<string | null>;
|
|
350
|
+
chainId: ComputedRef<string | null>;
|
|
351
|
+
isConnected: ComputedRef<boolean>;
|
|
352
|
+
}
|
|
353
|
+
/** Read the connected Solana CAIP-10 account from any wallet. */
|
|
354
|
+
declare function useSolanaAccount(accounts: MaybeRefOrGetter<string[] | null | undefined>, connected: MaybeRefOrGetter<boolean>): UseSolanaAccountReturn;
|
|
355
|
+
|
|
59
356
|
interface UseChainReturn {
|
|
60
357
|
/** The configured chain matching the connected CAIP-2 id, or null. */
|
|
61
358
|
currentChain: ComputedRef<WalletChain | null>;
|
|
@@ -133,6 +430,81 @@ interface UseSolanaBalanceReturn {
|
|
|
133
430
|
*/
|
|
134
431
|
declare function useSolanaBalance(address: MaybeRefOrGetter<string | null | undefined>, rpcUrl: MaybeRefOrGetter<string | null | undefined>): UseSolanaBalanceReturn;
|
|
135
432
|
|
|
433
|
+
type TxStatus = "pending" | "mined" | "confirmed" | "failed" | "unknown";
|
|
434
|
+
interface TxStatusEntry {
|
|
435
|
+
hash: string;
|
|
436
|
+
chainId: number;
|
|
437
|
+
from: string;
|
|
438
|
+
to: string;
|
|
439
|
+
value: string;
|
|
440
|
+
data?: string;
|
|
441
|
+
nonce?: number;
|
|
442
|
+
status: TxStatus;
|
|
443
|
+
blockNumber?: number;
|
|
444
|
+
blockHash?: string;
|
|
445
|
+
gasUsed?: string;
|
|
446
|
+
effectiveGasPrice?: string;
|
|
447
|
+
createdAt: number;
|
|
448
|
+
confirmedAt?: number;
|
|
449
|
+
updatedAt: number;
|
|
450
|
+
error?: string;
|
|
451
|
+
label?: string;
|
|
452
|
+
memo?: string;
|
|
453
|
+
replacementCount?: number;
|
|
454
|
+
}
|
|
455
|
+
/** Structural contract accepted by the transaction-monitor composables. */
|
|
456
|
+
interface TxMonitorLike {
|
|
457
|
+
watchTx(hash: string, chainId: number, options?: Record<string, unknown>): Promise<TxStatusEntry>;
|
|
458
|
+
stopWatching(hash: string, chainId?: number): void;
|
|
459
|
+
getTxStatus(hash: string, chainId?: number): TxStatusEntry | null;
|
|
460
|
+
getTxHistory(address?: string, chainId?: number): Promise<TxStatusEntry[]>;
|
|
461
|
+
refreshTx(hash: string, chainId?: number): Promise<void>;
|
|
462
|
+
on(event: "statusChange", listener: (entry: TxStatusEntry) => void): this;
|
|
463
|
+
on(event: "confirmed", listener: (entry: TxStatusEntry) => void): this;
|
|
464
|
+
on(event: "failed", listener: (entry: TxStatusEntry) => void): this;
|
|
465
|
+
off(event: string, listener: Function): this;
|
|
466
|
+
}
|
|
467
|
+
interface UseTxMonitorReturn {
|
|
468
|
+
entry: ShallowRef<TxStatusEntry | null>;
|
|
469
|
+
status: ComputedRef<TxStatus | "idle">;
|
|
470
|
+
isLoading: ShallowRef<boolean>;
|
|
471
|
+
isWatching: ShallowRef<boolean>;
|
|
472
|
+
error: ShallowRef<Error | null>;
|
|
473
|
+
refresh: () => Promise<void>;
|
|
474
|
+
stopWatching: () => void;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Reactively monitor one transaction using a caller-owned TxMonitor.
|
|
478
|
+
*
|
|
479
|
+
* Vue has no AppKit monitor provider, so the monitor is explicit. The hook
|
|
480
|
+
* listens only while its source values are current; a late promise from a
|
|
481
|
+
* previous hash, chain, or monitor cannot overwrite the active result.
|
|
482
|
+
*/
|
|
483
|
+
declare function useTxMonitor(hash: MaybeRefOrGetter<string | null | undefined>, chainId: MaybeRefOrGetter<number | null | undefined>, monitor: MaybeRefOrGetter<TxMonitorLike | null | undefined>): UseTxMonitorReturn;
|
|
484
|
+
|
|
485
|
+
interface UseLastTxReturn {
|
|
486
|
+
lastTx: ShallowRef<TxStatusEntry | null>;
|
|
487
|
+
lastConfirmedTx: ShallowRef<TxStatusEntry | null>;
|
|
488
|
+
lastFailedTx: ShallowRef<TxStatusEntry | null>;
|
|
489
|
+
clear: () => void;
|
|
490
|
+
}
|
|
491
|
+
/** Track the latest confirmed or failed transaction from a caller-owned monitor. */
|
|
492
|
+
declare function useLastTx(monitor: MaybeRefOrGetter<TxMonitorLike | null | undefined>): UseLastTxReturn;
|
|
493
|
+
|
|
494
|
+
interface UseTxHistoryReturn {
|
|
495
|
+
entries: ShallowRef<TxStatusEntry[]>;
|
|
496
|
+
isLoading: ShallowRef<boolean>;
|
|
497
|
+
error: ShallowRef<Error | null>;
|
|
498
|
+
refresh: () => Promise<void>;
|
|
499
|
+
summary: ComputedRef<{
|
|
500
|
+
pending: number;
|
|
501
|
+
confirmed: number;
|
|
502
|
+
failed: number;
|
|
503
|
+
}>;
|
|
504
|
+
}
|
|
505
|
+
/** Query and keep a caller-owned monitor's transaction history current. */
|
|
506
|
+
declare function useTxHistory(address: MaybeRefOrGetter<string | null | undefined>, chainId: MaybeRefOrGetter<number | null | undefined>, monitor: MaybeRefOrGetter<TxMonitorLike | null | undefined>): UseTxHistoryReturn;
|
|
507
|
+
|
|
136
508
|
/** The part of a connector this needs. Anything with these two is enough. */
|
|
137
509
|
interface CapabilityClient {
|
|
138
510
|
getCapabilities?: (session: unknown) => Promise<Record<string, unknown>>;
|
|
@@ -199,4 +571,4 @@ declare function useSolanaRoles(connector: MaybeRefOrGetter<SolanaRolesSource |
|
|
|
199
571
|
walletType?: string;
|
|
200
572
|
} | null | undefined>): UseSolanaRolesReturn;
|
|
201
573
|
|
|
202
|
-
export { type AccountEntry, AppkitAccordion, AppkitAccountButton, AppkitAlertDialog, AppkitAvatar, AppkitBadge, AppkitButton, AppkitCard, AppkitCardContent, AppkitCardDescription, AppkitCardFooter, AppkitCardHeader, AppkitCardTitle, AppkitCheckbox, AppkitCollapsible, AppkitConnectButton, AppkitDialog, AppkitDropdownMenu, AppkitInput, AppkitPopover, AppkitProgress, AppkitScrollArea, AppkitSelect, AppkitSeparator, AppkitSkeleton, AppkitSwitch, AppkitTabs, AppkitToggleGroup, AppkitTooltip, type CapabilityClient, type UseAccountsReturn, type UseCapabilitiesReturn, type UseChainReturn, type UsePassphraseGateReturn, type UseSolanaBalanceReturn as UseSolanaBalanceVueReturn, type UseSolanaRolesReturn, useAccounts, useCapabilities, useChain, usePassphraseGate, useSolanaBalance, useSolanaRoles };
|
|
574
|
+
export { type AccountEntry, AppkitAccordion, AppkitAccountButton, AppkitAlertDialog, AppkitAvatar, AppkitBadge, AppkitButton, AppkitCard, AppkitCardContent, AppkitCardDescription, AppkitCardFooter, AppkitCardHeader, AppkitCardTitle, AppkitCheckbox, AppkitCollapsible, AppkitConnectButton, AppkitDialog, AppkitDropdownMenu, AppkitInput, AppkitPopover, AppkitProgress, AppkitScrollArea, AppkitSelect, AppkitSeparator, AppkitSkeleton, AppkitSwitch, AppkitTabs, AppkitToggleGroup, AppkitTooltip, type CapabilityClient, type DelegationCodeReader, type NativeBalanceReader, type TokenBalanceReader, type TokenBalanceResult, type TokenInfo, type TxMonitorLike, type TxStatus, type TxStatusEntry, type UseAccountReturn, type UseAccountsReturn, type UseBalanceOptions, type UseBalanceReturn, type UseCapabilitiesReturn, type UseChainReturn, type UseCompareCostsReturn, type UseConnectReturn, type UseDelegationReturn, type UseDisconnectReturn, type UseExecuteRouteReturn, type UseLastTxReturn, type UseLookupAddressReturn, type UseNotificationOptions, type UseNotificationReturn, type UsePassphraseGateReturn, type UseResolveNameReturn, type UseRouteQuoteOptions, type UseRouteQuoteReturn, type UseSessionReturn, type UseSolanaAccountReturn, type UseSolanaBalanceReturn as UseSolanaBalanceVueReturn, type UseSolanaRolesReturn, type UseSwitchChainReturn, type UseTokenBalanceOptions, type UseTokenBalanceReturn, type UseTokenListOptions, type UseTokenListReturn, type UseTokenSearchOptions, type UseTokenSearchReturn, type UseTxHistoryReturn, type UseTxMonitorReturn, type UseValidateDestinationReturn, useAccount, useAccounts, useBalance, useCapabilities, useChain, useCompareCosts, useConnect, useDelegation, useDisconnect, useExecuteRoute, useLastTx, useLookupAddress, useNotification, usePassphraseGate, useResolveName, useRouteQuote, useSession, useSolanaAccount, useSolanaBalance, useSolanaRoles, useSwitchChain, useTokenBalance, useTokenList, useTokenSearch, useTxHistory, useTxMonitor, useValidateDestination };
|