-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
export * from "./call.ts"; | ||
export * from "./decodeContractExecResult.ts"; | ||
export * from "./decodeError.ts"; | ||
export * from "./toContractAbiMessage.ts"; | ||
export * from "./toRegistryErrorDecoded.ts"; | ||
export * from "./toStatusName.ts"; |
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.
maybe we need a .prettierrc
to avoid inconsistent auto-save?
cc @DoubleOTheven
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.
@nicolad You can set Deno as the formatter. It can format on save too.
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.
the denoland vscode plugin works well
|
||
export const toStatusName = ( | ||
status: ExtrinsicStatus | SubmittableResult | undefined, | ||
i18n: I18n = defaultI18n |
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.
This is a good exploration. I created that issue because this is a common task that could be made easier, or we could come up with better patterns to DRY up code.
- We want to be able to use string interpolation too.
- We also do not want to introduce a brand new system for handling translations. i18n-next,
react-intl
, etc already exist. Is there a way we can make them easier to use withuseink
? ( I don't know the answer to that yet).
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.
Here is a Dapp using translations. I don't think there are examples of interpolation in there, but maybe those libraries are enough and we should not worry about it for useink
. I'm curious to hear your thoughts
SubmittableResult, | ||
} from "@polkadot/types/interfaces"; | ||
|
||
type I18n = { [key: string]: string }; |
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.
key: should be typed to NotificationType
instead of any string.
I'm closing this PR for now. A lot has changed for V 1.0.0. We should re-evaluate what features we want here |
Thanks for explanations, @DoubleOTheven |
Resolves #30
Description
This PR adds a new helper function called toStatusName to easily display customized messages for a contract transaction. The function accepts a transaction object and an optional i18n object to allow for customizable messages and 18n support.