This Rust application provides a simple API for managing stake delegators in NEAR protocol.
- GET Endpoint: The
/get-staking-pools
endpoint returns information about delegators in a JSON format.
Example:
http https://near-delegators-api.fly.dev/get-staking-pools
{
"timestamp": 1709599033,
"delegator_staking_pools": {
"frol.near": [
"qbit.poolv1.near"
],
"frolik.near": [
"astro-stakers.poolv1.near",
"bisontrails2.poolv1.near",
"linear-protocol.near",
"qbit.poolv1.near",
"staked.poolv1.near",
"zavodil.poolv1.near"
],
...
}
}
- GET Endpoint: The
/get-staking-pools/<account-id>
endpoint returns information about all validators for specified delegator.
Example:
http https://near-delegators-api.fly.dev/get-staking-pools/frolik.near
{
"delegator_staking_pools": [
"astro-stakers.poolv1.near",
"bisontrails2.poolv1.near",
"linear-protocol.near",
"qbit.poolv1.near",
"staked.poolv1.near",
"zavodil.poolv1.near"
],
"timestamp": 1709599415
}
- POST Endpoint: The
/update-staking-pools
endpoint allows for the update of delegator information.
Firstly, you need to create an account and authenticate:
fly auth
Then simply run launch command:
To ensure high availability, especially for production apps, fly.io strongly recommend running at least 2 machines. You can scale up the number of machines using the fly scale command in the CLI. Check out the documentation for more details.
Use show command to view current resources:
fly scale show
And count command to scale your app:
fly scale count 2
In case you want to redeploy application:
fly deploy
You also can view logs via cli or fly.io dashboard:
fly logs -a near-delegators-api
The application logs requests and errors using the pretty_env_logger
crate and provides timestamped logs in a readable format.
The API will be accessible at generated fly.io link.
You can either call webhook by yourself or use Pagoda Console to send POST request to the deployed application if new successful action happens on target *.poolv1.near
Here's a suggested configuration:
Feel free to customize and extend the functionality based on your specific use case.