-
Notifications
You must be signed in to change notification settings - Fork 74
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
add new type in api - settings in order to support different types of… #476
add new type in api - settings in order to support different types of… #476
Conversation
… 'urls' - json-rpc and substrate-connect; This makes the previous used apiURL deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, I think the enum usage here is related to the fact that non-type import as are now used here. The polkadot-js codebase were cleared from all usage of these quite some time ago (18-25+ months now), they are really problematic when used in a library.
Merge master should fix the CI failures.
packages/ui-settings/src/Settings.ts
Outdated
import EventEmitter from 'eventemitter3'; | ||
import store from 'store'; | ||
|
||
import { isUndefined } from '@polkadot/util'; | ||
|
||
import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults'; | ||
import { Endpoint, EndpointType, Option, SettingsStruct } from './types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be import type
packages/ui-settings/src/index.ts
Outdated
@@ -2,10 +2,11 @@ | |||
// SPDX-License-Identifier: Apache-2.0 | |||
|
|||
import { Settings, settings } from './Settings'; | |||
import { Endpoint, EndpointType, JsonRpcEndpoint, SubstrateConnectEndpoint } from './types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type
(and move up to the correct place)
packages/ui-settings/src/index.ts
Outdated
|
||
export { ENDPOINT_DEFAULT, ICON_DEFAULT, ICON_DEFAULT_HOST, LANGUAGE_DEFAULT, LOCKING_DEFAULT, PREFIX_DEFAULT, UIMODE_DEFAULT, UITHEME_DEFAULT } from './defaults'; | ||
export { packageInfo } from './packageInfo'; | ||
|
||
export { settings, Settings }; | ||
export { settings, Settings, Endpoint, JsonRpcEndpoint, SubstrateConnectEndpoint, EndpointType }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the type exports here. (We always only have the types in /types.ts
)
packages/ui-settings/src/types.ts
Outdated
chain: string; | ||
} | ||
|
||
export enum EndpointType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the enum, it is hugely problematic (polkadot-js doesn't use these at all) -
- it creates a bunch of code to make this work in the transpiling phase
- it turns type-only imports into type & code imports (types files now contain actual JS logic)
This is sufficient: export type EndpointType = 'json-rpc' | 'substrate-connect';
Co-authored-by: Jaco <jacogr@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sane. Thank you.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
… inputs - 'json-rpc' and 'substrate-connect';
The new format will be:
or