-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Pusher-Labs/implement-missing-btc-items
Implement missing btc items
- Loading branch information
Showing
14 changed files
with
43,431 additions
and
34,270 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { BtcAddressDTO, Transactions, RawTxsBTC, ChainStatsBtc } from './types/blockchair-api-types'; | ||
/** | ||
* https://blockchair.com/api/docs#link_200 | ||
* @param chain | ||
* @param hash | ||
*/ | ||
export declare const getTx: (baseUrl: string, hash: string, apiKey?: string | undefined) => Promise<Transactions>; | ||
/** | ||
* https://blockchair.com/api/docs#link_201 | ||
* @param chain | ||
* @param hash | ||
*/ | ||
export declare const getRawTx: (baseUrl: string, hash: string, apiKey?: string | undefined) => Promise<RawTxsBTC>; | ||
/** | ||
* https://blockchair.com/api/docs#link_300 | ||
* @param chain | ||
* @param address | ||
*/ | ||
export declare const getAddress: (baseUrl: string, address: string, apiKey?: string | undefined, limit?: number | undefined, offset?: number | undefined) => Promise<BtcAddressDTO>; | ||
/** | ||
* https://blockchair.com/api/docs#link_202 | ||
* @param chain | ||
* @param txHex | ||
*/ | ||
export declare const broadcastTx: (baseUrl: string, txHex: string, apiKey?: string | undefined) => Promise<string>; | ||
/** | ||
* https://blockchair.com/api/docs#link_001 | ||
* @param chain | ||
*/ | ||
export declare const bitcoinStats: (baseUrl: string, apiKey?: string | undefined) => Promise<ChainStatsBtc>; |
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,53 +1,48 @@ | ||
import * as Bitcoin from 'bitcoinjs-lib'; | ||
import * as Utils from './utils'; | ||
import { Txs } from './types/electrs-api-types'; | ||
import { FeeOptions } from './types/client-types'; | ||
import { AsgardexClient, TxParams } from '@asgardex-clients/core'; | ||
import { TxHistoryParams, TxsPage, Address, AsgardexClient, TxParams, TxHash, Balance, Network, Fees, AsgardexClientParams } from '@asgardex-clients/asgardex-client'; | ||
/** | ||
* Class variables accessed across functions | ||
*/ | ||
declare enum Network { | ||
TEST = "testnet", | ||
MAIN = "mainnet" | ||
} | ||
/** | ||
* BitcoinClient Interface. Potentially to become AsgardClient | ||
* BitcoinClient Interface | ||
*/ | ||
interface BitcoinClient { | ||
purgeClient(): void; | ||
setNetwork(net: Network): void; | ||
getNetwork(net: Network): Bitcoin.networks.Network; | ||
setBaseUrl(endpoint: string): void; | ||
getAddress(): string; | ||
validateAddress(address: string): boolean; | ||
scanUTXOs(): Promise<void>; | ||
calcFees(addressTo: string, memo?: string): Promise<FeeOptions>; | ||
} | ||
declare type BitcoinClientParams = AsgardexClientParams & { | ||
nodeUrl?: string; | ||
nodeApiKey?: string; | ||
}; | ||
/** | ||
* Implements Client declared above | ||
*/ | ||
declare class Client implements BitcoinClient, AsgardexClient { | ||
net: Network; | ||
phrase: string; | ||
electrsAPI: string; | ||
utxos: Utils.UTXO[]; | ||
constructor(_net?: Network, _electrsAPI?: string, _phrase?: string); | ||
nodeUrl: string; | ||
nodeApiKey: string; | ||
constructor({ network, nodeUrl, nodeApiKey, phrase }: BitcoinClientParams); | ||
setNodeURL(url: string): void; | ||
setNodeAPIKey(key: string): void; | ||
generatePhrase: () => string; | ||
setPhrase: (phrase?: string | undefined) => void; | ||
setPhrase: (phrase: string) => Address; | ||
purgeClient: () => void; | ||
setNetwork(_net: Network): void; | ||
getNetwork(net: Network): Bitcoin.networks.Network; | ||
setBaseUrl(endpoint: string): void; | ||
getExplorerUrl: () => string; | ||
getAddress: () => string; | ||
getNetwork(): Network; | ||
getExplorerAddressUrl(address: Address): string; | ||
getExplorerTxUrl(txID: string): string; | ||
getAddress: () => Address; | ||
private getBtcKeys; | ||
validateAddress: (address: string) => boolean; | ||
scanUTXOs: () => Promise<void>; | ||
getBalance: () => Promise<number>; | ||
getBalanceForAddress: (address: string) => Promise<number>; | ||
getBalance: (address?: string | undefined) => Promise<Balance[]>; | ||
private getChange; | ||
getTransactions: (address: string) => Promise<Txs>; | ||
calcFees: (memo?: string | undefined) => Promise<FeeOptions>; | ||
transfer: ({ amount, recipient, memo, feeRate }: TxParams) => Promise<string>; | ||
getTransactions: (params?: TxHistoryParams | undefined) => Promise<TxsPage>; | ||
/** | ||
* getFees | ||
*/ | ||
getFees(): Promise<Fees>; | ||
getFeesWithMemo(memo: string): Promise<Fees>; | ||
deposit({ asset, amount, recipient, memo, feeRate }: TxParams): Promise<TxHash>; | ||
transfer({ asset, amount, recipient, memo, feeRate }: TxParams): Promise<TxHash>; | ||
} | ||
export { Client, Network }; |
Oops, something went wrong.