Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Joystream #421

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/ui/src/components/select/NetworkSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
kusamaNetworksAndParachains,
networkList,
polkadotNetworksAndParachains,
soloChains,
testChains
} from '../../constants'
import { theme } from '../../styles/theme'
Expand Down Expand Up @@ -67,6 +68,8 @@ const NetworkSelection = () => {
{renderNetworks(polkadotNetworksAndParachains)}
<ListSubheader>Kusama & Parachains</ListSubheader>
{renderNetworks(kusamaNetworksAndParachains)}
<ListSubheader>Solo chains</ListSubheader>
{renderNetworks(soloChains)}
<ListSubheader>Testnets</ListSubheader>
{renderNetworks(testChains)}
</SelectStyled>
Expand Down
110 changes: 46 additions & 64 deletions packages/ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { nodesInterlaySVG } from './logos/interlaySVG'
import { nodesWestendColourSVG } from './logos/westend_colourSVG'
import { nodesMoonriverSVG } from './logos/moonriverSVG'
import { nodesMoonbeamSVG } from './logos/moonbeamSVG'
import { nodesJoystreamSVG } from './logos/joystreamSVG'

export const DAPP_NAME = 'Multix'
export const ICON_SIZE_LARGE = 92
Expand All @@ -39,146 +40,154 @@ export const networkList = {
chainId: 'polkadot',
explorerNetworkName: 'polkadot',
rpcUrl: 'wss://rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: chainsPolkadotCircleSVG
} as NetworkInfo,
kusama: {
chainId: 'kusama',
explorerNetworkName: 'kusama',
rpcUrl: 'wss://kusama-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: chainsKusamaSVG
} as NetworkInfo,
'assethub-dot': {
chainId: 'assethub-polkadot',
explorerNetworkName: 'assethub-polkadot',
rpcUrl: 'wss://polkadot-asset-hub-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesAssetHubSVG
} as NetworkInfo,
'assethub-ksm': {
chainId: 'assethub-kusama',
explorerNetworkName: 'assethub-kusama',
rpcUrl: 'wss://kusama-asset-hub-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesAssetHubSVG
} as NetworkInfo,
acala: {
chainId: 'acala',
explorerNetworkName: 'acala',
rpcUrl: 'wss://acala-rpc-3.aca-api.network/ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: chainsAcalaSVG
} as NetworkInfo,
// amplitude: {
// chainId: 'amplitude',
// explorerNetworkName: 'amplitude',
// rpcUrl: 'wss://rpc-amplitude.pendulumchain.tech',
// wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
// httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
// wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
// httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
// logo: chainsAmplitudeSVG
// } as NetworkInfo,
astar: {
chainId: 'astar',
explorerNetworkName: 'astar',
rpcUrl: 'wss://rpc.astar.network',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesAstarPNG
} as NetworkInfo,
'bifrost-dot': {
chainId: 'bifrost-polkadot',
explorerNetworkName: 'bifrost',
rpcUrl: 'wss://bifrost-polkadot.api.onfinality.io/public-ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesBifrostSVG
} as NetworkInfo,
hydradx: {
chainId: 'hydradx',
explorerNetworkName: 'hydradx',
rpcUrl: 'wss://hydradx-rpc.dwellir.com',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: hydradxSVG
} as NetworkInfo,
interlay: {
chainId: 'interlay',
explorerNetworkName: 'interlay',
rpcUrl: 'wss://interlay.api.onfinality.io/public-ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesInterlaySVG
} as NetworkInfo,
khala: {
chainId: 'khala',
explorerNetworkName: 'khala',
rpcUrl: 'wss://khala-api.phala.network/ws',
wsGraphqlUrl: 'wss:///squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https:///squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss:///squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https:///squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesKhalaSVG
} as NetworkInfo,
// pendulum: {
// chainId: 'pendulum',
// explorerNetworkName: 'pendulum',
// rpcUrl: 'wss://rpc-pendulum.prd.pendulumchain.tech',
// wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
// httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
// wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
// httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
// logo: chainsPendulumSVG
// } as NetworkInfo,
moonbeam: {
chainId: 'moonbeam',
explorerNetworkName: 'moonbeam',
rpcUrl: 'wss://moonbeam.api.onfinality.io/public-ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesMoonbeamSVG
} as NetworkInfo,
moonriver: {
chainId: 'moonriver',
explorerNetworkName: 'moonriver',
rpcUrl: 'wss://moonriver.api.onfinality.io/public-ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesMoonriverSVG
} as NetworkInfo,
phala: {
chainId: 'phala',
explorerNetworkName: 'phala',
rpcUrl: 'wss://api.phala.network/ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: phalaSVG
} as NetworkInfo,
'rhala testnet': {
chainId: 'rhala',
explorerNetworkName: '',
rpcUrl: 'wss://subbridge-test.phala.network/rhala/ws',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesKhalaSVG
} as NetworkInfo,
rococo: {
chainId: 'rococo',
explorerNetworkName: 'rococo',
rpcUrl: 'wss://rococo-rpc.polkadot.io',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: chainsRococoSVG
} as NetworkInfo,
// westend: {
// chainId: 'westend',
// explorerNetworkName: 'westend',
// rpcUrl: 'wss://westend-rpc.polkadot.io',
// wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v6/graphql',
// httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v6/graphql',
// wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
// httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
// logo: nodesWestendColourSVG
// } as NetworkInfo,
joystream: {
chainId: 'joystream',
explorerNetworkName: 'joystream',
rpcUrl: 'wss://rpc.joystream.org',
wsGraphqlUrl: 'wss://squid.subsquid.io/multix-large/v/v7/graphql',
httpGraphqlUrl: 'https://squid.subsquid.io/multix-large/v/v7/graphql',
logo: nodesJoystreamSVG
},
local: {
chainId: import.meta.env.VITE_CHAIN_ID,
explorerNetworkName: import.meta.env.VITE_NETWORK_NAME as 'kusama',
Expand All @@ -201,38 +210,11 @@ export const polkadotNetworksAndParachains = [
'phala'
]
export const kusamaNetworksAndParachains = ['kusama', 'assethub-ksm', 'khala', 'moonriver']
export const soloChains = ['joystream']
export const testChains = ['rococo', 'rhala testnet', 'local']

export type SupportedNetworks = keyof typeof networkList

/**
* Types
*/
export type TPolkadotChain = keyof typeof POLKADOT_MAINNET_CHAINS

/**
* Chains
*/
export const POLKADOT_MAINNET_CHAINS = {
'polkadot:91b171bb158e2d3848fa23a9f1c25182': {
chainId: '91b171bb158e2d3848fa23a9f1c25182',
name: 'Polkadot',
logo: chainsPolkadotCircleSVG,
rgb: '230, 1, 122',
rpc: ''
}
}

export const POLKADOT_TEST_CHAINS = {
'polkadot:e143f23803ac50e8f6f8e62695d1ce9e': {
chainId: 'e143f23803ac50e8f6f8e62695d1ce9e',
name: 'Polkadot Westend',
logo: nodesWestendColourSVG,
rgb: '218, 104, 167',
rpc: ''
}
}

/**
* Methods
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/hooks/useProxyAdditionNeededFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export const useProxyAdditionNeededFunds = () => {

if (!chainInfo?.tokenDecimals) return

if (!api.consts.proxy.proxyDepositFactor) return
if (!api.consts?.proxy?.proxyDepositFactor) return

// the proxy is already created (with proxyDepositBase already deposited by the first account
// that added the first proxy) we are only adding one account as proxy
const reserved = api.consts.proxy.proxyDepositFactor as unknown as BN
const reserved = api.consts?.proxy?.proxyDepositFactor as unknown as BN
setMin(reserved)
}, [api, chainInfo])

Expand Down
10 changes: 5 additions & 5 deletions packages/ui/src/hooks/usePureProxyCreationNeededFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ export const usePureProxyCreationNeededFunds = () => {
if (!chainInfo?.tokenDecimals) return

if (
!api.consts.proxy.proxyDepositFactor ||
!api.consts.proxy.proxyDepositBase ||
!api.consts.balances.existentialDeposit
!api.consts?.proxy?.proxyDepositFactor ||
!api.consts?.proxy?.proxyDepositBase ||
!api.consts?.balances?.existentialDeposit
)
return

const reserved = (api.consts.proxy.proxyDepositFactor as unknown as BN)
const reserved = (api.consts?.proxy?.proxyDepositFactor as unknown as BN)
// we only create one proxy here
.muln(1)
.iadd(api.consts.proxy.proxyDepositBase as unknown as BN)
.iadd(api.consts?.proxy?.proxyDepositBase as unknown as BN)

// the signer should survive and have at lease the existential deposit
// play safe and add the existential deposit twice which should suffice
Expand Down
7 changes: 7 additions & 0 deletions packages/ui/src/logos/joystreamSVG.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 nodesJoystreamSVG =
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3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squid/assets/envs/.env.joystream
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RPC_WS="wss://rpc.joystream.org"
CHAIN_ID='joystream'
BLOCK_START=0
PREFIX=126
ARCHIVE_NAME="joystream"
10 changes: 10 additions & 0 deletions squid/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@
"lib/main",
"dotenv_config_path=assets/envs/.env.moonbeam"
]
},
"start-joystream": {
"description": "starts the indexer with joystream",
"cmd": [
"node",
"-r",
"dotenv/config",
"lib/main",
"dotenv_config_path=assets/envs/.env.joystream"
]
}
}
}
4 changes: 3 additions & 1 deletion squid/squid-manifests/large-squid.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
manifestVersion: subsquid.io/v0.1
name: multix-large
version: 6
version: 7
description: |-
Squid for Multix

Expand Down Expand Up @@ -40,6 +40,8 @@ deploy:
cmd: ['sqd', 'start-moonriver']
- name: khala-processor
cmd: ['sqd', 'start-khala']
- name: joystream-processor
cmd: ['sqd', 'start-joystream']
# - name: pendulum-processor
# cmd: ['sqd', 'start-pendulum']
# - name: amplitude-processor
Expand Down
Loading