-
Notifications
You must be signed in to change notification settings - Fork 103
feat: remove hardcoded base token dependencies from the app #8160
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
Changes from 1 commit
66e2c32
ba84d75
af26deb
dad031b
f0106bb
a65e832
0fed75e
f7ca246
b6d9193
954c85b
fe3fb2e
85fdce6
465ee97
d3bb6ae
0267ccf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,37 @@ | ||
import { COIN_TYPE, DEFAULT_BASE_TOKEN } from '../constants' | ||
import { NetworkId, TokenSupply } from '../enums' | ||
import { COIN_TYPE } from '../constants' | ||
import { NetworkId } from '../enums' | ||
import { IStardustNetworkMetadata } from '../interfaces' | ||
import { NetworkMetadata } from '../types' | ||
import { nodeInfoBaseToken, nodeInfoProtocol } from '../stores/node-info.store' | ||
import { get } from 'svelte/store' | ||
|
||
export const DEFAULT_NETWORK_METADATA: Readonly<{ [key in NetworkId]?: NetworkMetadata }> = { | ||
[NetworkId.Shimmer]: <IStardustNetworkMetadata>{ | ||
id: NetworkId.Shimmer, | ||
name: 'Shimmer', | ||
coinType: COIN_TYPE[NetworkId.Shimmer], | ||
protocol: { | ||
version: 2, | ||
networkName: 'shimmer', | ||
bech32Hrp: 'smr', | ||
minPowScore: 1500, | ||
belowMaxDepth: 15, | ||
rentStructure: { | ||
vByteCost: 100, | ||
vByteFactorData: 1, | ||
vByteFactorKey: 10, | ||
}, | ||
tokenSupply: TokenSupply.Shimmer, | ||
}, | ||
baseToken: DEFAULT_BASE_TOKEN[NetworkId.Shimmer], | ||
protocol: get(nodeInfoProtocol), | ||
baseToken: get(nodeInfoBaseToken), | ||
}, | ||
[NetworkId.Testnet]: <IStardustNetworkMetadata>{ | ||
id: NetworkId.Testnet, | ||
name: 'Testnet', | ||
coinType: COIN_TYPE[NetworkId.Testnet], | ||
protocol: { | ||
version: 2, | ||
networkName: 'testnet', | ||
bech32Hrp: 'rms', | ||
minPowScore: 1500, | ||
belowMaxDepth: 15, | ||
rentStructure: { | ||
vByteCost: 100, | ||
vByteFactorData: 1, | ||
vByteFactorKey: 10, | ||
}, | ||
tokenSupply: TokenSupply.Testnet, | ||
}, | ||
baseToken: DEFAULT_BASE_TOKEN[NetworkId.Testnet], | ||
protocol: get(nodeInfoProtocol), | ||
baseToken: get(nodeInfoBaseToken), | ||
}, | ||
[NetworkId.Iota]: <IStardustNetworkMetadata>{ | ||
id: NetworkId.Iota, | ||
name: 'IOTA', | ||
coinType: COIN_TYPE[NetworkId.Iota], | ||
protocol: { | ||
version: 2, | ||
networkName: 'iota', | ||
bech32Hrp: 'iota', | ||
minPowScore: 1500, | ||
belowMaxDepth: 15, | ||
rentStructure: { | ||
vByteCost: 250, | ||
vByteFactorData: 1, | ||
vByteFactorKey: 10, | ||
}, | ||
tokenSupply: TokenSupply.Iota, | ||
}, | ||
baseToken: DEFAULT_BASE_TOKEN[NetworkId.Iota], | ||
protocol: get(nodeInfoProtocol), | ||
baseToken: get(nodeInfoBaseToken), | ||
}, | ||
[NetworkId.IotaAlphanet]: <IStardustNetworkMetadata>{ | ||
id: NetworkId.IotaAlphanet, | ||
name: 'IOTA Alphanet', | ||
coinType: COIN_TYPE[NetworkId.IotaAlphanet], | ||
protocol: { | ||
version: 2, | ||
networkName: 'iota-alphanet-2', | ||
bech32Hrp: 'atoi', | ||
minPowScore: 1500, | ||
belowMaxDepth: 15, | ||
rentStructure: { | ||
vByteCost: 250, | ||
vByteFactorData: 1, | ||
vByteFactorKey: 10, | ||
}, | ||
tokenSupply: TokenSupply.Iota, | ||
}, | ||
baseToken: DEFAULT_BASE_TOKEN[NetworkId.IotaAlphanet], | ||
protocol: get(nodeInfoProtocol), | ||
baseToken: get(nodeInfoBaseToken), | ||
}, | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,8 +1,12 @@ | ||||
import { INodeInfo } from '@iota/sdk/out/types' | ||||
import { writable } from 'svelte/store' | ||||
import { writable, derived } from 'svelte/store' | ||||
|
||||
export const nodeInfo = writable<INodeInfo | undefined>(undefined) | ||||
|
||||
export function setNodeInfo(newNodeInfo: INodeInfo | undefined): void { | ||||
return nodeInfo.set(newNodeInfo) | ||||
} | ||||
|
||||
export const nodeInfoBaseToken = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.baseToken) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the point of this store? You don't seem to be reading it from any svelte file so all the reactivity features it comes with are effectively not used at all, thus it seems more appropiate to me to just read the |
||||
|
||||
export const nodeInfoProtocol = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.protocol) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not used
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
import { INodeInfoBaseToken } from '@iota/sdk/out/types' | ||
import { TokenStandard } from '../enums' | ||
|
||
export interface IBaseToken { | ||
export interface IBaseToken extends INodeInfoBaseToken { | ||
standard: TokenStandard.BaseToken | ||
name: string | ||
tickerSymbol?: string | ||
unit: string | ||
subunit?: string | null | ||
decimals: number | ||
useMetricPrefix?: boolean | ||
} |
Uh oh!
There was an error while loading. Please reload this page.