1
import { context, u128, storage, logging, PersistentUnorderedMap } from "near-sdk-as";
@nearBindgen
export class MyItem{
  id: u64;
  type: u32;
  price: u128; // This is causing the deserialization error
}

When including this fragment of code in my smart contract, compiling, deploying to testnet and calling any method on it, I receive: "Error happened while deserializing the module"

When I change price:u128 to price:u64, it all starts to work, no more error.

What is the best way to represent monetary value of something (for example NFT) in a smart contract model? Is u128 the wrong type? If I should use some other type - how do I convert it to u128 before transferring it?

sgraphics
  • 61
  • 4

0 Answers0