@hashgraph/sdk
Version:
3 lines (2 loc) • 1.38 kB
JavaScript
import t from"./NftId.js";import e from"../account/AccountId.js";import r from"../Timestamp.js";import{encode as o}from"../encoding/hex.js";import d from"../LedgerId.js";class n{constructor(t){this.nftId=t.nftId,this.accountId=t.accountId,this.creationTime=t.creationTime,this.metadata=t.metadata,this.ledgerId=t.ledgerId,this.spenderId=t.spenderId,Object.freeze(this)}static _fromProtobuf(o){return new n({nftId:t._fromProtobuf(o.nftID),accountId:e._fromProtobuf(o.accountID),creationTime:r._fromProtobuf(o.creationTime),metadata:void 0!==o.metadata?o.metadata:null,ledgerId:null!=o.ledgerId?d.fromBytes(o.ledgerId):null,spenderId:null!=o.spenderId?e._fromProtobuf(o.spenderId):null})}_toProtobuf(){return{nftID:this.nftId._toProtobuf(),accountID:this.accountId._toProtobuf(),creationTime:this.creationTime._toProtobuf(),metadata:this.metadata,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,spenderId:null!=this.spenderId?this.spenderId._toProtobuf():null}}toJson(){return{nftId:this.nftId.toString(),accountId:this.accountId.toString(),creationTime:this.creationTime.toString(),metadata:null!=this.metadata?o(this.metadata):null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,spenderId:null!=this.spenderId?this.spenderId.toString():null}}toString(){return JSON.stringify(this.toJson())}}export{n as default};
//# sourceMappingURL=TokenNftInfo.js.map