@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.
@@ -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
- export declare const routesExample: {
6
- data: {
7
- cross_chain_swap_zetachain_routes: {
8
- routeId: string;
9
- fromChainId: number;
10
- fromTokenAddress: string;
11
- fromAmount: string;
12
- fromAmountWithOutDecimals: string;
13
- fromAmountUSD: string;
14
- toChainId: number;
15
- toTokenAddress: string;
16
- toAmount: string;
17
- toAmountWithOutDecimals: string;
18
- toAmountUSD: string;
19
- fromAddress: string;
20
- toAddress: string;
21
- slippage: number;
22
- approveTarget: string;
23
- fees: {
24
- type: string;
25
- chainId: number;
26
- token: string;
27
- amount: string;
28
- AmountWithOutDecimals: string;
29
- amountUSD: string;
30
- }[];
31
- omniPlan: ({
32
- hash: string;
33
- type: string;
34
- inChainType: string;
35
- inChainId: number;
36
- inToken: string;
37
- inAmount: string;
38
- inAmountWithOutDecimals: number;
39
- outChainType: string;
40
- outChainId: number;
41
- outToken: string;
42
- outAmount: string;
43
- outAmountWithOutDecimals: number;
44
- feeChainType: string;
45
- feeChainId: number;
46
- feeToken: string;
47
- feeAmount: string;
48
- feeRateBps: number;
49
- swapSteps?: undefined;
50
- withdrawGasCostZrc20?: undefined;
51
- withdrawGas?: undefined;
52
- } | {
53
- hash: string;
54
- type: string;
55
- inChainType: string;
56
- inChainId: number;
57
- inToken: string;
58
- inAmount: string;
59
- inAmountWithOutDecimals: number;
60
- outChainType: string;
61
- outChainId: number;
62
- outToken: string;
63
- outAmount: string;
64
- outAmountWithOutDecimals: number;
65
- feeChainType: string;
66
- feeChainId: number;
67
- feeToken: string;
68
- feeAmount: string;
69
- feeRateBps: number;
70
- swapSteps: {
71
- ammKey: string;
72
- label: string;
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: any;
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, routesExample } from './useFetchRoutePriceBridge';
2
+ import { BridgeStep, CrossChainSwapZetachainRoute } from './useFetchRoutePriceBridge';
3
3
  export declare function generateBridgeStep({ omniPlan, tokenList, }: {
4
- omniPlan: (typeof routesExample)['data']['cross_chain_swap_zetachain_routes']['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,4 @@
1
+ import { Transaction, VersionedTransaction } from '@solana/web3.js';
2
+ export declare function constructSolanaTransaction({ data }: {
3
+ data: string;
4
+ }): VersionedTransaction | Transaction;
@@ -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.23",
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
- "@solana/web3.js": "1.98.2",
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
  },