From 20a1ea7ca040977e34bcf3b0ab02a9015fbbecb5 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 11 Aug 2021 23:25:20 +0800 Subject: [PATCH] modify configs & add persistence chain --- src/libs/data/data.js | 16 ++++++++++++++++ src/store/chains/akash.json | 1 + src/store/chains/band.json | 1 + src/store/chains/cosmos.json | 1 + src/store/chains/crypto.json | 1 + src/store/chains/iris.json | 1 + src/store/chains/kava.json | 1 + src/store/chains/okexchain.json | 1 + src/store/chains/osmosis.json | 1 + src/store/chains/persistence.json | 7 +++++++ src/store/chains/terra.json | 1 + 11 files changed, 32 insertions(+) create mode 100644 src/store/chains/persistence.json diff --git a/src/libs/data/data.js b/src/libs/data/data.js index 9f5361ca..5a8c766f 100644 --- a/src/libs/data/data.js +++ b/src/libs/data/data.js @@ -122,9 +122,25 @@ export function operatorAddressToAccount(operAddress) { if (prefix === 'iva') { // handle special cases return Bech32.encode('iaa', data) } + if (prefix === 'crocncl') { // handle special cases + return Bech32.encode('cro', data) + } return Bech32.encode(prefix.replace('valoper', ''), data) } +// TODO, not tested +export function pubkeyToAccountAddress(pubkey, prefix) { + return Bech32.encode(prefix, pubkey, 40) +} + +export function addressDecode(address) { + return Bech32.decode(address) +} + +export function addressEnCode(prefix, pubkey) { + return Bech32.encode(prefix, pubkey) +} + export function consensusPubkeyToHexAddress(consensusPubkey) { let raw = null if (typeof consensusPubkey === 'object') { diff --git a/src/store/chains/akash.json b/src/store/chains/akash.json index 32bc3487..9d6b39b7 100644 --- a/src/store/chains/akash.json +++ b/src/store/chains/akash.json @@ -2,5 +2,6 @@ "chain_name": "akash", "api": "https://akash.api.ping.pub", "sdk_version": "0.41.3", + "addr_prefix": "akash", "logo": "https://dl.airtable.com/.attachments/52586702dd8352d97834fce5c2d83614/969b4d53/akash-network.png" } \ No newline at end of file diff --git a/src/store/chains/band.json b/src/store/chains/band.json index fc3b4e66..0153b214 100644 --- a/src/store/chains/band.json +++ b/src/store/chains/band.json @@ -1,6 +1,7 @@ { "chain_name": "band", "api": "https://api-gm-lb.bandchain.org", + "addr_prefix": "band", "logo": "https://dl.airtable.com/.attachments/472ae99a508e32b4439b416beddd4eb9/c5166f62/band-symbol-blue-bg.75a3ad91.svg", "sdk_version": "0.33.8" } \ No newline at end of file diff --git a/src/store/chains/cosmos.json b/src/store/chains/cosmos.json index 7a5bdf55..1805bb0c 100644 --- a/src/store/chains/cosmos.json +++ b/src/store/chains/cosmos.json @@ -2,5 +2,6 @@ "chain_name": "cosmos", "api":"https://lcd-cosmoshub.keplr.app", "sdk_version": "0.42.6", + "addr_prefix": "cosmos", "logo": "https://dl.airtable.com/.attachments/e54f814bba8c0f9af8a3056020210de0/2d1155fb/cosmos-hub.svg" } \ No newline at end of file diff --git a/src/store/chains/crypto.json b/src/store/chains/crypto.json index 7efaca9c..852b28cb 100644 --- a/src/store/chains/crypto.json +++ b/src/store/chains/crypto.json @@ -3,5 +3,6 @@ "chain_name": "crypto", "api": "https://mainnet.crypto.org:1317", "sdk_version": "0.39.2", + "addr_prefix": "cro", "logo": "https://dl.airtable.com/.attachments/b2e638424ea09dccd4f11b04dc53872a/844d11dc/LOGO.png" } \ No newline at end of file diff --git a/src/store/chains/iris.json b/src/store/chains/iris.json index c38b6055..7491192b 100644 --- a/src/store/chains/iris.json +++ b/src/store/chains/iris.json @@ -2,5 +2,6 @@ "chain_name": "iris", "api": "https://iris.api.ping.pub", "sdk_version": "0.42.4", + "addr_prefix": "iaa", "logo": "https://dl.airtable.com/.attachments/2d6d51b1b262db00ecc51616ffc3bdf5/90ff00d0/IRISnet.svg" } \ No newline at end of file diff --git a/src/store/chains/kava.json b/src/store/chains/kava.json index dc253a21..94ec02aa 100644 --- a/src/store/chains/kava.json +++ b/src/store/chains/kava.json @@ -2,5 +2,6 @@ "chain_name": "kava", "api": "https://kava4.data.kava.io", "sdk_version": "0.39.2", + "addr_prefix": "kava", "logo": "https://dl.airtable.com/.attachments/f25737491bd0034240093a7b4e039b15/afec77ff/logo.png" } \ No newline at end of file diff --git a/src/store/chains/okexchain.json b/src/store/chains/okexchain.json index 696087e6..4791fbd2 100644 --- a/src/store/chains/okexchain.json +++ b/src/store/chains/okexchain.json @@ -2,6 +2,7 @@ "chain_name": "okexchain", "api": "https://exchainrpc.okex.org/okexchain/v1", "sdk_version": "0.39.2", + "addr_prefix": "ex", "logo": "https://dl.airtable.com/.attachments/4620a173477efece7f459a3d6fc770c0/9f6618ad/OKexchain.svg", "unload_module": ["minting", "slashing"] } \ No newline at end of file diff --git a/src/store/chains/osmosis.json b/src/store/chains/osmosis.json index 8e0d693b..5fcc106e 100644 --- a/src/store/chains/osmosis.json +++ b/src/store/chains/osmosis.json @@ -2,5 +2,6 @@ "chain_name": "osmosis", "api": "https://lcd-osmosis.keplr.app", "sdk_version": "0.42.5", + "addr_prefix": "osmo", "logo": "https://dl.airtable.com/.attachments/4ef30ec4008bc86cc3c0f74a6bb84050/0eeb4d64/aQ5W3zaT_400x400.jpg" } diff --git a/src/store/chains/persistence.json b/src/store/chains/persistence.json new file mode 100644 index 00000000..e22139b9 --- /dev/null +++ b/src/store/chains/persistence.json @@ -0,0 +1,7 @@ +{ + "chain_name": "persistence", + "api": "https://rest.core.persistence.one", + "sdk_version": "0.42.4", + "addr_prefix": "persistence", + "logo": "https://dl.airtable.com/.attachments/23178be773dc4de133ca4c07056aba1c/6e855850/persistence.png" +} \ No newline at end of file diff --git a/src/store/chains/terra.json b/src/store/chains/terra.json index 55368b32..6c2b7d43 100644 --- a/src/store/chains/terra.json +++ b/src/store/chains/terra.json @@ -2,5 +2,6 @@ "chain_name": "terra", "api": "https://fcd.terra.dev", "sdk_version": "0.39.2", + "addr_prefix": "terra", "logo": "https://dl.airtable.com/.attachments/275a6cbdbdc911856556e716a60d6ec4/87addd7f/terra.jpg" } \ No newline at end of file