Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 4 additions & 34 deletions content/evm/indexer-providers/moralis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class SeiMoralisService {
async initialize() {
if (!this.initialized) {
await Moralis.start({
apiKey: process.env.MORALIS_API_KEY!
apiKey: process.env.MORALIS_API_KEY
});
this.initialized = true;
console.log('Moralis initialized for Sei blockchain');
Expand All @@ -288,19 +288,15 @@ class SeiMoralisService {

try {
// Get all wallet data in parallel
const [transactions, nfts, tokenBalances, tokenTransfers] = await Promise.all([this.getWalletTransactions(walletAddress), this.getWalletNFTs(walletAddress), this.getTokenBalances(walletAddress), this.getTokenTransfers(walletAddress)]);
const [nfts, tokenBalances] = await Promise.all([this.getWalletNFTs(walletAddress), this.getTokenBalances(walletAddress)]);

return {
address: walletAddress,
transactions: transactions.result,
nfts: nfts.result,
tokenBalances: tokenBalances,
tokenTransfers: tokenTransfers.result,
summary: {
totalTransactions: transactions.total,
totalNFTs: nfts.total,
totalTokenTypes: tokenBalances.length,
totalTransfers: tokenTransfers.total
totalNFTs: nfts,
totalTokenTypes: tokenBalances.length
}
};
} catch (error) {
Expand All @@ -309,18 +305,6 @@ class SeiMoralisService {
}
}

async getWalletTransactions(walletAddress: string, options = {}) {
const defaultOptions = {
chain: '0x531',
...options
};

return await Moralis.EvmApi.transaction.getWalletTransactions({
address: walletAddress,
...defaultOptions
});
}

async getWalletNFTs(walletAddress: string) {
return await Moralis.EvmApi.nft.getWalletNFTs({
address: walletAddress,
Expand All @@ -335,20 +319,6 @@ class SeiMoralisService {
});
return response.raw;
}

async getTokenTransfers(walletAddress: string) {
return await Moralis.EvmApi.token.getWalletTokenTransfers({
address: walletAddress,
chain: '0x531'
});
}

async getTransactionDetails(txHash: string) {
return await Moralis.EvmApi.transaction.getTransactionVerbose({
transactionHash: txHash,
chain: '0x531'
});
}
}

// Usage example
Expand Down
Loading