import { providers } from 'ethers'; import BaseService from '../commons/BaseService'; import { eEthereumTxType, EthereumTransactionTypeExtended, transactionType, } from '../commons/types'; import { NTokenMoonBirds } from './typechain/NTokenMoonBirds'; import { NTokenMoonBirds__factory } from './typechain/NTokenMoonBirds__factory'; export class NTokenMoonbirds extends BaseService { contractAddress: string; constructor(provider: providers.Provider, address: string) { super(provider, NTokenMoonBirds__factory); this.contractAddress = address; } public async getNestingPeriod(tokenId: string) { const contract = this.getContractInstance(this.contractAddress); return contract.nestingPeriod(tokenId); } public toggleNesting( tokenIds: string[], onBehalfOf: string, ): EthereumTransactionTypeExtended { const contract = this.getContractInstance(this.contractAddress); const txCallback: () => Promise = this.generateTxCallback({ rawTxMethod: async () => contract.populateTransaction.toggleNesting(tokenIds), from: onBehalfOf, }); return { tx: txCallback, txType: eEthereumTxType.DLP_ACTION, gas: this.generateTxPriceEstimation([], txCallback), }; } }