Address page with QR code
This commit is contained in:
@@ -13,4 +13,7 @@ export interface AbstractBitcoinApi {
|
||||
getBlockTransactionsFromIndex(hash: string, index: number): Promise<IBlock>;
|
||||
getBlocks(): Promise<string>;
|
||||
getBlocksFromHeight(height: number): Promise<string>;
|
||||
getAddress(address: string): Promise<IBlock>;
|
||||
getAddressTransactions(address: string): Promise<IBlock>;
|
||||
getAddressTransactionsFromLastSeenTxid(address: string, lastSeenTxid: string): Promise<IBlock>;
|
||||
}
|
||||
|
||||
@@ -84,22 +84,27 @@ class BitcoindApi implements AbstractBitcoinApi {
|
||||
getBlock(hash: string): Promise<IBlock> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
getBlocks(): Promise<string> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
getBlocksFromHeight(height: number): Promise<string> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
getBlockTransactions(hash: string): Promise<IBlock> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
getBlockTransactionsFromIndex(hash: string, index: number): Promise<IBlock> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getAddress(address: string): Promise<IBlock> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getAddressTransactions(address: string): Promise<IBlock> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getAddressTransactionsFromLastSeenTxid(address: string, lastSeenTxid: string): Promise<IBlock> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export default BitcoindApi;
|
||||
|
||||
@@ -149,6 +149,39 @@ class EsploraApi implements AbstractBitcoinApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAddress(address: string): Promise<IBlock> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const blockInfo: AxiosResponse = await this.client.get('/address/' + address);
|
||||
resolve(blockInfo.data);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAddressTransactions(address: string): Promise<IBlock> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const blockInfo: AxiosResponse = await this.client.get('/address/' + address + '/txs');
|
||||
resolve(blockInfo.data);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAddressTransactionsFromLastSeenTxid(address: string, lastSeenTxid: string): Promise<IBlock> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const blockInfo: AxiosResponse = await this.client.get('/address/' + address + '/txs/chain/' + lastSeenTxid);
|
||||
resolve(blockInfo.data);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default EsploraApi;
|
||||
|
||||
Reference in New Issue
Block a user