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: textual encoding for ICRC-1 account #98

Merged
merged 12 commits into from
May 29, 2023

Conversation

roman-kashitsyn
Copy link
Contributor

This change proposes a textual encoding for ICRC-1 accounts.

github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Apr 18, 2023
# Motivation

Bump ic-js to implement what might be the definitive textual encoding
for ICRC-1 account.

Source of encoding 👉 dfinity/ICRC-1#98

# PRs

- [x] dfinity/ic-js#308

# Changes

- bump ic-js
- test: fix mock data from / to that were incorrectly set
- test: use object param to avoid from / to to be incorrectly set in the
future
- test: partial mock subaccount array isn't supported anymore to
encode/decode ICRC account as the decoded checks the validity of the
checksum
github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Apr 18, 2023
# Motivation

Bump ic-js to implement what might be the definitive textual encoding
for ICRC-1 account.

Source of encoding 👉 dfinity/ICRC-1#98

# PRs

- [x] dfinity/ic-js#308

# Changes

- bump ic-js
- test: fix mock data from / to that were incorrectly set
- test: use object param to avoid from / to to be incorrectly set in the
future
- test: partial mock subaccount array isn't supported anymore to
encode/decode ICRC account as the decoded checks the validity of the
checksum
github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Apr 18, 2023
# Motivation

Bump ic-js to implement what might be the definitive textual encoding
for ICRC-1 account.

Source of encoding 👉 dfinity/ICRC-1#98

# PRs

- [x] dfinity/ic-js#308

# Changes

- bump ic-js
- test: fix mock data from / to that were incorrectly set
- test: use object param to avoid from / to to be incorrectly set in the
future
- test: partial mock subaccount array isn't supported anymore to
encode/decode ICRC account as the decoded checks the validity of the
checksum
github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Apr 18, 2023
# Motivation

Bump ic-js to implement what might be the definitive textual encoding
for ICRC-1 account.

Source of encoding 👉 dfinity/ICRC-1#98

# PRs

- [x] dfinity/ic-js#308

# Changes

- bump ic-js
- test: fix mock data from / to that were incorrectly set
- test: use object param to avoid from / to to be incorrectly set in the
future
- test: partial mock subaccount array isn't supported anymore to
encode/decode ICRC account as the decoded checks the validity of the
checksum
@letmejustputthishere
Copy link
Member

can we provide this as a https://mops.one package?

@roman-kashitsyn
Copy link
Contributor Author

can we provide this as a https://mops.one package?

I fear only after mops.one implements team ownership for packages (ideally, but not necessarily, using GitHub groups).
I don't think a single identity should own such packages.

@skilesare
Copy link

This might be helpful since motoko is wishy washy with blob an [nat8]

public type BytesAccount = { owner : Principal; subaccount : ?[Nat8] };

public func fromBytesAccount(item: BytesAccount) : Account{
    {
      item with
      subaccount = switch(item.subaccount){
        case(null) null;
        case(?val) ?Blob.fromArray(val);
      };
    };
  };

@roman-kashitsyn roman-kashitsyn merged commit 599ea75 into main May 29, 2023
@roman-kashitsyn roman-kashitsyn deleted the roman-textual-encoding branch May 29, 2023 20:59
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.

5 participants