From 10b4bf282c5b2b57a49d196c70a0640bfad062c5 Mon Sep 17 00:00:00 2001 From: Kun Date: Tue, 16 Mar 2021 15:57:00 +0800 Subject: [PATCH] Apply Crust types package and add DCF provider (#4861) * Fix abnormal account type * Fix crust logo invisible * Add Crust Rococo V1 Endpoint * Upgrade to Crust Maxwell * Apply crust type package and add DCF provider --- packages/apps-config/package.json | 1 + .../src/api/spec/crust-parachain.ts | 88 ------------------- packages/apps-config/src/api/spec/crust.ts | 81 +---------------- packages/apps-config/src/api/spec/index.ts | 3 +- packages/apps-config/src/endpoints/testing.ts | 3 +- yarn.lock | 10 +++ 6 files changed, 16 insertions(+), 170 deletions(-) delete mode 100644 packages/apps-config/src/api/spec/crust-parachain.ts diff --git a/packages/apps-config/package.json b/packages/apps-config/package.json index 4a108e0503..f079851f4e 100644 --- a/packages/apps-config/package.json +++ b/packages/apps-config/package.json @@ -12,6 +12,7 @@ "dependencies": { "@acala-network/type-definitions": "^0.7.1", "@babel/runtime": "^7.13.10", + "@crustio/type-definitions": "0.0.5", "@darwinia/types": "^1.1.0-alpha.1", "@edgeware/node-types": "^3.3.2", "@interlay/polkabtc-types": "^0.5.3", diff --git a/packages/apps-config/src/api/spec/crust-parachain.ts b/packages/apps-config/src/api/spec/crust-parachain.ts deleted file mode 100644 index 500c9b06ff..0000000000 --- a/packages/apps-config/src/api/spec/crust-parachain.ts +++ /dev/null @@ -1,88 +0,0 @@ -// 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: { - Address: 'AccountId', - AddressInfo: 'Vec', - FileAlias: 'Vec', - Guarantee: { - targets: 'Vec>', - total: 'Compact', - submitted_in: 'EraIndex', - suppressed: 'bool' - }, - IASSig: 'Vec', - Identity: { - pub_key: 'Vec', - code: 'Vec' - }, - ISVBody: 'Vec', - LookupSource: 'AccountId', - MerchantInfo: { - address: 'Vec', - storage_price: 'Balance', - file_map: 'Vec<(Vec, Vec)>' - }, - MerchantPunishment: { - success: 'EraIndex', - failed: 'EraIndex', - value: 'Balance' - }, - MerkleRoot: 'Vec', - OrderStatus: { - _enum: ['Success', 'Failed', 'Pending'] - }, - PaymentLedger: { - total: 'Balance', - paid: 'Balance', - unreserved: 'Balance' - }, - Pledge: { - total: 'Balance', - used: 'Balance' - }, - ReportSlot: 'u64', - Releases: { - _enum: ['V1_0_0', 'V2_0_0'] - }, - Status: { - _enum: ['Free', 'Reserved'] - }, - StorageOrder: { - file_identifier: 'Vec', - file_size: 'u64', - created_on: 'BlockNumber', - completed_on: 'BlockNumber', - expired_on: 'BlockNumber', - provider: 'AccountId', - client: 'AccountId', - amount: 'Balance', - order_status: 'OrderStatus' - }, - SworkerCert: 'Vec', - SworkerCode: 'Vec', - SworkerPubKey: 'Vec', - SworkerSignature: 'Vec', - WorkReport: { - block_number: 'u64', - used: 'u64', - reserved: 'u64', - cached_reserved: 'u64', - files: 'Vec<(Vec, u64)>' - } - } - } - ] -}; - -export default definitions; diff --git a/packages/apps-config/src/api/spec/crust.ts b/packages/apps-config/src/api/spec/crust.ts index 935d8f1c67..a0dc789a38 100644 --- a/packages/apps-config/src/api/spec/crust.ts +++ b/packages/apps-config/src/api/spec/crust.ts @@ -3,83 +3,6 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types'; -// structs need to be in order -/* eslint-disable sort-keys */ +import { typesBundleForPolkadot } from '@crustio/type-definitions'; -const definitions: OverrideBundleDefinition = { - types: [ - { - // on all versions - minmax: [0, undefined], - types: { - Address: 'AccountId', - AddressInfo: 'Vec', - ETHAddress: 'Vec', - EthereumTxHash: 'H256', - FileAlias: 'Vec', - FileInfo: { - file_size: 'u64', - expired_on: 'BlockNumber', - claimed_at: 'BlockNumber', - amount: 'Balance', - expected_replica_count: 'u32', - reported_replica_count: 'u32', - replicas: 'Vec>' - }, - Guarantee: { - targets: 'Vec>', - total: 'Compact', - submitted_in: 'EraIndex', - suppressed: 'bool' - }, - IASSig: 'Vec', - Identity: { - anchor: 'SworkerAnchor', - punishment_deadline: 'u64', - group: 'Option' - }, - ISVBody: 'Vec', - LookupSource: 'AccountId', - MerchantLedger: { - reward: 'Balance', - pledge: 'Balance' - }, - MerkleRoot: 'Vec', - ReportSlot: 'u64', - Replica: { - who: 'AccountId', - valid_at: 'BlockNumber', - anchor: 'SworkerAnchor', - is_reported: 'bool' - }, - PKInfo: { - code: 'SworkerCode', - anchor: 'Option' - }, - Status: { - _enum: ['Free', 'Reserved'] - }, - SworkerAnchor: 'Vec', - SworkerCert: 'Vec', - SworkerCode: 'Vec', - SworkerPubKey: 'Vec', - SworkerSignature: 'Vec', - UsedInfo: { - used_size: 'u64', - reported_group_count: 'u32', - groups: 'BTreeMap' - }, - WorkReport: { - report_slot: 'u64', - used: 'u64', - free: 'u64', - reported_files_size: 'u64', - reported_srd_root: 'MerkleRoot', - reported_files_root: 'MerkleRoot' - } - } - } - ] -}; - -export default definitions; +export default typesBundleForPolkadot.spec.crust as unknown as OverrideBundleDefinition; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index f3446e4ab5..8dc551ea48 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -15,7 +15,6 @@ import clover from './clover'; import cloverRococo from './clover-rococo'; import crab from './crab'; import crust from './crust'; -import crustParachain from './crust-parachain'; import testPara from './cumulus-test-parachain'; import darwinia from './darwinia'; import darwiniaParachain from './darwinia-parachain'; @@ -80,7 +79,7 @@ const spec: Record = { clover, 'clover-rococo': cloverRococo, crust, - 'crust-parachain': crustParachain, + 'crust-parachain': crust, 'cumulus-test-parachain': testPara, 'darwinia-parachain': darwiniaParachain, 'datahighway-parachain': datahighwayParachain, diff --git a/packages/apps-config/src/endpoints/testing.ts b/packages/apps-config/src/endpoints/testing.ts index 7051f66da0..ff66547dae 100644 --- a/packages/apps-config/src/endpoints/testing.ts +++ b/packages/apps-config/src/endpoints/testing.ts @@ -70,7 +70,8 @@ export function createTesting (t: TFunction): LinkOption[] { info: 'crust', text: t('rpc.crust.network', 'Crust Maxwell', { ns: 'apps-config' }), providers: { - 'Crust Network': 'wss://api.crust.network/' + 'Crust Network': 'wss://api.crust.network/', + 'DCloud Foundation': 'wss://api.decloudf.com/' } }, { diff --git a/yarn.lock b/yarn.lock index 79702dda58..1ed99fc5fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1398,6 +1398,15 @@ __metadata: languageName: node linkType: hard +"@crustio/type-definitions@npm:0.0.5": + version: 0.0.5 + resolution: "@crustio/type-definitions@npm:0.0.5" + dependencies: + "@open-web3/orml-type-definitions": ^0.8.2-9 + checksum: 849813ac540f3a406555b99dd2a3439c279810275ca28881e8efd95604cce5800bb49644d5ccb0318aecb48f2f7cb4cf0b362198186edbf0d49816882e24414c + languageName: node + linkType: hard + "@darwinia/types-known@npm:^1.1.0-alpha.1": version: 1.1.0-alpha.1 resolution: "@darwinia/types-known@npm:1.1.0-alpha.1" @@ -2371,6 +2380,7 @@ __metadata: dependencies: "@acala-network/type-definitions": ^0.7.1 "@babel/runtime": ^7.13.10 + "@crustio/type-definitions": 0.0.5 "@darwinia/types": ^1.1.0-alpha.1 "@edgeware/node-types": ^3.3.2 "@interlay/polkabtc-types": ^0.5.3