diff --git a/packages/wallet-lib/docs/account/getTransactionHistory.md b/packages/wallet-lib/docs/account/getTransactionHistory.md index 5bae3c55f9b..d8ab76c2b58 100644 --- a/packages/wallet-lib/docs/account/getTransactionHistory.md +++ b/packages/wallet-lib/docs/account/getTransactionHistory.md @@ -10,5 +10,23 @@ Returns : sorted and classified transaction history ```js const transactionHistory = account.getTransactionHistory(); -// -``` \ No newline at end of file + +/** + * [ + { + from: [ { address: 'ySBsUTdfKSzqg5SHDFa6SZLRFzbbaBsrMX' } ], + to: [{ + address: 'yUSaLsYdFxuuWxNJFEvoJNAcJk3KTotLpU', + satoshis: 3999989000 + } + ], + type: 'sent', + time: 1634325172, + txId: '97932c88eda0423578f26d32a0a1ba21b5792721f345c135bc8eb2cb4864184c', + blockHash: '000000f3a03c0c7c89dcd089f87edcb18bdd95051e85bc27e7de73666a071698', + isChainLocked: true, + isInstantLocked: true + } + ] + */ +``` diff --git a/packages/wallet-lib/src/types/Account/Account.d.ts b/packages/wallet-lib/src/types/Account/Account.d.ts index 1a38d8b18f9..5310566bc86 100644 --- a/packages/wallet-lib/src/types/Account/Account.d.ts +++ b/packages/wallet-lib/src/types/Account/Account.d.ts @@ -9,7 +9,7 @@ import { Strategy, Network, broadcastTransactionOpts, - Plugins, RawTransaction, TransactionsMap, WalletObj, StatusInfo + Plugins, RawTransaction, TransactionsMap, WalletObj, StatusInfo, TransactionsHistory } from "../types"; import { KeyChain } from "../KeyChain/KeyChain"; import { InstantLock } from "@dashevo/dashcore-lib"; @@ -62,6 +62,7 @@ export declare class Account { getPrivateKeys(addressList: [PublicAddress]): [PrivateKey]; getTotalBalance(displayDuffs?: boolean): number; getTransaction(txid: transactionId): Transaction; + getTransactionHistory(): TransactionsHistory; getTransactions(): [Transaction]; getUTXOS(): [UnspentOutput]; getUnconfirmedBalance(displayDuffs?: boolean): number; diff --git a/packages/wallet-lib/src/types/Account/methods/getTransactionHistory.js b/packages/wallet-lib/src/types/Account/methods/getTransactionHistory.js index 2faef228680..3118f363a65 100644 --- a/packages/wallet-lib/src/types/Account/methods/getTransactionHistory.js +++ b/packages/wallet-lib/src/types/Account/methods/getTransactionHistory.js @@ -11,9 +11,9 @@ const sortByHeightDescending = (a, b) => (b.height - a.height); /** * Get all the transaction history already formated - * @return {Promise} + * @return {TransactionsHistory} */ -async function getTransactionHistory() { +function getTransactionHistory() { const transactionHistory = []; const { diff --git a/packages/wallet-lib/src/types/types.d.ts b/packages/wallet-lib/src/types/types.d.ts index 9ac6291ec2d..103a3e8facb 100644 --- a/packages/wallet-lib/src/types/types.d.ts +++ b/packages/wallet-lib/src/types/types.d.ts @@ -42,14 +42,16 @@ export declare type TransactionHistory = T & { address: string, satoshis: number, }], - time: number, to: [{ address: string, satoshis: number }], type: TransactionHistoryType + time: number, txId: string, - blockHash: string + blockHash: string, + isChainLocked: boolean, + isInstantLocked: boolean } export declare type TransactionsHistory = [TransactionHistory]|[];