@sodax/dapp-kit 1.0.1-beta-rc1 → 1.0.1-beta-rc3
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/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/hooks/mm/useBorrow.ts +4 -2
- package/src/hooks/mm/useRepay.ts +4 -2
- package/src/hooks/mm/useSupply.ts +4 -2
- package/src/hooks/mm/useWithdraw.ts +4 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sodax/dapp-kit",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.0.1-beta-
|
|
4
|
+
"version": "1.0.1-beta-rc3",
|
|
5
5
|
"description": "dapp-kit of New World",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"viem": "2.29.2",
|
|
19
|
-
"@sodax/sdk": "1.0.1-beta-
|
|
20
|
-
"@sodax/types": "1.0.1-beta-
|
|
19
|
+
"@sodax/sdk": "1.0.1-beta-rc3",
|
|
20
|
+
"@sodax/types": "1.0.1-beta-rc3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "18.3.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { XToken } from '@sodax/types';
|
|
1
|
+
import type { SpokeChainId, XToken } from '@sodax/types';
|
|
2
2
|
import { useMutation, type UseMutationResult } from '@tanstack/react-query';
|
|
3
3
|
import { parseUnits } from 'viem';
|
|
4
4
|
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
@@ -40,7 +40,7 @@ export function useBorrow(
|
|
|
40
40
|
const { sodax } = useSodaxContext();
|
|
41
41
|
|
|
42
42
|
return useMutation<BorrowResponse, Error, string>({
|
|
43
|
-
mutationFn: async (amount: string) => {
|
|
43
|
+
mutationFn: async (amount: string, toChainId?: SpokeChainId, toAddress?: string) => {
|
|
44
44
|
if (!spokeProvider) {
|
|
45
45
|
throw new Error('spokeProvider is not found');
|
|
46
46
|
}
|
|
@@ -50,6 +50,8 @@ export function useBorrow(
|
|
|
50
50
|
token: spokeToken.address,
|
|
51
51
|
amount: parseUnits(amount, 18),
|
|
52
52
|
action: 'borrow',
|
|
53
|
+
toChainId: toChainId,
|
|
54
|
+
toAddress: toAddress,
|
|
53
55
|
},
|
|
54
56
|
spokeProvider,
|
|
55
57
|
);
|
package/src/hooks/mm/useRepay.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpokeProvider } from '@sodax/sdk';
|
|
2
|
-
import type { XToken } from '@sodax/types';
|
|
2
|
+
import type { SpokeChainId, XToken } from '@sodax/types';
|
|
3
3
|
import { useMutation, type UseMutationResult } from '@tanstack/react-query';
|
|
4
4
|
import { parseUnits } from 'viem';
|
|
5
5
|
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
@@ -41,7 +41,7 @@ export function useRepay(
|
|
|
41
41
|
const { sodax } = useSodaxContext();
|
|
42
42
|
|
|
43
43
|
return useMutation<RepayResponse, Error, string>({
|
|
44
|
-
mutationFn: async (amount: string) => {
|
|
44
|
+
mutationFn: async (amount: string, toChainId?: SpokeChainId, toAddress?: string) => {
|
|
45
45
|
if (!spokeProvider) {
|
|
46
46
|
throw new Error('spokeProvider is not found');
|
|
47
47
|
}
|
|
@@ -51,6 +51,8 @@ export function useRepay(
|
|
|
51
51
|
token: spokeToken.address,
|
|
52
52
|
amount: parseUnits(amount, spokeToken.decimals),
|
|
53
53
|
action: 'repay',
|
|
54
|
+
toChainId: toChainId,
|
|
55
|
+
toAddress: toAddress,
|
|
54
56
|
},
|
|
55
57
|
spokeProvider,
|
|
56
58
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpokeProvider } from '@sodax/sdk';
|
|
2
|
-
import type { XToken } from '@sodax/types';
|
|
2
|
+
import type { SpokeChainId, XToken } from '@sodax/types';
|
|
3
3
|
import { useMutation, type UseMutationResult } from '@tanstack/react-query';
|
|
4
4
|
import { parseUnits } from 'viem';
|
|
5
5
|
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
@@ -40,7 +40,7 @@ export function useSupply(
|
|
|
40
40
|
const { sodax } = useSodaxContext();
|
|
41
41
|
|
|
42
42
|
return useMutation<SupplyResponse, Error, string>({
|
|
43
|
-
mutationFn: async (amount: string) => {
|
|
43
|
+
mutationFn: async (amount: string, toChainId?: SpokeChainId, toAddress?: string) => {
|
|
44
44
|
if (!spokeProvider) {
|
|
45
45
|
throw new Error('spokeProvider is not found');
|
|
46
46
|
}
|
|
@@ -50,6 +50,8 @@ export function useSupply(
|
|
|
50
50
|
token: spokeToken.address,
|
|
51
51
|
amount: parseUnits(amount, spokeToken.decimals),
|
|
52
52
|
action: 'supply',
|
|
53
|
+
toChainId: toChainId,
|
|
54
|
+
toAddress: toAddress,
|
|
53
55
|
},
|
|
54
56
|
spokeProvider,
|
|
55
57
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpokeProvider } from '@sodax/sdk';
|
|
2
|
-
import type { XToken } from '@sodax/types';
|
|
2
|
+
import type { SpokeChainId, XToken } from '@sodax/types';
|
|
3
3
|
import { useMutation, type UseMutationResult } from '@tanstack/react-query';
|
|
4
4
|
import { parseUnits } from 'viem';
|
|
5
5
|
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
@@ -39,7 +39,7 @@ export function useWithdraw(
|
|
|
39
39
|
const { sodax } = useSodaxContext();
|
|
40
40
|
|
|
41
41
|
return useMutation<WithdrawResponse, Error, string>({
|
|
42
|
-
mutationFn: async (amount: string) => {
|
|
42
|
+
mutationFn: async (amount: string, toChainId?: SpokeChainId, toAddress?: string) => {
|
|
43
43
|
if (!spokeProvider) {
|
|
44
44
|
throw new Error('spokeProvider is not found');
|
|
45
45
|
}
|
|
@@ -50,6 +50,8 @@ export function useWithdraw(
|
|
|
50
50
|
// vault token on hub chain decimals is 18
|
|
51
51
|
amount: parseUnits(amount, 18),
|
|
52
52
|
action: 'withdraw',
|
|
53
|
+
toChainId: toChainId,
|
|
54
|
+
toAddress: toAddress,
|
|
53
55
|
},
|
|
54
56
|
spokeProvider,
|
|
55
57
|
);
|