🔑
New Bitcoin City Developers
  • Keys API
    • Get Top Key Holders
    • Search Key Holders
    • Track New Key Holders
    • Get Trade History Data
    • Get Trade History by Address
    • Get Chart Key by Address
    • Get Chart Token by Address
    • Get List Token Balance by Address
    • Get User Profile
    • Get Tweet Like Retweet
    • Get Number Tweet Post Comment
    • Get List Bull Bear (Mr Market)
    • Get Bull Bear Detail
    • Get List Raffle
    • Get Raffle Detail
    • Get List Spin Wheel
    • Get Spin Wheel Detail
  • Keys Contract Interaction
    • Get Keys Holding by User
    • Get Buying Price
    • Get Selling Price
    • Buy Key
    • Sell Key
    • Estimate Swap Key
    • Execute Swap Key
    • Multicall
    • Staking Open
    • Staking Close
    • Staking Order Create
    • Staking Order Close
  • PlaceHolder Chrome Extension
  • Prompts
  • Demo site
    • Demo
Powered by GitBook
On this page
  • Contract function
  • Contract address
  • Parameters
  • Sample code
  1. Keys Contract Interaction

Buy Key

Buy keys for a specific amount.

Contract function

buyKeysV2ByToken

Contract address

0x9b727dcaC7b331f95786D3b01fA79191Ab527DA3

Parameters

token: key contract address 
amountX18: amount of key buy

Sample code

 const { write: executeBuy, isLoading: buyLoading } = useContractWrite({
    address: FACTORY_CONTRACT_ADDRESS,
    abi: TOKEN_ABI,
    functionName: "buyKeysV2ByToken",
    args: [user.tokenaddress, buy*1e18,buyPrice],
  });
PreviousGet Selling PriceNextSell Key

Last updated 1 year ago