From 3abd3a96d73bf1868e37a943703551edd8b7c8ce Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 4 Nov 2024 17:21:57 +0700 Subject: [PATCH 01/84] init supported chain info for spec dex --- packages/common/package.json | 4 +-- .../src/chain-infos/chain-info-reader.ts | 13 ++++++++ .../common/src/constants/chain-registry.ts | 5 +++ packages/common/src/supported/index.ts | 0 .../common/src/supported/supported-reader.ts | 33 +++++++++++++++++++ packages/common/src/supported/supported.ts | 19 +++++++++++ packages/common/src/supported/types.ts | 15 +++++++++ supported/oraidex.json | 30 +++++++++++++++++ 8 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 packages/common/src/supported/index.ts create mode 100644 packages/common/src/supported/supported-reader.ts create mode 100644 packages/common/src/supported/supported.ts create mode 100644 packages/common/src/supported/types.ts create mode 100644 supported/oraidex.json diff --git a/packages/common/package.json b/packages/common/package.json index 7d15330..24ee16b 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { - "name": "@oraichain/common", - "version": "1.1.1", + "name": "oraichain-common-test", + "version": "1.1.2", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/chain-infos/chain-info-reader.ts b/packages/common/src/chain-infos/chain-info-reader.ts index 55bd4ab..e5f2337 100644 --- a/packages/common/src/chain-infos/chain-info-reader.ts +++ b/packages/common/src/chain-infos/chain-info-reader.ts @@ -26,6 +26,19 @@ export class ChainInfoReaderFromBackend implements ChainInfoReader { } } +export class ChainInfoReaderFromOraiCommon implements ChainInfoReader { + constructor(private readonly sourceUrl: string) {} + + async readChainInfos() { + const chains = (await ( + await fetchRetry( + this.sourceUrl + ) + ).json()) as CustomChainInfo[]; + return chains; + } +} + /** * @summary This class fetches chain infos from our github master branch directly. Beware that it has a rate limit of 60 requests / hour per IP */ diff --git a/packages/common/src/constants/chain-registry.ts b/packages/common/src/constants/chain-registry.ts index 0fc9414..cdfbbe4 100644 --- a/packages/common/src/constants/chain-registry.ts +++ b/packages/common/src/constants/chain-registry.ts @@ -13,3 +13,8 @@ export const CHAIN_REGISTRY_GITHUB_API_ENDPOINTS = { export const CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS = { BASE_URL: "https://raw.githubusercontent.com/oraichain/oraichain-sdk/master" }; + +export const ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS = { + BASE_URL: "https://api.github.com", + SUPPORTED_INFO: "/repos/oraichain/oraichain-sdk/contents/supported/" +} diff --git a/packages/common/src/supported/index.ts b/packages/common/src/supported/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/common/src/supported/supported-reader.ts b/packages/common/src/supported/supported-reader.ts new file mode 100644 index 0000000..a9082be --- /dev/null +++ b/packages/common/src/supported/supported-reader.ts @@ -0,0 +1,33 @@ +import { fetchRetry } from "src/helpers"; +import { SupportedChainInfo, SupportedChainInfoReader } from "./types"; +import { ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS } from "src/constants"; + +export class SupportedChainInfoReaderFromGit + implements SupportedChainInfoReader +{ + constructor( + private readonly dex: string, + private readonly accessToken: string + ) {} + + async readSupportedChainInfo(): Promise { + const options = { + method: "GET", + headers: { + Accept: "application/json" + } + }; + if (this.accessToken) { + options.headers["Authorization"] = `Bearer ${this.accessToken}`; + options.headers["X-GitHub-Api-Version"] = "2022-11-28"; + } + const supportedChainInfo: SupportedChainInfo = await ( + await fetchRetry( + `${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.BASE_URL}${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.SUPPORTED_INFO}${this.dex}.json?ref=feat/read-from-orai-common-backend`, + options + ) + ).json(); + + return supportedChainInfo; + } +} diff --git a/packages/common/src/supported/supported.ts b/packages/common/src/supported/supported.ts new file mode 100644 index 0000000..e34ad3b --- /dev/null +++ b/packages/common/src/supported/supported.ts @@ -0,0 +1,19 @@ +import { + SupportedChainInfo, + SupportedChainInfoReader, + SupportedTokens +} from "./types"; + +export class SupportChainInfoImpl implements SupportedTokens { + constructor(public readonly supportedChainInfo: SupportedChainInfo) {} + + static async create(supportedReader: SupportedChainInfoReader) { + const supportedChainInfo = await supportedReader.readSupportedChainInfo(); + const info = new SupportChainInfoImpl(supportedChainInfo); + return info; + } + + get oraichainSupportedTokens() { + return Object.values(this.supportedChainInfo["oraichain"].coinDenoms); + } +} diff --git a/packages/common/src/supported/types.ts b/packages/common/src/supported/types.ts new file mode 100644 index 0000000..0df120d --- /dev/null +++ b/packages/common/src/supported/types.ts @@ -0,0 +1,15 @@ +export type SupportedChainInfo = { + [chainId: string]: { + coinDenoms: { + [name: string]: string; + }; + }; +}; + +export interface SupportedChainInfoReader { + readSupportedChainInfo(): Promise; +} + +export interface SupportedTokens { + oraichainSupportedTokens: string[]; +} \ No newline at end of file diff --git a/supported/oraidex.json b/supported/oraidex.json new file mode 100644 index 0000000..0374f69 --- /dev/null +++ b/supported/oraidex.json @@ -0,0 +1,30 @@ +{ + "oraichain": { + "coinDenoms": { + "AIRI": "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg", + "ATOM": "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78", + "BEP20 KWT": "ibc/4F7464EEE736CCFB6B444EB72DE60B3B43C0DD509FFA2B87E05D584467AAE8C8", + "BEP20 MILKY": "ibc/E12A2298AC40011C79F02F26C324BD54DF20F4B2904CB9028BFDEDCFAA89B906", + "BTC": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/obtc", + "BTC (Legacy)": "orai10g6frpysmdgw5tdqke47als6f97aqmr8s3cljsvjce4n5enjftcqtamzsd", + "HMSTR": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/HMSTR", + "IBC INJ": "ibc/49D820DFDE9F885D7081725A58202ABA2F465CAEE4AFBC683DFB79A8E013E83E", + "INJ": "orai19rtmkk6sn4tppvjmp5d5zj6gfsdykrl5rw2euu5gwur3luheuuusesqn49", + "KWT": "orai1nd4r053e3kgedgld2ymen8l9yrw8xpjyaal7j5", + "MILKY": "orai1gzvndtzceqwfymu2kqhta2jn6gmzxvzqwdgvjw", + "NTMPI": "ibc/576B1D63E401B6A9A071C78A1D1316D016EC9333D2FEB14AD503FAC4B8731CD1", + "OCH": "orai1hn8w33cqvysun2aujk5sv33tku4pgcxhhnsxmvnkfvdxagcx0p8qa4l98q", + "ORAI": "orai", + "ORAIX": "orai1lus0f0rhx8s03gdllx2n6vhkmf0536dv57wfge", + "OSMO": "ibc/9C4DCD21B48231D0BC2AC3D1B74A864746B37E4292694C93C617324250D002FC", + "PEPE": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/extPEPE", + "TON": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/ton", + "USDC": "orai15un8msx3n5zf9ahlxmfeqd2kwa5wm0nrpxer304m9nd5q6qq0g6sku5pdd", + "USDT": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", + "WETH": "orai1dqa52a7hxxuv8ghe7q5v0s36ra0cthea960q2cukznleqhk0wpnshfegez", + "scATOM": "orai19q4qak2g3cj2xc2y3060t0quzn3gfhzx08rjlrdd3vqxhjtat0cq668phq", + "scORAI": "orai1065qe48g7aemju045aeyprflytemx7kecxkf5m7u5h5mphd0qlcs47pclp", + "wTRX": "orai1c7tpjenafvgjtgm9aqwm7afnke6c56hpdms8jc6md40xs3ugd0es5encn0" + } + } +} From 304570a42f22dd5edabbb731b78dc7328705c895 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 4 Nov 2024 17:26:50 +0700 Subject: [PATCH 02/84] fix: reset package name --- packages/common/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 24ee16b..7d15330 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { - "name": "oraichain-common-test", - "version": "1.1.2", + "name": "@oraichain/common", + "version": "1.1.1", "main": "build/index.js", "license": "MIT", "scripts": { From 471061563f713b15cb8219ec63c21e07bb2a0c04 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 4 Nov 2024 17:30:03 +0700 Subject: [PATCH 03/84] add export --- packages/common/src/supported/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/common/src/supported/index.ts b/packages/common/src/supported/index.ts index e69de29..214b52a 100644 --- a/packages/common/src/supported/index.ts +++ b/packages/common/src/supported/index.ts @@ -0,0 +1,3 @@ +export * from "./supported"; +export * from "./supported-reader"; +export * from "./types"; \ No newline at end of file From 0ce0d37ff7c8001afcf04de58fbe03d5f686dffa Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 4 Nov 2024 18:50:05 +0700 Subject: [PATCH 04/84] add: option filter supported token --- packages/common/package.json | 2 +- packages/common/src/common.ts | 24 +++++++++++--- packages/common/src/helpers/denom-check.ts | 7 ++++- packages/common/src/index.ts | 1 + .../common/src/supported/supported-reader.ts | 10 ++++-- .../common/src/token-items/token-items.ts | 31 ++++++++++++++++--- 6 files changed, 62 insertions(+), 13 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 7d15330..f690037 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.1", + "version": "1.1.2", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 2686d11..7ef6278 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -8,6 +8,7 @@ import { ChainInfosImpl, CustomChainInfo } from "./chain-infos"; +import { SupportedChainInfo, SupportedChainInfoReader } from "./supported"; import { TokenItems, TokenItemsImpl } from "./token-items"; export class OraiCommon { @@ -16,17 +17,32 @@ export class OraiCommon { private _tokenItems?: TokenItems ) {} - static initializeFromCustomChainInfos(customChainInfos: CustomChainInfo[]) { + static initializeFromCustomChainInfos( + customChainInfos: CustomChainInfo[], + supportedChainInfo: SupportedChainInfo = null + ) { const common = new OraiCommon( new ChainInfosImpl(customChainInfos), - new TokenItemsImpl(customChainInfos) + new TokenItemsImpl(customChainInfos, supportedChainInfo) ); return common; } - static async initializeFromChainInfoReader(reader: ChainInfoReader) { + static async initializeFromChainInfoReader( + reader: ChainInfoReader, + supportedReader: SupportedChainInfoReader = null + ) { const customChainInfos = await reader.readChainInfos(); - return OraiCommon.initializeFromCustomChainInfos(customChainInfos); + + let supportedChainInfo: SupportedChainInfo; + if (supportedReader) { + supportedChainInfo = await supportedReader.readSupportedChainInfo(); + } + + return OraiCommon.initializeFromCustomChainInfos( + customChainInfos, + supportedChainInfo + ); } static async initializeFromBackend() { diff --git a/packages/common/src/helpers/denom-check.ts b/packages/common/src/helpers/denom-check.ts index d9e8aa0..37e9333 100644 --- a/packages/common/src/helpers/denom-check.ts +++ b/packages/common/src/helpers/denom-check.ts @@ -1,13 +1,18 @@ +import { TokenItemType } from "src/token-items"; + /** * Determine if the denom is native token or not * @param denom denom of token or coin * @param prefixCw20 prefix of non-native token. Default is "orai1" * @returns true if the denom is native token of Oraichain, false otherwise */ - export const isNative = (denom: string, prefixCw20: string = "orai1") => { if (denom.startsWith(prefixCw20)) { return false; } return true; }; + +export const extractCosmosDenomOrCW20Address = (token: TokenItemType) => { + return token.contractAddress ? token.contractAddress : token.denom; +} diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index e7985da..658d49d 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -1,6 +1,7 @@ export * from "./common"; export * from "./chain-infos"; export * from "./token-items"; +export * from "./supported"; export * from "./constants"; export * from "./tx"; export * from "./helpers"; diff --git a/packages/common/src/supported/supported-reader.ts b/packages/common/src/supported/supported-reader.ts index a9082be..1bea0af 100644 --- a/packages/common/src/supported/supported-reader.ts +++ b/packages/common/src/supported/supported-reader.ts @@ -1,6 +1,6 @@ -import { fetchRetry } from "src/helpers"; +import { fetchRetry } from "../helpers"; import { SupportedChainInfo, SupportedChainInfoReader } from "./types"; -import { ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS } from "src/constants"; +import { ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS } from "../constants"; export class SupportedChainInfoReaderFromGit implements SupportedChainInfoReader @@ -21,13 +21,17 @@ export class SupportedChainInfoReaderFromGit options.headers["Authorization"] = `Bearer ${this.accessToken}`; options.headers["X-GitHub-Api-Version"] = "2022-11-28"; } - const supportedChainInfo: SupportedChainInfo = await ( + const res = await ( await fetchRetry( `${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.BASE_URL}${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.SUPPORTED_INFO}${this.dex}.json?ref=feat/read-from-orai-common-backend`, options ) ).json(); + const supportedChainInfo: SupportedChainInfo = await ( + await fetchRetry(res.download_url) + ).json(); + return supportedChainInfo; } } diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index a38ca5c..06a75b5 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -4,6 +4,8 @@ import { COSMOS_CHAIN_IDS } from "../constants/chain-ids"; import { IBC_DENOMS } from "../constants/denoms"; import { TokenItemType } from "./types"; import { NETWORK_TYPES } from "../constants/network"; +import { SupportedChainInfo, SupportedChainInfoReader } from "../supported"; +import { extractCosmosDenomOrCW20Address, isNative } from "../helpers"; export interface TokenItems { otherChainTokens: TokenItemType[]; @@ -20,11 +22,24 @@ export interface TokenItems { } export class TokenItemsImpl implements TokenItems { - constructor(private readonly chainInfos: CustomChainInfo[]) {} + constructor( + private readonly chainInfos: CustomChainInfo[], + private readonly supportedChainInfo: SupportedChainInfo + ) {} - static async create(chainInfoReader: ChainInfoReader) { + static async create( + chainInfoReader: ChainInfoReader, + supportedChainInfoReader: SupportedChainInfoReader = null + ) { const chainInfos = await chainInfoReader.readChainInfos(); - const tokenItems = new TokenItemsImpl(chainInfos); + + let supportedChainInfo: SupportedChainInfo; + if (supportedChainInfoReader) { + supportedChainInfo = + await supportedChainInfoReader.readSupportedChainInfo(); + } + const tokenItems = new TokenItemsImpl(chainInfos, supportedChainInfo); + return tokenItems; } @@ -75,11 +90,19 @@ export class TokenItemsImpl implements TokenItems { } get oraichainTokens() { - return this.getTokensFromNetwork( + const oraiTokens = this.getTokensFromNetwork( this.chainInfos.find( (chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAICHAIN ) ); + + if (!this.supportedChainInfo) return oraiTokens; + + return oraiTokens.filter((token) => + Object.values(this.supportedChainInfo["oraichain"].coinDenoms).includes( + extractCosmosDenomOrCW20Address(token) + ) + ); } get tokens() { From cd974bd81746efb739038c7681403771f475a4d0 Mon Sep 17 00:00:00 2001 From: trungbach Date: Tue, 5 Nov 2024 01:17:03 +0700 Subject: [PATCH 05/84] chore: add TEST_TOKEN to supported tokens --- supported/oraidex.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/supported/oraidex.json b/supported/oraidex.json index 0374f69..e581c31 100644 --- a/supported/oraidex.json +++ b/supported/oraidex.json @@ -24,7 +24,8 @@ "WETH": "orai1dqa52a7hxxuv8ghe7q5v0s36ra0cthea960q2cukznleqhk0wpnshfegez", "scATOM": "orai19q4qak2g3cj2xc2y3060t0quzn3gfhzx08rjlrdd3vqxhjtat0cq668phq", "scORAI": "orai1065qe48g7aemju045aeyprflytemx7kecxkf5m7u5h5mphd0qlcs47pclp", - "wTRX": "orai1c7tpjenafvgjtgm9aqwm7afnke6c56hpdms8jc6md40xs3ugd0es5encn0" + "wTRX": "orai1c7tpjenafvgjtgm9aqwm7afnke6c56hpdms8jc6md40xs3ugd0es5encn0", + "TEST_TOKEN": "test-token-denom" } } } From 46c5490c394d4b610bcc8f1a925f06dedfc6acd4 Mon Sep 17 00:00:00 2001 From: trungbach Date: Tue, 5 Nov 2024 02:08:02 +0700 Subject: [PATCH 06/84] chore: update TEST_TOKEN in supported tokens --- supported/oraidex.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supported/oraidex.json b/supported/oraidex.json index e581c31..4ea6aba 100644 --- a/supported/oraidex.json +++ b/supported/oraidex.json @@ -25,7 +25,7 @@ "scATOM": "orai19q4qak2g3cj2xc2y3060t0quzn3gfhzx08rjlrdd3vqxhjtat0cq668phq", "scORAI": "orai1065qe48g7aemju045aeyprflytemx7kecxkf5m7u5h5mphd0qlcs47pclp", "wTRX": "orai1c7tpjenafvgjtgm9aqwm7afnke6c56hpdms8jc6md40xs3ugd0es5encn0", - "TEST_TOKEN": "test-token-denom" + "TEST_TOKEN": "orai1lus0f0rhx8s03gdllx2n6vhkmf0536dv57wfge" } } } From 1360f237d930ecd2bf6259703b4470023cdf1ba3 Mon Sep 17 00:00:00 2001 From: trungbach Date: Tue, 5 Nov 2024 02:15:14 +0700 Subject: [PATCH 07/84] chore: update TEST_TOKEN in supported tokens --- supported/oraidex.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supported/oraidex.json b/supported/oraidex.json index 4ea6aba..62a668a 100644 --- a/supported/oraidex.json +++ b/supported/oraidex.json @@ -25,7 +25,7 @@ "scATOM": "orai19q4qak2g3cj2xc2y3060t0quzn3gfhzx08rjlrdd3vqxhjtat0cq668phq", "scORAI": "orai1065qe48g7aemju045aeyprflytemx7kecxkf5m7u5h5mphd0qlcs47pclp", "wTRX": "orai1c7tpjenafvgjtgm9aqwm7afnke6c56hpdms8jc6md40xs3ugd0es5encn0", - "TEST_TOKEN": "orai1lus0f0rhx8s03gdllx2n6vhkmf0536dv57wfge" + "TEST_TOKEN": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/extCAT" } } } From 5ef557a207d58b3b890064a8b43fa7c1a651a035 Mon Sep 17 00:00:00 2001 From: ducphamle2 Date: Mon, 4 Nov 2024 11:25:22 -0800 Subject: [PATCH 08/84] fix: use correct oraichain chain id --- packages/common/src/token-items/token-items.ts | 6 +++--- supported/oraidex.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 06a75b5..96e55a7 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -99,9 +99,9 @@ export class TokenItemsImpl implements TokenItems { if (!this.supportedChainInfo) return oraiTokens; return oraiTokens.filter((token) => - Object.values(this.supportedChainInfo["oraichain"].coinDenoms).includes( - extractCosmosDenomOrCW20Address(token) - ) + Object.values( + this.supportedChainInfo[COSMOS_CHAIN_IDS.ORAICHAIN].coinDenoms + ).includes(extractCosmosDenomOrCW20Address(token)) ); } diff --git a/supported/oraidex.json b/supported/oraidex.json index 62a668a..1ced6f1 100644 --- a/supported/oraidex.json +++ b/supported/oraidex.json @@ -1,5 +1,5 @@ { - "oraichain": { + "Oraichain": { "coinDenoms": { "AIRI": "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg", "ATOM": "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78", From 64ab5f972985d494e862eeeb70afa33f2fea0063 Mon Sep 17 00:00:00 2001 From: ducphamle2 Date: Mon, 4 Nov 2024 11:35:27 -0800 Subject: [PATCH 09/84] chore: refactor code --- packages/common/src/common.ts | 34 ++++++++----------- .../common/src/token-items/token-items.ts | 17 ++++++---- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 7ef6278..8fadf0e 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -8,7 +8,7 @@ import { ChainInfosImpl, CustomChainInfo } from "./chain-infos"; -import { SupportedChainInfo, SupportedChainInfoReader } from "./supported"; +import { SupportedChainInfo } from "./supported"; import { TokenItems, TokenItemsImpl } from "./token-items"; export class OraiCommon { @@ -17,32 +17,17 @@ export class OraiCommon { private _tokenItems?: TokenItems ) {} - static initializeFromCustomChainInfos( - customChainInfos: CustomChainInfo[], - supportedChainInfo: SupportedChainInfo = null - ) { + static initializeFromCustomChainInfos(customChainInfos: CustomChainInfo[]) { const common = new OraiCommon( new ChainInfosImpl(customChainInfos), - new TokenItemsImpl(customChainInfos, supportedChainInfo) + new TokenItemsImpl(customChainInfos) ); return common; } - static async initializeFromChainInfoReader( - reader: ChainInfoReader, - supportedReader: SupportedChainInfoReader = null - ) { + static async initializeFromChainInfoReader(reader: ChainInfoReader) { const customChainInfos = await reader.readChainInfos(); - - let supportedChainInfo: SupportedChainInfo; - if (supportedReader) { - supportedChainInfo = await supportedReader.readSupportedChainInfo(); - } - - return OraiCommon.initializeFromCustomChainInfos( - customChainInfos, - supportedChainInfo - ); + return OraiCommon.initializeFromCustomChainInfos(customChainInfos); } static async initializeFromBackend() { @@ -62,6 +47,15 @@ export class OraiCommon { return OraiCommon.initializeFromChainInfoReader(reader); } + static async initializeFromBackendWithFilters( + supportedChainInfo: SupportedChainInfo + ) { + const common = await this.initializeFromBackend(); + const filteredTokenItems = + common.tokenItems.withSupportedChainInfo(supportedChainInfo); + return common.withTokenItems(filteredTokenItems); + } + withChainInfos(chainInfos: ChainInfos) { this._chainInfos = chainInfos; return this; diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 96e55a7..99463ba 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -19,13 +19,14 @@ export interface TokenItems { cw20TokenMap: { [k: string]: TokenItemType }; evmTokens: TokenItemType[]; kawaiiTokens: TokenItemType[]; + withSupportedChainInfo: (supportedChainInfo: SupportedChainInfo) => this; } export class TokenItemsImpl implements TokenItems { - constructor( - private readonly chainInfos: CustomChainInfo[], - private readonly supportedChainInfo: SupportedChainInfo - ) {} + // a filter for DEX + private supportedChainInfo: SupportedChainInfo; + + constructor(private readonly chainInfos: CustomChainInfo[]) {} static async create( chainInfoReader: ChainInfoReader, @@ -38,8 +39,7 @@ export class TokenItemsImpl implements TokenItems { supportedChainInfo = await supportedChainInfoReader.readSupportedChainInfo(); } - const tokenItems = new TokenItemsImpl(chainInfos, supportedChainInfo); - + const tokenItems = new TokenItemsImpl(chainInfos); return tokenItems; } @@ -172,4 +172,9 @@ export class TokenItemsImpl implements TokenItems { (c) => c.denom ); } + + withSupportedChainInfo(supportedChainInfo: SupportedChainInfo) { + this.supportedChainInfo = supportedChainInfo; + return this; + } } From 908e7342c90b91391a05051d1cb35e35b93ac41c Mon Sep 17 00:00:00 2001 From: ducphamle2 Date: Mon, 4 Nov 2024 11:40:03 -0800 Subject: [PATCH 10/84] fix: use supported reader instead initializeFromBackendWithSupportedReader --- packages/common/src/common.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 8fadf0e..03a663c 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -8,7 +8,7 @@ import { ChainInfosImpl, CustomChainInfo } from "./chain-infos"; -import { SupportedChainInfo } from "./supported"; +import { SupportedChainInfo, SupportedChainInfoReader } from "./supported"; import { TokenItems, TokenItemsImpl } from "./token-items"; export class OraiCommon { @@ -47,10 +47,11 @@ export class OraiCommon { return OraiCommon.initializeFromChainInfoReader(reader); } - static async initializeFromBackendWithFilters( - supportedChainInfo: SupportedChainInfo + static async initializeFromBackendWithSupportedReader( + supportedReader: SupportedChainInfoReader ) { const common = await this.initializeFromBackend(); + const supportedChainInfo = await supportedReader.readSupportedChainInfo(); const filteredTokenItems = common.tokenItems.withSupportedChainInfo(supportedChainInfo); return common.withTokenItems(filteredTokenItems); From 6294f0550f202e53a013bedde339a84e48a8797e Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 10:29:29 +0700 Subject: [PATCH 11/84] feat: Add documentation for repository features and logic --- FEATURES.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 FEATURES.md diff --git a/FEATURES.md b/FEATURES.md new file mode 100644 index 0000000..363b316 --- /dev/null +++ b/FEATURES.md @@ -0,0 +1,35 @@ +The repository contains various logic related to the Oraichain SDK, which includes handling chain information, token items, and supported chain information. Here are some key areas of logic in the repository: + +## Chain Information Handling: + +Classes like `ChainInfoReader`, `ChainInfoReaderFromBackend`, `ChainInfoReaderFromGit`, and `ChainInfoReaderFromGitRaw` are responsible for reading chain information from various sources such as backend services, GitHub, and raw GitHub content. + +The `OraiCommon` class provides methods to initialize chain information from different sources. + +## Token Items Handling: + +Classes like `TokenItems` and `TokenItemsImpl` manage token items. + +The repository includes logic for handling token items, such as fetching and managing token data. + +## Supported Chain Information: + +Classes like `SupportedChainInfoReader` and `SupportedChainInfoReaderFromGit` handle reading supported chain information from GitHub. + +Functions like `readSupportedChainInfo` are used to fetch and process supported chain information. + +## Helpers and Utilities: + +The repository includes various helper functions and utilities in files like `index.ts`, which provide functionalities such as making HTTP requests with retries, parsing transactions, and converting numbers. + +## Constants and Configuration: + +Constants related to chain IDs and registry endpoints are defined in files like `chain-ids.ts` and `chain-registry.ts`. + +## Package Management: + +The repository uses tools like Lerna and Nx for managing multiple packages and their dependencies. The configuration for these tools can be found in files like `lerna.json` and `nx.json`. + +## Documentation: + +The repository includes documentation files like `CHAIN_REGISTRY.md` that provide information about the chain registry mechanism and how to integrate different blockchains with the Oraichain ecosystem. From 23b5238df1b26e13b1cc6cb4f9b48f238e60e12b Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 14:16:18 +0700 Subject: [PATCH 12/84] chore: Refactor code and update supported tokens --- .../src/chain-infos/chain-info-reader.ts | 28 ++------ .../common/src/chain-infos/chain-infos.ts | 7 +- packages/common/src/chain-infos/types.ts | 8 +-- packages/common/src/common.ts | 20 +----- .../common/src/constants/chain-registry.ts | 9 ++- .../common/src/supported/supported-reader.ts | 16 ++--- packages/common/src/supported/supported.ts | 10 +-- .../common/src/token-items/token-items.ts | 64 +++---------------- packages/common/tests/chain-reader-impl.ts | 5 +- packages/common/tests/common.spec.ts | 27 +++----- 10 files changed, 51 insertions(+), 143 deletions(-) diff --git a/packages/common/src/chain-infos/chain-info-reader.ts b/packages/common/src/chain-infos/chain-info-reader.ts index e5f2337..7f9c855 100644 --- a/packages/common/src/chain-infos/chain-info-reader.ts +++ b/packages/common/src/chain-infos/chain-info-reader.ts @@ -4,11 +4,7 @@ import { CHAIN_REGISTRY_GITHUB_API_ENDPOINTS, CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS } from "../constants"; -import { - ChainInfoReader, - ChainInfoReaderFromGitRawOptions, - CustomChainInfo -} from "./types"; +import { ChainInfoReader, ChainInfoReaderFromGitRawOptions, CustomChainInfo } from "./types"; import path from "path"; export class ChainInfoReaderFromBackend implements ChainInfoReader { @@ -30,11 +26,7 @@ export class ChainInfoReaderFromOraiCommon implements ChainInfoReader { constructor(private readonly sourceUrl: string) {} async readChainInfos() { - const chains = (await ( - await fetchRetry( - this.sourceUrl - ) - ).json()) as CustomChainInfo[]; + const chains = (await (await fetchRetry(this.sourceUrl)).json()) as CustomChainInfo[]; return chains; } } @@ -57,23 +49,16 @@ export class ChainInfoReaderFromGit implements ChainInfoReader { options.headers["X-GitHub-Api-Version"] = "2022-11-28"; } const response = await ( - await fetchRetry( - `${CHAIN_REGISTRY_GITHUB_API_ENDPOINTS.BASE_URL}${CHAIN_REGISTRY_GITHUB_API_ENDPOINTS.CHAIN_INFOS}`, - options - ) + await fetchRetry(CHAIN_REGISTRY_GITHUB_API_ENDPOINTS.CHAIN_INFOS, options) ).json(); const responses = ( - await Promise.allSettled( - response.map((chain) => fetchRetry(chain.download_url)) - ) + await Promise.allSettled(response.map((chain) => fetchRetry(chain.download_url))) ) .filter((chain) => chain.status === "fulfilled") .map((chain) => chain.value); - const chains: CustomChainInfo[] = await Promise.all( - responses.map((data) => data.json()) - ); + const chains: CustomChainInfo[] = await Promise.all(responses.map((data) => data.json())); return chains; } } @@ -90,8 +75,7 @@ export class ChainInfoReaderFromGitRaw implements ChainInfoReader { } ) { if (!this.options.baseUrl) - this.options.baseUrl = - CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS.BASE_URL; + this.options.baseUrl = CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS.BASE_URL; this.generateUrls(); } diff --git a/packages/common/src/chain-infos/chain-infos.ts b/packages/common/src/chain-infos/chain-infos.ts index 7498bff..b71c4da 100644 --- a/packages/common/src/chain-infos/chain-infos.ts +++ b/packages/common/src/chain-infos/chain-infos.ts @@ -5,8 +5,7 @@ export class ChainInfosImpl implements ChainInfos { static async create(chainInfoReader: ChainInfoReader) { const chainInfos = await chainInfoReader.readChainInfos(); - const info = new ChainInfosImpl(chainInfos); - return info; + return new ChainInfosImpl(chainInfos); } get evmChains() { @@ -16,4 +15,8 @@ export class ChainInfosImpl implements ChainInfos { get cosmosChains() { return this.chainInfos.filter((c) => c.networkType === "cosmos"); } + + getSpecificChainInfo(chainId: string) { + return this.chainInfos.find((c) => c.chainId === chainId); + } } diff --git a/packages/common/src/chain-infos/types.ts b/packages/common/src/chain-infos/types.ts index 433f39c..0c71cd2 100644 --- a/packages/common/src/chain-infos/types.ts +++ b/packages/common/src/chain-infos/types.ts @@ -1,9 +1,4 @@ -import { - FeeCurrency, - ChainInfo, - Bech32Config, - Currency -} from "@keplr-wallet/types"; +import { FeeCurrency, ChainInfo, Bech32Config, Currency } from "@keplr-wallet/types"; import { NetworkType, CoinType } from "../constants/network"; import { NetworkChainId } from "../constants"; @@ -49,6 +44,7 @@ export interface ChainInfos { chainInfos: CustomChainInfo[]; evmChains: CustomChainInfo[]; cosmosChains: CustomChainInfo[]; + getSpecificChainInfo: (chainId: string) => CustomChainInfo; } export interface ChainInfoReader { diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 03a663c..253c400 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -8,14 +8,10 @@ import { ChainInfosImpl, CustomChainInfo } from "./chain-infos"; -import { SupportedChainInfo, SupportedChainInfoReader } from "./supported"; import { TokenItems, TokenItemsImpl } from "./token-items"; export class OraiCommon { - constructor( - private _chainInfos?: ChainInfos, - private _tokenItems?: TokenItems - ) {} + constructor(private _chainInfos?: ChainInfos, private _tokenItems?: TokenItems) {} static initializeFromCustomChainInfos(customChainInfos: CustomChainInfo[]) { const common = new OraiCommon( @@ -40,23 +36,11 @@ export class OraiCommon { return OraiCommon.initializeFromChainInfoReader(reader); } - static async initializeFromGitRaw( - options?: ChainInfoReaderFromGitRawOptions - ) { + static async initializeFromGitRaw(options?: ChainInfoReaderFromGitRawOptions) { const reader = new ChainInfoReaderFromGitRaw(options); return OraiCommon.initializeFromChainInfoReader(reader); } - static async initializeFromBackendWithSupportedReader( - supportedReader: SupportedChainInfoReader - ) { - const common = await this.initializeFromBackend(); - const supportedChainInfo = await supportedReader.readSupportedChainInfo(); - const filteredTokenItems = - common.tokenItems.withSupportedChainInfo(supportedChainInfo); - return common.withTokenItems(filteredTokenItems); - } - withChainInfos(chainInfos: ChainInfos) { this._chainInfos = chainInfos; return this; diff --git a/packages/common/src/constants/chain-registry.ts b/packages/common/src/constants/chain-registry.ts index cdfbbe4..d1a8c34 100644 --- a/packages/common/src/constants/chain-registry.ts +++ b/packages/common/src/constants/chain-registry.ts @@ -5,9 +5,9 @@ export const CHAIN_REGISTRY_BACKEND_ENDPOINTS = { CHAIN_INFOS: "/chains" } as const; +export const GITHUB_API_BASE_URL = "https://api.github.com"; export const CHAIN_REGISTRY_GITHUB_API_ENDPOINTS = { - BASE_URL: "https://api.github.com", - CHAIN_INFOS: "/repos/oraichain/oraichain-sdk/contents/chains" + CHAIN_INFOS: GITHUB_API_BASE_URL + "/repos/oraichain/oraichain-sdk/contents/chains" }; export const CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS = { @@ -15,6 +15,5 @@ export const CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS = { }; export const ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS = { - BASE_URL: "https://api.github.com", - SUPPORTED_INFO: "/repos/oraichain/oraichain-sdk/contents/supported/" -} + SUPPORTED_INFO: GITHUB_API_BASE_URL + "/repos/oraichain/oraichain-sdk/contents/supported/" +}; diff --git a/packages/common/src/supported/supported-reader.ts b/packages/common/src/supported/supported-reader.ts index 1bea0af..197a257 100644 --- a/packages/common/src/supported/supported-reader.ts +++ b/packages/common/src/supported/supported-reader.ts @@ -2,15 +2,13 @@ import { fetchRetry } from "../helpers"; import { SupportedChainInfo, SupportedChainInfoReader } from "./types"; import { ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS } from "../constants"; -export class SupportedChainInfoReaderFromGit - implements SupportedChainInfoReader -{ - constructor( - private readonly dex: string, - private readonly accessToken: string - ) {} +export class SupportedChainInfoReaderFromGit implements SupportedChainInfoReader { + constructor(private readonly dex: string, private readonly accessToken: string) {} - async readSupportedChainInfo(): Promise { + async readSupportedChainInfo( + // branch name + ref = "feat/read-from-orai-common-backend" + ): Promise { const options = { method: "GET", headers: { @@ -23,7 +21,7 @@ export class SupportedChainInfoReaderFromGit } const res = await ( await fetchRetry( - `${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.BASE_URL}${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.SUPPORTED_INFO}${this.dex}.json?ref=feat/read-from-orai-common-backend`, + `${ORAICHAIN_COMMON_GITHUB_API_ENDPOINTS.SUPPORTED_INFO}${this.dex}.json?ref=${ref}`, options ) ).json(); diff --git a/packages/common/src/supported/supported.ts b/packages/common/src/supported/supported.ts index e34ad3b..0a20893 100644 --- a/packages/common/src/supported/supported.ts +++ b/packages/common/src/supported/supported.ts @@ -1,8 +1,4 @@ -import { - SupportedChainInfo, - SupportedChainInfoReader, - SupportedTokens -} from "./types"; +import { SupportedChainInfo, SupportedChainInfoReader, SupportedTokens } from "./types"; export class SupportChainInfoImpl implements SupportedTokens { constructor(public readonly supportedChainInfo: SupportedChainInfo) {} @@ -16,4 +12,8 @@ export class SupportChainInfoImpl implements SupportedTokens { get oraichainSupportedTokens() { return Object.values(this.supportedChainInfo["oraichain"].coinDenoms); } + + networkSupportedTokens(chainId: string) { + return Object.values(this.supportedChainInfo[chainId]?.coinDenoms); + } } diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 99463ba..3bce2be 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -2,10 +2,8 @@ import { flatten, uniqBy } from "lodash"; import { ChainInfoReader, CustomChainInfo } from "../chain-infos"; import { COSMOS_CHAIN_IDS } from "../constants/chain-ids"; import { IBC_DENOMS } from "../constants/denoms"; -import { TokenItemType } from "./types"; import { NETWORK_TYPES } from "../constants/network"; -import { SupportedChainInfo, SupportedChainInfoReader } from "../supported"; -import { extractCosmosDenomOrCW20Address, isNative } from "../helpers"; +import { TokenItemType } from "./types"; export interface TokenItems { otherChainTokens: TokenItemType[]; @@ -19,33 +17,18 @@ export interface TokenItems { cw20TokenMap: { [k: string]: TokenItemType }; evmTokens: TokenItemType[]; kawaiiTokens: TokenItemType[]; - withSupportedChainInfo: (supportedChainInfo: SupportedChainInfo) => this; } export class TokenItemsImpl implements TokenItems { - // a filter for DEX - private supportedChainInfo: SupportedChainInfo; - constructor(private readonly chainInfos: CustomChainInfo[]) {} - static async create( - chainInfoReader: ChainInfoReader, - supportedChainInfoReader: SupportedChainInfoReader = null - ) { + static async create(chainInfoReader: ChainInfoReader) { const chainInfos = await chainInfoReader.readChainInfos(); - - let supportedChainInfo: SupportedChainInfo; - if (supportedChainInfoReader) { - supportedChainInfo = - await supportedChainInfoReader.readSupportedChainInfo(); - } const tokenItems = new TokenItemsImpl(chainInfos); return tokenItems; } - private getTokensFromNetwork = ( - network: CustomChainInfo - ): TokenItemType[] => { + private getTokensFromNetwork = (network: CustomChainInfo): TokenItemType[] => { if (!network) return []; const evmDenomsMap = { kwt: [IBC_DENOMS.KWTBSC], @@ -62,8 +45,7 @@ export class TokenItemsImpl implements TokenItems { org: network.chainName, coinType: network.bip44.coinType, contractAddress: currency.contractAddress, - prefix: - currency?.prefixToken ?? network.bech32Config?.bech32PrefixAccAddr, + prefix: currency?.prefixToken ?? network.bech32Config?.bech32PrefixAccAddr, coinGeckoId: currency.coinGeckoId, denom: currency.coinMinimalDenom, bridgeNetworkIdentifier: currency.bridgeNetworkIdentifier, @@ -90,18 +72,8 @@ export class TokenItemsImpl implements TokenItems { } get oraichainTokens() { - const oraiTokens = this.getTokensFromNetwork( - this.chainInfos.find( - (chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAICHAIN - ) - ); - - if (!this.supportedChainInfo) return oraiTokens; - - return oraiTokens.filter((token) => - Object.values( - this.supportedChainInfo[COSMOS_CHAIN_IDS.ORAICHAIN].coinDenoms - ).includes(extractCosmosDenomOrCW20Address(token)) + return this.getTokensFromNetwork( + this.chainInfos.find((chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAICHAIN) ); } @@ -118,18 +90,12 @@ export class TokenItemsImpl implements TokenItems { } get assetInfoMap() { - return Object.fromEntries( - this.flattenTokens.map((c) => [c.contractAddress || c.denom, c]) - ); + return Object.fromEntries(this.flattenTokens.map((c) => [c.contractAddress || c.denom, c])); } get cosmosTokens() { return uniqBy( - this.flattenTokens.filter( - (token) => - // !token.contractAddress && - token.denom && token.cosmosBased && token.coinGeckoId - ), + this.flattenTokens.filter((token) => token.denom && token.cosmosBased && token.coinGeckoId), (c) => c.denom ); } @@ -138,25 +104,20 @@ export class TokenItemsImpl implements TokenItems { return uniqBy( this.cosmosTokens.filter( // filter cosmos based tokens to collect tokens that have contract addresses - (token) => - // !token.contractAddress && - token.contractAddress + (token) => token.contractAddress ), (c) => c.denom ); } get cw20TokenMap() { - return Object.fromEntries( - this.cw20Tokens.map((c) => [c.contractAddress, c]) - ); + return Object.fromEntries(this.cw20Tokens.map((c) => [c.contractAddress, c])); } get evmTokens() { return uniqBy( this.flattenTokens.filter( (token) => - // !token.contractAddress && token.denom && !token.cosmosBased && token.coinGeckoId && @@ -172,9 +133,4 @@ export class TokenItemsImpl implements TokenItems { (c) => c.denom ); } - - withSupportedChainInfo(supportedChainInfo: SupportedChainInfo) { - this.supportedChainInfo = supportedChainInfo; - return this; - } } diff --git a/packages/common/tests/chain-reader-impl.ts b/packages/common/tests/chain-reader-impl.ts index f7061b1..02ebb22 100644 --- a/packages/common/tests/chain-reader-impl.ts +++ b/packages/common/tests/chain-reader-impl.ts @@ -4,9 +4,8 @@ import { CustomChainInfo } from "../src/chain-infos/types"; import { ChainInfoReader } from "../src"; export class ChainInfoReaderImpl implements ChainInfoReader { - constructor( - private readonly directory: string = path.join(process.cwd(), "chains") - ) {} + constructor(private readonly directory: string = path.join(process.cwd(), "chains")) {} + async readChainInfos(): Promise { const files = await promises.readdir(this.directory); const jsonFiles = files.filter((file) => path.extname(file) === ".json"); diff --git a/packages/common/tests/common.spec.ts b/packages/common/tests/common.spec.ts index 7e83f41..7f80593 100644 --- a/packages/common/tests/common.spec.ts +++ b/packages/common/tests/common.spec.ts @@ -1,7 +1,6 @@ -import { expect, afterAll, beforeAll, describe, it } from "vitest"; +import { describe, expect, it } from "vitest"; +import { ChainInfosImpl, TokenItemsImpl } from "../src/"; import { OraiCommon } from "../src/common"; -import { ChainInfoReaderFromGitRaw, ChainInfosImpl } from "../src/"; -import { TokenItemsImpl } from "../src/"; import { COSMOS_CHAIN_IDS } from "../src/constants/chain-ids"; import { ChainInfoReaderImpl } from "./chain-reader-impl"; @@ -9,32 +8,24 @@ describe("test common", () => { it("test-chain-info-reader", async () => { const reader = new ChainInfoReaderImpl(); const result = await reader.readChainInfos(); - const oraichainNetwork = result.find( - (chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAIBRIDGE - ); + const oraichainNetwork = result.find((chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAIBRIDGE); expect(oraichainNetwork).not.undefined; }); it("test-chain-infos-getter", async () => { const reader = new ChainInfoReaderImpl(); const chainInfos = await ChainInfosImpl.create(reader); + expect(chainInfos.evmChains.filter((chain) => chain.networkType !== "evm").length).toEqual(0); expect( - chainInfos.evmChains.filter((chain) => chain.networkType !== "evm").length - ).toEqual(0); - expect( - chainInfos.cosmosChains.filter((chain) => chain.networkType !== "cosmos") - .length + chainInfos.cosmosChains.filter((chain) => chain.networkType !== "cosmos").length ).toEqual(0); }); it("test-token-items-getter", async () => { const reader = new ChainInfoReaderImpl(); const tokenItems = await TokenItemsImpl.create(reader); - expect( - tokenItems.cosmosTokens.find( - (chain) => chain.chainId !== COSMOS_CHAIN_IDS.COSMOSHUB - ) - ).not.undefined; + expect(tokenItems.cosmosTokens.find((chain) => chain.chainId !== COSMOS_CHAIN_IDS.COSMOSHUB)) + .not.undefined; }); it("test-common-getters", async () => { @@ -42,9 +33,7 @@ describe("test common", () => { const chainInfos = await ChainInfosImpl.create(reader); const tokenItems = await TokenItemsImpl.create(reader); - const common = new OraiCommon() - .withChainInfos(chainInfos) - .withTokenItems(tokenItems); + const common = new OraiCommon().withChainInfos(chainInfos).withTokenItems(tokenItems); expect(common.chainInfos).not.undefined; expect(common.tokenItems).not.undefined; From 64b0d98a2e5dfa9767c6bfdba878c45a0f6f03a5 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 14:56:43 +0700 Subject: [PATCH 13/84] chore: Update publish_package workflow to trigger only on the feat/dynamic-token-list branch --- .github/workflows/publish_package.yml | 63 +++++++++++++++++++ packages/common/package.json | 2 +- .../common/src/constants/chain-registry.ts | 2 +- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish_package.yml diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml new file mode 100644 index 0000000..0752f7a --- /dev/null +++ b/.github/workflows/publish_package.yml @@ -0,0 +1,63 @@ +name: publish_package + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [feat/dynamic-token-list] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: ["18"] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.8.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v4 + id: yarn-cache + with: + path: | + ${{ steps.yarn-cache-dir-path.outputs.dir }} + ./node_modules/ + key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install Dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn + - name: Build + run: yarn build + - name: Authenticate with private NPM package + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: Publish Oraichain Common + id: publish-oraichain-common + continue-on-error: true + run: yarn deploy packages/common + env: + CI: false + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: send result via discord + uses: appleboy/discord-action@master + with: + webhook_id: ${{ secrets.WEBHOOK_ID }} + webhook_token: ${{ secrets.WEBHOOK_TOKEN }} + username: "GitBot" + message: "Repo oraichain-sdk has just published. @oraichain/common: ${{ steps.publish-oraichain-common.outcome }}. ${{ github.event.head_commit.author.name }}" diff --git a/packages/common/package.json b/packages/common/package.json index f690037..194ea84 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.2", + "version": "1.1.2-beta", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/constants/chain-registry.ts b/packages/common/src/constants/chain-registry.ts index d1a8c34..dc15c84 100644 --- a/packages/common/src/constants/chain-registry.ts +++ b/packages/common/src/constants/chain-registry.ts @@ -1,6 +1,6 @@ export const CHAIN_REGISTRY_BACKEND_ENDPOINTS = { // FIXME: setup a basic backend & URL for fetching & storing all chain infos - BASE_URL: "https://", + BASE_URL: "https://oraicommon-staging.oraidex.io", BASE_ENDPOINT: "/api/v1", CHAIN_INFOS: "/chains" } as const; From 7dad66707a6ff9bab8499874630eeb286a26ccee Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 14:58:52 +0700 Subject: [PATCH 14/84] chore: Enable Corepack and prepare Yarn for publishing package --- .github/workflows/publish_package.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 0752f7a..07fbfe0 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -39,6 +39,12 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- + + - name: Enable Corepack + run: corepack enable + - name: Prepare Yarn + run: corepack prepare yarn@4.3.1 --activate + - name: Install Dependencies if: steps.yarn-cache.outputs.cache-hit != 'true' run: yarn From 5c861e50d000f5639972b1680a9d92eccfebfb9c Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 15:00:49 +0700 Subject: [PATCH 15/84] chore: Update npm dependency to latest stable version --- yarn.lock | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index f1b5ce9..696ac8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1619,7 +1619,22 @@ __metadata: languageName: node linkType: hard -"@oraichain/common@npm:^1.1.1, @oraichain/common@workspace:packages/common": +"@oraichain/common@npm:^1.1.1": + version: 1.1.1 + resolution: "@oraichain/common@npm:1.1.1" + dependencies: + "@keplr-wallet/types": "npm:0.12.141" + axios: "npm:0.21.4" + axios-extensions: "npm:3.1.6" + bech32: "npm:^1.1.4" + cosmjs-types: "npm:^0.8.0" + ethers: "npm:^5.5.1" + lodash: "npm:^4.17.21" + checksum: 10c0/71bdd9abd0d77394fae7b35effd5fcda326c7f0baabd4203e903b392ed376712e838f3d339fb137afa9b99a8f0686c96556ee9ca355bff3d851151c740bbb92f + languageName: node + linkType: hard + +"@oraichain/common@workspace:packages/common": version: 0.0.0-use.local resolution: "@oraichain/common@workspace:packages/common" dependencies: From 8e75c4764c80ce42163367db355cf6f004464506 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:16:47 +0700 Subject: [PATCH 16/84] chore: Update package version to 1.1.2_beta --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index 194ea84..c6f3ffd 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.2-beta", + "version": "1.1.2_beta", "main": "build/index.js", "license": "MIT", "scripts": { From 324d3df1a34913b404f6833da2feddd13b438a51 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:18:55 +0700 Subject: [PATCH 17/84] chore: Update package version to 1.1.2 --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index c6f3ffd..f690037 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.2_beta", + "version": "1.1.2", "main": "build/index.js", "license": "MIT", "scripts": { From 77815c5a1ac0b950e51b7217fca5798306ece99c Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:21:03 +0700 Subject: [PATCH 18/84] chore: Update deploy script to use yarn publish --access public --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2ba6af..eb8714c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "clean": "nx reset && lerna clean --yes && lerna exec -- rimraf build/ dist/ cache/", "build": "lerna run build --concurrency 1", "build-tsc": "tsc -p", - "deploy": "yarn build && lerna publish", + "deploy": "yarn publish --access public", "build:docker": "lerna run build --concurrency 1" }, "workspaces": [ From 557cdc7b7e0220003a1fb188d5589c1454d4d02e Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:26:33 +0700 Subject: [PATCH 19/84] chore: Update deploy script to use yarn npm publish --access public --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb8714c..2535a3b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "clean": "nx reset && lerna clean --yes && lerna exec -- rimraf build/ dist/ cache/", "build": "lerna run build --concurrency 1", "build-tsc": "tsc -p", - "deploy": "yarn publish --access public", + "deploy": "yarn npm publish --access public", "build:docker": "lerna run build --concurrency 1" }, "workspaces": [ From 1c8b21704ad3100a056e98cf1af16e24f95408b3 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:35:43 +0700 Subject: [PATCH 20/84] chore: Update deploy script to use yarn --cwd packages/common deploy --- .github/workflows/publish_package.yml | 2 +- packages/common/package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 07fbfe0..16bb584 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -56,7 +56,7 @@ jobs: - name: Publish Oraichain Common id: publish-oraichain-common continue-on-error: true - run: yarn deploy packages/common + run: yarn --cwd packages/common deploy env: CI: false NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/packages/common/package.json b/packages/common/package.json index f690037..fcf39af 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -4,7 +4,8 @@ "main": "build/index.js", "license": "MIT", "scripts": { - "build": "tsc -p tsconfig.json" + "build": "tsc -p tsconfig.json", + "deploy": "yarn npm publish --access public" }, "files": [ "build/" From 52c95ec49cca26818920ab0f3708317342d36e80 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:40:59 +0700 Subject: [PATCH 21/84] chore: Add NODE_AUTH_TOKEN to the publish_package workflow --- .github/workflows/publish_package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 16bb584..ce3ba7a 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -60,6 +60,7 @@ jobs: env: CI: false NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: send result via discord uses: appleboy/discord-action@master with: From 74cc2975fde63f181c316e0f210a37b90f7978bc Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:48:42 +0700 Subject: [PATCH 22/84] chore: Update publish_package workflow to trigger only on the feat/dynamic-token-list branch --- .github/workflows/publish_package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index ce3ba7a..5d9b4ba 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -59,7 +59,6 @@ jobs: run: yarn --cwd packages/common deploy env: CI: false - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: send result via discord uses: appleboy/discord-action@master From ebe7041b756da6c8ffdbf286a19051c3ae10b29e Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:50:55 +0700 Subject: [PATCH 23/84] chore: Update publish_package workflow to use npmAuthToken instead of _authToken --- .github/workflows/publish_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 5d9b4ba..d9b744e 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -51,7 +51,7 @@ jobs: - name: Build run: yarn build - name: Authenticate with private NPM package - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + run: echo "//registry.npmjs.org/:npmAuthToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: Publish Oraichain Common id: publish-oraichain-common From e58690d89dd1b1510c489470f127815b832ca824 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 16:53:22 +0700 Subject: [PATCH 24/84] chore: Update publish_package workflow to use npmAuthToken instead of _authToken --- .github/workflows/publish_package.yml | 14 +++++++------- .yarnrc.yml | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index d9b744e..49e1304 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -60,10 +60,10 @@ jobs: env: CI: false NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: send result via discord - uses: appleboy/discord-action@master - with: - webhook_id: ${{ secrets.WEBHOOK_ID }} - webhook_token: ${{ secrets.WEBHOOK_TOKEN }} - username: "GitBot" - message: "Repo oraichain-sdk has just published. @oraichain/common: ${{ steps.publish-oraichain-common.outcome }}. ${{ github.event.head_commit.author.name }}" + # - name: send result via discord + # uses: appleboy/discord-action@master + # with: + # webhook_id: ${{ secrets.WEBHOOK_ID }} + # webhook_token: ${{ secrets.WEBHOOK_TOKEN }} + # username: "GitBot" + # message: "Repo oraichain-sdk has just published. @oraichain/common: ${{ steps.publish-oraichain-common.outcome }}. ${{ github.event.head_commit.author.name }}" diff --git a/.yarnrc.yml b/.yarnrc.yml index 8b757b2..1a22c4a 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1,2 @@ -nodeLinker: node-modules \ No newline at end of file +nodeLinker: node-modules +npmAuthToken: ${{ secrets.NPM_TOKEN }} From cd68706d9ea22d51c5b8be56bade8b77ab4cd955 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 17:22:19 +0700 Subject: [PATCH 25/84] chore: Configure registry for NPM package publishing --- .github/workflows/publish_package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 49e1304..11db977 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -53,6 +53,8 @@ jobs: - name: Authenticate with private NPM package run: echo "//registry.npmjs.org/:npmAuthToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + - name: Config registry + run: yarn config set registry https://registry.npmjs.org/ - name: Publish Oraichain Common id: publish-oraichain-common continue-on-error: true From d3b994811ebdb2652a2c6c2e1564f8436fd82e0f Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 17:26:16 +0700 Subject: [PATCH 26/84] chore: Update NPM registry configuration for package publishing --- .github/workflows/publish_package.yml | 2 -- .yarnrc.yml | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 11db977..49e1304 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -53,8 +53,6 @@ jobs: - name: Authenticate with private NPM package run: echo "//registry.npmjs.org/:npmAuthToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - - name: Config registry - run: yarn config set registry https://registry.npmjs.org/ - name: Publish Oraichain Common id: publish-oraichain-common continue-on-error: true diff --git a/.yarnrc.yml b/.yarnrc.yml index 1a22c4a..1bf57fd 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,2 +1,3 @@ nodeLinker: node-modules npmAuthToken: ${{ secrets.NPM_TOKEN }} +npmRegistryServer: "https://registry.npmjs.org" From e97d01821494e0b18ea30d466f69044cda7a9a51 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 6 Nov 2024 17:56:11 +0700 Subject: [PATCH 27/84] chore: Update publish_package workflow to use npmAuthToken instead of _authToken --- .github/workflows/publish_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 49e1304..2d0f238 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -51,7 +51,7 @@ jobs: - name: Build run: yarn build - name: Authenticate with private NPM package - run: echo "//registry.npmjs.org/:npmAuthToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: Publish Oraichain Common id: publish-oraichain-common From 14176b9fcc1984ebaef12f3459d0c51cf25ea762 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 7 Nov 2024 11:05:51 +0700 Subject: [PATCH 28/84] feat: Add method to retrieve specific chain tokens by chainId --- packages/common/src/token-items/token-items.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 3bce2be..6ef8960 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -63,6 +63,10 @@ export class TokenItemsImpl implements TokenItems { }); }; + getSpecificChainTokens(chainId: string) { + return this.getTokensFromNetwork(this.chainInfos.find((chain) => chain.chainId === chainId)); + } + get otherChainTokens() { return flatten( this.chainInfos From f2a45cda3e8d295bcd6e057155f0ff367b342371 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 7 Nov 2024 11:46:05 +0700 Subject: [PATCH 29/84] chore: Update deployment script to use lerna for publishing packages --- .github/workflows/publish_package.yml | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 2d0f238..4b4e63e 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -56,10 +56,11 @@ jobs: - name: Publish Oraichain Common id: publish-oraichain-common continue-on-error: true - run: yarn --cwd packages/common deploy + run: yarn deploy env: CI: false NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # - name: send result via discord # uses: appleboy/discord-action@master # with: diff --git a/package.json b/package.json index 2535a3b..5ec2b5e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "clean": "nx reset && lerna clean --yes && lerna exec -- rimraf build/ dist/ cache/", "build": "lerna run build --concurrency 1", "build-tsc": "tsc -p", - "deploy": "yarn npm publish --access public", + "deploy": "lerna publish from-package", "build:docker": "lerna run build --concurrency 1" }, "workspaces": [ From 5e4b9ae7b62e45a390376600b5a0194813b07079 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 7 Nov 2024 11:53:00 +0700 Subject: [PATCH 30/84] chore: Update deployment scripts for CI and modify package publish commands --- .github/workflows/publish_package.yml | 2 +- package.json | 3 ++- packages/common/package.json | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 4b4e63e..a398f4e 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -56,7 +56,7 @@ jobs: - name: Publish Oraichain Common id: publish-oraichain-common continue-on-error: true - run: yarn deploy + run: yarn deploy:ci env: CI: false NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 5ec2b5e..d445ad4 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "clean": "nx reset && lerna clean --yes && lerna exec -- rimraf build/ dist/ cache/", "build": "lerna run build --concurrency 1", "build-tsc": "tsc -p", - "deploy": "lerna publish from-package", + "deploy": "yarn build && lerna publish", + "deploy:ci": "lerna publish from-package --yes", "build:docker": "lerna run build --concurrency 1" }, "workspaces": [ diff --git a/packages/common/package.json b/packages/common/package.json index fcf39af..f690037 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -4,8 +4,7 @@ "main": "build/index.js", "license": "MIT", "scripts": { - "build": "tsc -p tsconfig.json", - "deploy": "yarn npm publish --access public" + "build": "tsc -p tsconfig.json" }, "files": [ "build/" From dff0e6ed3b3a4597907eb6e4d8a77111b1e5a87d Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 7 Nov 2024 15:49:00 +0700 Subject: [PATCH 31/84] feat: Add Discord notification step to publish workflow and include method to retrieve specific chain tokens --- .github/workflows/publish_package.yml | 14 +++++++------- packages/common/src/token-items/token-items.ts | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index a398f4e..a335e30 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -61,10 +61,10 @@ jobs: CI: false NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - # - name: send result via discord - # uses: appleboy/discord-action@master - # with: - # webhook_id: ${{ secrets.WEBHOOK_ID }} - # webhook_token: ${{ secrets.WEBHOOK_TOKEN }} - # username: "GitBot" - # message: "Repo oraichain-sdk has just published. @oraichain/common: ${{ steps.publish-oraichain-common.outcome }}. ${{ github.event.head_commit.author.name }}" + - name: send result via discord + uses: appleboy/discord-action@master + with: + webhook_id: ${{ secrets.WEBHOOK_ID }} + webhook_token: ${{ secrets.WEBHOOK_TOKEN }} + username: "GitBot" + message: "Repo oraichain-sdk has just published. @oraichain/common: ${{ steps.publish-oraichain-common.outcome }}. ${{ github.event.head_commit.author.name }}" diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 6ef8960..39d79a3 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -17,6 +17,7 @@ export interface TokenItems { cw20TokenMap: { [k: string]: TokenItemType }; evmTokens: TokenItemType[]; kawaiiTokens: TokenItemType[]; + getSpecificChainTokens: (chainId: string) => TokenItemType[]; } export class TokenItemsImpl implements TokenItems { From a254e5c68342bb49b776cb014e26de82b0c27c13 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 7 Nov 2024 16:14:20 +0700 Subject: [PATCH 32/84] chore: Bump version to 1.1.3 in package.json --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index f690037..edba1d1 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.2", + "version": "1.1.3", "main": "build/index.js", "license": "MIT", "scripts": { From 10c88c50b407e0f6d41a97c33816c638d7d72d9d Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 8 Nov 2024 14:00:01 +0700 Subject: [PATCH 33/84] feat: Add icon property to TokenItemType and update TokenItemsImpl to include coin image URL --- packages/common/src/token-items/token-items.ts | 3 ++- packages/common/src/token-items/types.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 39d79a3..37b09db 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -59,7 +59,8 @@ export class TokenItemsImpl implements TokenItems { maxGas: (network.feeCurrencies?.[0].gasPriceStep?.high ?? 0) * 20000, gasPriceStep: currency.gasPriceStep, feeCurrencies: network.feeCurrencies, - evmDenoms + evmDenoms, + icon: currency.coinImageUrl }; }); }; diff --git a/packages/common/src/token-items/types.ts b/packages/common/src/token-items/types.ts index 188600a..27ba639 100644 --- a/packages/common/src/token-items/types.ts +++ b/packages/common/src/token-items/types.ts @@ -22,4 +22,5 @@ export type TokenItemType = { readonly high: number; }; feeCurrencies?: FeeCurrency[]; + icon: string; }; From b9200908aba8ed9e0570a2f12bedb57d4bcf22c1 Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 8 Nov 2024 14:00:23 +0700 Subject: [PATCH 34/84] chore: Bump version to 1.1.4 in package.json --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index edba1d1..056869e 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.3", + "version": "1.1.4", "main": "build/index.js", "license": "MIT", "scripts": { From 2e59e290e23e2f9aee405ef26b21fc197b59ea5e Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 8 Nov 2024 16:39:38 +0700 Subject: [PATCH 35/84] feat: Bump version to 1.1.5 and update coinDecimals type to include 9; add chainLogo properties to CustomChainInfo --- packages/common/package.json | 2 +- packages/common/src/chain-infos/types.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 056869e..630287a 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.1.4", + "version": "1.1.5", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/chain-infos/types.ts b/packages/common/src/chain-infos/types.ts index 0c71cd2..5367585 100644 --- a/packages/common/src/chain-infos/types.ts +++ b/packages/common/src/chain-infos/types.ts @@ -6,7 +6,7 @@ export type BridgeAppCurrency = FeeCurrency & { readonly bridgeTo?: string[]; readonly coinGeckoId?: string; readonly bridgeNetworkIdentifier?: string; - readonly coinDecimals: 6 | 8 | 14 | 18; // 6 for cosmos, 8 for bitcoin, 18 for evm + readonly coinDecimals: 6 | 8 | 9 | 14 | 18; // 6 for cosmos, 8 for bitcoin, 18 for evm readonly contractAddress?: string; readonly prefixToken?: string; }; @@ -38,6 +38,8 @@ export interface CustomChainInfo readonly txUrl: string; readonly accountUrl?: string; }; + readonly chainLogoPng?: string; + readonly chainLogoSvg?: string; } export interface ChainInfos { From 11e029f28a253babe6bd575ce9b2c463a8c08fdd Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 18 Nov 2024 11:49:20 +0700 Subject: [PATCH 36/84] feat: add bsc pepe --- chains/0x38.json | 10 ++++++++++ packages/common/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/chains/0x38.json b/chains/0x38.json index 0ba9820..5ee4f58 100644 --- a/chains/0x38.json +++ b/chains/0x38.json @@ -82,6 +82,16 @@ "coinGeckoId": "dogecoin", "bridgeTo": ["Oraichain"], "coinImageUrl": "https://assets.coingecko.com/coins/images/5/standard/dogecoin.png?1696501409" + }, + { + "coinDenom": "PEPE", + "coinMinimalDenom": "erc20:0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00:Pepe", + "contractAddress": "0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00", + "coinDecimals": 18, + "coinGeckoId": "pepe", + "bridgeTo": ["Oraichain"], + "prefixToken": "oraib", + "coinImageUrl": "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776" } ], "txExplorer": { diff --git a/packages/common/package.json b/packages/common/package.json index e042c95..67ed8f0 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1", + "version": "1.2.2", "main": "build/index.js", "license": "MIT", "scripts": { From a5857d2307840eb5a4f2e5fb13716fd9602a5b7d Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 18 Nov 2024 14:26:30 +0700 Subject: [PATCH 37/84] fix: update fee currency for evm --- chains/0x01.json | 12 ++++++++++++ chains/0x1ae6.json | 12 ++++++++++++ chains/0x2b6653dc.json | 13 +++++++++++++ chains/0x38.json | 12 ++++++++++++ 4 files changed, 49 insertions(+) diff --git a/chains/0x01.json b/chains/0x01.json index fa7c605..780d797 100644 --- a/chains/0x01.json +++ b/chains/0x01.json @@ -7,6 +7,18 @@ "coinType": 60, "networkType": "evm", "features": ["isEvm"], + "feeCurrencies": [ + { + "coinDenom": "ETH", + "coinMinimalDenom": "eth", + "contractAddress": "", + "coinDecimals": 18, + "bridgeTo": ["Oraichain"], + "coinGeckoId": "ethereum", + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png", + "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } + } + ], "currencies": [ { "coinDenom": "ORAI", diff --git a/chains/0x1ae6.json b/chains/0x1ae6.json index 99d668d..4ad851d 100644 --- a/chains/0x1ae6.json +++ b/chains/0x1ae6.json @@ -7,6 +7,18 @@ "bip44": { "coinType": 60 }, "coinType": 60, "features": ["isEvm"], + "feeCurrencies": [ + { + "coinDenom": "ERC20 KWT", + "bridgeTo": ["Oraichain", "kawaii_6886-1"], + "coinMinimalDenom": "erc20:0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd:Kawaii Islands", + "contractAddress": "0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd", + "coinDecimals": 18, + "coinGeckoId": "kawaii-islands", + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/12313.png", + "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } + } + ], "currencies": [ { "coinDenom": "ERC20 MILKY", diff --git a/chains/0x2b6653dc.json b/chains/0x2b6653dc.json index 98fb127..0861bdb 100644 --- a/chains/0x2b6653dc.json +++ b/chains/0x2b6653dc.json @@ -6,6 +6,19 @@ "networkType": "evm", "chainName": "tronnetwork", "features": ["isEvm"], + "feeCurrencies": [ + { + "coinDenom": "wTRX", + "coinMinimalDenom": "trx20_trx", + "contractAddress": "0x891cdb91d149f23B1a45D9c5Ca78a88d0cB44C18", + "bridgeTo": ["Oraichain"], + "coinDecimals": 6, + "coinGeckoId": "tron", + "prefixToken": "trontrx-mainnet", + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png", + "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } + } + ], "currencies": [ { "coinDenom": "USDT", diff --git a/chains/0x38.json b/chains/0x38.json index 5ee4f58..7c82795 100644 --- a/chains/0x38.json +++ b/chains/0x38.json @@ -7,6 +7,18 @@ "bip44": { "coinType": 60 }, "coinType": 60, "features": ["isEvm"], + "feeCurrencies": [ + { + "coinDenom": "BNB", + "coinMinimalDenom": "bnb", + "contractAddress": "", + "coinDecimals": 18, + "coinGeckoId": "binancecoin", + "bridgeTo": ["Oraichain"], + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png", + "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } + } + ], "currencies": [ { "coinDenom": "ORAI", From 5d6e2093fb89f5d09b485af12dd03e3f1d929920 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 18 Nov 2024 17:09:00 +0700 Subject: [PATCH 38/84] fix: update fee currency for evm --- chains/0x01.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chains/0x01.json b/chains/0x01.json index 780d797..600befe 100644 --- a/chains/0x01.json +++ b/chains/0x01.json @@ -88,6 +88,16 @@ "coinGeckoId": "oraidex", "prefixToken": "eth-mainnet", "coinImageUrl": "https://i.ibb.co/VmMJtf7/oraix.png" + }, + { + "coinDenom": "PEPE", + "coinMinimalDenom": "erc20:0x6982508145454Ce325dDbE47a25d4ec3d2311933:Pepe", + "contractAddress": "0x6982508145454Ce325dDbE47a25d4ec3d2311933", + "coinDecimals": 18, + "bridgeTo": ["Oraichain"], + "coinGeckoId": "pepe", + "prefixToken": "eth-mainnet", + "coinImageUrl": "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776" } ], "txExplorer": { From b582c6c20cc430796bf399e7dcaf9c6eec4cf447 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Fri, 22 Nov 2024 15:10:26 +0700 Subject: [PATCH 39/84] fix: patch pkg --- .yarnrc.yml | 4 +- .../@cosmjs+cosmwasm-stargate+0.31.3.patch | 87 ------------ .../@cosmjs+cosmwasm-stargate+0.32.4.patch | 64 +++++++++ patches/@cosmjs+stargate+0.31.3.patch | 87 ------------ patches/@cosmjs+stargate+0.32.4.patch | 72 ++++++++++ patches/@cosmjs+tendermint-rpc+0.31.3.patch | 134 ------------------ 6 files changed, 139 insertions(+), 309 deletions(-) delete mode 100644 patches/@cosmjs+cosmwasm-stargate+0.31.3.patch create mode 100644 patches/@cosmjs+cosmwasm-stargate+0.32.4.patch delete mode 100644 patches/@cosmjs+stargate+0.31.3.patch create mode 100644 patches/@cosmjs+stargate+0.32.4.patch delete mode 100644 patches/@cosmjs+tendermint-rpc+0.31.3.patch diff --git a/.yarnrc.yml b/.yarnrc.yml index 1bf57fd..d11e0b7 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,3 +1,5 @@ nodeLinker: node-modules -npmAuthToken: ${{ secrets.NPM_TOKEN }} + +npmAuthToken: "${{ secrets.NPM_TOKEN }}" + npmRegistryServer: "https://registry.npmjs.org" diff --git a/patches/@cosmjs+cosmwasm-stargate+0.31.3.patch b/patches/@cosmjs+cosmwasm-stargate+0.31.3.patch deleted file mode 100644 index b162100..0000000 --- a/patches/@cosmjs+cosmwasm-stargate+0.31.3.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts -index 3aebdc5..7fa6509 100644 ---- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts -+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts -@@ -1,5 +1,6 @@ - import { Account, AuthExtension, BankExtension, Block, Coin, DeliverTxResponse, IndexedTx, QueryClient, SearchTxQuery, SequenceResponse, TxExtension } from "@cosmjs/stargate"; - import { HttpEndpoint, TendermintClient } from "@cosmjs/tendermint-rpc"; -+import { QueryAllContractStateResponse } from "cosmjs-types/cosmwasm/wasm/v1/query"; - import { JsonObject, WasmExtension } from "./modules"; - export interface Code { - readonly id: number; -@@ -49,7 +50,7 @@ export declare class CosmWasmClient { - * This uses auto-detection to decide between a Tendermint 0.37 and 0.34 client. - * To set the Tendermint client explicitly, use `create`. - */ -- static connect(endpoint: string | HttpEndpoint): Promise; -+ static connect(endpoint: string | HttpEndpoint, desiredHeight?: number): Promise; - /** - * Creates an instance from a manually created Tendermint client. - * Use this to use `Tendermint37Client` instead of `Tendermint34Client`. -@@ -136,5 +137,6 @@ export declare class CosmWasmClient { - * Promise is rejected for invalid response format. - */ - queryContractSmart(address: string, queryMsg: JsonObject): Promise; -+ getAllContractState(address: string, paginationKey: Uint8Array): Promise; - private txsQuery; - } -diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js -index 8f6305b..093a700 100644 ---- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js -+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js -@@ -17,18 +17,18 @@ class CosmWasmClient { - * This uses auto-detection to decide between a Tendermint 0.37 and 0.34 client. - * To set the Tendermint client explicitly, use `create`. - */ -- static async connect(endpoint) { -+ static async connect(endpoint, desiredHeight) { - // Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 - // Using 0.34 as the fallback. - let tmClient; -- const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint); -+ const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint, desiredHeight); - const version = (await tm37Client.status()).nodeInfo.version; - if (version.startsWith("0.37.")) { - tmClient = tm37Client; - } - else { - tm37Client.disconnect(); -- tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); -+ tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint, desiredHeight); - } - return CosmWasmClient.create(tmClient); - } -@@ -351,6 +351,33 @@ class CosmWasmClient { - } - } - } -+ -+ /** -+ * Makes a smart query on the contract, returns the parsed JSON document. -+ * -+ * Promise is rejected when contract does not exist. -+ * Promise is rejected for invalid query format. -+ * Promise is rejected for invalid response format. -+ */ -+ async getAllContractState(address, paginationKey) { -+ try { -+ return await this.forceGetQueryClient().wasm.getAllContractState(address, paginationKey); -+ } -+ catch (error) { -+ if (error instanceof Error) { -+ if (error.message.startsWith("not found: contract")) { -+ throw new Error(`No contract found at address "${address}"`); -+ } -+ else { -+ throw error; -+ } -+ } -+ else { -+ throw error; -+ } -+ } -+ } -+ - async txsQuery(query) { - const results = await this.forceGetTmClient().txSearchAll({ query: query }); - return results.txs.map((tx) => { diff --git a/patches/@cosmjs+cosmwasm-stargate+0.32.4.patch b/patches/@cosmjs+cosmwasm-stargate+0.32.4.patch new file mode 100644 index 0000000..12b3599 --- /dev/null +++ b/patches/@cosmjs+cosmwasm-stargate+0.32.4.patch @@ -0,0 +1,64 @@ +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts +index a770785..3f427c8 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts +@@ -58,6 +58,7 @@ export declare class CosmWasmClient { + protected constructor(cometClient: CometClient | undefined); + protected getCometClient(): CometClient | undefined; + protected forceGetCometClient(): CometClient; ++ public setQueryClientWithHeight(height?: number): void; + protected getQueryClient(): (QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension) | undefined; + protected forceGetQueryClient(): QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension; + getChainId(): Promise; +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js +index af8341d..bc91fbc 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js +@@ -35,6 +35,13 @@ class CosmWasmClient { + this.queryClient = stargate_1.QueryClient.withExtensions(cometClient, stargate_1.setupAuthExtension, stargate_1.setupBankExtension, modules_1.setupWasmExtension, stargate_1.setupTxExtension); + } + } ++ ++ setQueryClientWithHeight(height = undefined) { ++ if (this.tmClient) { ++ this.queryClient = stargate_1.QueryClient.withExtensionsWithHeight(this.tmClient, height, stargate_1.setupAuthExtension, stargate_1.setupBankExtension, modules_1.setupWasmExtension, stargate_1.setupTxExtension); ++ } ++ } ++ + getCometClient() { + return this.cometClient; + } +@@ -120,12 +127,12 @@ class CosmWasmClient { + else if ((0, stargate_1.isSearchTxQueryArray)(query)) { + rawQuery = query + .map((t) => { +- // numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462 +- if (typeof t.value === "string") +- return `${t.key}='${t.value}'`; +- else +- return `${t.key}=${t.value}`; +- }) ++ // numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462 ++ if (typeof t.value === "string") ++ return `${t.key}='${t.value}'`; ++ else ++ return `${t.key}=${t.value}`; ++ }) + .join(" AND "); + } + else { +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js b/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js +index e5bf448..878f7e4 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js +@@ -4,8 +4,8 @@ exports.setupWasmExtension = void 0; + const encoding_1 = require("@cosmjs/encoding"); + const stargate_1 = require("@cosmjs/stargate"); + const query_1 = require("cosmjs-types/cosmwasm/wasm/v1/query"); +-function setupWasmExtension(base) { +- const rpc = (0, stargate_1.createProtobufRpcClient)(base); ++function setupWasmExtension(base, height) { ++ const rpc = (0, stargate_1.createProtobufRpcClient)(base, height); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); diff --git a/patches/@cosmjs+stargate+0.31.3.patch b/patches/@cosmjs+stargate+0.31.3.patch deleted file mode 100644 index 279ef09..0000000 --- a/patches/@cosmjs+stargate+0.31.3.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.js b/node_modules/@cosmjs/stargate/build/queryclient/utils.js -index 6f4ecaa..b4f6d6b 100644 ---- a/node_modules/@cosmjs/stargate/build/queryclient/utils.js -+++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.js -@@ -32,7 +32,7 @@ function createProtobufRpcClient(base) { - return { - request: async (service, method, data) => { - const path = `/${service}/${method}`; -- const response = await base.queryAbci(path, data, undefined); -+ const response = await base.queryAbci(path, data, base.tmClient.desiredHeight); - return response.value; - }, - }; -diff --git a/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts b/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts -index b8ca38c..e954160 100644 ---- a/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts -+++ b/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts -@@ -28,6 +28,7 @@ export interface SigningStargateClientOptions extends StargateClientOptions { - readonly broadcastTimeoutMs?: number; - readonly broadcastPollIntervalMs?: number; - readonly gasPrice?: GasPrice; -+ readonly desiredHeight?: number; - } - export declare function createDefaultAminoConverters(): AminoConverters; - export declare class SigningStargateClient extends StargateClient { -diff --git a/node_modules/@cosmjs/stargate/build/signingstargateclient.js b/node_modules/@cosmjs/stargate/build/signingstargateclient.js -index 4330b9f..4a470c3 100644 ---- a/node_modules/@cosmjs/stargate/build/signingstargateclient.js -+++ b/node_modules/@cosmjs/stargate/build/signingstargateclient.js -@@ -58,14 +58,14 @@ class SigningStargateClient extends stargateclient_1.StargateClient { - // Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 - // Using 0.34 as the fallback. - let tmClient; -- const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint); -+ const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint, options.desiredHeight); - const version = (await tm37Client.status()).nodeInfo.version; - if (version.startsWith("0.37.")) { - tmClient = tm37Client; - } - else { - tm37Client.disconnect(); -- tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); -+ tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint, options.desiredHeight); - } - return SigningStargateClient.createWithSigner(tmClient, signer, options); - } -diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.d.ts b/node_modules/@cosmjs/stargate/build/stargateclient.d.ts -index 0cd6feb..b5fc618 100644 ---- a/node_modules/@cosmjs/stargate/build/stargateclient.d.ts -+++ b/node_modules/@cosmjs/stargate/build/stargateclient.d.ts -@@ -137,6 +137,7 @@ export interface PrivateStargateClient { - } - export interface StargateClientOptions { - readonly accountParser?: AccountParser; -+ readonly desiredHeight?: number; - } - export declare class StargateClient { - private readonly tmClient; -diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.js b/node_modules/@cosmjs/stargate/build/stargateclient.js -index 3268b13..3845295 100644 ---- a/node_modules/@cosmjs/stargate/build/stargateclient.js -+++ b/node_modules/@cosmjs/stargate/build/stargateclient.js -@@ -70,14 +70,14 @@ class StargateClient { - // Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 - // Using 0.34 as the fallback. - let tmClient; -- const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint); -+ const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint, options.desiredHeight); - const version = (await tm37Client.status()).nodeInfo.version; - if (version.startsWith("0.37.")) { - tmClient = tm37Client; - } - else { - tm37Client.disconnect(); -- tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); -+ tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint, options.desiredHeight); - } - return StargateClient.create(tmClient, options); - } -@@ -299,6 +299,7 @@ class StargateClient { - return results.txs.map((tx) => { - const txMsgData = abci_1.TxMsgData.decode(tx.result.data ?? new Uint8Array()); - return { -+ ...tx, - height: tx.height, - txIndex: tx.index, - hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(), diff --git a/patches/@cosmjs+stargate+0.32.4.patch b/patches/@cosmjs+stargate+0.32.4.patch new file mode 100644 index 0000000..667a8c4 --- /dev/null +++ b/patches/@cosmjs+stargate+0.32.4.patch @@ -0,0 +1,72 @@ +diff --git a/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js b/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js +index 634b2e5..c2daa9c 100644 +--- a/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js ++++ b/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js +@@ -32,6 +32,24 @@ class QueryClient { + } + return client; + } ++ ++ static withExtensionsWithHeight(cometClient, height, ...extensionSetups) { ++ const client = new QueryClient(cometClient, height); ++ const extensions = extensionSetups.map((setupExtension) => setupExtension(client, height)); ++ for (const extension of extensions) { ++ (0, utils_1.assert)((0, utils_1.isNonNullObject)(extension), `Extension must be a non-null object`); ++ for (const [moduleKey, moduleValue] of Object.entries(extension)) { ++ (0, utils_1.assert)((0, utils_1.isNonNullObject)(moduleValue), `Module must be a non-null object. Found type ${typeof moduleValue} for module "${moduleKey}".`); ++ const current = client[moduleKey] || {}; ++ client[moduleKey] = { ++ ...current, ++ ...moduleValue, ++ }; ++ } ++ } ++ return client; ++ } ++ + constructor(cometClient) { + this.cometClient = cometClient; + } +diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts +index ec5b471..92d5737 100644 +--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts ++++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts +@@ -18,7 +18,7 @@ export declare function createPagination(paginationKey?: Uint8Array): PageReques + export interface ProtobufRpcClient { + request(service: string, method: string, data: Uint8Array): Promise; + } +-export declare function createProtobufRpcClient(base: QueryClient): ProtobufRpcClient; ++export declare function createProtobufRpcClient(base: QueryClient, height?: number): ProtobufRpcClient; + /** + * Takes a uint64 value as string, number, BigInt or Uint64 and returns a BigInt + * of it. +diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.js b/node_modules/@cosmjs/stargate/build/queryclient/utils.js +index ea25080..a0cb539 100644 +--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.js ++++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.js +@@ -24,11 +24,11 @@ function createPagination(paginationKey) { + return paginationKey ? pagination_1.PageRequest.fromPartial({ key: paginationKey }) : pagination_1.PageRequest.fromPartial({}); + } + exports.createPagination = createPagination; +-function createProtobufRpcClient(base) { ++function createProtobufRpcClient(base, height = undefined) { + return { + request: async (service, method, data) => { + const path = `/${service}/${method}`; +- const response = await base.queryAbci(path, data, undefined); ++ const response = await base.queryAbci(path, data, height); + return response.value; + }, + }; +diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.js b/node_modules/@cosmjs/stargate/build/stargateclient.js +index a6da130..0918f14 100644 +--- a/node_modules/@cosmjs/stargate/build/stargateclient.js ++++ b/node_modules/@cosmjs/stargate/build/stargateclient.js +@@ -297,6 +297,7 @@ class StargateClient { + return results.txs.map((tx) => { + const txMsgData = abci_1.TxMsgData.decode(tx.result.data ?? new Uint8Array()); + return { ++ ...tx, + height: tx.height, + txIndex: tx.index, + hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(), diff --git a/patches/@cosmjs+tendermint-rpc+0.31.3.patch b/patches/@cosmjs+tendermint-rpc+0.31.3.patch deleted file mode 100644 index 34e5a12..0000000 --- a/patches/@cosmjs+tendermint-rpc+0.31.3.patch +++ /dev/null @@ -1,134 +0,0 @@ -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts -index 533ef38..925fcf6 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts -@@ -8,11 +8,11 @@ export declare class Tendermint34Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static connect(endpoint: string | HttpEndpoint): Promise; -+ static connect(endpoint: string | HttpEndpoint, desiredHeight?: number): Promise; - /** - * Creates a new Tendermint client given an RPC client. - */ -- static create(rpcClient: RpcClient): Promise; -+ static create(rpcClient: RpcClient, desiredHeight?: number): Promise; - private static detectVersion; - private readonly client; - private readonly p; -@@ -86,4 +86,5 @@ export declare class Tendermint34Client { - validatorsAll(height?: number): Promise; - private doCall; - private subscribe; -+ public desiredHeight: number; - } -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js -index f822f39..3ab5384 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js -@@ -34,7 +34,7 @@ class Tendermint34Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static async connect(endpoint) { -+ static async connect(endpoint, desiredHeight) { - let rpcClient; - if (typeof endpoint === "object") { - rpcClient = new rpcclients_1.HttpClient(endpoint); -@@ -48,13 +48,13 @@ class Tendermint34Client { - // while did not help. Thus we query the version as a way to say "hi" to the backend, - // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); -- return Tendermint34Client.create(rpcClient); -+ return Tendermint34Client.create(rpcClient, desiredHeight); - } - /** - * Creates a new Tendermint client given an RPC client. - */ -- static async create(rpcClient) { -- return new Tendermint34Client(rpcClient); -+ static async create(rpcClient, desiredHeight) { -+ return new Tendermint34Client(rpcClient, desiredHeight); - } - static async detectVersion(client) { - const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status); -@@ -72,10 +72,11 @@ class Tendermint34Client { - /** - * Use `Tendermint34Client.connect` or `Tendermint34Client.create` to create an instance. - */ -- constructor(client) { -+ constructor(client, desiredHeight) { - this.client = client; - this.p = adaptor_1.adaptor34.params; - this.r = adaptor_1.adaptor34.responses; -+ this.desiredHeight = desiredHeight; - } - disconnect() { - this.client.disconnect(); -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts -index 3752168..c9b8043 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts -@@ -8,11 +8,11 @@ export declare class Tendermint37Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static connect(endpoint: string | HttpEndpoint): Promise; -+ static connect(endpoint: string | HttpEndpoint, desiredHeight?: number): Promise; - /** - * Creates a new Tendermint client given an RPC client. - */ -- static create(rpcClient: RpcClient): Promise; -+ static create(rpcClient: RpcClient, desiredHeight?: number): Promise; - private static detectVersion; - private readonly client; - private readonly p; -@@ -86,4 +86,5 @@ export declare class Tendermint37Client { - validatorsAll(height?: number): Promise; - private doCall; - private subscribe; -+ public desiredHeight: number; - } -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js -index 8f78cc6..892c417 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js -@@ -34,7 +34,7 @@ class Tendermint37Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static async connect(endpoint) { -+ static async connect(endpoint, desiredHeight) { - let rpcClient; - if (typeof endpoint === "object") { - rpcClient = new rpcclients_1.HttpClient(endpoint); -@@ -48,13 +48,13 @@ class Tendermint37Client { - // while did not help. Thus we query the version as a way to say "hi" to the backend, - // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); -- return Tendermint37Client.create(rpcClient); -+ return Tendermint37Client.create(rpcClient, desiredHeight); - } - /** - * Creates a new Tendermint client given an RPC client. - */ -- static async create(rpcClient) { -- return new Tendermint37Client(rpcClient); -+ static async create(rpcClient, desiredHeight) { -+ return new Tendermint37Client(rpcClient, desiredHeight); - } - static async detectVersion(client) { - const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status); -@@ -72,10 +72,11 @@ class Tendermint37Client { - /** - * Use `Tendermint37Client.connect` or `Tendermint37Client.create` to create an instance. - */ -- constructor(client) { -+ constructor(client, desiredHeight) { - this.client = client; - this.p = adaptor_1.adaptor37.params; - this.r = adaptor_1.adaptor37.responses; -+ this.desiredHeight = desiredHeight - } - disconnect() { - this.client.disconnect(); From dcacd707160c279c48aaaa7c4009c8f4f7e220b9 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 16:52:37 +0700 Subject: [PATCH 40/84] add: custom base url and dex for init from backend --- packages/common/src/chain-infos/chain-info-reader.ts | 6 ++++-- packages/common/src/common.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/common/src/chain-infos/chain-info-reader.ts b/packages/common/src/chain-infos/chain-info-reader.ts index 55bd4ab..82ceb12 100644 --- a/packages/common/src/chain-infos/chain-info-reader.ts +++ b/packages/common/src/chain-infos/chain-info-reader.ts @@ -12,14 +12,16 @@ import { import path from "path"; export class ChainInfoReaderFromBackend implements ChainInfoReader { + constructor(private readonly baseUrl?: string, private readonly dex?: string) {} + async readChainInfos() { const chains = (await ( await fetchRetry( - CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_URL + + this.baseUrl ?? CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_URL + path.join( CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_ENDPOINT, CHAIN_REGISTRY_BACKEND_ENDPOINTS.CHAIN_INFOS - ) + ) + "?dex=" + this.dex ) ).json()) as CustomChainInfo[]; return chains; diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 2686d11..0e98662 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -29,8 +29,8 @@ export class OraiCommon { return OraiCommon.initializeFromCustomChainInfos(customChainInfos); } - static async initializeFromBackend() { - const reader = new ChainInfoReaderFromBackend(); + static async initializeFromBackend(baseUrl?: string, dex?: string) { + const reader = new ChainInfoReaderFromBackend(baseUrl, dex); return OraiCommon.initializeFromChainInfoReader(reader); } From f50cca98329012ff97cd510418eada3a9727ab9b Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 16:55:08 +0700 Subject: [PATCH 41/84] pump version --- .github/workflows/publish_package.yml | 70 +++++++++++++++++++++++++++ packages/common/package.json | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish_package.yml diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml new file mode 100644 index 0000000..a335e30 --- /dev/null +++ b/.github/workflows/publish_package.yml @@ -0,0 +1,70 @@ +name: publish_package + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [feat/dynamic-token-list] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: ["18"] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.8.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v4 + id: yarn-cache + with: + path: | + ${{ steps.yarn-cache-dir-path.outputs.dir }} + ./node_modules/ + key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Enable Corepack + run: corepack enable + - name: Prepare Yarn + run: corepack prepare yarn@4.3.1 --activate + + - name: Install Dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn + - name: Build + run: yarn build + - name: Authenticate with private NPM package + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: Publish Oraichain Common + id: publish-oraichain-common + continue-on-error: true + run: yarn deploy:ci + env: + CI: false + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: send result via discord + uses: appleboy/discord-action@master + with: + webhook_id: ${{ secrets.WEBHOOK_ID }} + webhook_token: ${{ secrets.WEBHOOK_TOKEN }} + username: "GitBot" + message: "Repo oraichain-sdk has just published. @oraichain/common: ${{ steps.publish-oraichain-common.outcome }}. ${{ github.event.head_commit.author.name }}" diff --git a/packages/common/package.json b/packages/common/package.json index e042c95..afe35bd 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1", + "version": "1.2.1-beta1", "main": "build/index.js", "license": "MIT", "scripts": { From 291fb7a5597ed969f9ad79b38f316f32c84d7116 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 17:04:25 +0700 Subject: [PATCH 42/84] update branch --- .github/workflows/publish_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index a335e30..05f79ac 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -4,7 +4,7 @@ name: publish_package on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [feat/dynamic-token-list] + branches: [feat/github-permissionless] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From f25821342de97991deb5a79e5a1725f4a992949a Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 17:06:14 +0700 Subject: [PATCH 43/84] pump version --- yarn.lock | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 6982976..7a1992e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1606,7 +1606,22 @@ __metadata: languageName: node linkType: hard -"@oraichain/common@npm:^1.2.0, @oraichain/common@workspace:packages/common": +"@oraichain/common@npm:^1.2.0": + version: 1.2.0 + resolution: "@oraichain/common@npm:1.2.0" + dependencies: + "@keplr-wallet/types": "npm:0.12.141" + axios: "npm:0.21.4" + axios-extensions: "npm:3.1.6" + bech32: "npm:^1.1.4" + cosmjs-types: "npm:^0.8.0" + ethers: "npm:^5.5.1" + lodash: "npm:^4.17.21" + checksum: 10c0/67ca8c9297147544492e81057cc990a9aa74750bc1e5396807503fe0ce504eac9a7315ba4d070fb39b5ebc5fef5ef3ed5ec26199e9652710ba6c013f6186e23e + languageName: node + linkType: hard + +"@oraichain/common@workspace:packages/common": version: 0.0.0-use.local resolution: "@oraichain/common@workspace:packages/common" dependencies: From dd7290d4360b210bafce8fccbaf964651534bb94 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 17:12:56 +0700 Subject: [PATCH 44/84] fix patch --- .../@cosmjs+cosmwasm-stargate+0.31.3.patch | 87 ------------ .../@cosmjs+cosmwasm-stargate+0.32.4.patch | 80 +++++++++++ patches/@cosmjs+stargate+0.31.3.patch | 87 ------------ patches/@cosmjs+stargate+0.32.4.patch | 72 ++++++++++ patches/@cosmjs+tendermint-rpc+0.31.3.patch | 134 ------------------ patches/@cosmjs+tendermint-rpc+0.32.4.patch | 37 +++++ 6 files changed, 189 insertions(+), 308 deletions(-) delete mode 100644 patches/@cosmjs+cosmwasm-stargate+0.31.3.patch create mode 100644 patches/@cosmjs+cosmwasm-stargate+0.32.4.patch delete mode 100644 patches/@cosmjs+stargate+0.31.3.patch create mode 100644 patches/@cosmjs+stargate+0.32.4.patch delete mode 100644 patches/@cosmjs+tendermint-rpc+0.31.3.patch create mode 100644 patches/@cosmjs+tendermint-rpc+0.32.4.patch diff --git a/patches/@cosmjs+cosmwasm-stargate+0.31.3.patch b/patches/@cosmjs+cosmwasm-stargate+0.31.3.patch deleted file mode 100644 index b162100..0000000 --- a/patches/@cosmjs+cosmwasm-stargate+0.31.3.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts -index 3aebdc5..7fa6509 100644 ---- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts -+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts -@@ -1,5 +1,6 @@ - import { Account, AuthExtension, BankExtension, Block, Coin, DeliverTxResponse, IndexedTx, QueryClient, SearchTxQuery, SequenceResponse, TxExtension } from "@cosmjs/stargate"; - import { HttpEndpoint, TendermintClient } from "@cosmjs/tendermint-rpc"; -+import { QueryAllContractStateResponse } from "cosmjs-types/cosmwasm/wasm/v1/query"; - import { JsonObject, WasmExtension } from "./modules"; - export interface Code { - readonly id: number; -@@ -49,7 +50,7 @@ export declare class CosmWasmClient { - * This uses auto-detection to decide between a Tendermint 0.37 and 0.34 client. - * To set the Tendermint client explicitly, use `create`. - */ -- static connect(endpoint: string | HttpEndpoint): Promise; -+ static connect(endpoint: string | HttpEndpoint, desiredHeight?: number): Promise; - /** - * Creates an instance from a manually created Tendermint client. - * Use this to use `Tendermint37Client` instead of `Tendermint34Client`. -@@ -136,5 +137,6 @@ export declare class CosmWasmClient { - * Promise is rejected for invalid response format. - */ - queryContractSmart(address: string, queryMsg: JsonObject): Promise; -+ getAllContractState(address: string, paginationKey: Uint8Array): Promise; - private txsQuery; - } -diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js -index 8f6305b..093a700 100644 ---- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js -+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js -@@ -17,18 +17,18 @@ class CosmWasmClient { - * This uses auto-detection to decide between a Tendermint 0.37 and 0.34 client. - * To set the Tendermint client explicitly, use `create`. - */ -- static async connect(endpoint) { -+ static async connect(endpoint, desiredHeight) { - // Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 - // Using 0.34 as the fallback. - let tmClient; -- const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint); -+ const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint, desiredHeight); - const version = (await tm37Client.status()).nodeInfo.version; - if (version.startsWith("0.37.")) { - tmClient = tm37Client; - } - else { - tm37Client.disconnect(); -- tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); -+ tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint, desiredHeight); - } - return CosmWasmClient.create(tmClient); - } -@@ -351,6 +351,33 @@ class CosmWasmClient { - } - } - } -+ -+ /** -+ * Makes a smart query on the contract, returns the parsed JSON document. -+ * -+ * Promise is rejected when contract does not exist. -+ * Promise is rejected for invalid query format. -+ * Promise is rejected for invalid response format. -+ */ -+ async getAllContractState(address, paginationKey) { -+ try { -+ return await this.forceGetQueryClient().wasm.getAllContractState(address, paginationKey); -+ } -+ catch (error) { -+ if (error instanceof Error) { -+ if (error.message.startsWith("not found: contract")) { -+ throw new Error(`No contract found at address "${address}"`); -+ } -+ else { -+ throw error; -+ } -+ } -+ else { -+ throw error; -+ } -+ } -+ } -+ - async txsQuery(query) { - const results = await this.forceGetTmClient().txSearchAll({ query: query }); - return results.txs.map((tx) => { diff --git a/patches/@cosmjs+cosmwasm-stargate+0.32.4.patch b/patches/@cosmjs+cosmwasm-stargate+0.32.4.patch new file mode 100644 index 0000000..4da5cf7 --- /dev/null +++ b/patches/@cosmjs+cosmwasm-stargate+0.32.4.patch @@ -0,0 +1,80 @@ +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts +index a770785..3f427c8 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts +@@ -58,6 +58,7 @@ export declare class CosmWasmClient { + protected constructor(cometClient: CometClient | undefined); + protected getCometClient(): CometClient | undefined; + protected forceGetCometClient(): CometClient; ++ public setQueryClientWithHeight(height?: number): void; + protected getQueryClient(): (QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension) | undefined; + protected forceGetQueryClient(): QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension; + getChainId(): Promise; +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js +index af8341d..bc91fbc 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js +@@ -35,6 +35,13 @@ class CosmWasmClient { + this.queryClient = stargate_1.QueryClient.withExtensions(cometClient, stargate_1.setupAuthExtension, stargate_1.setupBankExtension, modules_1.setupWasmExtension, stargate_1.setupTxExtension); + } + } ++ ++ setQueryClientWithHeight(height = undefined) { ++ if (this.tmClient) { ++ this.queryClient = stargate_1.QueryClient.withExtensionsWithHeight(this.tmClient, height, stargate_1.setupAuthExtension, stargate_1.setupBankExtension, modules_1.setupWasmExtension, stargate_1.setupTxExtension); ++ } ++ } ++ + getCometClient() { + return this.cometClient; + } +@@ -120,12 +127,12 @@ class CosmWasmClient { + else if ((0, stargate_1.isSearchTxQueryArray)(query)) { + rawQuery = query + .map((t) => { +- // numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462 +- if (typeof t.value === "string") +- return `${t.key}='${t.value}'`; +- else +- return `${t.key}=${t.value}`; +- }) ++ // numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462 ++ if (typeof t.value === "string") ++ return `${t.key}='${t.value}'`; ++ else ++ return `${t.key}=${t.value}`; ++ }) + .join(" AND "); + } + else { +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js b/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js +index e5bf448..878f7e4 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js +@@ -4,8 +4,8 @@ exports.setupWasmExtension = void 0; + const encoding_1 = require("@cosmjs/encoding"); + const stargate_1 = require("@cosmjs/stargate"); + const query_1 = require("cosmjs-types/cosmwasm/wasm/v1/query"); +-function setupWasmExtension(base) { +- const rpc = (0, stargate_1.createProtobufRpcClient)(base); ++function setupWasmExtension(base, height) { ++ const rpc = (0, stargate_1.createProtobufRpcClient)(base, height); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); +diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js +index 6eb95bb..24d3038 100644 +--- a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js ++++ b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js +@@ -397,7 +397,10 @@ class SigningCosmWasmClient extends cosmwasmclient_1.CosmWasmClient { + throw new Error("Failed to retrieve account from signer"); + } + const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey)); +- const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; ++ let signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; ++ if (this.signer.signEip191) { ++ signMode = signing_1.SignMode.SIGN_MODE_EIP_191; ++ } + const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg)); + const signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight); + const { signature, signed } = await this.signer.signAmino(signerAddress, signDoc); diff --git a/patches/@cosmjs+stargate+0.31.3.patch b/patches/@cosmjs+stargate+0.31.3.patch deleted file mode 100644 index 279ef09..0000000 --- a/patches/@cosmjs+stargate+0.31.3.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.js b/node_modules/@cosmjs/stargate/build/queryclient/utils.js -index 6f4ecaa..b4f6d6b 100644 ---- a/node_modules/@cosmjs/stargate/build/queryclient/utils.js -+++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.js -@@ -32,7 +32,7 @@ function createProtobufRpcClient(base) { - return { - request: async (service, method, data) => { - const path = `/${service}/${method}`; -- const response = await base.queryAbci(path, data, undefined); -+ const response = await base.queryAbci(path, data, base.tmClient.desiredHeight); - return response.value; - }, - }; -diff --git a/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts b/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts -index b8ca38c..e954160 100644 ---- a/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts -+++ b/node_modules/@cosmjs/stargate/build/signingstargateclient.d.ts -@@ -28,6 +28,7 @@ export interface SigningStargateClientOptions extends StargateClientOptions { - readonly broadcastTimeoutMs?: number; - readonly broadcastPollIntervalMs?: number; - readonly gasPrice?: GasPrice; -+ readonly desiredHeight?: number; - } - export declare function createDefaultAminoConverters(): AminoConverters; - export declare class SigningStargateClient extends StargateClient { -diff --git a/node_modules/@cosmjs/stargate/build/signingstargateclient.js b/node_modules/@cosmjs/stargate/build/signingstargateclient.js -index 4330b9f..4a470c3 100644 ---- a/node_modules/@cosmjs/stargate/build/signingstargateclient.js -+++ b/node_modules/@cosmjs/stargate/build/signingstargateclient.js -@@ -58,14 +58,14 @@ class SigningStargateClient extends stargateclient_1.StargateClient { - // Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 - // Using 0.34 as the fallback. - let tmClient; -- const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint); -+ const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint, options.desiredHeight); - const version = (await tm37Client.status()).nodeInfo.version; - if (version.startsWith("0.37.")) { - tmClient = tm37Client; - } - else { - tm37Client.disconnect(); -- tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); -+ tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint, options.desiredHeight); - } - return SigningStargateClient.createWithSigner(tmClient, signer, options); - } -diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.d.ts b/node_modules/@cosmjs/stargate/build/stargateclient.d.ts -index 0cd6feb..b5fc618 100644 ---- a/node_modules/@cosmjs/stargate/build/stargateclient.d.ts -+++ b/node_modules/@cosmjs/stargate/build/stargateclient.d.ts -@@ -137,6 +137,7 @@ export interface PrivateStargateClient { - } - export interface StargateClientOptions { - readonly accountParser?: AccountParser; -+ readonly desiredHeight?: number; - } - export declare class StargateClient { - private readonly tmClient; -diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.js b/node_modules/@cosmjs/stargate/build/stargateclient.js -index 3268b13..3845295 100644 ---- a/node_modules/@cosmjs/stargate/build/stargateclient.js -+++ b/node_modules/@cosmjs/stargate/build/stargateclient.js -@@ -70,14 +70,14 @@ class StargateClient { - // Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 - // Using 0.34 as the fallback. - let tmClient; -- const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint); -+ const tm37Client = await tendermint_rpc_1.Tendermint37Client.connect(endpoint, options.desiredHeight); - const version = (await tm37Client.status()).nodeInfo.version; - if (version.startsWith("0.37.")) { - tmClient = tm37Client; - } - else { - tm37Client.disconnect(); -- tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); -+ tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint, options.desiredHeight); - } - return StargateClient.create(tmClient, options); - } -@@ -299,6 +299,7 @@ class StargateClient { - return results.txs.map((tx) => { - const txMsgData = abci_1.TxMsgData.decode(tx.result.data ?? new Uint8Array()); - return { -+ ...tx, - height: tx.height, - txIndex: tx.index, - hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(), diff --git a/patches/@cosmjs+stargate+0.32.4.patch b/patches/@cosmjs+stargate+0.32.4.patch new file mode 100644 index 0000000..667a8c4 --- /dev/null +++ b/patches/@cosmjs+stargate+0.32.4.patch @@ -0,0 +1,72 @@ +diff --git a/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js b/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js +index 634b2e5..c2daa9c 100644 +--- a/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js ++++ b/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js +@@ -32,6 +32,24 @@ class QueryClient { + } + return client; + } ++ ++ static withExtensionsWithHeight(cometClient, height, ...extensionSetups) { ++ const client = new QueryClient(cometClient, height); ++ const extensions = extensionSetups.map((setupExtension) => setupExtension(client, height)); ++ for (const extension of extensions) { ++ (0, utils_1.assert)((0, utils_1.isNonNullObject)(extension), `Extension must be a non-null object`); ++ for (const [moduleKey, moduleValue] of Object.entries(extension)) { ++ (0, utils_1.assert)((0, utils_1.isNonNullObject)(moduleValue), `Module must be a non-null object. Found type ${typeof moduleValue} for module "${moduleKey}".`); ++ const current = client[moduleKey] || {}; ++ client[moduleKey] = { ++ ...current, ++ ...moduleValue, ++ }; ++ } ++ } ++ return client; ++ } ++ + constructor(cometClient) { + this.cometClient = cometClient; + } +diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts +index ec5b471..92d5737 100644 +--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts ++++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts +@@ -18,7 +18,7 @@ export declare function createPagination(paginationKey?: Uint8Array): PageReques + export interface ProtobufRpcClient { + request(service: string, method: string, data: Uint8Array): Promise; + } +-export declare function createProtobufRpcClient(base: QueryClient): ProtobufRpcClient; ++export declare function createProtobufRpcClient(base: QueryClient, height?: number): ProtobufRpcClient; + /** + * Takes a uint64 value as string, number, BigInt or Uint64 and returns a BigInt + * of it. +diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.js b/node_modules/@cosmjs/stargate/build/queryclient/utils.js +index ea25080..a0cb539 100644 +--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.js ++++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.js +@@ -24,11 +24,11 @@ function createPagination(paginationKey) { + return paginationKey ? pagination_1.PageRequest.fromPartial({ key: paginationKey }) : pagination_1.PageRequest.fromPartial({}); + } + exports.createPagination = createPagination; +-function createProtobufRpcClient(base) { ++function createProtobufRpcClient(base, height = undefined) { + return { + request: async (service, method, data) => { + const path = `/${service}/${method}`; +- const response = await base.queryAbci(path, data, undefined); ++ const response = await base.queryAbci(path, data, height); + return response.value; + }, + }; +diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.js b/node_modules/@cosmjs/stargate/build/stargateclient.js +index a6da130..0918f14 100644 +--- a/node_modules/@cosmjs/stargate/build/stargateclient.js ++++ b/node_modules/@cosmjs/stargate/build/stargateclient.js +@@ -297,6 +297,7 @@ class StargateClient { + return results.txs.map((tx) => { + const txMsgData = abci_1.TxMsgData.decode(tx.result.data ?? new Uint8Array()); + return { ++ ...tx, + height: tx.height, + txIndex: tx.index, + hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(), diff --git a/patches/@cosmjs+tendermint-rpc+0.31.3.patch b/patches/@cosmjs+tendermint-rpc+0.31.3.patch deleted file mode 100644 index 34e5a12..0000000 --- a/patches/@cosmjs+tendermint-rpc+0.31.3.patch +++ /dev/null @@ -1,134 +0,0 @@ -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts -index 533ef38..925fcf6 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.d.ts -@@ -8,11 +8,11 @@ export declare class Tendermint34Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static connect(endpoint: string | HttpEndpoint): Promise; -+ static connect(endpoint: string | HttpEndpoint, desiredHeight?: number): Promise; - /** - * Creates a new Tendermint client given an RPC client. - */ -- static create(rpcClient: RpcClient): Promise; -+ static create(rpcClient: RpcClient, desiredHeight?: number): Promise; - private static detectVersion; - private readonly client; - private readonly p; -@@ -86,4 +86,5 @@ export declare class Tendermint34Client { - validatorsAll(height?: number): Promise; - private doCall; - private subscribe; -+ public desiredHeight: number; - } -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js -index f822f39..3ab5384 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js -@@ -34,7 +34,7 @@ class Tendermint34Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static async connect(endpoint) { -+ static async connect(endpoint, desiredHeight) { - let rpcClient; - if (typeof endpoint === "object") { - rpcClient = new rpcclients_1.HttpClient(endpoint); -@@ -48,13 +48,13 @@ class Tendermint34Client { - // while did not help. Thus we query the version as a way to say "hi" to the backend, - // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); -- return Tendermint34Client.create(rpcClient); -+ return Tendermint34Client.create(rpcClient, desiredHeight); - } - /** - * Creates a new Tendermint client given an RPC client. - */ -- static async create(rpcClient) { -- return new Tendermint34Client(rpcClient); -+ static async create(rpcClient, desiredHeight) { -+ return new Tendermint34Client(rpcClient, desiredHeight); - } - static async detectVersion(client) { - const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status); -@@ -72,10 +72,11 @@ class Tendermint34Client { - /** - * Use `Tendermint34Client.connect` or `Tendermint34Client.create` to create an instance. - */ -- constructor(client) { -+ constructor(client, desiredHeight) { - this.client = client; - this.p = adaptor_1.adaptor34.params; - this.r = adaptor_1.adaptor34.responses; -+ this.desiredHeight = desiredHeight; - } - disconnect() { - this.client.disconnect(); -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts -index 3752168..c9b8043 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.d.ts -@@ -8,11 +8,11 @@ export declare class Tendermint37Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static connect(endpoint: string | HttpEndpoint): Promise; -+ static connect(endpoint: string | HttpEndpoint, desiredHeight?: number): Promise; - /** - * Creates a new Tendermint client given an RPC client. - */ -- static create(rpcClient: RpcClient): Promise; -+ static create(rpcClient: RpcClient, desiredHeight?: number): Promise; - private static detectVersion; - private readonly client; - private readonly p; -@@ -86,4 +86,5 @@ export declare class Tendermint37Client { - validatorsAll(height?: number): Promise; - private doCall; - private subscribe; -+ public desiredHeight: number; - } -diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js -index 8f78cc6..892c417 100644 ---- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js -+++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js -@@ -34,7 +34,7 @@ class Tendermint37Client { - * - * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. - */ -- static async connect(endpoint) { -+ static async connect(endpoint, desiredHeight) { - let rpcClient; - if (typeof endpoint === "object") { - rpcClient = new rpcclients_1.HttpClient(endpoint); -@@ -48,13 +48,13 @@ class Tendermint37Client { - // while did not help. Thus we query the version as a way to say "hi" to the backend, - // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); -- return Tendermint37Client.create(rpcClient); -+ return Tendermint37Client.create(rpcClient, desiredHeight); - } - /** - * Creates a new Tendermint client given an RPC client. - */ -- static async create(rpcClient) { -- return new Tendermint37Client(rpcClient); -+ static async create(rpcClient, desiredHeight) { -+ return new Tendermint37Client(rpcClient, desiredHeight); - } - static async detectVersion(client) { - const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status); -@@ -72,10 +72,11 @@ class Tendermint37Client { - /** - * Use `Tendermint37Client.connect` or `Tendermint37Client.create` to create an instance. - */ -- constructor(client) { -+ constructor(client, desiredHeight) { - this.client = client; - this.p = adaptor_1.adaptor37.params; - this.r = adaptor_1.adaptor37.responses; -+ this.desiredHeight = desiredHeight - } - disconnect() { - this.client.disconnect(); diff --git a/patches/@cosmjs+tendermint-rpc+0.32.4.patch b/patches/@cosmjs+tendermint-rpc+0.32.4.patch new file mode 100644 index 0000000..d3efd73 --- /dev/null +++ b/patches/@cosmjs+tendermint-rpc+0.32.4.patch @@ -0,0 +1,37 @@ +diff --git a/node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js b/node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js +index 8c72817..2b810d2 100644 +--- a/node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js ++++ b/node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js +@@ -34,9 +34,11 @@ function isExperimental(nodeJsFunc) { + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + async function http(method, url, headers, request) { ++ const timeout = Number(process.env.HTTP_TIMEOUT || 30000); + if (typeof fetch === "function" && !isExperimental(fetch)) { + const settings = { + method: method, ++ signal: AbortSignal.timeout(timeout), + body: request ? JSON.stringify(request) : undefined, + headers: { + // eslint-disable-next-line @typescript-eslint/naming-convention +@@ -50,7 +52,7 @@ async function http(method, url, headers, request) { + } + else { + return axios_1.default +- .request({ url: url, method: method, data: request, headers: headers }) ++ .request({ url: url, method: method, data: request, headers: headers, timeout: timeout }) + .then((res) => res.data); + } + } +diff --git a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js +index a426641..9f33204 100644 +--- a/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js ++++ b/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js +@@ -320,6 +320,7 @@ function decodeTxProof(data) { + } + function decodeTxResponse(data) { + return { ++ ...data, + tx: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx)), + result: decodeTxData((0, encodings_1.assertObject)(data.tx_result)), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), From 76b539d9ef366700be2c98b372dca480d61ecd90 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 17:14:43 +0700 Subject: [PATCH 45/84] add ci --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 2af7532..e7ca7db 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build": "lerna run build --concurrency 1", "build-tsc": "tsc -p", "deploy": "yarn build && lerna publish", + "deploy:ci": "lerna publish from-package --yes", "build:docker": "lerna run build --concurrency 1" }, "workspaces": [ From 7b27600b526ff2bec3f3b6becc996152187a4415 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 17:46:47 +0700 Subject: [PATCH 46/84] refactor chain info reader for improved readability and structure --- .../src/chain-infos/chain-info-reader.ts | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/packages/common/src/chain-infos/chain-info-reader.ts b/packages/common/src/chain-infos/chain-info-reader.ts index c2ea2ca..80e881e 100644 --- a/packages/common/src/chain-infos/chain-info-reader.ts +++ b/packages/common/src/chain-infos/chain-info-reader.ts @@ -1,25 +1,31 @@ -import { fetchRetry } from "../helpers"; +import path from "path"; import { CHAIN_REGISTRY_BACKEND_ENDPOINTS, CHAIN_REGISTRY_GITHUB_API_ENDPOINTS, CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS } from "../constants"; -import { ChainInfoReader, ChainInfoReaderFromGitRawOptions, CustomChainInfo } from "./types"; -import path from "path"; +import { fetchRetry } from "../helpers"; +import { + ChainInfoReader, + ChainInfoReaderFromGitRawOptions, + CustomChainInfo +} from "./types"; export class ChainInfoReaderFromBackend implements ChainInfoReader { - constructor(private readonly baseUrl?: string, private readonly dex?: string) {} + constructor( + private readonly baseUrl?: string, + private readonly dex?: string + ) {} async readChainInfos() { - const chains = (await ( - await fetchRetry( - this.baseUrl ?? CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_URL + - path.join( - CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_ENDPOINT, - CHAIN_REGISTRY_BACKEND_ENDPOINTS.CHAIN_INFOS - ) + "?dex=" + this.dex - ) - ).json()) as CustomChainInfo[]; + const { BASE_ENDPOINT, BASE_URL, CHAIN_INFOS } = + CHAIN_REGISTRY_BACKEND_ENDPOINTS; + const url = + (this.baseUrl ?? BASE_URL) + + path.join(BASE_ENDPOINT, CHAIN_INFOS) + + "?dex=" + + this.dex; + const chains = (await (await fetchRetry(url)).json()) as CustomChainInfo[]; return chains; } } @@ -28,7 +34,9 @@ export class ChainInfoReaderFromOraiCommon implements ChainInfoReader { constructor(private readonly sourceUrl: string) {} async readChainInfos() { - const chains = (await (await fetchRetry(this.sourceUrl)).json()) as CustomChainInfo[]; + const chains = (await ( + await fetchRetry(this.sourceUrl) + ).json()) as CustomChainInfo[]; return chains; } } @@ -55,12 +63,16 @@ export class ChainInfoReaderFromGit implements ChainInfoReader { ).json(); const responses = ( - await Promise.allSettled(response.map((chain) => fetchRetry(chain.download_url))) + await Promise.allSettled( + response.map((chain) => fetchRetry(chain.download_url)) + ) ) .filter((chain) => chain.status === "fulfilled") .map((chain) => chain.value); - const chains: CustomChainInfo[] = await Promise.all(responses.map((data) => data.json())); + const chains: CustomChainInfo[] = await Promise.all( + responses.map((data) => data.json()) + ); return chains; } } @@ -77,7 +89,8 @@ export class ChainInfoReaderFromGitRaw implements ChainInfoReader { } ) { if (!this.options.baseUrl) - this.options.baseUrl = CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS.BASE_URL; + this.options.baseUrl = + CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS.BASE_URL; this.generateUrls(); } From 9f55dd7914506280e0bf2bf2d4df78f33a356155 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 28 Nov 2024 17:47:18 +0700 Subject: [PATCH 47/84] bump version to 1.2.1-beta3 --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index 1600329..be65913 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta2", + "version": "1.2.1-beta3", "main": "build/index.js", "license": "MIT", "scripts": { From 3a04e5d39901a68831a9332dc7abcf3b0cb87193 Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 29 Nov 2024 13:58:17 +0700 Subject: [PATCH 48/84] feat: add Celestia chain configuration --- chains/celestia.json | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 chains/celestia.json diff --git a/chains/celestia.json b/chains/celestia.json new file mode 100644 index 0000000..732afa7 --- /dev/null +++ b/chains/celestia.json @@ -0,0 +1,53 @@ +{ + "$schema": "../chain.schema.json", + "rpc": "https://celestia.rpc.orai.io", + "rest": "https://celestia.lcd.orai.io", + "chainId": "celestia", + "chainName": "Celestia", + "networkType": "cosmos", + "bip44": { + "coinType": 118 + }, + "coinType": 118, + "bech32Config": { + "bech32PrefixAccAddr": "celestia", + "bech32PrefixAccPub": "celestiapub", + "bech32PrefixConsAddr": "celestiavalcons", + "bech32PrefixConsPub": "celestiavalconspub", + "bech32PrefixValAddr": "celestiavaloper", + "bech32PrefixValPub": "celestiavaloperpub" + }, + "features": [], + "chainSymbolImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/celestia/chain.png", + "currencies": [ + { + "coinDecimals": 6, + "coinDenom": "TIA", + "coinGeckoId": "celestia", + "coinMinimalDenom": "utia", + "coinImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/celestia/chain.png" + } + ], + "feeCurrencies": [ + { + "coinDecimals": 6, + "coinDenom": "TIA", + "coinGeckoId": "celestia", + "coinMinimalDenom": "utia", + "coinImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/celestia/chain.png", + "gasPriceStep": { + "low": 0.01, + "average": 0.02, + "high": 0.1 + } + } + ], + "stakeCurrency": { + "coinDecimals": 6, + "coinDenom": "TIA", + "coinGeckoId": "celestia", + "coinMinimalDenom": "utia", + "coinImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/celestia/utia.png" + }, + "walletUrlForStaking": "https://wallet.keplr.app/chains/celestia" +} From 33cc30f7e412dffc6b21f4bf6037780a0cd0c686 Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 29 Nov 2024 14:01:22 +0700 Subject: [PATCH 49/84] bump version to 1.2.1-beta4 and add Celestia chain ID --- packages/common/package.json | 2 +- packages/common/src/constants/chain-ids.ts | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index be65913..4d433a4 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta3", + "version": "1.2.1-beta4", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/constants/chain-ids.ts b/packages/common/src/constants/chain-ids.ts index 408800d..cea02eb 100644 --- a/packages/common/src/constants/chain-ids.ts +++ b/packages/common/src/constants/chain-ids.ts @@ -14,7 +14,8 @@ export const COSMOS_CHAIN_IDS = { INJECTVE: "injective-1", KAWAII_COSMOS: "kawaii_6886-1", NOBLE: "noble-1", - NEUTARO: "Neutaro-1" + NEUTARO: "Neutaro-1", + CELESTIA: "celestia" } as const; export const TON_CHAIN_ID = { @@ -81,13 +82,7 @@ export const EVM_CHAIN_IDS_DECIMAL = { }; export type EvmChainId = (typeof EVM_CHAIN_IDS)[keyof typeof EVM_CHAIN_IDS]; -export type CosmosChainId = - (typeof COSMOS_CHAIN_IDS)[keyof typeof COSMOS_CHAIN_IDS]; +export type CosmosChainId = (typeof COSMOS_CHAIN_IDS)[keyof typeof COSMOS_CHAIN_IDS]; export type TonChainId = (typeof TON_CHAIN_ID)[keyof typeof TON_CHAIN_ID]; -export type BitcoinChainId = - (typeof BITCOIN_CHAIN_ID)[keyof typeof BITCOIN_CHAIN_ID]; -export type NetworkChainId = - | CosmosChainId - | EvmChainId - | TonChainId - | BitcoinChainId; +export type BitcoinChainId = (typeof BITCOIN_CHAIN_ID)[keyof typeof BITCOIN_CHAIN_ID]; +export type NetworkChainId = CosmosChainId | EvmChainId | TonChainId | BitcoinChainId; From 5358ab561e3aa979930de1fc5af9683eed9a1abe Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 29 Nov 2024 17:21:06 +0700 Subject: [PATCH 50/84] fix: update evmDenoms assignment for improved clarity --- packages/common/src/token-items/token-items.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 37b09db..1d1447b 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -37,10 +37,6 @@ export class TokenItemsImpl implements TokenItems { injective: [IBC_DENOMS.INJECTIVE] }; return network.currencies.map((currency) => { - const evmDenoms = - network.chainId === COSMOS_CHAIN_IDS.ORAICHAIN - ? evmDenomsMap[currency.coinMinimalDenom] - : undefined; return { name: currency.coinDenom, org: network.chainName, @@ -59,7 +55,7 @@ export class TokenItemsImpl implements TokenItems { maxGas: (network.feeCurrencies?.[0].gasPriceStep?.high ?? 0) * 20000, gasPriceStep: currency.gasPriceStep, feeCurrencies: network.feeCurrencies, - evmDenoms, + evmDenoms: evmDenomsMap[currency.coinMinimalDenom], icon: currency.coinImageUrl }; }); From b1cd1e4154e2f498857504b7bff3e7871bfa1ea5 Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 29 Nov 2024 17:22:42 +0700 Subject: [PATCH 51/84] bump version to 1.2.1-beta5 --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index 4d433a4..ecd6199 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta4", + "version": "1.2.1-beta5", "main": "build/index.js", "license": "MIT", "scripts": { From a04e41db3692b478b619101a3490f4abcadf3d79 Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 29 Nov 2024 18:11:14 +0700 Subject: [PATCH 52/84] fix: update coinMinimalDenom values for consistency and clarity; bump version to 1.2.1-beta6 --- chains/Oraichain.json | 18 ++++++------------ packages/common/package.json | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index c47b7c1..89c9066 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -35,13 +35,7 @@ "bech32PrefixConsAddr": "oraivalcons", "bech32PrefixConsPub": "oraivalconspub" }, - "features": [ - "stargate", - "ibc-transfer", - "cosmwasm", - "wasmd_0.24+", - "no-legacy-stdTx" - ], + "features": ["stargate", "ibc-transfer", "cosmwasm", "wasmd_0.24+", "no-legacy-stdTx"], "txExplorer": { "name": "Oraiscan", "txUrl": "https://scan.orai.io/txs/{txHash}", @@ -76,7 +70,7 @@ { "coinDenom": "AIRI", "coinGeckoId": "airight", - "coinMinimalDenom": "cw20:orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg:aiRight Token", + "coinMinimalDenom": "airi", "type": "cw20", "contractAddress": "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg", "bridgeTo": ["0x38"], @@ -86,7 +80,7 @@ { "coinDenom": "USDT", "coinGeckoId": "tether", - "coinMinimalDenom": "cw20:orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh:Tether", + "coinMinimalDenom": "usdt", "type": "cw20", "contractAddress": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", "bridgeTo": ["0x38", "0x2b6653dc", "0x01"], @@ -121,7 +115,7 @@ { "coinDenom": "KWT", "coinGeckoId": "kawaii-islands", - "coinMinimalDenom": "cw20:orai1nd4r053e3kgedgld2ymen8l9yrw8xpjyaal7j5:KWT", + "coinMinimalDenom": "kwt", "type": "cw20", "contractAddress": "orai1nd4r053e3kgedgld2ymen8l9yrw8xpjyaal7j5", "bridgeTo": ["kawaii_6886-1", "0x38"], @@ -138,7 +132,7 @@ { "coinDenom": "MILKY", "coinGeckoId": "milky-token", - "coinMinimalDenom": "cw20:orai1gzvndtzceqwfymu2kqhta2jn6gmzxvzqwdgvjw:MILKY", + "coinMinimalDenom": "milky", "type": "cw20", "contractAddress": "orai1gzvndtzceqwfymu2kqhta2jn6gmzxvzqwdgvjw", "bridgeTo": ["kawaii_6886-1", "0x38"], @@ -191,7 +185,7 @@ { "coinDenom": "INJ", "coinGeckoId": "injective-protocol", - "coinMinimalDenom": "cw20:orai19rtmkk6sn4tppvjmp5d5zj6gfsdykrl5rw2euu5gwur3luheuuusesqn49:INJ", + "coinMinimalDenom": "injective", "contractAddress": "orai19rtmkk6sn4tppvjmp5d5zj6gfsdykrl5rw2euu5gwur3luheuuusesqn49", "bridgeTo": ["injective-1"], "type": "cw20", diff --git a/packages/common/package.json b/packages/common/package.json index ecd6199..823be66 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta5", + "version": "1.2.1-beta6", "main": "build/index.js", "license": "MIT", "scripts": { From 064acbcd0bf7e19c0f4b1872e2376a746ea8297b Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 3 Dec 2024 17:50:08 +0700 Subject: [PATCH 53/84] fix: update version to 1.2.1-beta7 and add readonly chainId to CustomChainInfo interface --- packages/common/package.json | 2 +- packages/common/src/chain-infos/types.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index 823be66..6753317 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta6", + "version": "1.2.1-beta7", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/chain-infos/types.ts b/packages/common/src/chain-infos/types.ts index 5367585..1a59d18 100644 --- a/packages/common/src/chain-infos/types.ts +++ b/packages/common/src/chain-infos/types.ts @@ -26,6 +26,7 @@ export interface CustomChainInfo | "rest" | "bech32Config" > { + readonly chainId: NetworkChainId; readonly networkType: NetworkType; readonly coinType: CoinType; readonly bech32Config?: Bech32Config; From 4d1a5895103c6914d2de3307db5b561fdd389264 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 3 Dec 2024 18:04:35 +0700 Subject: [PATCH 54/84] fix: bump version to 1.2.1-beta8 and update chainId type to NetworkChainId --- packages/common/package.json | 2 +- packages/common/src/token-items/types.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 6753317..e9f5ed7 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta7", + "version": "1.2.1-beta8", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/token-items/types.ts b/packages/common/src/token-items/types.ts index 27ba639..9859c78 100644 --- a/packages/common/src/token-items/types.ts +++ b/packages/common/src/token-items/types.ts @@ -1,4 +1,5 @@ import { FeeCurrency } from "@keplr-wallet/types"; +import { NetworkChainId } from "src/constants"; export type TokenItemType = { name: string; @@ -9,7 +10,7 @@ export type TokenItemType = { evmDenoms?: string[]; bridgeNetworkIdentifier?: string; bridgeTo?: string[]; - chainId: string; + chainId: NetworkChainId; coinType?: number; rpc: string; decimals: number; From 4b8bd668fd08cd34ed24a85a25afe025bcaf478c Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 10:46:50 +0700 Subject: [PATCH 55/84] fix: add ORAIBTC chain ID to COSMOS_CHAIN_IDS for completeness --- packages/common/src/constants/chain-ids.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/src/constants/chain-ids.ts b/packages/common/src/constants/chain-ids.ts index cea02eb..6e86ad2 100644 --- a/packages/common/src/constants/chain-ids.ts +++ b/packages/common/src/constants/chain-ids.ts @@ -15,7 +15,8 @@ export const COSMOS_CHAIN_IDS = { KAWAII_COSMOS: "kawaii_6886-1", NOBLE: "noble-1", NEUTARO: "Neutaro-1", - CELESTIA: "celestia" + CELESTIA: "celestia", + ORAIBTC: "oraibtc-mainnet-1" } as const; export const TON_CHAIN_ID = { From 60bcb80009b1a26aa1070ee0e075f3a14b307762 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 10:47:07 +0700 Subject: [PATCH 56/84] fix: bump version to 1.2.1-beta9 --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index e9f5ed7..e4f37f2 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta8", + "version": "1.2.1-beta9", "main": "build/index.js", "license": "MIT", "scripts": { From 5c694a20d1a67b6a26cbaf9d55db26265bdd5952 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:04:56 +0700 Subject: [PATCH 57/84] feat: add chainSymbolImageUrl to various chain configurations and update coinImageUrl for Oraichain --- chains/0x01.json | 1 + chains/0x1ae6.json | 1 + chains/0x2b6653dc.json | 1 + chains/0x38.json | 1 + chains/Oraichain.json | 7 +-- chains/bitcoin.json | 1 + chains/injective-1.json | 15 +++---- chains/kawaii_6886-1.json | 1 + chains/oraibtc-mainnet-1.json | 1 + chains/osmosis-1.json | 9 +--- .../src/chain-infos/chain-info-reader.ts | 44 +++++++------------ .../common/src/token-items/token-items.ts | 3 +- packages/common/src/token-items/types.ts | 1 + 13 files changed, 38 insertions(+), 48 deletions(-) diff --git a/chains/0x01.json b/chains/0x01.json index 600befe..cc1b35a 100644 --- a/chains/0x01.json +++ b/chains/0x01.json @@ -7,6 +7,7 @@ "coinType": 60, "networkType": "evm", "features": ["isEvm"], + "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png", "feeCurrencies": [ { "coinDenom": "ETH", diff --git a/chains/0x1ae6.json b/chains/0x1ae6.json index 4ad851d..05d4d79 100644 --- a/chains/0x1ae6.json +++ b/chains/0x1ae6.json @@ -7,6 +7,7 @@ "bip44": { "coinType": 60 }, "coinType": 60, "features": ["isEvm"], + "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/12313.png", "feeCurrencies": [ { "coinDenom": "ERC20 KWT", diff --git a/chains/0x2b6653dc.json b/chains/0x2b6653dc.json index 0861bdb..8d9d219 100644 --- a/chains/0x2b6653dc.json +++ b/chains/0x2b6653dc.json @@ -6,6 +6,7 @@ "networkType": "evm", "chainName": "tronnetwork", "features": ["isEvm"], + "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png", "feeCurrencies": [ { "coinDenom": "wTRX", diff --git a/chains/0x38.json b/chains/0x38.json index 7c82795..2d511be 100644 --- a/chains/0x38.json +++ b/chains/0x38.json @@ -7,6 +7,7 @@ "bip44": { "coinType": 60 }, "coinType": 60, "features": ["isEvm"], + "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png", "feeCurrencies": [ { "coinDenom": "BNB", diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 89c9066..ada0254 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -11,7 +11,7 @@ "coinDecimals": 6, "coinGeckoId": "oraichain-token", "bridgeTo": ["0x38", "0x01", "injective-1"], - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } }, "feeCurrencies": [ @@ -21,7 +21,7 @@ "coinDecimals": 6, "coinGeckoId": "oraichain-token", "bridgeTo": ["0x38", "0x01", "injective-1"], - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } } ], @@ -41,6 +41,7 @@ "txUrl": "https://scan.orai.io/txs/{txHash}", "accountUrl": "https://scan.orai.io/account/{address}" }, + "chainSymbolImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/celestia/chain.png", "currencies": [ { "coinDenom": "ORAI", @@ -48,7 +49,7 @@ "coinDecimals": 6, "coinGeckoId": "oraichain-token", "bridgeTo": ["0x38", "0x01", "injective-1"], - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } }, { diff --git a/chains/bitcoin.json b/chains/bitcoin.json index c1d0430..cd4305b 100644 --- a/chains/bitcoin.json +++ b/chains/bitcoin.json @@ -8,6 +8,7 @@ "coinType": 0 }, "coinType": 0, + "chainSymbolImageUrl": "https://assets.coingecko.com/coins/images/1/small/bitcoin.png", "stakeCurrency": { "coinDenom": "BTC", "coinMinimalDenom": "btc", diff --git a/chains/injective-1.json b/chains/injective-1.json index ceed90a..62ffe57 100644 --- a/chains/injective-1.json +++ b/chains/injective-1.json @@ -7,6 +7,7 @@ "networkType": "cosmos", "bip44": { "coinType": 60 }, "coinType": 60, + "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7226.png", "bech32Config": { "bech32PrefixAccAddr": "inj", "bech32PrefixAccPub": "injpub", @@ -15,18 +16,12 @@ "bech32PrefixConsAddr": "injvalcons", "bech32PrefixConsPub": "injvalconspub" }, - "features": [ - "stargate", - "no-legacy-stdTx", - "ibc-transfer", - "ibc-go", - "eth-key-sign", - "cosmwasm" - ], + "features": ["stargate", "no-legacy-stdTx", "ibc-transfer", "ibc-go", "eth-key-sign", "cosmwasm"], "stakeCurrency": { "coinDenom": "INJ", "coinMinimalDenom": "inj", "coinDecimals": 18, + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7226.png", "coinGeckoId": "injective-protocol", "gasPriceStep": { "low": 5000000000, @@ -40,6 +35,7 @@ "coinMinimalDenom": "inj", "coinDecimals": 18, "coinGeckoId": "injective-protocol", + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7226.png", "gasPriceStep": { "low": 5000000000, "average": 25000000000, @@ -58,7 +54,8 @@ "average": 25000000000, "high": 50000000000 }, - "bridgeTo": ["Oraichain"] + "bridgeTo": ["Oraichain"], + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7226.png" }, { "coinDenom": "ORAI", diff --git a/chains/kawaii_6886-1.json b/chains/kawaii_6886-1.json index 358768b..7529242 100644 --- a/chains/kawaii_6886-1.json +++ b/chains/kawaii_6886-1.json @@ -5,6 +5,7 @@ "chainId": "kawaii_6886-1", "chainName": "kawaiiverse", "networkType": "cosmos", + "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/12313.png", "stakeCurrency": { "coinDenom": "ORAIE", "coinMinimalDenom": "oraie", diff --git a/chains/oraibtc-mainnet-1.json b/chains/oraibtc-mainnet-1.json index 6bbec46..d4573df 100644 --- a/chains/oraibtc-mainnet-1.json +++ b/chains/oraibtc-mainnet-1.json @@ -4,6 +4,7 @@ "rpc": "https://btc.rpc.orai.io", "rest": "https://btc.lcd.orai.io", "networkType": "cosmos", + "chainSymbolImageUrl": "https://assets.coingecko.com/coins/images/1/small/bitcoin.png", "stakeCurrency": { "coinDenom": "ORAIBTC", "coinMinimalDenom": "uoraibtc", diff --git a/chains/osmosis-1.json b/chains/osmosis-1.json index 61d4375..d348336 100644 --- a/chains/osmosis-1.json +++ b/chains/osmosis-1.json @@ -15,13 +15,8 @@ "bech32PrefixConsAddr": "osmovalcons", "bech32PrefixConsPub": "osmovalconspub" }, - "features": [ - "stargate", - "ibc-transfer", - "no-legacy-stdTx", - "ibc-go", - "cosmwasm" - ], + "features": ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go", "cosmwasm"], + "chainSymbolImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", "stakeCurrency": { "coinDenom": "OSMO", "coinMinimalDenom": "uosmo", diff --git a/packages/common/src/chain-infos/chain-info-reader.ts b/packages/common/src/chain-infos/chain-info-reader.ts index 80e881e..d9aab41 100644 --- a/packages/common/src/chain-infos/chain-info-reader.ts +++ b/packages/common/src/chain-infos/chain-info-reader.ts @@ -5,26 +5,15 @@ import { CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS } from "../constants"; import { fetchRetry } from "../helpers"; -import { - ChainInfoReader, - ChainInfoReaderFromGitRawOptions, - CustomChainInfo -} from "./types"; +import { ChainInfoReader, ChainInfoReaderFromGitRawOptions, CustomChainInfo } from "./types"; export class ChainInfoReaderFromBackend implements ChainInfoReader { - constructor( - private readonly baseUrl?: string, - private readonly dex?: string - ) {} + constructor(private readonly baseUrl?: string, private readonly dex?: string) {} async readChainInfos() { - const { BASE_ENDPOINT, BASE_URL, CHAIN_INFOS } = - CHAIN_REGISTRY_BACKEND_ENDPOINTS; + const { BASE_ENDPOINT, BASE_URL, CHAIN_INFOS } = CHAIN_REGISTRY_BACKEND_ENDPOINTS; const url = - (this.baseUrl ?? BASE_URL) + - path.join(BASE_ENDPOINT, CHAIN_INFOS) + - "?dex=" + - this.dex; + (this.baseUrl ?? BASE_URL) + path.join(BASE_ENDPOINT, CHAIN_INFOS) + "?dex=" + this.dex; const chains = (await (await fetchRetry(url)).json()) as CustomChainInfo[]; return chains; } @@ -34,9 +23,7 @@ export class ChainInfoReaderFromOraiCommon implements ChainInfoReader { constructor(private readonly sourceUrl: string) {} async readChainInfos() { - const chains = (await ( - await fetchRetry(this.sourceUrl) - ).json()) as CustomChainInfo[]; + const chains = (await (await fetchRetry(this.sourceUrl)).json()) as CustomChainInfo[]; return chains; } } @@ -63,16 +50,12 @@ export class ChainInfoReaderFromGit implements ChainInfoReader { ).json(); const responses = ( - await Promise.allSettled( - response.map((chain) => fetchRetry(chain.download_url)) - ) + await Promise.allSettled(response.map((chain) => fetchRetry(chain.download_url))) ) .filter((chain) => chain.status === "fulfilled") .map((chain) => chain.value); - const chains: CustomChainInfo[] = await Promise.all( - responses.map((data) => data.json()) - ); + const chains: CustomChainInfo[] = await Promise.all(responses.map((data) => data.json())); return chains; } } @@ -88,9 +71,6 @@ export class ChainInfoReaderFromGitRaw implements ChainInfoReader { baseUrl: CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS.BASE_URL } ) { - if (!this.options.baseUrl) - this.options.baseUrl = - CHAIN_REGISTRY_GITHUB_RAWCONTENT_ENDPOINTS.BASE_URL; this.generateUrls(); } @@ -106,7 +86,15 @@ export class ChainInfoReaderFromGitRaw implements ChainInfoReader { async readChainInfos() { const chainInfos: CustomChainInfo[] = await this.fetchUrls(); - return chainInfos; + + return chainInfos.map((chain: any) => { + const nativeToken = chain.feeCurrencies?.[0]; + return { + ...chain, + chainLogoPng: chain.chainLogoPng || nativeToken?.coinImageUrl, + chainLogoSvg: chain.chainLogoSvg || nativeToken?.coinImageUrl + }; + }); } async fetchUrls() { diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 1d1447b..7105525 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -56,7 +56,8 @@ export class TokenItemsImpl implements TokenItems { gasPriceStep: currency.gasPriceStep, feeCurrencies: network.feeCurrencies, evmDenoms: evmDenomsMap[currency.coinMinimalDenom], - icon: currency.coinImageUrl + icon: currency.coinImageUrl, + iconLight: currency.coinImageUrl }; }); }; diff --git a/packages/common/src/token-items/types.ts b/packages/common/src/token-items/types.ts index 9859c78..7ebc122 100644 --- a/packages/common/src/token-items/types.ts +++ b/packages/common/src/token-items/types.ts @@ -24,4 +24,5 @@ export type TokenItemType = { }; feeCurrencies?: FeeCurrency[]; icon: string; + iconLight?: string; }; From b1c0716e3a4479d3fdd3ecd8adef99de290e5d70 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:07:44 +0700 Subject: [PATCH 58/84] fix: update chainSymbolImageUrl and coinImageUrl for Osmosis to use new asset URLs --- chains/osmosis-1.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chains/osmosis-1.json b/chains/osmosis-1.json index d348336..52e8af9 100644 --- a/chains/osmosis-1.json +++ b/chains/osmosis-1.json @@ -16,13 +16,13 @@ "bech32PrefixConsPub": "osmovalconspub" }, "features": ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go", "cosmwasm"], - "chainSymbolImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "chainSymbolImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "stakeCurrency": { "coinDenom": "OSMO", "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } }, "feeCurrencies": [ @@ -31,7 +31,7 @@ "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } } ], @@ -41,7 +41,7 @@ "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 }, "bridgeTo": ["Oraichain"] }, From 24c90bd6a05fd2bd3f0c628cb4ef1456979a0613 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:12:16 +0700 Subject: [PATCH 59/84] fix: update chain names to use proper capitalization and update chainSymbolImageUrl for Oraichain --- chains/0x01.json | 2 +- chains/0x2b6653dc.json | 2 +- chains/0x38.json | 2 +- chains/Neutaro-1.json | 3 ++- chains/Oraichain.json | 4 ++-- chains/cosmoshub-4.json | 2 +- chains/injective-1.json | 2 +- chains/noble-1.json | 10 ++-------- chains/osmosis-1.json | 2 +- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/chains/0x01.json b/chains/0x01.json index cc1b35a..3eac81b 100644 --- a/chains/0x01.json +++ b/chains/0x01.json @@ -2,7 +2,7 @@ "$schema": "../chain.schema.json", "rpc": "https://rpc.ankr.com/eth", "chainId": "0x01", - "chainName": "ethereum", + "chainName": "Ethereum", "bip44": { "coinType": 60 }, "coinType": 60, "networkType": "evm", diff --git a/chains/0x2b6653dc.json b/chains/0x2b6653dc.json index 8d9d219..367cce3 100644 --- a/chains/0x2b6653dc.json +++ b/chains/0x2b6653dc.json @@ -4,7 +4,7 @@ "rest": "https://api.trongrid.io", "chainId": "0x2b6653dc", "networkType": "evm", - "chainName": "tronnetwork", + "chainName": "Tron Network", "features": ["isEvm"], "chainSymbolImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png", "feeCurrencies": [ diff --git a/chains/0x38.json b/chains/0x38.json index 2d511be..4a66a5b 100644 --- a/chains/0x38.json +++ b/chains/0x38.json @@ -3,7 +3,7 @@ "rpc": "https://bsc-dataseed1.binance.org", "networkType": "evm", "chainId": "0x38", - "chainName": "bsc", + "chainName": "BNB Chain", "bip44": { "coinType": 60 }, "coinType": 60, "features": ["isEvm"], diff --git a/chains/Neutaro-1.json b/chains/Neutaro-1.json index 7af6af6..f8f48de 100644 --- a/chains/Neutaro-1.json +++ b/chains/Neutaro-1.json @@ -3,10 +3,11 @@ "rpc": "https://neutaro.rpc.orai.io", "rest": "https://neutaro.lcd.orai.io", "chainId": "Neutaro-1", - "chainName": "neutaro", + "chainName": "Neutaro", "networkType": "cosmos", "bip44": { "coinType": 118 }, "coinType": 118, + "chainSymbolImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/Neutaro/chain.png", "bech32Config": { "bech32PrefixAccAddr": "neutaro", "bech32PrefixAccPub": "neutaropub", diff --git a/chains/Oraichain.json b/chains/Oraichain.json index ada0254..e6a0b69 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -3,7 +3,7 @@ "rpc": "https://rpc.orai.io", "rest": "https://lcd.orai.io", "chainId": "Oraichain", - "chainName": "oraichain", + "chainName": "Oraichain", "networkType": "cosmos", "stakeCurrency": { "coinDenom": "ORAI", @@ -41,7 +41,7 @@ "txUrl": "https://scan.orai.io/txs/{txHash}", "accountUrl": "https://scan.orai.io/account/{address}" }, - "chainSymbolImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/celestia/chain.png", + "chainSymbolImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "currencies": [ { "coinDenom": "ORAI", diff --git a/chains/cosmoshub-4.json b/chains/cosmoshub-4.json index eb3da87..e855545 100644 --- a/chains/cosmoshub-4.json +++ b/chains/cosmoshub-4.json @@ -3,7 +3,7 @@ "rpc": "https://rpc-cosmos.oraidex.io", "rest": "https://lcd-cosmos.oraidex.io", "chainId": "cosmoshub-4", - "chainName": "cosmos", + "chainName": "Cosmos Hub", "networkType": "cosmos", "bip44": { "coinType": 118 }, "coinType": 118, diff --git a/chains/injective-1.json b/chains/injective-1.json index 62ffe57..6e43a6c 100644 --- a/chains/injective-1.json +++ b/chains/injective-1.json @@ -3,7 +3,7 @@ "rpc": "https://injective.rpc.orai.io", "rest": "https://injective.lcd.orai.io", "chainId": "injective-1", - "chainName": "injective", + "chainName": "Injective", "networkType": "cosmos", "bip44": { "coinType": 60 }, "coinType": 60, diff --git a/chains/noble-1.json b/chains/noble-1.json index 2a2b195..7cffd41 100644 --- a/chains/noble-1.json +++ b/chains/noble-1.json @@ -3,7 +3,7 @@ "rpc": "https://noble-rpc.polkachu.com", "rest": "https://noble-api.polkachu.com", "chainId": "noble-1", - "chainName": "noble", + "chainName": "Noble", "networkType": "cosmos", "bip44": { "coinType": 118 }, "coinType": 118, @@ -15,13 +15,7 @@ "bech32PrefixConsAddr": "noblevalcons", "bech32PrefixConsPub": "noblevalconspub" }, - "features": [ - "stargate", - "ibc-transfer", - "no-legacy-stdTx", - "ibc-go", - "cosmwasm" - ], + "features": ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go", "cosmwasm"], "currencies": [ { "coinDenom": "USDC", diff --git a/chains/osmosis-1.json b/chains/osmosis-1.json index 52e8af9..770b567 100644 --- a/chains/osmosis-1.json +++ b/chains/osmosis-1.json @@ -3,7 +3,7 @@ "rpc": "https://osmosis.rpc.orai.io/", "rest": "https://osmosis.lcd.orai.io/", "chainId": "osmosis-1", - "chainName": "osmosis", + "chainName": "Osmosis", "networkType": "cosmos", "bip44": { "coinType": 118 }, "coinType": 118, From 35e4911f5817b968f27f07749d3d7f2bc874dc66 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:37:39 +0700 Subject: [PATCH 60/84] fix: update coinImageUrl for Oraichain across multiple chain configurations --- CHAIN_REGISTRY.md | 14 ++++---------- chains/0x01.json | 2 +- chains/0x38.json | 2 +- chains/injective-1.json | 2 +- chains/oraibridge-subnet-2.json | 4 ++-- chains/osmosis-1.json | 11 +++++------ 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/CHAIN_REGISTRY.md b/CHAIN_REGISTRY.md index ebd5f3f..391defa 100644 --- a/CHAIN_REGISTRY.md +++ b/CHAIN_REGISTRY.md @@ -53,7 +53,7 @@ A sample `Oraichain.json` includes the following information. "coinDecimals": 6, "coinGeckoId": "oraichain-token", "bridgeTo": ["0x38", "0x01", "injective-1"], - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } }, "feeCurrencies": [ @@ -63,7 +63,7 @@ A sample `Oraichain.json` includes the following information. "coinDecimals": 6, "coinGeckoId": "oraichain-token", "bridgeTo": ["0x38", "0x01", "injective-1"], - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } } ], @@ -76,13 +76,7 @@ A sample `Oraichain.json` includes the following information. "bech32PrefixConsAddr": "oraivalcons", "bech32PrefixConsPub": "oraivalconspub" }, - "features": [ - "stargate", - "ibc-transfer", - "cosmwasm", - "wasmd_0.24+", - "no-legacy-stdTx" - ], + "features": ["stargate", "ibc-transfer", "cosmwasm", "wasmd_0.24+", "no-legacy-stdTx"], "txExplorer": { "name": "Oraiscan", "txUrl": "https://scan.orai.io/txs/{txHash}", @@ -95,7 +89,7 @@ A sample `Oraichain.json` includes the following information. "coinDecimals": 6, "coinGeckoId": "oraichain-token", "bridgeTo": ["0x38", "0x01", "injective-1"], - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } }, { diff --git a/chains/0x01.json b/chains/0x01.json index 3eac81b..6a04ae7 100644 --- a/chains/0x01.json +++ b/chains/0x01.json @@ -29,7 +29,7 @@ "bridgeTo": ["Oraichain"], "coinGeckoId": "oraichain-token", "prefixToken": "eth-mainnet", - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png" + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png" }, { "coinDenom": "USDC", diff --git a/chains/0x38.json b/chains/0x38.json index 4a66a5b..01b99ee 100644 --- a/chains/0x38.json +++ b/chains/0x38.json @@ -29,7 +29,7 @@ "coinDecimals": 18, "coinGeckoId": "oraichain-token", "prefixToken": "oraib", - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png" + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png" }, { "coinDenom": "AIRI", diff --git a/chains/injective-1.json b/chains/injective-1.json index 6e43a6c..eec3be9 100644 --- a/chains/injective-1.json +++ b/chains/injective-1.json @@ -62,7 +62,7 @@ "coinMinimalDenom": "ibc/C20C0A822BD22B2CEF0D067400FCCFB6FAEEE9E91D360B4E0725BD522302D565", "coinDecimals": 6, "coinGeckoId": "oraichain-token", - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "bridgeTo": ["Oraichain"] } ], diff --git a/chains/oraibridge-subnet-2.json b/chains/oraibridge-subnet-2.json index 0fc30a2..c84ca32 100644 --- a/chains/oraibridge-subnet-2.json +++ b/chains/oraibridge-subnet-2.json @@ -43,7 +43,7 @@ "bridgeNetworkIdentifier": "0x38", "coinDecimals": 18, "coinGeckoId": "oraichain-token", - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png" + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png" }, { "coinDenom": "ORAI", @@ -52,7 +52,7 @@ "coinDecimals": 18, "coinGeckoId": "oraichain-token", "prefixToken": "eth-mainnet", - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png" + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png" }, { "coinDenom": "USDC", diff --git a/chains/osmosis-1.json b/chains/osmosis-1.json index 770b567..681bcfc 100644 --- a/chains/osmosis-1.json +++ b/chains/osmosis-1.json @@ -3,7 +3,7 @@ "rpc": "https://osmosis.rpc.orai.io/", "rest": "https://osmosis.lcd.orai.io/", "chainId": "osmosis-1", - "chainName": "Osmosis", + "chainName": "osmosis", "networkType": "cosmos", "bip44": { "coinType": 118 }, "coinType": 118, @@ -16,13 +16,12 @@ "bech32PrefixConsPub": "osmovalconspub" }, "features": ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go", "cosmwasm"], - "chainSymbolImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "stakeCurrency": { "coinDenom": "OSMO", "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", + "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } }, "feeCurrencies": [ @@ -31,7 +30,7 @@ "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", + "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } } ], @@ -41,7 +40,7 @@ "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", + "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 }, "bridgeTo": ["Oraichain"] }, @@ -58,7 +57,7 @@ "coinMinimalDenom": "ibc/161D7D62BAB3B9C39003334F1671208F43C06B643CC9EDBBE82B64793C857F1D", "coinDecimals": 6, "coinGeckoId": "oraichain-token", - "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } }, { From 1f0c5760a17666b3cb2e10cc2155496e8a774ead Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:42:30 +0700 Subject: [PATCH 61/84] fix: update coinImageUrl and add chainSymbolImageUrl for Osmosis to use new asset URLs --- chains/osmosis-1.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chains/osmosis-1.json b/chains/osmosis-1.json index 681bcfc..363dcdf 100644 --- a/chains/osmosis-1.json +++ b/chains/osmosis-1.json @@ -21,16 +21,17 @@ "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } }, + "chainSymbolImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "feeCurrencies": [ { "coinDenom": "OSMO", "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 } } ], @@ -40,7 +41,7 @@ "coinMinimalDenom": "uosmo", "coinDecimals": 6, "coinGeckoId": "osmosis", - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png", + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/small/osmo.png?1632763885", "gasPriceStep": { "low": 0, "average": 0.025, "high": 0.04 }, "bridgeTo": ["Oraichain"] }, From bf43fb1cac7c437e17b08ff82ad9c0b4b0f77a98 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:43:00 +0700 Subject: [PATCH 62/84] fix: update chainName for Osmosis to use proper capitalization --- chains/osmosis-1.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/osmosis-1.json b/chains/osmosis-1.json index 363dcdf..593238c 100644 --- a/chains/osmosis-1.json +++ b/chains/osmosis-1.json @@ -3,7 +3,7 @@ "rpc": "https://osmosis.rpc.orai.io/", "rest": "https://osmosis.lcd.orai.io/", "chainId": "osmosis-1", - "chainName": "osmosis", + "chainName": "Osmosis", "networkType": "cosmos", "bip44": { "coinType": 118 }, "coinType": 118, From 4751b8db3f8c38ac5aa1e8c19ae753c384c183db Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 17:49:45 +0700 Subject: [PATCH 63/84] fix: add coinImageUrl for Oraichain in chain configuration --- chains/Oraichain.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index e6a0b69..50aa9d2 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -156,7 +156,8 @@ "type": "cw20", "contractAddress": "orai1065qe48g7aemju045aeyprflytemx7kecxkf5m7u5h5mphd0qlcs47pclp", "coinGeckoId": "scorai", - "coinDecimals": 6 + "coinDecimals": 6, + "coinImageUrl": "https://assets.coingecko.com/coins/images/28897/standard/Orchai_LOGO.png?1696527873" }, { "coinDenom": "wTRX", From 9842bb67053eeda6c0f124c2ac9c9632f727f8a0 Mon Sep 17 00:00:00 2001 From: trungbach Date: Wed, 4 Dec 2024 18:43:48 +0700 Subject: [PATCH 64/84] fix: add coinImageUrl for Oraichain in chain configuration --- chains/Oraichain.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 50aa9d2..ff82b63 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -175,7 +175,8 @@ "type": "cw20", "contractAddress": "orai19q4qak2g3cj2xc2y3060t0quzn3gfhzx08rjlrdd3vqxhjtat0cq668phq", "coinGeckoId": "scatom", - "coinDecimals": 6 + "coinDecimals": 6, + "coinImageUrl": "https://assets.coingecko.com/coins/images/33050/standard/orchai_logo_white_copy_4x-8_%281%29.png?1700473937" }, { "coinDenom": "IBC INJ", From 787723492d21289de0de6332eeac707b1609b12f Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 14:14:43 +0700 Subject: [PATCH 65/84] fix: update chainName for Bitcoin to use proper capitalization and remove unnecessary bridge entries for Oraichain --- chains/Oraichain.json | 10 ---------- chains/bitcoin.json | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index ff82b63..eeb7bc4 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -236,7 +236,6 @@ "coinMinimalDenom": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/ton", "coinDecimals": 9, "coinGeckoId": "the-open-network", - "bridgeTo": ["ton"], "coinImageUrl": "https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png?1696517498" }, { @@ -247,19 +246,10 @@ "coinDecimals": 6, "coinImageUrl": "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776" }, - { - "coinDenom": "CAT", - "coinGeckoId": "simon-s-cat", - "coinMinimalDenom": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/extCAT", - "bridgeTo": ["0x38"], - "coinDecimals": 6, - "coinImageUrl": "https://assets.coingecko.com/coins/images/39765/standard/Simon's_Cat_Logo.png?1724017505" - }, { "coinDenom": "HMSTR", "coinGeckoId": "hamster-kombat", "coinMinimalDenom": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/HMSTR", - "bridgeTo": ["ton"], "coinDecimals": 9, "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/32195.png" }, diff --git a/chains/bitcoin.json b/chains/bitcoin.json index cd4305b..31a673d 100644 --- a/chains/bitcoin.json +++ b/chains/bitcoin.json @@ -3,7 +3,7 @@ "rpc": "https://rpc.ankr.com/btc", "rest": "https://blockstream.info/api", "chainId": "bitcoin", - "chainName": "bitcoin", + "chainName": "Bitcoin", "bip44": { "coinType": 0 }, From 731df34a4b774a33fa1486379908c808a397261a Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 14:36:48 +0700 Subject: [PATCH 66/84] fix: update coinImageUrl for Oraichain to use new asset URL --- chains/Oraichain.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index eeb7bc4..901afb6 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -66,7 +66,7 @@ "coinMinimalDenom": "ibc/576B1D63E401B6A9A071C78A1D1316D016EC9333D2FEB14AD503FAC4B8731CD1", "bridgeTo": ["Neutaro-1"], "coinDecimals": 6, - "coinImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/Neutaro/chain.png" + "coinImageUrl": "https://assets.coingecko.com/coins/images/36277/standard/Neutaro_logo.jpg?1711371142" }, { "coinDenom": "AIRI", From ae2121ddfbc03be1c821735c6ab8b670f503ff14 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 15:00:58 +0700 Subject: [PATCH 67/84] feat: add Solana chain configuration and update bridge entries for Oraichain --- chains/0x38.json | 10 +++ chains/Oraichain.json | 10 ++- ...lana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json | 66 +++++++++++++++++++ packages/common/src/constants/chain-ids.ts | 3 +- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json diff --git a/chains/0x38.json b/chains/0x38.json index 01b99ee..71b9af1 100644 --- a/chains/0x38.json +++ b/chains/0x38.json @@ -105,6 +105,16 @@ "bridgeTo": ["Oraichain"], "prefixToken": "oraib", "coinImageUrl": "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776" + }, + { + "coinDenom": "WSOL", + "coinMinimalDenom": "bep20_wsol", + "contractAddress": "0xfA54fF1a158B5189Ebba6ae130CEd6bbd3aEA76e", + "coinDecimals": 9, + "coinGeckoId": "solana", + "bridgeTo": ["Oraichain"], + "prefixToken": "oraib", + "coinImageUrl": "https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756" } ], "txExplorer": { diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 901afb6..8c8c822 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -48,7 +48,7 @@ "coinMinimalDenom": "orai", "coinDecimals": 6, "coinGeckoId": "oraichain-token", - "bridgeTo": ["0x38", "0x01", "injective-1"], + "bridgeTo": ["0x38", "0x01", "injective-1", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-token.png", "gasPriceStep": { "low": 0.003, "average": 0.005, "high": 0.007 } }, @@ -260,6 +260,14 @@ "bridgeTo": ["0x38"], "coinDecimals": 8, "coinImageUrl": "https://assets.coingecko.com/coins/images/5/standard/dogecoin.png?1696501409" + }, + { + "coinDenom": "MAX", + "coinGeckoId": "max-2", + "coinMinimalDenom": "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/oraim8c9d1nkfuQk9EzGYEUGxqL3MHQYndRw1huVo5h", + "bridgeTo": ["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], + "coinDecimals": 6, + "coinImageUrl": "https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2" } ] } diff --git a/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json b/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json new file mode 100644 index 0000000..3e28a70 --- /dev/null +++ b/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json @@ -0,0 +1,66 @@ +{ + "rpc": "https://swr.xnftdata.com/rpc-proxy/", + "rest": "https://swr.xnftdata.com/rpc-proxy/", + "chainId": "solChainId", + "chainName": "Solana", + "bip44": { + "coinType": 501 + }, + "bech32Config": { + "bech32PrefixAccAddr": "sol", + "bech32PrefixAccPub": "solpub", + "bech32PrefixValAddr": "solvaloper", + "bech32PrefixValPub": "solvaloperpub", + "bech32PrefixConsAddr": "solvalcons", + "bech32PrefixConsPub": "solvalconspub" + }, + "stakeCurrency": { + "coinDenom": "SOL", + "coinMinimalDenom": "sol", + "coinDecimals": 9, + "coinGeckoId": "solana", + "coinImageUrl": "https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756" + }, + "chainSymbolImageUrl": "https://upload.wikimedia.org/wikipedia/en/b/b9/Solana_logo.png", + "networkType": "svm", + "currencies": [ + { + "coinDenom": "MAX", + "coinMinimalDenom": "max", + "coinDecimals": 6, + "bridgeTo": ["Oraichain"], + "contractAddress": "oraim8c9d1nkfuQk9EzGYEUGxqL3MHQYndRw1huVo5h", + "coinGeckoId": "max-2", + "coinImageUrl": "https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2" + }, + { + "coinDenom": "ORAI", + "coinMinimalDenom": "s20_orai", + "coinDecimals": 8, + "bridgeTo": ["Oraichain"], + "contractAddress": "2hZWncnmsSMdbkdwzSHJfrnDVkL66g63gncdRWqjTbBB", + "coinGeckoId": "oraichain-token", + "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png" + } + ], + "feeCurrencies": [ + { + "coinDenom": "SOL", + "coinMinimalDenom": "sol", + "coinDecimals": 9, + "coinGeckoId": "solana", + "coinImageUrl": "https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756", + "gasPriceStep": { + "low": 1, + "average": 1.25, + "high": 1.5 + } + } + ], + "features": [], + "txExplorer": { + "name": "Sol Scan", + "txUrl": "https://solscan.io/tx/{txHash}", + "accountUrl": "https://solscan.io/address/{address}" + } +} diff --git a/packages/common/src/constants/chain-ids.ts b/packages/common/src/constants/chain-ids.ts index 6e86ad2..ee64cab 100644 --- a/packages/common/src/constants/chain-ids.ts +++ b/packages/common/src/constants/chain-ids.ts @@ -86,4 +86,5 @@ export type EvmChainId = (typeof EVM_CHAIN_IDS)[keyof typeof EVM_CHAIN_IDS]; export type CosmosChainId = (typeof COSMOS_CHAIN_IDS)[keyof typeof COSMOS_CHAIN_IDS]; export type TonChainId = (typeof TON_CHAIN_ID)[keyof typeof TON_CHAIN_ID]; export type BitcoinChainId = (typeof BITCOIN_CHAIN_ID)[keyof typeof BITCOIN_CHAIN_ID]; -export type NetworkChainId = CosmosChainId | EvmChainId | TonChainId | BitcoinChainId; +export type SolChainId = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"; +export type NetworkChainId = CosmosChainId | EvmChainId | TonChainId | BitcoinChainId | SolChainId; From bcb0f354181c9abb8a30d73e52ed1f758997a0e7 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 15:03:13 +0700 Subject: [PATCH 68/84] fix: update chainId for Solana configuration to use correct identifier --- chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json b/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json index 3e28a70..9cf032e 100644 --- a/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json +++ b/chains/solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.json @@ -1,7 +1,7 @@ { "rpc": "https://swr.xnftdata.com/rpc-proxy/", "rest": "https://swr.xnftdata.com/rpc-proxy/", - "chainId": "solChainId", + "chainId": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "chainName": "Solana", "bip44": { "coinType": 501 From 5ede433c8864319699ea3c35cbb94cf7151ff928 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 15:45:55 +0700 Subject: [PATCH 69/84] fix: bump version to 1.2.1-beta10 in package.json --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index e4f37f2..8df46dd 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta9", + "version": "1.2.1-beta10", "main": "build/index.js", "license": "MIT", "scripts": { From bcd8575f7289ad1e8b807ed63687baf2b9421b21 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 17:11:34 +0700 Subject: [PATCH 70/84] feat: add bridgeTo property for Oraichain to enable bridging to Bitcoin --- chains/Oraichain.json | 1 + 1 file changed, 1 insertion(+) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 8c8c822..aeeebe0 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -212,6 +212,7 @@ "type": "cw20", "contractAddress": "orai10g6frpysmdgw5tdqke47als6f97aqmr8s3cljsvjce4n5enjftcqtamzsd", "coinDecimals": 6, + "bridgeTo": ["bitcoin"], "coinImageUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png" }, { From 13b9534b6168521e2e9f25fe581502f6d9da0634 Mon Sep 17 00:00:00 2001 From: trungbach Date: Thu, 5 Dec 2024 18:21:05 +0700 Subject: [PATCH 71/84] feat: add HTT coin configuration for Oraichain with new contract address and image URL --- chains/Oraichain.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index aeeebe0..37f494a 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -269,6 +269,15 @@ "bridgeTo": ["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], "coinDecimals": 6, "coinImageUrl": "https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2" + }, + { + "coinDenom": "HTT", + "coinGeckoId": "osmosis", + "coinMinimalDenom": "cw20:orai1k5d5cgekt8kkzcrnxrx860wadvz5esjwtyv299g0ht75a92yfn6qvgu0ml:OCH", + "contractAddress": "orai1k5d5cgekt8kkzcrnxrx860wadvz5esjwtyv299g0ht75a92yfn6qvgu0ml", + "coinDecimals": 6, + "type": "cw20", + "coinImageUrl": "https://i.imgur.com/JEUjDal.jpeg" } ] } From 77b54078d36b5775dcc9f7cfd0d24b8a75d23dc5 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 15:49:37 +0700 Subject: [PATCH 72/84] feat: add THT coin configuration for Oraichain with new contract address and image URL --- chains/Oraichain.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 37f494a..9185ba5 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -278,6 +278,15 @@ "coinDecimals": 6, "type": "cw20", "coinImageUrl": "https://i.imgur.com/JEUjDal.jpeg" + }, + { + "coinDenom": "THT", + "coinGeckoId": "polkadot", + "coinMinimalDenom": "cw20:orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re:THT", + "contractAddress": "orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re", + "coinDecimals": 6, + "type": "cw20", + "coinImageUrl": "https://i.imgur.com/28ZtBo3.jpeg" } ] } From e7f92124798612231b27e2b140b5da996967fb13 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 15:54:28 +0700 Subject: [PATCH 73/84] refactor: remove THT coin configuration from Oraichain.json --- chains/Oraichain.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 9185ba5..37f494a 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -278,15 +278,6 @@ "coinDecimals": 6, "type": "cw20", "coinImageUrl": "https://i.imgur.com/JEUjDal.jpeg" - }, - { - "coinDenom": "THT", - "coinGeckoId": "polkadot", - "coinMinimalDenom": "cw20:orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re:THT", - "contractAddress": "orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re", - "coinDecimals": 6, - "type": "cw20", - "coinImageUrl": "https://i.imgur.com/28ZtBo3.jpeg" } ] } From 5ef061796b5faa900960aa87725795717a92e60d Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 15:55:02 +0700 Subject: [PATCH 74/84] feat: add THT coin configuration for Oraichain with contract address and image URL --- chains/Oraichain.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 37f494a..9185ba5 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -278,6 +278,15 @@ "coinDecimals": 6, "type": "cw20", "coinImageUrl": "https://i.imgur.com/JEUjDal.jpeg" + }, + { + "coinDenom": "THT", + "coinGeckoId": "polkadot", + "coinMinimalDenom": "cw20:orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re:THT", + "contractAddress": "orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re", + "coinDecimals": 6, + "type": "cw20", + "coinImageUrl": "https://i.imgur.com/28ZtBo3.jpeg" } ] } From 083c9d2e0c1450498f983d92ff965a67861b7f4e Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 16:26:08 +0700 Subject: [PATCH 75/84] refactor: remove HTT coin configuration from Oraichain.json --- chains/Oraichain.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 37f494a..dcf72d0 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -270,14 +270,5 @@ "coinDecimals": 6, "coinImageUrl": "https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2" }, - { - "coinDenom": "HTT", - "coinGeckoId": "osmosis", - "coinMinimalDenom": "cw20:orai1k5d5cgekt8kkzcrnxrx860wadvz5esjwtyv299g0ht75a92yfn6qvgu0ml:OCH", - "contractAddress": "orai1k5d5cgekt8kkzcrnxrx860wadvz5esjwtyv299g0ht75a92yfn6qvgu0ml", - "coinDecimals": 6, - "type": "cw20", - "coinImageUrl": "https://i.imgur.com/JEUjDal.jpeg" - } ] } From 65912ba7c201a90a0404c9267f4cad3afa0de7e4 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 16:26:25 +0700 Subject: [PATCH 76/84] fix: correct JSON formatting in Oraichain.json --- chains/Oraichain.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index dcf72d0..aeeebe0 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -269,6 +269,6 @@ "bridgeTo": ["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], "coinDecimals": 6, "coinImageUrl": "https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2" - }, + } ] } From 92f3901c3b40ff132d92cf764e40fb18ff5e05f7 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 16:30:23 +0700 Subject: [PATCH 77/84] refactor: remove THT coin configuration from Oraichain.json --- chains/Oraichain.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 9185ba5..37f494a 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -278,15 +278,6 @@ "coinDecimals": 6, "type": "cw20", "coinImageUrl": "https://i.imgur.com/JEUjDal.jpeg" - }, - { - "coinDenom": "THT", - "coinGeckoId": "polkadot", - "coinMinimalDenom": "cw20:orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re:THT", - "contractAddress": "orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re", - "coinDecimals": 6, - "type": "cw20", - "coinImageUrl": "https://i.imgur.com/28ZtBo3.jpeg" } ] } From f71507e282f2bbe0fffb63e75fa259c560fd84e6 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 6 Dec 2024 16:30:52 +0700 Subject: [PATCH 78/84] feat: add THT coin configuration to Oraichain.json with contract address and image URL --- chains/Oraichain.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index aeeebe0..a8797ff 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -269,6 +269,15 @@ "bridgeTo": ["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], "coinDecimals": 6, "coinImageUrl": "https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2" + }, + { + "coinDenom": "THT", + "coinGeckoId": "polkadot", + "coinMinimalDenom": "cw20:orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re:THT", + "contractAddress": "orai1fkz48mkvw9cs848kjmr69gn7znj9flyc3vd2xvzud7h2x36xaj7q6p48re", + "coinDecimals": 6, + "type": "cw20", + "coinImageUrl": "https://i.imgur.com/28ZtBo3.jpeg" } ] } From b9b7c8b55ae429f451ff9ad78f7fbcf2d94939af Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 10 Dec 2024 16:21:28 +0700 Subject: [PATCH 79/84] feat: update package version to 1.2.1-beta11 and enhance TokenItemsImpl with new methods for managing extended token items --- packages/common/package.json | 2 +- .../common/src/token-items/token-items.ts | 63 ++++++++++++++----- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 8df46dd..b246172 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta10", + "version": "1.2.1-beta11", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 7105525..3dd445e 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -1,5 +1,9 @@ import { flatten, uniqBy } from "lodash"; -import { ChainInfoReader, CustomChainInfo } from "../chain-infos"; +import { + BridgeAppCurrency, + ChainInfoReader, + CustomChainInfo +} from "../chain-infos"; import { COSMOS_CHAIN_IDS } from "../constants/chain-ids"; import { IBC_DENOMS } from "../constants/denoms"; import { NETWORK_TYPES } from "../constants/network"; @@ -20,8 +24,14 @@ export interface TokenItems { getSpecificChainTokens: (chainId: string) => TokenItemType[]; } +const evmDenomsMap = { + kwt: [IBC_DENOMS.KWTBSC], + milky: [IBC_DENOMS.MILKYBSC], + injective: [IBC_DENOMS.INJECTIVE] +}; + export class TokenItemsImpl implements TokenItems { - constructor(private readonly chainInfos: CustomChainInfo[]) {} + constructor(private chainInfos: CustomChainInfo[]) {} static async create(chainInfoReader: ChainInfoReader) { const chainInfos = await chainInfoReader.readChainInfos(); @@ -29,20 +39,19 @@ export class TokenItemsImpl implements TokenItems { return tokenItems; } - private getTokensFromNetwork = (network: CustomChainInfo): TokenItemType[] => { + private getTokensFromNetwork = ( + network: CustomChainInfo + ): TokenItemType[] => { if (!network) return []; - const evmDenomsMap = { - kwt: [IBC_DENOMS.KWTBSC], - milky: [IBC_DENOMS.MILKYBSC], - injective: [IBC_DENOMS.INJECTIVE] - }; + return network.currencies.map((currency) => { return { name: currency.coinDenom, org: network.chainName, coinType: network.bip44.coinType, contractAddress: currency.contractAddress, - prefix: currency?.prefixToken ?? network.bech32Config?.bech32PrefixAccAddr, + prefix: + currency?.prefixToken ?? network.bech32Config?.bech32PrefixAccAddr, coinGeckoId: currency.coinGeckoId, denom: currency.coinMinimalDenom, bridgeNetworkIdentifier: currency.bridgeNetworkIdentifier, @@ -63,7 +72,25 @@ export class TokenItemsImpl implements TokenItems { }; getSpecificChainTokens(chainId: string) { - return this.getTokensFromNetwork(this.chainInfos.find((chain) => chain.chainId === chainId)); + return this.getTokensFromNetwork( + this.chainInfos.find((chain) => chain.chainId === chainId) + ); + } + + addExtendedTokenItemsOnChain( + tokenItems: BridgeAppCurrency[], + chain: CustomChainInfo + ) { + const chainTarget = this.chainInfos.find( + (chainInfo) => chainInfo.chainId === chain.chainId + ); + + if (chainTarget) { + chainTarget.currencies.push(...tokenItems); + this.chainInfos = this.chainInfos.map((chainInfo) => + chainInfo.chainId === chain.chainId ? chainTarget : chainInfo + ); + } } get otherChainTokens() { @@ -76,7 +103,9 @@ export class TokenItemsImpl implements TokenItems { get oraichainTokens() { return this.getTokensFromNetwork( - this.chainInfos.find((chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAICHAIN) + this.chainInfos.find( + (chain) => chain.chainId === COSMOS_CHAIN_IDS.ORAICHAIN + ) ); } @@ -93,12 +122,16 @@ export class TokenItemsImpl implements TokenItems { } get assetInfoMap() { - return Object.fromEntries(this.flattenTokens.map((c) => [c.contractAddress || c.denom, c])); + return Object.fromEntries( + this.flattenTokens.map((c) => [c.contractAddress || c.denom, c]) + ); } get cosmosTokens() { return uniqBy( - this.flattenTokens.filter((token) => token.denom && token.cosmosBased && token.coinGeckoId), + this.flattenTokens.filter( + (token) => token.denom && token.cosmosBased && token.coinGeckoId + ), (c) => c.denom ); } @@ -114,7 +147,9 @@ export class TokenItemsImpl implements TokenItems { } get cw20TokenMap() { - return Object.fromEntries(this.cw20Tokens.map((c) => [c.contractAddress, c])); + return Object.fromEntries( + this.cw20Tokens.map((c) => [c.contractAddress, c]) + ); } get evmTokens() { From 192377f7cc415b9c995ec0f80fcd2f14cc04012e Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 10 Dec 2024 16:32:28 +0700 Subject: [PATCH 80/84] feat: update package version to 1.2.1-beta12 and add method for managing extended token items in OraiCommon --- packages/common/package.json | 2 +- packages/common/src/common.ts | 17 +++++++++++++++-- packages/common/src/token-items/token-items.ts | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index b246172..066c806 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta11", + "version": "1.2.1-beta12", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 73c7f68..02db121 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -1,4 +1,5 @@ import { + BridgeAppCurrency, ChainInfoReader, ChainInfoReaderFromBackend, ChainInfoReaderFromGit, @@ -11,7 +12,10 @@ import { import { TokenItems, TokenItemsImpl } from "./token-items"; export class OraiCommon { - constructor(private _chainInfos?: ChainInfos, private _tokenItems?: TokenItems) {} + constructor( + private _chainInfos?: ChainInfos, + private _tokenItems?: TokenItems + ) {} static initializeFromCustomChainInfos(customChainInfos: CustomChainInfo[]) { const common = new OraiCommon( @@ -36,11 +40,20 @@ export class OraiCommon { return OraiCommon.initializeFromChainInfoReader(reader); } - static async initializeFromGitRaw(options?: ChainInfoReaderFromGitRawOptions) { + static async initializeFromGitRaw( + options?: ChainInfoReaderFromGitRawOptions + ) { const reader = new ChainInfoReaderFromGitRaw(options); return OraiCommon.initializeFromChainInfoReader(reader); } + addExtendedTokenItemsOnChain( + tokenItems: BridgeAppCurrency[], + chain: CustomChainInfo + ) { + this._tokenItems.addExtendedTokenItemsOnChain(tokenItems, chain); + } + withChainInfos(chainInfos: ChainInfos) { this._chainInfos = chainInfos; return this; diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index 3dd445e..ad14d79 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -22,6 +22,10 @@ export interface TokenItems { evmTokens: TokenItemType[]; kawaiiTokens: TokenItemType[]; getSpecificChainTokens: (chainId: string) => TokenItemType[]; + addExtendedTokenItemsOnChain: ( + tokenItems: BridgeAppCurrency[], + chain: CustomChainInfo + ) => void; } const evmDenomsMap = { From 454f98eec9d30eb56cd0ade80fff285f78946fad Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 10 Dec 2024 18:34:22 +0700 Subject: [PATCH 81/84] feat: update package version to 1.2.1-beta13 and remove addExtendedTokenItemsOnChain method from OraiCommon and TokenItems interface --- packages/common/package.json | 2 +- packages/common/src/common.ts | 9 +-------- .../common/src/token-items/token-items.ts | 20 ------------------- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 066c806..e190f16 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta12", + "version": "1.2.1-beta13", "main": "build/index.js", "license": "MIT", "scripts": { diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 02db121..8e23d0f 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -46,14 +46,7 @@ export class OraiCommon { const reader = new ChainInfoReaderFromGitRaw(options); return OraiCommon.initializeFromChainInfoReader(reader); } - - addExtendedTokenItemsOnChain( - tokenItems: BridgeAppCurrency[], - chain: CustomChainInfo - ) { - this._tokenItems.addExtendedTokenItemsOnChain(tokenItems, chain); - } - + withChainInfos(chainInfos: ChainInfos) { this._chainInfos = chainInfos; return this; diff --git a/packages/common/src/token-items/token-items.ts b/packages/common/src/token-items/token-items.ts index ad14d79..107db0a 100644 --- a/packages/common/src/token-items/token-items.ts +++ b/packages/common/src/token-items/token-items.ts @@ -22,10 +22,6 @@ export interface TokenItems { evmTokens: TokenItemType[]; kawaiiTokens: TokenItemType[]; getSpecificChainTokens: (chainId: string) => TokenItemType[]; - addExtendedTokenItemsOnChain: ( - tokenItems: BridgeAppCurrency[], - chain: CustomChainInfo - ) => void; } const evmDenomsMap = { @@ -81,22 +77,6 @@ export class TokenItemsImpl implements TokenItems { ); } - addExtendedTokenItemsOnChain( - tokenItems: BridgeAppCurrency[], - chain: CustomChainInfo - ) { - const chainTarget = this.chainInfos.find( - (chainInfo) => chainInfo.chainId === chain.chainId - ); - - if (chainTarget) { - chainTarget.currencies.push(...tokenItems); - this.chainInfos = this.chainInfos.map((chainInfo) => - chainInfo.chainId === chain.chainId ? chainTarget : chainInfo - ); - } - } - get otherChainTokens() { return flatten( this.chainInfos From 61b05e96b8e820a7561d19c049c24a05733ae18a Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 20 Dec 2024 10:52:33 +0700 Subject: [PATCH 82/84] feat: add chain symbol image URL for TON in configuration --- chains/ton.json | 1 + 1 file changed, 1 insertion(+) diff --git a/chains/ton.json b/chains/ton.json index e41a4ff..c84cbd4 100644 --- a/chains/ton.json +++ b/chains/ton.json @@ -8,6 +8,7 @@ "coinType": 607 }, "coinType": 607, + "chainSymbolImageUrl": "https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png", "stakeCurrency": { "coinDenom": "TON", "coinMinimalDenom": "ton", From b9c94defb8f1e70a8ee2d54188ad0380c54203da Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 20 Dec 2024 11:04:13 +0700 Subject: [PATCH 83/84] fix: update coin image URLs for various tokens in Oraichain configuration --- chains/Oraichain.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chains/Oraichain.json b/chains/Oraichain.json index 8b60a90..f2c4c75 100644 --- a/chains/Oraichain.json +++ b/chains/Oraichain.json @@ -58,7 +58,7 @@ "coinMinimalDenom": "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78", "bridgeTo": ["cosmoshub-4"], "coinDecimals": 6, - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/atom.png" + "coinImageUrl": "https://assets.coingecko.com/coins/images/1481/standard/cosmos_hub.png" }, { "coinDenom": "NTMPI", @@ -76,7 +76,7 @@ "contractAddress": "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg", "bridgeTo": ["0x38"], "coinDecimals": 6, - "coinImageUrl": "https://i.ibb.co/m8mCyMr/airi.png" + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/airi.png" }, { "coinDenom": "USDT", @@ -104,7 +104,7 @@ "coinDecimals": 6, "coinGeckoId": "osmosis", "bridgeTo": ["osmosis-1"], - "coinImageUrl": "https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png" + "coinImageUrl": "https://assets.coingecko.com/coins/images/16724/standard/osmo.png?1696516298" }, { "coinDenom": "BEP20 KWT", @@ -148,7 +148,7 @@ "bridgeTo": ["0x01"], "coinGeckoId": "oraidex", "coinDecimals": 6, - "coinImageUrl": "https://i.ibb.co/VmMJtf7/oraix.png" + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/oraix.png" }, { "coinDenom": "scORAI", From da8a9d9dc2481d690512bab638494dd06ec08589 Mon Sep 17 00:00:00 2001 From: trungbach Date: Fri, 20 Dec 2024 16:25:56 +0700 Subject: [PATCH 84/84] chore: bump version to 1.2.5 in package.json --- packages/common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/package.json b/packages/common/package.json index 71c8bba..dee6a0c 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/common", - "version": "1.2.1-beta13", + "version": "1.2.5", "main": "build/index.js", "license": "MIT", "scripts": {