/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { BroadcastKMS } from '../models/BroadcastKMS'; import type { PrivKey } from '../models/PrivKey'; import type { PrivKeyRequest } from '../models/PrivKeyRequest'; import type { TransactionHash } from '../models/TransactionHash'; import type { TransferVetBlockchain } from '../models/TransferVetBlockchain'; import type { TransferVetBlockchainKMS } from '../models/TransferVetBlockchainKMS'; import type { VetBlock } from '../models/VetBlock'; import type { VetTx } from '../models/VetTx'; import type { VetTxReceipt } from '../models/VetTxReceipt'; import type { Wallet } from '../models/Wallet'; import type { CancelablePromise } from '../core/CancelablePromise'; import { request as __request } from '../core/request'; export class VeChainService { /** * Generate VeChain wallet *
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 VeChain wallet with derivation path m'/44'/818'/0'/0. More about BIP44 HD wallets can be found here - https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki. * Generate BIP44 compatible VeChain wallet.
* * @param mnemonic Mnemonic to use for generation of extended public and private keys. * @returns Wallet OK * @throws ApiError */ public static vetGenerateWallet( mnemonic?: string, ): CancelablePromiseGenerate VeChain account deposit address from Extended public key. Deposit address is generated for the specific index - each extended public key can generate * up to 2^31 addresses starting from index 0 until 2^31 - 1.
* * @param xpub Extended public key of wallet. * @param index Derivation index of desired address to be generated. * @returns any OK * @throws ApiError */ public static vetGenerateAddress( xpub: string, index: number, ): CancelablePromise<{ /** * VeChain addres */ address?: string; }> { return __request({ method: 'GET', path: `/v3/vet/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 while processing the request.`, }, }); } /** * Generate VeChain 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^32 private keys starting from index 0 until 2^31 - 1.
* * @param requestBody * @returns PrivKey OK * @throws ApiError */ public static vetGenerateAddressPrivateKey( requestBody: PrivKeyRequest, ): CancelablePromiseGet VeChain current block number.
* @returns number OK * @throws ApiError */ public static vetGetCurrentBlock(): CancelablePromiseGet VeChain Block by block hash or block number.
* @param hash Block hash or block number * @returns VetBlock OK * @throws ApiError */ public static vetGetBlock( hash: string, ): CancelablePromiseGet VeChain Account balance in VET.
* @param address Account address you want to get balance of * @returns any OK * @throws ApiError */ public static vetGetBalance( address: string, ): CancelablePromise<{ /** * Balance in VET */ balance?: string; }> { return __request({ method: 'GET', path: `/v3/vet/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.`, 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 while processing the request.`, }, }); } /** * Get VeChain Account energy (VTHO) *Get VeChain Account energy in VTHO. VTHO is used for paying for the transaction fee.
* @param address Account address you want to get balance of * @returns any OK * @throws ApiError */ public static vetGetEnergy( address: string, ): CancelablePromise<{ /** * Balance in VTHO */ energy?: string; }> { return __request({ method: 'GET', path: `/v3/vet/account/energy/${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.`, 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 while processing the request.`, }, }); } /** * Get VeChain Transaction *Get VeChain Transaction by transaction hash.
* @param hash Transaction hash * @returns VetTx OK * @throws ApiError */ public static vetGetTransaction( hash: string, ): CancelablePromiseGet VeChain Transaction Receipt by transaction hash. Transaction receipt is available only after transaction is * included in the block and contains information about paid fee or created contract address and much more.
* * @param hash Transaction hash * @returns VetTxReceipt OK * @throws ApiError */ public static vetGetTransactionReceipt( hash: string, ): CancelablePromiseSend VET from account to account. Fee for the transaction is paid in VTHO.
* 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 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.
*
Broadcast signed transaction to VeChain blockchain. This method is used internally from Tatum KMS, Tatum Middleware or Tatum client libraries. * It is possible to create custom signing mechanism and use this method only for broadcasting data to the blockchain.
* * @param requestBody * @returns TransactionHash OK * @throws ApiError */ public static vetBroadcast( requestBody: BroadcastKMS, ): CancelablePromise