@hashgraph/sdk
Version:
3 lines (2 loc) • 1.23 kB
JavaScript
import o from"../token/TokenId.js";import t from"./AccountId.js";import n from"long";import{convertAmountToLong as e}from"../util.js";class u{constructor(o){this.tokenId=o.tokenId,this.spenderAccountId=o.spenderAccountId,this.ownerAccountId=o.ownerAccountId,this.amount=null!=o.amount?e(o.amount):null,Object.freeze(this)}static _fromProtobuf(e){return new u({tokenId:o._fromProtobuf(e.tokenId),spenderAccountId:t._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?t._fromProtobuf(e.owner):null,amount:null!=e.amount?n.fromValue(e.amount):null})}static _fromGrantedProtobuf(e,r){return new u({tokenId:o._fromProtobuf(e.tokenId),spenderAccountId:t._fromProtobuf(e.spender),ownerAccountId:r,amount:null!=e.amount?n.fromValue(e.amount):null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,amount:this.amount}}_validateChecksums(o){this.tokenId.validateChecksum(o),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(o),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(o)}}export{u as default};
//# sourceMappingURL=TokenAllowance.js.map