-
Notifications
You must be signed in to change notification settings - Fork 162
feat: add /transaction/metadata-blob endpoint
#1886
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
Conversation
| // Dynamic import helper that TypeScript won't transform to require() | ||
| // This is necessary because @polkadot-api/merkleize-metadata is an ESM-only package | ||
| // eslint-disable-next-line @typescript-eslint/no-implied-eval | ||
| const dynamicImport = new Function('specifier', 'return import(specifier)') as <T>(specifier: string) => Promise<T>; |
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.
Interesting work around. In order to not mess with the bundler, I am okay with this.
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.
Yeah, it's taken from here with a few mods https://stackoverflow.com/questions/65265420/how-to-prevent-typescript-from-transpiling-dynamic-imports-into-require
src/controllers/transaction/TransactionMetadataBlobController.ts
Outdated
Show resolved
Hide resolved
TarikGul
left a comment
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.
Great job 👍
This adds an endpoint that returns the metadata blob for offline signers. It uses
@polkadot-ap/merkleize-metadatato generate the blob and proof for a tx.The dynamic imports changes were necessary since the latest versions of
@polkadot-ap/merkleize-metadatause@scure/base@^2.0.0, which is ESM-only.Pending:
Closes #1783