@@ -17,7 +17,7 @@ export interface AccountTransactionsResult {
1717 marker ?: any
1818}
1919
20- const getAccountTransactions = (
20+ const getAccountTransactions = async (
2121 account : string ,
2222 currency : string | undefined ,
2323 marker : any ,
@@ -62,35 +62,39 @@ const getAccountTransactions = (
6262 }
6363
6464 log . info ( `get transactions: ${ account } -> ${ classicAddress } ` )
65- return getAccountTxs ( rippledSocket , classicAddress , limit , marker )
66- . then ( ( data ) => {
67- const transactions = data . transactions
68- . map ( ( tx : any ) => {
69- const txn = formatTransaction ( tx )
70- return summarize ( txn , true )
71- } )
72- . filter ( ( tx : any ) => {
73- // No filter - return all transactions
74- if ( ! currency ) {
75- return true
76- }
65+ try {
66+ const data = await getAccountTxs (
67+ rippledSocket ,
68+ classicAddress ,
69+ limit ,
70+ marker ,
71+ )
72+ const transactions = data . transactions
73+ . map ( ( tx : any ) => {
74+ const txn = formatTransaction ( tx )
75+ return summarize ( txn , true )
76+ } )
77+ . filter ( ( tx : any ) => {
78+ // No filter - return all transactions
79+ if ( ! currency ) {
80+ return true
81+ }
7782
78- // Filter by currency (IOU) or MPT issuance ID (passed as currency)
79- const txString = JSON . stringify ( tx )
80- return (
81- txString . includes ( `"currency":"${ currency . toUpperCase ( ) } "` ) ||
82- txString . includes ( `"${ currency } "` )
83- )
84- } )
85- return {
86- transactions,
87- marker : data . marker ,
88- }
89- } )
90- . catch ( ( error : any ) => {
91- log . error ( error . toString ( ) )
92- throw error
93- } )
83+ // Filter by currency (IOU) or MPT issuance ID (passed as currency)
84+ const txString = JSON . stringify ( tx )
85+ return (
86+ txString . includes ( `"currency":"${ currency . toUpperCase ( ) } "` ) ||
87+ txString . includes ( `"${ currency } "` )
88+ )
89+ } )
90+ return {
91+ transactions,
92+ marker : data . marker ,
93+ }
94+ } catch ( error : any ) {
95+ log . error ( error . toString ( ) )
96+ throw error
97+ }
9498}
9599
96100export default getAccountTransactions
0 commit comments