@monerium/sdk-react-provider 0.2.0 → 0.4.0
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/README.md +31 -22
- package/dist/index.d.ts +322 -175
- package/dist/index.js +20 -13
- package/dist/index.mjs +4 -4
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
5
|
import { UseQueryOptions, UseQueryResult, UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
5
|
-
import MoneriumClient, { ChainId,
|
|
6
|
-
export {
|
|
6
|
+
import MoneriumClient, { ChainId, Chain, CurrencyCode, Profile, ProfilesResponse, Token, Address, AddressesResponse, Currency, Balances, IBAN, IBANsResponse, Order, OrdersResponse, OrderState, ResponseStatus, SubmitProfileDetailsPayload, RequestIbanPayload, MoveIbanPayload, NewOrder, LinkedAddress, LinkAddress } from '@monerium/sdk';
|
|
7
|
+
export { Address, Balances, IBAN, LinkAddress, MoveIbanPayload, NewOrder, Order, Profile, ProfilePermissions, ResponseStatus, SubmitProfileDetailsPayload, Token } from '@monerium/sdk';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Wrap your application with the Monerium provider.
|
|
10
11
|
* @group Provider
|
|
11
12
|
* @param params
|
|
12
13
|
* @param params.children - Rest of the application.
|
|
13
14
|
* @param params.clientId - Monerium auth flow client id.
|
|
14
|
-
* @param params.
|
|
15
|
+
* @param params.redirectUri - Monerium auth flow redirect url.
|
|
15
16
|
* @param params.environment - Monerium environment.
|
|
16
17
|
* @returns
|
|
17
18
|
*/
|
|
18
|
-
declare const MoneriumProvider: ({ children, clientId,
|
|
19
|
+
declare const MoneriumProvider: ({ children, clientId, redirectUri, environment, refreshToken, onRefreshTokenUpdate, debug, }: {
|
|
19
20
|
children: ReactNode;
|
|
20
|
-
clientId
|
|
21
|
+
clientId: string;
|
|
22
|
+
redirectUri: string;
|
|
23
|
+
/** @deprecated use redirectUri */
|
|
21
24
|
redirectUrl?: string;
|
|
22
25
|
environment?: "sandbox" | "production";
|
|
26
|
+
refreshToken?: string;
|
|
27
|
+
onRefreshTokenUpdate?: (token: string) => void;
|
|
28
|
+
debug?: boolean;
|
|
23
29
|
}) => react_jsx_runtime.JSX.Element;
|
|
24
30
|
|
|
25
31
|
type SdkInstance = {
|
|
@@ -55,13 +61,20 @@ type UseAuthReturn = {
|
|
|
55
61
|
* See [Tanstack Query - useQuery](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery) options.
|
|
56
62
|
* @see # [Tanstack Query - useQuery](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery)
|
|
57
63
|
* @template {Object} TData - The data returned.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* useQueryHook({
|
|
67
|
+
* query: {
|
|
68
|
+
* enabled: isReady,
|
|
69
|
+
* staleTime: 1000,
|
|
70
|
+
* placeHolderData: { foo: 'bar' },
|
|
71
|
+
* }
|
|
72
|
+
* })
|
|
73
|
+
* ```
|
|
74
|
+
* ## Options
|
|
75
|
+
* > `queryKey` and `queryFn` are used internally and therefore not included as an options.
|
|
61
76
|
* ```diff
|
|
62
77
|
* query: {
|
|
63
|
-
* - queryKey,
|
|
64
|
-
* - queryFn,
|
|
65
78
|
* gcTime,
|
|
66
79
|
* enabled,
|
|
67
80
|
* networkMode,
|
|
@@ -85,26 +98,6 @@ type UseAuthReturn = {
|
|
|
85
98
|
* throwOnError
|
|
86
99
|
* }
|
|
87
100
|
* ```
|
|
88
|
-
* @example
|
|
89
|
-
* ```ts
|
|
90
|
-
* useQueryHook({
|
|
91
|
-
* query: {
|
|
92
|
-
* enabled: isReady,
|
|
93
|
-
* staleTime: 1000,
|
|
94
|
-
* placeHolderData: { foo: 'bar' },
|
|
95
|
-
* }
|
|
96
|
-
* })
|
|
97
|
-
* ```
|
|
98
|
-
* @usedBy
|
|
99
|
-
* {@link useAuthContext}
|
|
100
|
-
*
|
|
101
|
-
* {@link useBalances}
|
|
102
|
-
*
|
|
103
|
-
* {@link useOrders}
|
|
104
|
-
*
|
|
105
|
-
* {@link useProfile}
|
|
106
|
-
*
|
|
107
|
-
* {@link useTokens}
|
|
108
101
|
*/
|
|
109
102
|
type QueryOptions<TData = unknown> = Omit<UseQueryOptions<TData>, 'queryKey' | 'queryFn'>;
|
|
110
103
|
/**
|
|
@@ -143,16 +136,6 @@ type QueryOptions<TData = unknown> = Omit<UseQueryOptions<TData>, 'queryKey' | '
|
|
|
143
136
|
* status,
|
|
144
137
|
*}
|
|
145
138
|
* ```
|
|
146
|
-
* @usedBy
|
|
147
|
-
* {@link useAuthContext}
|
|
148
|
-
*
|
|
149
|
-
* {@link useBalances}
|
|
150
|
-
*
|
|
151
|
-
* {@link useOrders}
|
|
152
|
-
*
|
|
153
|
-
* {@link useProfile}
|
|
154
|
-
*
|
|
155
|
-
* {@link useTokens}
|
|
156
139
|
*
|
|
157
140
|
*/
|
|
158
141
|
type QueryResult<TVarName extends string, TData = unknown> = Omit<UseQueryResult<TData>, 'data'> & {
|
|
@@ -166,14 +149,26 @@ type QueryResult<TVarName extends string, TData = unknown> = Omit<UseQueryResult
|
|
|
166
149
|
* @template {Object} TError - The error returned.
|
|
167
150
|
* @template {Object} TVariables - The variables used in the mutation.
|
|
168
151
|
*
|
|
169
|
-
* @
|
|
170
|
-
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* useMutationHook({
|
|
155
|
+
* mutation: {
|
|
156
|
+
* onSuccess: (data, variables) => {
|
|
157
|
+
* console.log('onSuccess callback', data, variables);
|
|
158
|
+
* },
|
|
159
|
+
* onError: (error) => {
|
|
160
|
+
* console.log('onError callback', error);
|
|
161
|
+
* },
|
|
162
|
+
* },
|
|
163
|
+
* })
|
|
164
|
+
*
|
|
165
|
+
* ```
|
|
166
|
+
* ## Options
|
|
167
|
+
* > `mutationKey` and `mutationFn` are used internally and therefore not included as an options.
|
|
171
168
|
* ```diff
|
|
172
169
|
* mutation: {
|
|
173
170
|
* gcTime,
|
|
174
171
|
* meta,
|
|
175
|
-
* - mutationFn,
|
|
176
|
-
* - mutationKey,
|
|
177
172
|
* networkMode,
|
|
178
173
|
* onError,
|
|
179
174
|
* onMutate,
|
|
@@ -185,24 +180,6 @@ type QueryResult<TVarName extends string, TData = unknown> = Omit<UseQueryResult
|
|
|
185
180
|
* throwOnError,
|
|
186
181
|
* }
|
|
187
182
|
* ```
|
|
188
|
-
* @example
|
|
189
|
-
* ```ts
|
|
190
|
-
* useMutationHook({
|
|
191
|
-
* mutation: {
|
|
192
|
-
* onSuccess: (data, variables) => {
|
|
193
|
-
* console.log('onSuccess callback', data, variables);
|
|
194
|
-
* },
|
|
195
|
-
* onError: (error) => {
|
|
196
|
-
* console.log('onError callback', error);
|
|
197
|
-
* },
|
|
198
|
-
* },
|
|
199
|
-
* })
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* @usedBy
|
|
203
|
-
* {@link useLinkAddress}
|
|
204
|
-
*
|
|
205
|
-
* {@link usePlaceOrder}
|
|
206
183
|
*/
|
|
207
184
|
type MutationOptions<TData = unknown, TError = unknown, TVariables = unknown> = Omit<UseMutationOptions<TData, TError, TVariables>, 'mutationKey' | 'mutationFn'>;
|
|
208
185
|
/**
|
|
@@ -236,10 +213,6 @@ type MutationOptions<TData = unknown, TError = unknown, TVariables = unknown> =
|
|
|
236
213
|
* variables,
|
|
237
214
|
* } = useMutationHook();
|
|
238
215
|
* ```
|
|
239
|
-
* @usedBy
|
|
240
|
-
* {@link useLinkAddress}
|
|
241
|
-
*
|
|
242
|
-
* {@link usePlaceOrder}
|
|
243
216
|
*/
|
|
244
217
|
type MutationResult<TFuncName extends string, TData, TError, TVariables, TContext = unknown> = Omit<UseMutationResult<TData, TError, TVariables, TContext>, 'mutateAsync'> & {
|
|
245
218
|
[P in TFuncName]: UseMutationResult<TData, TError, TVariables, TContext>['mutateAsync'];
|
|
@@ -249,31 +222,38 @@ declare const MoneriumContext: react.Context<(UseAuthReturn & SdkInstance) | nul
|
|
|
249
222
|
|
|
250
223
|
/**
|
|
251
224
|
* @internal
|
|
252
|
-
* Query keys
|
|
225
|
+
* Query keys for React query
|
|
253
226
|
* */
|
|
254
227
|
declare const keys: {
|
|
255
228
|
getAll: string[];
|
|
256
|
-
|
|
257
|
-
getProfile: (profileId: string) => string[];
|
|
229
|
+
getProfile: (profile: string) => string[];
|
|
258
230
|
getProfiles: string[];
|
|
259
|
-
|
|
231
|
+
getAddress: (address: string) => (string | string[])[];
|
|
232
|
+
getAddresses: (filter?: unknown) => {}[];
|
|
233
|
+
getBalances: (address: string, chain: Chain, currencies?: CurrencyCode | CurrencyCode[]) => string[];
|
|
234
|
+
getIban: (iban: string) => string[];
|
|
235
|
+
getIbans: (filter?: unknown) => {}[];
|
|
260
236
|
getTokens: string[];
|
|
261
237
|
getOrder: (orderId: string) => string[];
|
|
262
238
|
getOrders: (filter?: unknown) => {}[];
|
|
239
|
+
submitProfileDetails: string[];
|
|
240
|
+
moveIban: string[];
|
|
241
|
+
requestIban: string[];
|
|
263
242
|
placeOrder: string[];
|
|
264
243
|
linkAddress: string[];
|
|
265
244
|
};
|
|
266
245
|
/**
|
|
267
246
|
* # Redirect to the Monerium auth flow.
|
|
268
247
|
* @group Hooks
|
|
248
|
+
* @category Authentication
|
|
269
249
|
* @example
|
|
270
250
|
* ```ts
|
|
271
251
|
* const { authorize, isAuthorized, isLoading, error } = useAuth();
|
|
272
252
|
*
|
|
273
253
|
* authorize(); // Redirects to the Monerium auth flow.
|
|
274
254
|
*
|
|
275
|
-
* //
|
|
276
|
-
* authorize({ address, signature,
|
|
255
|
+
* // Opt-in to automated wallet linking with these parameters.
|
|
256
|
+
* authorize({ address, signature, chain }).
|
|
277
257
|
* ```
|
|
278
258
|
*
|
|
279
259
|
* @returns {UseAuthReturn}
|
|
@@ -286,124 +266,138 @@ declare const keys: {
|
|
|
286
266
|
*/
|
|
287
267
|
declare function useAuth(): UseAuthReturn;
|
|
288
268
|
/**
|
|
289
|
-
*
|
|
269
|
+
* If no `profile` id is provided, the default profile is used.
|
|
290
270
|
* @group Hooks
|
|
291
|
-
*
|
|
292
|
-
* @param {Object}
|
|
293
|
-
* @param {QueryOptions<AuthContext>} [params.query] {@inheritDoc QueryOptions}
|
|
271
|
+
* @category Profiles
|
|
272
|
+
* @param {Object} params
|
|
294
273
|
*
|
|
295
274
|
* @example
|
|
296
275
|
* ```ts
|
|
297
276
|
* const {
|
|
298
|
-
*
|
|
277
|
+
* data
|
|
299
278
|
* isLoading,
|
|
300
279
|
* isError,
|
|
301
280
|
* error,
|
|
302
281
|
* refetch,
|
|
303
282
|
* ...moreUseQueryResults
|
|
304
|
-
* } =
|
|
283
|
+
* } = useProfile();
|
|
305
284
|
* ```
|
|
306
|
-
|
|
307
|
-
* @see
|
|
308
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/auth-context)
|
|
309
|
-
*
|
|
310
|
-
* [AuthContext interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/AuthContext.md)
|
|
285
|
+
|
|
286
|
+
* @see {@link https://monerium.dev/api-docs#operation/profile | API Documentation}
|
|
311
287
|
*/
|
|
312
|
-
declare function
|
|
313
|
-
|
|
314
|
-
|
|
288
|
+
declare function useProfile({ profile, query, }?: {
|
|
289
|
+
/** The id of the profile */
|
|
290
|
+
profile?: string;
|
|
291
|
+
/** {@inheritDoc QueryOptions} */
|
|
292
|
+
query?: QueryOptions<Profile>;
|
|
293
|
+
}): _tanstack_react_query.UseQueryResult<Profile, Error>;
|
|
315
294
|
/**
|
|
316
|
-
* # Get
|
|
317
|
-
* If no `profileId` is provided, the default profile is used.
|
|
295
|
+
* # Get profiles
|
|
318
296
|
* @group Hooks
|
|
319
|
-
* @
|
|
320
|
-
*
|
|
321
|
-
* @param {
|
|
297
|
+
* @category Profiles
|
|
298
|
+
*
|
|
299
|
+
* @param {Object} [params] No required parameters.
|
|
322
300
|
*
|
|
323
301
|
* @example
|
|
324
302
|
* ```ts
|
|
325
303
|
* const {
|
|
326
|
-
*
|
|
304
|
+
* data,
|
|
327
305
|
* isLoading,
|
|
328
306
|
* isError,
|
|
329
307
|
* error,
|
|
330
308
|
* refetch,
|
|
331
309
|
* ...moreUseQueryResults
|
|
332
|
-
* } =
|
|
310
|
+
* } = useProfiles();
|
|
333
311
|
* ```
|
|
334
|
-
|
|
335
|
-
* @see
|
|
336
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profile)
|
|
337
|
-
*
|
|
338
|
-
* [Profile interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Profile.md)
|
|
312
|
+
* @see {@link https://monerium.dev/api-docs#operation/profiles | API Documentation}
|
|
339
313
|
*/
|
|
340
|
-
declare function
|
|
341
|
-
|
|
342
|
-
query?: QueryOptions<
|
|
343
|
-
}):
|
|
314
|
+
declare function useProfiles({ query, }?: {
|
|
315
|
+
/** {@inheritDoc QueryOptions} */
|
|
316
|
+
query?: QueryOptions<ProfilesResponse>;
|
|
317
|
+
}): _tanstack_react_query.UseQueryResult<ProfilesResponse, Error>;
|
|
344
318
|
/**
|
|
345
|
-
* # Get profiles
|
|
346
319
|
* @group Hooks
|
|
347
320
|
* @param {Object} [params] No required parameters.
|
|
348
|
-
* @param {QueryOptions<Profile[]>} [params.query] {@inheritDoc QueryOptions}
|
|
349
321
|
*
|
|
350
322
|
* @example
|
|
351
323
|
* ```ts
|
|
352
324
|
* const {
|
|
353
|
-
*
|
|
325
|
+
* data,
|
|
354
326
|
* isLoading,
|
|
355
327
|
* isError,
|
|
356
328
|
* error,
|
|
357
329
|
* refetch,
|
|
358
330
|
* ...moreUseQueryResults
|
|
359
|
-
* } =
|
|
331
|
+
* } = useTokens();
|
|
360
332
|
* ```
|
|
361
333
|
|
|
362
|
-
* @see
|
|
363
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profiles)
|
|
364
|
-
*
|
|
365
|
-
* [Profile interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Profile.md)
|
|
334
|
+
* @see {@link https://monerium.dev/api-docs#operation/tokens | API Documentation}
|
|
366
335
|
*/
|
|
367
|
-
declare function
|
|
368
|
-
|
|
369
|
-
|
|
336
|
+
declare function useTokens({ query, }?: {
|
|
337
|
+
/** {@inheritDoc QueryOptions} */
|
|
338
|
+
query?: QueryOptions<Token[]>;
|
|
339
|
+
}): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
370
340
|
/**
|
|
371
|
-
* # Get tokens
|
|
372
341
|
* @group Hooks
|
|
373
|
-
* @
|
|
374
|
-
* @param {
|
|
375
|
-
|
|
342
|
+
* @category Addresses
|
|
343
|
+
* @param {Object} params
|
|
344
|
+
|
|
376
345
|
* @example
|
|
377
346
|
* ```ts
|
|
378
347
|
* const {
|
|
379
|
-
*
|
|
348
|
+
* data,
|
|
380
349
|
* isLoading,
|
|
381
350
|
* isError,
|
|
382
351
|
* error,
|
|
383
352
|
* refetch,
|
|
384
353
|
* ...moreUseQueryResults
|
|
385
|
-
* } =
|
|
354
|
+
* } = useAddress();
|
|
386
355
|
* ```
|
|
387
|
-
|
|
388
|
-
* @see
|
|
389
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/tokens)
|
|
390
|
-
*
|
|
391
|
-
* [Token interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Token.md)
|
|
356
|
+
* @see {@link https://monerium.dev/api-docs-v2#tag/addresses/operation/address | API Documentation}
|
|
392
357
|
*/
|
|
393
|
-
declare function
|
|
394
|
-
|
|
395
|
-
|
|
358
|
+
declare function useAddress({ address, query, }: {
|
|
359
|
+
/** Fetch a specific address. */
|
|
360
|
+
address: string;
|
|
361
|
+
/** {@inheritDoc QueryOptions} */
|
|
362
|
+
query?: QueryOptions<Address>;
|
|
363
|
+
}): _tanstack_react_query.UseQueryResult<Address, Error>;
|
|
396
364
|
/**
|
|
397
|
-
* # Get balances
|
|
398
365
|
* @group Hooks
|
|
366
|
+
* @category Addresses
|
|
399
367
|
* @param {Object} [params] No required parameters.
|
|
400
|
-
* @param {
|
|
401
|
-
* @param {
|
|
402
|
-
|
|
368
|
+
* @param {Object} [params.profile] Filter based on profile id.
|
|
369
|
+
* @param {Object} [params.chain] Filter based on chain - CURRENTLY RETURNS AN ERROR.
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* const {
|
|
373
|
+
* data,
|
|
374
|
+
* isLoading,
|
|
375
|
+
* isError,
|
|
376
|
+
* error,
|
|
377
|
+
* refetch,
|
|
378
|
+
* ...moreUseQueryResults
|
|
379
|
+
* } = useAddresses();
|
|
380
|
+
* ```
|
|
381
|
+
* @see {@link https://monerium.dev/api-docs-v2#tag/addresses/operation/addresses | API Documentation}
|
|
382
|
+
*/
|
|
383
|
+
declare function useAddresses({ profile, chain, query, }?: {
|
|
384
|
+
profile?: string;
|
|
385
|
+
chain?: Chain | ChainId;
|
|
386
|
+
/** {@inheritDoc QueryOptions} */
|
|
387
|
+
query?: QueryOptions<AddressesResponse>;
|
|
388
|
+
}): _tanstack_react_query.UseQueryResult<AddressesResponse, Error>;
|
|
389
|
+
/**
|
|
390
|
+
* # Get balance for a an address on a give chain
|
|
391
|
+
* @group Hooks
|
|
392
|
+
* @category Addresses
|
|
393
|
+
* @param {Object} params
|
|
394
|
+
* @param {QueryOptions<Balances>} params.address The address to fetch the balance for.
|
|
395
|
+
* @param {QueryOptions<Balances>} params.chain The chain to fetch the balance for.
|
|
396
|
+
* @param {QueryOptions<Balances>} [params.currencies] One or many: `eur`, `usd`, `gbp`, `isk`
|
|
403
397
|
* @example
|
|
404
398
|
* ```ts
|
|
405
399
|
* const {
|
|
406
|
-
*
|
|
400
|
+
* data,
|
|
407
401
|
* isLoading,
|
|
408
402
|
* isError,
|
|
409
403
|
* error,
|
|
@@ -411,25 +405,72 @@ declare function useTokens({ query, }?: {
|
|
|
411
405
|
* ...moreUseQueryResults
|
|
412
406
|
* } = useBalances();
|
|
413
407
|
* ```
|
|
414
|
-
* @see
|
|
415
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profile-balances)
|
|
408
|
+
* @see {@link https://monerium.dev/api-docs/v2#tag/addresses/operation/balances | API Documentation}
|
|
416
409
|
*
|
|
417
|
-
* [Balances interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Balances.md)
|
|
418
410
|
*/
|
|
419
|
-
declare function useBalances({
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
411
|
+
declare function useBalances({ address, chain, currencies, query, }: {
|
|
412
|
+
address: string;
|
|
413
|
+
chain: Chain | ChainId;
|
|
414
|
+
currencies?: Currency | Currency[];
|
|
415
|
+
/** {@inheritDoc QueryOptions} */
|
|
416
|
+
query?: QueryOptions<Balances>;
|
|
417
|
+
}): _tanstack_react_query.UseQueryResult<Balances, Error>;
|
|
423
418
|
/**
|
|
424
|
-
* # Get single order
|
|
425
419
|
* @group Hooks
|
|
420
|
+
* @category IBANs
|
|
426
421
|
* @param {Object} params
|
|
427
|
-
* @param {Object} params.orderId The id of the order.
|
|
428
|
-
* @param {QueryOptions<Order>} [params.query] {@inheritDoc QueryOptions}
|
|
429
422
|
* @example
|
|
430
423
|
* ```ts
|
|
431
424
|
* const {
|
|
432
|
-
*
|
|
425
|
+
* data,
|
|
426
|
+
* isLoading,
|
|
427
|
+
* isError,
|
|
428
|
+
* error,
|
|
429
|
+
* refetch,
|
|
430
|
+
* ...moreUseQueryResults
|
|
431
|
+
* } = useIBAN();
|
|
432
|
+
* ```
|
|
433
|
+
* @see {@link https://monerium.dev/api-docs-v2#tag/ibans/operation/iban | API Documentation}
|
|
434
|
+
*/
|
|
435
|
+
declare function useIBAN({ iban, query, }: {
|
|
436
|
+
/** Fetch a specific IBAN */
|
|
437
|
+
iban: string;
|
|
438
|
+
/** {@inheritDoc QueryOptions} */
|
|
439
|
+
query?: QueryOptions<IBAN>;
|
|
440
|
+
}): _tanstack_react_query.UseQueryResult<IBAN, Error>;
|
|
441
|
+
/**
|
|
442
|
+
* @group Hooks
|
|
443
|
+
* @category IBANs
|
|
444
|
+
* @param {Object} [params] No required parameters.
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* const {
|
|
448
|
+
* data,
|
|
449
|
+
* isLoading,
|
|
450
|
+
* isError,
|
|
451
|
+
* error,
|
|
452
|
+
* refetch,
|
|
453
|
+
* ...moreUseQueryResults
|
|
454
|
+
* } = useIBANs();
|
|
455
|
+
* ```
|
|
456
|
+
* @see {@link https://monerium.dev/api-docs-v2#tag/ibans/operation/ibans | API Documentation}
|
|
457
|
+
*/
|
|
458
|
+
declare function useIBANs({ profile, chain, query, }?: {
|
|
459
|
+
/** Fetch IBANs for a specific profile. */
|
|
460
|
+
profile?: string;
|
|
461
|
+
/** Fetch IBANs for a specific chain. */
|
|
462
|
+
chain?: Chain | ChainId;
|
|
463
|
+
/** {@inheritDoc QueryOptions} */
|
|
464
|
+
query?: QueryOptions<IBANsResponse>;
|
|
465
|
+
}): _tanstack_react_query.UseQueryResult<IBANsResponse, Error>;
|
|
466
|
+
/**
|
|
467
|
+
* @group Hooks
|
|
468
|
+
* @category Orders
|
|
469
|
+
* @param {Object} params
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* const {
|
|
473
|
+
* data,
|
|
433
474
|
* isLoading,
|
|
434
475
|
* isError,
|
|
435
476
|
* error,
|
|
@@ -437,30 +478,28 @@ declare function useBalances({ profileId, query, }?: {
|
|
|
437
478
|
* ...moreUseQueryResults
|
|
438
479
|
* } = useOrder();
|
|
439
480
|
* ```
|
|
440
|
-
* @see
|
|
441
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/order)
|
|
442
|
-
*
|
|
443
|
-
* [Order interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Order.md)
|
|
481
|
+
* @see {@link https://monerium.dev/api-docs#operation/order| API Documentation}
|
|
444
482
|
*/
|
|
445
483
|
declare function useOrder({ orderId, query, }: {
|
|
484
|
+
/** The id of the order. */
|
|
446
485
|
orderId: string;
|
|
486
|
+
/** {@inheritDoc QueryOptions} */
|
|
447
487
|
query?: QueryOptions<Order>;
|
|
448
|
-
}):
|
|
488
|
+
}): _tanstack_react_query.UseQueryResult<Order, Error>;
|
|
449
489
|
/**
|
|
450
|
-
* # Get orders
|
|
451
490
|
* @group Hooks
|
|
491
|
+
* @category Orders
|
|
452
492
|
* @param {Object} [params] No required parameters.
|
|
453
493
|
* @param {Object} [params.address] Filter based on the blockchain address associated with the order.
|
|
454
494
|
* @param {Object} [params.memo] Filter by the payment memo/reference..
|
|
455
495
|
* @param {Object} [params.profile] Filter based on the profile ID associated with the order.
|
|
456
496
|
* @param {Object} [params.state] Filter based on the state of the order.
|
|
457
497
|
* @param {Object} [params.txHash] Filter based on the blockchain transaction hash.
|
|
458
|
-
* @param {QueryOptions<Order[]>} [params.query] {@inheritDoc QueryOptions}
|
|
459
498
|
*
|
|
460
499
|
* @example
|
|
461
500
|
* ```ts
|
|
462
501
|
* const {
|
|
463
|
-
*
|
|
502
|
+
* data,
|
|
464
503
|
* isLoading,
|
|
465
504
|
* isError,
|
|
466
505
|
* error,
|
|
@@ -468,28 +507,105 @@ declare function useOrder({ orderId, query, }: {
|
|
|
468
507
|
* ...moreUseQueryResults
|
|
469
508
|
* } = useOrders();
|
|
470
509
|
* ```
|
|
471
|
-
* @see
|
|
472
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/orders)
|
|
473
|
-
*
|
|
474
|
-
* [Order interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Order.md)
|
|
510
|
+
* @see {@link https://monerium.dev/api-docs#operation/orders | API Documentation}
|
|
475
511
|
*/
|
|
476
512
|
declare function useOrders({ query, ...filters }?: {
|
|
477
|
-
|
|
513
|
+
/** {@inheritDoc QueryOptions} */
|
|
514
|
+
query?: QueryOptions<OrdersResponse>;
|
|
478
515
|
address?: string;
|
|
479
516
|
txHash?: string;
|
|
480
517
|
profile?: string;
|
|
481
518
|
memo?: string;
|
|
482
519
|
state?: OrderState;
|
|
483
|
-
}):
|
|
520
|
+
}): _tanstack_react_query.UseQueryResult<OrdersResponse, Error>;
|
|
521
|
+
/**
|
|
522
|
+
* Submit the required compliance information to onboard the customer.
|
|
523
|
+
*
|
|
524
|
+
* Note that you won't be able to change the profile "kind" from personal to corporate or vice versa once the profile has been approved.
|
|
525
|
+
* @group Hooks
|
|
526
|
+
* @category Profiles
|
|
527
|
+
* @param param
|
|
528
|
+
* @param {string} param.profile The id of the profile to submit to.
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```ts
|
|
532
|
+
* const {
|
|
533
|
+
* submitProfileDetails, // useMutation's `mutateAsync` property
|
|
534
|
+
* isPending,
|
|
535
|
+
* isError,
|
|
536
|
+
* error,
|
|
537
|
+
* status,
|
|
538
|
+
* ...moreUseMutationResults
|
|
539
|
+
* } = useSubmitProfileDetails();
|
|
540
|
+
* ```
|
|
541
|
+
* @see {@link https://monerium.dev/api-docs-v2#tag/profiles/operation/profile-details | API Documentation}}
|
|
542
|
+
*/
|
|
543
|
+
declare function useSubmitProfileDetails({ profile, mutation, }: {
|
|
544
|
+
profile: string;
|
|
545
|
+
/** {@inheritDoc MutationOptions} */
|
|
546
|
+
mutation?: MutationOptions<ResponseStatus, Error, SubmitProfileDetailsPayload>;
|
|
547
|
+
}): MutationResult<'submitProfileDetails', ResponseStatus, Error, SubmitProfileDetailsPayload>;
|
|
548
|
+
/**
|
|
549
|
+
* Create an IBAN for a specified address and chain.
|
|
550
|
+
* All incoming EUR payments will automatically be routed to the linked address on that chain.
|
|
551
|
+
* Any linked address can use this IBAN for outgoing payments.
|
|
552
|
+
* @group Hooks
|
|
553
|
+
* @category IBANs
|
|
554
|
+
* @param {Object} [params] No required parameters.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```ts
|
|
558
|
+
* const {
|
|
559
|
+
* requestIban, // useMutation's `mutateAsync` property
|
|
560
|
+
* isPending,
|
|
561
|
+
* isError,
|
|
562
|
+
* error,
|
|
563
|
+
* status,
|
|
564
|
+
* ...moreUseMutationResults
|
|
565
|
+
* } = useRequestIban();
|
|
566
|
+
* ```
|
|
567
|
+
* @see {@link https://monerium.dev/api-docs-v2#tag/ibans/operation/request-iban | API Documentation}}
|
|
568
|
+
*/
|
|
569
|
+
declare function useRequestIban({ mutation, }?: {
|
|
570
|
+
/** {@inheritDoc MutationOptions} */
|
|
571
|
+
mutation?: MutationOptions<ResponseStatus, Error, RequestIbanPayload>;
|
|
572
|
+
}): MutationResult<'requestIban', ResponseStatus, Error, RequestIbanPayload>;
|
|
573
|
+
/**
|
|
574
|
+
* Move an existing IBAN to a specified address an chain.
|
|
575
|
+
* All incoming EUR payments will automatically be routed to the address on that chain.
|
|
576
|
+
* @group Hooks
|
|
577
|
+
* @category IBANs
|
|
578
|
+
* @param {Object} [params] No required parameters.
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* ```ts
|
|
582
|
+
* const {
|
|
583
|
+
* moveIban, // useMutation's `mutateAsync` property
|
|
584
|
+
* isPending,
|
|
585
|
+
* isError,
|
|
586
|
+
* error,
|
|
587
|
+
* status,
|
|
588
|
+
* ...moreUseMutationResults
|
|
589
|
+
* } = useMoveIban();
|
|
590
|
+
* ```
|
|
591
|
+
* @see {@link https://monerium.dev/api-docs/v2#tag/ibans/operation/move-iban | API Documentation}
|
|
592
|
+
*/
|
|
593
|
+
declare function useMoveIban({ mutation, }?: {
|
|
594
|
+
/** {@inheritDoc MutationOptions} */
|
|
595
|
+
mutation?: MutationOptions<ResponseStatus, Error, MoveIbanPayload & {
|
|
596
|
+
iban: string;
|
|
597
|
+
}>;
|
|
598
|
+
}): MutationResult<'moveIban', ResponseStatus, Error, MoveIbanPayload & {
|
|
599
|
+
iban: string;
|
|
600
|
+
}>;
|
|
484
601
|
/**
|
|
485
|
-
* # Place an order.
|
|
486
602
|
* When the order has been placed, the orders query will be invalidated and re-fetched.
|
|
487
603
|
*
|
|
488
604
|
* If the order amount is above 15000, a supporting document is required.
|
|
489
605
|
* @group Hooks
|
|
606
|
+
* @category Orders
|
|
490
607
|
* @param param
|
|
491
608
|
* @param {File} param.supportingDocument Supporting document file.
|
|
492
|
-
* @param {Object} param.mutation {@inheritDoc MutationOptions}
|
|
493
609
|
*
|
|
494
610
|
* @example
|
|
495
611
|
* ```ts
|
|
@@ -502,23 +618,19 @@ declare function useOrders({ query, ...filters }?: {
|
|
|
502
618
|
* ...moreUseMutationResults
|
|
503
619
|
* } = usePlaceOrder();
|
|
504
620
|
* ```
|
|
505
|
-
* @see
|
|
506
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/post-orders)
|
|
507
|
-
*
|
|
508
|
-
* [NewOrder type](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/type-aliases/NewOrder.md)
|
|
621
|
+
* @see {@link https://monerium.dev/api-docs#operation/post-orders| API Documentation}
|
|
509
622
|
*/
|
|
510
623
|
declare function usePlaceOrder({ supportingDocument, mutation, }?: {
|
|
511
624
|
supportingDocument?: File;
|
|
625
|
+
/** {@inheritDoc MutationOptions} */
|
|
512
626
|
mutation?: MutationOptions<Order, Error, NewOrder>;
|
|
513
627
|
}): MutationResult<'placeOrder', Order, Error, NewOrder>;
|
|
514
628
|
/**
|
|
515
629
|
* # Add address to profile.
|
|
516
|
-
* When the address has been linked, the relevant profile query will be invalidated and re-fetched.
|
|
517
630
|
*
|
|
518
631
|
* @group Hooks
|
|
519
|
-
* @
|
|
520
|
-
* @param {
|
|
521
|
-
* @param {Object} param.mutation {@inheritDoc MutationOptions}
|
|
632
|
+
* @category Profiles
|
|
633
|
+
* @param {Object} [params] No required parameters.
|
|
522
634
|
*
|
|
523
635
|
* @example
|
|
524
636
|
* ```ts
|
|
@@ -531,14 +643,49 @@ declare function usePlaceOrder({ supportingDocument, mutation, }?: {
|
|
|
531
643
|
* ...moreUseMutationResults
|
|
532
644
|
* } = useLinkAddress();
|
|
533
645
|
* ```
|
|
534
|
-
* @see
|
|
535
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profile-addresses)
|
|
536
|
-
*
|
|
537
|
-
* [LinkAddress interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/LinkAddress.md)
|
|
646
|
+
* @see {@link https://monerium.dev/api-docs#operation/profile-addresses | API Documentation}
|
|
538
647
|
*/
|
|
539
|
-
declare function useLinkAddress({
|
|
540
|
-
|
|
648
|
+
declare function useLinkAddress({ mutation, }?: {
|
|
649
|
+
/** {@inheritDoc MutationOptions} */
|
|
541
650
|
mutation?: MutationOptions<LinkedAddress, Error, LinkAddress>;
|
|
542
651
|
}): MutationResult<'linkAddress', LinkedAddress, Error, LinkAddress>;
|
|
652
|
+
/**
|
|
653
|
+
* API consumers have the option to subscribe to a WebSocket for real-time order notifications. This WebSocket complies with the standard WebSocket Protocol, allowing the use of standard WebSocket libraries for subscription.
|
|
654
|
+
*
|
|
655
|
+
* The WebSocket emits an event when a order changes state:
|
|
656
|
+
*
|
|
657
|
+
* `placed`: The order has been created but not yet processed.
|
|
658
|
+
*
|
|
659
|
+
* `pending`: The order is awaiting fulfillment (e.g., review, minting/burning tokens, or sending/receiving SEPA payment).
|
|
660
|
+
*
|
|
661
|
+
* `processed`: The order has been completed successfully.
|
|
662
|
+
*
|
|
663
|
+
* `rejected`: The order was rejected, possibly due to compliance reasons or insufficient funds.
|
|
664
|
+
* @group Hooks
|
|
665
|
+
* @category Orders
|
|
666
|
+
* @param {Object} params
|
|
667
|
+
* @param {OrderState} [params.state] Filter based on the state of the order.
|
|
668
|
+
* @param {string} [params.profile] Filter based on the profile id of the order.
|
|
669
|
+
* @param {Function} params.onMessage Callback function to handle the order notification.
|
|
670
|
+
* @param {Function} [params.onError] Callback function to handle the error notification.
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* ```ts
|
|
674
|
+
* const {
|
|
675
|
+
* state,
|
|
676
|
+
* profile,
|
|
677
|
+
* onMessage,
|
|
678
|
+
* onError
|
|
679
|
+
* } = useSubscribeOrderNotification();
|
|
680
|
+
* ```
|
|
681
|
+
* @see {@link https://monerium.dev/api-docs/v1#operation/orders-notifications| API Documentation}
|
|
682
|
+
* @returns {Function} Unsubscribe from order notifications.
|
|
683
|
+
*/
|
|
684
|
+
declare const useSubscribeOrderNotification: ({ state, profile, onMessage, onError, }: {
|
|
685
|
+
state?: OrderState;
|
|
686
|
+
profile?: string;
|
|
687
|
+
onMessage: (order: Order) => void;
|
|
688
|
+
onError?: ((err: Event) => void) | undefined;
|
|
689
|
+
}) => () => void | undefined;
|
|
543
690
|
|
|
544
|
-
export { type AuthorizeParams, MoneriumContext, MoneriumProvider, type MutationOptions, type MutationResult, type QueryOptions, type QueryResult, type SdkInstance, type UseAuthReturn, keys,
|
|
691
|
+
export { type AuthorizeParams, MoneriumContext, MoneriumProvider, type MutationOptions, type MutationResult, type QueryOptions, type QueryResult, type SdkInstance, type UseAuthReturn, keys, useAddress, useAddresses, useAuth, useBalances, useIBAN, useIBANs, useLinkAddress, useMoveIban, useOrder, useOrders, usePlaceOrder, useProfile, useProfiles, useRequestIban, useSubmitProfileDetails, useSubscribeOrderNotification, useTokens };
|