From 00e616a5bdfb65bcd0290ffd86a70bb2bdc26d77 Mon Sep 17 00:00:00 2001 From: WoeOm <1015996366@qq.com> Date: Thu, 20 Aug 2020 14:36:43 +0800 Subject: [PATCH] add crab (darwinia canary network) (#3451) * add crab (darwinia canary network) * unusable BalanceInfo * alphabetical * remove module separator * alphabetical --- packages/apps-config/src/api/spec/crab.ts | 221 ++++++++++++++++++ packages/apps-config/src/api/spec/index.ts | 2 + .../apps-config/src/settings/endpoints.ts | 6 + packages/apps-config/src/ui/general/index.ts | 2 + packages/apps-config/src/ui/logos/index.ts | 3 + .../apps-config/src/ui/logos/nodes/crab.svg | 17 ++ 6 files changed, 251 insertions(+) create mode 100644 packages/apps-config/src/api/spec/crab.ts create mode 100644 packages/apps-config/src/ui/logos/nodes/crab.svg diff --git a/packages/apps-config/src/api/spec/crab.ts b/packages/apps-config/src/api/spec/crab.ts new file mode 100644 index 0000000000..4a1f0db1d6 --- /dev/null +++ b/packages/apps-config/src/api/spec/crab.ts @@ -0,0 +1,221 @@ +// Copyright 2017-2020 @polkadot/apps-config authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +// structs need to be in order +/* eslint-disable sort-keys */ + +export default { + Address: 'AccountId', + BalanceLock: { + id: 'LockIdentifier', + lock_for: 'LockFor', + lock_reasons: 'LockReasons', + amount: 'Balance', + reasons: 'Reasons' + }, + LockFor: { + _enum: { + Common: 'Common', + Staking: 'StakingLock' + } + }, + Common: { + amount: 'Balance' + }, + StakingLock: { + staking_amount: 'Balance', + unbondings: 'Vec' + }, + LockReasons: { + _enum: { + Fee: null, + Misc: null, + All: null + } + }, + Unbonding: { + amount: 'Balance', + until: 'BlockNumber' + }, + AccountData: { + free: 'Balance', + reserved: 'Balance', + free_kton: 'Balance', + reserved_kton: 'Balance', + misc_frozen: 'Balance', + fee_frozen: 'Balance' + }, + RingBalance: 'Balance', + KtonBalance: 'Balance', + TsInMs: 'u64', + Power: 'u32', + DepositId: 'U256', + StakingBalanceT: { + _enum: { + RingBalance: 'Balance', + KtonBalance: 'Balance' + } + }, + StakingLedgerT: { + stash: 'AccountId', + active_ring: 'Compact', + active_deposit_ring: 'Compact', + active_kton: 'Compact', + deposit_items: 'Vec', + ring_staking_lock: 'StakingLock', + kton_staking_lock: 'StakingLock', + claimed_rewards: 'Vec', + total: 'Compact', + active: 'Compact', + unlocking: 'Vec' + }, + TimeDepositItem: { + value: 'Compact', + start_time: 'Compact', + expire_time: 'Compact' + }, + RewardDestination: { + _enum: { + Staked: 'Staked', + Stash: null, + Controller: null + } + }, + Staked: { + promise_month: 'u8' + }, + ExposureT: { + own_ring_balance: 'Compact', + own_kton_balance: 'Compact', + own_power: 'Power', + total_power: 'Power', + others: 'Vec', + total: 'Compact', + own: 'Compact' + }, + IndividualExposure: { + who: 'AccountId', + ring_balance: 'Compact', + kton_balance: 'Compact', + power: 'Power', + value: 'Compact' + }, + ElectionResultT: { + elected_stashes: 'Vec', + exposures: 'Vec<(AccountId, ExposureT)>', + compute: 'ElectionCompute' + }, + RKT: { + r: 'Balance', + k: 'Balance' + }, + SpanRecord: { + slashed: 'RKT', + paid_out: 'RKT' + }, + UnappliedSlash: { + validator: 'AccountId', + own: 'RKT', + others: 'Vec<(AccountId, RKT)>', + reporters: 'Vec', + payout: 'RKT' + }, + Proposal: { + proposer: 'AccountId', + beneficiary: 'AccountId', + ring_value: 'Balance', + kton_value: 'Balance', + ring_bond: 'Balance', + kton_bond: 'Balance', + value: 'Balance', + bond: 'Balance' + }, + EthTransactionIndex: '(H256, u64)', + EthHeaderBrief: { + total_difficulty: 'U256', + parent_hash: 'H256', + number: 'EthBlockNumber', + relayer: 'AccountId' + }, + EthBlockNumber: 'u64', + EthHeader: { + parent_hash: 'H256', + timestamp: 'u64', + number: 'EthBlockNumber', + author: 'EthAddress', + transactions_root: 'H256', + uncles_hash: 'H256', + extra_data: 'Bytes', + state_root: 'H256', + receipts_root: 'H256', + log_bloom: 'Bloom', + gas_used: 'U256', + gas_limit: 'U256', + difficulty: 'U256', + seal: 'Vec', + hash: 'Option' + }, + EthAddress: 'H160', + Bloom: '[u8; 256; Bloom]', + H128: '[u8; 16; H128]', + EthashProof: { + dag_nodes: '(H512, H512)', + proof: 'Vec' + }, + Receipt: { + gas_used: 'U256', + log_bloom: 'Bloom', + logs: 'Vec', + outcome: 'TransactionOutcome' + }, + EthereumNetworkType: { + _enum: { + Mainnet: null, + Ropsten: null + } + }, + RedeemFor: { + _enum: { + Ring: null, + Kton: null, + Deposit: null + } + }, + EthereumReceiptProof: { + index: 'u64', + proof: 'Bytes', + header_hash: 'H256' + }, + MMRProof: 'Vec', + OtherSignature: { + _enum: { + Eth: 'EcdsaSignature', + Tron: 'EcdsaSignature' + } + }, + EcdsaSignature: '[u8; 65; EcdsaSignature]', + OtherAddress: { + _enum: { + Eth: '[u8; 20; EthereumAddress]', + Tron: '[u8; 20; TronAddress]' + } + }, + AddressT: '[u8; 20; AddressT]', + MerkleMountainRangeRootLog: { + prefix: '[u8; 4; Prefix]', + mmr_root: 'Hash' + }, + Round: 'u64', + TcBlockNumber: 'Vec', + TcHeaderHash: 'Vec', + MMRHash: 'Vec', + GameId: 'TcBlockNumber', + RawHeaderThing: 'Vec', + BalancesRuntimeDispatchInfo: { + usable_balance: 'Balance' + }, + StakingRuntimeDispatchInfo: { + power: 'Power' + } +}; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index cb36da48a7..69224b749c 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -4,6 +4,7 @@ import acala from './acala'; import centrifugeChain from './centrifuge-chain'; +import crab from './crab'; import testPara from './cumulus-test-parachain'; import edgeware from './edgeware'; import encointerNodeNotee from './encointer-node-notee'; @@ -15,6 +16,7 @@ import nodle from './nodle'; import stablePoc from './stable-poc'; export default { + Crab: crab, 'Nodle Chain Node': nodle, acala, 'centrifuge-chain': centrifugeChain, diff --git a/packages/apps-config/src/settings/endpoints.ts b/packages/apps-config/src/settings/endpoints.ts index 300f11f482..633c17e7b4 100644 --- a/packages/apps-config/src/settings/endpoints.ts +++ b/packages/apps-config/src/settings/endpoints.ts @@ -91,6 +91,12 @@ function createLive (t: TFunction): LinkOption[] { text: t('rpc.centrifuge', 'Centrifuge (Mainnet, hosted by Centrifuge)', { ns: 'apps-config' }), value: 'wss://fullnode.centrifuge.io' }, + { + dnslink: 'crab', + info: 'crab', + text: t('rpc.crab', 'Crab (Darwinia Canary, hosted by Darwinia Network)', { ns: 'apps-config' }), + value: 'wss://crab.darwinia.network' + }, { dnslink: 'edgeware', info: 'edgeware', diff --git a/packages/apps-config/src/ui/general/index.ts b/packages/apps-config/src/ui/general/index.ts index 32467476c4..18bd1bb84d 100644 --- a/packages/apps-config/src/ui/general/index.ts +++ b/packages/apps-config/src/ui/general/index.ts @@ -5,6 +5,7 @@ const defaultColor = undefined; // '#f19135' const emptyColor = '#999'; +const chainCrab = '#7C30DD'; const chainKulupu = '#003366'; const chainPolkadot = '#e6007a'; const chainKusama = '#000'; // '#d32e79'; @@ -21,6 +22,7 @@ const nodeKilt = '#eb5b2a'; // overrides based on the actual matched chain name const chainColors: Record = [ + ['Crab', chainCrab], ['Kulupu', chainKulupu], ['Kusama', chainKusama], ['Kusama CC1', chainKusama], diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index 905fdf01ab..85135c935c 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -14,6 +14,7 @@ import chainRococoTrick from './chains/rococo-trick.svg'; // defaults for the node type, assuming we don't have a specific chain, but rather match on the implementation import nodeAcala from './nodes/acala-circle.svg'; import nodeCentrifuge from './nodes/centrifuge.png'; +import nodeCrab from './nodes/crab.svg'; import nodeEdgeware from './nodes/edgeware-circle.svg'; import nodeEncointerNotee from './nodes/encointer-notee.svg'; import nodeEncointerTeeproxy from './nodes/encointer-teeproxy.svg'; @@ -49,6 +50,7 @@ const chainLogos: Record = [ const nodeLogos: Record = [ ['centrifuge chain', nodeCentrifuge], ['Centrifuge Chain Node', nodeCentrifuge], + ['crab', nodeCrab], ['Edgeware Node', nodeEdgeware], ['Encointer Node', nodeEncointerNotee], ['Encointer Node noTEE', nodeEncointerNotee], @@ -70,6 +72,7 @@ const namedLogos: Record = { acala: nodeAcala, alexander: nodePolkadot, centrifuge: nodeCentrifuge, + crab: nodeCrab, edgeware: nodeEdgeware, empty: emptyLogo, kilt: nodeKilt, diff --git a/packages/apps-config/src/ui/logos/nodes/crab.svg b/packages/apps-config/src/ui/logos/nodes/crab.svg new file mode 100644 index 0000000000..e95ac69c83 --- /dev/null +++ b/packages/apps-config/src/ui/logos/nodes/crab.svg @@ -0,0 +1,17 @@ + + + 编组 3 + + + + + + + + + + + + + + \ No newline at end of file