Skip to content

Commit

Permalink
Merge pull request #61 from clober-dex/feat/get-addresses
Browse files Browse the repository at this point in the history
feat: add `getContractAddresses` function
  • Loading branch information
graykode authored May 20, 2024
2 parents 3771146 + 439c858 commit 2b9286a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clober/v2-sdk",
"version": "0.0.43",
"version": "0.0.44",
"description": "🛠 An SDK for building applications on top of Clober V2",
"files": [
"dist"
Expand Down
17 changes: 17 additions & 0 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ import { type OpenOrder } from './model/open-order'
import { decorator } from './utils/decorator'
import { fetchChartLogs, fetchLatestChartLog } from './apis/chart-logs'
import { getMarketId } from './utils/market'
import { CONTRACT_ADDRESSES } from './constants/addresses'

/**
* Get contract addresses by chain id
* @param chainId - chain id from {@link CHAIN_IDS}
* @returns Contract addresses
*
* @example
* import { getContractAddresses } from '@clober/v2-sdk'
*
* const addresses = await getContractAddresses({
* chainId: 421614,
* })
*/
export const getContractAddresses = ({ chainId }: { chainId: CHAIN_IDS }) => {
return CONTRACT_ADDRESSES[chainId]
}

/**
* Get market information by chain id and token addresses
Expand Down

0 comments on commit 2b9286a

Please sign in to comment.