@use-stellar/vue 0.0.0-stage → 0.2.3
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/LICENSE +134 -0
- package/README.md +187 -2
- package/dist/chunk-7ROX7ZPL.mjs +123 -0
- package/dist/chunk-7ROX7ZPL.mjs.map +1 -0
- package/dist/index.d.mts +212 -0
- package/dist/index.d.ts +212 -0
- package/dist/index.js +829 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +713 -0
- package/dist/index.mjs.map +1 -0
- package/dist/nuxt/module.d.mts +15 -0
- package/dist/nuxt/module.d.ts +15 -0
- package/dist/nuxt/module.js +29 -0
- package/dist/nuxt/module.js.map +1 -0
- package/dist/nuxt/module.mjs +23 -0
- package/dist/nuxt/module.mjs.map +1 -0
- package/dist/nuxt/runtime/plugin.d.mts +24 -0
- package/dist/nuxt/runtime/plugin.d.ts +24 -0
- package/dist/nuxt/runtime/plugin.js +140 -0
- package/dist/nuxt/runtime/plugin.js.map +1 -0
- package/dist/nuxt/runtime/plugin.mjs +28 -0
- package/dist/nuxt/runtime/plugin.mjs.map +1 -0
- package/dist/plugin-bXIRDH8_.d.mts +84 -0
- package/dist/plugin-bXIRDH8_.d.ts +84 -0
- package/dist/test-utils.d.mts +27 -0
- package/dist/test-utils.d.ts +27 -0
- package/dist/test-utils.js +97 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/test-utils.mjs +22 -0
- package/dist/test-utils.mjs.map +1 -0
- package/package.json +132 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export { A as Asset, B as Balance, N as NETWORK_CONFIGS, a as NetworkConfig, S as STELLAR_RUNTIME_KEY, b as StellarNetwork, c as StellarPluginOptions, d as StellarRuntime, e as createStellarPlugin, f as createStellarRuntime, u as useStellarRuntime } from './plugin-bXIRDH8_.mjs';
|
|
2
|
+
import { MaybeRefOrGetter, ComputedRef, ShallowRef, Ref } from 'vue';
|
|
3
|
+
export { MaybeRefOrGetter } from 'vue';
|
|
4
|
+
import { Asset, Balance, StellarError, ContractSpecLike, ContractEvent, SendPaymentOptions, SendPaymentResult, AddTrustlineOptions, TransactionResult, PathPaymentOptions, ClaimableBalance, NormalizedPayment } from 'use-stellar/core';
|
|
5
|
+
export { ANONYMOUS_SIMULATION_SOURCE, AddTrustlineOptions, PathPaymentOptions, SendPaymentOptions, SendPaymentResult, accountKey, claimableBalanceKey, paymentsKey } from 'use-stellar/core';
|
|
6
|
+
|
|
7
|
+
interface UseBalanceOptions {
|
|
8
|
+
address: MaybeRefOrGetter<string | null | undefined>;
|
|
9
|
+
asset?: Asset;
|
|
10
|
+
staleTime?: MaybeRefOrGetter<number | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Retries after a rate limit (429), honouring `Retry-After`. Defaults to 3,
|
|
13
|
+
* as in the React hook; 0 disables retrying.
|
|
14
|
+
*/
|
|
15
|
+
maxRetries?: MaybeRefOrGetter<number | undefined>;
|
|
16
|
+
}
|
|
17
|
+
interface UseBalanceReturn {
|
|
18
|
+
balance: ComputedRef<string | null>;
|
|
19
|
+
balances: ComputedRef<Balance[]>;
|
|
20
|
+
loading: ComputedRef<boolean>;
|
|
21
|
+
error: ComputedRef<StellarError | null>;
|
|
22
|
+
refetch: () => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
declare function useBalance(options: UseBalanceOptions): UseBalanceReturn;
|
|
25
|
+
|
|
26
|
+
interface UseSorobanContractOptions {
|
|
27
|
+
contractId: MaybeRefOrGetter<string | null | undefined>;
|
|
28
|
+
method: MaybeRefOrGetter<string | null | undefined>;
|
|
29
|
+
args?: MaybeRefOrGetter<readonly unknown[] | null | undefined>;
|
|
30
|
+
spec?: MaybeRefOrGetter<ContractSpecLike | null | undefined>;
|
|
31
|
+
sourceAccount?: MaybeRefOrGetter<string | null | undefined>;
|
|
32
|
+
staleTime?: number;
|
|
33
|
+
}
|
|
34
|
+
interface UseSorobanContractReturn<T = unknown> {
|
|
35
|
+
data: ComputedRef<T | null>;
|
|
36
|
+
loading: ComputedRef<boolean>;
|
|
37
|
+
error: ComputedRef<StellarError | null>;
|
|
38
|
+
refetch: () => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Simulates a read-only Soroban contract call through the shared core query.
|
|
42
|
+
* Every input may be static or reactive; cache identity follows the canonical
|
|
43
|
+
* serialized arguments rather than Vue proxy identity.
|
|
44
|
+
*/
|
|
45
|
+
declare function useSorobanContract<T = unknown>(options: UseSorobanContractOptions): UseSorobanContractReturn<T>;
|
|
46
|
+
|
|
47
|
+
interface UseContractEventsOptions {
|
|
48
|
+
contractIds: MaybeRefOrGetter<readonly string[]>;
|
|
49
|
+
topics?: MaybeRefOrGetter<readonly (readonly string[])[] | undefined>;
|
|
50
|
+
startLedger?: MaybeRefOrGetter<number | undefined>;
|
|
51
|
+
interval?: MaybeRefOrGetter<number | undefined>;
|
|
52
|
+
bufferSize?: MaybeRefOrGetter<number | undefined>;
|
|
53
|
+
enabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
54
|
+
}
|
|
55
|
+
interface UseContractEventsReturn {
|
|
56
|
+
events: ShallowRef<ContractEvent[]>;
|
|
57
|
+
latestLedger: ComputedRef<number | null>;
|
|
58
|
+
loading: ComputedRef<boolean>;
|
|
59
|
+
error: ComputedRef<StellarError | null>;
|
|
60
|
+
clear: () => void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Polls Soroban contract events through the framework-neutral core poller and
|
|
64
|
+
* binds its lifetime to the current Vue effect scope.
|
|
65
|
+
*/
|
|
66
|
+
declare function useContractEvents(options: UseContractEventsOptions): UseContractEventsReturn;
|
|
67
|
+
|
|
68
|
+
interface UseSendPaymentReturn {
|
|
69
|
+
send: (options: SendPaymentOptions) => Promise<SendPaymentResult & {
|
|
70
|
+
error?: string;
|
|
71
|
+
}>;
|
|
72
|
+
loading: Ref<boolean>;
|
|
73
|
+
error: ShallowRef<StellarError | null>;
|
|
74
|
+
result: ShallowRef<SendPaymentResult | null>;
|
|
75
|
+
reset: () => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sends a Stellar payment through the framework-neutral core action while
|
|
79
|
+
* keeping Vue state scoped to the calling component.
|
|
80
|
+
*/
|
|
81
|
+
declare function useSendPayment(): UseSendPaymentReturn;
|
|
82
|
+
|
|
83
|
+
interface UseAddTrustlineReturn {
|
|
84
|
+
addTrustline: (options: AddTrustlineOptions) => Promise<TransactionResult>;
|
|
85
|
+
loading: Ref<boolean>;
|
|
86
|
+
error: ShallowRef<StellarError | null>;
|
|
87
|
+
result: ShallowRef<TransactionResult | null>;
|
|
88
|
+
reset: () => void;
|
|
89
|
+
}
|
|
90
|
+
/** Adds an issued-asset trustline through the shared core transaction action. */
|
|
91
|
+
declare function useAddTrustline(): UseAddTrustlineReturn;
|
|
92
|
+
|
|
93
|
+
interface UsePathPaymentReturn {
|
|
94
|
+
pathPayment: (options: PathPaymentOptions) => Promise<TransactionResult>;
|
|
95
|
+
loading: Ref<boolean>;
|
|
96
|
+
error: ShallowRef<StellarError | null>;
|
|
97
|
+
result: ShallowRef<TransactionResult | null>;
|
|
98
|
+
reset: () => void;
|
|
99
|
+
}
|
|
100
|
+
/** Submits a slippage-bounded path payment through the shared core action. */
|
|
101
|
+
declare function usePathPayment(): UsePathPaymentReturn;
|
|
102
|
+
|
|
103
|
+
interface UseClaimableBalanceOptions {
|
|
104
|
+
address?: MaybeRefOrGetter<string | null | undefined>;
|
|
105
|
+
staleTime?: MaybeRefOrGetter<number | undefined>;
|
|
106
|
+
}
|
|
107
|
+
interface UseClaimableBalanceReturn {
|
|
108
|
+
balances: ComputedRef<ClaimableBalance[]>;
|
|
109
|
+
loading: ComputedRef<boolean>;
|
|
110
|
+
error: ComputedRef<StellarError | null>;
|
|
111
|
+
refetch: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
declare function useClaimableBalance(options?: UseClaimableBalanceOptions): UseClaimableBalanceReturn;
|
|
114
|
+
|
|
115
|
+
interface UsePaymentsOptions {
|
|
116
|
+
address?: MaybeRefOrGetter<string | null | undefined>;
|
|
117
|
+
limit?: MaybeRefOrGetter<number | undefined>;
|
|
118
|
+
order?: MaybeRefOrGetter<"asc" | "desc" | undefined>;
|
|
119
|
+
cursor?: MaybeRefOrGetter<string | undefined>;
|
|
120
|
+
maxRetries?: MaybeRefOrGetter<number | undefined>;
|
|
121
|
+
}
|
|
122
|
+
interface UsePaymentsReturn {
|
|
123
|
+
payments: ComputedRef<NormalizedPayment[]>;
|
|
124
|
+
loading: ComputedRef<boolean>;
|
|
125
|
+
error: ComputedRef<StellarError | null>;
|
|
126
|
+
isStale: ComputedRef<boolean>;
|
|
127
|
+
refetch: () => Promise<void>;
|
|
128
|
+
fetchNext: () => Promise<void>;
|
|
129
|
+
fetchPrev: () => Promise<void>;
|
|
130
|
+
hasNext: ComputedRef<boolean>;
|
|
131
|
+
hasPrev: ComputedRef<boolean>;
|
|
132
|
+
}
|
|
133
|
+
declare function usePayments(options?: UsePaymentsOptions): UsePaymentsReturn;
|
|
134
|
+
|
|
135
|
+
interface UsePaymentHistoryOptions extends UsePaymentsOptions {
|
|
136
|
+
direction?: MaybeRefOrGetter<"incoming" | "outgoing" | "all" | undefined>;
|
|
137
|
+
asset?: MaybeRefOrGetter<Asset | "all" | undefined>;
|
|
138
|
+
}
|
|
139
|
+
interface UsePaymentHistoryReturn {
|
|
140
|
+
payments: ComputedRef<NormalizedPayment[]>;
|
|
141
|
+
loading: ComputedRef<boolean>;
|
|
142
|
+
error: ComputedRef<StellarError | null>;
|
|
143
|
+
isStale: ComputedRef<boolean>;
|
|
144
|
+
refetch: () => Promise<void>;
|
|
145
|
+
fetchNext: () => Promise<void>;
|
|
146
|
+
fetchPrev: () => Promise<void>;
|
|
147
|
+
hasNext: ComputedRef<boolean>;
|
|
148
|
+
hasPrev: ComputedRef<boolean>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Filters the current `usePayments` page without issuing another request.
|
|
152
|
+
* Filtering is intentionally page-local; pagination continues to follow the
|
|
153
|
+
* unfiltered Horizon result set.
|
|
154
|
+
*/
|
|
155
|
+
declare function usePaymentHistory(options?: UsePaymentHistoryOptions): UsePaymentHistoryReturn;
|
|
156
|
+
|
|
157
|
+
interface QueryStoreConfig {
|
|
158
|
+
/** How long (ms) data is considered fresh. Defaults to 30 000 (30s). */
|
|
159
|
+
staleTime?: number;
|
|
160
|
+
/** How long (ms) an entry is kept after its last subscriber leaves. Defaults to 300 000 (5min). */
|
|
161
|
+
gcTime?: number;
|
|
162
|
+
}
|
|
163
|
+
/** The reactive shape a composable reads. Mutating it directly is not supported — go through the store. */
|
|
164
|
+
interface QueryEntry<T = unknown> {
|
|
165
|
+
data: T | null;
|
|
166
|
+
updatedAt: number | null;
|
|
167
|
+
loading: boolean;
|
|
168
|
+
error: unknown;
|
|
169
|
+
}
|
|
170
|
+
interface RunOptions {
|
|
171
|
+
/** Overrides the store's default staleTime for this call. */
|
|
172
|
+
staleTime?: number;
|
|
173
|
+
/** Bypasses both the in-flight dedup check and the staleTime check. */
|
|
174
|
+
force?: boolean;
|
|
175
|
+
}
|
|
176
|
+
declare class VueQueryStore {
|
|
177
|
+
private entries;
|
|
178
|
+
private staleTime;
|
|
179
|
+
private gcTime;
|
|
180
|
+
constructor(config?: QueryStoreConfig);
|
|
181
|
+
private ensure;
|
|
182
|
+
/**
|
|
183
|
+
* The live, reactive entry for a key. Read its fields inside a `computed`
|
|
184
|
+
* or `watchEffect` — Vue tracks the read and re-runs when the store writes
|
|
185
|
+
* to it.
|
|
186
|
+
*/
|
|
187
|
+
getEntry<T>(key: string): QueryEntry<T>;
|
|
188
|
+
/**
|
|
189
|
+
* Registers a subscriber for `key` and cancels any pending GC eviction.
|
|
190
|
+
* Returns the unsubscribe function — call it from `onCleanup` /
|
|
191
|
+
* `onScopeDispose` so an idle entry is eventually evicted.
|
|
192
|
+
*/
|
|
193
|
+
subscribe(key: string): () => void;
|
|
194
|
+
/** Number of active subscribers for a key. Exposed for tests. */
|
|
195
|
+
subscriberCount(key: string): number;
|
|
196
|
+
private scheduleGc;
|
|
197
|
+
isFresh(key: string, staleTime?: number): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Runs `queryFn` for `key`, deduplicated: a call made while a fetch for the
|
|
200
|
+
* same key is already in flight awaits that same promise instead of
|
|
201
|
+
* issuing a second request — this is what lets two Vue scopes reading the
|
|
202
|
+
* same query share one network call. Skipped entirely when cached data is
|
|
203
|
+
* still within `staleTime`, unless `force` is set.
|
|
204
|
+
*/
|
|
205
|
+
run<T>(key: string, queryFn: () => Promise<T>, opts?: RunOptions): Promise<T>;
|
|
206
|
+
/** Marks a cached query stale so its next read fetches fresh data. */
|
|
207
|
+
invalidate(key: string | readonly unknown[]): void;
|
|
208
|
+
/** Empties the store. Useful in tests; not meant for app code. */
|
|
209
|
+
clear(): void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { type QueryEntry, type QueryStoreConfig, type RunOptions, type UseAddTrustlineReturn, type UseBalanceOptions, type UseBalanceReturn, type UseClaimableBalanceOptions, type UseClaimableBalanceReturn, type UseContractEventsOptions, type UseContractEventsReturn, type UsePathPaymentReturn, type UsePaymentHistoryOptions, type UsePaymentHistoryReturn, type UsePaymentsOptions, type UsePaymentsReturn, type UseSendPaymentReturn, type UseSorobanContractOptions, type UseSorobanContractReturn, VueQueryStore, useAddTrustline, useBalance, useClaimableBalance, useContractEvents, usePathPayment, usePaymentHistory, usePayments, useSendPayment, useSorobanContract };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export { A as Asset, B as Balance, N as NETWORK_CONFIGS, a as NetworkConfig, S as STELLAR_RUNTIME_KEY, b as StellarNetwork, c as StellarPluginOptions, d as StellarRuntime, e as createStellarPlugin, f as createStellarRuntime, u as useStellarRuntime } from './plugin-bXIRDH8_.js';
|
|
2
|
+
import { MaybeRefOrGetter, ComputedRef, ShallowRef, Ref } from 'vue';
|
|
3
|
+
export { MaybeRefOrGetter } from 'vue';
|
|
4
|
+
import { Asset, Balance, StellarError, ContractSpecLike, ContractEvent, SendPaymentOptions, SendPaymentResult, AddTrustlineOptions, TransactionResult, PathPaymentOptions, ClaimableBalance, NormalizedPayment } from 'use-stellar/core';
|
|
5
|
+
export { ANONYMOUS_SIMULATION_SOURCE, AddTrustlineOptions, PathPaymentOptions, SendPaymentOptions, SendPaymentResult, accountKey, claimableBalanceKey, paymentsKey } from 'use-stellar/core';
|
|
6
|
+
|
|
7
|
+
interface UseBalanceOptions {
|
|
8
|
+
address: MaybeRefOrGetter<string | null | undefined>;
|
|
9
|
+
asset?: Asset;
|
|
10
|
+
staleTime?: MaybeRefOrGetter<number | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Retries after a rate limit (429), honouring `Retry-After`. Defaults to 3,
|
|
13
|
+
* as in the React hook; 0 disables retrying.
|
|
14
|
+
*/
|
|
15
|
+
maxRetries?: MaybeRefOrGetter<number | undefined>;
|
|
16
|
+
}
|
|
17
|
+
interface UseBalanceReturn {
|
|
18
|
+
balance: ComputedRef<string | null>;
|
|
19
|
+
balances: ComputedRef<Balance[]>;
|
|
20
|
+
loading: ComputedRef<boolean>;
|
|
21
|
+
error: ComputedRef<StellarError | null>;
|
|
22
|
+
refetch: () => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
declare function useBalance(options: UseBalanceOptions): UseBalanceReturn;
|
|
25
|
+
|
|
26
|
+
interface UseSorobanContractOptions {
|
|
27
|
+
contractId: MaybeRefOrGetter<string | null | undefined>;
|
|
28
|
+
method: MaybeRefOrGetter<string | null | undefined>;
|
|
29
|
+
args?: MaybeRefOrGetter<readonly unknown[] | null | undefined>;
|
|
30
|
+
spec?: MaybeRefOrGetter<ContractSpecLike | null | undefined>;
|
|
31
|
+
sourceAccount?: MaybeRefOrGetter<string | null | undefined>;
|
|
32
|
+
staleTime?: number;
|
|
33
|
+
}
|
|
34
|
+
interface UseSorobanContractReturn<T = unknown> {
|
|
35
|
+
data: ComputedRef<T | null>;
|
|
36
|
+
loading: ComputedRef<boolean>;
|
|
37
|
+
error: ComputedRef<StellarError | null>;
|
|
38
|
+
refetch: () => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Simulates a read-only Soroban contract call through the shared core query.
|
|
42
|
+
* Every input may be static or reactive; cache identity follows the canonical
|
|
43
|
+
* serialized arguments rather than Vue proxy identity.
|
|
44
|
+
*/
|
|
45
|
+
declare function useSorobanContract<T = unknown>(options: UseSorobanContractOptions): UseSorobanContractReturn<T>;
|
|
46
|
+
|
|
47
|
+
interface UseContractEventsOptions {
|
|
48
|
+
contractIds: MaybeRefOrGetter<readonly string[]>;
|
|
49
|
+
topics?: MaybeRefOrGetter<readonly (readonly string[])[] | undefined>;
|
|
50
|
+
startLedger?: MaybeRefOrGetter<number | undefined>;
|
|
51
|
+
interval?: MaybeRefOrGetter<number | undefined>;
|
|
52
|
+
bufferSize?: MaybeRefOrGetter<number | undefined>;
|
|
53
|
+
enabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
54
|
+
}
|
|
55
|
+
interface UseContractEventsReturn {
|
|
56
|
+
events: ShallowRef<ContractEvent[]>;
|
|
57
|
+
latestLedger: ComputedRef<number | null>;
|
|
58
|
+
loading: ComputedRef<boolean>;
|
|
59
|
+
error: ComputedRef<StellarError | null>;
|
|
60
|
+
clear: () => void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Polls Soroban contract events through the framework-neutral core poller and
|
|
64
|
+
* binds its lifetime to the current Vue effect scope.
|
|
65
|
+
*/
|
|
66
|
+
declare function useContractEvents(options: UseContractEventsOptions): UseContractEventsReturn;
|
|
67
|
+
|
|
68
|
+
interface UseSendPaymentReturn {
|
|
69
|
+
send: (options: SendPaymentOptions) => Promise<SendPaymentResult & {
|
|
70
|
+
error?: string;
|
|
71
|
+
}>;
|
|
72
|
+
loading: Ref<boolean>;
|
|
73
|
+
error: ShallowRef<StellarError | null>;
|
|
74
|
+
result: ShallowRef<SendPaymentResult | null>;
|
|
75
|
+
reset: () => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sends a Stellar payment through the framework-neutral core action while
|
|
79
|
+
* keeping Vue state scoped to the calling component.
|
|
80
|
+
*/
|
|
81
|
+
declare function useSendPayment(): UseSendPaymentReturn;
|
|
82
|
+
|
|
83
|
+
interface UseAddTrustlineReturn {
|
|
84
|
+
addTrustline: (options: AddTrustlineOptions) => Promise<TransactionResult>;
|
|
85
|
+
loading: Ref<boolean>;
|
|
86
|
+
error: ShallowRef<StellarError | null>;
|
|
87
|
+
result: ShallowRef<TransactionResult | null>;
|
|
88
|
+
reset: () => void;
|
|
89
|
+
}
|
|
90
|
+
/** Adds an issued-asset trustline through the shared core transaction action. */
|
|
91
|
+
declare function useAddTrustline(): UseAddTrustlineReturn;
|
|
92
|
+
|
|
93
|
+
interface UsePathPaymentReturn {
|
|
94
|
+
pathPayment: (options: PathPaymentOptions) => Promise<TransactionResult>;
|
|
95
|
+
loading: Ref<boolean>;
|
|
96
|
+
error: ShallowRef<StellarError | null>;
|
|
97
|
+
result: ShallowRef<TransactionResult | null>;
|
|
98
|
+
reset: () => void;
|
|
99
|
+
}
|
|
100
|
+
/** Submits a slippage-bounded path payment through the shared core action. */
|
|
101
|
+
declare function usePathPayment(): UsePathPaymentReturn;
|
|
102
|
+
|
|
103
|
+
interface UseClaimableBalanceOptions {
|
|
104
|
+
address?: MaybeRefOrGetter<string | null | undefined>;
|
|
105
|
+
staleTime?: MaybeRefOrGetter<number | undefined>;
|
|
106
|
+
}
|
|
107
|
+
interface UseClaimableBalanceReturn {
|
|
108
|
+
balances: ComputedRef<ClaimableBalance[]>;
|
|
109
|
+
loading: ComputedRef<boolean>;
|
|
110
|
+
error: ComputedRef<StellarError | null>;
|
|
111
|
+
refetch: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
declare function useClaimableBalance(options?: UseClaimableBalanceOptions): UseClaimableBalanceReturn;
|
|
114
|
+
|
|
115
|
+
interface UsePaymentsOptions {
|
|
116
|
+
address?: MaybeRefOrGetter<string | null | undefined>;
|
|
117
|
+
limit?: MaybeRefOrGetter<number | undefined>;
|
|
118
|
+
order?: MaybeRefOrGetter<"asc" | "desc" | undefined>;
|
|
119
|
+
cursor?: MaybeRefOrGetter<string | undefined>;
|
|
120
|
+
maxRetries?: MaybeRefOrGetter<number | undefined>;
|
|
121
|
+
}
|
|
122
|
+
interface UsePaymentsReturn {
|
|
123
|
+
payments: ComputedRef<NormalizedPayment[]>;
|
|
124
|
+
loading: ComputedRef<boolean>;
|
|
125
|
+
error: ComputedRef<StellarError | null>;
|
|
126
|
+
isStale: ComputedRef<boolean>;
|
|
127
|
+
refetch: () => Promise<void>;
|
|
128
|
+
fetchNext: () => Promise<void>;
|
|
129
|
+
fetchPrev: () => Promise<void>;
|
|
130
|
+
hasNext: ComputedRef<boolean>;
|
|
131
|
+
hasPrev: ComputedRef<boolean>;
|
|
132
|
+
}
|
|
133
|
+
declare function usePayments(options?: UsePaymentsOptions): UsePaymentsReturn;
|
|
134
|
+
|
|
135
|
+
interface UsePaymentHistoryOptions extends UsePaymentsOptions {
|
|
136
|
+
direction?: MaybeRefOrGetter<"incoming" | "outgoing" | "all" | undefined>;
|
|
137
|
+
asset?: MaybeRefOrGetter<Asset | "all" | undefined>;
|
|
138
|
+
}
|
|
139
|
+
interface UsePaymentHistoryReturn {
|
|
140
|
+
payments: ComputedRef<NormalizedPayment[]>;
|
|
141
|
+
loading: ComputedRef<boolean>;
|
|
142
|
+
error: ComputedRef<StellarError | null>;
|
|
143
|
+
isStale: ComputedRef<boolean>;
|
|
144
|
+
refetch: () => Promise<void>;
|
|
145
|
+
fetchNext: () => Promise<void>;
|
|
146
|
+
fetchPrev: () => Promise<void>;
|
|
147
|
+
hasNext: ComputedRef<boolean>;
|
|
148
|
+
hasPrev: ComputedRef<boolean>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Filters the current `usePayments` page without issuing another request.
|
|
152
|
+
* Filtering is intentionally page-local; pagination continues to follow the
|
|
153
|
+
* unfiltered Horizon result set.
|
|
154
|
+
*/
|
|
155
|
+
declare function usePaymentHistory(options?: UsePaymentHistoryOptions): UsePaymentHistoryReturn;
|
|
156
|
+
|
|
157
|
+
interface QueryStoreConfig {
|
|
158
|
+
/** How long (ms) data is considered fresh. Defaults to 30 000 (30s). */
|
|
159
|
+
staleTime?: number;
|
|
160
|
+
/** How long (ms) an entry is kept after its last subscriber leaves. Defaults to 300 000 (5min). */
|
|
161
|
+
gcTime?: number;
|
|
162
|
+
}
|
|
163
|
+
/** The reactive shape a composable reads. Mutating it directly is not supported — go through the store. */
|
|
164
|
+
interface QueryEntry<T = unknown> {
|
|
165
|
+
data: T | null;
|
|
166
|
+
updatedAt: number | null;
|
|
167
|
+
loading: boolean;
|
|
168
|
+
error: unknown;
|
|
169
|
+
}
|
|
170
|
+
interface RunOptions {
|
|
171
|
+
/** Overrides the store's default staleTime for this call. */
|
|
172
|
+
staleTime?: number;
|
|
173
|
+
/** Bypasses both the in-flight dedup check and the staleTime check. */
|
|
174
|
+
force?: boolean;
|
|
175
|
+
}
|
|
176
|
+
declare class VueQueryStore {
|
|
177
|
+
private entries;
|
|
178
|
+
private staleTime;
|
|
179
|
+
private gcTime;
|
|
180
|
+
constructor(config?: QueryStoreConfig);
|
|
181
|
+
private ensure;
|
|
182
|
+
/**
|
|
183
|
+
* The live, reactive entry for a key. Read its fields inside a `computed`
|
|
184
|
+
* or `watchEffect` — Vue tracks the read and re-runs when the store writes
|
|
185
|
+
* to it.
|
|
186
|
+
*/
|
|
187
|
+
getEntry<T>(key: string): QueryEntry<T>;
|
|
188
|
+
/**
|
|
189
|
+
* Registers a subscriber for `key` and cancels any pending GC eviction.
|
|
190
|
+
* Returns the unsubscribe function — call it from `onCleanup` /
|
|
191
|
+
* `onScopeDispose` so an idle entry is eventually evicted.
|
|
192
|
+
*/
|
|
193
|
+
subscribe(key: string): () => void;
|
|
194
|
+
/** Number of active subscribers for a key. Exposed for tests. */
|
|
195
|
+
subscriberCount(key: string): number;
|
|
196
|
+
private scheduleGc;
|
|
197
|
+
isFresh(key: string, staleTime?: number): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Runs `queryFn` for `key`, deduplicated: a call made while a fetch for the
|
|
200
|
+
* same key is already in flight awaits that same promise instead of
|
|
201
|
+
* issuing a second request — this is what lets two Vue scopes reading the
|
|
202
|
+
* same query share one network call. Skipped entirely when cached data is
|
|
203
|
+
* still within `staleTime`, unless `force` is set.
|
|
204
|
+
*/
|
|
205
|
+
run<T>(key: string, queryFn: () => Promise<T>, opts?: RunOptions): Promise<T>;
|
|
206
|
+
/** Marks a cached query stale so its next read fetches fresh data. */
|
|
207
|
+
invalidate(key: string | readonly unknown[]): void;
|
|
208
|
+
/** Empties the store. Useful in tests; not meant for app code. */
|
|
209
|
+
clear(): void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { type QueryEntry, type QueryStoreConfig, type RunOptions, type UseAddTrustlineReturn, type UseBalanceOptions, type UseBalanceReturn, type UseClaimableBalanceOptions, type UseClaimableBalanceReturn, type UseContractEventsOptions, type UseContractEventsReturn, type UsePathPaymentReturn, type UsePaymentHistoryOptions, type UsePaymentHistoryReturn, type UsePaymentsOptions, type UsePaymentsReturn, type UseSendPaymentReturn, type UseSorobanContractOptions, type UseSorobanContractReturn, VueQueryStore, useAddTrustline, useBalance, useClaimableBalance, useContractEvents, usePathPayment, usePaymentHistory, usePayments, useSendPayment, useSorobanContract };
|