diff --git a/src/RPC/Wallet.ts b/src/RPC/Wallet.ts index 1fa9811..a098363 100644 --- a/src/RPC/Wallet.ts +++ b/src/RPC/Wallet.ts @@ -4,7 +4,7 @@ import { BalanceDetail } from '../contracts/balanceDetail'; import { CheckWallet } from '../contracts/checkwallet'; import { Output, RawTransaction } from '../contracts/rawTransaction'; import { Script } from '../contracts/script'; -import { Transaction } from '../contracts/transaction'; +import { DetailedRawTransaction, Transaction } from '../contracts/transaction'; import { RPCBase } from '../RPCBase'; import { Address, @@ -105,7 +105,7 @@ export class Wallet extends RPCBase { * @param {number} amount - Amount to be burned down * @param {string} [hexString] * @returns {Promise} - * @memberof GridcoinRPC + * @memberof Wallet */ public async burn(amount: number, hexString?: Hex): Promise { return this.call('burn', amount, hexString); @@ -122,7 +122,7 @@ export class Wallet extends RPCBase { * and nBalanceInQuestion showing the amount involved in those transactions (absolute value, does not subtract) * * @returns {Promise} - * @memberof GridcoinRPC + * @memberof Wallet */ public async checkWallet(): Promise { return this.call('checkwallet'); @@ -199,7 +199,7 @@ export class Wallet extends RPCBase { * * @param {string} gridcoinAddress * @returns {Promise} - an account name - * @memberof GridcoinRPC + * @memberof Wallet */ public async getAccount(gridcoinAddress: Address): Promise { return this.call('getaccount', gridcoinAddress); @@ -212,7 +212,7 @@ export class Wallet extends RPCBase { * * @param {string} account - an account name * @returns {Promise
} - GRC address - * @memberof GridcoinRPC + * @memberof Wallet */ public async getAccountAddress(account: string): Promise
{ return this.call
('getaccountaddress', account); @@ -223,7 +223,7 @@ export class Wallet extends RPCBase { * * @param {string} account - the account name * @returns {Promise} - a list of addresses - * @memberof GridcoinRPC + * @memberof Wallet */ public async getAddressesByAccount(account: string): Promise { return this.call('getaddressesbyaccount', account); @@ -274,7 +274,7 @@ export class Wallet extends RPCBase { * * @param {string} [account] * @returns {Promise} - * @memberof GridcoinRPC + * @memberof Wallet */ public async getNewAddress(account?: string): Promise
{ return this.call
('getnewaddress', account); @@ -306,11 +306,11 @@ export class Wallet extends RPCBase { * returns an Object with information about txid * * @param {TX} txid - * @returns {Promise} + * @returns {Promise} * @memberof Wallet */ - public async getRawTransactionVerbose(txid: TX): Promise { - return this.call('getrawtransaction', txid, true); + public async getRawTransactionVerbose(txid: TX): Promise { + return this.call('getrawtransaction', txid, true); } /** @@ -332,7 +332,7 @@ export class Wallet extends RPCBase { * @param {number} [minconf=1] - the minimum number of confirmations * @returns {Promise} - the number of coins received * @deprecated - * @memberof GridcoinRPC + * @memberof Wallet */ public getReceivedByAccount(account: string, minconf = 1): Promise { return this.call('getreceivedbyaccount', account, minconf); @@ -348,7 +348,7 @@ export class Wallet extends RPCBase { * @param {string} gridcoinAddress - the address * @param {number} [minconf=1] - the minimum number of confirmations * @returns {Promise} - the number of coins received - * @memberof GridcoinRPC + * @memberof Wallet */ public getReceivedByAddress( gridcoinAddress: string, @@ -356,4 +356,19 @@ export class Wallet extends RPCBase { ): Promise { return this.call('getreceivedbyaddress', gridcoinAddress, minconf); } + + /** + * Get detailed information about in-wallet transaction + * + * @param {TX} txid - The transaction id + * @param {boolean} [includeWatchOnly=false] - Whether to include watchonly addresses in balance calculation and details + * @returns {Promise} + * @memberof Wallet + */ + public getTransaction( + txid: TX, + includeWatchOnly = false, + ): Promise { + return this.call('gettransaction', txid, includeWatchOnly); + } } diff --git a/src/contracts/transaction.ts b/src/contracts/transaction.ts index a027c22..9b3e222 100644 --- a/src/contracts/transaction.ts +++ b/src/contracts/transaction.ts @@ -103,7 +103,6 @@ export interface Vout { } export interface Transaction { - hex?: string; /** * The transaction id * @@ -137,4 +136,10 @@ export interface Transaction { contracts: Contract[]; vin: Vin[]; vout: Vout[]; + blockhash: string; + confirmations: number; +} + +export interface DetailedRawTransaction extends Transaction { + hex: string; }