UNPKG

@evolutionland/evolution-js

Version:

evolution evolution-js evolutionland evolution-js-sdk evolution-land metaverse

162 lines (130 loc) 10.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>drill/v1.ts - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav > <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#apostleAllowanceToClockAuction">apostleAllowanceToClockAuction</a></li><li><a href="global.html#apostleAskWithToken">apostleAskWithToken</a></li><li><a href="global.html#apostleBidWithToken">apostleBidWithToken</a></li><li><a href="global.html#apostleBorn">apostleBorn</a></li><li><a href="global.html#apostleBornAndEnhance">apostleBornAndEnhance</a></li><li><a href="global.html#apostleBreed">apostleBreed</a></li><li><a href="global.html#apostleBreedAsk">apostleBreedAsk</a></li><li><a href="global.html#apostleBreedBid">apostleBreedBid</a></li><li><a href="global.html#apostleCancelAskWithToken">apostleCancelAskWithToken</a></li><li><a href="global.html#apostleCancelBreedAsk">apostleCancelBreedAsk</a></li><li><a href="global.html#apostleCancelHire">apostleCancelHire</a></li><li><a href="global.html#apostleClaim">apostleClaim</a></li><li><a href="global.html#apostleClaimHire">apostleClaimHire</a></li><li><a href="global.html#apostleGetAutoBreedFee">apostleGetAutoBreedFee</a></li><li><a href="global.html#apostleGetCurrentPriceByTokenId">apostleGetCurrentPriceByTokenId</a></li><li><a href="global.html#apostleGetCurrentSiringPriceByTokenId">apostleGetCurrentSiringPriceByTokenId</a></li><li><a href="global.html#apostleHire">apostleHire</a></li><li><a href="global.html#apostleHireBid">apostleHireBid</a></li><li><a href="global.html#apostleStopWork">apostleStopWork</a></li><li><a href="global.html#apostleTransfer">apostleTransfer</a></li><li><a href="global.html#apostleWork">apostleWork</a></li><li><a href="global.html#drillStopWork">drillStopWork</a></li><li><a href="global.html#drillTransfer">drillTransfer</a></li><li><a href="global.html#drillWork">drillWork</a></li><li><a href="global.html#equipmentTransfer">equipmentTransfer</a></li><li><a href="global.html#equipmentUnequip">equipmentUnequip</a></li><li><a href="global.html#erc20Allowance">erc20Allowance</a></li><li><a href="global.html#erc20AllowanceByContractAddress">erc20AllowanceByContractAddress</a></li><li><a href="global.html#erc20Approve">erc20Approve</a></li><li><a href="global.html#erc20ApproveByContractAddress">erc20ApproveByContractAddress</a></li><li><a href="global.html#erc20BalanceOf">erc20BalanceOf</a></li><li><a href="global.html#erc20TotalSupply">erc20TotalSupply</a></li><li><a href="global.html#erc20TransferByContractAddress">erc20TransferByContractAddress</a></li><li><a href="global.html#erc721IsApprovedForAll">erc721IsApprovedForAll</a></li><li><a href="global.html#erc721IsApprovedOrOwner">erc721IsApprovedOrOwner</a></li><li><a href="global.html#erc721OwnerOf">erc721OwnerOf</a></li><li><a href="global.html#erc721SetApprovalForAll">erc721SetApprovalForAll</a></li><li><a href="global.html#erc1155BalanceOf">erc1155BalanceOf</a></li><li><a href="global.html#erc1155BalanceOfBatch">erc1155BalanceOfBatch</a></li><li><a href="global.html#erc1155IsApprovedForAll">erc1155IsApprovedForAll</a></li><li><a href="global.html#erc1155SafeBatchTransferFrom">erc1155SafeBatchTransferFrom</a></li><li><a href="global.html#erc1155SetApprovalForAll">erc1155SetApprovalForAll</a></li><li><a href="global.html#farmGetStakerAddress">farmGetStakerAddress</a></li><li><a href="global.html#farmGetStakerBalanceOf">farmGetStakerBalanceOf</a></li><li><a href="global.html#farmGetStakerEarned">farmGetStakerEarned</a></li><li><a href="global.html#farmGetStakerExit">farmGetStakerExit</a></li><li><a href="global.html#farmGetStakerGetReward">farmGetStakerGetReward</a></li><li><a href="global.html#farmGetStakerStakeToken">farmGetStakerStakeToken</a></li><li><a href="global.html#farmGetStakerTotalSupply">farmGetStakerTotalSupply</a></li><li><a href="global.html#farmStakerWithdraw">farmStakerWithdraw</a></li><li><a href="global.html#furnaceBuyTreasure">furnaceBuyTreasure</a></li><li><a href="global.html#furnaceDisenchantProps">furnaceDisenchantProps</a></li><li><a href="global.html#furnaceDismantleEquipment">furnaceDismantleEquipment</a></li><li><a href="global.html#furnaceEnchantEquipment">furnaceEnchantEquipment</a></li><li><a href="global.html#furnaceEnchantProps">furnaceEnchantProps</a></li><li><a href="global.html#furnaceGetTreasurePrice">furnaceGetTreasurePrice</a></li><li><a href="global.html#furnaceGetTreasureStatus">furnaceGetTreasureStatus</a></li><li><a href="global.html#furnaceOpenTreasure">furnaceOpenTreasure</a></li><li><a href="global.html#goldRushRaffleChangeAmount">goldRushRaffleChangeAmount</a></li><li><a href="global.html#goldRushRaffleChangeInfo">goldRushRaffleChangeInfo</a></li><li><a href="global.html#goldRushRaffleChangeSubAddr">goldRushRaffleChangeSubAddr</a></li><li><a href="global.html#goldRushRaffleDraw">goldRushRaffleDraw</a></li><li><a href="global.html#goldRushRaffleExit">goldRushRaffleExit</a></li><li><a href="global.html#goldRushRaffleGetHistory">goldRushRaffleGetHistory</a></li><li><a href="global.html#goldRushRaffleJoin">goldRushRaffleJoin</a></li><li><a href="global.html#landAskWithToken">landAskWithToken</a></li><li><a href="global.html#landBatchClaimItemResource">landBatchClaimItemResource</a></li><li><a href="global.html#landBatchClaimLandResource">landBatchClaimLandResource</a></li><li><a href="global.html#landBidWithToken">landBidWithToken</a></li><li><a href="global.html#landCancelAskWithToken">landCancelAskWithToken</a></li><li><a href="global.html#landClaimItemResource">landClaimItemResource</a></li><li><a href="global.html#landClaimLand">landClaimLand</a></li><li><a href="global.html#landGetAvailableItemResources">landGetAvailableItemResources</a></li><li><a href="global.html#landGetAvailableResources">landGetAvailableResources</a></li><li><a href="global.html#landGetCurrentPriceByTokenId">landGetCurrentPriceByTokenId</a></li><li><a href="global.html#landTransfer">landTransfer</a></li><li><a href="global.html#lotteryGetPointsBalance">lotteryGetPointsBalance</a></li><li><a href="global.html#lotteryGetTotalRewardInPool">lotteryGetTotalRewardInPool</a></li><li><a href="global.html#lotteryPlayWithTicket">lotteryPlayWithTicket</a></li><li><a href="global.html#materialBalanceOfBatch">materialBalanceOfBatch</a></li><li><a href="global.html#materialBatchTransfer">materialBatchTransfer</a></li><li><a href="global.html#materialIdEncode">materialIdEncode</a></li><li><a href="global.html#pveTeamAt">pveTeamAt</a></li><li><a href="global.html#pveTeamEvict">pveTeamEvict</a></li><li><a href="global.html#pveTeamExist">pveTeamExist</a></li><li><a href="global.html#pveTeamExit">pveTeamExit</a></li><li><a href="global.html#pveTeamExits">pveTeamExits</a></li><li><a href="global.html#pveTeamJoin">pveTeamJoin</a></li><li><a href="global.html#pveTeamJoins">pveTeamJoins</a></li><li><a href="global.html#pveTeamSwap">pveTeamSwap</a></li><li><a href="global.html#uniswapBuyRING">uniswapBuyRING</a></li></ul> </nav> <div id="main"> <h1 class="page-title">drill/v1.ts</h1> <section> <article> <pre class="prettyprint source linenums"><code>import { ethers } from "ethers"; import { pad0xBegin } from "@evo/utils/common/utils"; import { triggerContractByContractName } from "@evo/utils/ethers/contractHelper"; import type { CallbackType } from "@evo/utils/ethers/contractHelper"; import { LandId } from "@evo/config/constants"; import { TransactionResponse } from "@ethersproject/providers"; /** * Transfer Drill * @param landId Land Id * @param signer Signer * @param from Drill owner * @param to Recipient * @param tokenId Drill tokenId * @param callback Callback * @returns any */ export const drillTransfer = ( landId: LandId, signer: ethers.Signer, from: string, to: string, tokenId: string, callback?: CallbackType ): Promise&lt;TransactionResponse> => { return triggerContractByContractName( landId, signer, "objectOwnership", "transferFrom", [from, to, pad0xBegin(tokenId)], callback ); }; /** * Divest the props on the index slot on the tokenid land * @param landId The tokenId of land * @param signer Signer * @param tokenId Drill tokenId * @param index The index slot * @param callback Callback * @returns any */ export const drillStopWork = ( landId: LandId, signer: ethers.Signer, tokenId: string, index: number, callback?: CallbackType ): Promise&lt;TransactionResponse> => { return triggerContractByContractName( landId, signer, "apostleLandResource", "divest", [pad0xBegin(tokenId), index], callback ); }; /** * Equip function, A NFT can equip to EVO Bar (LandBar or ApostleBar). * @param landId Land Id * @param signer Signer * @param landTokenId Land token Id which to be quiped * @param drillContractAddress Drill contract address * @param drillTokenId Props token address which to quip * @param resourceContractAddress Which resouce appply to * @param slotIndex Index of the Bar * @param callback Callback * @returns any */ export const drillWork = ( landId: LandId, signer: ethers.Signer, landTokenId: string, drillContractAddress: string, drillTokenId: string, resourceContractAddress: string, slotIndex: number, callback?: CallbackType ): Promise&lt;TransactionResponse> => { return triggerContractByContractName( landId, signer, "apostleLandResource", "equip", [pad0xBegin(landTokenId), resourceContractAddress, slotIndex, drillContractAddress, pad0xBegin(drillTokenId)], callback ); }; </code></pre> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Aug 15 2022 13:54:57 GMT+0800 (China Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>