From 1f7bde31532556ef27497933ca3797f765cefb52 Mon Sep 17 00:00:00 2001 From: Will O'Beirne Date: Mon, 16 Apr 2018 12:48:27 -0400 Subject: [PATCH] Add musicoin network and node. --- common/config/dpaths.ts | 8 +++++- common/libs/nodes/index.ts | 3 +++ .../config/networks/staticNetworks.ts | 25 ++++++++++++++++++- common/reducers/config/nodes/staticNodes.ts | 15 +++++++++++ shared/types/network.d.ts | 3 ++- shared/types/node.d.ts | 4 ++- 6 files changed, 54 insertions(+), 4 deletions(-) diff --git a/common/config/dpaths.ts b/common/config/dpaths.ts index f9e6da2b..4b1a0729 100644 --- a/common/config/dpaths.ts +++ b/common/config/dpaths.ts @@ -53,6 +53,11 @@ export const ELLA_DEFAULT: DPath = { value: "m/44'/163'/0'/0" }; +export const MUSIC_DEFAULT: DPath = { + label: 'Default (MUSIC)', + value: "m/44'/184'/0'/0" +}; + export const ETH_SINGULAR: DPath = { label: 'SingularDTV', value: "m/0'/0'/0'" @@ -69,7 +74,8 @@ export const DPaths: DPath[] = [ UBQ_DEFAULT, POA_DEFAULT, TOMO_DEFAULT, - ELLA_DEFAULT + ELLA_DEFAULT, + MUSIC_DEFAULT ]; // PATHS TO BE INCLUDED REGARDLESS OF WALLET FORMAT diff --git a/common/libs/nodes/index.ts b/common/libs/nodes/index.ts index 6f2cf55b..7a907848 100644 --- a/common/libs/nodes/index.ts +++ b/common/libs/nodes/index.ts @@ -99,6 +99,9 @@ shepherd.useProvider('rpc', 'tomo', regTomoConf, 'https://core.tomocoin.io'); const regEllaConf = makeProviderConfig({ network: 'ELLA' }); shepherd.useProvider('rpc', 'ella', regEllaConf, 'https://jsonrpc.ellaism.org'); +const regMusicConf = makeProviderConfig({ network: 'MUSIC' }); +shepherd.useProvider('rpc', 'music', regMusicConf, 'https://mewapi.musicoin.tw'); + /** * Pseudo-networks to support metamask / web3 interaction */ diff --git a/common/reducers/config/networks/staticNetworks.ts b/common/reducers/config/networks/staticNetworks.ts index c8af1897..fad2f57c 100644 --- a/common/reducers/config/networks/staticNetworks.ts +++ b/common/reducers/config/networks/staticNetworks.ts @@ -16,7 +16,8 @@ import { EXP_DEFAULT, POA_DEFAULT, TOMO_DEFAULT, - UBQ_DEFAULT + UBQ_DEFAULT, + MUSIC_DEFAULT } from 'config/dpaths'; import { ConfigAction } from 'actions/config'; import { makeExplorer } from 'utils/helpers'; @@ -252,6 +253,28 @@ export const INITIAL_STATE: State = { max: 60, initial: 20 } + }, + MUSIC: { + name: 'MUSIC', + unit: 'MUSIC', + chainId: 7762959, + isCustom: false, + color: '#ffbb00', + blockExplorer: makeExplorer({ + name: 'Musicoin Explorer', + origin: 'https://explorer.musicoin.org', + addressPath: 'account' + }), + tokens: [], + contracts: [], + dPathFormats: { + [InsecureWalletName.MNEMONIC_PHRASE]: MUSIC_DEFAULT + }, + gasPriceSettings: { + min: 1, + max: 60, + initial: 20 + } } }; diff --git a/common/reducers/config/nodes/staticNodes.ts b/common/reducers/config/nodes/staticNodes.ts index d8c141e5..7c63f0ac 100644 --- a/common/reducers/config/nodes/staticNodes.ts +++ b/common/reducers/config/nodes/staticNodes.ts @@ -184,6 +184,21 @@ export const INITIAL_STATE: StaticNodesState = { service: 'ellaism.org', lib: shepherdProvider, estimateGas: true + }, + + music_auto: { + network: 'MUSIC', + isCustom: false, + service: 'AUTO', + lib: shepherdProvider, + estimateGas: true + }, + music: { + network: 'MUSIC', + isCustom: false, + service: 'musicoin.tw', + lib: shepherdProvider, + estimateGas: true } }; diff --git a/shared/types/network.d.ts b/shared/types/network.d.ts index 4b63ad4b..309ad3fe 100644 --- a/shared/types/network.d.ts +++ b/shared/types/network.d.ts @@ -10,7 +10,8 @@ type StaticNetworkIds = | 'EXP' | 'POA' | 'TOMO' - | 'ELLA'; + | 'ELLA' + | 'MUSIC'; export interface BlockExplorerConfig { name: string; diff --git a/shared/types/node.d.ts b/shared/types/node.d.ts index 5f18d821..08a3d7ad 100644 --- a/shared/types/node.d.ts +++ b/shared/types/node.d.ts @@ -50,7 +50,9 @@ declare enum StaticNodeId { TOMO_AUTO = 'tomo_auto', TOMO = 'tomo', ELLA_AUTO = 'ella_auto', - ELLA = 'ella' + ELLA = 'ella', + MUSIC_AUTO = 'music_auto', + MUSIC = 'music' } type StaticNodeConfigs = { [key in StaticNodeId]: StaticNodeConfig } & { web3?: StaticNodeConfig };