@sodax/dapp-kit 0.0.1-rc.5 → 0.0.1-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contexts/index.d.ts +2 -1
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/hooks/mm/index.d.ts +2 -0
- package/dist/hooks/mm/index.d.ts.map +1 -1
- package/dist/hooks/mm/useAllowance.d.ts +4 -0
- package/dist/hooks/mm/useAllowance.d.ts.map +1 -0
- package/dist/hooks/{shared → mm}/useApprove.d.ts +5 -1
- package/dist/hooks/mm/useApprove.d.ts.map +1 -0
- package/dist/hooks/mm/useBorrow.d.ts +10 -1
- package/dist/hooks/mm/useBorrow.d.ts.map +1 -1
- package/dist/hooks/mm/useRepay.d.ts +10 -1
- package/dist/hooks/mm/useRepay.d.ts.map +1 -1
- package/dist/hooks/mm/useSupply.d.ts +3 -1
- package/dist/hooks/mm/useSupply.d.ts.map +1 -1
- package/dist/hooks/mm/useUserReservesData.d.ts +1 -1
- package/dist/hooks/mm/useUserReservesData.d.ts.map +1 -1
- package/dist/hooks/mm/useWithdraw.d.ts +8 -1
- package/dist/hooks/mm/useWithdraw.d.ts.map +1 -1
- package/dist/hooks/provider/useHubProvider.d.ts +1 -1
- package/dist/hooks/provider/useHubProvider.d.ts.map +1 -1
- package/dist/hooks/provider/useSpokeProvider.d.ts +16 -2
- package/dist/hooks/provider/useSpokeProvider.d.ts.map +1 -1
- package/dist/hooks/shared/index.d.ts +0 -2
- package/dist/hooks/shared/index.d.ts.map +1 -1
- package/dist/hooks/swap/useCreateIntentOrder.d.ts +4 -4
- package/dist/hooks/swap/useCreateIntentOrder.d.ts.map +1 -1
- package/dist/index.js +148 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -146
- package/dist/index.mjs.map +1 -1
- package/dist/providers/SodaxProvider.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/contexts/index.ts +2 -1
- package/src/hooks/mm/index.ts +2 -0
- package/src/hooks/{shared → mm}/useAllowance.ts +4 -2
- package/src/hooks/{shared → mm}/useApprove.ts +9 -7
- package/src/hooks/mm/useBorrow.ts +14 -5
- package/src/hooks/mm/useRepay.ts +14 -4
- package/src/hooks/mm/useSupply.ts +7 -4
- package/src/hooks/mm/useUserReservesData.ts +22 -33
- package/src/hooks/mm/useWithdraw.ts +12 -4
- package/src/hooks/provider/useHubProvider.ts +2 -20
- package/src/hooks/provider/useSpokeProvider.ts +53 -7
- package/src/hooks/shared/index.ts +0 -2
- package/src/hooks/swap/useCreateIntentOrder.ts +4 -6
- package/src/providers/SodaxProvider.tsx +18 -3
- package/dist/hooks/shared/useAllowance.d.ts +0 -3
- package/dist/hooks/shared/useAllowance.d.ts.map +0 -1
- package/dist/hooks/shared/useApprove.d.ts.map +0 -1
package/dist/contexts/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Sodax } from '@sodax/sdk';
|
|
1
|
+
import type { EvmHubProvider, Sodax } from '@sodax/sdk';
|
|
2
2
|
export interface SodaxContextType {
|
|
3
3
|
sodax: Sodax;
|
|
4
4
|
testnet: boolean;
|
|
5
|
+
hubProvider: EvmHubProvider | undefined;
|
|
5
6
|
}
|
|
6
7
|
export declare const SodaxContext: import("react").Context<SodaxContextType | null>;
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,cAAc,GAAG,SAAS,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,kDAA+C,CAAC"}
|
package/dist/hooks/mm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { XToken } from '@sodax/types';
|
|
2
|
+
import type { MoneyMarketAction } from '@sodax/sdk';
|
|
3
|
+
export declare function useAllowance(token: XToken, amount: string, action: MoneyMarketAction): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
4
|
+
//# sourceMappingURL=useAllowance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAllowance.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useAllowance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAC;AAIzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,kEAyBpF"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { XToken } from '@sodax/types';
|
|
2
|
+
import type { MoneyMarketAction } from '@sodax/sdk';
|
|
2
3
|
interface UseApproveReturn {
|
|
3
|
-
approve: (amount
|
|
4
|
+
approve: ({ amount, action }: {
|
|
5
|
+
amount: string;
|
|
6
|
+
action: MoneyMarketAction;
|
|
7
|
+
}) => Promise<boolean>;
|
|
4
8
|
isLoading: boolean;
|
|
5
9
|
error: Error | null;
|
|
6
10
|
resetError: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApprove.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useApprove.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,iBAAiB,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjG,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAwC1D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { XToken } from '@sodax/types';
|
|
2
2
|
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import type { SpokeProvider } from '@sodax/sdk';
|
|
3
4
|
interface BorrowResponse {
|
|
4
5
|
ok: true;
|
|
5
6
|
value: [`0x${string}`, `0x${string}`];
|
|
@@ -11,6 +12,14 @@ interface BorrowResponse {
|
|
|
11
12
|
* handling the entire borrow process including transaction creation, submission,
|
|
12
13
|
* and cross-chain communication.
|
|
13
14
|
*
|
|
15
|
+
* @param {XToken} spokeToken - The token to borrow from the spoke chain. Must be an XToken with valid address and chain information.
|
|
16
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the borrow transaction. Must be a valid SpokeProvider instance.
|
|
17
|
+
*
|
|
18
|
+
* @returns {UseMutationResult<BorrowResponse, Error, string>} A mutation result object with the following properties:
|
|
19
|
+
* - mutateAsync: Function to execute the borrow transaction
|
|
20
|
+
* - isPending: Boolean indicating if a transaction is in progress
|
|
21
|
+
* - error: Error object if the last transaction failed, null otherwise
|
|
22
|
+
*
|
|
14
23
|
* @example
|
|
15
24
|
* ```typescript
|
|
16
25
|
* const { mutateAsync: borrow, isPending, error } = useBorrow(spokeToken);
|
|
@@ -21,6 +30,6 @@ interface BorrowResponse {
|
|
|
21
30
|
* - spokeProvider is not available
|
|
22
31
|
* - Transaction execution fails
|
|
23
32
|
*/
|
|
24
|
-
export declare function useBorrow(spokeToken: XToken): UseMutationResult<BorrowResponse, Error, string>;
|
|
33
|
+
export declare function useBorrow(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<BorrowResponse, Error, string>;
|
|
25
34
|
export {};
|
|
26
35
|
//# sourceMappingURL=useBorrow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBorrow.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useBorrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useBorrow.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useBorrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,UAAU,cAAc;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BlD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SpokeProvider } from '@sodax/sdk';
|
|
1
2
|
import type { XToken } from '@sodax/types';
|
|
2
3
|
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
4
|
interface RepayResponse {
|
|
@@ -11,6 +12,14 @@ interface RepayResponse {
|
|
|
11
12
|
* handling the entire repayment process including transaction creation, submission,
|
|
12
13
|
* and cross-chain communication.
|
|
13
14
|
*
|
|
15
|
+
* @param {XToken} spokeToken - The token to repay on the spoke chain. Must be an XToken with valid address and chain information.
|
|
16
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the repay transaction. Must be a valid SpokeProvider instance.
|
|
17
|
+
*
|
|
18
|
+
* @returns {UseMutationResult<RepayResponse, Error, string>} A mutation result object with the following properties:
|
|
19
|
+
* - mutateAsync: Function to execute the repay transaction
|
|
20
|
+
* - isPending: Boolean indicating if a transaction is in progress
|
|
21
|
+
* - error: Error object if the last transaction failed, null otherwise
|
|
22
|
+
*
|
|
14
23
|
* @example
|
|
15
24
|
* ```typescript
|
|
16
25
|
* const { mutateAsync: repay, isPending, error } = useRepay(spokeToken);
|
|
@@ -21,6 +30,6 @@ interface RepayResponse {
|
|
|
21
30
|
* - spokeProvider is not available
|
|
22
31
|
* - Transaction execution fails
|
|
23
32
|
*/
|
|
24
|
-
export declare function useRepay(spokeToken: XToken): UseMutationResult<RepayResponse, Error, string>;
|
|
33
|
+
export declare function useRepay(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<RepayResponse, Error, string>;
|
|
25
34
|
export {};
|
|
26
35
|
//# sourceMappingURL=useRepay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRepay.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useRepay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRepay.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useRepay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI5E,UAAU,aAAa;IACrB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BjD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SpokeProvider } from '@sodax/sdk';
|
|
1
2
|
import type { XToken } from '@sodax/types';
|
|
2
3
|
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
4
|
interface SupplyResponse {
|
|
@@ -12,6 +13,7 @@ interface SupplyResponse {
|
|
|
12
13
|
* and cross-chain communication.
|
|
13
14
|
*
|
|
14
15
|
* @param {XToken} spokeToken - The token to supply on the spoke chain. Must be an XToken with valid address and chain information.
|
|
16
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the supply transaction. Must be a valid SpokeProvider instance.
|
|
15
17
|
*
|
|
16
18
|
* @returns {UseMutationResult<SupplyResponse, Error, string>} A mutation result object with the following properties:
|
|
17
19
|
* - mutateAsync: Function to execute the supply transaction
|
|
@@ -27,6 +29,6 @@ interface SupplyResponse {
|
|
|
27
29
|
* @throws {Error} When:
|
|
28
30
|
* - spokeProvider is not available
|
|
29
31
|
*/
|
|
30
|
-
export declare function useSupply(spokeToken: XToken): UseMutationResult<SupplyResponse, Error, string>;
|
|
32
|
+
export declare function useSupply(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<SupplyResponse, Error, string>;
|
|
31
33
|
export {};
|
|
32
34
|
//# sourceMappingURL=useSupply.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSupply.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useSupply.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSupply.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useSupply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI5E,UAAU,cAAc;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BlD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChainId } from '@sodax/types';
|
|
2
|
-
export declare function useUserReservesData(spokeChainId: ChainId): {
|
|
2
|
+
export declare function useUserReservesData(spokeChainId: ChainId, address: string | undefined): {
|
|
3
3
|
token: import("@sodax/sdk").XToken | undefined;
|
|
4
4
|
underlyingAsset: string;
|
|
5
5
|
scaledATokenBalance: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;;;;;;gBAsCrF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SpokeProvider } from '@sodax/sdk';
|
|
1
2
|
import type { XToken } from '@sodax/types';
|
|
2
3
|
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
4
|
interface WithdrawResponse {
|
|
@@ -11,6 +12,12 @@ interface WithdrawResponse {
|
|
|
11
12
|
* handling the entire withdrawal process including transaction creation, submission,
|
|
12
13
|
* and cross-chain communication.
|
|
13
14
|
*
|
|
15
|
+
* @param {XToken} spokeToken - The token to withdraw from the spoke chain. Must be an XToken with valid address and chain information.
|
|
16
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the withdraw transaction. Must be a valid SpokeProvider instance.
|
|
17
|
+
*
|
|
18
|
+
* @returns {UseMutationResult<WithdrawResponse, Error, string>} A mutation result object with the following properties:
|
|
19
|
+
* - mutateAsync: Function to execute the withdraw transaction
|
|
20
|
+
* - isPending: Boolean indicating if a transaction is in progress
|
|
14
21
|
* @example
|
|
15
22
|
* ```typescript
|
|
16
23
|
* const { mutateAsync: withdraw, isPending, error } = useWithdraw(spokeToken);
|
|
@@ -21,6 +28,6 @@ interface WithdrawResponse {
|
|
|
21
28
|
* - spokeProvider is not available
|
|
22
29
|
* - Transaction execution fails
|
|
23
30
|
*/
|
|
24
|
-
export declare function useWithdraw(spokeToken: XToken): UseMutationResult<WithdrawResponse, Error, string>;
|
|
31
|
+
export declare function useWithdraw(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<WithdrawResponse, Error, string>;
|
|
25
32
|
export {};
|
|
26
33
|
//# sourceMappingURL=useWithdraw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWithdraw.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useWithdraw.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useWithdraw.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useWithdraw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI5E,UAAU,gBAAgB;IACxB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,CAAC,CA2BpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHubProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useHubProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"useHubProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useHubProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,wBAAgB,cAAc,IAAI,cAAc,GAAG,SAAS,CAI3D"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type SpokeProvider, type IWalletProvider } from '@sodax/sdk';
|
|
2
2
|
import type { SpokeChainId } from '@sodax/types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Hook to get the appropriate spoke provider based on the chain type.
|
|
5
|
+
* Supports EVM, SUI, ICON and INJECTIVE chains.
|
|
6
|
+
*
|
|
7
|
+
* @param {SpokeChainId | undefined} spokeChainId - The spoke chain ID to get the provider for
|
|
8
|
+
* @param {IWalletProvider | undefined} walletProvider - The wallet provider to use
|
|
9
|
+
* @returns {SpokeProvider | undefined} The appropriate spoke provider instance for the given chain ID, or undefined if invalid/unsupported
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Using a specific SpokeChainId and wallet provider
|
|
14
|
+
* const spokeProvider = useSpokeProvider(spokeChainId, walletProvider);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function useSpokeProvider(spokeChainId: SpokeChainId | undefined, walletProvider?: IWalletProvider | undefined): SpokeProvider | undefined;
|
|
4
18
|
//# sourceMappingURL=useSpokeProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSpokeProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useSpokeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useSpokeProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useSpokeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAIV,YAAY,EAEb,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,cAAc,CAAC,EAAE,eAAe,GAAG,SAAS,GAC3C,aAAa,GAAG,SAAS,CAsC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateIntentParams,
|
|
1
|
+
import type { CreateIntentParams, IntentExecutionResponse, Result, IntentSubmitErrorCode, Intent, PacketData, IntentSubmitError, SpokeProvider } from '@sodax/sdk';
|
|
2
2
|
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
3
|
type CreateIntentResult = Result<[
|
|
4
4
|
IntentExecutionResponse,
|
|
@@ -9,12 +9,12 @@ type CreateIntentResult = Result<[
|
|
|
9
9
|
* Hook for creating and submitting an intent order for cross-chain swaps.
|
|
10
10
|
* Uses React Query's useMutation for better state management and caching.
|
|
11
11
|
*
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the swap
|
|
13
13
|
* @returns {UseMutationResult} Mutation result object containing mutation function and state
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```typescript
|
|
17
|
-
* const { mutateAsync: createIntent, isPending } = useCreateIntentOrder(
|
|
17
|
+
* const { mutateAsync: createIntent, isPending } = useCreateIntentOrder(spokeProvider);
|
|
18
18
|
*
|
|
19
19
|
* const handleSwap = async () => {
|
|
20
20
|
* const result = await createIntent({
|
|
@@ -28,6 +28,6 @@ type CreateIntentResult = Result<[
|
|
|
28
28
|
* };
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export declare function useCreateIntentOrder(
|
|
31
|
+
export declare function useCreateIntentOrder(spokeProvider: SpokeProvider | undefined): UseMutationResult<CreateIntentResult, Error, CreateIntentParams>;
|
|
32
32
|
export {};
|
|
33
33
|
//# sourceMappingURL=useCreateIntentOrder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateIntentOrder.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useCreateIntentOrder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"useCreateIntentOrder.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useCreateIntentOrder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,EACN,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,KAAK,kBAAkB,GAAG,MAAM,CAC9B;IAAC,uBAAuB;IAAE,MAAM;IAAE,UAAU;CAAC,EAC7C,iBAAiB,CAAC,qBAAqB,CAAC,CACzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAWlE"}
|