Skip to content

Commit

Permalink
Merge pull request #465 from Sifchain/staging
Browse files Browse the repository at this point in the history
[hotfix] restore EMONEY ibc integration
  • Loading branch information
alanrsoares authored Mar 12, 2022
2 parents dd460d8 + 2c7e8e8 commit 32d189f
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 30 deletions.
31 changes: 16 additions & 15 deletions ui/app/public/images/tokens/JUNO.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ui/app/src/hooks/useCore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createServices, createUsecases } from "@/business";
import { createServices, createUsecases, ServiceContext } from "@/business";
import {
createAccountPoolFinder,
createPoolFinder,
Expand All @@ -11,7 +11,7 @@ switchEnv({ location: window.location });
const { tag, sifAssetTag, ethAssetTag } = getEnv({
location: window.location,
});
console.log("getEnv", tag, sifAssetTag, ethAssetTag);
console.log("getEnv", { tag, sifAssetTag, ethAssetTag });
const config = getConfig(tag, sifAssetTag, ethAssetTag);
const services = createServices(config);
const store = createStore();
Expand Down
12 changes: 2 additions & 10 deletions ui/app/src/utils/getTokenIconUrl.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { useCore } from "@/hooks/useCore";
import { IAsset } from "@sifchain/sdk";

declare global {
interface Window {
/**
* This is injected by vite
*/
TOKEN_SVG_PATH_LOOKUP?: Record<string, string>;
}
}

// All token svg icons are passed in as a <symbol, path> lookup via vite.config.ts.
// We don't use import.meta.glob because it gives warnings about the public dir, where these are stored...
const tokenSrcMap = new Map<string, string>(
Object.entries(window.TOKEN_SVG_PATH_LOOKUP ?? {}),
// @ts-ignore injected by vite
Object.entries(TOKEN_SVG_PATH_LOOKUP ?? {}),
);

export const getTokenIconUrl = (
Expand Down
12 changes: 12 additions & 0 deletions ui/core/src/clients/chains/EmoneyChain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Chain } from "../../entities";
import { BaseChain } from "./_BaseChain";
import { urlJoin } from "url-join-ts";

export class EmoneyChain extends BaseChain implements Chain {
getBlockExplorerUrlForTxHash(hash: string) {
return urlJoin(this.chainConfig.blockExplorerUrl, "txs", hash);
}
getBlockExplorerUrlForAddress(hash: string) {
return urlJoin(this.chainConfig.blockExplorerUrl, "account", hash);
}
}
1 change: 1 addition & 0 deletions ui/core/src/clients/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export * from "./JunoChain";
export * from "./IxoChain";
export * from "./BandChain";
export * from "./LikecoinChain";
export * from "./EmoneyChain";
2 changes: 2 additions & 0 deletions ui/core/src/clients/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
IxoChain,
BandChain,
LikecoinChain,
EmoneyChain,
} from "@sifchain/sdk/src/clients/chains";
import { Network } from "..";

Expand All @@ -33,6 +34,7 @@ export const networkChainCtorLookup = {
[Network.IXO]: IxoChain,
[Network.BAND]: BandChain,
[Network.LIKECOIN]: LikecoinChain,
[Network.EMONEY]: EmoneyChain,
};

export * from "./chains";
Expand Down
55 changes: 55 additions & 0 deletions ui/core/src/config/chains/emoney/emoney-mainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Network, IBCChainConfig } from "../../../entities";

