@symmio/trading-react 0.2.0 → 1.1.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 +2 -2
- package/dist/account-layer/index.d.ts +4 -0
- package/dist/account-layer/index.d.ts.map +1 -1
- package/dist/account-layer/index.js +30 -26
- package/dist/account-layer/use-account-balance-info.d.ts +15 -4
- package/dist/account-layer/use-account-balance-info.d.ts.map +1 -1
- package/dist/account-layer/use-account-balance-info.js +21 -9
- package/dist/account-layer/use-account-balance-info.js.map +1 -1
- package/dist/account-layer/use-account-balance-of.d.ts +15 -4
- package/dist/account-layer/use-account-balance-of.d.ts.map +1 -1
- package/dist/account-layer/use-account-balance-of.js +20 -9
- package/dist/account-layer/use-account-balance-of.js.map +1 -1
- package/dist/account-layer/use-affiliate-state.d.ts +26 -0
- package/dist/account-layer/use-affiliate-state.d.ts.map +1 -0
- package/dist/account-layer/use-affiliate-state.js +27 -0
- package/dist/account-layer/use-affiliate-state.js.map +1 -0
- package/dist/account-layer/use-cancel-registration.d.ts +28 -0
- package/dist/account-layer/use-cancel-registration.d.ts.map +1 -0
- package/dist/account-layer/use-cancel-registration.js +38 -0
- package/dist/account-layer/use-cancel-registration.js.map +1 -0
- package/dist/account-layer/use-deposit-and-allocate.d.ts +7 -4
- package/dist/account-layer/use-deposit-and-allocate.d.ts.map +1 -1
- package/dist/account-layer/use-deposit-and-allocate.js.map +1 -1
- package/dist/account-layer/use-deposit.d.ts +3 -1
- package/dist/account-layer/use-deposit.d.ts.map +1 -1
- package/dist/account-layer/use-deposit.js +17 -15
- package/dist/account-layer/use-deposit.js.map +1 -1
- package/dist/account-layer/use-generated-account-manager-address.d.ts +25 -0
- package/dist/account-layer/use-generated-account-manager-address.d.ts.map +1 -0
- package/dist/account-layer/use-generated-account-manager-address.js +27 -0
- package/dist/account-layer/use-generated-account-manager-address.js.map +1 -0
- package/dist/account-layer/use-request-to-register-affiliate.d.ts +43 -0
- package/dist/account-layer/use-request-to-register-affiliate.d.ts.map +1 -0
- package/dist/account-layer/use-request-to-register-affiliate.js +38 -0
- package/dist/account-layer/use-request-to-register-affiliate.js.map +1 -0
- package/dist/estimated-price/index.d.ts +2 -0
- package/dist/estimated-price/index.d.ts.map +1 -0
- package/dist/estimated-price/use-debounced-value.d.ts +9 -0
- package/dist/estimated-price/use-debounced-value.d.ts.map +1 -0
- package/dist/estimated-price/use-debounced-value.js +18 -0
- package/dist/estimated-price/use-debounced-value.js.map +1 -0
- package/dist/estimated-price/use-estimated-price.d.ts +46 -0
- package/dist/estimated-price/use-estimated-price.d.ts.map +1 -0
- package/dist/estimated-price/use-estimated-price.js +31 -0
- package/dist/estimated-price/use-estimated-price.js.map +1 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +124 -118
- package/dist/instant-layer/use-instant-close-auto.d.ts +1 -1
- package/dist/instant-layer/use-instant-close-auto.js.map +1 -1
- package/dist/instant-layer/use-instant-close-bulk-auto.d.ts +1 -1
- package/dist/instant-layer/use-instant-close-bulk-auto.js.map +1 -1
- package/dist/instant-layer/use-instant-open-with-tpsl.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-open-with-tpsl.js +10 -2
- package/dist/instant-layer/use-instant-open-with-tpsl.js.map +1 -1
- package/dist/margin/index.d.ts +2 -0
- package/dist/margin/index.d.ts.map +1 -0
- package/dist/margin/use-available-instant-open-margin.d.ts +51 -0
- package/dist/margin/use-available-instant-open-margin.d.ts.map +1 -0
- package/dist/margin/use-available-instant-open-margin.js +66 -0
- package/dist/margin/use-available-instant-open-margin.js.map +1 -0
- package/dist/provider/symmio-provider.d.ts +14 -5
- package/dist/provider/symmio-provider.d.ts.map +1 -1
- package/dist/provider/symmio-provider.js +2 -2
- package/dist/provider/symmio-provider.js.map +1 -1
- package/dist/quotes/use-managed-quotes.js +16 -16
- package/dist/quotes/use-managed-quotes.js.map +1 -1
- package/dist/websocket/is-settle-notification.d.ts +15 -0
- package/dist/websocket/is-settle-notification.d.ts.map +1 -0
- package/dist/websocket/is-settle-notification.js +15 -0
- package/dist/websocket/is-settle-notification.js.map +1 -0
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`@symmio/trading-react` is the React layer of the SYMMIO SDK. It wraps the framework-agnostic `@symmio/trading-core` in hooks and a provider, bridging the SDK to your app's wagmi and TanStack Query setup so you can read positions, quotes, balances, and prices and run trading flows without wiring contract calls yourself.
|
|
6
6
|
|
|
7
|
-
**[Documentation](https://
|
|
7
|
+
**[Documentation](https://doc.trading-sdk.symm.io/react) · [Live SDK console](https://console.trading-sdk.symm.io/)**
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -40,7 +40,7 @@ function Account() {
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
For the full list of hooks and providers, see the [API reference](https://
|
|
43
|
+
For the full list of hooks and providers, see the [API reference](https://doc.trading-sdk.symm.io/react).
|
|
44
44
|
|
|
45
45
|
## License
|
|
46
46
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
export * from './use-account-balance-info.js';
|
|
2
2
|
export * from './use-account-balance-of.js';
|
|
3
3
|
export * from './use-add-margin.js';
|
|
4
|
+
export * from './use-affiliate-state.js';
|
|
4
5
|
export * from './use-allocate.js';
|
|
6
|
+
export * from './use-cancel-registration.js';
|
|
5
7
|
export * from './use-create-sub-accounts.js';
|
|
6
8
|
export * from './use-deallocate.js';
|
|
7
9
|
export * from './use-delete-sub-account.js';
|
|
8
10
|
export * from './use-deposit.js';
|
|
9
11
|
export * from './use-deposit-and-allocate.js';
|
|
10
12
|
export * from './use-edit-account-name.js';
|
|
13
|
+
export * from './use-generated-account-manager-address.js';
|
|
11
14
|
export * from './use-predicted-next-virtual-account.js';
|
|
12
15
|
export * from './use-remove-margin.js';
|
|
16
|
+
export * from './use-request-to-register-affiliate.js';
|
|
13
17
|
export * from './use-simulate-add-margin.js';
|
|
14
18
|
export * from './use-simulate-allocate.js';
|
|
15
19
|
export * from './use-simulate-create-sub-accounts.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account-layer/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iDAAiD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account-layer/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC;AACpC,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iDAAiD,CAAC"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { useAccountBalanceInfo as e } from "./use-account-balance-info.js";
|
|
2
2
|
import { useAccountBalanceOf as t } from "./use-account-balance-of.js";
|
|
3
3
|
import { useAddMargin as n } from "./use-add-margin.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
4
|
+
import { useAffiliateState as r } from "./use-affiliate-state.js";
|
|
5
|
+
import { useAllocate as i } from "./use-allocate.js";
|
|
6
|
+
import { useCancelRegistration as a } from "./use-cancel-registration.js";
|
|
7
|
+
import { useCreateSubAccounts as o } from "./use-create-sub-accounts.js";
|
|
8
|
+
import { useDeallocate as s } from "./use-deallocate.js";
|
|
9
|
+
import { useDeleteSubAccount as c } from "./use-delete-sub-account.js";
|
|
10
|
+
import { useDeposit as l } from "./use-deposit.js";
|
|
11
|
+
import { useDepositAndAllocate as u } from "./use-deposit-and-allocate.js";
|
|
12
|
+
import { useEditAccountName as d } from "./use-edit-account-name.js";
|
|
13
|
+
import { useGeneratedAccountManagerAddress as f } from "./use-generated-account-manager-address.js";
|
|
14
|
+
import { usePredictedNextVirtualAccount as p } from "./use-predicted-next-virtual-account.js";
|
|
15
|
+
import { useRemoveMargin as m } from "./use-remove-margin.js";
|
|
16
|
+
import { useRequestToRegisterAffiliate as h } from "./use-request-to-register-affiliate.js";
|
|
17
|
+
import { useSimulateAddMargin as g } from "./use-simulate-add-margin.js";
|
|
18
|
+
import { useSimulateAllocate as _ } from "./use-simulate-allocate.js";
|
|
19
|
+
import { useSimulateCreateSubAccounts as v } from "./use-simulate-create-sub-accounts.js";
|
|
20
|
+
import { useSimulateDeallocate as y } from "./use-simulate-deallocate.js";
|
|
21
|
+
import { useSimulateDeleteSubAccount as b } from "./use-simulate-delete-sub-account.js";
|
|
22
|
+
import { useSimulateDeposit as x } from "./use-simulate-deposit.js";
|
|
23
|
+
import { useSimulateDepositAndAllocate as S } from "./use-simulate-deposit-and-allocate.js";
|
|
24
|
+
import { useSimulateEditAccountName as C } from "./use-simulate-edit-account-name.js";
|
|
25
|
+
import { useSimulateRemoveMargin as w } from "./use-simulate-remove-margin.js";
|
|
26
|
+
import { useSubAccount as T } from "./use-sub-account.js";
|
|
27
|
+
import { useSubAccountVirtualNonce as E } from "./use-sub-account-virtual-nonce.js";
|
|
28
|
+
import { useSubAccountsCountOfUser as D } from "./use-sub-accounts-count-of-user.js";
|
|
29
|
+
import { useUserSubAccounts as O } from "./use-user-sub-accounts.js";
|
|
30
|
+
import { useUserSubAccountsAddresses as k } from "./use-user-sub-accounts-addresses.js";
|
|
31
|
+
import { useVirtualAccount as A } from "./use-virtual-account.js";
|
|
32
|
+
import { useVirtualAccountsAddressesOfSubAccount as j } from "./use-virtual-accounts-addresses-of-sub-account.js";
|
|
33
|
+
export { e as useAccountBalanceInfo, t as useAccountBalanceOf, n as useAddMargin, r as useAffiliateState, i as useAllocate, a as useCancelRegistration, o as useCreateSubAccounts, s as useDeallocate, c as useDeleteSubAccount, l as useDeposit, u as useDepositAndAllocate, d as useEditAccountName, f as useGeneratedAccountManagerAddress, p as usePredictedNextVirtualAccount, m as useRemoveMargin, h as useRequestToRegisterAffiliate, g as useSimulateAddMargin, _ as useSimulateAllocate, v as useSimulateCreateSubAccounts, y as useSimulateDeallocate, b as useSimulateDeleteSubAccount, x as useSimulateDeposit, S as useSimulateDepositAndAllocate, C as useSimulateEditAccountName, w as useSimulateRemoveMargin, T as useSubAccount, E as useSubAccountVirtualNonce, D as useSubAccountsCountOfUser, O as useUserSubAccounts, k as useUserSubAccountsAddresses, A as useVirtualAccount, j as useVirtualAccountsAddressesOfSubAccount };
|
|
@@ -3,19 +3,30 @@ import { UseQueryResult } from '@tanstack/react-query';
|
|
|
3
3
|
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for {@link useAccountBalanceInfo}: the core query options
|
|
6
|
-
* (account, chain id, TanStack `query` overrides) plus an optional `config
|
|
6
|
+
* (account, chain id, TanStack `query` overrides) plus an optional `config` and
|
|
7
|
+
* a `live` flag.
|
|
7
8
|
*/
|
|
8
|
-
export type UseAccountBalanceInfoParameters = GetAccountBalanceInfoOptions & ConfigParameter
|
|
9
|
+
export type UseAccountBalanceInfoParameters = GetAccountBalanceInfoOptions & ConfigParameter & {
|
|
10
|
+
/**
|
|
11
|
+
* Subscribe to the account's on-chain settle notifications and refetch on
|
|
12
|
+
* each open-anchor / close-fill (a shared WebSocket; requires the provider
|
|
13
|
+
* tree). Turn this on wherever the balance must reflect a just-settled trade
|
|
14
|
+
* without a manual refresh.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
live?: boolean;
|
|
18
|
+
};
|
|
9
19
|
/** Return type of {@link useAccountBalanceInfo}. */
|
|
10
20
|
export type UseAccountBalanceInfoReturnType = UseQueryResult<GetAccountBalanceInfoReturnType, SymmioRequestError>;
|
|
11
21
|
/**
|
|
12
22
|
* Read raw `balanceInfoOfPartyA` fields for a SYMMIO account. The query is
|
|
13
23
|
* disabled until `account` is set. Omitted `chainId` resolves through the SDK
|
|
14
|
-
* config. Errors are normalized to {@link SymmioRequestError}.
|
|
24
|
+
* config. Errors are normalized to {@link SymmioRequestError}. Pass `live: true`
|
|
25
|
+
* to auto-refetch when an open/close settles on-chain.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
17
28
|
* ```tsx
|
|
18
|
-
* const { data, isLoading } = useAccountBalanceInfo({ account });
|
|
29
|
+
* const { data, isLoading } = useAccountBalanceInfo({ account, live: true });
|
|
19
30
|
* ```
|
|
20
31
|
*/
|
|
21
32
|
export declare function useAccountBalanceInfo(parameters?: UseAccountBalanceInfoParameters): UseAccountBalanceInfoReturnType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-balance-info.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-account-balance-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,
|
|
1
|
+
{"version":3,"file":"use-account-balance-info.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-account-balance-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EAErC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;;;GAIG;AACH,MAAM,MAAM,+BAA+B,GAAG,4BAA4B,GACxE,eAAe,GAAG;IAChB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEJ,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,+BAA+B,EAAE,kBAAkB,CAAC,CAAC;AAElH;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,+BAAoC,GAC/C,+BAA+B,CAwCjC"}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useSymmioConfig as e } from "../provider/use-symmio-config.js";
|
|
3
3
|
import { normalizeSymmError as t } from "../errors/normalize-symm-error.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { SETTLE_REFETCH_DELAYS_MS as n, isSettleNotification as r } from "../websocket/is-settle-notification.js";
|
|
5
|
+
import { useNotifications as i } from "../websocket/use-notifications.js";
|
|
6
|
+
import { getAccountBalanceInfoQueryOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useCallback as o } from "react";
|
|
8
|
+
import { useQuery as s } from "@tanstack/react-query";
|
|
6
9
|
//#region src/account-layer/use-account-balance-info.ts
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
...a,
|
|
10
|
+
function c(c = {}) {
|
|
11
|
+
let { live: l, ...u } = c, d = e(u), f = a(d, u), p = s({
|
|
12
|
+
...f,
|
|
11
13
|
queryFn: async () => {
|
|
12
14
|
try {
|
|
13
|
-
return await
|
|
15
|
+
return await f.queryFn();
|
|
14
16
|
} catch (e) {
|
|
15
17
|
throw t(e);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
|
-
});
|
|
20
|
+
}), { refetch: m } = p, h = u.account;
|
|
21
|
+
return i({
|
|
22
|
+
account: h,
|
|
23
|
+
chainId: u.chainId ?? d.defaultChainId,
|
|
24
|
+
config: u.config,
|
|
25
|
+
enabled: !!(l && h) && u.query?.enabled !== !1,
|
|
26
|
+
onNotification: o((e) => {
|
|
27
|
+
let t = h !== void 0 && e.vaAddress?.toLowerCase() === h.toLowerCase();
|
|
28
|
+
if (!(!r(e) && !t)) for (let e of n) setTimeout(() => void m(), e);
|
|
29
|
+
}, [m, h])
|
|
30
|
+
}), p;
|
|
19
31
|
}
|
|
20
32
|
//#endregion
|
|
21
|
-
export {
|
|
33
|
+
export { c as useAccountBalanceInfo };
|
|
22
34
|
|
|
23
35
|
//# sourceMappingURL=use-account-balance-info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-balance-info.js","names":[],"sources":["../../src/account-layer/use-account-balance-info.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceInfoQueryOptions,\n type ConfigParameter,\n type GetAccountBalanceInfoOptions,\n type GetAccountBalanceInfoReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useAccountBalanceInfo}: the core query options\n * (account, chain id, TanStack `query` overrides) plus an optional `config
|
|
1
|
+
{"version":3,"file":"use-account-balance-info.js","names":[],"sources":["../../src/account-layer/use-account-balance-info.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceInfoQueryOptions,\n type ConfigParameter,\n type GetAccountBalanceInfoOptions,\n type GetAccountBalanceInfoReturnType,\n type Notification,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { isSettleNotification, SETTLE_REFETCH_DELAYS_MS } from \"../websocket/is-settle-notification\";\nimport { useNotifications } from \"../websocket/use-notifications\";\n\n/**\n * Parameters for {@link useAccountBalanceInfo}: the core query options\n * (account, chain id, TanStack `query` overrides) plus an optional `config` and\n * a `live` flag.\n */\nexport type UseAccountBalanceInfoParameters = GetAccountBalanceInfoOptions &\n ConfigParameter & {\n /**\n * Subscribe to the account's on-chain settle notifications and refetch on\n * each open-anchor / close-fill (a shared WebSocket; requires the provider\n * tree). Turn this on wherever the balance must reflect a just-settled trade\n * without a manual refresh.\n * @default false\n */\n live?: boolean;\n };\n\n/** Return type of {@link useAccountBalanceInfo}. */\nexport type UseAccountBalanceInfoReturnType = UseQueryResult<GetAccountBalanceInfoReturnType, SymmioRequestError>;\n\n/**\n * Read raw `balanceInfoOfPartyA` fields for a SYMMIO account. The query is\n * disabled until `account` is set. Omitted `chainId` resolves through the SDK\n * config. Errors are normalized to {@link SymmioRequestError}. Pass `live: true`\n * to auto-refetch when an open/close settles on-chain.\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useAccountBalanceInfo({ account, live: true });\n * ```\n */\nexport function useAccountBalanceInfo(\n parameters: UseAccountBalanceInfoParameters = {},\n): UseAccountBalanceInfoReturnType {\n const { live, ...queryParameters } = parameters;\n const config = useSymmioConfig(queryParameters);\n const options = getAccountBalanceInfoQueryOptions(config, queryParameters);\n\n const query = useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseAccountBalanceInfoReturnType;\n\n const { refetch } = query;\n const account = queryParameters.account;\n useNotifications({\n account,\n // Watch the same chain the balance is read from (the query falls back to the\n // config default when chainId is omitted).\n chainId: queryParameters.chainId ?? config.defaultChainId,\n config: queryParameters.config,\n enabled: Boolean(live && account) && queryParameters.query?.enabled !== false,\n onNotification: useCallback(\n (notification: Notification) => {\n // Refetch on a balance-moving settle, or on any frame whose `vaAddress`\n // is the exact account being read (its Virtual Account just settled).\n const matchesVa = account !== undefined && notification.vaAddress?.toLowerCase() === account.toLowerCase();\n if (!isSettleNotification(notification) && !matchesVa) return;\n // The on-chain read lags the anchor block, so refetch in a short burst\n // until the post-settle balance lands.\n for (const ms of SETTLE_REFETCH_DELAYS_MS) setTimeout(() => void refetch(), ms);\n },\n [refetch, account],\n ),\n });\n\n return query;\n}\n"],"mappings":";;;;;;;;;AAgDA,SAAgB,EACd,IAA8C,CAAC,GACd;CACjC,IAAM,EAAE,SAAM,GAAG,MAAoB,GAC/B,IAAS,EAAgB,CAAe,GACxC,IAAU,EAAkC,GAAQ,CAAe,GAEnE,IAAQ,EAAS;EACrB,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAEK,EAAE,eAAY,GACd,IAAU,EAAgB;CAsBhC,OArBA,EAAiB;EACf;EAGA,SAAS,EAAgB,WAAW,EAAO;EAC3C,QAAQ,EAAgB;EACxB,SAAS,GAAQ,KAAQ,MAAY,EAAgB,OAAO,YAAY;EACxE,gBAAgB,GACb,MAA+B;GAG9B,IAAM,IAAY,MAAY,KAAA,KAAa,EAAa,WAAW,YAAY,MAAM,EAAQ,YAAY;GACrG,OAAC,EAAqB,CAAY,KAAK,CAAC,IAG5C,KAAK,IAAM,KAAM,GAA0B,iBAAiB,KAAK,EAAQ,GAAG,CAAE;EAChF,GACA,CAAC,GAAS,CAAO,CACnB;CACF,CAAC,GAEM;AACT"}
|
|
@@ -3,19 +3,30 @@ import { UseQueryResult } from '@tanstack/react-query';
|
|
|
3
3
|
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for {@link useAccountBalanceOf}: the core query options
|
|
6
|
-
* (account, chain id, TanStack `query` overrides) plus an optional `config
|
|
6
|
+
* (account, chain id, TanStack `query` overrides) plus an optional `config` and
|
|
7
|
+
* a `live` flag.
|
|
7
8
|
*/
|
|
8
|
-
export type UseAccountBalanceOfParameters = GetAccountBalanceOfOptions & ConfigParameter
|
|
9
|
+
export type UseAccountBalanceOfParameters = GetAccountBalanceOfOptions & ConfigParameter & {
|
|
10
|
+
/**
|
|
11
|
+
* Subscribe to the account's on-chain settle notifications and refetch on
|
|
12
|
+
* each open-anchor / close-fill (a shared WebSocket; requires the provider
|
|
13
|
+
* tree). Turn this on wherever the balance must reflect a just-settled trade
|
|
14
|
+
* without a manual refresh.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
live?: boolean;
|
|
18
|
+
};
|
|
9
19
|
/** Return type of {@link useAccountBalanceOf}. */
|
|
10
20
|
export type UseAccountBalanceOfReturnType = UseQueryResult<GetAccountBalanceOfReturnType, SymmioRequestError>;
|
|
11
21
|
/**
|
|
12
22
|
* Read raw `balanceOf` for a SYMMIO account. The query is disabled until
|
|
13
23
|
* `account` is set. Omitted `chainId` resolves through the SDK config. Errors are
|
|
14
|
-
* normalized to {@link SymmioRequestError}.
|
|
24
|
+
* normalized to {@link SymmioRequestError}. Pass `live: true` to auto-refetch
|
|
25
|
+
* when an open/close settles on-chain.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
17
28
|
* ```tsx
|
|
18
|
-
* const { data } = useAccountBalanceOf({ account });
|
|
29
|
+
* const { data } = useAccountBalanceOf({ account, live: true });
|
|
19
30
|
* ```
|
|
20
31
|
*/
|
|
21
32
|
export declare function useAccountBalanceOf(parameters?: UseAccountBalanceOfParameters): UseAccountBalanceOfReturnType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-balance-of.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-account-balance-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,
|
|
1
|
+
{"version":3,"file":"use-account-balance-of.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-account-balance-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAEnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,GACpE,eAAe,GAAG;IAChB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEJ,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,6BAA6B,EAAE,kBAAkB,CAAC,CAAC;AAE9G;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAoCjH"}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useSymmioConfig as e } from "../provider/use-symmio-config.js";
|
|
3
3
|
import { normalizeSymmError as t } from "../errors/normalize-symm-error.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { SETTLE_REFETCH_DELAYS_MS as n, isSettleNotification as r } from "../websocket/is-settle-notification.js";
|
|
5
|
+
import { useNotifications as i } from "../websocket/use-notifications.js";
|
|
6
|
+
import { getAccountBalanceOfQueryOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useCallback as o } from "react";
|
|
8
|
+
import { useQuery as s } from "@tanstack/react-query";
|
|
6
9
|
//#region src/account-layer/use-account-balance-of.ts
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
...a,
|
|
10
|
+
function c(c = {}) {
|
|
11
|
+
let { live: l, ...u } = c, d = e(u), f = a(d, u), p = s({
|
|
12
|
+
...f,
|
|
11
13
|
queryFn: async () => {
|
|
12
14
|
try {
|
|
13
|
-
return await
|
|
15
|
+
return await f.queryFn();
|
|
14
16
|
} catch (e) {
|
|
15
17
|
throw t(e);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
|
-
});
|
|
20
|
+
}), { refetch: m } = p;
|
|
21
|
+
return i({
|
|
22
|
+
account: u.account,
|
|
23
|
+
chainId: u.chainId ?? d.defaultChainId,
|
|
24
|
+
config: u.config,
|
|
25
|
+
enabled: !!(l && u.account) && u.query?.enabled !== !1,
|
|
26
|
+
onNotification: o((e) => {
|
|
27
|
+
if (r(e)) for (let e of n) setTimeout(() => void m(), e);
|
|
28
|
+
}, [m])
|
|
29
|
+
}), p;
|
|
19
30
|
}
|
|
20
31
|
//#endregion
|
|
21
|
-
export {
|
|
32
|
+
export { c as useAccountBalanceOf };
|
|
22
33
|
|
|
23
34
|
//# sourceMappingURL=use-account-balance-of.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-balance-of.js","names":[],"sources":["../../src/account-layer/use-account-balance-of.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceOfQueryOptions,\n type ConfigParameter,\n type GetAccountBalanceOfOptions,\n type GetAccountBalanceOfReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useAccountBalanceOf}: the core query options\n * (account, chain id, TanStack `query` overrides) plus an optional `config
|
|
1
|
+
{"version":3,"file":"use-account-balance-of.js","names":[],"sources":["../../src/account-layer/use-account-balance-of.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceOfQueryOptions,\n type ConfigParameter,\n type GetAccountBalanceOfOptions,\n type GetAccountBalanceOfReturnType,\n type Notification,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { isSettleNotification, SETTLE_REFETCH_DELAYS_MS } from \"../websocket/is-settle-notification\";\nimport { useNotifications } from \"../websocket/use-notifications\";\n\n/**\n * Parameters for {@link useAccountBalanceOf}: the core query options\n * (account, chain id, TanStack `query` overrides) plus an optional `config` and\n * a `live` flag.\n */\nexport type UseAccountBalanceOfParameters = GetAccountBalanceOfOptions &\n ConfigParameter & {\n /**\n * Subscribe to the account's on-chain settle notifications and refetch on\n * each open-anchor / close-fill (a shared WebSocket; requires the provider\n * tree). Turn this on wherever the balance must reflect a just-settled trade\n * without a manual refresh.\n * @default false\n */\n live?: boolean;\n };\n\n/** Return type of {@link useAccountBalanceOf}. */\nexport type UseAccountBalanceOfReturnType = UseQueryResult<GetAccountBalanceOfReturnType, SymmioRequestError>;\n\n/**\n * Read raw `balanceOf` for a SYMMIO account. The query is disabled until\n * `account` is set. Omitted `chainId` resolves through the SDK config. Errors are\n * normalized to {@link SymmioRequestError}. Pass `live: true` to auto-refetch\n * when an open/close settles on-chain.\n *\n * @example\n * ```tsx\n * const { data } = useAccountBalanceOf({ account, live: true });\n * ```\n */\nexport function useAccountBalanceOf(parameters: UseAccountBalanceOfParameters = {}): UseAccountBalanceOfReturnType {\n const { live, ...queryParameters } = parameters;\n const config = useSymmioConfig(queryParameters);\n const options = getAccountBalanceOfQueryOptions(config, queryParameters);\n\n const query = useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseAccountBalanceOfReturnType;\n\n const { refetch } = query;\n useNotifications({\n account: queryParameters.account,\n // Watch the same chain the balance is read from (the query falls back to the\n // config default when chainId is omitted).\n chainId: queryParameters.chainId ?? config.defaultChainId,\n config: queryParameters.config,\n enabled: Boolean(live && queryParameters.account) && queryParameters.query?.enabled !== false,\n onNotification: useCallback(\n (notification: Notification) => {\n if (!isSettleNotification(notification)) return;\n // The on-chain read lags the anchor block, so refetch in a short burst\n // until the post-settle balance lands.\n for (const ms of SETTLE_REFETCH_DELAYS_MS) setTimeout(() => void refetch(), ms);\n },\n [refetch],\n ),\n });\n\n return query;\n}\n"],"mappings":";;;;;;;;;AAgDA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,EAAE,SAAM,GAAG,MAAoB,GAC/B,IAAS,EAAgB,CAAe,GACxC,IAAU,EAAgC,GAAQ,CAAe,GAEjE,IAAQ,EAAS;EACrB,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAEK,EAAE,eAAY;CAmBpB,OAlBA,EAAiB;EACf,SAAS,EAAgB;EAGzB,SAAS,EAAgB,WAAW,EAAO;EAC3C,QAAQ,EAAgB;EACxB,SAAS,GAAQ,KAAQ,EAAgB,YAAY,EAAgB,OAAO,YAAY;EACxF,gBAAgB,GACb,MAA+B;GACzB,MAAqB,CAAY,GAGtC,KAAK,IAAM,KAAM,GAA0B,iBAAiB,KAAK,EAAQ,GAAG,CAAE;EAChF,GACA,CAAC,CAAO,CACV;CACF,CAAC,GAEM;AACT"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigParameter, GetAffiliateStateOptions, GetAffiliateStateReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useAffiliateState}: the core query options (affiliate,
|
|
6
|
+
* chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseAffiliateStateParameters = GetAffiliateStateOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useAffiliateState}. */
|
|
10
|
+
export type UseAffiliateStateReturnType = UseQueryResult<GetAffiliateStateReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read an affiliate's lifecycle state (`NONE` / `PENDING` / `ACTIVE` / `PAUSED`).
|
|
13
|
+
* The query is disabled until `affiliate` is set. `chainId` defaults to the
|
|
14
|
+
* connected chain. Pass a `query.refetchInterval` to poll while awaiting
|
|
15
|
+
* approval. Errors are normalized to {@link SymmioRequestError}.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { data: state } = useAffiliateState({
|
|
20
|
+
* affiliate,
|
|
21
|
+
* query: { refetchInterval: 15_000 },
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAffiliateState(parameters?: UseAffiliateStateParameters): UseAffiliateStateReturnType;
|
|
26
|
+
//# sourceMappingURL=use-affiliate-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-affiliate-state.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-affiliate-state.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG,eAAe,CAAC;AAErF,gDAAgD;AAChD,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;AAE1G;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,GAAE,2BAAgC,GAAG,2BAA2B,CAkB3G"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getAffiliateStateQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/account-layer/use-affiliate-state.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useAffiliateState };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-affiliate-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-affiliate-state.js","names":[],"sources":["../../src/account-layer/use-affiliate-state.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAffiliateStateQueryOptions,\n type ConfigParameter,\n type GetAffiliateStateOptions,\n type GetAffiliateStateReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useAffiliateState}: the core query options (affiliate,\n * chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseAffiliateStateParameters = GetAffiliateStateOptions & ConfigParameter;\n\n/** Return type of {@link useAffiliateState}. */\nexport type UseAffiliateStateReturnType = UseQueryResult<GetAffiliateStateReturnType, SymmioRequestError>;\n\n/**\n * Read an affiliate's lifecycle state (`NONE` / `PENDING` / `ACTIVE` / `PAUSED`).\n * The query is disabled until `affiliate` is set. `chainId` defaults to the\n * connected chain. Pass a `query.refetchInterval` to poll while awaiting\n * approval. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: state } = useAffiliateState({\n * affiliate,\n * query: { refetchInterval: 15_000 },\n * });\n * ```\n */\nexport function useAffiliateState(parameters: UseAffiliateStateParameters = {}): UseAffiliateStateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getAffiliateStateQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseAffiliateStateReturnType;\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,EAAkB,IAA0C,CAAC,GAAgC;CAC3G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA8B,GAAQ;EACpD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CancelRegistrationParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
import { WriteParameters, WriteResult } from '../transactions/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for {@link useCancelRegistration}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseCancelRegistrationParameters = WriteParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Result returned by the {@link useCancelRegistration} mutation.
|
|
11
|
+
*/
|
|
12
|
+
export type CancelRegistrationResult = WriteResult;
|
|
13
|
+
/** Return type of {@link useCancelRegistration}. */
|
|
14
|
+
export type UseCancelRegistrationReturnType = UseMutationResult<CancelRegistrationResult, SymmioRequestError, CancelRegistrationParameters>;
|
|
15
|
+
/**
|
|
16
|
+
* Submit a `cancelRegistration` transaction to withdraw a still-`PENDING`
|
|
17
|
+
* affiliate registration (caller must be the affiliate `admin`). On success, the
|
|
18
|
+
* cancelled affiliate's `getAffiliateState` query is invalidated so mounted
|
|
19
|
+
* status polls refetch.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { mutate } = useCancelRegistration();
|
|
24
|
+
* mutate({ affiliate: "0xaff…" });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useCancelRegistration(parameters?: UseCancelRegistrationParameters): UseCancelRegistrationReturnType;
|
|
28
|
+
//# sourceMappingURL=use-cancel-registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cancel-registration.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-cancel-registration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,eAAe,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC;AAEnD,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAC7D,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,+BAAoC,GAC/C,+BAA+B,CAgCjC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
+
import { cancelRegistrationMutationOptions as a, getAffiliateStateQueryKey as o } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as s, useQueryClient as c } from "@tanstack/react-query";
|
|
9
|
+
//#region src/account-layer/use-cancel-registration.ts
|
|
10
|
+
function l(l = {}) {
|
|
11
|
+
let u = t(l), d = e(), f = c(), p = a(u);
|
|
12
|
+
return s({
|
|
13
|
+
mutationKey: p.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
let t = e.chainId ?? d;
|
|
17
|
+
return r(u, await p.mutationFn({
|
|
18
|
+
affiliate: e.affiliate,
|
|
19
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
20
|
+
chainId: t
|
|
21
|
+
}), {
|
|
22
|
+
chainId: t,
|
|
23
|
+
waitForReceipt: l.waitForReceipt,
|
|
24
|
+
confirmations: l.confirmations
|
|
25
|
+
});
|
|
26
|
+
} catch (e) {
|
|
27
|
+
throw n(e);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
onSuccess: (e, t) => {
|
|
31
|
+
f.invalidateQueries({ predicate: i(o, { affiliate: t.affiliate }) });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { l as useCancelRegistration };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=use-cancel-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cancel-registration.js","names":[],"sources":["../../src/account-layer/use-cancel-registration.ts"],"sourcesContent":["\"use client\";\n\nimport {\n cancelRegistrationMutationOptions,\n getAffiliateStateQueryKey,\n type CancelRegistrationParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useCancelRegistration}.\n */\nexport type UseCancelRegistrationParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useCancelRegistration} mutation.\n */\nexport type CancelRegistrationResult = WriteResult;\n\n/** Return type of {@link useCancelRegistration}. */\nexport type UseCancelRegistrationReturnType = UseMutationResult<\n CancelRegistrationResult,\n SymmioRequestError,\n CancelRegistrationParameters\n>;\n\n/**\n * Submit a `cancelRegistration` transaction to withdraw a still-`PENDING`\n * affiliate registration (caller must be the affiliate `admin`). On success, the\n * cancelled affiliate's `getAffiliateState` query is invalidated so mounted\n * status polls refetch.\n *\n * @example\n * ```tsx\n * const { mutate } = useCancelRegistration();\n * mutate({ affiliate: \"0xaff…\" });\n * ```\n */\nexport function useCancelRegistration(\n parameters: UseCancelRegistrationParameters = {},\n): UseCancelRegistrationReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = cancelRegistrationMutationOptions(config);\n\n return useMutation<CancelRegistrationResult, SymmioRequestError, CancelRegistrationParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({\n affiliate: variables.affiliate,\n simulateBeforeWrite: variables.simulateBeforeWrite,\n chainId: resolvedChainId,\n });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_data, variables) => {\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getAffiliateStateQueryKey, { affiliate: variables.affiliate }),\n });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA4CA,SAAgB,EACd,IAA8C,CAAC,GACd;CACjC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAAkC,CAAM;CAErD,OAAO,EAAwF;EAC7F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAM7C,OAAO,EAAmB,GAAQ,MALf,EAAK,WAAW;KACjC,WAAW,EAAU;KACrB,qBAAqB,EAAU;KAC/B,SAAS;IACX,CAAC,GACuC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAO,MAAc;GAC/B,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA2B,EAAE,WAAW,EAAU,UAAU,CAAC,EACzF,CAAC;EACH;CACF,CAAC;AACH"}
|
|
@@ -12,10 +12,13 @@ export type DepositAndAllocateResult = WriteResult;
|
|
|
12
12
|
export type UseDepositAndAllocateReturnType = UseMutationResult<DepositAndAllocateResult, SymmioRequestError, DepositAndAllocateForAccountParameters>;
|
|
13
13
|
/**
|
|
14
14
|
* Submit a `depositAndAllocateForAccount` transaction, crediting collateral to a
|
|
15
|
-
* subaccount
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* wallet
|
|
15
|
+
* subaccount and allocating it into the **classic pool** in one transaction.
|
|
16
|
+
* Instant trading spends the **available** balance instead — for the instant
|
|
17
|
+
* flow fund with `useDeposit` alone (funds allocated here are not what an
|
|
18
|
+
* instant open consumes). The connected wallet must own the subaccount, and must
|
|
19
|
+
* have approved the collateral to the SYMMIO core first (see
|
|
20
|
+
* `useApproveCollateral`). On success, the connected wallet's collateral
|
|
21
|
+
* allowance and balance queries are invalidated.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deposit-and-allocate.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deposit-and-allocate.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,sCAAsC,EAC5C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,eAAe,CAAC;AAE9D,qEAAqE;AACrE,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC;AAEnD,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAC7D,wBAAwB,EACxB,kBAAkB,EAClB,sCAAsC,CACvC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"use-deposit-and-allocate.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deposit-and-allocate.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,sCAAsC,EAC5C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,eAAe,CAAC;AAE9D,qEAAqE;AACrE,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC;AAEnD,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAC7D,wBAAwB,EACxB,kBAAkB,EAClB,sCAAsC,CACvC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,+BAAoC,GAC/C,+BAA+B,CAkCjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deposit-and-allocate.js","names":[],"sources":["../../src/account-layer/use-deposit-and-allocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n depositAndAllocateForAccountMutationOptions,\n getCollateralAllowanceQueryKey,\n getCollateralBalanceQueryKey,\n type DepositAndAllocateForAccountParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useConnection } from \"wagmi\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useDepositAndAllocate}.\n */\nexport type UseDepositAndAllocateParameters = WriteParameters;\n\n/** Result returned by the {@link useDepositAndAllocate} mutation. */\nexport type DepositAndAllocateResult = WriteResult;\n\n/** Return type of {@link useDepositAndAllocate}. */\nexport type UseDepositAndAllocateReturnType = UseMutationResult<\n DepositAndAllocateResult,\n SymmioRequestError,\n DepositAndAllocateForAccountParameters\n>;\n\n/**\n * Submit a `depositAndAllocateForAccount` transaction, crediting collateral to a\n * subaccount
|
|
1
|
+
{"version":3,"file":"use-deposit-and-allocate.js","names":[],"sources":["../../src/account-layer/use-deposit-and-allocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n depositAndAllocateForAccountMutationOptions,\n getCollateralAllowanceQueryKey,\n getCollateralBalanceQueryKey,\n type DepositAndAllocateForAccountParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useConnection } from \"wagmi\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useDepositAndAllocate}.\n */\nexport type UseDepositAndAllocateParameters = WriteParameters;\n\n/** Result returned by the {@link useDepositAndAllocate} mutation. */\nexport type DepositAndAllocateResult = WriteResult;\n\n/** Return type of {@link useDepositAndAllocate}. */\nexport type UseDepositAndAllocateReturnType = UseMutationResult<\n DepositAndAllocateResult,\n SymmioRequestError,\n DepositAndAllocateForAccountParameters\n>;\n\n/**\n * Submit a `depositAndAllocateForAccount` transaction, crediting collateral to a\n * subaccount and allocating it into the **classic pool** in one transaction.\n * Instant trading spends the **available** balance instead — for the instant\n * flow fund with `useDeposit` alone (funds allocated here are not what an\n * instant open consumes). The connected wallet must own the subaccount, and must\n * have approved the collateral to the SYMMIO core first (see\n * `useApproveCollateral`). On success, the connected wallet's collateral\n * allowance and balance queries are invalidated.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useDepositAndAllocate();\n * mutate({ account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport function useDepositAndAllocate(\n parameters: UseDepositAndAllocateParameters = {},\n): UseDepositAndAllocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = depositAndAllocateForAccountMutationOptions(config);\n\n return useMutation<DepositAndAllocateResult, SymmioRequestError, DepositAndAllocateForAccountParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({\n account: variables.account,\n amount: variables.amount,\n simulateBeforeWrite: variables.simulateBeforeWrite,\n chainId: resolvedChainId,\n });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: () => {\n const partial = address ? { owner: address } : undefined;\n void queryClient.invalidateQueries({ predicate: predicateMatch(getCollateralAllowanceQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getCollateralBalanceQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAgDA,SAAgB,EACd,IAA8C,CAAC,GACd;CACjC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAA4C,CAAM;CAE/D,OAAO,EAAkG;EACvG,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAO7C,OAAO,EAAmB,GAAQ,MANf,EAAK,WAAW;KACjC,SAAS,EAAU;KACnB,QAAQ,EAAU;KAClB,qBAAqB,EAAU;KAC/B,SAAS;IACX,CAAC,GACuC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,iBAAiB;GACf,IAAM,IAAU,IAAU,EAAE,OAAO,EAAQ,IAAI,KAAA;GAE/C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAgC,CAAO,EAAE,CAAC,GACzG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA8B,CAAO,EAAE,CAAC;EACzG;CACF,CAAC;AACH"}
|
|
@@ -15,7 +15,9 @@ export type UseDepositReturnType = UseMutationResult<DepositResult, SymmioReques
|
|
|
15
15
|
* subaccount's available balance. The connected wallet must own the subaccount,
|
|
16
16
|
* and must have approved the collateral to the SYMMIO core first (see
|
|
17
17
|
* `useApproveCollateral`). On success, the connected wallet's collateral
|
|
18
|
-
* allowance and balance queries
|
|
18
|
+
* allowance and balance queries **and the credited subaccount's available
|
|
19
|
+
* balance** are invalidated, so mounted reads — including the trade form's
|
|
20
|
+
* available instant-open margin (`Max`) — refetch immediately.
|
|
19
21
|
*
|
|
20
22
|
* @example
|
|
21
23
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deposit.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deposit.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-deposit.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deposit.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEnD,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC;AAExC,yCAAyC;AACzC,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,aAAa,EAAE,kBAAkB,EAAE,2BAA2B,CAAC,CAAC;AAErH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,UAAU,GAAE,oBAAyB,GAAG,oBAAoB,CAyCtF"}
|
|
@@ -4,38 +4,40 @@ import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
|
4
4
|
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
5
|
import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
6
|
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
-
import { depositForAccountMutationOptions as a,
|
|
8
|
-
import { useConnection as
|
|
9
|
-
import { useMutation as
|
|
7
|
+
import { depositForAccountMutationOptions as a, getAccountBalanceInfoQueryKey as o, getAccountBalanceOfQueryKey as s, getCollateralAllowanceQueryKey as c, getCollateralBalanceQueryKey as l } from "@symmio/trading-core";
|
|
8
|
+
import { useConnection as u } from "wagmi";
|
|
9
|
+
import { useMutation as d, useQueryClient as f } from "@tanstack/react-query";
|
|
10
10
|
//#region src/account-layer/use-deposit.ts
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return
|
|
14
|
-
mutationKey:
|
|
11
|
+
function p(p = {}) {
|
|
12
|
+
let m = t(p), h = e(), { address: g } = u(), _ = f(), v = a(m);
|
|
13
|
+
return d({
|
|
14
|
+
mutationKey: v.mutationKey,
|
|
15
15
|
mutationFn: async (e) => {
|
|
16
16
|
try {
|
|
17
|
-
let t = e.chainId ??
|
|
18
|
-
return r(
|
|
17
|
+
let t = e.chainId ?? h;
|
|
18
|
+
return r(m, await v.mutationFn({
|
|
19
19
|
account: e.account,
|
|
20
20
|
amount: e.amount,
|
|
21
21
|
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
22
22
|
chainId: t
|
|
23
23
|
}), {
|
|
24
24
|
chainId: t,
|
|
25
|
-
waitForReceipt:
|
|
26
|
-
confirmations:
|
|
25
|
+
waitForReceipt: p.waitForReceipt,
|
|
26
|
+
confirmations: p.confirmations
|
|
27
27
|
});
|
|
28
28
|
} catch (e) {
|
|
29
29
|
throw n(e);
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
onSuccess: () => {
|
|
33
|
-
let
|
|
34
|
-
|
|
32
|
+
onSuccess: (e, t) => {
|
|
33
|
+
let n = g ? { owner: g } : void 0;
|
|
34
|
+
_.invalidateQueries({ predicate: i(c, n) }), _.invalidateQueries({ predicate: i(l, n) });
|
|
35
|
+
let r = { account: t.account };
|
|
36
|
+
_.invalidateQueries({ predicate: i(o, r) }), _.invalidateQueries({ predicate: i(s, r) });
|
|
35
37
|
}
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
//#endregion
|
|
39
|
-
export {
|
|
41
|
+
export { p as useDeposit };
|
|
40
42
|
|
|
41
43
|
//# sourceMappingURL=use-deposit.js.map
|