/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { CreateTronTrc10Blockchain } from '../models/CreateTronTrc10Blockchain'; import type { CreateTronTrc10BlockchainKMS } from '../models/CreateTronTrc10BlockchainKMS'; import type { CreateTronTrc20Blockchain } from '../models/CreateTronTrc20Blockchain'; import type { CreateTronTrc20BlockchainKMS } from '../models/CreateTronTrc20BlockchainKMS'; import type { FreezeTron } from '../models/FreezeTron'; import type { FreezeTronKMS } from '../models/FreezeTronKMS'; import type { PrivKey } from '../models/PrivKey'; import type { PrivKeyRequest } from '../models/PrivKeyRequest'; import type { TransactionHash } from '../models/TransactionHash'; import type { TransferTronBlockchain } from '../models/TransferTronBlockchain'; import type { TransferTronBlockchainKMS } from '../models/TransferTronBlockchainKMS'; import type { TransferTronTrc10Blockchain } from '../models/TransferTronTrc10Blockchain'; import type { TransferTronTrc10BlockchainKMS } from '../models/TransferTronTrc10BlockchainKMS'; import type { TransferTronTrc20Blockchain } from '../models/TransferTronTrc20Blockchain'; import type { TransferTronTrc20BlockchainKMS } from '../models/TransferTronTrc20BlockchainKMS'; import type { TronAccount } from '../models/TronAccount'; import type { TronBlock } from '../models/TronBlock'; import type { TronBroadcast } from '../models/TronBroadcast'; import type { TronTrc10Detail } from '../models/TronTrc10Detail'; import type { TronTx } from '../models/TronTx'; import type { TronTx20 } from '../models/TronTx20'; import type { TronWallet } from '../models/TronWallet'; import type { CancelablePromise } from '../core/CancelablePromise'; import { request as __request } from '../core/request'; export class TronService { /** * Generate a TRON wallet *
1 credit per API call
*Tatum supports BIP44 HD wallets. It is very convenient and secure, since it can generate 2^31 addresses from 1 mnemonic phrase. Mnemonic phrase consists of 24 special words in defined order and can restore access to all generated addresses and private keys.
Each address is identified by 3 main values:
Tatum follows BIP44 specification and generates for Bitcoin wallet with derivation path m'/44'/195'/0'/0. More about BIP44 HD wallets can be found here - https://github.com/tron/bips/blob/master/bip-0044.mediawiki. * Generate BIP44 compatible Tron wallet.
* * @param mnemonic Mnemonic to use for generation of extended public and private keys. * @returns TronWallet OK * @throws ApiError */ public static generateTronwallet( mnemonic?: string, ): CancelablePromise5 credits per API call
*Generate a TRON address from the extended public key of the wallet. The address is generated for the specific index - each extended public key can generate up to 2^32 addresses with the index starting from 0 up to 2^31.
* * @param xpub The extended public key of the wallet; can be in the base58 format (111 characters) or the hexadecimal format (130 characters) * @param index Derivation index of desired address to be generated. * @returns any OK * @throws ApiError */ public static tronGenerateAddress( xpub: string, index: number, ): CancelablePromise<{ /** * Tron address */ address?: string; }> { return __request({ method: 'GET', path: `/v3/tron/address/${xpub}/${index}`, errors: { 400: `Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.`, 401: `Unauthorized. Not valid or inactive subscription key present in the HTTP Header.`, 403: `Forbidden. The request is authenticated, but it is not possible to required perform operation due to logical error or invalid permissions.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Generate the private key for a TRON address *10 credits per API call
*Generate private key for address from mnemonic for given derivation path index. Private key is generated for the specific index - each mnemonic * can generate up to 2^31 private keys starting from index 0 until 2^31.
* * @param requestBody * @returns PrivKey OK * @throws ApiError */ public static tronGenerateAddressPrivateKey( requestBody: PrivKeyRequest, ): CancelablePromise5 credits per API call
*Get current Tron block.
* * @returns any OK * @throws ApiError */ public static tronGetCurrentBlock(): CancelablePromise<{ /** * Block height. */ blockNumber?: number; /** * Block hash. */ hash?: string; /** * Wether the block is from mainnet of Shasta testnet */ testnet?: boolean; }> { return __request({ method: 'GET', path: `/v3/tron/info`, errors: { 401: `Unauthorized. Not valid or inactive subscription key present in the HTTP Header.`, 403: `Forbidden. The request is authenticated, but it is not possible to required perform operation due to logical error or invalid permissions.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Get a TRON block by its hash or height *5 credits per API call
*Get Tron block by hash or height.
* * @param hash Block hash or height. * @returns TronBlock OK * @throws ApiError */ public static tronGetBlock( hash: string, ): CancelablePromise5 credits per API call
*Get Tron account by address.
* * @param address Account address. * @returns TronAccount OK * @throws ApiError */ public static tronGetAccount( address: string, ): CancelablePromise10 credits per API call
*Freeze Tron assets on the address. By freezing assets, you can obtain energy or bandwidth to perform transactions.
*Signing a transaction
*When freezing the balance, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.
*Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.
*For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronFreeze( requestBody: (FreezeTron | FreezeTronKMS), ): CancelablePromise5 credits per API call
*Get all transactions for a TRON account.
*This API returns up to 200 transactions in one API call. If there are more than 200 transactions for the TRON account, the response body will contain the next parameter with the ID of the transaction that follows the last (200th) transaction in the returned list.
To get the next 200 transactions, make another call using this API, but this time add the next parameter the endpoint URL and set it to the transaction ID from the next parameter in the response, for example:
https://{region}.tatum.io/v3/tron/transaction/account/{address}?next=81d0524acf5967f3b361e03fd7d141ab511791cd7aad7ae406c4c8d408290991
5 credits per API call
*Get TRC-20 transactions for a TRON account.
*This API returns up to 200 transactions in one API call. If there are more than 200 transactions for the TRON account, the response body will contain the next parameter with the ID of the transaction that follows the last (200th) transaction in the returned list.
To get the next 200 transactions, make another call using this API, but this time add the next parameter the endpoint URL and set it to the transaction ID from the next parameter in the response, for example:
https://{region}.tatum.io/v3/tron/transaction/account/{address}/trc20?next=81d0524acf5967f3b361e03fd7d141ab511791cd7aad7ae406c4c8d408290991
10 credits per API call
*Send an amount in TRX from address to address.
*Signing a transaction
*When sending TRX to a TRON account, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.
*Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.
*For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronTransfer( requestBody: (TransferTronBlockchain | TransferTronBlockchainKMS), ): CancelablePromise10 credits per API call
*Send TRC-10 tokens from address to address.
*Signing a transaction
*When sending TRC-10 tokens to a TRON account, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.
*Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.
*For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronTransferTrc10( requestBody: (TransferTronTrc10Blockchain | TransferTronTrc10BlockchainKMS), ): CancelablePromise10 credits per API call
*Send TRC-20 tokens from address to address.
*Signing a transaction
*When sending TRC-20 tokens to a TRON account, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.
*Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.
*For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronTransferTrc20( requestBody: (TransferTronTrc20Blockchain | TransferTronTrc20BlockchainKMS), ): CancelablePromise10 credits per API call
*Create Tron TRC10 token. 1 account can create only 1 token. All supply of the tokens are transferred to the issuer account 100 seconds after the creation.
*Signing a transaction
*When creating a TRC-10 token, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.
*Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.
*For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronCreateTrc10( requestBody: (CreateTronTrc10Blockchain | CreateTronTrc10BlockchainKMS), ): CancelablePromise5 credits per API call
*Get Tron TRC10 token details.
* * @param id TRC10 token ID * @returns TronTrc10Detail OK * @throws ApiError */ public static tronTrc10Detail( id: number, ): CancelablePromise10 credits per API call
*Create Tron TRC20 token. 1 account can create only 1 token. All supply of the tokens are transfered to the issuer account 100 seconds after the creation.
*Signing a transaction
*When creating a TRC-20 token, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.
*Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.
*For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronCreateTrc20( requestBody: (CreateTronTrc20Blockchain | CreateTronTrc20BlockchainKMS), ): CancelablePromise5 credits per API call
*Get Tron transaction by hash.
* * @param hash Transaction hash. * @returns TronTx OK * @throws ApiError */ public static tronGetTransaction( hash: string, ): CancelablePromise5 credits per API call
*Broadcast Tron transaction. This method is used internally from Tatum Middleware or Tatum client libraries. * It is possible to create custom signing mechanism and use this method only for broadcasting data to the blockchian.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static tronBroadcast( requestBody: TronBroadcast, ): CancelablePromise