Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/intergrate dynamic token #356

Merged
merged 144 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
d48e760
pump common beta & oraiswap-v3
vuonghuuhung Nov 4, 2024
873d7f1
fix: update branch in workflow
vuonghuuhung Nov 4, 2024
76e9144
pump common
vuonghuuhung Nov 4, 2024
86919bb
pump common
vuonghuuhung Nov 4, 2024
2dd0206
pump common
vuonghuuhung Nov 4, 2024
9bafbbc
feat: add oraidex json
quangdz1704 Nov 6, 2024
da1f5b3
chore: add test
quangdz1704 Nov 7, 2024
f0fb2f9
init load tokens
haunv3 Nov 7, 2024
2766816
Merge branch 'feat/token_map' into feat/update-common-oraichain-token
quangdz1704 Nov 7, 2024
cfd70fc
feat: add token Config
quangdz1704 Nov 7, 2024
3b151ea
feat: add token Config
quangdz1704 Nov 7, 2024
137187a
fix: update common
quangdz1704 Nov 7, 2024
8217f19
fix: update common
quangdz1704 Nov 7, 2024
29087c0
fix: update common
quangdz1704 Nov 7, 2024
791c640
Merge branch 'main' of https://github.com/oraichain/oraidex-sdk into …
quangdz1704 Nov 7, 2024
91dcd60
fix: test
quangdz1704 Nov 7, 2024
5a27344
fix: update @oraichain/common to version 1.1.3 and clean up imports
trungbach Nov 7, 2024
6f4d230
fix: update TypeScript module setting from es2020 to esnext in tsconf…
trungbach Nov 7, 2024
58bd885
fix: update dependencies and adjust TypeScript configurations
trungbach Nov 7, 2024
78823fc
fix: build token
quangdz1704 Nov 8, 2024
50df0e2
fix: update sdk common
quangdz1704 Nov 8, 2024
c439940
fix: refactor token initialization and filtering logic in initOraiCommon
trungbach Nov 8, 2024
18826ae
fix: update sdk
quangdz1704 Nov 11, 2024
e94ed74
Merge branch 'feat/intergrate_common' of https://github.com/oraichain…
quangdz1704 Nov 11, 2024
44a1f53
fix: common reader
quangdz1704 Nov 11, 2024
38b4ea6
fix: get list token suppoted json
quangdz1704 Nov 12, 2024
867ad0c
Feat/add htt token (#358)
trungbach Nov 12, 2024
2cdfb92
fix: rm htt token
quangdz1704 Nov 12, 2024
122cbb6
feat: add htt (#359)
quangdz1704 Nov 12, 2024
1a9b975
chore: bump version common
quangdz1704 Nov 12, 2024
2096706
chore: bump version universal swap
quangdz1704 Nov 14, 2024
b17d963
chore: bump common version
quangdz1704 Nov 14, 2024
6aa5164
fix: update version common in universal swap
quangdz1704 Nov 14, 2024
0721510
fix: update package
quangdz1704 Nov 15, 2024
a2b52fa
fix: update call api supported token
quangdz1704 Nov 18, 2024
8f35443
fix: format bridge to
quangdz1704 Nov 18, 2024
31969cf
Merge branch 'main' of https://github.com/oraichain/oraidex-sdk into …
quangdz1704 Nov 20, 2024
bf14e4c
fix: update token suported
quangdz1704 Nov 20, 2024
697c710
fix: update version common
quangdz1704 Nov 21, 2024
d98b053
fix: update common version
quangdz1704 Nov 22, 2024
9ef0772
chore: bump version commom
quangdz1704 Nov 22, 2024
7a0d0f8
chore: bump version commom
quangdz1704 Nov 22, 2024
d366ce8
chore: bump version commom
quangdz1704 Nov 22, 2024
3ffe740
chore: update version 1.2.0
quangdz1704 Nov 22, 2024
502fb35
fix: update version common
quangdz1704 Nov 22, 2024
1977f15
fix: update common sdk version
quangdz1704 Nov 22, 2024
df2c0d8
chore: update verions
quangdz1704 Nov 22, 2024
1edeb09
resolve
vuonghuuhung Nov 28, 2024
bc6a309
refactor: remove module type and update tsconfig settings across pack…
trungbach Nov 28, 2024
ce824d1
chore: update @oraichain/common to version 1.2.1-beta3 and refactor t…
vuonghuuhung Nov 28, 2024
271d15a
add example
vuonghuuhung Nov 28, 2024
07d3b69
Merge branch 'feat/intergration_common_revert_commonjs' into feat/int…
trungbach Nov 28, 2024
b7f3b96
Merge branch 'feat/intergrate_common' of https://github.com/oraichain…
trungbach Nov 28, 2024
dbefa92
fix: network.ts
vuonghuuhung Nov 29, 2024
175cad9
feat: bump version of @oraichain/oraidex-common to 2.0.0 and update d…
vuonghuuhung Nov 29, 2024
15af7f9
feat: update @oraichain/oraidex-common to version 2.0.0 and adjust de…
trungbach Nov 29, 2024
b5f174e
fix: make Icon property optional in TokenItemType
trungbach Nov 29, 2024
dbef974
fix: allow additional CoinGeckoId values by adding string type
trungbach Nov 29, 2024
7b8d9dd
feat: initialize OraidexCommon in demo files and update tsconfig to e…
trungbach Nov 29, 2024
a5b4064
feat: integrate OraidexCommon into demo files for enhanced functionality
vuonghuuhung Nov 29, 2024
174b8ef
fix: handle errors in alphaSwapToOraichain function and improve logging
trungbach Nov 29, 2024
80ee846
feat: enhance address validation by integrating CustomChainInfo and u…
trungbach Nov 29, 2024
c9d89eb
feat: refactor asset parsing and validation logic in OraidexCommon to…
trungbach Nov 29, 2024
68e96d0
feat: enhance OraidexCommon integration by adding getOraidexCommonAtt…
trungbach Nov 29, 2024
5c7494a
feat: refactor getTokenOnOraichain usage and improve address validati…
vuonghuuhung Nov 29, 2024
927280d
chore: update @oraichain/common dependency to version ^1.2.1-beta5
trungbach Nov 29, 2024
20b6c1c
chore: update @oraichain/common dependency to version 1.2.1-beta5
trungbach Nov 29, 2024
aa9471f
chore: update @oraichain/common dependency to version ^1.2.1-beta6
trungbach Nov 29, 2024
9756381
feat: add flattenTokens support in OraidexCommon and update related l…
vuonghuuhung Nov 29, 2024
707240c
feat: update @oraichain/oraidex-common to version 2.0.0-beta.1 and ad…
trungbach Nov 29, 2024
e46acb6
chore: update @oraichain/cw-simulate to version ^2.8.108 and adjust d…
vuonghuuhung Dec 1, 2024
b632e68
feat: update package versions to 1.2.0-beta1 and integrate new workfl…
vuonghuuhung Dec 1, 2024
4399127
feat: bump version to 1.2.0-beta2 and update TypeScript configuration…
vuonghuuhung Dec 1, 2024
e43ccbb
feat: bump version to 2.0.0-beta.2 and enhance getOraidexCommonAttrib…
vuonghuuhung Dec 1, 2024
b484076
feat: bump versions for oraiswap-v3 to 1.1.3-beta.1 and universal-swa…
trungbach Dec 1, 2024
3d706dc
Merge remote-tracking branch 'origin/feat/intergrate_common' into fea…
trungbach Dec 1, 2024
141ee31
feat: bump version to 1.2.0-beta3 and implement token filtering funct…
vuonghuuhung Dec 2, 2024
daa60d2
feat: bump version to 2.0.0-beta.3 and add staking_oraix and indexer_…
vuonghuuhung Dec 2, 2024
33c79cc
feat: add mixer_router to OraidexCommon and update yarn.lock for orai…
vuonghuuhung Dec 2, 2024
3740264
feat: bump version to 1.2.0-beta4 and update oraidex-common dependenc…
vuonghuuhung Dec 2, 2024
058a35b
feat: bump version to 2.0.0-beta.4 and update dependencies in multipl…
vuonghuuhung Dec 2, 2024
90043ed
feat: bump version to 1.2.0-beta5 for oraiswap-v3 and universal-swap …
vuonghuuhung Dec 2, 2024
89c9b1b
feat: bump version to 2.0.0-beta.6 and update dependencies across pac…
vuonghuuhung Dec 3, 2024
21d4a7c
feat: bump versions to 2.0.0-beta.7 and 1.2.1-beta7 across packages
vuonghuuhung Dec 3, 2024
b469311
feat: bump versions to 2.0.0-beta.8 and 1.2.0-beta.8 across packages
vuonghuuhung Dec 3, 2024
e47b1d9
feat: bump versions to 2.0.0-beta.9 and 1.2.0-beta.9 across packages
vuonghuuhung Dec 3, 2024
46bbc1e
feat: bump versions to 2.0.0-beta.10 and 1.2.0-beta.10 across package…
vuonghuuhung Dec 3, 2024
afec8f4
feat: bump versions to 2.0.0-beta.11 and 1.2.0-beta.11 across package…
vuonghuuhung Dec 3, 2024
584c844
feat: add ORAIBTC and oBTC configurations to oraidex.json for mainnet…
vuonghuuhung Dec 4, 2024
1dbd8d3
feat: add ORAIBTC and oBTC configurations for oraibtc-mainnet-1 in or…
vuonghuuhung Dec 4, 2024
842f8a0
feat: update version to 2.0.0-beta.12; add btcTokens getter and bitco…
vuonghuuhung Dec 4, 2024
2d8c382
feat: bump version to 1.2.0-beta.12 in oraiswap-v3 and universal-swap…
vuonghuuhung Dec 4, 2024
aea52c0
Merge branch 'feat/intergrate_common_v1' into feat/intergrate_common
trungbach Dec 4, 2024
60f03ef
feat: bump version to 2.0.0-beta.13 for oraidex-common, oraiswap-v3, …
vuonghuuhung Dec 4, 2024
3ceb27f
fix: update workflow branch name from feat/intergrate_common_v1 to fe…
vuonghuuhung Dec 4, 2024
22668d7
feat: bump versions to 2.0.0-beta.14 for oraidex-common and 1.2.0-bet…
vuonghuuhung Dec 4, 2024
733916b
feat: bump versions to 2.0.0-beta.15 for oraidex-common and 1.2.0-bet…
trungbach Dec 4, 2024
f6648bb
chore: comment out Oraiswap v3 and Universal-swap publish steps in wo…
trungbach Dec 4, 2024
94029b9
fix: update build command to specify package directory for Oraidex Co…
trungbach Dec 4, 2024
b2fc745
fix: update build command in workflow and restore publish steps for O…
trungbach Dec 4, 2024
260f9e7
Merge branch 'main' into feat/intergrate_common
trungbach Dec 5, 2024
8fdff0c
bump version to 2.0.0-beta.16 in package.json
trungbach Dec 5, 2024
dc3ddb1
add Solana configuration for MAX and ORAI tokens in oraidex.json
trungbach Dec 5, 2024
2aff510
bump version to 2.0.0-beta.17 and add solTokens getter in OraidexComm…
trungbach Dec 5, 2024
39c790b
add HTT token configuration to oraidex.json (#378)
trungbach Dec 5, 2024
e739c3b
add THT token configuration to oraidex.json
vuonghuuhung Dec 6, 2024
aa69cf0
remove THT token configuration from oraidex.json
vuonghuuhung Dec 6, 2024
593726a
remove HTT token configuration from oraidex.json
vuonghuuhung Dec 6, 2024
36cfa5e
add THT token configuration to oraidex.json (#379)
vuonghuuhung Dec 6, 2024
847866a
bump package versions for oraidex-common, oraiswap-v3, and universal-…
vuonghuuhung Dec 10, 2024
d9a46a9
update ibcInfos type definition to allow any value and bump oraidex-c…
vuonghuuhung Dec 10, 2024
fa72961
bump package versions for oraidex-common, oraiswap-v3, and universal-…
vuonghuuhung Dec 10, 2024
a4af46e
bump package versions for oraidex-common, oraiswap-v3, and universal-…
vuonghuuhung Dec 10, 2024
5be1b69
bump package versions for oraidex-common, oraiswap-v3, and universal-…
vuonghuuhung Dec 10, 2024
453eb9f
remove hardcode list pairs
haunv3 Dec 12, 2024
79c241e
remove commented-out getOraidexCommonAttribute function and related t…
trungbach Dec 12, 2024
eab4e44
add Ton and TonTestnet support in wallet interface, update NetworkTyp…
trungbach Dec 12, 2024
018fd97
Merge branch 'main' into feat/intergrate_common
trungbach Dec 12, 2024
4a84151
Merge branch 'remove/list-pairs' into feat/intergrate_common
trungbach Dec 13, 2024
dcbe880
fix oraidex common
haunv3 Dec 13, 2024
12cbbca
Merge branch 'main' into feat/intergrate_common
trungbach Dec 18, 2024
ffdef11
bump version to 2.0.0-beta.23 in package.json
trungbach Dec 18, 2024
ce6cc89
bump version to 2.0.0-beta.24 and add tonTokens and tonNetworkMainnet…
trungbach Dec 18, 2024
4c6c58e
refactor: update build command for oraidex-common and comment out unu…
trungbach Dec 18, 2024
648fe57
refactor: update build command in workflow and bump version for orais…
trungbach Dec 18, 2024
9699c50
bump version to 1.2.0-beta.24 and update router API to staging enviro…
trungbach Dec 19, 2024
8f87343
bump version to 2.0.0-beta.25 and add ton configuration to oraidex.json
trungbach Dec 20, 2024
93ab0e2
Merge remote-tracking branch 'origin/main' into feat/intergrate_common
trungbach Dec 20, 2024
14055df
refactor: update build and publish process for oraidex-common package
trungbach Dec 20, 2024
d17e449
chore: update oraidex-common and common package versions to stable re…
trungbach Dec 20, 2024
94902b3
chore: update @oraichain/common package version to 1.2.6 and enable p…
trungbach Dec 21, 2024
43e1924
chore: update version of @oraichain/oraidex-common to 2.0.0-beta
trungbach Dec 21, 2024
3cc2346
chore: update oraidex-common to version 2.0.1 and @oraichain/common t…
trungbach Dec 23, 2024
3687821
chore: bump version to 2.0.2 and update toAmount function for improve…
trungbach Dec 23, 2024
d437f33
chore: update oraiswap and universal-swap package versions to 1.2.0-b…
trungbach Dec 23, 2024
f3d8e48
chore: bump oraidex-common version to 2.0.3 and improve toAmount func…
trungbach Dec 23, 2024
61a4654
chore: bump oraidex-common version to 2.0.4 and enhance toDisplay fun…
trungbach Dec 23, 2024
9d19ef7
update simulate amount
haunv3 Dec 25, 2024
b9da35e
Merge branch 'main' into feat/intergrate_common
trungbach Dec 26, 2024
8e1f9e1
chore: update package versions for oraiswap-v3 and universal-swap to …
trungbach Dec 26, 2024
bf9993b
fix simulate new token
haunv3 Dec 26, 2024
d59d915
chore: update package versions to 1.3.0 for oraiswap-v3 and universal…
trungbach Dec 27, 2024
489d8f9
Merge branch 'feat/intergrate_common' of https://github.com/oraichain…
trungbach Dec 27, 2024
5ff8cbc
chore: bump version to 2.0.6 and update backend URL for OraidexCommon…
trungbach Dec 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/oraidex-common/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ export const network: CustomChainInfo & NetworkConfig = {
export const evmChains = chainInfos.filter((c) => c.networkType === "evm");
export const cosmosChains: CustomChainInfo[] = chainInfos.filter((c) => c.networkType === "cosmos");


// evm network
export enum Networks {
mainnet = 1,
Expand Down
53 changes: 16 additions & 37 deletions packages/oraidex-common/src/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,38 +97,33 @@ export const initOraiCommon = async () => {
const tokenListSupports = supportedChainIns.supportedChainInfo;

const tokenInfos = [];

// filter to get tokens that are supported by the network.
for (const [chainId, coins] of Object.entries(tokenListSupports)) {
const orgTokenList = oraiCommon.tokenItems.getSpecificChainTokens(chainId);
const listCoinId = Object.values(coins);
const chainTokens = oraiCommon.tokenItems.getSpecificChainTokens(chainId);
const listSupportedTokenByChain = Object.values(coins);

const fmtTokens = listCoinId.reduce((acc, tk) => {
const findItem = orgTokenList.find((c) => [c.contractAddress, c.denom].includes(tk.denom));
const fmtTokens = listSupportedTokenByChain.reduce((acc, supportedToken) => {
const findItem = chainTokens.find((chainToken) =>
[chainToken.contractAddress, chainToken.denom].includes(supportedToken.denom)
);

if (findItem) {
acc.push({
...findItem,
coinGeckoId: tk.coingecko_id,
Icon: findItem.icon || tokenIconByCoingeckoId[tk.coingecko_id]?.Icon || "",
IconLight: findItem.icon || tokenIconByCoingeckoId[tk.coingecko_id]?.IconLight || ""
coinGeckoId: supportedToken.coingecko_id,
Icon: findItem.icon || tokenIconByCoingeckoId[supportedToken.coingecko_id]?.Icon || "",
IconLight: findItem.icon || tokenIconByCoingeckoId[supportedToken.coingecko_id]?.IconLight || ""
});
}

return acc;
}, []);

tokenInfos.push(...fmtTokens);
}

tokenConfig.oraichainTokens = tokenInfos.filter((tk) => tk.chainId === "Oraichain");
tokenConfig.otherChainTokens = tokenInfos.filter((tk) => tk.chainId !== "Oraichain");

const { chainInfos, tokenItems } = oraiCommon;

console.log({
chainInfos: chainInfos.chainInfos.length,
tokenItems: tokenItems.tokens.length,
tokenConfig
});
tokenConfig.oraichainTokens = tokenInfos.filter((token) => token.chainId === "Oraichain");
tokenConfig.otherChainTokens = tokenInfos.filter((token) => token.chainId !== "Oraichain");
}

return { tokenConfig, oraiCommon };
Expand All @@ -139,50 +134,34 @@ await initOraiCommon();
export const oraichainTokens = tokenConfig.oraichainTokens;
export const otherChainTokens = tokenConfig.otherChainTokens;
export const chainInfosCommon = oraiCommon.chainInfos;

export const tokens = [otherChainTokens, oraichainTokens];

export const flattenTokens = flatten(tokens);
export const tokenMap = Object.fromEntries(flattenTokens.map((c) => [c.denom, c]));
export const assetInfoMap = Object.fromEntries(flattenTokens.map((c) => [c.contractAddress || c.denom, c]));
export const cosmosTokens = uniqBy(
flattenTokens.filter(
(token) =>
// !token.contractAddress &&
token.denom && token.cosmosBased && token.coinGeckoId
),
flattenTokens.filter((token) => token.denom && token.cosmosBased && token.coinGeckoId),
(c) => c.denom
);

export const cw20Tokens = uniqBy(
cosmosTokens.filter(
// filter cosmos based tokens to collect tokens that have contract addresses
(token) =>
// !token.contractAddress &&
token.contractAddress
(token) => token.contractAddress
),
(c) => c.denom
);

export const cw20TokenMap = Object.fromEntries(cw20Tokens.map((c) => [c.contractAddress, c]));

export const evmTokens = uniqBy(
flattenTokens.filter(
(token) =>
// !token.contractAddress &&
token.denom && !token.cosmosBased && token.coinGeckoId && token.chainId !== "kawaii_6886-1"
(token) => token.denom && !token.cosmosBased && token.coinGeckoId && token.chainId !== "kawaii_6886-1"
),
(c) => c.denom
);

export const kawaiiTokens = uniqBy(
cosmosTokens.filter((token) => token.chainId === "kawaii_6886-1"),
(c) => c.denom
);

// mapped token with icon
export const oraichainTokensWithIcon = mapListWithIcon(oraichainTokens, tokensIcon, "coinGeckoId");
export const otherTokensWithIcon = mapListWithIcon(otherChainTokens, tokensIcon, "coinGeckoId");

export const tokensWithIcon = [otherTokensWithIcon, oraichainTokensWithIcon];
export const flattenTokensWithIcon = flatten(tokensWithIcon);
Loading