feat: expose ledger-icp converters #716
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The ICRC signer standards require developers to pass the payload as a Candid
Uint8Array
. Such an array can be generated using@dfinity/candid
which I find it somewhat cumbersome to use when you are not used to it. Moreover, the IDL declarations required for this conversion are not currently exposed by the types generated by Candid and didc, which means that each developer has to manually copy the data. Long story short, it's not the best DX.That's why, in our implementation of the Oisy standard, we discussed providing an opinionated client library that can be used to interact with Oisy, or wallet.
Given that most JavaScript developers are likely more familiar with using the types exposed by ic-js to interact with well-known canisters of the Internet Computer (IC), such as ledgers, rather than those generated by Candid, this PR aims to expose the "converters" of
ledger-icp
to allow the client library to obfuscate this complexity.In short, this Oisy client library needs to be able to transform IC-js types into Candid types the same way ic-js do. Therefore, to avoid code duplication, this PR exposes the converters.
Notes
Oisy signer lib is currently not open source as in development and not yet reviewed by security but, happy to jump in a call to share more details if anything is unclear.
Changes
@dfinity/ledger-icp
converters