Skip to content

Commit

Permalink
Add asset hubs, astar, hydra (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut authored Jul 17, 2023
1 parent 659b868 commit 332dd95
Show file tree
Hide file tree
Showing 47 changed files with 72,566 additions and 68,273 deletions.
4 changes: 2 additions & 2 deletions packages/ui/src/components/CallInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const createUlTree = ({ name, args, decimals, unit }: CreateTreeParams) => {
return (
<ul className="params">
{Object.entries(args).map(([key, value]) => {
const destAddress = value?.Id

// in case the call was a WrapperOpaque<Call> the destination is the value and has no Id
const destAddress = value?.Id || value
// show nice dest
if (
((isBalancesTransferAlike && key === 'dest') ||
Expand Down
59 changes: 47 additions & 12 deletions packages/ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { localSVG } from './logos/localSVG'
import { chainsPolkadotCircleSVG } from './logos/polkadot-circleSVG'
import { chainsRococoSVG } from './logos/rococoSVG'
import { phalaSVG } from './logos/phalaSVG'
import { nodesAstarPNG } from './logos/astarPNG'
import { nodesAssetHubSVG } from './logos/assetHubSVG'
import { hydradxSVG } from './logos/hydradxSVG'

export const DAPP_NAME = 'Multix'
export const ICON_SIZE = 40
Expand All @@ -21,6 +24,14 @@ export interface NetworkInfo {
export const PAYMENT_INFO_ACCOUNT = '5CXQZrh1MSgnGGCdJu3tqvRfCv7t5iQXGGV9UKotrbfhkavs'

export const networkList = {
polkadot: {
chainId: 'polkadot',
explorerNetworkName: 'polkadot',
rpcUrl: 'wss://rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: chainsPolkadotCircleSVG
} as NetworkInfo,
kusama: {
chainId: 'kusama',
explorerNetworkName: 'kusama',
Expand All @@ -29,21 +40,37 @@ export const networkList = {
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: chainsKusamaSVG
} as NetworkInfo,
polkadot: {
chainId: 'polkadot',
explorerNetworkName: 'polkadot',
rpcUrl: 'wss://rpc.polkadot.io',
'assethub-ksm': {
chainId: 'assethub-kusama',
explorerNetworkName: 'assethub-kusama',
rpcUrl: 'wss://kusama-asset-hub-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: chainsPolkadotCircleSVG
logo: nodesAssetHubSVG
} as NetworkInfo,
rococo: {
chainId: 'rococo',
explorerNetworkName: 'rococo',
rpcUrl: 'wss://rococo-rpc.polkadot.io',
'assethub-dot': {
chainId: 'assethub-polkadot',
explorerNetworkName: 'assethub-polkadot',
rpcUrl: 'wss://polkadot-asset-hub-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: chainsRococoSVG
logo: nodesAssetHubSVG
} as NetworkInfo,
astar: {
chainId: 'astar',
explorerNetworkName: 'astar',
rpcUrl: 'wss://rpc.astar.network',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: nodesAstarPNG
} as NetworkInfo,
hydradx: {
chainId: 'hydradx',
explorerNetworkName: 'hydradx',
rpcUrl: 'wss://hydradx-rpc.dwellir.com',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: hydradxSVG
} as NetworkInfo,
phala: {
chainId: 'phala',
Expand All @@ -61,12 +88,20 @@ export const networkList = {
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: nodesKhalaSVG
} as NetworkInfo,
rococo: {
chainId: 'rococo',
explorerNetworkName: 'rococo',
rpcUrl: 'wss://rococo-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: chainsRococoSVG
} as NetworkInfo,
'rhala testnet': {
chainId: 'rhala',
explorerNetworkName: '',
rpcUrl: 'wss://subbridge-test.phala.network/rhala/ws',
wsGraphqlUrl: 'wss://api.multix.chainsafe.io/graphql',
httpGraphqlUrl: 'https://api.multix.chainsafe.io/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix/graphql',
logo: nodesKhalaSVG
} as NetworkInfo,
local: {
Expand Down
7 changes: 7 additions & 0 deletions packages/ui/src/logos/assetHubSVG.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0

// Do not edit. Auto-generated via node scripts/imgConvert.mjs

export const nodesAssetHubSVG =
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI3LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA2NDAgNjQwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA2NDAgNjQwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6IzMyMUQ0Nzt9Cgkuc3Qxe2ZpbGw6I0ZGRkZGRjt9Cgkuc3Qye2ZpbGw6I0U2MDA3QTt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTYzNy4zLDMxOS4zYzAsMTc1LjItMTQyLDMxNy4zLTMxNy4zLDMxNy4zUzIuNyw0OTQuNiwyLjcsMzE5LjNTMTQ0LjgsMi4xLDMyMCwyLjFTNjM3LjMsMTQ0LjEsNjM3LjMsMzE5LjN6IgoJCS8+Cgk8cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDQ0LjIsMzkyLjRoLTY3LjZsLTEyLjctMzFoLTg1LjhsLTEyLjcsMzFoLTY3LjZsODAuOS0xODQuM2g4NC41TDQ0NC4yLDM5Mi40eiBNMzIxLjEsMjU2bC0yMi40LDU1aDQ0LjcKCQlMMzIxLjEsMjU2eiIvPgoJPGNpcmNsZSBjbGFzcz0ic3QyIiBjeD0iMzIxIiBjeT0iMTIyLjEiIHI9IjQ2LjkiLz4KCTxjaXJjbGUgY2xhc3M9InN0MiIgY3g9IjMyMSIgY3k9IjUxNy4xIiByPSI0Ni45Ii8+Cgk8Y2lyY2xlIGNsYXNzPSJzdDIiIGN4PSIxNDcuOCIgY3k9IjIxNiIgcj0iNDYuOSIvPgoJPGNpcmNsZSBjbGFzcz0ic3QyIiBjeD0iNDk0LjMiIGN5PSIyMTYiIHI9IjQ2LjkiLz4KCTxjaXJjbGUgY2xhc3M9InN0MiIgY3g9IjE0Ny44IiBjeT0iNDI0LjgiIHI9IjQ2LjkiLz4KCTxjaXJjbGUgY2xhc3M9InN0MiIgY3g9IjQ5NC4zIiBjeT0iNDI0LjgiIHI9IjQ2LjkiLz4KPC9nPgo8L3N2Zz4K'
7 changes: 7 additions & 0 deletions packages/ui/src/logos/astarPNG.ts

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages/ui/src/logos/hydradxSVG.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0

// Do not edit. Auto-generated via node scripts/imgConv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yNjhsLTE3OC43NzQsLTE3OC44MDRsLTAuODIzLDAuODA4Yy03MC4xNzcsNjguNzQxIC0xODcuMzQzLDE1OS42NDQgLTMyMC45OTEsMTY2LjU0M2MzMy41MTYsLTM3LjM0NSAxMDcuNDI4LC0xMzIuMjk2IDEwNy40MjgsLTI0My40MTFjMCwtMTExLjExNiAtNzMuOTEyLC0yMDYuMDY3IC0xMDcuNDI4LC0yNDMuNDExbC0xNi4xNzIsLTE4LjU3MmwtMTYuMTcyLDE4LjU3MmMtMzMuNTE2LDM3LjM0NCAtMTA3LjQyOCwxMzIuMjk1IC0xMDcuNDI4LDI0My40MTFjMCwxMTEuMTE1IDczLjkxMiwyMDYuMDY2IDEwNy40MjgsMjQzLjQxMWMtMTM0LjE3MSwtNi45MjYgLTI1MS43MzEsLTk4LjUxNSAtMzIxLjgxNSwtMTY3LjM1MWwtMTc1LjAzNSwxNzUuMTE0WiIgc3R5bGU9ImZpbGw6I2Y2NTNhMjsiLz48L3N2Zz4='
1 change: 1 addition & 0 deletions packages/ui/src/utils/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function parseGenericCall(genericCall: GenericCall, registry: Registry):
// serialize to a polkadot-js Call and parse so it is not a hex blob.
try {
const call = registry.createType('Call', argument.toHex())
newArgs['callData'] = call.toHex()
newArgs[paramName] = parseGenericCall(call, registry)
} catch {
newArgs[paramName] = argument
Expand Down
6 changes: 6 additions & 0 deletions squid/assets/envs/.env.assethub-kusama
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#assethub-kusama
BLOCK_START=0
PREFIX=2
RPC_WS="wss://kusama-asset-hub-rpc.polkadot.io"
ARCHIVE_NAME="statemine"
CHAIN_ID='assethub-kusama'
6 changes: 6 additions & 0 deletions squid/assets/envs/.env.assethub-polkadot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#assethub-polkadot
BLOCK_START=0
PREFIX=0
RPC_WS="wss://polkadot-asset-hub-rpc.polkadot.io"
ARCHIVE_NAME="statemint"
CHAIN_ID='assethub-polkadot'
7 changes: 7 additions & 0 deletions squid/assets/envs/.env.astar
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#astar
BLOCK_START=0
PREFIX=5
RPC_WS="wss://rpc.astar.network"
ARCHIVE_NAME="astar"
CHAIN_ID='astar'
GENESIS='0x9eb76c5184c4ab8679d2d5d819fdf90b9c001403e9e17da2e14b6d8aec4029c6'
6 changes: 6 additions & 0 deletions squid/assets/envs/.env.hydradx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#hydradx
BLOCK_START=0
PREFIX=63
RPC_WS="wss://hydradx-rpc.dwellir.com"
ARCHIVE_NAME="hydradx"
CHAIN_ID='hydradx'
40 changes: 40 additions & 0 deletions squid/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,46 @@
"lib/main",
"dotenv_config_path=assets/envs/.env.rhala"
]
},
"start-astar": {
"description": "starts the indexer with astar",
"cmd": [
"node",
"-r",
"dotenv/config",
"lib/main",
"dotenv_config_path=assets/envs/.env.astar"
]
},
"start-assethub-polkadot": {
"description": "starts the indexer with assethub-polkadot",
"cmd": [
"node",
"-r",
"dotenv/config",
"lib/main",
"dotenv_config_path=assets/envs/.env.assethub-polkadot"
]
},
"start-assethub-kusama": {
"description": "starts the indexer with assethub-kusama",
"cmd": [
"node",
"-r",
"dotenv/config",
"lib/main",
"dotenv_config_path=assets/envs/.env.assethub-kusama"
]
},
"start-hydradx": {
"description": "starts the indexer with hydradx",
"cmd": [
"node",
"-r",
"dotenv/config",
"lib/main",
"dotenv_config_path=assets/envs/.env.hydradx"
]
}
}
}
2 changes: 1 addition & 1 deletion squid/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ enum ProxyType {
SudoBalances
NominationPools
Society
Unkown # this is added in case a new proxy type comes up and isn't supported yet
Unknown # this is added in case a new proxy type comes up and isn't supported yet
}
10 changes: 9 additions & 1 deletion squid/squid.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
manifestVersion: subsquid.io/v0.1
name: multix
version: 1
version: 2
description: |-
Squid for Multix
Expand All @@ -22,6 +22,14 @@ deploy:
cmd: ['sqd', 'start-khala']
- name: rhala-processor
cmd: ['sqd', 'start-rhala']
- name: astar-processor
cmd: ['sqd', 'start-astar']
- name: assethub-polkadot-processor
cmd: ['sqd', 'start-assethub-polkadot']
- name: assethub-kusama-processor
cmd: ['sqd', 'start-assethub-kusama']
- name: hydradx-processor
cmd: ['sqd', 'start-hydradx']
api:
cmd: ['npx', 'squid-graphql-server', '--subscriptions']
scale:
Expand Down
8 changes: 5 additions & 3 deletions squid/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export const env = new Env().getEnv()
const archiveUrl =
env.archiveUrl ||
lookupArchive(env.archiveName as KnownArchivesSubstrate, {
release: 'FireSquid'
release: 'FireSquid',
genesis: env.genesis,
type: 'Substrate'
})
const chainId = env.chainId

Expand Down Expand Up @@ -146,14 +148,14 @@ processor.run(new TypeormDatabase({ stateSchema: chainId }), async (ctx) => {
}

if (item.name === 'Proxy.ProxyAdded') {
const newProxy = getProxyInfoFromArgs(item, chainId)
const newProxy = getProxyInfoFromArgs({ item, chainId, ctx, isAdded: true })
// ctx.log.info(`-----> delegator ${newProxy.delegator}`)
// ctx.log.info(`-----> delegatee ${newProxy.delegatee}`)
newProxies.set(newProxy.id, { ...newProxy, createdAt: timestamp })
}

if (item.name === 'Proxy.ProxyRemoved') {
const proxyRemoval = getProxyInfoFromArgs(item, chainId)
const proxyRemoval = getProxyInfoFromArgs({ item, chainId, ctx, isAdded: false })
// ctx.log.info(`-----> to remove delegator ${proxyRemoval.delegator}`)
// ctx.log.info(`-----> to remove delegatee ${proxyRemoval.delegatee}`)
if (newProxies.has(proxyRemoval.id)) {
Expand Down
2 changes: 1 addition & 1 deletion squid/src/model/generated/_proxyType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export enum ProxyType {
SudoBalances = "SudoBalances",
NominationPools = "NominationPools",
Society = "Society",
Unkown = "Unkown",
Unknown = "Unknown",
}
Loading

0 comments on commit 332dd95

Please sign in to comment.