Skip to content

Commit

Permalink
Merge pull request #23 from alephium/update-sdk-to-0.17.1
Browse files Browse the repository at this point in the history
Update sdk to 0.17.1
  • Loading branch information
polarker authored Aug 10, 2023
2 parents 10a7e5e + 02c4fbf commit 9594988
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 117 deletions.
134 changes: 67 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
]
},
"dependencies": {
"@alephium/cli": "^0.16.1",
"@alephium/web3": "^0.16.1",
"@alephium/web3-test": "^0.16.1",
"@alephium/web3-wallet": "^0.16.1",
"@alephium/web3-react": "^0.16.1",
"@alephium/cli": "^0.17.1",
"@alephium/web3": "^0.17.1",
"@alephium/web3-test": "^0.17.1",
"@alephium/web3-wallet": "^0.17.1",
"@alephium/web3-react": "^0.17.1",
"@alephium/token-list": "0.0.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
Expand Down
7 changes: 4 additions & 3 deletions src/components/AddLiquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ButtonWithLoader from "./ButtonWithLoader";
import TokenSelectDialog from "./TokenSelectDialog";
import NumberTextField from "./NumberTextField";
import { addLiquidity, bigIntToString, PairTokenDecimals, minimalAmount, AddLiquidityDetails, tryGetBalance } from "../utils/dex";
import { useAlephiumWallet, useAvailableBalances } from "../hooks/useAlephiumWallet";
import { useAvailableBalances } from "../hooks/useAvailableBalance";
import { useSlippageTolerance } from "../hooks/useSlippageTolerance";
import { useDeadline } from "../hooks/useDeadline";
import { DEFAULT_SLIPPAGE } from "../state/settings/reducer";
Expand All @@ -17,6 +17,7 @@ import { commonStyles } from "./style";
import { useHistory } from "react-router-dom";
import { TransactionSubmitted, WaitingForTxSubmission } from "./Transactions";
import { DetailItem } from "./DetailsItem";
import { useWallet } from "@alephium/web3-react";

function AddLiquidity() {
const classes = commonStyles();
Expand All @@ -26,7 +27,7 @@ function AddLiquidity() {
const [deadline,] = useDeadline()
const dispatch = useDispatch()
const [error, setError] = useState<string | undefined>(undefined)
const wallet = useAlephiumWallet()
const wallet = useWallet()
const { balance, updateBalanceForTx } = useAvailableBalances()
const history = useHistory()

Expand Down Expand Up @@ -134,7 +135,7 @@ function AddLiquidity() {
balance,
wallet.signer,
wallet.signer.explorerProvider,
wallet.address,
wallet.account.address,
tokenPairState,
tokenAInfo,
tokenBInfo,
Expand Down
9 changes: 5 additions & 4 deletions src/components/AddPool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import { TokenInfo } from "@alephium/token-list"
import { useCallback, useEffect, useMemo, useState } from "react";
import ButtonWithLoader from "./ButtonWithLoader";
import { tokenPairExist, createTokenPair } from "../utils/dex";
import { useAlephiumWallet, useAvailableBalances } from "../hooks/useAlephiumWallet";
import { useAvailableBalances } from "../hooks/useAvailableBalance";
import { commonStyles } from "./style";
import TokenSelectDialog from "./TokenSelectDialog";
import { useHistory } from "react-router-dom";
import { TransactionSubmitted, WaitingForTxSubmission } from "./Transactions";
import { useWallet } from "@alephium/web3-react";

function AddPool() {
const commonClasses = commonStyles();
Expand All @@ -17,13 +18,13 @@ function AddPool() {
const [txId, setTxId] = useState<string | undefined>(undefined)
const [addingPool, setAddingPool] = useState<boolean>(false)
const [error, setError] = useState<string | undefined>(undefined)
const wallet = useAlephiumWallet()
const wallet = useWallet()
const { balance, updateBalanceForTx } = useAvailableBalances()
const history = useHistory()

useEffect(() => {
async function checkContractExist() {
if (tokenAInfo !== undefined && tokenBInfo !== undefined && wallet !== undefined) {
if (tokenAInfo !== undefined && tokenBInfo !== undefined && wallet !== undefined && wallet.nodeProvider !== undefined) {
try {
const exist = await tokenPairExist(wallet.nodeProvider, tokenAInfo.id, tokenBInfo.id)
if (exist) setError(`token pair already exist`)
Expand Down Expand Up @@ -82,7 +83,7 @@ function AddPool() {
const result = await createTokenPair(
wallet.signer,
wallet.signer.explorerProvider,
wallet.address,
wallet.account.address,
tokenAInfo.id,
tokenBInfo.id
)
Expand Down
5 changes: 3 additions & 2 deletions src/components/Pools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import { commonStyles } from "./style";
import { TokenInfo } from "@alephium/token-list";
import { useTokenPairState } from "../state/useTokenPairState";
import TokenSelectDialog from "./TokenSelectDialog";
import { useAlephiumWallet, useAvailableBalances } from "../hooks/useAlephiumWallet";
import { useAvailableBalances } from "../hooks/useAvailableBalance";
import { DetailItem } from "./DetailsItem";
import BigNumber from "bignumber.js";
import { useWallet } from "@alephium/web3-react";

function Pool() {
const commonClasses = commonStyles()
const [tokenAInfo, setTokenAInfo] = useState<TokenInfo | undefined>(undefined)
const [tokenBInfo, setTokenBInfo] = useState<TokenInfo | undefined>(undefined)
const { tokenPairState, getTokenPairStateError } = useTokenPairState(tokenAInfo, tokenBInfo)
const wallet = useAlephiumWallet()
const wallet = useWallet()
const { balance } = useAvailableBalances()

const handleTokenAChange = useCallback((tokenInfo) => {
Expand Down
7 changes: 4 additions & 3 deletions src/components/RemoveLiquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
bigIntToString
} from "../utils/dex";
import { formatUnits } from "ethers/lib/utils";
import { useAlephiumWallet, useAvailableBalances } from "../hooks/useAlephiumWallet";
import { useAvailableBalances } from "../hooks/useAvailableBalance";
import { useSlippageTolerance } from "../hooks/useSlippageTolerance";
import { useDeadline } from "../hooks/useDeadline";
import { DEFAULT_SLIPPAGE } from "../state/settings/reducer";
Expand All @@ -23,6 +23,7 @@ import { useTokenPairState } from "../state/useTokenPairState";
import { TransactionSubmitted, WaitingForTxSubmission } from "./Transactions";
import { DetailItem } from "./DetailsItem";
import { useHistory } from "react-router-dom";
import { useWallet } from "@alephium/web3-react";

function RemoveLiquidity() {
const classes = commonStyles();
Expand All @@ -37,7 +38,7 @@ function RemoveLiquidity() {
const [slippage,] = useSlippageTolerance()
const [deadline,] = useDeadline()
const [error, setError] = useState<string | undefined>(undefined)
const wallet = useAlephiumWallet()
const wallet = useWallet()
const { balance: availableBalance, updateBalanceForTx } = useAvailableBalances()
const history = useHistory()

Expand Down Expand Up @@ -163,7 +164,7 @@ function RemoveLiquidity() {
const result = await removeLiquidity(
wallet.signer,
wallet.signer.explorerProvider,
wallet.address,
wallet.account.address,
tokenPairState,
amount,
removeLiquidityDetails.amount0,
Expand Down
Loading

0 comments on commit 9594988

Please sign in to comment.