From c53a36d4d06dc92929a20496b90ae33bc43216eb Mon Sep 17 00:00:00 2001 From: qinghuan <1245816264@qq.com> Date: Sat, 30 Jan 2021 17:58:03 +0800 Subject: [PATCH] Added ChainX logos & endpoints (#4544) * Added ChainX logos & endpoints * lint fix * add types --- packages/apps-config/src/api/spec/chainx.ts | 450 ++++++++++++++++++ packages/apps-config/src/api/spec/index.ts | 2 + .../apps-config/src/endpoints/production.ts | 7 + packages/apps-config/src/ui/colors.ts | 2 + packages/apps-config/src/ui/logos/index.ts | 4 + .../apps-config/src/ui/logos/nodes/chainx.svg | 14 + .../apps/public/locales/en/apps-config.json | 1 + .../apps/public/locales/fr/translation.json | 1 + 8 files changed, 481 insertions(+) create mode 100644 packages/apps-config/src/api/spec/chainx.ts create mode 100755 packages/apps-config/src/ui/logos/nodes/chainx.svg diff --git a/packages/apps-config/src/api/spec/chainx.ts b/packages/apps-config/src/api/spec/chainx.ts new file mode 100644 index 0000000000..75f557cf8b --- /dev/null +++ b/packages/apps-config/src/api/spec/chainx.ts @@ -0,0 +1,450 @@ +// Copyright 2017-2021 @polkadot/apps-config authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// structs need to be in order +/* eslint-disable sort-keys */ + +export default { + Address: 'AccountId', + LookupSource: 'AccountId', + Chain: { + _enum: [ + 'ChainX', + 'Bitcoin', + 'Ethereum', + 'Polkadot' + ] + }, + NetworkType: { + _enum: [ + 'Mainnet', + 'Testnet' + ] + }, + AssetType: { + _enum: [ + 'Usable', + 'Locked', + 'Reserved', + 'ReservedWithdrawal', + 'ReservedDexSpot' + ] + }, + OrderType: { + _enum: [ + 'Limit', + 'Market' + ] + }, + Side: { + _enum: [ + 'Buy', + 'Sell' + ] + }, + LockedType: { + _enum: [ + 'Bonded', + 'BondedWithdrawal' + ] + }, + Memo: 'Text', + AssetInfo: { + token: 'String', + tokenName: 'String', + chain: 'Chain', + decimals: 'Decimals', + desc: 'String' + }, + TradingPairProfile: { + id: 'TradingPairId', + currencyPair: 'CurrencyPair', + pipDecimals: 'u32', + tickDecimals: 'u32', + tradable: 'bool' + }, + Order: { + props: 'OrderProperty', + status: 'OrderStatus', + remaining: 'Balance', + executedIndices: 'Vec', + alreadyFilled: 'Balance', + lastUpdateAt: 'BlockNumber' + }, + TradingPairInfo: { + latestPrice: 'Price', + lastUpdated: 'BlockNumber' + }, + OrderExecutedInfo: { + tradingHistoryIdx: 'TradingHistoryIndex', + pairId: 'TradingPairId', + price: 'Price', + maker: 'AccountId', + taker: 'AccountId', + makerOrderId: 'OrderId', + takerOrderId: 'OrderId', + turnover: 'Balance', + executedAt: 'BlockNumber' + }, + BtcHeaderInfo: { + header: 'BtcHeader', + height: 'u32' + }, + BtcParams: { + maxBits: 'u32', + blockMaxFuture: 'u32', + targetTimespanSeconds: 'u32', + targetSpacingSeconds: 'u32', + retargetingFactor: 'u32', + retargetingInterval: 'u32', + minTimespan: 'u32', + maxTimespan: 'u32' + }, + MiningAssetInfo: { + assetId: 'AssetId', + miningPower: 'FixedAssetPower', + rewardPot: 'AccountId', + rewardPotBalance: 'RpcBalance', + lastTotalMiningWeight: 'RpcMiningWeight', + lastTotalMiningWeightUpdate: 'BlockNumber' + }, + MiningDividendInfo: { + own: 'Balance', + other: 'Balance', + insufficientStake: 'Balance' + }, + AssetLedger: { + lastTotalMiningWeight: 'MiningWeight', + lastTotalMiningWeightUpdate: 'BlockNumber' + }, + MinerLedger: { + lastMiningWeight: 'MiningWeight', + lastMiningWeightUpdate: 'BlockNumber', + lastClaim: 'Option' + }, + ClaimRestriction: { + stakingRequirement: 'StakingRequirement', + frequencyLimit: 'BlockNumber' + }, + NominatorInfo: { + lastRebond: 'Option' + }, + BondRequirement: { + selfBonded: 'Balance', + total: 'Balance' + }, + Unbonded: { + value: 'Balance', + lockedUntil: 'BlockNumber' + }, + ValidatorLedger: { + totalNomination: 'Balance', + lastTotalVoteWeight: 'VoteWeight', + lastTotalVoteWeightUpdate: 'BlockNumber' + }, + NominatorLedger: { + nomination: 'Balance', + lastVoteWeight: 'VoteWeight', + lastVoteWeightUpdate: 'BlockNumber', + unbondedChunks: 'Vec' + }, + ValidatorProfile: { + registeredAt: 'BlockNumber', + isChilled: 'bool', + lastChilled: 'Option', + referralId: 'ReferralId' + }, + GlobalDistribution: { + treasury: 'u32', + mining: 'u32' + }, + MiningDistribution: { + asset: 'u32', + staking: 'u32' + }, + InclusionFee: { + baseFee: 'Balance', + lenFee: 'Balance', + adjustedWeightFee: 'Balance' + }, + FeeDetails: { + inclusionFee: 'Option>', + extraFee: 'Balance', + tip: 'Balance', + finalFee: 'Balance' + }, + UnbondedIndex: 'u32', + Token: 'Text', + Desc: 'Text', + AddrStr: 'Text', + HandicapInfo: 'Handicap', + Price: 'u128', + OrderId: 'u64', + TradingPairId: 'u32', + TradingHistoryIndex: 'u64', + PriceFluctuation: 'u32', + BtcAddress: 'Text', + FixedAssetPower: 'u32', + StakingRequirement: 'u32', + Decimals: 'u8', + CurrencyPair: { + base: 'AssetId', + quote: 'AssetId' + }, + OrderStatus: { + _enum: [ + 'Created', + 'PartialFill', + 'Filled', + 'PartialFillAndCanceled', + 'Canceled' + ] + }, + AssetId: 'u32', + MiningWeight: 'u128', + VoteWeight: 'u128', + ReferralId: 'Text', + AssetRestriction: { + _enum: [ + 'Move', + 'Transfer', + 'Deposit', + 'Withdraw', + 'DestroyWithdrawal', + 'DestroyFree' + ] + }, + AssetRestrictions: { + bits: 'u32' + }, + BtcHeader: 'Vec', + BtcNetwork: { + _enum: [ + 'Mainnet', + 'Testnet' + ] + }, + OrderInfo: 'Order', + Amount: 'i128', + AmountOf: 'Amount', + CurrencyIdOf: 'AssetId', + CurrencyId: 'AssetId', + Handicap: { + highestBid: 'Price', + lowestAsk: 'Price' + }, + OrderProperty: { + id: 'OrderId', + side: 'Side', + price: 'Price', + amount: 'Amount', + pairId: 'TradingPairId', + submitter: 'AccountId', + orderType: 'OrderType', + createdAt: 'BlockNumber' + }, + TotalAssetInfo: { + info: 'AssetInfo', + balance: 'BTreeMap', + isOnline: 'bool', + restrictions: 'AssetRestrictions' + }, + WithdrawalRecordId: 'u32', + WithdrawalState: { + _enum: [ + 'Applying', + 'Processing', + 'NormalFinish', + 'RootFinish', + 'NormalCancel', + 'RootCancel' + ] + }, + WithdrawalRecord: { + assetId: 'AssetId', + applicant: 'AccountId', + balance: 'Balance', + addr: 'AddrStr', + ext: 'Memo', + height: 'BlockNumber' + }, + WithdrawalLimit: { + minimalWithdrawal: 'Balance', + fee: 'Balance' + }, + TrusteeInfoConfig: { + minTrusteeCount: 'u32', + maxTrusteeCount: 'u32' + }, + GenericTrusteeIntentionProps: { + about: 'Text', + hotEntity: 'Vec', + coldEntity: 'Vec' + }, + GenericTrusteeSessionInfo: { + trusteeList: 'Vec', + threshold: 'u16', + hotAddress: 'Vec', + coldAddress: 'Vec' + }, + ChainAddress: 'Vec', + BtcTrusteeType: 'Vec', + BtcTrusteeAddrInfo: { + addr: 'BtcAddress', + redeemScript: 'Vec' + }, + BtcTrusteeIntentionProps: { + about: 'Text', + hotEntity: 'BtcTrusteeType', + coldEntity: 'BtcTrusteeType' + }, + BtcTrusteeSessionInfo: { + trusteeList: 'Vec', + threshold: 'u16', + hotAddress: 'BtcTrusteeAddrInfo', + coldAddress: 'BtcTrusteeAddrInfo' + }, + BtcTransaction: 'Vec', + BtcPartialMerkleTree: 'Vec', + BtcRelayedTxInfo: { + blockHash: 'H256', + merkleProof: 'BtcPartialMerkleTree' + }, + BtcHeaderIndex: { + hash: 'H256', + height: 'u32' + }, + BtcTxResult: { + _enum: [ + 'Success', + 'Failure' + ] + }, + BtcTxState: { + txType: 'BtcTxType', + result: 'BtcTxResult' + }, + BtcTxType: { + _enum: [ + 'Withdrawal', + 'Deposit', + 'HotAndCold', + 'TrusteeTransition', + 'Irrelevance' + ] + }, + BtcDepositCache: { + txid: 'H256', + balance: 'u64' + }, + BtcVoteResult: { + _enum: [ + 'Unfinish', + 'Finish' + ] + }, + BtcWithdrawalProposal: { + sigState: 'BtcVoteResult', + withdrawalIdList: 'Vec', + tx: 'BtcTransaction', + trusteeList: 'Vec<(AccountId, bool)>' + }, + BtcTxVerifier: { + _enum: [ + 'Recover', + 'RuntimeInterface' + ] + }, + RpcTotalAssetInfo: { + info: 'AssetInfo', + balance: 'BTreeMap', + isOnline: 'bool', + restrictions: 'AssetRestrictions' + }, + RpcOrder: { + id: 'OrderId', + side: 'Side', + price: 'RpcPrice', + amount: 'RpcBalance', + pairId: 'TradingPairId', + submitter: 'AccountId', + orderType: 'OrderType', + createdAt: 'BlockNumber', + status: 'OrderStatus', + remaining: 'RpcBalance', + executedIndices: 'Vec', + alreadyFilled: 'RpcBalance', + reservedBalance: 'RpcBalance', + lastUpdateAt: 'BlockNumber' + }, + RpcWithdrawalRecord: { + assetId: 'AssetId', + applicant: 'AccountId', + balance: 'RpcBalance', + addr: 'String', + ext: 'String', + height: 'BlockNumber', + state: 'WithdrawalState' + }, + RpcMiningDividendInfo: { + own: 'RpcBalance', + other: 'RpcBalance', + insufficientStake: 'RpcBalance' + }, + RpcInclusionFee: { + baseFee: 'RpcBalance', + lenFee: 'RpcBalance', + adjustedWeightFee: 'RpcBalance' + }, + RpcFeeDetails: { + inclusionFee: 'Option', + tip: 'RpcBalance', + extraFee: 'RpcBalance', + finalFee: 'RpcBalance' + }, + ValidatorInfo: { + account: 'AccountId', + registeredAt: 'BlockNumber', + isChilled: 'bool', + lastChilled: 'Option', + totalNomination: 'RpcBalance', + lastTotalVoteWeight: 'RpcVoteWeight', + lastTotalVoteWeightUpdate: 'BlockNumber', + isValidating: 'bool', + selfBonded: 'RpcBalance', + referralId: 'String', + rewardPotAccount: 'AccountId', + rewardPotBalance: 'RpcBalance' + }, + FullPairInfo: { + baseCurrency: 'AssetId', + highestBid: 'RpcPrice', + id: 'TradingPairId', + latestPrice: 'RpcPrice', + latestPriceUpdatedAt: 'BlockNumber', + lowestAsk: 'RpcPrice', + maxValidBid: 'RpcPrice', + minValidAsk: 'RpcPrice', + pipDecimals: 'u32', + quoteCurrency: 'AssetId', + tickDecimals: 'u32', + tradable: 'bool' + }, + Depth: { + asks: 'Vec<(RpcPrice, RpcBalance)>', + bids: 'Vec<(RpcPrice, RpcBalance)>' + }, + Page: { + pageIndex: 'u32', + pageSize: 'u32', + data: 'Vec' + }, + String: 'Text', + Balance: 'u128', + RpcPrice: 'String', + RpcBalance: 'String', + RpcMiningWeight: 'String', + RpcVoteWeight: 'String', + FullIdentification: 'ValidatorId', + WithdrawalRecordOf: 'WithdrawalRecord' +}; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index b7bcb59274..5579985c45 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -5,6 +5,7 @@ import bifrost from './bifrost'; import bitcountry from './bitcountry'; import canvas from './canvas'; import centrifugeChain from './centrifuge-chain'; +import chainx from './chainx'; import crab from './crab'; import crust from './crust'; import crustParachain from './crust-parachain'; @@ -46,6 +47,7 @@ export default { 'bitcountry-node': bitcountry, canvas, 'centrifuge-chain': centrifugeChain, + chainx: chainx, crust, 'crust-parachain': crustParachain, 'cumulus-test-parachain': testPara, diff --git a/packages/apps-config/src/endpoints/production.ts b/packages/apps-config/src/endpoints/production.ts index be55f148e1..b564d34c11 100644 --- a/packages/apps-config/src/endpoints/production.ts +++ b/packages/apps-config/src/endpoints/production.ts @@ -53,6 +53,13 @@ export function createProduction (t: TFunction): LinkOption[] { 'Darwinia Network': 'wss://crab.darwinia.network' } }, + { + info: 'chainx', + text: t('rpc.chainx', 'ChainX', { ns: 'apps-config' }), + providers: { + ChainX: 'wss://mainnet.chainx.org/ws' + } + }, { info: 'darwinia', text: t('rpc.darwinia', 'Darwinia', { ns: 'apps-config' }), diff --git a/packages/apps-config/src/ui/colors.ts b/packages/apps-config/src/ui/colors.ts index e826d794b5..7994b24494 100644 --- a/packages/apps-config/src/ui/colors.ts +++ b/packages/apps-config/src/ui/colors.ts @@ -12,6 +12,7 @@ const emptyColor = '#99999'; const chainBitCountry = '#191a2e'; const chainCrab = '#7C30DD'; const chainCrust = '#ff8812'; +const chainChainx = '#F6C94A'; const chainDarwinia = 'linear-gradient(-45deg, #FE3876 0%, #7C30DD 71%, #3A30DD 100%)'; const chainHanonycash = '#0099CC'; const chainHydrate = '#000000'; @@ -72,6 +73,7 @@ export const chainColors: Record = [ ['Darwinia Crab', chainCrab], ['crust maxwell', chainCrust], ['Crust PC1', chainCrust], + ['ChainX', chainChainx], ['darwinia cc1', chainDarwinia], ['Darwinia PC2', chainRoccoDarwinia], ['DataHighway', chainRoccoDataHighway], diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index dffb5b4586..847f0e9442 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -25,6 +25,7 @@ import nodeBifrost from './nodes/bifrost.svg'; import nodeBitCountry from './nodes/bitcountry.svg'; import nodeCanvas from './nodes/canvas-2.png'; import nodeCentrifuge from './nodes/centrifuge.png'; +import nodeChainx from './nodes/chainx.svg'; import nodeCrab from './nodes/crab.svg'; import nodeCrust from './nodes/crust.svg'; import nodeDarwinia from './nodes/darwinia.png'; @@ -65,6 +66,7 @@ import emptyLogo from './empty.svg'; // NOTE: This is as retrieved via system.chain RPC export const chainLogos: Record = [ ['Crust PC1', nodeCrust], + ['ChainX', nodeChainx], ['darwinia crab', nodeCrab], ['Darwinia PC2', nodeDarwinia], ['DataHighway', nodeDataHighway], @@ -106,6 +108,7 @@ export const nodeLogos: Record = [ ['Canvas Node', nodeCanvas], ['centrifuge chain', nodeCentrifuge], ['Centrifuge Chain Node', nodeCentrifuge], + ['ChainX Node', nodeChainx], ['darwinia crab', nodeCrab], ['crust', nodeCrust], ['Crust Collator', nodeCrust], @@ -164,6 +167,7 @@ export const namedLogos: Record = { bitcountry: nodeBitCountry, canvas: nodeCanvas, centrifuge: nodeCentrifuge, + chainx: nodeChainx, crab: nodeCrab, crust: nodeCrust, darwinia: nodeDarwinia, diff --git a/packages/apps-config/src/ui/logos/nodes/chainx.svg b/packages/apps-config/src/ui/logos/nodes/chainx.svg new file mode 100755 index 0000000000..6cd7488f41 --- /dev/null +++ b/packages/apps-config/src/ui/logos/nodes/chainx.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/apps/public/locales/en/apps-config.json b/packages/apps/public/locales/en/apps-config.json index 9cf18b9079..10b429cb1c 100644 --- a/packages/apps/public/locales/en/apps-config.json +++ b/packages/apps/public/locales/en/apps-config.json @@ -8,6 +8,7 @@ "rpc.canvas": "Canvas", "rpc.centrifuge": "Centrifuge", "rpc.crab": "Darwinia Crab", + "rpc.chainx":"ChainX", "rpc.crust.network": "Crust Maxwell", "rpc.custom": "Custom environment", "rpc.custom.entry": "Custom {{WS_URL}}", diff --git a/packages/apps/public/locales/fr/translation.json b/packages/apps/public/locales/fr/translation.json index bb93e71e99..c31326d324 100644 --- a/packages/apps/public/locales/fr/translation.json +++ b/packages/apps/public/locales/fr/translation.json @@ -1294,6 +1294,7 @@ "rpc.canvas": "Canvas", "rpc.centrifuge": "Centrifuge", "rpc.crab": "Darwinia Crab", + "rpc.chainx":"ChainX", "rpc.crust.network": "Crust Maxwell", "rpc.custom": "Environment personnalisé", "rpc.custom.entry": "Personalisé {{WS_URL}}",