@monerium/sdk-react-provider 0.3.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 +29 -20
- package/dist/index.d.ts +317 -172
- package/dist/index.js +22 -15
- package/dist/index.mjs +4 -4
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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.
|
|
@@ -15,13 +16,16 @@ export { AuthContext, Balances, LinkAddress, Order, OrderState, Profile, Token }
|
|
|
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
21
|
clientId: string;
|
|
21
22
|
redirectUri: string;
|
|
22
23
|
/** @deprecated use redirectUri */
|
|
23
24
|
redirectUrl?: string;
|
|
24
25
|
environment?: "sandbox" | "production";
|
|
26
|
+
refreshToken?: string;
|
|
27
|
+
onRefreshTokenUpdate?: (token: string) => void;
|
|
28
|
+
debug?: boolean;
|
|
25
29
|
}) => react_jsx_runtime.JSX.Element;
|
|
26
30
|
|
|
27
31
|
type SdkInstance = {
|
|
@@ -57,13 +61,20 @@ type UseAuthReturn = {
|
|
|
57
61
|
* See [Tanstack Query - useQuery](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery) options.
|
|
58
62
|
* @see # [Tanstack Query - useQuery](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery)
|
|
59
63
|
* @template {Object} TData - The data returned.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
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.
|
|
63
76
|
* ```diff
|
|
64
77
|
* query: {
|
|
65
|
-
* - queryKey,
|
|
66
|
-
* - queryFn,
|
|
67
78
|
* gcTime,
|
|
68
79
|
* enabled,
|
|
69
80
|
* networkMode,
|
|
@@ -87,26 +98,6 @@ type UseAuthReturn = {
|
|
|
87
98
|
* throwOnError
|
|
88
99
|
* }
|
|
89
100
|
* ```
|
|
90
|
-
* @example
|
|
91
|
-
* ```ts
|
|
92
|
-
* useQueryHook({
|
|
93
|
-
* query: {
|
|
94
|
-
* enabled: isReady,
|
|
95
|
-
* staleTime: 1000,
|
|
96
|
-
* placeHolderData: { foo: 'bar' },
|
|
97
|
-
* }
|
|
98
|
-
* })
|
|
99
|
-
* ```
|
|
100
|
-
* @usedBy
|
|
101
|
-
* {@link useAuthContext}
|
|
102
|
-
*
|
|
103
|
-
* {@link useBalances}
|
|
104
|
-
*
|
|
105
|
-
* {@link useOrders}
|
|
106
|
-
*
|
|
107
|
-
* {@link useProfile}
|
|
108
|
-
*
|
|
109
|
-
* {@link useTokens}
|
|
110
101
|
*/
|
|
111
102
|
type QueryOptions<TData = unknown> = Omit<UseQueryOptions<TData>, 'queryKey' | 'queryFn'>;
|
|
112
103
|
/**
|
|
@@ -145,16 +136,6 @@ type QueryOptions<TData = unknown> = Omit<UseQueryOptions<TData>, 'queryKey' | '
|
|
|
145
136
|
* status,
|
|
146
137
|
*}
|
|
147
138
|
* ```
|
|
148
|
-
* @usedBy
|
|
149
|
-
* {@link useAuthContext}
|
|
150
|
-
*
|
|
151
|
-
* {@link useBalances}
|
|
152
|
-
*
|
|
153
|
-
* {@link useOrders}
|
|
154
|
-
*
|
|
155
|
-
* {@link useProfile}
|
|
156
|
-
*
|
|
157
|
-
* {@link useTokens}
|
|
158
139
|
*
|
|
159
140
|
*/
|
|
160
141
|
type QueryResult<TVarName extends string, TData = unknown> = Omit<UseQueryResult<TData>, 'data'> & {
|
|
@@ -168,14 +149,26 @@ type QueryResult<TVarName extends string, TData = unknown> = Omit<UseQueryResult
|
|
|
168
149
|
* @template {Object} TError - The error returned.
|
|
169
150
|
* @template {Object} TVariables - The variables used in the mutation.
|
|
170
151
|
*
|
|
171
|
-
* @
|
|
172
|
-
*
|
|
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.
|
|
173
168
|
* ```diff
|
|
174
169
|
* mutation: {
|
|
175
170
|
* gcTime,
|
|
176
171
|
* meta,
|
|
177
|
-
* - mutationFn,
|
|
178
|
-
* - mutationKey,
|
|
179
172
|
* networkMode,
|
|
180
173
|
* onError,
|
|
181
174
|
* onMutate,
|
|
@@ -187,24 +180,6 @@ type QueryResult<TVarName extends string, TData = unknown> = Omit<UseQueryResult
|
|
|
187
180
|
* throwOnError,
|
|
188
181
|
* }
|
|
189
182
|
* ```
|
|
190
|
-
* @example
|
|
191
|
-
* ```ts
|
|
192
|
-
* useMutationHook({
|
|
193
|
-
* mutation: {
|
|
194
|
-
* onSuccess: (data, variables) => {
|
|
195
|
-
* console.log('onSuccess callback', data, variables);
|
|
196
|
-
* },
|
|
197
|
-
* onError: (error) => {
|
|
198
|
-
* console.log('onError callback', error);
|
|
199
|
-
* },
|
|
200
|
-
* },
|
|
201
|
-
* })
|
|
202
|
-
* ```
|
|
203
|
-
*
|
|
204
|
-
* @usedBy
|
|
205
|
-
* {@link useLinkAddress}
|
|
206
|
-
*
|
|
207
|
-
* {@link usePlaceOrder}
|
|
208
183
|
*/
|
|
209
184
|
type MutationOptions<TData = unknown, TError = unknown, TVariables = unknown> = Omit<UseMutationOptions<TData, TError, TVariables>, 'mutationKey' | 'mutationFn'>;
|
|
210
185
|
/**
|
|
@@ -238,10 +213,6 @@ type MutationOptions<TData = unknown, TError = unknown, TVariables = unknown> =
|
|
|
238
213
|
* variables,
|
|
239
214
|
* } = useMutationHook();
|
|
240
215
|
* ```
|
|
241
|
-
* @usedBy
|
|
242
|
-
* {@link useLinkAddress}
|
|
243
|
-
*
|
|
244
|
-
* {@link usePlaceOrder}
|
|
245
216
|
*/
|
|
246
217
|
type MutationResult<TFuncName extends string, TData, TError, TVariables, TContext = unknown> = Omit<UseMutationResult<TData, TError, TVariables, TContext>, 'mutateAsync'> & {
|
|
247
218
|
[P in TFuncName]: UseMutationResult<TData, TError, TVariables, TContext>['mutateAsync'];
|
|
@@ -251,30 +222,37 @@ declare const MoneriumContext: react.Context<(UseAuthReturn & SdkInstance) | nul
|
|
|
251
222
|
|
|
252
223
|
/**
|
|
253
224
|
* @internal
|
|
254
|
-
* Query keys
|
|
225
|
+
* Query keys for React query
|
|
255
226
|
* */
|
|
256
227
|
declare const keys: {
|
|
257
228
|
getAll: string[];
|
|
258
|
-
|
|
259
|
-
getProfile: (profileId: string) => string[];
|
|
229
|
+
getProfile: (profile: string) => string[];
|
|
260
230
|
getProfiles: string[];
|
|
261
|
-
|
|
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) => {}[];
|
|
262
236
|
getTokens: string[];
|
|
263
237
|
getOrder: (orderId: string) => string[];
|
|
264
238
|
getOrders: (filter?: unknown) => {}[];
|
|
239
|
+
submitProfileDetails: string[];
|
|
240
|
+
moveIban: string[];
|
|
241
|
+
requestIban: string[];
|
|
265
242
|
placeOrder: string[];
|
|
266
243
|
linkAddress: string[];
|
|
267
244
|
};
|
|
268
245
|
/**
|
|
269
246
|
* # Redirect to the Monerium auth flow.
|
|
270
247
|
* @group Hooks
|
|
248
|
+
* @category Authentication
|
|
271
249
|
* @example
|
|
272
250
|
* ```ts
|
|
273
251
|
* const { authorize, isAuthorized, isLoading, error } = useAuth();
|
|
274
252
|
*
|
|
275
253
|
* authorize(); // Redirects to the Monerium auth flow.
|
|
276
254
|
*
|
|
277
|
-
* //
|
|
255
|
+
* // Opt-in to automated wallet linking with these parameters.
|
|
278
256
|
* authorize({ address, signature, chain }).
|
|
279
257
|
* ```
|
|
280
258
|
*
|
|
@@ -288,124 +266,138 @@ declare const keys: {
|
|
|
288
266
|
*/
|
|
289
267
|
declare function useAuth(): UseAuthReturn;
|
|
290
268
|
/**
|
|
291
|
-
*
|
|
269
|
+
* If no `profile` id is provided, the default profile is used.
|
|
292
270
|
* @group Hooks
|
|
293
|
-
*
|
|
294
|
-
* @param {Object}
|
|
295
|
-
* @param {QueryOptions<AuthContext>} [params.query] {@inheritDoc QueryOptions}
|
|
271
|
+
* @category Profiles
|
|
272
|
+
* @param {Object} params
|
|
296
273
|
*
|
|
297
274
|
* @example
|
|
298
275
|
* ```ts
|
|
299
276
|
* const {
|
|
300
|
-
*
|
|
277
|
+
* data
|
|
301
278
|
* isLoading,
|
|
302
279
|
* isError,
|
|
303
280
|
* error,
|
|
304
281
|
* refetch,
|
|
305
282
|
* ...moreUseQueryResults
|
|
306
|
-
* } =
|
|
283
|
+
* } = useProfile();
|
|
307
284
|
* ```
|
|
308
|
-
|
|
309
|
-
* @see
|
|
310
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/auth-context)
|
|
311
|
-
*
|
|
312
|
-
* [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}
|
|
313
287
|
*/
|
|
314
|
-
declare function
|
|
315
|
-
|
|
316
|
-
|
|
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>;
|
|
317
294
|
/**
|
|
318
|
-
* # Get
|
|
319
|
-
* If no `profileId` is provided, the default profile is used.
|
|
295
|
+
* # Get profiles
|
|
320
296
|
* @group Hooks
|
|
321
|
-
* @
|
|
322
|
-
*
|
|
323
|
-
* @param {
|
|
297
|
+
* @category Profiles
|
|
298
|
+
*
|
|
299
|
+
* @param {Object} [params] No required parameters.
|
|
324
300
|
*
|
|
325
301
|
* @example
|
|
326
302
|
* ```ts
|
|
327
303
|
* const {
|
|
328
|
-
*
|
|
304
|
+
* data,
|
|
329
305
|
* isLoading,
|
|
330
306
|
* isError,
|
|
331
307
|
* error,
|
|
332
308
|
* refetch,
|
|
333
309
|
* ...moreUseQueryResults
|
|
334
|
-
* } =
|
|
310
|
+
* } = useProfiles();
|
|
335
311
|
* ```
|
|
336
|
-
|
|
337
|
-
* @see
|
|
338
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profile)
|
|
339
|
-
*
|
|
340
|
-
* [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}
|
|
341
313
|
*/
|
|
342
|
-
declare function
|
|
343
|
-
|
|
344
|
-
query?: QueryOptions<
|
|
345
|
-
}):
|
|
314
|
+
declare function useProfiles({ query, }?: {
|
|
315
|
+
/** {@inheritDoc QueryOptions} */
|
|
316
|
+
query?: QueryOptions<ProfilesResponse>;
|
|
317
|
+
}): _tanstack_react_query.UseQueryResult<ProfilesResponse, Error>;
|
|
346
318
|
/**
|
|
347
|
-
* # Get profiles
|
|
348
319
|
* @group Hooks
|
|
349
320
|
* @param {Object} [params] No required parameters.
|
|
350
|
-
* @param {QueryOptions<Profile[]>} [params.query] {@inheritDoc QueryOptions}
|
|
351
321
|
*
|
|
352
322
|
* @example
|
|
353
323
|
* ```ts
|
|
354
324
|
* const {
|
|
355
|
-
*
|
|
325
|
+
* data,
|
|
356
326
|
* isLoading,
|
|
357
327
|
* isError,
|
|
358
328
|
* error,
|
|
359
329
|
* refetch,
|
|
360
330
|
* ...moreUseQueryResults
|
|
361
|
-
* } =
|
|
331
|
+
* } = useTokens();
|
|
362
332
|
* ```
|
|
363
333
|
|
|
364
|
-
* @see
|
|
365
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profiles)
|
|
366
|
-
*
|
|
367
|
-
* [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}
|
|
368
335
|
*/
|
|
369
|
-
declare function
|
|
370
|
-
|
|
371
|
-
|
|
336
|
+
declare function useTokens({ query, }?: {
|
|
337
|
+
/** {@inheritDoc QueryOptions} */
|
|
338
|
+
query?: QueryOptions<Token[]>;
|
|
339
|
+
}): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
372
340
|
/**
|
|
373
|
-
* # Get tokens
|
|
374
341
|
* @group Hooks
|
|
375
|
-
* @
|
|
376
|
-
* @param {
|
|
377
|
-
|
|
342
|
+
* @category Addresses
|
|
343
|
+
* @param {Object} params
|
|
344
|
+
|
|
378
345
|
* @example
|
|
379
346
|
* ```ts
|
|
380
347
|
* const {
|
|
381
|
-
*
|
|
348
|
+
* data,
|
|
382
349
|
* isLoading,
|
|
383
350
|
* isError,
|
|
384
351
|
* error,
|
|
385
352
|
* refetch,
|
|
386
353
|
* ...moreUseQueryResults
|
|
387
|
-
* } =
|
|
354
|
+
* } = useAddress();
|
|
388
355
|
* ```
|
|
389
|
-
|
|
390
|
-
* @see
|
|
391
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/tokens)
|
|
392
|
-
*
|
|
393
|
-
* [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}
|
|
394
357
|
*/
|
|
395
|
-
declare function
|
|
396
|
-
|
|
397
|
-
|
|
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>;
|
|
398
364
|
/**
|
|
399
|
-
* # Get balances
|
|
400
365
|
* @group Hooks
|
|
366
|
+
* @category Addresses
|
|
401
367
|
* @param {Object} [params] No required parameters.
|
|
402
|
-
* @param {
|
|
403
|
-
* @param {
|
|
404
|
-
|
|
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`
|
|
405
397
|
* @example
|
|
406
398
|
* ```ts
|
|
407
399
|
* const {
|
|
408
|
-
*
|
|
400
|
+
* data,
|
|
409
401
|
* isLoading,
|
|
410
402
|
* isError,
|
|
411
403
|
* error,
|
|
@@ -413,25 +405,72 @@ declare function useTokens({ query, }?: {
|
|
|
413
405
|
* ...moreUseQueryResults
|
|
414
406
|
* } = useBalances();
|
|
415
407
|
* ```
|
|
416
|
-
* @see
|
|
417
|
-
* [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}
|
|
418
409
|
*
|
|
419
|
-
* [Balances interface](https://github.com/monerium/js-monorepo/blob/main/packages/sdk/docs/generated/interfaces/Balances.md)
|
|
420
410
|
*/
|
|
421
|
-
declare function useBalances({
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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>;
|
|
425
418
|
/**
|
|
426
|
-
* # Get single order
|
|
427
419
|
* @group Hooks
|
|
420
|
+
* @category IBANs
|
|
428
421
|
* @param {Object} params
|
|
429
|
-
* @param {Object} params.orderId The id of the order.
|
|
430
|
-
* @param {QueryOptions<Order>} [params.query] {@inheritDoc QueryOptions}
|
|
431
422
|
* @example
|
|
432
423
|
* ```ts
|
|
433
424
|
* const {
|
|
434
|
-
*
|
|
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,
|
|
435
474
|
* isLoading,
|
|
436
475
|
* isError,
|
|
437
476
|
* error,
|
|
@@ -439,30 +478,28 @@ declare function useBalances({ profileId, query, }?: {
|
|
|
439
478
|
* ...moreUseQueryResults
|
|
440
479
|
* } = useOrder();
|
|
441
480
|
* ```
|
|
442
|
-
* @see
|
|
443
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/order)
|
|
444
|
-
*
|
|
445
|
-
* [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}
|
|
446
482
|
*/
|
|
447
483
|
declare function useOrder({ orderId, query, }: {
|
|
484
|
+
/** The id of the order. */
|
|
448
485
|
orderId: string;
|
|
486
|
+
/** {@inheritDoc QueryOptions} */
|
|
449
487
|
query?: QueryOptions<Order>;
|
|
450
|
-
}):
|
|
488
|
+
}): _tanstack_react_query.UseQueryResult<Order, Error>;
|
|
451
489
|
/**
|
|
452
|
-
* # Get orders
|
|
453
490
|
* @group Hooks
|
|
491
|
+
* @category Orders
|
|
454
492
|
* @param {Object} [params] No required parameters.
|
|
455
493
|
* @param {Object} [params.address] Filter based on the blockchain address associated with the order.
|
|
456
494
|
* @param {Object} [params.memo] Filter by the payment memo/reference..
|
|
457
495
|
* @param {Object} [params.profile] Filter based on the profile ID associated with the order.
|
|
458
496
|
* @param {Object} [params.state] Filter based on the state of the order.
|
|
459
497
|
* @param {Object} [params.txHash] Filter based on the blockchain transaction hash.
|
|
460
|
-
* @param {QueryOptions<Order[]>} [params.query] {@inheritDoc QueryOptions}
|
|
461
498
|
*
|
|
462
499
|
* @example
|
|
463
500
|
* ```ts
|
|
464
501
|
* const {
|
|
465
|
-
*
|
|
502
|
+
* data,
|
|
466
503
|
* isLoading,
|
|
467
504
|
* isError,
|
|
468
505
|
* error,
|
|
@@ -470,28 +507,105 @@ declare function useOrder({ orderId, query, }: {
|
|
|
470
507
|
* ...moreUseQueryResults
|
|
471
508
|
* } = useOrders();
|
|
472
509
|
* ```
|
|
473
|
-
* @see
|
|
474
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/orders)
|
|
475
|
-
*
|
|
476
|
-
* [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}
|
|
477
511
|
*/
|
|
478
512
|
declare function useOrders({ query, ...filters }?: {
|
|
479
|
-
|
|
513
|
+
/** {@inheritDoc QueryOptions} */
|
|
514
|
+
query?: QueryOptions<OrdersResponse>;
|
|
480
515
|
address?: string;
|
|
481
516
|
txHash?: string;
|
|
482
517
|
profile?: string;
|
|
483
518
|
memo?: string;
|
|
484
519
|
state?: OrderState;
|
|
485
|
-
}):
|
|
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
|
+
}>;
|
|
486
601
|
/**
|
|
487
|
-
* # Place an order.
|
|
488
602
|
* When the order has been placed, the orders query will be invalidated and re-fetched.
|
|
489
603
|
*
|
|
490
604
|
* If the order amount is above 15000, a supporting document is required.
|
|
491
605
|
* @group Hooks
|
|
606
|
+
* @category Orders
|
|
492
607
|
* @param param
|
|
493
608
|
* @param {File} param.supportingDocument Supporting document file.
|
|
494
|
-
* @param {Object} param.mutation {@inheritDoc MutationOptions}
|
|
495
609
|
*
|
|
496
610
|
* @example
|
|
497
611
|
* ```ts
|
|
@@ -504,23 +618,19 @@ declare function useOrders({ query, ...filters }?: {
|
|
|
504
618
|
* ...moreUseMutationResults
|
|
505
619
|
* } = usePlaceOrder();
|
|
506
620
|
* ```
|
|
507
|
-
* @see
|
|
508
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/post-orders)
|
|
509
|
-
*
|
|
510
|
-
* [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}
|
|
511
622
|
*/
|
|
512
623
|
declare function usePlaceOrder({ supportingDocument, mutation, }?: {
|
|
513
624
|
supportingDocument?: File;
|
|
625
|
+
/** {@inheritDoc MutationOptions} */
|
|
514
626
|
mutation?: MutationOptions<Order, Error, NewOrder>;
|
|
515
627
|
}): MutationResult<'placeOrder', Order, Error, NewOrder>;
|
|
516
628
|
/**
|
|
517
629
|
* # Add address to profile.
|
|
518
|
-
* When the address has been linked, the relevant profile query will be invalidated and re-fetched.
|
|
519
630
|
*
|
|
520
631
|
* @group Hooks
|
|
521
|
-
* @
|
|
522
|
-
* @param {
|
|
523
|
-
* @param {Object} param.mutation {@inheritDoc MutationOptions}
|
|
632
|
+
* @category Profiles
|
|
633
|
+
* @param {Object} [params] No required parameters.
|
|
524
634
|
*
|
|
525
635
|
* @example
|
|
526
636
|
* ```ts
|
|
@@ -533,14 +643,49 @@ declare function usePlaceOrder({ supportingDocument, mutation, }?: {
|
|
|
533
643
|
* ...moreUseMutationResults
|
|
534
644
|
* } = useLinkAddress();
|
|
535
645
|
* ```
|
|
536
|
-
* @see
|
|
537
|
-
* [API Documentation](https://monerium.dev/api-docs#operation/profile-addresses)
|
|
538
|
-
*
|
|
539
|
-
* [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}
|
|
540
647
|
*/
|
|
541
|
-
declare function useLinkAddress({
|
|
542
|
-
|
|
648
|
+
declare function useLinkAddress({ mutation, }?: {
|
|
649
|
+
/** {@inheritDoc MutationOptions} */
|
|
543
650
|
mutation?: MutationOptions<LinkedAddress, Error, LinkAddress>;
|
|
544
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;
|
|
545
690
|
|
|
546
|
-
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 };
|