Explorer
Get Portfolio Activity
Learn how to retrieve a user's portfolio activity using the Okto SDK.
The getPortfolioActivity
function retrieves the user's recent portfolio activity and transactions.
Example
import { useOkto } from '@okto_web3/react-native-sdk';
import { getPortfolioActivity } from '@okto_web3/react-native-sdk';
import { View, Text, Pressable } from 'react-native';
function PortfolioActivity() {
const oktoClient = useOkto();
async function fetchActivity() {
try {
const activity = await getPortfolioActivity(oktoClient);
console.log('Portfolio activity:', activity);
} catch (error) {
console.error('Error fetching activity:', error);
}
}
return (
<View>
<Pressable onPress={fetchActivity}>
<Text>Fetch Portfolio Activity</Text>
</Pressable>
</View>
);
}
Method Overview
Method | Description |
---|---|
async getPortfolioActivity | Get user's portfolio activity |
Get Portfolio Activity
async getPortfolioActivity(oktoClient: OktoClient)
retrieves the user's recent portfolio activity.
Parameters
Parameter | Type | Description |
---|---|---|
oktoClient | OktoClient | Instance of OktoClient obtained from useOkto hook |
Response
Success Response
Field Name | Type | Description |
---|---|---|
activity | Promise<ActivityData[]> | Array of portfolio activities |
Note
For error handling:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support