-
Notifications
You must be signed in to change notification settings - Fork 324
OPDATA-3674: Add totalBalance endpoint to avalanche-platform EA #4038
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 418f22d The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f05fd2f
to
88745c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this might be close enough to balance that we can just add a new parameter to?
getBalance(address: string): Promise<GetBalanceResult> { | ||
return this.callPlatformMethod({ | ||
method: 'getBalance', | ||
address, | ||
}) | ||
} | ||
|
||
async getStake(address: string): Promise<GetStakeResult> { | ||
return this.callPlatformMethod({ | ||
method: 'getStake', | ||
address, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel we need these two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like this?
I'm not convinced this is an improvement.
It's the same number of lines of code but now in a single longer function.
I think we can probably just delete the existing endpoint. Right now I'd rather not introduce unnecessary complexity for something that's not used. |
https://smartcontract-it.atlassian.net/browse/OPDATA-3674
Description
We need total balance for a list of Avalanche addresses for a proof-of-reserves feed.
Some of these addresses are P-chain addresses.
The
avalanche-platform
EA already interacts with Avalanche P-chain, although it currently doesn't appear to be used by anything.Unfortunately its existing
balance
endpoint only returns the stake of the requested addresses.This PR adds a new
totalBalance
endpoint which returns the sum of locked and unlocked balances and stake.Balances are for a specific asset, which defaults to the asset ID of the native AVA token, but can be set to something else as well.
Changes
totalBalance
.Steps to Test
proof-of-reserves
in another branch with other necessary changes inpor-address-list
.Quality Assurance
infra-k8s
configuration file.adapter-secrets
configuration file or update the soak testing blacklist.test-payload.json
file with relevant requests.feature/x
,chore/x
,release/x
,hotfix/x
,fix/x
) or is created from Jira.