-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samuel Sramko
committed
Oct 12, 2021
1 parent
a92b208
commit 9ccfbb8
Showing
5 changed files
with
372 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,36 @@ | ||
import BigNumber from 'bignumber.js' | ||
import {get, post} from '../connector/tatum' | ||
import {TransactionHash} from '../model' | ||
import {get, post} from '../connector/tatum'; | ||
|
||
export const flowBroadcast = async (txData: string, signatureId?: string): Promise<TransactionHash> => post(`/v3/flow/broadcast`, { | ||
txData, | ||
signatureId | ||
}) | ||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/FlowSign" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const flowSignWithKey = async (data: string, isPayer: boolean): Promise<{ signature: string }> => | ||
post('/v3/flow/sign', {data, isPayer}); | ||
|
||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/FlowGetSignKey" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const flowGetSignKey = async (isPayer: boolean): Promise<{ keyId: number, address: string }> => | ||
get(`/v3/flow/proposal/${isPayer}`); | ||
|
||
// TODO: return types for FLOW | ||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/FlowGetCurrentBlock" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const flowGetCurrentBlock = async (): Promise<number> => get(`/v3/flow/block/current`) | ||
export const flowGetCurrentBlock = async (): Promise<number> => get(`/v3/flow/block/current`); | ||
|
||
export const flowBroadcastTx = async (txData: string, proposalKey?: number) => post('/v3/flow/broadcast', {txData, proposalKey}); | ||
|
||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/FlowGetBlock" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const flowGetBlock = async (hash: string): Promise<any> => get(`/v3/flow/block/${hash}`) | ||
export const flowGetBlock = async (hash: string): Promise<any> => get(`/v3/flow/block/${hash}`); | ||
|
||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/FlowGetAccount" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const flowGetAccount = async (address: string): Promise<any> => { | ||
const {data} = await get(`/v3/flow/account/${address}`) | ||
return {flow: new BigNumber(data.flow), cUsd: new BigNumber(data.cUsd)} | ||
} | ||
export const flowGetAccount = async (address: string): Promise<any> => get(`/v3/flow/account/${address}`); | ||
|
||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/FlowGetTransaction" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const flowGetTransaction = async (hash: string): Promise<any> => get(`/v3/flow/transaction/${hash}`) | ||
export const flowGetTransaction = async (hash: string): Promise<any> => get(`/v3/flow/transaction/${hash}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.