Skip to content

Commit

Permalink
ALL-4358 - Fix Flare bugs (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel authored Feb 16, 2024
1 parent c676f38 commit 178219b
Show file tree
Hide file tree
Showing 25 changed files with 293 additions and 246 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tatumio",
"version": "2.2.47",
"version": "2.2.48",
"license": "MIT",
"repository": "https://github.com/tatumio/tatum-js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/api_schema.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/api-client/src/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export type { BscTxLog } from './models/BscTxLog';
export type { BtcBasedBalance } from './models/BtcBasedBalance';
export type { BtcBlock } from './models/BtcBlock';
export type { BtcBlockHash } from './models/BtcBlockHash';
export type { BtcGetTxByAddressBatch } from './models/BtcGetTxByAddressBatch';
export type { BtcInfo } from './models/BtcInfo';
export type { BtcTransactionFromAddress } from './models/BtcTransactionFromAddress';
export type { BtcTransactionFromAddressKMS } from './models/BtcTransactionFromAddressKMS';
Expand Down Expand Up @@ -617,7 +618,6 @@ export type { FlareBlock } from './models/FlareBlock';
export type { FlareEstimateGas } from './models/FlareEstimateGas';
export type { FlareTestnetType } from './models/FlareTestnetType';
export type { FlareTx } from './models/FlareTx';
export type { FlareTxInternal } from './models/FlareTxInternal';
export type { FlowAccount } from './models/FlowAccount';
export type { FlowAddPubKeyMnemonic } from './models/FlowAddPubKeyMnemonic';
export type { FlowAddPubKeySecret } from './models/FlowAddPubKeySecret';
Expand Down Expand Up @@ -1039,6 +1039,7 @@ export type { UpdateFeeTronKMS } from './models/UpdateFeeTronKMS';
export type { UpdateMarketplaceSolana } from './models/UpdateMarketplaceSolana';
export type { UpdateMarketplaceSolanaKMS } from './models/UpdateMarketplaceSolanaKMS';
export type { Url } from './models/Url';
export type { Utxo } from './models/Utxo';
export type { ValidGasPumpAddress } from './models/ValidGasPumpAddress';
export type { VC } from './models/VC';
export type { VerifySolanaNFT } from './models/VerifySolanaNFT';
Expand Down
14 changes: 14 additions & 0 deletions packages/api-client/src/generated/models/BtcGetTxByAddressBatch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type BtcGetTxByAddressBatch = {
/**
* Type of the transaction to fetch - either incoming, or outgoing. If none is present - all transactions are fetched.
*/
txType?: 'incoming' | 'outgoing';
/**
* Addresses
*/
addresses: Array<string>;
}
5 changes: 4 additions & 1 deletion packages/api-client/src/generated/models/ChainUtxoEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/* tslint:disable */
/* eslint-disable */

export type ChainUtxoEnum = 'bitcoin' | 'bitcoin-testnet' | 'litecoin' | 'litecoin-testnet' | 'doge' | 'doge-testnet' | 'cardano' | 'cardano-preprod';
/**
* The blockchain to work with.
*/
export type ChainUtxoEnum = 'bitcoin' | 'bitcoin-mainnet' | 'bitcoin-testnet' | 'litecoin' | 'litecoin-mainnet' | 'litecoin-testnet' | 'doge' | 'doge-mainnet' | 'doge-testnet' | 'cardano' | 'cardano-mainnet' | 'cardano-preprod';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type CreateSubscriptionContractLogEvent = {
/**
* The blockchain on which events should be monitored.
*/
chain: 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BSC';
chain: 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BSC' | 'FLR';
/**
* The URL of the endpoint where an HTTP POST request will be sent when the block where the events from the smart contracts are reflected gets completed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type CreateSubscriptionMultiTokenTransferEvent = {
/**
* The blockchain on which events should be monitored.
*/
chain: 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BSC';
chain: 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BSC' | 'FLR';
/**
* The URL of the endpoint where an HTTP POST request will be sent when the block where the events from the smart contracts are reflected gets completed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type CreateSubscriptionNftTransferEvent = {
/**
* The blockchain on which events should be monitored.
*/
chain: 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BSC';
chain: 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BSC' | 'FLR';
/**
* The URL of the endpoint where an HTTP POST request will be sent when the block where the events from the smart contracts are reflected gets completed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type CreateSubscriptionNotification = {
/**
* Blockchain of the address.
*/
chain: 'SOL' | 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BTC' | 'LTC' | 'BCH' | 'DOGE' | 'TRON' | 'BSC';
chain: 'SOL' | 'ETH' | 'MATIC' | 'CELO' | 'KLAY' | 'BTC' | 'LTC' | 'BCH' | 'DOGE' | 'TRON' | 'BSC' | 'FLR';
/**
* URL of the endpoint, where HTTP POST request will be sent, when transaction is detected on the address.
*/
Expand Down
62 changes: 0 additions & 62 deletions packages/api-client/src/generated/models/FlareTxInternal.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type TransferFlareBlockchain = {
/**
* Currency to transfer from Flare Blockchain Account.
*/
currency: 'Flare';
currency: 'FLR';
/**
* Custom defined fee. If not present, it will be calculated automatically.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type TransferFlareBlockchainKMS = {
/**
* Currency to transfer from Flare Blockchain Account.
*/
currency: 'Flare';
currency: 'FLR';
/**
* Custom defined fee. If not present, it will be calculated automatically.
*/
Expand Down
29 changes: 29 additions & 0 deletions packages/api-client/src/generated/models/Utxo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { ChainUtxoEnum } from './ChainUtxoEnum';

export type Utxo = {
chain: ChainUtxoEnum;
/**
* Address of the UTXO
*/
address: string;
/**
* Hash of the transaction this UTXO is present in
*/
txHash: string;
/**
* Index of the UTXO in the transaction
*/
index: number;
/**
* Value of the UTXO, in BTC, LTC or DOGE.
*/
value: number;
/**
* String representation of the value of the UTXO, in BTC, LTC or DOGE.
*/
valueAsString: string;
}
36 changes: 36 additions & 0 deletions packages/api-client/src/generated/services/BitcoinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { BroadcastKMS } from '../models/BroadcastKMS';
import type { BtcBasedBalance } from '../models/BtcBasedBalance';
import type { BtcBlock } from '../models/BtcBlock';
import type { BtcBlockHash } from '../models/BtcBlockHash';
import type { BtcGetTxByAddressBatch } from '../models/BtcGetTxByAddressBatch';
import type { BtcInfo } from '../models/BtcInfo';
import type { BtcTransactionFromAddress } from '../models/BtcTransactionFromAddress';
import type { BtcTransactionFromAddressKMS } from '../models/BtcTransactionFromAddressKMS';
Expand Down Expand Up @@ -265,6 +266,41 @@ export class BitcoinService {
});
}

/**
* Get transactions for multiple Bitcoin addresses in a batch
* <p><b>1 credit per address for each API call</b></p>
* <p>Retrieve transactions for multiple Bitcoin addresses in a batch.</p>
*
* @param requestBody
* @returns any OK
* @throws ApiError
*/
public static btcGetTxByAddressBatch(
requestBody?: BtcGetTxByAddressBatch,
): CancelablePromise<Array<{
/**
* Address
*/
address?: string;
/**
* Transactions for address.
*/
transactions?: Array<BtcTx>;
}>> {
return __request({
method: 'POST',
path: `/v3/bitcoin/transaction/address/batch`,
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 perform the required operation due to a logical error or invalid permissions.`,
500: `Internal server error. There was an error on the server while processing the request.`,
},
});
}

/**
* Send BTC to Bitcoin addresses
* <p><b>2 credits per API call</b></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export class BlockchainFeesService {
* Estimate the fee for a KuCoin Community Chain transaction
* <p><b>2 credits per API call</b></p>
* <p>Get an estimated gas price and the number of gas units needed for a Flare transaction.</p>
* <p style="border:4px solid DeepSkyBlue;"><b>NOTE:</b> The estimated gas price is returned in <b>wei</b>. However, when <a href="https://apidoc.tatum.io/tag/KuCoin#operation/FlareBlockchainTransfer" target="_blank">making the transaction itself</a> and providing the custom fee, you have to provide the gas price in <b>Gwei</b>. Make sure to convert the estimated gas price from wei to Gwei before submitting your transaction.</p>
* <p style="border:4px solid DeepSkyBlue;"><b>NOTE:</b> The estimated gas price is returned in <b>wei</b>. However, when <a href="https://apidoc.tatum.io/tag/Flare#operation/FlareBlockchainTransfer" target="_blank">making the transaction itself</a> and providing the custom fee, you have to provide the gas price in <b>Gwei</b>. Make sure to convert the estimated gas price from wei to Gwei before submitting your transaction.</p>
*
* @param requestBody
* @returns GasEstimated OK
Expand Down
86 changes: 63 additions & 23 deletions packages/api-client/src/generated/services/DataApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type { TokenIds } from '../models/TokenIds';
import type { TokenTezos } from '../models/TokenTezos';
import type { TokenType } from '../models/TokenType';
import type { TxData } from '../models/TxData';
import type { Utxo } from '../models/Utxo';
import type { CancelablePromise } from '../core/CancelablePromise';
import { request as __request } from '../core/request';

Expand Down Expand Up @@ -711,44 +712,83 @@ export class DataApiService {
* @param chain The blockchain to work with.
* @param address The blockchain address.
* @param totalValue The total amount of transaction you want to send. Only UTXOs up to this amount will be returned, so you will not spend more than you need.
* @returns any OK
* @returns Utxo OK
* @throws ApiError
*/
public static getUtxosByAddress(
chain: ChainUtxoEnum,
address: string,
totalValue: number,
): CancelablePromise<Array<Utxo>> {
return __request({
method: 'GET',
path: `/v3/data/utxos`,
query: {
'chain': chain,
'address': address,
'totalValue': totalValue,
},
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.`,
},
});
}

