@hashgraph/sdk
Version:
3 lines (2 loc) • 1.15 kB
JavaScript
import o from"../token/TokenId.js";import t from"./AccountId.js";import n from"long";class e{constructor(o){this.tokenId=o.tokenId,this.spenderAccountId=o.spenderAccountId,this.ownerAccountId=o.ownerAccountId,this.amount=o.amount,Object.freeze(this)}static _fromProtobuf(u){return new e({tokenId:o._fromProtobuf(u.tokenId),spenderAccountId:t._fromProtobuf(u.spender),ownerAccountId:null!=u.owner?t._fromProtobuf(u.owner):null,amount:null!=u.amount?n.fromValue(u.amount):null})}static _fromGrantedProtobuf(u,r){return new e({tokenId:o._fromProtobuf(u.tokenId),spenderAccountId:t._fromProtobuf(u.spender),ownerAccountId:r,amount:null!=u.amount?n.fromValue(u.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{e as default};
//# sourceMappingURL=TokenAllowance.js.map