Expand your realtime crypto wallet by integrating a dynamic feed of onchain activity.
Show all onchain activity for a wallet address in the 'Activity' tab of our app.
getWalletActivity
async function to our server.js
file to fetch activity data from Sim APIs.
/v1/evm/activity/{address}
endpoint, adding the limit
as a query parameter.
The Activity API conveniently packages the transaction data within an activity
array in the response.
The array provides rich context for each event, such as block_time
, transaction_hash
, from
and to
addresses, value
, value_usd
, and more.
offset
and limit
query parameters. For a production wallet, you might implement infinite scrolling or “Load More” buttons to fetch subsequent pages of activity.app.get('/')
route handler, add a call to getWalletActivity
, and include its results in the data passed to res.render
.
app.get('/')
route handler now handles fetching of both token balances and wallet activity.
Both the tokens
and the newly fetched activities
arrays are then passed to the res.render
method.
This makes the complete dataset available to our wallet.ejs
template, enabling it to populate both the “Tokens” and “Activity” tabs with relevant, realtime onchain information.
views/wallet.ejs
template to render the fetched activity data within the “Activity” tab.
CTRL+F for id="activity"
and locate the section for the Activity tab.
It currently contains a placeholder paragraph.
Replace that entire div
with the following EJS code:
activity.type
(and activity.function.name
for contract calls).block_time
) is converted to a readable local date/time string.chain_id
) is displayed, providing important multichain context.value
) is converted into a user-friendly decimal format (e.g., “1.5 ETH”). This conversion utilizes the decimals
property from token_metadata
.token_id
.value_usd
), if provided by the API, is formatted to two decimal places and shown, giving a sense of the transaction’s monetary worth.node server.js
and refresh the app in the browser.
When you click on the Activity tab, you should now see a list of the latest transactions, similar to the screenshot at the beginning of this guide.