/**
* Get unspent UTXOs for a batch of addresses
* <p><b>100 credits per address for each API call.</b></p>
* <p>Retrieve unspent UTXOs for each provided address, up to a specified total amount.
* If you want to prepare a transaction on UTXO-based chains like Bitcoin, you need to enter unspent UTXOs to be able to perform a transaction. By providing ```totalValue``` as a total, our API will return a list of UTXOs that will be enough to cover the transaction.</p>
* Our API lets you get the unpenst UTXOs for a specific address on:</p>
* <ul>
* <li>Bitcoin - bitcoin / bitcoin-testnet</li>
* <li>Litecoin - litecoin / litecoin-testnet</li>
* <li>Dogecoin - doge / doge-testnet</li>
* <li>Cardano - cardano / cardano-preprod</li>
* </ul>
* <p>To get started:</p>
* <ul>
* <li>Provide a chain and addresses you want to list unspent UTXOs for. If available, our API will return information about the unspent UTXOs for each address. API traverses latest 200k incoming transactions.</li>
* </ul>
*
* @param requestBody
* @returns any OK
* @throws ApiError
*/
public static getUtxosByAddressBatch(
requestBody: {
chain?: ChainUtxoEnum;
/**
* Addresses
*/
addresses: Array<string>;
/**
* The total amount of transaction you want to send. Only UTXOs up to this amount will be returned, so you will not spend more than you need.
*/
totalValue: number;
},
): CancelablePromise<Array<{
chain: ChainUtxoEnum;
/**
* Address of the UTXO
* The blockchain address.
*/
address: string;
address?: string;
/**
* Hash of the transaction this UTXO is present in
* UTXOs up to amount for address.
*/
txHash: string;
utxos?: Array<Utxo>;
/**
* Index of the UTXO in the transaction
* Indicate whether the total value of UTXOs is sufficient for the transaction.
*/
index: number;
/**
* Value of the UTXO, in BTC, LTC or DOGE.
*/
value: number;
/**
* String representation of the value of the UTXO, in BTC, LTC or DOGE.
*/
valueAsString: string;
transactionPossible?: boolean;
}>> {
return __request({
method: 'GET',
path: `/v3/data/utxos`,
query: {
'chain': chain,
'address': address,
'totalValue': totalValue,
},
method: 'POST',
path: `/v3/data/utxos/batch`,
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.`,
Expand Down
Loading

0 comments on commit 178219b

Please sign in to comment.