diff --git a/.changelog/1376.trivial.md b/.changelog/1376.trivial.md
new file mode 100644
index 000000000..67b95ebeb
--- /dev/null
+++ b/.changelog/1376.trivial.md
@@ -0,0 +1 @@
+Remove unused local layer configs and explicitly define tokens per ParaTime
diff --git a/src/app/components/logo/SmallTokenLogo.tsx b/src/app/components/logo/SmallTokenLogo.tsx
index 43a1add08..67ff2176e 100644
--- a/src/app/components/logo/SmallTokenLogo.tsx
+++ b/src/app/components/logo/SmallTokenLogo.tsx
@@ -5,9 +5,9 @@ import euroELogo from '../../../../public/euroe.png'
export const SmallTokenLogo: FC<{ ticker: Ticker }> = ({ ticker }) => {
switch (ticker) {
- case 'ROSE':
+ case Ticker.ROSE:
return
- case 'EUROe':
+ case Ticker.EUROe:
return
default:
return null
diff --git a/src/config.ts b/src/config.ts
index f162db4f3..b6a819c86 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -1,7 +1,7 @@
// We get this from the generated code to avoid circular imports
// eslint-disable-next-line no-restricted-imports
import { Layer } from './oasis-nexus/generated/api'
-import { getTokenForNetwork, NativeToken, NativeTokenInfo } from './types/ticker'
+import { NativeToken, NativeTokenInfo } from './types/ticker'
import { SearchScope } from './types/searchScope'
export const consensusDecimals = 9
@@ -19,11 +19,11 @@ type LayerNetwork = {
runtimeId: string | undefined
/**
- * What are the native tokens on this layer?
- *
- * (If not given, the network's default token will be used.)
+ * What are the tokens on this layer?
+ * Note: native token must be the first on the list. Others are just incorrectly named "Native"
+ * See terminology in https://github.com/oasisprotocol/oasis-sdk/blob/5bec25f/client-sdk/go/config/default.go#L109-L120
*/
- tokens?: NativeTokenInfo[]
+ tokens: [NativeTokenInfo, ...NativeTokenInfo[]]
/**
* What fiat currency should we use for displaying value?
@@ -34,7 +34,6 @@ type LayerNetwork = {
type LayerConfig = {
mainnet: LayerNetwork
testnet: LayerNetwork
- local: LayerNetwork
decimals: number
type: RuntimeTypes
}
@@ -45,6 +44,15 @@ export enum RuntimeTypes {
}
// consensusConfig: max_block_size = 22020096, max_block_gas = unlimited right now
+export const consensusConfig = {
+ mainnet: {
+ tokens: [NativeToken.ROSE],
+ },
+ testnet: {
+ tokens: [NativeToken.TEST],
+ },
+ decimals: consensusDecimals,
+}
const emeraldConfig: LayerConfig = {
mainnet: {
@@ -53,18 +61,14 @@ const emeraldConfig: LayerConfig = {
// Match max_batch_gas https://github.com/oasisprotocol/emerald-paratime/blob/5a36a646b989e510fadc0029178fe96a24cad101/src/lib.rs#L112-L112
blockGasLimit: 10_000_000,
runtimeId: '000000000000000000000000000000000000000000000000e2eaa99fc008f87f',
+ tokens: [NativeToken.ROSE],
},
testnet: {
activeNodes: 32,
address: 'oasis1qr629x0tg9gm5fyhedgs9lw5eh3d8ycdnsxf0run',
blockGasLimit: 30_000_000,
runtimeId: '00000000000000000000000000000000000000000000000072c8215e60d5bca7',
- },
- local: {
- activeNodes: undefined,
- address: undefined,
- blockGasLimit: undefined,
- runtimeId: undefined,
+ tokens: [NativeToken.TEST],
},
decimals: 18,
type: RuntimeTypes.Evm,
@@ -76,18 +80,14 @@ const cipherConfig: LayerConfig = {
address: 'oasis1qrnu9yhwzap7rqh6tdcdcpz0zf86hwhycchkhvt8',
blockGasLimit: undefined, // TODO: provide gas limit
runtimeId: '000000000000000000000000000000000000000000000000e199119c992377cb',
+ tokens: [NativeToken.ROSE],
},
testnet: {
activeNodes: 15,
address: 'oasis1qqdn25n5a2jtet2s5amc7gmchsqqgs4j0qcg5k0t',
blockGasLimit: undefined, // TODO: provide gas limit
runtimeId: '0000000000000000000000000000000000000000000000000000000000000000',
- },
- local: {
- activeNodes: undefined,
- address: undefined,
- blockGasLimit: undefined,
- runtimeId: undefined,
+ tokens: [NativeToken.TEST],
},
decimals: 9,
type: RuntimeTypes.Oasis,
@@ -100,6 +100,7 @@ const sapphireConfig: LayerConfig = {
// See max_batch_gas https://github.com/oasisprotocol/sapphire-paratime/blob/main/runtime/src/lib.rs#L166
blockGasLimit: 15_000_000,
runtimeId: '000000000000000000000000000000000000000000000000f80306c9858e7279',
+ tokens: [NativeToken.ROSE],
},
testnet: {
activeNodes: 21,
@@ -107,14 +108,8 @@ const sapphireConfig: LayerConfig = {
// See max_batch_gas https://github.com/oasisprotocol/sapphire-paratime/blob/main/runtime/src/lib.rs#L166
blockGasLimit: 15_000_000,
runtimeId: '000000000000000000000000000000000000000000000000a6d1e3ebf60dff6c',
+ tokens: [NativeToken.TEST],
},
- local: {
- activeNodes: undefined,
- address: undefined,
- blockGasLimit: undefined,
- runtimeId: undefined,
- },
-
decimals: 18,
type: RuntimeTypes.Evm,
}
@@ -125,23 +120,16 @@ const pontusxConfig: LayerConfig = {
address: undefined,
blockGasLimit: undefined,
runtimeId: undefined,
+ tokens: [NativeToken.EUROe],
},
testnet: {
activeNodes: 1,
address: 'oasis1qr02702pr8ecjuff2z3es254pw9xl6z2yg9qcc6c',
blockGasLimit: 15_000_000,
runtimeId: '0000000000000000000000000000000000000000000000004febe52eb412b421',
- // Kindly note, the sequence is important as src/app/utils/rpc-utils.ts will utilize the first token.
tokens: [NativeToken.EUROe, NativeToken.TEST],
fiatCurrency: 'eur',
},
- local: {
- activeNodes: undefined,
- address: undefined,
- blockGasLimit: undefined,
- runtimeId: undefined,
- },
-
decimals: 18,
type: RuntimeTypes.Evm,
}
@@ -181,13 +169,12 @@ export const getTokensForScope = (scope: SearchScope | undefined): NativeTokenIn
if (!scope) {
return []
}
- const { network, layer } = scope
- const networkDefault = getTokenForNetwork(network)
- if (layer !== Layer.consensus) {
- return paraTimesConfig[layer][network].tokens ?? [networkDefault]
+ if (scope.layer !== Layer.consensus) {
+ return paraTimesConfig[scope.layer][scope.network].tokens
+ } else {
+ return consensusConfig[scope.network].tokens
}
- return [networkDefault]
}
export const getFiatCurrencyForScope = (scope: SearchScope | undefined) =>
diff --git a/src/types/ticker.ts b/src/types/ticker.ts
index 047d5d888..d9cc66d85 100644
--- a/src/types/ticker.ts
+++ b/src/types/ticker.ts
@@ -1,4 +1,3 @@
-import { Network } from './network'
import { TFunction } from 'i18next'
export type Ticker = (typeof Ticker)[keyof typeof Ticker]
@@ -31,13 +30,6 @@ export const NativeToken = {
},
} as const
-export const networkToken: Record = {
- [Network.mainnet]: NativeToken.ROSE,
- [Network.testnet]: NativeToken.TEST,
-}
-
-export const getTokenForNetwork = (network: Network): NativeTokenInfo => networkToken[network]
-
export const getNameForTicker = (_t: TFunction, ticker: string): string => {
// TODO: how do we translate ticker names?
return ticker