From 6b0ea2115387c9f964e765c1cac80fe00cdfc2f2 Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Tue, 1 Dec 2020 11:11:28 +0800 Subject: [PATCH 1/9] Fix abnormal account type --- packages/apps-config/src/api/spec/crust.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/apps-config/src/api/spec/crust.ts b/packages/apps-config/src/api/spec/crust.ts index 44740e8e21e8..2b02859a0bd5 100644 --- a/packages/apps-config/src/api/spec/crust.ts +++ b/packages/apps-config/src/api/spec/crust.ts @@ -6,7 +6,6 @@ export default { Address: 'AccountId', - RefCount: 'u8', AddressInfo: 'Vec', FileAlias: 'Vec', Guarantee: { From 3fa3f512aa46839896812141400ae2999136add3 Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Tue, 1 Dec 2020 11:12:08 +0800 Subject: [PATCH 2/9] Fix crust logo invisible --- packages/apps-config/src/ui/logos/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index 217762582a32..5827d696d81c 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -88,7 +88,7 @@ export const nodeLogos: Record = [ ['centrifuge chain', nodeCentrifuge], ['Centrifuge Chain Node', nodeCentrifuge], ['darwinia crab', nodeCrab], - ['crust node', nodeCrust], + ['crust', nodeCrust], ['darwinia', nodeDarwinia], ['darwinia parachain', nodeDarwinia], ['Dock Full Node', nodeDockMainnet], From 27451e3415351cc4966ddc6ed419d20620d03bd7 Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Mon, 25 Jan 2021 13:42:01 +0800 Subject: [PATCH 3/9] Add Crust Rococo V1 Endpoint --- .../src/api/spec/crust-parachain.ts | 76 +++++++++++++++++++ packages/apps-config/src/api/spec/index.ts | 2 + .../src/endpoints/testingRococo.ts | 8 ++ packages/apps-config/src/ui/colors.ts | 1 + packages/apps-config/src/ui/logos/index.ts | 3 + .../apps/public/locales/en/apps-config.json | 1 + .../apps/public/locales/fr/translation.json | 1 + 7 files changed, 92 insertions(+) create mode 100644 packages/apps-config/src/api/spec/crust-parachain.ts diff --git a/packages/apps-config/src/api/spec/crust-parachain.ts b/packages/apps-config/src/api/spec/crust-parachain.ts new file mode 100644 index 000000000000..250eddf1ab8d --- /dev/null +++ b/packages/apps-config/src/api/spec/crust-parachain.ts @@ -0,0 +1,76 @@ +// Copyright 2017-2021 @polkadot/apps-config authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// structs need to be in order +/* eslint-disable sort-keys */ + +export default { + 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)>' + } +}; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index 7c7a45c78eef..1f8eabf1d686 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -7,6 +7,7 @@ import canvas from './canvas'; import centrifugeChain from './centrifuge-chain'; 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'; @@ -42,6 +43,7 @@ export default { canvas, 'centrifuge-chain': centrifugeChain, crust, + 'crust-parachain': crustParachain, 'cumulus-test-parachain': testPara, 'darwinia-parachain': darwiniaParachain, 'dock-main-runtime': dock, diff --git a/packages/apps-config/src/endpoints/testingRococo.ts b/packages/apps-config/src/endpoints/testingRococo.ts index 5f2e34e6094c..a57fb25fd42b 100644 --- a/packages/apps-config/src/endpoints/testingRococo.ts +++ b/packages/apps-config/src/endpoints/testingRococo.ts @@ -59,6 +59,14 @@ export function createRococo (t: TFunction): EndpointOption { Bifrost: 'wss://rococo-1.testnet.liebi.com' } }, + { + info: 'rococoCrust', + paraId: 7777, + text: t('rpc.rococo.crust', 'Crust PC1', { ns: 'apps-config' }), + providers: { + Crust: 'wss://api-rococo.crust.network' + } + }, { info: 'rococoDarwinia', paraId: 18, diff --git a/packages/apps-config/src/ui/colors.ts b/packages/apps-config/src/ui/colors.ts index 2f2f1022fdd4..5b88bd5d84d3 100644 --- a/packages/apps-config/src/ui/colors.ts +++ b/packages/apps-config/src/ui/colors.ts @@ -66,6 +66,7 @@ export const chainColors: Record = [ ['Bifrost PC1', chainRoccoBifrost], ['Darwinia Crab', chainCrab], ['crust maxwell cc2', chainCrust], + ['Crust PC1', chainCrust], ['darwinia cc1', chainDarwinia], ['Darwinia PC2', chainRoccoDarwinia], ['Encointer PC1', nodeEncointerNotee], diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index 6bf30c5878b6..7a2ff5b9c60d 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -59,6 +59,7 @@ import emptyLogo from './empty.svg'; // Alphabetical overrides based on the actual matched chain name // NOTE: This is as retrieved via system.chain RPC export const chainLogos: Record = [ + ['Crust PC1', nodeCrust], ['darwinia crab', nodeCrab], ['Darwinia PC2', nodeDarwinia], ['Dusty', chainDusty], @@ -97,6 +98,7 @@ export const nodeLogos: Record = [ ['Centrifuge Chain Node', nodeCentrifuge], ['darwinia crab', nodeCrab], ['crust', nodeCrust], + ['Crust Collator', nodeCrust], ['darwinia', nodeDarwinia], ['darwinia parachain', nodeDarwinia], ['Darwinia Runtime Module Library', nodeDarwinia], @@ -174,6 +176,7 @@ export const namedLogos: Record = { rococo: chainRococo, rococoAcala: nodeAcala, rococoBifrost: nodeBifrost, + rococoCrust: nodeCrust, rococoDarwinia: nodeDarwinia, rococoKilt: nodeKilt, rococoLaminar: nodeLaminar, diff --git a/packages/apps/public/locales/en/apps-config.json b/packages/apps/public/locales/en/apps-config.json index 878d2aa73f71..44c86b8ceb17 100644 --- a/packages/apps/public/locales/en/apps-config.json +++ b/packages/apps/public/locales/en/apps-config.json @@ -53,6 +53,7 @@ "rpc.rococo": "Rococo", "rpc.rococo.acala": "Mandala PC2", "rpc.rococo.bifrost": "Bifrost PC1", + "rpc.rococo.crust": "Crust PC1", "rpc.rococo.darwinia": "Darwinia PC2", "rpc.rococo.encointer": "Encointer PC1", "rpc.rococo.kilt": "KILT PC1", diff --git a/packages/apps/public/locales/fr/translation.json b/packages/apps/public/locales/fr/translation.json index ece8a3687572..464a09402963 100644 --- a/packages/apps/public/locales/fr/translation.json +++ b/packages/apps/public/locales/fr/translation.json @@ -1325,6 +1325,7 @@ "rpc.polkadot.w3f": "Polkadot", "rpc.rococo": "Rococo", "rpc.rococo.acala": "Mandala PC1", + "rpc.rococo.crust": "Crust PC1", "rpc.rococo.darwinia": "Darwinia PC1", "rpc.rococo.laminar": "Turbulence PC1", "rpc.rococo.plasm": "Plasm PC1", From 2c7ec5db3406b62cd9aba17964a78516b744376c Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Mon, 25 Jan 2021 21:27:38 +0800 Subject: [PATCH 4/9] Upgrade to Crust Maxwell --- packages/apps-config/src/api/spec/crust.ts | 74 +++++++++---------- packages/apps-config/src/endpoints/testing.ts | 2 +- packages/apps-config/src/links/subscan.ts | 2 +- packages/apps-config/src/ui/colors.ts | 2 +- .../apps/public/locales/en/apps-config.json | 2 +- .../apps/public/locales/fr/translation.json | 2 +- 6 files changed, 39 insertions(+), 45 deletions(-) diff --git a/packages/apps-config/src/api/spec/crust.ts b/packages/apps-config/src/api/spec/crust.ts index 250eddf1ab8d..9d41bbcca4b9 100644 --- a/packages/apps-config/src/api/spec/crust.ts +++ b/packages/apps-config/src/api/spec/crust.ts @@ -7,7 +7,18 @@ export default { 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', @@ -16,61 +27,44 @@ export default { }, IASSig: 'Vec', Identity: { - pub_key: 'Vec', - code: 'Vec' + anchor: 'SworkerAnchor', + group: 'Option' }, ISVBody: 'Vec', LookupSource: 'AccountId', - MerchantInfo: { - address: 'Vec', - storage_price: 'Balance', - file_map: 'Vec<(Vec, Vec)>' - }, - MerchantPunishment: { - success: 'EraIndex', - failed: 'EraIndex', - value: 'Balance' + MerchantLedger: { + reward: 'Balance', + pledge: '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'] + Replica: { + who: 'AccountId', + valid_at: 'BlockNumber', + anchor: 'SworkerAnchor' + }, + PKInfo: { + code: 'SworkerCode', + anchor: 'Option' }, 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' - }, + SworkerAnchor: 'Vec', SworkerCert: 'Vec', SworkerCode: 'Vec', SworkerPubKey: 'Vec', SworkerSignature: 'Vec', + UsedInfo: { + used_size: 'u64', + groups: 'BTreeSet' + }, WorkReport: { - block_number: 'u64', + report_slot: 'u64', used: 'u64', - reserved: 'u64', - cached_reserved: 'u64', - files: 'Vec<(Vec, u64)>' + free: 'u64', + reported_files_size: 'u64', + reported_srd_root: 'MerkleRoot', + reported_files_root: 'MerkleRoot' } }; diff --git a/packages/apps-config/src/endpoints/testing.ts b/packages/apps-config/src/endpoints/testing.ts index 21e66f9a1429..047ee58f4f32 100644 --- a/packages/apps-config/src/endpoints/testing.ts +++ b/packages/apps-config/src/endpoints/testing.ts @@ -64,7 +64,7 @@ export function createTesting (t: TFunction): LinkOption[] { }, { info: 'crust', - text: t('rpc.crust.network', 'Crust Maxwell CC2', { ns: 'apps-config' }), + text: t('rpc.crust.network', 'Crust Maxwell', { ns: 'apps-config' }), providers: { 'Crust Network': 'wss://api.crust.network/' } diff --git a/packages/apps-config/src/links/subscan.ts b/packages/apps-config/src/links/subscan.ts index e2c1df56af15..fd0b4d361060 100644 --- a/packages/apps-config/src/links/subscan.ts +++ b/packages/apps-config/src/links/subscan.ts @@ -11,7 +11,7 @@ export default { 'Bifrost Asgard Nightly': 'bitfrost', 'Centrifuge Mainnet': 'centrifuge', ChainX: 'chainx', - 'Crust Maxwell CC2': 'crust', + 'Crust Maxwell': 'crust', 'Darwinia CC1': 'darwinia-cc1', 'Darwinia Crab': 'crab', Edgeware: 'edgeware', diff --git a/packages/apps-config/src/ui/colors.ts b/packages/apps-config/src/ui/colors.ts index 5b88bd5d84d3..ad75ee9c3dd4 100644 --- a/packages/apps-config/src/ui/colors.ts +++ b/packages/apps-config/src/ui/colors.ts @@ -65,7 +65,7 @@ export const chainColors: Record = [ ['Bit.Country Tewai Chain', chainBitCountry], ['Bifrost PC1', chainRoccoBifrost], ['Darwinia Crab', chainCrab], - ['crust maxwell cc2', chainCrust], + ['crust maxwell', chainCrust], ['Crust PC1', chainCrust], ['darwinia cc1', chainDarwinia], ['Darwinia PC2', chainRoccoDarwinia], diff --git a/packages/apps/public/locales/en/apps-config.json b/packages/apps/public/locales/en/apps-config.json index 44c86b8ceb17..44cdf4901476 100644 --- a/packages/apps/public/locales/en/apps-config.json +++ b/packages/apps/public/locales/en/apps-config.json @@ -8,7 +8,7 @@ "rpc.canvas": "Canvas", "rpc.centrifuge": "Centrifuge", "rpc.crab": "Darwinia Crab", - "rpc.crust.network": "Crust Maxwell CC2", + "rpc.crust.network": "Crust Maxwell", "rpc.custom": "Custom environment", "rpc.custom.entry": "Custom {{WS_URL}}", "rpc.custom.own": "Custom", diff --git a/packages/apps/public/locales/fr/translation.json b/packages/apps/public/locales/fr/translation.json index 464a09402963..bb93e71e9995 100644 --- a/packages/apps/public/locales/fr/translation.json +++ b/packages/apps/public/locales/fr/translation.json @@ -1294,7 +1294,7 @@ "rpc.canvas": "Canvas", "rpc.centrifuge": "Centrifuge", "rpc.crab": "Darwinia Crab", - "rpc.crust.network": "Crust Maxwell CC2", + "rpc.crust.network": "Crust Maxwell", "rpc.custom": "Environment personnalisé", "rpc.custom.entry": "Personalisé {{WS_URL}}", "rpc.custom.own": "Personalisé", From e69900bc66d20878682397dd30bb9cf497e9ce77 Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Tue, 16 Mar 2021 13:47:55 +0800 Subject: [PATCH 5/9] 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 4a108e050379..f079851f4eb8 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 500c9b06ff20..000000000000 --- 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 935d8f1c6777..a0dc789a3820 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 5ef35f036c36..cdab3ce7eb25 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'; @@ -79,7 +78,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 7051f66da0c5..ff66547dae4d 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 79702dda5846..1ed99fc5fb29 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 From 825bfb1bb338838646dc10bfa9fc7121a142f0f3 Mon Sep 17 00:00:00 2001 From: Kun Date: Mon, 29 Mar 2021 23:08:45 +0800 Subject: [PATCH 6/9] Ipfs on crust (#4) * Change ipfs upload in a more decentralized way * Add CRUST_SEEDS env variable --- .github/workflows/push-master.yml | 1 + package.json | 1 + scripts/ipfsUpload.cjs | 6 ++++++ yarn.lock | 13 ++++++++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index 0e38f76bfefe..c7f5bc4ff714 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -21,6 +21,7 @@ jobs: env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} + CRUST_SEEDS: ${{ secrets.CRUST_SEEDS }} GH_PAGES_SRC: packages/apps/build GH_PAT: ${{ secrets.GH_PAT }} GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }} diff --git a/package.json b/package.json index 26079528452f..82bc2a367d8d 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@babel/core": "^7.13.10", "@babel/register": "^7.13.8", "@babel/runtime": "^7.13.10", + "@crustio/crust-pin": "^0.0.1", "@pinata/sdk": "^1.1.13", "@polkadot/dev": "^0.62.7", "@polkadot/ts": "^0.3.62", diff --git a/scripts/ipfsUpload.cjs b/scripts/ipfsUpload.cjs index 1d7d15947898..fece220df8dd 100644 --- a/scripts/ipfsUpload.cjs +++ b/scripts/ipfsUpload.cjs @@ -3,6 +3,7 @@ const fs = require('fs'); const pinataSDK = require('@pinata/sdk'); +const crustPin = require('@crustio/crust-pin').default; const cloudflare = require('dnslink-cloudflare'); const execSync = require('@polkadot/dev/scripts/execSync.cjs'); @@ -19,6 +20,7 @@ const PINMETA = { name: DOMAIN }; const repo = `https://${process.env.GH_PAT}@github.com/${process.env.GITHUB_REPOSITORY}.git`; const pinata = pinataSDK(process.env.PINATA_API_KEY, process.env.PINATA_SECRET_KEY); +const crust = crustPin(process.env.CRUST_SEEDS); function writeFiles (name, content) { [DST, SRC].forEach((root) => @@ -36,6 +38,7 @@ skip-checks: true"`); } async function pin () { + // 1. Pin on pinata const result = await pinata.pinFromFS(DST, { pinataMetadata: PINMETA }); const url = `${GATEWAY}${result.IpfsHash}/`; const html = ` @@ -58,6 +61,9 @@ async function pin () { writeFiles('pin.json', JSON.stringify(result)); updateGh(result.IpfsHash); + // 2. Decentralized pin on Crust + await crust.pin(result.IpfsHash); + console.log(`Pinned ${result.IpfsHash}`); return result.IpfsHash; diff --git a/yarn.lock b/yarn.lock index 7dd90737b6a9..e35d8de514c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1412,7 +1412,17 @@ __metadata: languageName: node linkType: hard -"@crustio/type-definitions@npm:0.0.5": +"@crustio/crust-pin@npm:^0.0.1": + version: 0.0.1 + resolution: "@crustio/crust-pin@npm:0.0.1" + dependencies: + "@crustio/type-definitions": ^0.0.5 + "@polkadot/api": ^3.11.1 + checksum: 036cec0b77385b1ed0d8fa3fb91e8921b998a994ef1f45983911b473be4bedf259ae56babb581466bad588670a574580ce38d15ceeba35686ee4cc56312bdc4d + languageName: node + linkType: hard + +"@crustio/type-definitions@npm:0.0.5, @crustio/type-definitions@npm:^0.0.5": version: 0.0.5 resolution: "@crustio/type-definitions@npm:0.0.5" dependencies: @@ -14559,6 +14569,7 @@ fsevents@~2.1.2: "@babel/core": ^7.13.10 "@babel/register": ^7.13.8 "@babel/runtime": ^7.13.10 + "@crustio/crust-pin": ^0.0.1 "@pinata/sdk": ^1.1.13 "@polkadot/dev": ^0.62.7 "@polkadot/ts": ^0.3.62 From 84d66dc469a1ff4113a1121ff77001d12a58f72d Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Mon, 29 Mar 2021 23:25:25 +0800 Subject: [PATCH 7/9] Fix with Crust IPFS Upload --- scripts/ipfsUpload.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ipfsUpload.cjs b/scripts/ipfsUpload.cjs index fece220df8dd..98ab8c04f7ab 100644 --- a/scripts/ipfsUpload.cjs +++ b/scripts/ipfsUpload.cjs @@ -3,7 +3,7 @@ const fs = require('fs'); const pinataSDK = require('@pinata/sdk'); -const crustPin = require('@crustio/crust-pin').default; +const CrustPinner = require('@crustio/crust-pin').default; const cloudflare = require('dnslink-cloudflare'); const execSync = require('@polkadot/dev/scripts/execSync.cjs'); @@ -20,7 +20,7 @@ const PINMETA = { name: DOMAIN }; const repo = `https://${process.env.GH_PAT}@github.com/${process.env.GITHUB_REPOSITORY}.git`; const pinata = pinataSDK(process.env.PINATA_API_KEY, process.env.PINATA_SECRET_KEY); -const crust = crustPin(process.env.CRUST_SEEDS); +const crust = new CrustPinner(process.env.CRUST_SEEDS); function writeFiles (name, content) { [DST, SRC].forEach((root) => From 187a22d8d511775679b0b48c2155d151d2f76158 Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Sat, 15 May 2021 10:28:29 +0800 Subject: [PATCH 8/9] Add Crust Shadow Network --- .../apps-config/src/endpoints/productionRelayKusama.ts | 8 ++++++++ packages/apps-config/src/ui/colors.ts | 1 + packages/apps-config/src/ui/logos/index.ts | 1 + packages/apps/public/locales/en/apps-config.json | 1 + 4 files changed, 11 insertions(+) diff --git a/packages/apps-config/src/endpoints/productionRelayKusama.ts b/packages/apps-config/src/endpoints/productionRelayKusama.ts index 4ae038cadc70..f5787161d67c 100644 --- a/packages/apps-config/src/endpoints/productionRelayKusama.ts +++ b/packages/apps-config/src/endpoints/productionRelayKusama.ts @@ -27,6 +27,14 @@ export function createKusama (t: TFunction): EndpointOption { linked: [ // parachains with id, see Rococo // alphabetical based on chain name + { + info: 'crust shadow', + paraId: 2012, + text: t('rpc.kusama.shadow', 'Crust Shadow', { ns: 'apps-config' }), + providers: { + Crust: 'wss://shadow.phala.network/' + } + }, { info: 'khala', paraId: 2004, diff --git a/packages/apps-config/src/ui/colors.ts b/packages/apps-config/src/ui/colors.ts index 2d069dc801d6..74a271dfdacb 100644 --- a/packages/apps-config/src/ui/colors.ts +++ b/packages/apps-config/src/ui/colors.ts @@ -133,6 +133,7 @@ export const chainColors: Record = [ ['Clover', chainClover], ['crust maxwell', chainCrust], ['Crust PC1', chainCrust], + ['Crust Shadow', chainCrust], ['darwinia cc1', chainDarwinia], ['Darwinia Crab', chainCrab], ['Darwinia PC2', chainRoccoDarwinia], diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index 96ae2f443331..4c66175f530e 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -203,6 +203,7 @@ export const nodeLogos: Record = [ ['darwinia crab', nodeCrab], ['crust', nodeCrust], ['Crust Collator', nodeCrust], + ['Crust Shadow', nodeCrust], ['darwinia', nodeDarwinia], ['darwinia parachain', nodeDarwinia], ['Darwinia Runtime Module Library', nodeDarwinia], diff --git a/packages/apps/public/locales/en/apps-config.json b/packages/apps/public/locales/en/apps-config.json index 2fdf962dd5fb..88051e18613c 100644 --- a/packages/apps/public/locales/en/apps-config.json +++ b/packages/apps/public/locales/en/apps-config.json @@ -53,6 +53,7 @@ "rpc.kusama.onfinality": "Kusama", "rpc.kusama.parity": "Kusama", "rpc.kusama.patractlabs": "Kusama", + "rpc.kusama.shadow": "Crust Shadow", "rpc.kusama.w3f": "Kusama", "rpc.litentry.test": "Litentry", "rpc.local": "Local Node", From 8894bf5e06195aaaf65c5bfcbdff03df0050e9e6 Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Sat, 15 May 2021 10:32:48 +0800 Subject: [PATCH 9/9] Fix --- packages/apps-config/src/endpoints/productionRelayKusama.ts | 2 +- packages/apps-config/src/ui/colors.ts | 2 +- packages/apps-config/src/ui/logos/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/apps-config/src/endpoints/productionRelayKusama.ts b/packages/apps-config/src/endpoints/productionRelayKusama.ts index f5787161d67c..1ddaa19de94d 100644 --- a/packages/apps-config/src/endpoints/productionRelayKusama.ts +++ b/packages/apps-config/src/endpoints/productionRelayKusama.ts @@ -32,7 +32,7 @@ export function createKusama (t: TFunction): EndpointOption { paraId: 2012, text: t('rpc.kusama.shadow', 'Crust Shadow', { ns: 'apps-config' }), providers: { - Crust: 'wss://shadow.phala.network/' + Crust: 'wss://shadow.crust.network/' } }, { diff --git a/packages/apps-config/src/ui/colors.ts b/packages/apps-config/src/ui/colors.ts index 74a271dfdacb..3307379889e5 100644 --- a/packages/apps-config/src/ui/colors.ts +++ b/packages/apps-config/src/ui/colors.ts @@ -133,7 +133,7 @@ export const chainColors: Record = [ ['Clover', chainClover], ['crust maxwell', chainCrust], ['Crust PC1', chainCrust], - ['Crust Shadow', chainCrust], + ['crust shadow', chainCrust], ['darwinia cc1', chainDarwinia], ['Darwinia Crab', chainCrab], ['Darwinia PC2', chainRoccoDarwinia], diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index 4c66175f530e..79c2dba0e59c 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -203,7 +203,7 @@ export const nodeLogos: Record = [ ['darwinia crab', nodeCrab], ['crust', nodeCrust], ['Crust Collator', nodeCrust], - ['Crust Shadow', nodeCrust], + ['crust shadow', nodeCrust], ['darwinia', nodeDarwinia], ['darwinia parachain', nodeDarwinia], ['Darwinia Runtime Module Library', nodeDarwinia],