From 56a715e93495398147351d352e828ac8ba4be477 Mon Sep 17 00:00:00 2001 From: pan Date: Tue, 23 Feb 2021 18:59:01 +0800 Subject: [PATCH] Updated bifrost parachain types (#4717) --- .../src/api/spec/bifrost-parachain.ts | 254 ++++++++++++++++++ packages/apps-config/src/api/spec/index.ts | 4 +- 2 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 packages/apps-config/src/api/spec/bifrost-parachain.ts diff --git a/packages/apps-config/src/api/spec/bifrost-parachain.ts b/packages/apps-config/src/api/spec/bifrost-parachain.ts new file mode 100644 index 0000000000..9e252119fe --- /dev/null +++ b/packages/apps-config/src/api/spec/bifrost-parachain.ts @@ -0,0 +1,254 @@ +// Copyright 2017-2021 @polkadot/apps-config authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order +/* eslint-disable sort-keys */ + +const definitions: OverrideBundleDefinition = { + types: [ + { + // 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' + }, + TokenType: { + _enum: ['Native', 'Stable', 'Token', 'VToken'] + }, + 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: { + _enum: { + Initialized: 'MultiSigTx', + Created: 'MultiSigTx', + SignComplete: 'MultiSigTx', + Sent: 'Sent', + Succeeded: 'Succeeded', + Failed: 'Failed' + } + }, + TransactionStatus: { + _enum: ['Initialized', 'Created', 'SignComplete', 'Sent', 'Succeeded', 'Failed'] + }, + 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: { + _enum: { + Initial: 'IostMultiSigTx', + Generated: 'IostMultiSigTx', + Signed: 'IostMultiSigTx', + Processing: 'Processing', + Success: 'Vec', + Fail: 'Failed' + } + }, + SpecIndex: 'u32', + RequestIdentifier: 'u64', + DataVersion: 'u64', + AssetConfig: { + redeem_duration: 'BlockNumber', + min_reward_per_block: 'Balance' + }, + ProxyValidatorRegister: { + last_block: 'BlockNumber', + deposit: 'Balance', + need: 'Balance', + staking: 'Balance', + reward_per_block: 'Balance', + validator_address: 'Vec' + }, + PoolId: 'u32', + SwapFee: 'u128', + PoolDetails: { + owner: 'AccountId', + swap_fee_rate: 'SwapFee', + active: 'bool' + }, + PoolWeight: 'Balance', + PoolToken: 'u128', + PoolCreateTokenDetails: { + token_id: 'AssetId', + token_balance: 'Balance', + token_weight: 'PoolWeight' + }, + VtokenPool: { + token_pool: 'Balance', + vtoken_pool: 'Balance', + current_reward: 'Balance', + pending_reward: 'Balance' + }, + VtokenMintPrice: 'u128', + MintPrice: 'VtokenMintPrice' + } + + } + ] +}; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index 4f5bf37e7c..7f17c40d4b 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -6,6 +6,7 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types'; import acala from './acala'; import aresParachain from './ares-parachain'; import bifrost from './bifrost'; +import bifrostParachain from './bifrost-parachain'; import bitcountry from './bitcountry'; import canvas from './canvas'; import centrifugeChain from './centrifuge-chain'; @@ -64,7 +65,8 @@ const spec: Record = { Equilibrium: equilibrium, acala, 'ares-parachain': aresParachain, - bifrost, + bifrost: bifrost, + 'bifrost-parachain': bifrostParachain, 'bitcountry-node': bitcountry, 'btc-parachain': polkabtc, canvas,