Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

How to access result of Trie.get() #85

Answered by samlinux
samlinux asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for your response, but at the end I found this solution:

switch(oldNftItem) {
      case (null) {};
      case (?Nft) {
          if (exists) { 
            var _oldNftItem : Nft = Option.get(oldNftItem, Nft);
            var newNftItem : Nft = {
              tokenId = _oldNftItem.tokenId;
              principal = newPrincipal;
              url = _oldNftItem.url;
              creator = _oldNftItem.principal;
            };

            nftBelogsTo := Trie.replace(
              nftBelogsTo,
              key(nftId),
              Nat32.equal,
              ?newNftItem,
            ).0;
          };
      }; 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by professionalGithub99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants