haven-core-js
Version:
The JS library containing the Haven crypto plus lightweight wallet functions
215 lines (194 loc) • 5.13 kB
text/typescript
export type HavenTicker = "XHV" | "XUSD" | "XBTC" | "XEUR" | "XAU" | "XAG" | "XCNY" | "XGBP" | "XAUD" | "XCHF"
export type AmountPerAsset = Record<HavenTicker, string>;
export type SerializedTransaction = {
fromAmount: string;
toAmount: string;
from_asset_type: HavenTicker;
to_asset_type: HavenTicker;
height: number;
timestamp: string;
mempool: boolean;
hash: string;
coinbase: boolean;
total_received:Record<HavenTicker, string>;
total_sent: Record<HavenTicker, string>;
}
export type HavenTransferParams = {
sending_amount: string
is_sweeping: boolean
payment_id_string?: string
from_address_string: string
to_address_string: string
sec_viewKey_string: string
sec_spendKey_string: string
pub_spendKey_string: string
nettype: number
memo_string?: string
from_asset_type: HavenTicker
to_asset_type: HavenTicker
priority: string
unlock_time: number
blockchain_height:number
pricing_record?:any,
get_unspent_outs_fn: (req: unknown, callBack: (errMessage: string | null, response: unknown) => void) => void
get_random_outs_fn: (req: unknown, callBack: (errMessage: string | null, response: unknown) => void) => void
submit_raw_tx_fn: (req: unknown, callBack: (errMessage: string | null, response: unknown) => void) => void
status_update_fn: (params: any) => void
error_fn: (params: any) => void
success_fn: (params: any) => void
}
export type HavenTransferResponse = {
mixin: number
total_sent: string
final_payment_id: string
tx_hash: string
tx_fee: string
tx_key: string
tx_pub_key: string
}
export type KeysFromMnemonic = {
sec_seed_string: string
mnemonic_language: string
address_string: string
pub_viewKey_string: string
sec_viewKey_string: string
pub_spendKey_string: string
sec_spendKey_string: string
}
export type FeeEstimationParams = {
use_per_byte_fee: boolean,
use_rct: boolean,
n_inputs: number,
mixin: number,
n_outputs: number,
extra_size: number,
bulletproof: boolean,
base_fee: number,
fee_quantization_mask: number,
priority: number,
fork_version: number,
clsag: boolean
}
export interface ApiRandomOutsResponse {
amount_outs: Array<AmountOuts>
}
export interface AmountOuts {
amount: string;
outputs: Array<RandomOut>;
}
export interface RandomOut {
asset_index: number;
global_index: number;
public_key: string;
rct: string;
}
export interface ApiUnspentOutsResponse {
amount: string;
fork_version: number;
new_address: boolean;
outputs: Array<UnspentOut>;
per_byte_fee: number;
status: string;
}
export interface UnspentOut {
amount: string;
asset_index: number;
asset_type: string;
global_index: number;
height: number;
index: number;
public_key: string;
rct: string;
spend_key_images: Array<string>
timestamp: number;
tx_hash: string;
tx_id: number;
tx_prefix_hash: string;
tx_pub_key: string;
}
export interface ApiAddressInfoResponse {
blockchain_height: number;
locked_funds: string;
new_address: boolean;
scanned_block_height: number;
scanned_block_timestamp: number;
scanned_height: number;
spent_outputs: Array<UnspentOut>;
start_height: number;
status: string;
total_received: Record<HavenTicker, string>;
total_received_unlocked: Record<HavenTicker, string>;
total_sent: Record<HavenTicker, string>;
}
export interface ApiAddressTxsResponse {
blockchain_height: number;
new_address: boolean;
scanned_block_height: number;
scanned_block_timestamp: number;
scanned_height: number;
start_height: number;
status: string;
total_received: Record<HavenTicker, string>;
total_received_unlocked: Record<HavenTicker, string>;
transactions: Array<TransactionEntryResponse>;
}
export interface TransactionEntryResponse {
coinbase: boolean;
from_asset_type: string;
hash: string;
height: number;
id: number;
mempool: boolean;
mixin: number;
payment_id: string;
timestamp: number;
to_asset_type: string;
total_received: Record<HavenTicker, string>;
total_sent: Record<HavenTicker, string>;
tx_pub_key: string;
}
export interface ApiTxResponse {
coinbase: boolean;
error: string;
fee: number;
from_asset_type: string;
mixin_no: number;
no_confirmations: number;
num_of_inputs: number;
num_of_outputs: number;
payment_id: string;
pub_key: string;
rct_type: number;
size: number;
status: string;
timestamp: number;
to_asset_type: string;
total_received: Record<HavenTicker, string>;
total_sent: Record<HavenTicker, string>;
hash: string;
tx_height: number;
tx_version: number;
xmr_inputs: number;
xmr_outputs: number;
}
export interface ApiVersionResponse {
api: number;
blockchain_height: number;
fork_version: number;
git_branch_name: string;
last_git_commit_date: string;
last_git_commit_hash: string;
monero_version_full: string;
network_type: number;
per_byte_fee: number;
testnet: boolean;
}
export interface ApiLoginResponse {
generated_locally: boolean;
new_address: boolean;
start_height: number;
status: string;
}
export interface ApiPingResponse {
status: string;
}