/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { BroadcastKMS } from '../models/BroadcastKMS'; import type { EgldBlock } from '../models/EgldBlock'; import type { EgldTx } from '../models/EgldTx'; import type { PrivKey } from '../models/PrivKey'; import type { PrivKeyRequest } from '../models/PrivKeyRequest'; import type { SignatureId } from '../models/SignatureId'; import type { TransactionHash } from '../models/TransactionHash'; import type { TransferEgldBlockchain } from '../models/TransferEgldBlockchain'; import type { TransferEgldBlockchainKMS } from '../models/TransferEgldBlockchainKMS'; import type { CancelablePromise } from '../core/CancelablePromise'; import { request as __request } from '../core/request'; export class ElrondService { /** * Generate EGLD wallet *
The Elrond Address format is bech32, specified by the BIP 0173. The address always starts with an erd1. 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 EGLD wallet with derivation path m'/44'/508'/0'/0'. * More about BIP44 HD wallets can be found here - https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki. * Generate BIP44 compatible EGLD wallet.
* * @param mnemonic Mnemonic to use for generation of private key. * @returns any OK * @throws ApiError */ public static egldGenerateWallet( mnemonic?: string, ): CancelablePromise<{ /** * Mnemonic to use for generation of private key */ mnemonic?: string; }> { return __request({ method: 'GET', path: `/v3/egld/wallet`, query: { 'mnemonic': mnemonic, }, 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.`, }, }); } /** * Generate EGLD account address from mnemonic *Generate EGLD account deposit address from mnemonic phrase. Deposit address is generated for the specific * index - each mnemonic phrase can generate up to 2^31 addresses starting from index 0 until 2^31.
* * @param mnemonic Mnemonic to use for generation of address. * @param index Derivation index of desired address to be generated. * @returns any OK * @throws ApiError */ public static egldGenerateAddress( mnemonic: string, index: number, ): CancelablePromise<{ /** * EGLD address */ address?: string; }> { return __request({ method: 'GET', path: `/v3/egld/address/${mnemonic}/${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.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Generate EGLD private key *Generate private key of 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 egldGenerateAddressPrivateKey( requestBody: PrivKeyRequest, ): CancelablePromise2 credits per API call
*This endpoint is deprecated. Use the HTTP-based JSON RPC driver instead.
Use this endpoint URL as a http-based driver to connect directly to the EGLD node provided by Tatum. * To learn more about EGLD, visit the EGLD developer's guide.
* * @param xApiKey Tatum X-API-Key used for authorization. * @param requestBody * @returns any OK * @throws ApiError */ public static egldNodePost( xApiKey: string, requestBody: any, ): CancelablePromise2 credits per API call
*This endpoint is deprecated. Use the HTTP-based JSON RPC driver instead.
Use this endpoint URL as a http-based driver to connect directly to the EGLD node provided by Tatum. * To learn more about EGLD, visit the EGLD developer's guide.
* * @param xApiKey Tatum X-API-Key used for authorization. * @returns any OK * @throws ApiError */ public static egldNodeGet( xApiKey: string, ): CancelablePromiseGet EGLD current block number. This is the number of the latest block in the blockchain.
* @returns number OK * @throws ApiError */ public static eGldGetCurrentBlock(): CancelablePromiseGet EGLD block by block hash or block number. EGLD docs
* @param hash Block hash or nonce * @returns EgldBlock OK * @throws ApiError */ public static egldGetBlock( hash: string, ): CancelablePromiseGet account balance in EGLD.
* @param address Account address you want to get balance of * @returns any OK * @throws ApiError */ public static egldGetBalance( address: string, ): CancelablePromise<{ /** * Balance in EGLD */ balance?: string; }> { return __request({ method: 'GET', path: `/v3/egld/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 EGLD Transaction *Get EGLD transaction by transaction hash. Detail result please find here EGLD docs
* @param hash Transaction hash * @returns EgldTx OK * @throws ApiError */ public static egldGetTransaction( hash: string, ): CancelablePromiseThis endpoint allows one to retrieve the latest 20 transactions sent from an address.
* * @param address address * @returns any OK * @throws ApiError */ public static egldGetTransactionAddress( address: string, ): CancelablePromiseGet a number of outgoing EGLD transactions for the address. When a transaction is sent, there can be multiple outgoing transactions, * which are not yet processed by the blockchain. To distinguish between them, there is a counter called a nonce, which represents * the order of the transaction in the list of outgoing transactions.
* * @param address address * @returns number OK * @throws ApiError */ public static egldGetTransactionCount( address: string, ): CancelablePromiseSend EGLD from account to account.
* This operation needs the private key of the blockchain address. Every time the funds are transferred, the transaction must be signed with the corresponding private key.
* 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 devnet 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.
*
Broadcast signed transaction to EGLD 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 TransactionHash OK * @throws ApiError */ public static egldBroadcast( requestBody: BroadcastKMS, ): CancelablePromise