Sway-libs/nft library

Who has experience with the sway-libs/nft library?
`https://github.com/FuelLabs/sway-libs/blob/master/libs/nft/SPECIFICATION.md#overview
I don’t understand the syntax of the functions.

3 Likes

What don’t you understand exactly?

1 Like

I get the following errors in function types

My code :

      let token_id = 1;
      mint(buyer, token_id);
      transfer(buyer, token_id);

My mistakes

146 |         let token_id = 1;
147 |         mint(buyer, token_id);
    |              ^^^^^ Mismatched types.
expected: u64
found:    Address.
help: The argument that has been provided to this function's type does not match the declared type of the parameter in the function declaration.
148 |         transfer(buyer, token_id);
    |
____

error
   --> /Users/master/fuel/saprana/src/main.sw:147:21
    |
145 |
146 |         let token_id = 1;
147 |         mint(buyer, token_id);
    |                     ^^^^^^^^ Mismatched types.
expected: Identity
found:    u64.
help: The argument that has been provided to this function's type does not match the declared type of the parameter in the function declaration.
148 |         transfer(buyer, token_id);
    |
____

error
   --> /Users/master/fuel/saprana/src/main.sw:148:18
    |
146 |
147 |         mint(buyer, token_id);
148 |         transfer(buyer, token_id);
    |                  ^^^^^ Mismatched types.
expected: Identity
found:    Address.
help: The argument that has been provided to this function's type does not match the declared type of the parameter in the function declaration.
3 Likes

Hey @PaulZhemanov looks like the function signature of mint should be mint(amount: u64, to: Identity). Take a look at this file instead for NFT pointers and the associated tests for it. Going to ask about the docs for you though.

1 Like

It’s weird. this repository has completely different types…

Thanks!

The current version of this library is extremely outdated and will be promptly upgraded to incorporate the new multi-asset implementation, ensuring compatibility with the latest token standard. You can follow that here

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.