-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Dynamic swap fee display * Upgrade to Typescript 4.5 for Awaited * Upgraded lock file * Compact liquidity total * swap fee fixes for default lpFee * 0 fix * SwapInfo typing fixes * Default params Co-authored-by: Bao <[email protected]>
- Loading branch information
1 parent
a164dca
commit 5c667cd
Showing
6 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,35 @@ | ||
import { getSwapInfo } from '../services/swap' | ||
|
||
export async function querySwapInfo({ context: { client }, swap_address }) { | ||
const safeNum = (attr: string | undefined): number | undefined => | ||
attr != undefined ? Number(attr) : undefined | ||
|
||
export type SwapInfoResponse = { | ||
swap_address: string | ||
lp_token_supply: number | ||
lp_token_address: string | ||
token1_denom: string | ||
token1_reserve: number | ||
token2_denom: string | ||
token2_reserve: number | ||
owner?: string | ||
lp_fee_percent?: number | ||
protocol_fee_percent?: number | ||
protocol_fee_recipient?: string | ||
} | ||
|
||
export async function querySwapInfo({ | ||
context: { client }, | ||
swap_address, | ||
}): Promise<SwapInfoResponse> { | ||
const swap = await getSwapInfo(swap_address, client) | ||
|
||
return { | ||
...swap, | ||
swap_address, | ||
token1_reserve: Number(swap.token1_reserve), | ||
token2_reserve: Number(swap.token2_reserve), | ||
lp_token_supply: Number(swap.lp_token_supply), | ||
protocol_fee_percent: safeNum(swap.protocol_fee_percent), | ||
lp_fee_percent: safeNum(swap.lp_fee_percent), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5631,10 +5631,10 @@ type@^2.5.0: | |
resolved "https://registry.yarnpkg.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" | ||
integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== | ||
|
||
typescript@4.3.5: | ||
version "4.3.5" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" | ||
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== | ||
[email protected]: | ||
version "4.5.5" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" | ||
integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== | ||
|
||
unbox-primitive@^1.0.2: | ||
version "1.0.2" | ||
|