Skip to content

Instantly share code, notes, and snippets.

@Namaskar-1F64F
Created May 9, 2024 17:21
Show Gist options
  • Save Namaskar-1F64F/4d3df030c9d98eb2bac3547c0c59618f to your computer and use it in GitHub Desktop.
Save Namaskar-1F64F/4d3df030c9d98eb2bac3547c0c59618f to your computer and use it in GitHub Desktop.
ggpapi
{
"openapi": "3.1.0",
"info": {
"version": "1.0.0",
"title": "OpenAPI"
},
"components": {
"schemas": {},
"parameters": {}
},
"paths": {
"/bls/pop": {
"post": {
"tags": [
"BLS"
],
"summary": "Verify a BLS signature in the same format as the Avalanche node Proof of Possession.",
"operationId": "post_PopBLS",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"nodeID": {
"type": "string",
"description": "The node ID"
},
"nodePOP": {
"type": "object",
"properties": {
"publicKey": {
"type": "string",
"description": "The public key"
},
"proofOfPossession": {
"type": "string",
"description": "The proof of possession"
}
},
"required": [
"publicKey",
"proofOfPossession"
]
}
},
"required": [
"nodeID",
"nodePOP"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"valid": {
"type": "boolean",
"description": "Whether the signature is valid"
}
},
"required": [
"valid"
]
}
}
}
}
}
}
},
"/bls/verify": {
"post": {
"tags": [
"BLS"
],
"summary": "Verify a BLS signature",
"operationId": "post_VerifyBLS",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"pubKey": {
"type": "string",
"description": "The public key"
},
"signature": {
"type": "string",
"description": "The signature"
},
"message": {
"type": "string",
"description": "The message"
}
},
"required": [
"pubKey",
"signature",
"message"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"valid": {
"type": "boolean",
"description": "Whether the signature is valid"
}
},
"required": [
"valid"
]
}
}
}
}
}
}
},
"/bls/sign": {
"post": {
"tags": [
"BLS"
],
"summary": "Sign a message with a random BLS key. For testing.",
"operationId": "post_SignBLS",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The message to sign"
}
},
"required": [
"message"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"signature": {
"type": "string",
"description": "The signature"
},
"pubKey": {
"type": "string",
"description": "The public key"
},
"privKey": {
"type": "string",
"description": "The private key"
}
},
"required": [
"signature",
"pubKey",
"privKey"
]
}
}
}
}
}
}
},
"/prices/tj": {
"get": {
"tags": [
"Token Prices"
],
"summary": "Get the current token prices on Trader Joe XYZ",
"operationId": "get_TJTokenPrices",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"avaxUSDC": {
"type": "number",
"example": 35.0543
},
"avaxGGP": {
"type": "number",
"example": 0.33
},
"ggpUSDC": {
"type": "number",
"example": 11.589
}
},
"required": [
"avaxUSDC",
"avaxGGP",
"ggpUSDC"
]
}
}
}
}
}
}
},
"/ggAvax": {
"get": {
"tags": [
"Supply"
],
"summary": "Get the various amounts in the ggAVAX Liquid Staking pool",
"operationId": "get_ggAVAX",
"responses": {
"200": {
"description": "Successful response"
}
}
}
},
"/ggAvax/rewards": {
"get": {
"tags": [
"Supply"
],
"summary": "https://docs.stakingrewards.com/staking-data/sr-adapter/liquid-staking-lst",
"operationId": "get_StakingRewardsLST",
"responses": {
"200": {
"description": "Successful response"
}
}
}
},
"/ggpCirculatingSupply": {
"get": {
"tags": [
"Supply"
],
"summary": "Get the current circulating supply of GGP",
"operationId": "get_GGPCirculatingSupply",
"responses": {
"200": {
"description": "Successful response"
}
}
}
},
"/ggpTotalSupply": {
"get": {
"tags": [
"Supply"
],
"summary": "Get the current total supply of GGP",
"operationId": "get_GGPTotalSupply",
"responses": {
"200": {
"description": "Successful response"
}
}
}
},
"/contract": {
"get": {
"tags": [
"Contracts"
],
"summary": "Get the contract address and abi for a given contract name",
"operationId": "get_GetContract",
"parameters": [
{
"schema": {
"type": "string",
"description": "The name of the contract to get",
"example": "Staking"
},
"required": true,
"description": "The name of the contract to get",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"abi": {
"type": "object",
"properties": {}
}
},
"required": [
"address",
"abi"
]
}
}
}
}
}
}
},
"/stakers": {
"get": {
"tags": [
"Staking"
],
"summary": "Get all stakers",
"operationId": "get_GetStakers",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"stakers": {
"type": "array",
"items": {
"type": "object",
"properties": {}
}
}
},
"required": [
"stakers"
]
}
}
}
}
}
}
},
"/staker": {
"get": {
"tags": [
"Staking"
],
"summary": "Get a staker",
"operationId": "get_GetStaker",
"parameters": [
{
"schema": {
"type": "string",
"description": "Wallet address to check",
"example": "0xb794f5ea0ba39494ce839613fffba74279579268"
},
"required": true,
"description": "Wallet address to check",
"name": "address",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"staker": {
"type": "object",
"properties": {}
}
},
"required": [
"staker"
]
}
}
}
},
"404": {
"description": "Staker not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "staker not found"
}
},
"required": [
"error"
]
}
}
}
}
}
}
},
"/minipool/byStaker": {
"get": {
"tags": [
"Minipool"
],
"summary": "Get minipools by staker",
"operationId": "get_MinipoolsByStaker",
"parameters": [
{
"schema": {
"type": "string",
"description": "The staker address"
},
"required": true,
"description": "The staker address",
"name": "staker",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"minipools": {
"type": "array",
"items": {
"type": "object",
"properties": {}
}
}
},
"required": [
"minipools"
]
}
}
}
}
}
}
},
"/minipool/byNodeID": {
"get": {
"tags": [
"Minipool"
],
"summary": "Get minipool by nodeID.",
"operationId": "get_MinipoolByNodeID",
"parameters": [
{
"schema": {
"type": "string",
"description": "The nodeID"
},
"required": true,
"description": "The nodeID",
"name": "nodeID",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"minipools": {
"type": "array",
"items": {
"type": "object",
"properties": {}
},
"description": "List of minipools. Same output format as byStaker"
}
},
"required": [
"minipools"
]
}
}
}
}
}
}
},
"/validators": {
"get": {
"tags": [
"Staking"
],
"summary": "Get all currently active validators from Glacier API",
"operationId": "get_GetValidators",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"transactions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"txHash": {
"type": "string",
"example": "XQY73DSwd45XdqqYk3kkyhNyKUT8YDfWMbXJLWxJBiLf4g5oA"
},
"txType": {
"type": "string",
"example": "AddValidatorTx"
},
"estimatedReward": {
"type": "string",
"example": "33718924323"
},
"startTimestamp": {
"type": "number",
"example": 1701174574
},
"endTimestamp": {
"type": "number",
"example": 1708950574
},
"nodeId": {
"type": "string",
"example": "NodeID-LXpULpbU1A4AobEzCSBy6wYLEbogwsMK1"
},
"value": {
"type": "string",
"example": "2049485745177"
}
},
"required": [
"txHash",
"txType",
"estimatedReward",
"startTimestamp",
"endTimestamp",
"nodeId",
"value"
]
}
}
},
"required": [
"transactions"
]
}
}
}
}
}
}
},
"/rewards/byStake": {
"get": {
"tags": [
"Rewards"
],
"summary": "Calculate the rewards given ggpStaked and avaxStaked",
"operationId": "get_ByStake",
"parameters": [
{
"schema": {
"type": "string",
"description": "Amount of GGP Staked.",
"example": 350
},
"required": true,
"description": "Amount of GGP Staked.",
"name": "ggpStaked",
"in": "query"
},
{
"schema": {
"type": "string",
"description": "Amount of AVAX Staked.",
"example": 1000
},
"required": true,
"description": "Amount of AVAX Staked.",
"name": "avaxStaked",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ggpReward": {
"type": "number",
"example": 30
},
"apy": {
"type": "number",
"example": 15
}
},
"required": [
"ggpReward",
"apy"
]
}
}
}
}
}
}
},
"/rewards/byAddress": {
"get": {
"tags": [
"Rewards"
],
"summary": "Calculate the rewards given an address.",
"operationId": "get_ByAddress",
"parameters": [
{
"schema": {
"type": "string",
"description": "Wallet address to check",
"example": "0xb794f5ea0ba39494ce839613fffba74279579268"
},
"required": true,
"description": "Wallet address to check",
"name": "address",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ggpReward": {
"type": "number",
"example": 30
},
"apy": {
"type": "number",
"example": 15
}
},
"required": [
"ggpReward",
"apy"
]
}
}
}
}
}
}
},
"/eligibility": {
"get": {
"tags": [
"Rewards"
],
"summary": "Check if an address is eligible for rewards in the current cycle",
"operationId": "get_CheckEligibility",
"parameters": [
{
"schema": {
"type": "string",
"description": "Wallet address to check",
"example": "0xb794f5ea0ba39494ce839613fffba74279579268"
},
"required": true,
"description": "Wallet address to check",
"name": "address",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"isEligible": {
"type": "string",
"example": "eligible"
},
"stakerStartTime": {
"type": "number",
"example": 1683048253
},
"collatRatio": {
"type": "number",
"example": 1.445493049548
},
"highWater": {
"type": "number",
"example": 2004.28347293
}
},
"required": [
"isEligible",
"stakerStartTime",
"collatRatio",
"highWater"
]
}
}
}
}
}
}
},
"/prices": {
"get": {
"tags": [
"Token Prices"
],
"summary": "Get the current token prices",
"operationId": "get_TokenPrices",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ggpInAVAX": {
"type": "number",
"example": 0.3083
},
"avaxInUSD": {
"type": "number",
"example": 35.01
},
"ggpInUSD": {
"type": "number",
"example": 11.69
},
"avaxPriceinTJUSDC": {
"type": "number",
"example": 35.0543
}
},
"required": [
"ggpInAVAX",
"avaxInUSD",
"ggpInUSD",
"avaxPriceinTJUSDC"
]
}
}
}
}
}
}
},
"/nodeOpSpread": {
"get": {
"tags": [
"Node Op Spread"
],
"summary": "Returns min/max spread of rewards and apr for node operators at current ggpPriceInAVAX",
"operationId": "get_NodeOpSpread",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"min": {
"type": "object",
"properties": {
"ggpReward": {
"type": "number",
"example": 69
},
"apy": {
"type": "number",
"example": 16.9
}
},
"required": [
"ggpReward",
"apy"
]
},
"max": {
"type": "object",
"properties": {
"ggpReward": {
"type": "number",
"example": 420
},
"apy": {
"type": "number",
"example": 42
}
},
"required": [
"ggpReward",
"apy"
]
}
},
"required": [
"min",
"max"
]
}
}
}
}
}
}
},
"/metrics": {
"get": {
"tags": [
"Metrics"
],
"summary": "Get the current metrics",
"operationId": "get_Metrics",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ggavax_apy": {
"type": "number",
"example": 0.5
},
"total_assets": {
"type": "number",
"example": 0.5
},
"minipools_status_staking": {
"type": "number",
"example": 0.5
},
"staking_total_assets": {
"type": "number",
"example": 0.5
},
"total_ggp_stake": {
"type": "number",
"example": 0.5
},
"rewards_eligibility_min_seconds": {
"type": "number",
"example": 0.5
},
"rewards_cycle_start_time": {
"type": "number",
"example": 0.5
}
},
"required": [
"ggavax_apy",
"total_assets",
"minipools_status_staking",
"staking_total_assets",
"total_ggp_stake",
"rewards_eligibility_min_seconds",
"rewards_cycle_start_time"
]
}
}
}
}
}
}
},
"/metrics/apy": {
"get": {
"tags": [
"Metrics"
],
"summary": "Get the current ggAVAX APY",
"operationId": "get_ggAVAXAPY",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
}
}
}
}
},
"/metrics/self": {
"get": {
"operationId": "get_endpointMetrics",
"responses": {
"200": {
"description": "Object with user data."
}
}
}
},
"/utils/cb58/encode": {
"get": {
"operationId": "get_encodeNodeID",
"responses": {
"200": {
"description": "Object with user data."
}
}
}
},
"/features": {
"get": {
"tags": [
"Feature Flags"
],
"summary": "Get the feature flags for the current environment",
"operationId": "get_FeatureFlags",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"flags": {
"type": "object",
"properties": {
"liquid_staking": {
"type": "boolean",
"example": true
}
},
"required": [
"liquid_staking"
],
"description": "A map of feature flags"
}
},
"required": [
"flags"
]
}
}
}
}
}
}
}
},
"webhooks": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment