From 7e343933b10441d24c186123bf6de5090b5a0f81 Mon Sep 17 00:00:00 2001 From: Alex D Date: Tue, 16 May 2023 13:02:54 +0200 Subject: [PATCH] Gens parachain (#9447) * new eq balance * fix eq&gens balances * cleanup old types and methods; gens balances on account page * fix BigInt * add types-codec package to package.json --------- Co-authored-by: Alex D --- packages/apps-config/package.json | 1 + packages/apps-config/src/api/derives.ts | 4 +- .../apps-config/src/api/spec/equilibrium.ts | 202 +-- packages/apps-config/src/api/spec/genshiro.ts | 29 +- packages/apps-config/src/api/spec/index.ts | 1 - packages/apps-config/src/api/typesBundle.ts | 1375 +---------------- .../src/endpoints/productionRelayKusama.ts | 7 +- yarn.lock | 1 + 8 files changed, 88 insertions(+), 1532 deletions(-) diff --git a/packages/apps-config/package.json b/packages/apps-config/package.json index 70fc66497e..a7bd09ef23 100644 --- a/packages/apps-config/package.json +++ b/packages/apps-config/package.json @@ -38,6 +38,7 @@ "@polkadot/api-derive": "^10.7.1", "@polkadot/networks": "^12.2.1", "@polkadot/types": "^10.7.1", + "@polkadot/types-codec": "^10.7.1", "@polkadot/util": "^12.2.1", "@polkadot/wasm-util": "^7.2.1", "@polkadot/x-fetch": "^12.2.1", diff --git a/packages/apps-config/src/api/derives.ts b/packages/apps-config/src/api/derives.ts index e581e36424..17a3c25556 100644 --- a/packages/apps-config/src/api/derives.ts +++ b/packages/apps-config/src/api/derives.ts @@ -10,8 +10,8 @@ import mangata from './spec/mangata.js'; import subspace from './spec/subspace.js'; const mapping: [OverrideBundleDefinition, string[]][] = [ - [equilibrium, ['Equilibrium']], - [genshiro, ['Genshiro', 'Genshiro Rococo Testnet']], + [equilibrium, ['Equilibrium', 'Equilibrium-parachain']], + [genshiro, ['Genshiro', 'Gens-parachain']], [interbtc, ['interbtc-parachain', 'interbtc-standalone', 'interlay-parachain', 'kintsugi-parachain', 'testnet-kintsugi', 'testnet-interlay']], [subspace, ['subspace']], [mangata, ['mangata', 'mangata-parachain']] diff --git a/packages/apps-config/src/api/spec/equilibrium.ts b/packages/apps-config/src/api/spec/equilibrium.ts index 12b6d66f8f..02f793bd40 100644 --- a/packages/apps-config/src/api/spec/equilibrium.ts +++ b/packages/apps-config/src/api/spec/equilibrium.ts @@ -1,164 +1,108 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { Observable } from 'rxjs'; -import type { ApiInterfaceRx, AugmentedQuery, RxResult } from '@polkadot/api/types'; -import type { AccountData, AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces'; -import type { Codec, OverrideBundleDefinition } from '@polkadot/types/types'; +import type { ApiInterfaceRx } from '@polkadot/api/types'; +import type { Enum } from '@polkadot/types'; +import type { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces'; +import type { OverrideBundleDefinition } from '@polkadot/types/types'; +import type { Struct, u64, u128, Vec } from '@polkadot/types-codec'; +import type { ITuple } from '@polkadot/types-codec/types'; -import eqDefs from '@equilab/definitions'; -import { map } from 'rxjs'; +import { map, of } from 'rxjs'; -import { Enum } from '@polkadot/types'; -import { BN } from '@polkadot/util'; +import { memo } from '@polkadot/api-derive/util'; +import { U8aFixed } from '@polkadot/types-codec'; -interface SignedBalance extends Enum { +export interface SignedBalance extends Enum { readonly isPositive: boolean; readonly asPositive: Balance; readonly isNegative: boolean; readonly asNegative: Balance; } -interface Currency extends Enum { - readonly isUnknown: boolean; - readonly isUsd: boolean; - readonly isEq: boolean; - readonly isEth: boolean; - readonly isBtc: boolean; - readonly isEos: boolean; - readonly isDot: boolean; -} - -type CommonBalanceMap = ApiInterfaceRx['query']['balances']['account']; - -type EqBalanceDoubleMap = AugmentedQuery< -'rxjs', -(key1: AccountIndex | AccountId | Address | string, key2: T | string) => Observable, -[AccountId, Currency] -> - -const { equilibrium, equilibriumNext } = eqDefs; - -export const u64FromCurrency = (currency: string): number => { +export const u64FromCurrency = (currency: string): bigint => { const buf = Buffer.from(currency.toLowerCase()); const size = buf.length; - return buf.reduce( - (val, digit, i) => val + Math.pow(256, size - 1 - i) * digit, - 0 - ); + return buf.reduce((val, digit, i) => { + const exp = BigInt(size - 1 - i); + + return BigInt(val) + BigInt(256) ** exp * BigInt(digit); + }, BigInt(0)); }; -const transformBalanceStorage = ( - query: EqBalanceDoubleMap, - currency: string, - transform: (data: SB) => AccountData, - currencyToAsset: (arg: string, api?: ApiInterfaceRx) => T, - api?: ApiInterfaceRx -): CommonBalanceMap => { - const arg = currencyToAsset(currency, api); +const TOKENS = ['eq']; - // HACK as we cannot properly transform queryMulti result, define AccountData getters on standard Enum - if (!(Enum as { hacked?: boolean }).hacked) { - (Enum as { hacked?: boolean }).hacked = true; +interface EqPrimitivesBalanceAccountData extends Enum { + readonly isV0: boolean; + readonly asV0: { + readonly lock: u128; + readonly balance: Vec>; + } & Struct; + readonly type: 'V0'; +} - for (const prop of ['free', 'reserved', 'miscFrozen', 'feeFrozen'] as Array) { - Object.defineProperty(Enum.prototype, prop, { - get () { - const accData: AccountData = transform(this as Enum); +interface EqPrimitivesSignedBalance extends Enum { + readonly isPositive: boolean; + readonly asPositive: u128; + readonly isNegative: boolean; + readonly asNegative: u128; + readonly type: 'Positive' | 'Negative'; +} - return accData[prop]; - }, - set () { - // Do nothing - } - }); - } - } +export const createDerives = (tokens: string[]) => tokens.reduce((prev, token, i) => { + const isNative = !i; - // Transform result if we call the func normally - const boundFunction = (account: AccountIndex | AccountId | Address | string) => - query(account, arg).pipe(map(transform)); + return { + ...prev, - // Bind currency as second key for doubleMap for queryMulti - const boundCreator = (account: AccountIndex | AccountId | Address | string) => - query.creator([account, arg]); + [token]: { customAccount: (instanceId: string, api: ApiInterfaceRx) => { + const { registry } = api; + const asset = u64FromCurrency(token); - Object.assign(boundCreator, { ...query.creator }); + return memo(instanceId, (address: AccountIndex | AccountId | Address | string) => api.query.system.account(address).pipe(map((v) => { + const data = (v as unknown as { data: EqPrimitivesBalanceAccountData }).data; - return Object.assign(boundFunction, { ...query, creator: boundCreator } as unknown as CommonBalanceMap); -}; + const miscFrozen = isNative ? data.asV0.lock : registry.createType('u128', 0); + const feeFrozen = miscFrozen; + const reserved = registry.createType('u128', 0); -const signedBalancePredicate = (raw: Codec): raw is SignedBalance => - ['asNegative', 'asPositive', 'isNegative', 'isPositive'].some((key) => - Object.prototype.hasOwnProperty.call(raw, key) - ); + const entry = data.asV0.balance.find(([assetId]) => { + return assetId.toBigInt() === asset; + }); -export const createCustomAccount = (currency: string, currencyToAsset: (curr: string, api?: ApiInterfaceRx) => A, accountDataType = 'AccountData'): -(instanceId: string, api: ApiInterfaceRx) => RxResult<(arg: string | Uint8Array | AccountId) => Observable> => (_instanceId: string, api: ApiInterfaceRx) => { - const registry = api.registry; + const balance = entry?.[1]; - const transform = (balance: SB): AccountData => { - let free = registry.createType('Balance'); - const reserved = registry.createType('Balance'); - const miscFrozen = registry.createType('Balance'); - const feeFrozen = registry.createType('Balance'); + const free = balance?.isPositive + ? balance.asPositive + : registry.createType('u128', 0); - if (signedBalancePredicate(balance)) { - if (balance.isPositive) { - free = registry.createType('Balance', balance.asPositive); - } else if (balance.isNegative) { - free = registry.createType('Balance', balance.asNegative.mul(new BN(-1))); - } - } + return { + feeFrozen, free, miscFrozen, reserved + }; + }))); + }, + customLocks: (instanceId: string, api: ApiInterfaceRx) => { + const { registry } = api; - return registry.createType(accountDataType as 'AccountData', { feeFrozen, free, miscFrozen, reserved }); + return memo(instanceId, (address: AccountIndex | AccountId | Address | string) => isNative + ? api.query.system.account(address).pipe(map((v) => { + const data = (v as unknown as { data: EqPrimitivesBalanceAccountData }).data; + + return [{ + amount: data.asV0.lock, + id: new U8aFixed(registry), + reasons: '' + }]; + })) + : of([])); + } } }; - - return transformBalanceStorage( - api.query.eqBalances.account as unknown as EqBalanceDoubleMap, - currency, - transform, - currencyToAsset, - api - ); -}; +}, {}); const definitions: OverrideBundleDefinition = { - derives: { - ...equilibrium.instances.balances.reduce( - (all, cur) => ({ - ...all, - [cur]: { - customAccount: createCustomAccount(cur, (currency: string, api?: ApiInterfaceRx) => { - let assetsEnabled = true; - - try { - api?.registry.createType('AssetIdInnerType' as any); - } catch (_) { - assetsEnabled = false; - } - - return assetsEnabled ? { 0: u64FromCurrency(currency) } : currency; - }) - } - }), - {} - ) - }, - - instances: equilibrium.instances, - - types: [ - { - minmax: [0, 264], - types: equilibrium.types - }, - { - minmax: [265, undefined], - types: equilibriumNext.types - } - ] + derives: createDerives(TOKENS), + instances: { balances: TOKENS } }; export default definitions; diff --git a/packages/apps-config/src/api/spec/genshiro.ts b/packages/apps-config/src/api/spec/genshiro.ts index 2ced580f62..4215b0d596 100644 --- a/packages/apps-config/src/api/spec/genshiro.ts +++ b/packages/apps-config/src/api/spec/genshiro.ts @@ -3,34 +3,13 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types'; -import eqDefs from '@equilab/definitions'; +import { createDerives } from './equilibrium.js'; -import { createCustomAccount, u64FromCurrency } from './equilibrium.js'; - -const { genshiro } = eqDefs; +const TOKENS = ['gens']; const definitions: OverrideBundleDefinition = { - derives: { - ...genshiro.instances.balances.reduce( - (all, cur) => ({ - ...all, - [cur]: { - customAccount: createCustomAccount(cur, (currency: string) => ({ 0: u64FromCurrency(currency) }), 'CompatAccountData') - } - }), - {} - ) - }, - - instances: genshiro.instances, - - types: [ - { - // on all versions - minmax: [0, undefined], - types: genshiro.types - } - ] + derives: createDerives(TOKENS), + instances: { balances: TOKENS } }; export default definitions; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index 30652f8d17..1c786baab6 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -143,7 +143,6 @@ const spec: Record = { 'Darwinia PC2': pangolin, Equilibrium: equilibrium, Genshiro: genshiro, - 'Genshiro Rococo Testnet': genshiro, Pangolin: pangolin, Pangoro: pangoro, VLN: vln, diff --git a/packages/apps-config/src/api/typesBundle.ts b/packages/apps-config/src/api/typesBundle.ts index a7230b1165..b1ef1a51e3 100644 --- a/packages/apps-config/src/api/typesBundle.ts +++ b/packages/apps-config/src/api/typesBundle.ts @@ -24147,1383 +24147,16 @@ export const typesBundle = { "Equilibrium": { "instances": { "balances": [ - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv", - "Usd" + "eq" ] - }, - "types": [ - { - "minmax": [ - 0, - 264 - ], - "types": { - "AccountData": { - "free": "Balance" - }, - "AccountIndex": "u32", - "AccountInfo": { - "nonce": "Index", - "consumers": "RefCount", - "providers": "RefCount", - "sufficients": "RefCount", - "data": "AccountData" - }, - "AccountType": { - "_enum": { - "Id32": "[u8; 32]", - "Key20": "[u8; 20]" - } - }, - "Address": "MultiAddress", - "Asset": { - "0": "AssetIdInnerType" - }, - "AssetData": { - "id": "Asset", - "lot": "FixedU128", - "price_step": "FixedU128", - "maker_fee": "FixedU128", - "taker_fee": "FixedU128", - "asset_xcm_data": "Option", - "debt_weight": "DebtWeightType", - "buyout_priority": "u64", - "asset_type": "AssetType", - "is_dex_enabled": "bool" - }, - "AssetId": "Asset", - "AssetIdInnerType": "u64", - "AssetMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "returns": "Vec", - "volatility": "FixedNumber", - "correlations": "Vec<(Asset, FixedNumber)>" - }, - "AssetName": "Vec", - "AssetType": { - "_enum": { - "Native": null, - "Physical": null, - "Synthetic": null, - "Lp": "PoolId" - } - }, - "AssetXcmData": { - "multi_location": "MultiLocation", - "decimals": "u8" - }, - "Balance": "u64", - "BalanceOf": "Balance", - "BalancesAggregate": { - "total_issuance": "Balance", - "total_debt": "Balance" - }, - "BestPrice": { - "ask": "Option", - "bid": "Option" - }, - "BlockNumber": "u32", - "CapVec": { - "head_index": "u32", - "len_cap": "u32", - "items": "Vec" - }, - "ChainId": "u8", - "Currency": { - "_enum": [ - "UNKNOWN", - "Eqd", - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv" - ] - }, - "ChunkKey": "u64", - "DataPoint": { - "price": "u64", - "account_id": "AccountId", - "block_number": "BlockNumber", - "timestamp": "u64" - }, - "DebtWeightType": "i128", - "DebtWeightTypeInner": "i128", - "DepositNonce": "u64", - "Duration": { - "secs": "u64", - "nanos": "u32" - }, - "FinancialMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "assets": "Vec", - "mean_returns": "Vec", - "volatilities": "Vec", - "correlations": "Vec", - "covariances": "Vec" - }, - "FinancialRecalcPeriodMs": "u64", - "FixedI64": "i64", - "FixedNumber": "u128", - "FixedU128": "u128", - "Keys": "SessionKeys3", - "LookupSource": "AccountIdLookup", - "MarginState": { - "_enum": { - "Good": null, - "SubGood": null, - "MaintenanceStart": "u64", - "MaintenanceIsGoing": "u64", - "MaintenanceTimeOver": "u64", - "MaintenanceEnd": null, - "SubCritical": null - } - }, - "MaxCountOfAssetsRecalcPerBlock": "i32", - "Number": "FixedU128", - "OperationRequestLiqFm": { - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "OperationRequest": { - "account": "AccountId", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "OperationRequestDexDeleteOrder": { - "asset": "Asset", - "order_id": "OrderId", - "price": "FixedI64", - "who": "AccountId", - "buyout": "Option", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "Order": { - "order_id": "OrderId", - "account_id": "AccountId", - "side": "OrderSide", - "price": "FixedI64", - "amount": "FixedU128", - "created_at": "u64", - "expiration_time": "u64" - }, - "OrderType": { - "_enum": { - "Limit": "FixedI64", - "Market": null - } - }, - "OrderId": "u64", - "OrderSide": { - "_enum": [ - "Buy", - "Sell" - ] - }, - "PoolId": "u32", - "PoolInfo": { - "owner": "AccountId", - "pool_asset": "AssetId", - "assets": "Vec", - "amplification": "Number", - "fee": "Permill", - "admin_fee": "Permill", - "balances": "Vec", - "total_balances": "Vec" - }, - "PoolTokenIndex": "u32", - "PortfolioMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "z_score": "u32", - "volatility": "FixedNumber", - "value_at_risk": "FixedNumber" - }, - "Price": "u128", - "PriceLog": { - "latest_timestamp": "Duration", - "prices": "CapVec" - }, - "PricePayload": { - "public": "[u8; 33]", - "asset": "Asset", - "price": "FixedI64", - "block_number": "BlockNumber" - }, - "PricePeriod": { - "_enum": [ - "Min", - "TenMin", - "Hour", - "FourHour", - "Day" - ] - }, - "PricePoint": { - "block_number": "BlockNumber", - "timestamp": "u64", - "last_fin_recalc_timestamp": "Timestamp", - "price": "u64", - "data_points": "Vec" - }, - "PriceUpdate": { - "period_start": "Duration", - "time": "Duration", - "price": "FixedNumber" - }, - "ProposalStatus": { - "_enum": [ - "Initiated", - "Approved", - "Rejected" - ] - }, - "ProposalVotes": { - "votes_for": "Vec", - "votes_against": "Vec", - "status": "ProposalStatus", - "expiry": "BlockNumber" - }, - "ResourceId": "[u8; 32]", - "Signature": "u32", - "SignedBalance": { - "_enum": { - "Positive": "Balance", - "Negative": "Balance" - } - }, - "SubAccType": { - "_enum": [ - "Bailsman", - "Borrower", - "Lender" - ] - }, - "Timestamp": "u64", - "TotalAggregates": { - "collateral": "Balance", - "debt": "Balance" - }, - "TransferReason": { - "_enum": [ - "Common", - "InterestFee", - "MarginCall", - "LiquidityFarming", - "BailsmenRedistribution", - "TreasuryEqBuyout", - "TreasuryBuyEq", - "Subaccount", - "Lock", - "Unlock", - "Claim", - "CurveFeeWithdraw" - ] - }, - "UserGroup": { - "_enum": [ - "UNKNOWN", - "Balances", - "Bailsmen", - "Borrowers", - "Lenders" - ] - }, - "UnsignedPriorityPair": "(u64, u64)", - "VestingInfo": { - "locked": "Balance", - "perBlock": "Balance", - "startingBlock": "BlockNumber" - } - } - }, - { - "minmax": [ - 265, - null - ], - "types": { - "AccountData": { - "free": "Balance" - }, - "AccountIndex": "u32", - "AccountInfo": { - "nonce": "Index", - "consumers": "RefCount", - "providers": "RefCount", - "sufficients": "RefCount", - "data": "AccountData" - }, - "AccountType": { - "_enum": { - "Id32": "[u8; 32]", - "Key20": "[u8; 20]" - } - }, - "Address": "MultiAddress", - "Asset": { - "0": "AssetIdInnerType" - }, - "AssetData": { - "id": "Asset", - "lot": "FixedU128", - "price_step": "FixedU128", - "maker_fee": "FixedU128", - "taker_fee": "FixedU128", - "asset_xcm_data": "Option", - "debt_weight": "DebtWeightType", - "buyout_priority": "u64", - "asset_type": "AssetType", - "is_dex_enabled": "bool" - }, - "AssetId": "Asset", - "AssetIdInnerType": "u64", - "AssetMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "returns": "Vec", - "volatility": "FixedNumber", - "correlations": "Vec<(Asset, FixedNumber)>" - }, - "AssetName": "Vec", - "AssetType": { - "_enum": { - "Native": null, - "Physical": null, - "Synthetic": null, - "Lp": "PoolId" - } - }, - "AssetXcmData": { - "multi_location": "MultiLocation", - "decimals": "u8" - }, - "Balance": "u64", - "BalanceOf": "Balance", - "BalancesAggregate": { - "total_issuance": "Balance", - "total_debt": "Balance" - }, - "BestPrice": { - "ask": "Option", - "bid": "Option" - }, - "BlockNumber": "u32", - "CapVec": { - "head_index": "u32", - "len_cap": "u32", - "items": "Vec" - }, - "ChainId": "u8", - "Currency": { - "_enum": [ - "UNKNOWN", - "Eqd", - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv" - ] - }, - "ChunkKey": "u64", - "DataPoint": { - "price": "u64", - "account_id": "AccountId", - "block_number": "BlockNumber", - "timestamp": "u64" - }, - "DebtWeightType": "i128", - "DebtWeightTypeInner": "i128", - "DepositNonce": "u64", - "Duration": { - "secs": "u64", - "nanos": "u32" - }, - "FinancialMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "assets": "Vec", - "mean_returns": "Vec", - "volatilities": "Vec", - "correlations": "Vec", - "covariances": "Vec" - }, - "FinancialRecalcPeriodMs": "u64", - "FixedI64": "i64", - "FixedNumber": "u128", - "FixedU128": "u128", - "Keys": "SessionKeys3", - "LookupSource": "AccountIdLookup", - "MarginState": { - "_enum": { - "Good": null, - "SubGood": null, - "MaintenanceStart": "u64", - "MaintenanceIsGoing": "u64", - "MaintenanceTimeOver": "u64", - "MaintenanceEnd": null, - "SubCritical": null - } - }, - "MaxCountOfAssetsRecalcPerBlock": "i32", - "Number": "FixedU128", - "OperationRequestLiqFm": { - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "OperationRequest": { - "account": "AccountId", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "OperationRequestDexDeleteOrder": { - "asset": "Asset", - "order_id": "OrderId", - "price": "FixedI64", - "who": "AccountId", - "buyout": "Option", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "Order": { - "order_id": "OrderId", - "account_id": "AccountId", - "side": "OrderSide", - "price": "FixedI64", - "amount": "FixedU128", - "created_at": "u64", - "expiration_time": "u64" - }, - "OrderType": { - "_enum": { - "Limit": "FixedI64", - "Market": null - } - }, - "OrderId": "u64", - "OrderSide": { - "_enum": [ - "Buy", - "Sell" - ] - }, - "PoolId": "u32", - "PoolInfo": { - "owner": "AccountId", - "pool_asset": "AssetId", - "assets": "Vec", - "amplification": "Number", - "fee": "Permill", - "admin_fee": "Permill", - "balances": "Vec", - "total_balances": "Vec" - }, - "PoolTokenIndex": "u32", - "PortfolioMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "z_score": "u32", - "volatility": "FixedNumber", - "value_at_risk": "FixedNumber" - }, - "Price": "u128", - "PriceLog": { - "latest_timestamp": "Duration", - "prices": "CapVec" - }, - "PricePayload": { - "public": "[u8; 33]", - "asset": "Asset", - "price": "FixedI64", - "block_number": "BlockNumber" - }, - "PricePeriod": { - "_enum": [ - "Min", - "TenMin", - "Hour", - "FourHour", - "Day" - ] - }, - "PricePoint": { - "block_number": "BlockNumber", - "timestamp": "u64", - "last_fin_recalc_timestamp": "Timestamp", - "price": "u64", - "data_points": "Vec" - }, - "PriceUpdate": { - "period_start": "Duration", - "time": "Duration", - "price": "FixedNumber" - }, - "ProposalStatus": { - "_enum": [ - "Initiated", - "Approved", - "Rejected" - ] - }, - "ProposalVotes": { - "votes_for": "Vec", - "votes_against": "Vec", - "status": "ProposalStatus", - "expiry": "BlockNumber" - }, - "ResourceId": "[u8; 32]", - "Signature": "u32", - "SignedBalance": { - "_enum": { - "Positive": "Balance", - "Negative": "Balance" - } - }, - "SubAccType": { - "_enum": [ - "Bailsman", - "Borrower", - "Lender" - ] - }, - "Timestamp": "u64", - "TotalAggregates": { - "collateral": "Balance", - "debt": "Balance" - }, - "TransferReason": { - "_enum": [ - "Common", - "InterestFee", - "MarginCall", - "LiquidityFarming", - "BailsmenRedistribution", - "TreasuryEqBuyout", - "TreasuryBuyEq", - "Subaccount", - "Lock", - "Unlock", - "Claim", - "CurveFeeWithdraw" - ] - }, - "UserGroup": { - "_enum": [ - "UNKNOWN", - "Balances", - "Bailsmen", - "Borrowers", - "Lenders" - ] - }, - "UnsignedPriorityPair": "(u64, u64)", - "VestingInfo": { - "locked": "Balance", - "perBlock": "Balance", - "startingBlock": "BlockNumber" - } - } - } - ] + } }, "Genshiro": { "instances": { "balances": [ - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv", - "Usd" + "gens" ] - }, - "types": [ - { - "minmax": [ - 0, - null - ], - "types": { - "AccountInfo": { - "nonce": "Index", - "consumers": "RefCount", - "providers": "RefCount" - }, - "Address": "AccountId", - "AmmPool": { - "_enum": { - "Curve": "PoolId", - "Yield": "PoolId" - } - }, - "Asset": { - "0": "AssetIdInnerType" - }, - "AssetData": { - "id": "Asset", - "lot": "FixedU128", - "price_step": "FixedU128", - "maker_fee": "FixedU128", - "taker_fee": "FixedU128", - "multi_asset": "Option", - "multi_location": "Option", - "debt_weight": "DebtWeightType", - "buyout_priority": "u64", - "asset_type": "AssetType", - "is_dex_enabled": "bool", - "collateral_enabled": "bool" - }, - "AssetId": "Asset", - "AssetIdInnerType": "u64", - "AssetMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "returns": "Vec", - "volatility": "FixedNumber", - "correlations": "Vec<(Asset, FixedNumber)>" - }, - "AssetName": "Vec", - "AssetType": { - "_enum": { - "Native": null, - "Physical": null, - "Synthetic": null, - "Lp": "AmmPool" - } - }, - "Balance": "u64", - "BalanceOf": "Balance", - "BalancesAggregate": { - "total_issuance": "Balance", - "total_debt": "Balance" - }, - "BestPrice": { - "ask": "Option", - "bid": "Option" - }, - "BinaryId": "u64", - "BinaryInfo": { - "start_time": "u64", - "end_time": "u64", - "proper": "Asset", - "minimal_amount": "Balance", - "target": "(Asset, BinaryMode)", - "total": "(Balance, Balance)", - "claimed": "Balance" - }, - "BinaryMode": { - "_enum": { - "CallPut": "FixedI64", - "InOut": "(FixedI64, FixedI64)" - } - }, - "BlockNumber": "u64", - "CapVec": { - "head_index": "u32", - "len_cap": "u32", - "items": "Vec" - }, - "ChainAddressType": { - "_enum": [ - "Ethereum", - "Substrate", - "SubstrateWithPrefix" - ] - }, - "ChainId": "u8", - "Currency": { - "_enum": [ - "UNKNOWN", - "Eqd", - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv" - ] - }, - "ChunkKey": "u64", - "DataPoint": { - "price": "u64", - "account_id": "AccountId", - "block_number": "BlockNumber", - "timestamp": "u64" - }, - "DebtWeightType": "i128", - "DebtWeightTypeInner": "i128", - "DepositNonce": "u64", - "DispatchErrorModule": "DispatchErrorModuleU8", - "Duration": { - "secs": "u64", - "nanos": "u32" - }, - "EpochCounter": "u64", - "EpochInfo": { - "counter": "EpochCounter", - "started_at": "Timestamp", - "duration": "Timestamp", - "new_duration": "Option" - }, - "FinancialMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "assets": "Vec", - "mean_returns": "Vec", - "volatilities": "Vec", - "correlations": "Vec", - "covariances": "Vec" - }, - "FinancialRecalcPeriodMs": "u64", - "FixedI64": "i64", - "FixedNumber": "u128", - "FixedU128": "u128", - "Keys": "SessionKeys3", - "LenderInfo": { - "deposit": "Balance", - "pending_withdrawals": "PendingWithdrawal" - }, - "LookupSource": "AccountId", - "MarginState": { - "_enum": { - "Good": null, - "SubGood": null, - "MaintenanceStart": "u64", - "MaintenanceIsGoing": "u64", - "MaintenanceTimeOver": "u64", - "MaintenanceEnd": null, - "SubCritical": null - } - }, - "MaxCountOfAssetsRecalcPerBlock": "i32", - "MmId": "u16", - "MmInfo": { - "weight": "Perbill", - "borrowed": "Balance" - }, - "MmPoolInfo": { - "account_id": "AccountId", - "min_amount": "Balance", - "total_staked": "Balance", - "total_deposit": "Balance", - "total_borrowed": "Balance", - "total_pending_withdrawals": "PendingWithdrawal" - }, - "Number": "FixedU128", - "OperationRequestLiqFm": { - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "OperationRequest": { - "account": "AccountId", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber", - "higher_priority": "bool" - }, - "OperationRequestDexDeleteOrder": { - "asset": "Asset", - "order_id": "OrderId", - "price": "FixedI64", - "who": "AccountId", - "buyout": "Option", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "Order": { - "order_id": "OrderId", - "account_id": "AccountId", - "side": "OrderSide", - "price": "FixedI64", - "amount": "FixedU128", - "created_at": "u64", - "expiration_time": "u64" - }, - "OrderType": { - "_enum": { - "Limit": { - "price": "FixedI64", - "expiration_time": "u64" - }, - "Market": null - } - }, - "OrderId": "u64", - "OrderSide": { - "_enum": [ - "Buy", - "Sell" - ] - }, - "PendingWithdrawal": { - "last_epoch": "EpochCounter", - "available": "Balance", - "available_next_epoch": "Balance", - "requested": "Balance" - }, - "PoolId": "u32", - "PoolInfo": { - "owner": "AccountId", - "pool_asset": "AssetId", - "assets": "Vec", - "amplification": "Number", - "fee": "Permill", - "admin_fee": "Permill", - "balances": "Vec", - "total_balances": "Vec" - }, - "PoolTokenIndex": "u32", - "PortfolioMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "z_score": "u32", - "volatility": "FixedNumber", - "value_at_risk": "FixedNumber" - }, - "Price": "u128", - "PriceLog": { - "latest_timestamp": "Duration", - "prices": "CapVec" - }, - "PricePayload": { - "public": "[u8; 33]", - "asset": "Asset", - "price": "FixedI64", - "block_number": "BlockNumber" - }, - "PricePeriod": { - "_enum": [ - "Min", - "TenMin", - "Hour", - "FourHour", - "Day" - ] - }, - "PricePoint": { - "block_number": "BlockNumber", - "timestamp": "u64", - "last_fin_recalc_timestamp": "Timestamp", - "price": "u64", - "data_points": "Vec" - }, - "PriceUpdate": { - "period_start": "Duration", - "time": "Duration", - "price": "FixedNumber" - }, - "ProposalStatus": { - "_enum": [ - "Initiated", - "Approved", - "Rejected" - ] - }, - "ProposalVotes": { - "votes_for": "Vec", - "votes_against": "Vec", - "status": "ProposalStatus", - "expiry": "BlockNumber" - }, - "ResourceId": "[u8; 32]", - "Round": { - "total_cap": "Balance", - "individual_cap": "Balance", - "end": "u64", - "token": "Asset", - "minimal_buy_amount": "Balance", - "vesting_params": "VestingParams" - }, - "Signature": "u32", - "SignedBalance": { - "_enum": { - "Positive": "Balance", - "Negative": "Balance" - } - }, - "SubAccType": { - "_enum": [ - "Bailsman", - "Borrower", - "Lender" - ] - }, - "Timestamp": "u64", - "TotalAggregates": { - "collateral": "Balance", - "debt": "Balance" - }, - "TransferReason": { - "_enum": [ - "Common", - "InterestFee", - "MarginCall", - "LiquidityFarming", - "BailsmenRedistribution", - "TreasuryEqBuyout", - "TreasuryBuyEq", - "Subaccount", - "Lock", - "Unlock", - "Claim", - "CurveFeeWithdraw", - "Reserve", - "Unreserve" - ] - }, - "UserGroup": { - "_enum": [ - "UNKNOWN", - "Balances", - "Bailsmen", - "Borrowers", - "Lenders" - ] - }, - "UnsignedPriorityPair": "(u64, u64)", - "VestingInfo": { - "locked": "Balance", - "perBlock": "Balance", - "startingBlock": "BlockNumber" - }, - "VestingParams": { - "blocks_until_beginning": "u64", - "amount_of_blocks": "u64" - }, - "XdotNumber": "u128", - "XdotPoolInfo": { - "pool_asset": "AssetId", - "lp_total_supply": "Balance", - "account": "AccountId", - "base_asset": "AssetId", - "xbase_asset": "AssetId", - "g1": "XdotNumber", - "g2": "XdotNumber", - "maturity": "u64", - "ts": "XdotNumber" - }, - "LockPeriod": { - "_enum": [ - "None", - "ThreeMonth", - "SixMonth", - "Year" - ] - } - } - } - ] - }, - "Genshiro Rococo Testnet": { - "instances": { - "balances": [ - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv", - "Usd" - ] - }, - "types": [ - { - "minmax": [ - 0, - null - ], - "types": { - "AccountInfo": { - "nonce": "Index", - "consumers": "RefCount", - "providers": "RefCount" - }, - "Address": "AccountId", - "AmmPool": { - "_enum": { - "Curve": "PoolId", - "Yield": "PoolId" - } - }, - "Asset": { - "0": "AssetIdInnerType" - }, - "AssetData": { - "id": "Asset", - "lot": "FixedU128", - "price_step": "FixedU128", - "maker_fee": "FixedU128", - "taker_fee": "FixedU128", - "multi_asset": "Option", - "multi_location": "Option", - "debt_weight": "DebtWeightType", - "buyout_priority": "u64", - "asset_type": "AssetType", - "is_dex_enabled": "bool", - "collateral_enabled": "bool" - }, - "AssetId": "Asset", - "AssetIdInnerType": "u64", - "AssetMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "returns": "Vec", - "volatility": "FixedNumber", - "correlations": "Vec<(Asset, FixedNumber)>" - }, - "AssetName": "Vec", - "AssetType": { - "_enum": { - "Native": null, - "Physical": null, - "Synthetic": null, - "Lp": "AmmPool" - } - }, - "Balance": "u64", - "BalanceOf": "Balance", - "BalancesAggregate": { - "total_issuance": "Balance", - "total_debt": "Balance" - }, - "BestPrice": { - "ask": "Option", - "bid": "Option" - }, - "BinaryId": "u64", - "BinaryInfo": { - "start_time": "u64", - "end_time": "u64", - "proper": "Asset", - "minimal_amount": "Balance", - "target": "(Asset, BinaryMode)", - "total": "(Balance, Balance)", - "claimed": "Balance" - }, - "BinaryMode": { - "_enum": { - "CallPut": "FixedI64", - "InOut": "(FixedI64, FixedI64)" - } - }, - "BlockNumber": "u64", - "CapVec": { - "head_index": "u32", - "len_cap": "u32", - "items": "Vec" - }, - "ChainAddressType": { - "_enum": [ - "Ethereum", - "Substrate", - "SubstrateWithPrefix" - ] - }, - "ChainId": "u8", - "Currency": { - "_enum": [ - "UNKNOWN", - "Eqd", - "Eq", - "Eth", - "Btc", - "Eos", - "Dot", - "Crv" - ] - }, - "ChunkKey": "u64", - "DataPoint": { - "price": "u64", - "account_id": "AccountId", - "block_number": "BlockNumber", - "timestamp": "u64" - }, - "DebtWeightType": "i128", - "DebtWeightTypeInner": "i128", - "DepositNonce": "u64", - "DispatchErrorModule": "DispatchErrorModuleU8", - "Duration": { - "secs": "u64", - "nanos": "u32" - }, - "EpochCounter": "u64", - "EpochInfo": { - "counter": "EpochCounter", - "started_at": "Timestamp", - "duration": "Timestamp", - "new_duration": "Option" - }, - "FinancialMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "assets": "Vec", - "mean_returns": "Vec", - "volatilities": "Vec", - "correlations": "Vec", - "covariances": "Vec" - }, - "FinancialRecalcPeriodMs": "u64", - "FixedI64": "i64", - "FixedNumber": "u128", - "FixedU128": "u128", - "Keys": "SessionKeys3", - "LenderInfo": { - "deposit": "Balance", - "pending_withdrawals": "PendingWithdrawal" - }, - "LookupSource": "AccountId", - "MarginState": { - "_enum": { - "Good": null, - "SubGood": null, - "MaintenanceStart": "u64", - "MaintenanceIsGoing": "u64", - "MaintenanceTimeOver": "u64", - "MaintenanceEnd": null, - "SubCritical": null - } - }, - "MaxCountOfAssetsRecalcPerBlock": "i32", - "MmId": "u16", - "MmInfo": { - "weight": "Perbill", - "borrowed": "Balance" - }, - "MmPoolInfo": { - "account_id": "AccountId", - "min_amount": "Balance", - "total_staked": "Balance", - "total_deposit": "Balance", - "total_borrowed": "Balance", - "total_pending_withdrawals": "PendingWithdrawal" - }, - "Number": "FixedU128", - "OperationRequestLiqFm": { - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "OperationRequest": { - "account": "AccountId", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber", - "higher_priority": "bool" - }, - "OperationRequestDexDeleteOrder": { - "asset": "Asset", - "order_id": "OrderId", - "price": "FixedI64", - "who": "AccountId", - "buyout": "Option", - "authority_index": "AuthIndex", - "validators_len": "u32", - "block_num": "BlockNumber" - }, - "Order": { - "order_id": "OrderId", - "account_id": "AccountId", - "side": "OrderSide", - "price": "FixedI64", - "amount": "FixedU128", - "created_at": "u64", - "expiration_time": "u64" - }, - "OrderType": { - "_enum": { - "Limit": { - "price": "FixedI64", - "expiration_time": "u64" - }, - "Market": null - } - }, - "OrderId": "u64", - "OrderSide": { - "_enum": [ - "Buy", - "Sell" - ] - }, - "PendingWithdrawal": { - "last_epoch": "EpochCounter", - "available": "Balance", - "available_next_epoch": "Balance", - "requested": "Balance" - }, - "PoolId": "u32", - "PoolInfo": { - "owner": "AccountId", - "pool_asset": "AssetId", - "assets": "Vec", - "amplification": "Number", - "fee": "Permill", - "admin_fee": "Permill", - "balances": "Vec", - "total_balances": "Vec" - }, - "PoolTokenIndex": "u32", - "PortfolioMetrics": { - "period_start": "Duration", - "period_end": "Duration", - "z_score": "u32", - "volatility": "FixedNumber", - "value_at_risk": "FixedNumber" - }, - "Price": "u128", - "PriceLog": { - "latest_timestamp": "Duration", - "prices": "CapVec" - }, - "PricePayload": { - "public": "[u8; 33]", - "asset": "Asset", - "price": "FixedI64", - "block_number": "BlockNumber" - }, - "PricePeriod": { - "_enum": [ - "Min", - "TenMin", - "Hour", - "FourHour", - "Day" - ] - }, - "PricePoint": { - "block_number": "BlockNumber", - "timestamp": "u64", - "last_fin_recalc_timestamp": "Timestamp", - "price": "u64", - "data_points": "Vec" - }, - "PriceUpdate": { - "period_start": "Duration", - "time": "Duration", - "price": "FixedNumber" - }, - "ProposalStatus": { - "_enum": [ - "Initiated", - "Approved", - "Rejected" - ] - }, - "ProposalVotes": { - "votes_for": "Vec", - "votes_against": "Vec", - "status": "ProposalStatus", - "expiry": "BlockNumber" - }, - "ResourceId": "[u8; 32]", - "Round": { - "total_cap": "Balance", - "individual_cap": "Balance", - "end": "u64", - "token": "Asset", - "minimal_buy_amount": "Balance", - "vesting_params": "VestingParams" - }, - "Signature": "u32", - "SignedBalance": { - "_enum": { - "Positive": "Balance", - "Negative": "Balance" - } - }, - "SubAccType": { - "_enum": [ - "Bailsman", - "Borrower", - "Lender" - ] - }, - "Timestamp": "u64", - "TotalAggregates": { - "collateral": "Balance", - "debt": "Balance" - }, - "TransferReason": { - "_enum": [ - "Common", - "InterestFee", - "MarginCall", - "LiquidityFarming", - "BailsmenRedistribution", - "TreasuryEqBuyout", - "TreasuryBuyEq", - "Subaccount", - "Lock", - "Unlock", - "Claim", - "CurveFeeWithdraw", - "Reserve", - "Unreserve" - ] - }, - "UserGroup": { - "_enum": [ - "UNKNOWN", - "Balances", - "Bailsmen", - "Borrowers", - "Lenders" - ] - }, - "UnsignedPriorityPair": "(u64, u64)", - "VestingInfo": { - "locked": "Balance", - "perBlock": "Balance", - "startingBlock": "BlockNumber" - }, - "VestingParams": { - "blocks_until_beginning": "u64", - "amount_of_blocks": "u64" - }, - "XdotNumber": "u128", - "XdotPoolInfo": { - "pool_asset": "AssetId", - "lp_total_supply": "Balance", - "account": "AccountId", - "base_asset": "AssetId", - "xbase_asset": "AssetId", - "g1": "XdotNumber", - "g2": "XdotNumber", - "maturity": "u64", - "ts": "XdotNumber" - }, - "LockPeriod": { - "_enum": [ - "None", - "ThreeMonth", - "SixMonth", - "Year" - ] - } - } - } - ] + } }, "Pangolin": { "alias": {}, diff --git a/packages/apps-config/src/endpoints/productionRelayKusama.ts b/packages/apps-config/src/endpoints/productionRelayKusama.ts index a0271a66bb..53a88b01cb 100644 --- a/packages/apps-config/src/endpoints/productionRelayKusama.ts +++ b/packages/apps-config/src/endpoints/productionRelayKusama.ts @@ -195,12 +195,11 @@ export const prodParasKusama: Omit[] = [ } }, { - homepage: 'https://genshiro.equilibrium.io', - info: 'genshiro', - isUnreachable: true, + homepage: 'https://genshiro..io', + info: 'Genshiro', paraId: 2024, providers: { - Equilibrium: 'wss://node.genshiro.io' + Genshiro: 'wss://node.ksm.genshiro.io' }, text: 'Genshiro', ui: { diff --git a/yarn.lock b/yarn.lock index 2ddfe77f08..3d235f9362 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1839,6 +1839,7 @@ __metadata: "@polkadot/api-derive": ^10.7.1 "@polkadot/networks": ^12.2.1 "@polkadot/types": ^10.7.1 + "@polkadot/types-codec": ^10.7.1 "@polkadot/util": ^12.2.1 "@polkadot/wasm-util": ^7.2.1 "@polkadot/x-fetch": ^12.2.1