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(frontend): add sol api for balance #4032

Merged
merged 14 commits into from
Dec 20, 2024

Conversation

loki344
Copy link
Collaborator

@loki344 loki344 commented Dec 19, 2024

Note

please review #4033 first

Motivation

To abstract the fetching of solana related data we introduce the solana.api.ts. Similar to how bitcoin.api.ts.

Note that this endpoint from solana only returns the sol balance in the wallet.
https://solana.com/docs/rpc/http/getbalance

Changes

  • implement solana get balance api

Tests

Unit tests provided

@loki344 loki344 marked this pull request as ready for review December 19, 2024 17:11
@loki344 loki344 requested a review from a team as a code owner December 19, 2024 17:11
* RPC URLs
*/
export const SOLANA_RPC_HTTP_URL_MAINNET = `https://solana-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`;
export const SOLANA_RPC_HTTP_URL_TESTNET = 'https://api.testnet.solana.com';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there is no testnet url in the alchemy dashboard

@loki344
Copy link
Collaborator Author

loki344 commented Dec 19, 2024

please review #4033 first

@loki344 loki344 marked this pull request as draft December 19, 2024 17:21
@loki344 loki344 marked this pull request as ready for review December 19, 2024 18:33
…l-api-for-balance

# Conflicts:
#	src/frontend/src/sol/types/network.ts
network: SolanaNetworkType;
}): Promise<bigint> => {
assertNonNullish(address);
assertNonNullish(network);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the function params are not optional, I don't think we need these asserts.

If address and/or network can be nullish, then we can keep the respective asserts but we need to update the function types accordingly.

Copy link
Contributor

@DenysKarmazynDFINITY DenysKarmazynDFINITY left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@loki344 loki344 enabled auto-merge (squash) December 20, 2024 15:47
@loki344 loki344 merged commit f304ed2 into main Dec 20, 2024
22 checks passed
@loki344 loki344 deleted the feat(frontend)/add-sol-api-for-balance branch December 20, 2024 15:52
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.

2 participants