UNPKG

@hashgraph/sdk

Version:
3 lines (2 loc) 3.02 kB
import t,{QUERY_REGISTRY as e}from"../query/Query.js";import n from"./NftId.js";import o from"../account/AccountId.js";import r from"./TokenId.js";import s from"./TokenNftInfo.js";import"bignumber.js";import"../HbarUnit.js";import f from"long";class u extends t{constructor(t={}){super(),this._nftId=null,null!=t.nftId&&this.setNftId(t.nftId),this._accountId=null,null!=t.accountId&&this.setAccountId(t.accountId),this._tokenId=null,null!=t.tokenId&&this.setTokenId(t.tokenId),this._start=null,null!=t.start&&this.setStart(t.start),this._end=null,null!=t.end&&this.setEnd(t.end)}static _fromProtobuf(t){if(null!=t.tokenGetNftInfo){const e=t.tokenGetNftInfo;return new u({nftId:null!=e.nftID?n._fromProtobuf(e.nftID):void 0})}if(null!=t.tokenGetAccountNftInfos){const e=t.tokenGetAccountNftInfos;return new u({accountId:null!=e.accountID?o._fromProtobuf(e.accountID):void 0,start:null!=e.start?e.start:void 0,end:null!=e.end?e.end:void 0})}{const e=t.tokenGetNftInfos;return new u({tokenId:null!=e.tokenID?r._fromProtobuf(e.tokenID):void 0,start:null!=e.start?e.start:void 0,end:null!=e.end?e.end:void 0})}}get nftId(){return this._nftId}setNftId(t){return this._nftId="string"==typeof t?n.fromString(t):n._fromProtobuf(t._toProtobuf()),this}get accountId(){return console.warn("`TokenNftInfoQuery.accountId` is deprecated with no replacement"),this._accountId}setAccountId(t){return console.warn("`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement"),this._accountId="string"==typeof t?o.fromString(t):o._fromProtobuf(t._toProtobuf()),this}get tokenId(){return console.warn("`TokenNftInfoQuery.tokenId` is deprecated with no replacement"),this._tokenId}setTokenId(t){return console.warn("`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement"),this._tokenId="string"==typeof t?r.fromString(t):r._fromProtobuf(t._toProtobuf()),this}get start(){return console.warn("`TokenNftInfoQuery.start` is deprecated with no replacement"),this._start}setStart(t){return console.warn("`TokenNftInfoQuery.setStart()` is deprecated with no replacement"),this._start="number"==typeof t?f.fromNumber(t):t,this}get end(){return console.warn("`TokenNftInfoQuery.end` is deprecated with no replacement"),this._end}setEnd(t){return console.warn("`TokenNftInfoQuery.setEnd()` is deprecated with no replacement"),this._end="number"==typeof t?f.fromNumber(t):t,this}async getCost(t){return super.getCost(t)}_execute(t,e){return t.token.getTokenNftInfo(e)}_mapResponseHeader(t){return t.tokenGetNftInfo.header}_mapResponse(t,e,n){const o=[t.tokenGetNftInfo.nft];return Promise.resolve(o.map(t=>s._fromProtobuf(t)))}_onMakeRequest(t){return{tokenGetNftInfo:{header:t,nftID:null!=this._nftId?this._nftId._toProtobuf():null}}}_getLogId(){return`TokenNftInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}e.set("tokenGetNftInfo",u._fromProtobuf);export{u as default}; //# sourceMappingURL=TokenNftInfoQuery.js.map