export const EMONEY_MAINNET: IBCChainConfig = {
chainType: "ibc",
network: Network.EMONEY,
displayName: "e-Money",
blockExplorerUrl: "https://emoney.bigdipper.live",
nativeAssetSymbol: "ungm",
chainId: "emoney-3",
rpcUrl: "https://proxies.sifchain.finance/api/emoney-3/rpc",
restUrl: "https://proxies.sifchain.finance/api/emoney-3/rest",
keplrChainInfo: {
rpc: "https://proxies.sifchain.finance/api/emoney-3/rpc",
rest: "https://proxies.sifchain.finance/api/emoney-3/rest",
chainId: "emoney-3",
chainName: "e-Money",
stakeCurrency: {
coinDenom: "NGM",
coinMinimalDenom: "ungm",
coinDecimals: 6,
coinGeckoId: "e-money",
},
walletUrl: "https://wallet.keplr.app/#/emoney/stake",
walletUrlForStaking: "https://wallet.keplr.app/#/emoney/stake",
bip44: {
coinType: 118,
},
bech32Config: {
bech32PrefixAccAddr: "emoney",
bech32PrefixAccPub: "emoneypub",
bech32PrefixValAddr: "emoneyvaloper",
bech32PrefixValPub: "emoneyvaloperpub",
bech32PrefixConsAddr: "emoneyvalcons",
bech32PrefixConsPub: "emoneyvalconspub",
},
currencies: [
{
coinDenom: "NGM",
coinMinimalDenom: "ungm",
coinDecimals: 6,
coinGeckoId: "e-money",
},
],
feeCurrencies: [
{
coinDenom: "NGM",
coinMinimalDenom: "ungm",
coinDecimals: 6,
coinGeckoId: "e-money",
},
],
coinType: 118,
features: ["stargate", "ibc-transfer"],
},
};
13 changes: 13 additions & 0 deletions ui/core/src/config/chains/emoney/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NetworkEnv } from "../../getEnv";
import { NetEnvChainConfigLookup } from "../NetEnvChainConfigLookup";
import { EMONEY_MAINNET } from "./emoney-mainnet";

export default <NetEnvChainConfigLookup>{
[NetworkEnv.LOCALNET]: EMONEY_MAINNET,
[NetworkEnv.TESTNET_042_IBC]: EMONEY_MAINNET,
[NetworkEnv.DEVNET_042]: EMONEY_MAINNET,
[NetworkEnv.DEVNET_042]: EMONEY_MAINNET,
[NetworkEnv.DEVNET]: EMONEY_MAINNET,
[NetworkEnv.TESTNET]: EMONEY_MAINNET,
[NetworkEnv.MAINNET]: EMONEY_MAINNET,
};
2 changes: 2 additions & 0 deletions ui/core/src/config/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import juno from "./juno";
import ixo from "./ixo";
import band from "./band";
import likecoin from "./likecoin";
import emoney from "./emoney";

export const chainConfigByNetworkEnv = Object.fromEntries(
Object.values(NetworkEnv).map((env) => {
Expand All @@ -37,6 +38,7 @@ export const chainConfigByNetworkEnv = Object.fromEntries(
[Network.BAND]: band[env],
// [Network.BITSONG]: bitsong[env],
[Network.LIKECOIN]: likecoin[env],
[Network.EMONEY]: emoney[env],
},
];
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1062,12 +1062,12 @@ const assets: {
imageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/13143.png",
},
{
symbol: "ngm",
symbol: "ungm",
displaySymbol: "ngm",
decimals: 6,
name: "ngm",
network: "sifchain",
homeNetwork: "ethereum",
homeNetwork: "emoney",
label: "ngm",
imageUrl:
"https://assets.coingecko.com/coins/images/13722/small/logo-200x200.jpg?1626095888",
Expand All @@ -1078,7 +1078,7 @@ const assets: {
decimals: 6,
name: "e-Money EUR",
network: "sifchain",
homeNetwork: "ethereum",
homeNetwork: "emoney",
label: "e-Money EUR",
imageUrl:
"https://assets.coingecko.com/coins/images/18817/small/eeur.jpg?1633508407",
Expand Down
1 change: 1 addition & 0 deletions ui/core/src/entities/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export enum Network {
REGEN = "regen",
SENTINEL = "sentinel",
TERRA = "terra",
EMONEY = "emoney",
}

1 comment on commit 32d189f

@vercel
Copy link

@vercel vercel bot commented on 32d189f Mar 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.