From 8884790e06b88136dbaac683f945b05e1f09dcd8 Mon Sep 17 00:00:00 2001 From: pan Date: Sun, 16 May 2021 13:09:36 +0800 Subject: [PATCH] Add Bifrost Kusama Parachain (#5297) * Add Bifrost Kusama Parachain * format code --- .../src/api/spec/bifrost-parachain.ts | 314 ++++-------------- .../src/endpoints/productionRelayKusama.ts | 8 + packages/apps-config/src/ui/colors.ts | 1 + .../apps/public/locales/en/apps-config.json | 1 + 4 files changed, 71 insertions(+), 253 deletions(-) diff --git a/packages/apps-config/src/api/spec/bifrost-parachain.ts b/packages/apps-config/src/api/spec/bifrost-parachain.ts index 6ffb9c90ee..b16929eaef 100644 --- a/packages/apps-config/src/api/spec/bifrost-parachain.ts +++ b/packages/apps-config/src/api/spec/bifrost-parachain.ts @@ -12,277 +12,85 @@ const definitions: OverrideBundleDefinition = { // on all versions minmax: [0, undefined], types: { - AccountInfo: 'AccountInfoWithRefCount', - Address: 'MultiAddress', - LookupSource: 'MultiAddress', - Token: { - symbol: 'Vec', - precision: 'u16', - total_supply: 'Balance', - token_type: 'TokenType', - pair: 'Option' - }, - Price: 'u64', - AccountAsset: { - balance: 'Balance', - locked: 'Balance', - available: 'Balance', - cost: 'Balance', - income: 'Balance' - }, TokenSymbol: { - _enum: [ - 'BNC', - 'aUSD', - 'DOT', - 'vDOT', - 'KSM', - 'vKSM', - 'ETH', - 'vETH', - 'EOS', - 'vEOS', - 'IOST', - 'vIOST' - ] - }, - TokenType: { - _enum: [ - 'Native', - 'Stable', - 'Token', - 'VToken' - ] + _enum: { + ASG: 0, + aUSD: 1, + DOT: 2, + vDOT: 3, + KSM: 4, + vKSM: 5, + ETH: 6, + vETH: 7, + EOS: 8, + vEOS: 9, + IOST: 10, + vIOST: 11 + } }, CurrencyId: { _enum: { Token: 'TokenSymbol' } }, - BiddingOrderId: 'u64', - RewardRecord: { - account_id: 'AccountId', - record_amount: 'Balance' - }, - EraId: 'u32', - BiddingOrderUnit: { - bidder_id: 'AccountId', - token_id: 'AssetId', - block_num: 'BlockNumber', - votes: 'Balance', - annual_roi: 'Permill', - validator: 'AccountId' - }, - BiddingOrderUnitOf: 'BiddingOrderUnit', - VersionId: 'u32', - PermissionName: 'u64', - PermissionLevel: { - actor: 'AccountName', - permission: 'PermissionName' - }, - Action: { - account: 'AccountName', - name: 'ActionName', - authorization: 'Vec', - data: 'Vec' - }, - AccountName: 'u64', - Checksum256: '([u8;32])', - ActionName: 'u64', - FlatMap: { - map: 'Vec<(ActionName, u64)>' - }, - UnsignedInt: 'u32', - ActionReceipt: { - receiver: 'AccountName', - act_digest: 'Checksum256', - global_sequence: 'u64', - recv_sequence: 'u64', - auth_sequence: 'FlatMap', - code_sequence: 'UnsignedInt', - abi_sequence: 'UnsignedInt' - }, - BlockchainType: { - _enum: [ - 'BIFROST', - 'EOS', - 'IOST' - ] - }, - Precision: 'u32', - BridgeAssetSymbol: { - blockchain: 'BlockchainType', - symbol: 'Vec', - precision: 'Precision' - }, - PublicKey: { - type_: 'UnsignedInt', - data: '[u8;33]' - }, - ProducerKey: { - producer_name: 'AccountName', - block_signing_key: 'PublicKey' - }, - ProducerSchedule: { - version: 'u32', - producers: 'Vec' - }, - bridgeEosSignature: { - type_: 'UnsignedInt', - data: '[u8;65]' - }, - BlockTimestamp: '(u32)', - Extension: '(u16, Vec)', - BlockHeader: { - timestamp: 'BlockTimestamp', - producer: 'AccountName', - confirmed: 'u16', - previous: 'Checksum256', - transaction_mroot: 'Checksum256', - action_mroot: 'Checksum256', - schedule_version: 'u32', - new_producers: 'Option', - header_extensions: 'Vec' - }, - SignedBlockHeader: { - block_header: 'BlockHeader', - producer_signature: 'bridgeEosSignature' - }, - Checksum256Array: 'Vec', - IncrementalMerkle: { - _node_count: 'u64', - _active_nodes: 'Checksum256Array' - }, - TxSig: { - signature: 'Vec', - author: 'AccountId' - }, - MultiSig: { - signatures: 'Vec', - threshold: 'u8' - }, - MultiSigTx: { - chain_id: 'Vec', - raw_tx: 'Vec', - multi_sig: 'MultiSig', - action: 'Action', - from: 'AccountId', - asset_id: 'AssetId' - }, - Sent: { - tx_id: 'Vec', - from: 'AccountId', - asset_id: 'AssetId' - }, - Succeeded: { - tx_id: 'Vec' - }, - Failed: { - tx_id: 'Vec', - reason: 'Vec' - }, - TxOut: { + AmountOf: 'i128', + ChainId: { _enum: { - Initialized: 'MultiSigTx', - Created: 'MultiSigTx', - SignComplete: 'MultiSigTx', - Sent: 'Sent', - Succeeded: 'Succeeded', - Failed: 'Failed' + RelayChain: 'Null', + ParaChain: 'ParaId' } }, - TransactionStatus: { - _enum: [ - 'Initialized', - 'Created', - 'SignComplete', - 'Sent', - 'Succeeded', - 'Failed' - ] + XCurrencyId: { + chainId: 'ChainId', + currencyId: 'Vec' }, - ProducerAuthoritySchedule: { - version: 'u32', - producers: 'Vec' - }, - ProducerAuthority: { - producer_name: 'ActionName', - authority: 'BlockSigningAuthority' - }, - BlockSigningAuthority: '(UnsignedInt, BlockSigningAuthorityV0)', - BlockSigningAuthorityV0: { - threshold: 'u32', - keyWeights: 'Vec' - }, - KeyWeight: { - key: 'PublicKey', - weight: 'u16' - }, - IostAction: { - contract: 'Vec', - action_name: 'Vec', - data: 'Vec' - }, - IostMultiSigTx: { - chain_id: 'i32', - raw_tx: 'Vec', - multi_sig: 'MultiSig', - action: 'IostAction', - from: 'AccountId', - asset_id: 'AssetId' - }, - Processing: { - tx_id: 'Vec', - multi_sig_tx: 'IostMultiSigTx' - }, - IostTxOut: { + CurrencyIdOf: 'CurrencyId', + IsExtended: 'bool', + StorageVersion: 'Releases', + ShareWeight: 'Balance', + PalletBalanceOf: 'Balance', + BlockNumberFor: 'BlockNumber', + NumberOrHex: { _enum: { - Initial: 'IostMultiSigTx', - Generated: 'IostMultiSigTx', - Signed: 'IostMultiSigTx', - Processing: 'Processing', - Success: 'Vec', - Fail: 'Failed' + Number: 'u64', + Hex: 'U256' } }, - SpecIndex: 'u32', - RequestIdentifier: 'u64', - DataVersion: 'u64', - AssetConfig: { - redeem_duration: 'BlockNumber', - min_reward_per_block: 'Balance' + TokenBalance: 'Balance', + TokenId: 'u32', + PairId: 'u32', + Pair: { + token_0: 'AssetId', + token_1: 'AssetId', + account: 'AccountId', + total_liquidity: 'TokenBalance', + lp_asset_id: 'AssetId' }, - ProxyValidatorRegister: { - last_block: 'BlockNumber', - deposit: 'Balance', - need: 'Balance', - staking: 'Balance', - reward_per_block: 'Balance', - validator_address: 'Vec' + PairInfo: { + token_0: 'AssetId', + token_1: 'AssetId', + account: 'AccountId', + total_liquidity: 'TokenBalance', + holding_liquidity: 'TokenBalance', + reserve_0: 'TokenBalance', + reserve_1: 'TokenBalance', + lp_asset_id: 'AssetId' }, - PoolId: 'u32', - SwapFee: 'u128', - PoolDetails: { - owner: 'AccountId', - swap_fee_rate: 'SwapFee', - active: 'bool' + AssetId: { + chain_id: 'u32', + module_index: 'u8', + asset_index: 'u32' }, - PoolWeight: 'Balance', - PoolToken: 'u128', - PoolCreateTokenDetails: { - token_id: 'AssetId', - token_balance: 'Balance', - token_weight: 'PoolWeight' + AssetProperty: { + _enum: { + Foreign: null, + Lp: 'LpProperty' + } }, - VtokenPool: { - token_pool: 'Balance', - vtoken_pool: 'Balance', - current_reward: 'Balance', - pending_reward: 'Balance' - }, - VtokenMintPrice: 'u128', - MintPrice: 'VtokenMintPrice', - CurrencyIdOf: 'CurrencyId' + LpProperty: { + token_0: 'AssetId', + token_1: 'AssetId' + } } } diff --git a/packages/apps-config/src/endpoints/productionRelayKusama.ts b/packages/apps-config/src/endpoints/productionRelayKusama.ts index 97ca03c660..3f0a027af2 100644 --- a/packages/apps-config/src/endpoints/productionRelayKusama.ts +++ b/packages/apps-config/src/endpoints/productionRelayKusama.ts @@ -32,6 +32,14 @@ export function createKusama (t: TFunction): EndpointOption { /// (3) parachains with id, see Rococo (info here maps to the actual "named icon") // // NOTE: Added alphabetical based on chain name + { + info: 'bifrost', + paraId: 2001, + text: t('rpc.kusama.bifrost', 'Bifrost', { ns: 'apps-config' }), + providers: { + Bifrost: 'wss://bifrost-rpc.liebi.com/ws' + } + }, { info: 'crust shadow', paraId: 2012, diff --git a/packages/apps-config/src/ui/colors.ts b/packages/apps-config/src/ui/colors.ts index 951058c681..22cdffcab4 100644 --- a/packages/apps-config/src/ui/colors.ts +++ b/packages/apps-config/src/ui/colors.ts @@ -127,6 +127,7 @@ export const chainColors: Record = [ ['Apron PC1', chainApron], ['Ares PC1', chainRoccoAres], ['Bifrost PC1', chainRoccoBifrost], + ['bifrost', chainRoccoBifrost], ['Bit.Country Tewai Chain', chainBitCountry], ['Beast Developer', chainBeastEave], ['ChainX', chainChainx], diff --git a/packages/apps/public/locales/en/apps-config.json b/packages/apps/public/locales/en/apps-config.json index e2b507153d..95ae5c1f13 100644 --- a/packages/apps/public/locales/en/apps-config.json +++ b/packages/apps/public/locales/en/apps-config.json @@ -10,6 +10,7 @@ "rpc.header.test": "Test networks", "rpc.header.test.relay": "Test relays & parachains", "rpc.hosted.by": "hosted by {{host}}", + "rpc.kusama.bifrost": "Bifrost", "rpc.kusama.khala": "Khala Network", "rpc.kusama.kilt": "KILT Mainnet", "rpc.kusama.parity": "Kusama",