@dodoex/widgets 3.0.2-zetachain.23 → 3.0.2-zetachain.25
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/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/{helper-CqaIE4xv.cjs → helper-h-U1v1Cd.cjs} +1 -1
- package/dist/{helper-DqBPoP8x.js → helper-nBm2Iobe.js} +1 -1
- package/dist/{index-CvOKKE-A.cjs → index-BRbjxFQm.cjs} +3 -3
- package/dist/index-CK9l9sYe.js +40 -0
- package/dist/index-C__sVv0Y.cjs +40 -0
- package/dist/{index-7faklOrt.js → index-DPbaPgJn.js} +2 -2
- package/dist/{index-1guHW9xj.cjs → index-DhANJSRi.cjs} +2 -2
- package/dist/{index-DTEiQR81.js → index-Qlewc1eS.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/types/components/Bridge/CompareRoute.d.ts +4 -0
- package/dist/types/hooks/Bridge/createBridgeOrder.d.ts +2 -1
- package/dist/types/hooks/Bridge/useExecuteBridgeRoute.d.ts +1 -2
- package/dist/types/hooks/Bridge/useFeeList.d.ts +9 -0
- package/dist/types/hooks/Bridge/useFetchRoutePriceBridge.d.ts +72 -124
- package/dist/types/hooks/Bridge/utils.d.ts +2 -2
- package/dist/types/hooks/ConnectWallet/useWalletInfo.d.ts +2 -0
- package/dist/types/utils/btc.d.ts +13 -0
- package/dist/types/utils/solana.d.ts +4 -0
- package/dist/types/utils/zetachain_btc_test.d.ts +5 -0
- package/package.json +5 -3
- package/dist/index-Cbv1N9aF.js +0 -40
- package/dist/index-Cy0L_rwv.cjs +0 -40
- package/dist/types/hooks/Bridge/useFetchRoutePriceBridge.test.d.ts +0 -1
|
@@ -2,128 +2,74 @@ import { Cross_Chain_Swap_Zetachain_RoutesQuery } from '@dodoex/api';
|
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
3
|
import { useWalletInfo } from '../ConnectWallet/useWalletInfo';
|
|
4
4
|
import { TokenInfo } from '../Token';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
percent: number;
|
|
74
|
-
inputToken: string;
|
|
75
|
-
inAmount: string;
|
|
76
|
-
outputToken: string;
|
|
77
|
-
outAmount: string;
|
|
78
|
-
feeToken: string;
|
|
79
|
-
feeAmount: string;
|
|
80
|
-
assembleArgs: {
|
|
81
|
-
baseToken: string;
|
|
82
|
-
quoteToken: string;
|
|
83
|
-
pairAddress: string;
|
|
84
|
-
pairName: string;
|
|
85
|
-
pmmState: {
|
|
86
|
-
i: string;
|
|
87
|
-
k: string;
|
|
88
|
-
b: string;
|
|
89
|
-
q: string;
|
|
90
|
-
b0: string;
|
|
91
|
-
q0: string;
|
|
92
|
-
r: number;
|
|
93
|
-
};
|
|
94
|
-
lpFeeRate: string;
|
|
95
|
-
mtFeeRate: string;
|
|
96
|
-
updatedAt: string;
|
|
97
|
-
};
|
|
98
|
-
}[];
|
|
99
|
-
withdrawGasCostZrc20?: undefined;
|
|
100
|
-
withdrawGas?: undefined;
|
|
101
|
-
} | {
|
|
102
|
-
hash: string;
|
|
103
|
-
type: string;
|
|
104
|
-
inChainType: string;
|
|
105
|
-
inChainId: number;
|
|
106
|
-
inToken: string;
|
|
107
|
-
inAmount: string;
|
|
108
|
-
inAmountWithOutDecimals: number;
|
|
109
|
-
outChainType: string;
|
|
110
|
-
outChainId: number;
|
|
111
|
-
outToken: string;
|
|
112
|
-
outAmount: string;
|
|
113
|
-
outAmountWithOutDecimals: number;
|
|
114
|
-
feeChainType: string;
|
|
115
|
-
feeChainId: number;
|
|
116
|
-
feeToken: string;
|
|
117
|
-
feeAmount: string;
|
|
118
|
-
feeRateBps: number;
|
|
119
|
-
withdrawGasCostZrc20: string;
|
|
120
|
-
withdrawGas: string;
|
|
121
|
-
swapSteps?: undefined;
|
|
122
|
-
})[];
|
|
123
|
-
encodeParams: {
|
|
124
|
-
interfaceParams: string;
|
|
125
|
-
};
|
|
126
|
-
};
|
|
5
|
+
type Fee = {
|
|
6
|
+
/**
|
|
7
|
+
platformFee = zetachain fee
|
|
8
|
+
destinationFee = destination chain Fee
|
|
9
|
+
btcDepositFee = source chain Fee
|
|
10
|
+
11:58
|
|
11
|
+
btcDepositFee 只有btc 链为起始链才有
|
|
12
|
+
*/
|
|
13
|
+
type: 'platformFee' | 'btcDepositFee' | 'destinationFee' | 'protocolFees';
|
|
14
|
+
chainId: number;
|
|
15
|
+
token: string;
|
|
16
|
+
amount: string | number;
|
|
17
|
+
amountWithOutDecimals: string;
|
|
18
|
+
amountUSD: string;
|
|
19
|
+
};
|
|
20
|
+
export type CrossChainSwapZetachainRoute = {
|
|
21
|
+
routeId: string;
|
|
22
|
+
fromChainId: number;
|
|
23
|
+
fromTokenAddress: string;
|
|
24
|
+
fromAmount: string;
|
|
25
|
+
fromAmountWithOutDecimals: string;
|
|
26
|
+
fromAmountUSD: string;
|
|
27
|
+
toChainId: number;
|
|
28
|
+
toTokenAddress: string;
|
|
29
|
+
toAmount: string;
|
|
30
|
+
toAmountWithOutDecimals: string;
|
|
31
|
+
toAmountUSD: string;
|
|
32
|
+
fromAddress: string;
|
|
33
|
+
toAddress: string;
|
|
34
|
+
slippage: number;
|
|
35
|
+
approveTarget: string | null;
|
|
36
|
+
fees: Array<Fee>;
|
|
37
|
+
omniPlan: Array<{
|
|
38
|
+
hash?: string | undefined;
|
|
39
|
+
type: string;
|
|
40
|
+
inChainType: string;
|
|
41
|
+
inChainId: number;
|
|
42
|
+
inToken: string;
|
|
43
|
+
inAmount: string;
|
|
44
|
+
inAmountWithOutDecimals: number;
|
|
45
|
+
outChainType: string;
|
|
46
|
+
outChainId: number;
|
|
47
|
+
outToken: string;
|
|
48
|
+
outAmount: string;
|
|
49
|
+
outAmountWithOutDecimals: number;
|
|
50
|
+
feeChainType: string;
|
|
51
|
+
feeChainId: number;
|
|
52
|
+
feeToken: string;
|
|
53
|
+
feeAmount: string;
|
|
54
|
+
feeRateBps: number;
|
|
55
|
+
btcDepositFee?: number;
|
|
56
|
+
withdrawGasCostZrc20?: string;
|
|
57
|
+
withdrawGas?: string;
|
|
58
|
+
swapSteps?: Array<{
|
|
59
|
+
ammKey: string;
|
|
60
|
+
label: string;
|
|
61
|
+
percent: number;
|
|
62
|
+
inputToken: string;
|
|
63
|
+
inAmount: string;
|
|
64
|
+
outputToken: string;
|
|
65
|
+
outAmount: string;
|
|
66
|
+
feeToken: string;
|
|
67
|
+
feeAmount: string;
|
|
68
|
+
assembleArgs: any;
|
|
69
|
+
}>;
|
|
70
|
+
}>;
|
|
71
|
+
encodeParams: {
|
|
72
|
+
interfaceParams: string;
|
|
127
73
|
};
|
|
128
74
|
};
|
|
129
75
|
export interface BridgeTokenI {
|
|
@@ -200,14 +146,15 @@ export interface BridgeRouteI {
|
|
|
200
146
|
/** in seconds */
|
|
201
147
|
roundedRouteCostTime: number;
|
|
202
148
|
/** approve contract address */
|
|
203
|
-
spenderContractAddress: string;
|
|
149
|
+
spenderContractAddress: string | null;
|
|
204
150
|
/** USD */
|
|
205
151
|
feeUSD: string | null;
|
|
152
|
+
fees: Array<Fee>;
|
|
206
153
|
/** in seconds */
|
|
207
154
|
executionDuration: number | null;
|
|
208
155
|
/** one-click */
|
|
209
156
|
step: BridgeStep;
|
|
210
|
-
encodeParams:
|
|
157
|
+
encodeParams: CrossChainSwapZetachainRoute['encodeParams'];
|
|
211
158
|
productParams: any;
|
|
212
159
|
sourceRoute: Cross_Chain_Swap_Zetachain_RoutesQuery['cross_chain_swap_zetachain_routes'];
|
|
213
160
|
}
|
|
@@ -229,3 +176,4 @@ export declare function useFetchRoutePriceBridge({ fromAccount, toAccount, fromT
|
|
|
229
176
|
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<Cross_Chain_Swap_Zetachain_RoutesQuery, Error>>;
|
|
230
177
|
bridgeRouteList: BridgeRouteI[];
|
|
231
178
|
};
|
|
179
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TokenList } from '../Token/type';
|
|
2
|
-
import { BridgeStep,
|
|
2
|
+
import { BridgeStep, CrossChainSwapZetachainRoute } from './useFetchRoutePriceBridge';
|
|
3
3
|
export declare function generateBridgeStep({ omniPlan, tokenList, }: {
|
|
4
|
-
omniPlan:
|
|
4
|
+
omniPlan: CrossChainSwapZetachainRoute['omniPlan'];
|
|
5
5
|
tokenList: TokenList;
|
|
6
6
|
}): BridgeStep;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChainId } from '@dodoex/api';
|
|
2
|
+
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin';
|
|
2
3
|
import { type Provider } from '@reown/appkit-adapter-solana/react';
|
|
3
4
|
import type { Provider as CoreProvider } from '@reown/appkit/react';
|
|
4
5
|
export declare function useWalletInfo(): {
|
|
@@ -21,6 +22,7 @@ export declare function useWalletInfo(): {
|
|
|
21
22
|
ethersProvider: CoreProvider;
|
|
22
23
|
solanaWalletProvider: Provider;
|
|
23
24
|
solanaConnection: import("@solana/web3.js").Connection | undefined;
|
|
25
|
+
bitcoinWalletProvider: BitcoinConnector;
|
|
24
26
|
getAppKitAccountByChainId: (targetChainId: ChainId | undefined) => {
|
|
25
27
|
appKitAccount: import("@reown/appkit/react").UseAppKitAccountReturn;
|
|
26
28
|
namespace: import("@reown/appkit-common").ChainNamespace;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin';
|
|
2
|
+
export declare function getMempoolUTXO(address: string): Promise<any>;
|
|
3
|
+
export declare function getMempoolTxDetail(txHash: string): Promise<any>;
|
|
4
|
+
export declare function getSignetMempoolUTXO(address: string): Promise<any>;
|
|
5
|
+
export declare function getSignetMempoolTxDetail(txHash: string): Promise<any>;
|
|
6
|
+
export declare function transferSignet({ fromAddress, toAddress, amount, calldata, publicKey, btcWallet, }: {
|
|
7
|
+
fromAddress: string;
|
|
8
|
+
toAddress: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
calldata: string;
|
|
11
|
+
publicKey: string;
|
|
12
|
+
btcWallet: BitcoinConnector;
|
|
13
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const executeRouteZetachainBtc: () => Promise<void>;
|
|
2
|
+
export declare function getMempoolUTXO(address: string): Promise<any>;
|
|
3
|
+
export declare function getMempoolTxDetail(txHash: string): Promise<any>;
|
|
4
|
+
export declare function getSignetMempoolUTXO(address: string): Promise<any>;
|
|
5
|
+
export declare function getSignetMempoolTxDetail(txHash: string): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodoex/widgets",
|
|
3
|
-
"version": "3.0.2-zetachain.
|
|
3
|
+
"version": "3.0.2-zetachain.25",
|
|
4
4
|
"description": "DODO Widgets",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/runtime": "^7.17.0",
|
|
61
|
+
"@bitcoinerlab/secp256k1": "1.2.0",
|
|
61
62
|
"@dodoex/api": "3.0.3-zetachain.9",
|
|
62
63
|
"@dodoex/components": "3.0.3-zetachain.5",
|
|
63
64
|
"@dodoex/contract-request": "^1.3.0",
|
|
@@ -104,10 +105,11 @@
|
|
|
104
105
|
"peerDependencies": {
|
|
105
106
|
"@babel/runtime": ">=7.17.0",
|
|
106
107
|
"@reown/appkit": "^1.7.5",
|
|
107
|
-
"@reown/appkit-utils": "^1.7.5",
|
|
108
108
|
"@reown/appkit-adapter-solana": "^1.7.5",
|
|
109
|
-
"@
|
|
109
|
+
"@reown/appkit-utils": "^1.7.5",
|
|
110
110
|
"@solana/spl-token": "^0.4.13",
|
|
111
|
+
"@solana/web3.js": "1.98.2",
|
|
112
|
+
"bitcoinjs-lib": "6.1.7",
|
|
111
113
|
"react": "^18.0.0",
|
|
112
114
|
"react-dom": "^18.0.0"
|
|
113
115
|
},
|