/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { BroadcastKMS } from '../models/BroadcastKMS'; import type { CallOneReadSmartContractMethod } from '../models/CallOneReadSmartContractMethod'; import type { CallOneSmartContractMethod } from '../models/CallOneSmartContractMethod'; import type { CallOneSmartContractMethodKMS } from '../models/CallOneSmartContractMethodKMS'; import type { Data } from '../models/Data'; import type { EthBlock } from '../models/EthBlock'; import type { OneTx } from '../models/OneTx'; 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 { TransferOneBlockchain } from '../models/TransferOneBlockchain'; import type { TransferOneBlockchainKMS } from '../models/TransferOneBlockchainKMS'; import type { Wallet } from '../models/Wallet'; import type { CancelablePromise } from '../core/CancelablePromise'; import { request as __request } from '../core/request'; export class HarmonyService { /** * Generate ONE 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 ONE wallet with derivation path m'/44'/60'/0'/0. More about BIP44 HD wallets can be found here - https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki. * Generate BIP44 compatible ONE wallet.
* * @param mnemonic Mnemonic to use for generation of extended public and private keys. * @returns Wallet OK * @throws ApiError */ public static oneGenerateWallet( mnemonic?: string, ): CancelablePromise1 credit per API call
*Generate ONE 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.
* * @param xpub Extended public key of wallet. * @param index Derivation index of desired address to be generated. * @returns any OK * @throws ApiError */ public static oneGenerateAddress( xpub: string, index: number, ): CancelablePromise<{ /** * ONE address */ address?: string; }> { return __request({ method: 'GET', path: `/v3/one/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.`, 500: `Internal server error. There was an error on the server during the processing of the request.`, }, }); } /** * Transform HEX address to Bech32 ONE address format *1 credit per API call
*Transform HEX address to Bech32 format with one prefix.
* * @param address Address in HEX (ETH compatible) format. * @returns any OK * @throws ApiError */ public static oneFormatAddress( address: string, ): CancelablePromise<{ /** * ONE address */ address?: string; }> { return __request({ method: 'GET', path: `/v3/one/address/format/${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.`, }, }); } /** * Generate ONE private key *1 credit per API call
*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 oneGenerateAddressPrivateKey( 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 web3 driver to connect directly to the ONE node provided by Tatum. * To learn more about ONE Web3, visit the ONE developer's guide.
* * @param xApiKey Tatum X-API-Key used for authorization. * @param requestBody * @param shardId Shard to read data from * @returns any OK * @throws ApiError */ public static oneWeb3Driver( xApiKey: string, requestBody: any, shardId?: number, ): CancelablePromise1 credit per API call
*Get ONE current block number. This is the number of the latest block in the blockchain.
* * @returns any OK * @throws ApiError */ public static oneGetCurrentBlock(): CancelablePromise1 credit per API call
*Get ONE block by block hash or block number.
* * @param hash Block hash or block number * @param shardId Shard to read data from * @returns EthBlock OK * @throws ApiError */ public static oneGetBlock( hash: string, shardId?: number, ): CancelablePromise1 credit per API call
*Get ONE account balance in ONE. This method does not prints any balance of the HRM20 or HRM721 tokens on the account.
* * @param address Account address you want to get balance of * @param shardId Shard to read data from * @returns any OK * @throws ApiError */ public static oneGetBalance( address: string, shardId?: number, ): CancelablePromise<{ /** * Balance in ONE */ balance?: string; }> { return __request({ method: 'GET', path: `/v3/one/account/balance/${address}`, query: { 'shardID': shardId, }, 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 ONE Transaction *2 credits per API call
*Get ONE transaction by transaction hash.
* * @param hash Transaction hash * @param shardId Shard to read data from * @returns OneTx OK * @throws ApiError */ public static oneGetTransaction( hash: string, shardId?: number, ): CancelablePromise1 credit per API call
*Get a number of outgoing ONE 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 * @param shardId Shard to read data from * @returns number OK * @throws ApiError */ public static oneGetTransactionCount( address: string, shardId?: number, ): CancelablePromise2 credits per API call
*Send ONE or Tatum supported HRM20 token from account to account.
* Default shard 0 is used for sender and recipient.
*
Signing a transaction
*When sending ONE, 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.
* Alternatively, using the Tatum client library for supported languages. * * @param requestBody * @param shardId Shard to read data from * @returns any OK * @throws ApiError */ public static oneBlockchainTransfer( requestBody: (TransferOneBlockchain | TransferOneBlockchainKMS), shardId?: number, ): CancelablePromise<(TransactionHash | SignatureId)> { return __request({ method: 'POST', path: `/v3/one/transaction`, query: { 'shardID': shardId, }, 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.`, 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.`, }, }); } /** * Invoke a method in a smart contract on Harmony *2 credits per API call
*Invoke a method in an existing smart contract on Harmony.
*You can call a read-only or write method.
*Signing a transaction
*When invoking a method in a smart contract, 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 * @param shardId Shard to read data from * @returns any OK * @throws ApiError */ public static oneBlockchainSmartContractInvocation( requestBody: (CallOneReadSmartContractMethod | CallOneSmartContractMethod | CallOneSmartContractMethodKMS), shardId?: number, ): CancelablePromise<(TransactionHash | SignatureId | Data)> { return __request({ method: 'POST', path: `/v3/one/smartcontract`, query: { 'shardID': shardId, }, 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.`, 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.`, }, }); } /** * Broadcast signed ONE transaction *2 credits per API call
*Broadcast signed transaction to ONE 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 * @param shardId Shard to read data from * @returns TransactionHash OK * @throws ApiError */ public static oneBroadcast( requestBody: BroadcastKMS, shardId?: number, ): CancelablePromise