From c700398b139df1b7269fb609c5ce197431762a6b Mon Sep 17 00:00:00 2001 From: pan Date: Tue, 22 Jun 2021 20:58:39 +0800 Subject: [PATCH] fix Bifrost asgard connect bug (#5657) --- .../src/api/spec/bifrost-asgard.ts | 110 ++++++++++++++++++ packages/apps-config/src/api/spec/index.ts | 2 + packages/apps-config/src/endpoints/testing.ts | 1 - 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 packages/apps-config/src/api/spec/bifrost-asgard.ts diff --git a/packages/apps-config/src/api/spec/bifrost-asgard.ts b/packages/apps-config/src/api/spec/bifrost-asgard.ts new file mode 100644 index 0000000000..57aaf61ab6 --- /dev/null +++ b/packages/apps-config/src/api/spec/bifrost-asgard.ts @@ -0,0 +1,110 @@ +// 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: { + TokenSymbol: { + _enum: { + ASG: 0, + aUSD: 2, + DOT: 3, + KSM: 4, + ETH: 5 + } + }, + CurrencyId: { + _enum: { + Token: 'TokenSymbol', + VToken: 'TokenSymbol', + Native: 'TokenSymbol', + Stable: 'TokenSymbol', + VSToken: 'TokenSymbol', + VSBond: '(TokenSymbol, ParaId, LeasePeriod, LeasePeriod)' + } + }, + CurrencyIdOf: 'CurrencyId', + TAssetBalance: 'Balance', + AmountOf: 'i128', + StorageVersion: 'Releases', + ShareWeight: 'Balance', + OrmlAccountData: { + free: 'Balance', + reserved: 'Balance', + frozen: 'Balance' + }, + BancorPool: { + currency_id: 'CurrencyId', + token_pool: 'Balance', + vstoken_pool: 'Balance', + token_base_supply: 'Balance', + vstoken_base_supply: 'Balance' + }, + PalletBalanceOf: 'Balance', + BlockNumberFor: 'BlockNumber', + NumberOrHex: { + _enum: { + Number: 'u64', + Hex: 'U256' + } + }, + IsExtended: 'bool', + SystemPalletId: 'PalletId', + RewardRecord: { + account_id: 'AccountId', + record_amount: 'Balance' + }, + MaxLocksOf: 'u32', + VestingInfo: { + locked: 'Balance', + per_block: 'Balance', + starting_block: 'BlockNumber' + }, + OrderId: 'u64', + OrderInfo: { + owner: 'AccountIdOf', + currency_sold: 'CurrencyIdOf', + amount_sold: 'BalanceOf', + currency_expected: 'CurrencyIdOf', + amount_expected: 'BalanceOf', + order_id: 'OrderId', + order_state: 'OrderState' + }, + OrderState: { + _enum: [ + 'InTrade', + 'Revoked', + 'Clinchd' + ] + }, + ZenlinkAssetId: { + chain_id: 'u32', + asset_type: 'u8', + asset_index: 'u32' + }, + ZenlinkAssetBalance: 'u128', + PairInfo: { + asset0: 'ZenlinkAssetId', + asset1: 'ZenlinkAssetId', + account: 'AccountId', + totalLiquidity: 'ZenlinkAssetBalance', + holdingLiquidity: 'ZenlinkAssetBalance', + reserve0: 'ZenlinkAssetBalance', + reserve1: 'ZenlinkAssetBalance', + lpAssetId: 'ZenlinkAssetId' + } + } + + } + ] +}; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index 0b76efba0c..2d0f32f8cf 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -8,6 +8,7 @@ import apron from './apron'; import aresParachain from './ares-parachain'; import beresheet from './beresheet'; import bifrost from './bifrost'; +import bifrostAsgard from './bifrost-asgard'; import bifrostParachain from './bifrost-parachain'; import bitcountry from './bitcountry'; import bitcountryParachain from './bitcountry-rococo'; @@ -109,6 +110,7 @@ const spec: Record = { ...acala, apron, 'ares-parachain': aresParachain, + asgard: bifrostAsgard, basilisk: hydrate, beresheet, bifrost: bifrost, diff --git a/packages/apps-config/src/endpoints/testing.ts b/packages/apps-config/src/endpoints/testing.ts index ee54501988..ace361828d 100644 --- a/packages/apps-config/src/endpoints/testing.ts +++ b/packages/apps-config/src/endpoints/testing.ts @@ -40,7 +40,6 @@ export function createTesting (t: TFunction, firstOnly?: boolean): LinkOption[] }, { info: 'bifrost', - isUnreachable: true, // https://github.com/polkadot-js/apps/issues/5619 text: t('rpc.test.bifrost', 'Bifrost Asgard', { ns: 'apps-config' }), providers: { Bifrost: 'wss://asgard-rpc.liebi.com/ws'