Developer Platform API Methods

API Methods of Developer Platform

Client Methods

  • Client.init(config): Initializes the client with an API key, chain, and optional provider.

  • Client.getApiKey(): Returns the currently configured API key.

  • Client.getProvider(): Returns the configured provider URL.

  • Client.getChainId(): Returns the selected chain ID.

Wallet Methods

  • Wallet.create(): Creates a new wallet and returns its address, private key, and mnemonic.

  • Wallet.balance(address): Fetches the native token balance for a wallet address.

Token Methods

  • Token.getNativeTokenBalance(address): Returns the native token balance for a given wallet or CronosId.

  • Token.getERC20TokenBalance(address, contractAddress, blockHeight?): Returns the ERC20 token balance.

  • Token.transfer({ to, amount, contractAddress? }): Transfers native or ERC20 tokens.

  • Token.wrap({ amount }): Wraps tokens.

  • Token.swap({ fromContractAddress, toContractAddress, amount }): Swaps tokens.

  • Token.getERC721TokenBalance(address, contractAddress): Returns ERC721 token balance.

  • Token.getTokenOwner(contractAddress, tokenId): Returns the owner of a specific ERC721 token.

  • Token.getTokenURI(contractAddress, tokenId): Returns the token URI of an ERC721 token.

  • Token.getERC721Metadata(contractAddress): Returns metadata for an ERC721 contract.

  • Token.getERC20Metadata(contractAddress): Returns metadata for an ERC20 contract.

Transaction Methods

  • Transaction.getTransactionsByAddress(address, explorerAPIKey, session?, limit?, startBlock?, endBlock?): Returns transaction list.

  • Transaction.getTransactionByHash(txHash): Returns a transaction by hash.

  • Transaction.getTransactionStatus(txHash): Returns transaction status.

  • Transaction.getTransactionCount(address): Returns the nonce/transaction count for a wallet.

  • Transaction.getGasPrice(): Returns the current gas price.

  • Transaction.getFeeData(): Returns fee-related data.

  • Transaction.estimateGas(payload): Estimates the gas for a transaction.

Contract Methods

  • Contract.getContractABI(contractAddress, explorerAPIKey): Returns the ABI of a smart contract.

  • Contract.getContractCode(contractAddress): Returns bytecode of a smart contract.

Block Methods

  • Block.getCurrentBlock(): Returns the latest block.

  • Block.getBlockByTag(tag, txDetail?): Fetches block by tag or number.

CronosId Methods

  • CronosId.forwardResolve(cronosId): Resolves a CronosId to a wallet address.

  • CronosId.reverseResolve(address): Resolves an address to its CronosId (if any).

Defi Methods

  • Defi.getWhitelistedTokens(protocol): Returns whitelisted tokens for a protocol.

  • Defi.getAllFarms(protocol): Returns all farms for a protocol.

  • Defi.getFarmBySymbol(protocol, symbol): Returns farm details by symbol.

Exchange Methods

  • Exchange.getAllTickers(): Returns all market tickers.

  • Exchange.getTickerByInstrument(instrumentName): Returns market data for a given trading pair.

Last updated

Was this helpful?