@minatokens/api
Version:
MinaTokens API
294 lines (269 loc) • 13.6 kB
text/typescript
// This file is auto-generated by @hey-api/openapi-ts
import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch';
import type { LaunchTokenData, LaunchTokenError, LaunchTokenResponse, GetContractInfoData, GetContractInfoError, GetContractInfoResponse, GetNftV2InfoData, GetNftV2InfoError, GetNftV2InfoResponse, FaucetData, FaucetError, FaucetResponse2, GetTokenInfoData, GetTokenInfoError, GetTokenInfoResponse, GetTokenBalanceData, GetTokenBalanceError, GetTokenBalanceResponse, ProveData, ProveError, ProveResponse, GetProofData, GetProofError, GetProofResponse, TxStatusData, TxStatusError, TxStatusResponse, MintTokensData, MintTokensError, MintTokensResponse, TransferTokensData, TransferTokensError, TransferTokensResponse, AirdropTokensData, AirdropTokensError, AirdropTokensResponse, RedeemTokensData, RedeemTokensError, RedeemTokensResponse, BurnTokensData, BurnTokensError, BurnTokensResponse, TokenBidData, TokenBidError, TokenBidResponse, TokenOfferData, TokenOfferError, TokenOfferResponse, BuyTokensData, BuyTokensError, BuyTokensResponse, SellTokensData, SellTokensError, SellTokensResponse, WithdrawTokenBidData, WithdrawTokenBidError, WithdrawTokenBidResponse, WithdrawTokenOfferData, WithdrawTokenOfferError, WithdrawTokenOfferResponse, UpdateTokenBidWhitelistData, UpdateTokenBidWhitelistError, UpdateTokenBidWhitelistResponse, UpdateTokenOfferWhitelistData, UpdateTokenOfferWhitelistError, UpdateTokenOfferWhitelistResponse, UpdateTokenAdminWhitelistData, UpdateTokenAdminWhitelistError, UpdateTokenAdminWhitelistResponse } from './types.gen.js';
export const client = createClient(createConfig());
/**
* Deploy a new fungible token contract.
* The `launch` endpoint is used to deploy a new fungible token on the Mina blockchain.
* It allows users to create a new token with customizable parameters such as symbol,
* decimals, URI, and admin contract type (standard or advanced).
*
*/
export const launchToken = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<LaunchTokenData, ThrowOnError>) => {
return (options?.client ?? client).post<LaunchTokenResponse, LaunchTokenError, ThrowOnError>({
...options,
url: '/token/launch'
});
};
/**
* Retrieve contract info
* Retrieves detailed information about a contract.
*/
export const getContractInfo = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetContractInfoData, ThrowOnError>) => {
return (options?.client ?? client).post<GetContractInfoResponse, GetContractInfoError, ThrowOnError>({
...options,
url: '/info/contract'
});
};
/**
* Retrieve NFT Info
* Retrieves detailed information about a Mina NFT V2.
*/
export const getNftV2Info = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetNftV2InfoData, ThrowOnError>) => {
return (options?.client ?? client).post<GetNftV2InfoResponse, GetNftV2InfoError, ThrowOnError>({
...options,
url: '/info/nft-v2'
});
};
/**
* Request Funds from Faucet
* Requests funds from the faucet for testing purposes.
*/
export const faucet = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<FaucetData, ThrowOnError>) => {
return (options?.client ?? client).post<FaucetResponse2, FaucetError, ThrowOnError>({
...options,
url: '/faucet'
});
};
/**
* Retrieve information about a fungible token.
* The `info` endpoint retrieves detailed information about a specific fungible token deployed on the Mina blockchain.
*
*/
export const getTokenInfo = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetTokenInfoData, ThrowOnError>) => {
return (options?.client ?? client).post<GetTokenInfoResponse, GetTokenInfoError, ThrowOnError>({
...options,
url: '/info/token'
});
};
/**
* Retrieve the balance of a specific token for an address.
* The `balance` endpoint retrieves the balance of a specific fungible token for a given Mina address.
*
*/
export const getTokenBalance = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetTokenBalanceData, ThrowOnError>) => {
return (options?.client ?? client).post<GetTokenBalanceResponse, GetTokenBalanceError, ThrowOnError>({
...options,
url: '/info/balance'
});
};
/**
* Generate proofs for signed token transactions.
* The `prove` endpoint initiates the proof generation process for a set of signed token transactions.
* It returns a job ID which can be used to check the status and retrieve the proofs or tx hashes using the `/proof` endpoint.
*
*/
export const prove = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<ProveData, ThrowOnError>) => {
return (options?.client ?? client).post<ProveResponse, ProveError, ThrowOnError>({
...options,
url: '/transaction/prove'
});
};
/**
* Check the status of a proof generation job and retrieve proofs.
* The `proof` endpoint allows you to check the status of a proof generation job initiated via the `/prove` endpoint.
* It returns the status of the job and the proofs or tx hashes if they are ready.
*
*/
export const getProof = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetProofData, ThrowOnError>) => {
return (options?.client ?? client).post<GetProofResponse, GetProofError, ThrowOnError>({
...options,
url: '/transaction/proof'
});
};
/**
* Retrieve the status of a transaction by its hash.
* The `tx-status` endpoint allows you to check the current status of a transaction on the Mina blockchain by providing the transaction hash. It returns whether the transaction has been applied, failed, or is still pending.
*
*/
export const txStatus = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TxStatusData, ThrowOnError>) => {
return (options?.client ?? client).post<TxStatusResponse, TxStatusError, ThrowOnError>({
...options,
url: '/transaction/status'
});
};
/**
* Mint new tokens to a specified address.
* The `mint` endpoint allows authorized users to mint new tokens of a fungible token on the Mina blockchain.
* This transaction increases the total supply of the token by creating new tokens and assigning them to a specified address.
* The sender must have the authority to mint tokens, typically the admin of the token contract.
*
*/
export const mintTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<MintTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<MintTokensResponse, MintTokensError, ThrowOnError>({
...options,
url: '/token/mint'
});
};
/**
* Transfer tokens from one address to another.
* The `transfer` endpoint allows users to transfer tokens of a fungible token on the Mina blockchain from one address to another.
* The sender must have sufficient balance and appropriate permissions to perform the transfer.
*
*/
export const transferTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TransferTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<TransferTokensResponse, TransferTokensError, ThrowOnError>({
...options,
url: '/token/transfer'
});
};
/**
* Distribute tokens to multiple addresses via airdrop.
* Allows users to distribute tokens to multiple addresses in a single transaction.
* This is efficient for distributing tokens during events like token launches or community rewards.
*
*/
export const airdropTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<AirdropTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<AirdropTokensResponse, AirdropTokensError, ThrowOnError>({
...options,
url: '/token/airdrop'
});
};
/**
* Redeem tokens for a MINA (applicable for Fungible Tokens with Bonding Curve Admin)
* The `redeem` endpoint allows users to redeem tokens of a fungible token on the Mina blockchain for a MINA.
* The sender must have sufficient balance and appropriate permissions to perform the transfer.
*
*/
export const redeemTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<RedeemTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<RedeemTokensResponse, RedeemTokensError, ThrowOnError>({
...options,
url: '/token/redeem'
});
};
/**
* Burn tokens from one address.
* The `burn` endpoint allows users to burn tokens of a fungible token on the Mina blockchain from one address.
* The sender must have sufficient balance and appropriate permissions to perform the burn.
*
*/
export const burnTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<BurnTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<BurnTokensResponse, BurnTokensError, ThrowOnError>({
...options,
url: '/token/burn'
});
};
/**
* Place a bid on a token
* Allows users to place a bid on an token.
*
*/
export const tokenBid = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TokenBidData, ThrowOnError>) => {
return (options?.client ?? client).post<TokenBidResponse, TokenBidError, ThrowOnError>({
...options,
url: '/token/bid/create'
});
};
/**
* Create an offer to sell tokens at a specified price.
* Allows users to create an offer to sell a specified amount of tokens at a given price.
*
*/
export const tokenOffer = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TokenOfferData, ThrowOnError>) => {
return (options?.client ?? client).post<TokenOfferResponse, TokenOfferError, ThrowOnError>({
...options,
url: '/token/offer/create'
});
};
/**
* Purchase tokens from an existing offer.
* Allows users to purchase tokens from an existing offer on the Mina blockchain.
* This endpoint facilitates the transaction where tokens are transferred from the offer address to the buyer's address in exchange for the specified price.
*
*/
export const buyTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<BuyTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<BuyTokensResponse, BuyTokensError, ThrowOnError>({
...options,
url: '/token/offer/buy'
});
};
/**
* Sell a token to the Bid contract.
* Allows token owners to sell their tokens to the Bid contract.
*
*/
export const sellTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<SellTokensData, ThrowOnError>) => {
return (options?.client ?? client).post<SellTokensResponse, SellTokensError, ThrowOnError>({
...options,
url: '/token/bid/sell'
});
};
/**
* Withdraw a previously placed bid on an token.
* Allows users to withdraw a bid they have previously placed using the `/bid` endpoint.
* This transaction cancels the active bid, releasing any locked funds.
*
*/
export const withdrawTokenBid = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<WithdrawTokenBidData, ThrowOnError>) => {
return (options?.client ?? client).post<WithdrawTokenBidResponse, WithdrawTokenBidError, ThrowOnError>({
...options,
url: '/token/bid/withdraw'
});
};
/**
* Withdraw a previously made offer to sell a token.
* Allows users to withdraw an offer they have previously made using the `/offer` endpoint.
* This transaction cancels the active offer, releasing any locked tokens.
*
*/
export const withdrawTokenOffer = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<WithdrawTokenOfferData, ThrowOnError>) => {
return (options?.client ?? client).post<WithdrawTokenOfferResponse, WithdrawTokenOfferError, ThrowOnError>({
...options,
url: '/token/offer/withdraw'
});
};
/**
* Update the bid whitelist
* Allows administrators to update the whitelist of addresses permitted to interact with the Bid contract.
* This is essential for managing participation in bidding processes, especially for controlled or private auctions.
*
*/
export const updateTokenBidWhitelist = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateTokenBidWhitelistData, ThrowOnError>) => {
return (options?.client ?? client).post<UpdateTokenBidWhitelistResponse, UpdateTokenBidWhitelistError, ThrowOnError>({
...options,
url: '/token/bid/whitelist'
});
};
/**
* Update the offer whitelist
* Allows administrators to update the whitelist of addresses permitted to interact with the Offer contract.
* This is essential for managing participation in offer processes, especially for controlled or private sales.
*
*/
export const updateTokenOfferWhitelist = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateTokenOfferWhitelistData, ThrowOnError>) => {
return (options?.client ?? client).post<UpdateTokenOfferWhitelistResponse, UpdateTokenOfferWhitelistError, ThrowOnError>({
...options,
url: '/token/offer/whitelist'
});
};
/**
* Update the advanced admin whitelist
* Allows administrators to update the whitelist of admin contracts.
*
*/
export const updateTokenAdminWhitelist = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateTokenAdminWhitelistData, ThrowOnError>) => {
return (options?.client ?? client).post<UpdateTokenAdminWhitelistResponse, UpdateTokenAdminWhitelistError, ThrowOnError>({
...options,
url: '/token/admin/whitelist'
});
};