Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: starknet portfolio provider #595

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

milancermak
Copy link
Contributor

Relates to: N/A

Risks

Low. Only agents with this plugin enabled would be affected.

Background

What does this PR do?

Replaces the old not-quite-working Starknet wallet provider with a new (more aptly named) portfolio provider. Also cleans up some of the Starknet plugin code.

What kind of change is this?

Feature + refactor.

Why are we doing this? Any context or related work?

The old Starknet walletProvider.ts was based on the Solana one, but wasn't fully functioning. This new one is.

Because there's no free API that returns the whole portfolio of a wallet for Starknet, I'm using a whitelist of tokens (PORTFOLIO_TOKENS) and Coingecko API to get the USD prices. An alternative would be to use BlastAPI's Builder API -> getWalletTokenBalances but that would require additional setup (Blast API key).

The output of the new plugin is sth like this:

symbol  | balance              | USD value
==================================================
ETH      | 0.059468702404375927| 207.55
STRK     | 120                 | 72.62

Documentation changes needed?

None that I'm aware of since there's no docs for this plugin.

Testing

Where should a reviewer start?

Detailed testing steps

None, automtated tests are fine.

Discord username

milan3774

@milancermak milancermak changed the title Dev/starknet cleanup dev: starknet portfolio provider Nov 25, 2024
import { fetchWithRetry, getStarknetAccount } from "../utils";
import { ERC20Token } from "../utils/ERC20Token";

const CONFIG = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets move this to a tokens.ts file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved PORTFOLIO_TOKENS to the existing token.ts

Copy link
Contributor

@ponderingdemocritus ponderingdemocritus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! only one suggestion

@milancermak milancermak changed the title dev: starknet portfolio provider feat: starknet portfolio provider Nov 26, 2024
@lalalune lalalune merged commit 6cdd4b4 into elizaOS:main Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants