1- import { Button , message } from "antd" ;
2- import { AddLiqReq , DeployPoolReq , swapApi } from "../utils/swapApi" ;
3- import { useUnisat } from "../provider/UniSatProvider" ;
4- import { handleError } from "../utils/utils" ;
1+ // import {Button, message} from "antd";
2+ // import {AddLiqReq, DeployPoolReq, swapApi} from "../utils/swapApi";
3+ // import {useUnisat} from "../provider/UniSatProvider";
4+ // import {handleError} from "../utils/utils";
5+ //
6+ // export function CreatePools() {
7+ //
8+ // const {address, signMessage} = useUnisat();
9+ //
10+ // async function create() {
11+ // try {
12+ //
13+ // const ts = Math.floor(Date.now() / 1000);
14+ // const params: DeployPoolReq = {
15+ // address,
16+ // tick0: "sats",
17+ // tick1: "ordi",
18+ // ts,
19+ // }
20+ //
21+ // const {signMsg} = await swapApi.preDeployPool(params)
22+ //
23+ // params.sig = await signMessage(signMsg)
24+ //
25+ // await swapApi.deployPool(params)
26+ //
27+ // message.success("Create pool success")
28+ // } catch (e) {
29+ // handleError(e)
30+ // }
31+ // }
32+ //
33+ // async function addLiq() {
34+ // try {
35+ // const ts = Math.floor(Date.now() / 1000);
36+ // const params: AddLiqReq = {
37+ // address,
38+ // tick0: "sats",
39+ // tick1: "ordi",
40+ // amount0: "10",
41+ // amount1: "100",
42+ // slippage: "0.005",
43+ // lp: "31.622776601683793",
44+ // ts,
45+ // }
46+ //
47+ // const {signMsg} = await swapApi.preAddLiquidity(params)
48+ //
49+ // params.sig = await signMessage(signMsg)
50+ //
51+ // await swapApi.addLiquidity(params)
52+ //
53+ // message.success("Add liquidity success")
54+ // } catch (e) {
55+ // handleError(e)
56+ // }
57+ // }
58+ //
59+ // return <>
60+ // <Button onClick={create}>
61+ // Create Pools (sats/ordi)
62+ // </Button>
63+ // <Button onClick={addLiq}>
64+ // Add Liquidity (sats/ordi)
65+ // </Button>
66+ // </>
67+ // }
568
669export function CreatePools ( ) {
770
8- const { address, signMessage} = useUnisat ( ) ;
9-
10- async function create ( ) {
11- try {
12-
13- const ts = Math . floor ( Date . now ( ) / 1000 ) ;
14- const params : DeployPoolReq = {
15- address,
16- tick0 : "sats" ,
17- tick1 : "ordi" ,
18- ts,
19- }
20-
21- const { signMsg} = await swapApi . preDeployPool ( params )
22-
23- params . sig = await signMessage ( signMsg )
24-
25- await swapApi . deployPool ( params )
26-
27- message . success ( "Create pool success" )
28- } catch ( e ) {
29- handleError ( e )
30- }
31- }
32-
33- async function addLiq ( ) {
34- try {
35- const ts = Math . floor ( Date . now ( ) / 1000 ) ;
36- const params : AddLiqReq = {
37- address,
38- tick0 : "sats" ,
39- tick1 : "ordi" ,
40- amount0 : "10" ,
41- amount1 : "100" ,
42- slippage : "0.005" ,
43- lp : "31.622776601683793" ,
44- ts,
45- }
46-
47- const { signMsg} = await swapApi . preAddLiquidity ( params )
48-
49- params . sig = await signMessage ( signMsg )
50-
51- await swapApi . addLiquidity ( params )
52-
53- message . success ( "Add liquidity success" )
54- } catch ( e ) {
55- handleError ( e )
56- }
57- }
58-
59- return < >
60- < Button onClick = { create } >
61- Create Pools (sats/ordi)
62- </ Button >
63- < Button onClick = { addLiq } >
64- Add Liquidity (sats/ordi)
65- </ Button >
66- </ >
6771}
0 commit comments