/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { AlgoBlock } from '../models/AlgoBlock'; import type { AlgoTransactionHashKMS } from '../models/AlgoTransactionHashKMS'; import type { AlgoTx } from '../models/AlgoTx'; import type { AlgoTxsWithPagination } from '../models/AlgoTxsWithPagination'; import type { AlgoWallet } from '../models/AlgoWallet'; import type { BroadcastKMS } from '../models/BroadcastKMS'; import type { ReceiveAlgorandAsset } from '../models/ReceiveAlgorandAsset'; import type { ReceiveAlgorandAssetKMS } from '../models/ReceiveAlgorandAssetKMS'; import type { SignatureId } from '../models/SignatureId'; import type { TransactionHash } from '../models/TransactionHash'; import type { TransferAlgorandBlockchain } from '../models/TransferAlgorandBlockchain'; import type { TransferAlgorandBlockchainKMS } from '../models/TransferAlgorandBlockchainKMS'; import type { CancelablePromise } from '../core/CancelablePromise'; import { request as __request } from '../core/request'; export class AlgorandService { /** * Generate Algorand wallet *
Tatum supports Algorand wallets.
* * @param mnemonic Mnemonic to use for generation of extended public and private keys. * @returns AlgoWallet OK * @throws ApiError */ public static algorandGenerateWallet( mnemonic?: string, ): CancelablePromiseGenerate Algorand account deposit address from private key.
* * @param priv private key of wallet. * @returns any OK * @throws ApiError */ public static algorandGenerateAddress( priv: string, ): CancelablePromise<{ /** * Algorand address */ address?: string; }> { return __request({ method: 'GET', path: `/v3/algorand/address/${priv}`, 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.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * @deprecated * Access Algorand Indexer GET node endpoints *1 credit per API call
*This endpoint is deprecated. Use the HTTP-based JSON RPC driver instead.
Use this endpoint URL as a http-based url to connect directly to the Algorand node provided by Tatum.
* You can check all available APIs here - https://developer.algorand.org/docs/rest-apis/indexer/.
*
* Example call for Get Tx By ID is described in the response. https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactionstxid.
*
* URL used for this call would be
https://api-eu1.tatum.io/v3/algorand/node/indexer/YOUR_API_KEY/v2/transactions/HNIQ76UTJYPOLZP5FWODYABBJPYPGJNEM2QEJSMDMQRWEKHEYJHQ* * @param xApiKey Tatum X-API-Key used for authorization. * @param indexerPath `**` path of indexer. * @returns AlgoTx OK * @throws ApiError */ public static algoNodeIndexerGetDriver( xApiKey: string, indexerPath: string, ): CancelablePromise
1 credit per API call
*This endpoint is deprecated. Use the HTTP-based JSON RPC driver instead.
Use this endpoint URL as a http-based url to connect directly to the Algorand node provided by Tatum.
* You can check al available APIs here - https://developer.algorand.org/docs/rest-apis/algod/v2/.
*
* Example call for Get Block is described in the response. https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksround.
*
* URL used for this call would be
https://api-eu1.tatum.io/v3/algorand/node/algod/YOUR_API_KEY/v2/blocks/16775567* * * @param xApiKey Tatum X-API-Key used for authorization. * @param algodPath `**` path of algod. * @returns AlgoBlock OK * @throws ApiError */ public static algoNodeGetDriver( xApiKey: string, algodPath: string, ): CancelablePromise
2 credits per API call
*This endpoint is deprecated. Use the HTTP-based JSON RPC driver instead.
Use this endpoint URL as a http-based url to connect directly to the Algorand node provided by Tatum.
* You can check al available APIs here - https://developer.algorand.org/docs/rest-apis/algod/v2/.
*
* Example call for Broadcast a raw transaction is described in the response. https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactions.
*
* URL used for this call would be
https://api-eu1.tatum.io/v3/algorand/node/algod/YOUR_API_KEY/v2/transactions* * * @param xApiKey Tatum X-API-Key used for authorization. * @param algodPath `**` path of algod. * @param requestBody * @returns any OK * @throws ApiError */ public static algoNodePostDriver( xApiKey: string, algodPath: string, requestBody: { /** * Check here - https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactions */ rawtxn?: string; }, ): CancelablePromise<{ /** * Check here - https://developer.algorand.org/docs/rest-apis/algod/v2/#rawtransaction-response-200 */ txId?: string; }> { return __request({ method: 'POST', path: `/v3/algorand/node/algod/${xApiKey}/${algodPath}`, body: requestBody, mediaType: 'application/json', 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.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Get Algorand Account balance *
Get Algorand account balance in ALGO.
* * @param address Account address you want to get balance of * @returns any OK * @throws ApiError */ public static algorandGetBalance( address: string, ): CancelablePromise<{ assets?: Array<{ /** * Balance in asset unit */ amount?: number; /** * Asset Index of ASA */ assetIndex?: number; }>; /** * Balance in ALGO */ balance?: number; }> { return __request({ method: 'GET', path: `/v3/algorand/account/balance/${address}`, 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.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Get current block number *Get Algorand current block number. This is the number of the latest block in the blockchain.
* @returns number OK * @throws ApiError */ public static algorandGetCurrentBlock(): CancelablePromiseGet Algorand block by block round number.
* @param roundNumber Block round number * @returns AlgoBlock OK * @throws ApiError */ public static algorandGetBlock( roundNumber: number, ): CancelablePromise2 credits per API call
*Send Algos from one Algorand address to the other one.
*Signing a transaction
*When sending Algos, 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 any OK * @throws ApiError */ public static algorandBlockchainTransfer( requestBody: (TransferAlgorandBlockchain | TransferAlgorandBlockchainKMS), ): CancelablePromise<(TransactionHash | SignatureId)> { return __request({ method: 'POST', path: `/v3/algorand/transaction`, body: requestBody, mediaType: 'application/json', 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.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Enable receiving asset on account *Enable accepting Algorand asset on the sender account.
* This operation needs the private key of the blockchain address.
* No one should ever send it's own private keys to the internet because there is a strong possibility of stealing keys and loss of funds. In this method, it is possible to enter privateKey
* or signatureId. PrivateKey should be used only for quick development on testnet versions of blockchain when there is no risk of losing funds. In production,
* Tatum KMS should be used for the highest security standards, and signatureId should be present in the request.
* Alternatively, using the Tatum client library for supported languages.
*
Get Algorand transaction by transaction id.
* @param txid Transaction id * @returns AlgoTx OK * @throws ApiError */ public static algorandGetTransaction( txid: string, ): CancelablePromiseGet Algorand transaction by specified period of time.
* @param from Start timestamp in specified period of time * @param to End timestamp in specified period of time * @param limit page size for pagination * @param next Algorand Next Token for getting the next page results * @returns AlgoTxsWithPagination OK * @throws ApiError */ public static algorandGetPayTransactionsByFromTo( from: string, to: string, limit?: string, next?: string, ): CancelablePromiseBroadcast signed transaction to Algorand blockchain. This method is used internally from Tatum KMS 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 AlgoTransactionHashKMS OK * @throws ApiError */ public static algoandBroadcast( requestBody: BroadcastKMS, ): CancelablePromise