Skip to content
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

feat: icrc map token metadata to record #798

Merged
merged 4 commits into from
Dec 23, 2024
Merged

Conversation

peterpeterparker
Copy link
Member

Motivation

I've been implementing the same mapper repeatedly, and today I needed it in another library (the oisy-wallet-signer). Instead of reimplementing it again, I added a utility to the ledger-icrc library to map the token metadata information from a ledger response provided in form of Candid arrays into a structured record.

Changes

  • Add utility mapTokenMetadata.

Copy link
Contributor

github-actions bot commented Dec 23, 2024

size-limit report 📦

Path Size
@dfinity/ckbtc 8.11 KB (0%)
@dfinity/cketh 3.68 KB (0%)
@dfinity/cmc 1.41 KB (0%)
@dfinity/ledger-icrc 4.33 KB (+3.38% 🔺)
@dfinity/ledger-icp 15.43 KB (0%)
@dfinity/nns 37.02 KB (0%)
@dfinity/nns-proto 140.98 KB (0%)
@dfinity/sns 16.98 KB (0%)
@dfinity/utils 4.67 KB (0%)
@dfinity/ic-management 3.19 KB (0%)

Copy link

@AntonioVentilii AntonioVentilii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tks!! Small question attached

@peterpeterparker peterpeterparker merged commit 73a6c8a into main Dec 23, 2024
12 checks passed
@peterpeterparker peterpeterparker deleted the feat/icrc-map-token branch December 23, 2024 10:14
peterpeterparker added a commit to dfinity/oisy-wallet that referenced this pull request Dec 23, 2024
# Motivation

The `@dfinity/ledger-icrc` now implements a function `mapTokenMetadata`
which is equals to our `mapOptionalToken` function (it was copied from
there, see PR [#798](dfinity/ic-js#798)),
therefore we can use this utility.

# Notes

Maybe I should have marked the type of the function as generic in ic-js
since we basically duplicates the same type with zod but TypeScript is
able to understand both types are equals it seems.

# Changes

- Replace function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants