Skip to main content
POST
/
set-staking-rate
Staking
curl --request POST \
  --url https://tokens.shakesco.com/set-staking-rate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "base_duration": "<string>",
  "base_reward_percent": "<string>",
  "email": "<string>",
  "amount": 123,
  "lock_duration": "<string>",
  "stake_index": 123
}
'
{ "tx_hash": "0xabc..." }

Documentation Index

Fetch the complete documentation index at: https://docs.shakesco.com/llms.txt

Use this file to discover all available pages before exploring further.

For the complete documentation index, see llms.txt. Staking lets customers lock a portion of their token balance for a fixed duration and earn a proportional reward. Your business sets a base staking rate; the API calculates pro-rata rewards for any lock duration.
Configure the base staking rate once with POST /set-staking-rate. All subsequent stake durations are calculated from that base.

Write Endpoints

POST /set-staking-rate

Set the base staking rate for your business. All stake durations are pro-rated from this.
base_duration
string
required
Base lock period in seconds (e.g. "31536000" = 1 year)
base_reward_percent
string
required
Basis points for the base reward (e.g. "2000" = 20%)
await fetch("https://tokens.shakesco.com/set-staking-rate", {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ base_duration: "31536000", base_reward_percent: "2000" }),
});
{ "tx_hash": "0xabc..." }

POST /create-stake

Lock a customer’s tokens into a stake position.
email
string
required
Customer’s email
amount
number
required
Tokens to lock
lock_duration
string
required
Lock period in seconds
{ "tx_hash": "0xabc..." }

POST /unstake

Unlock a stake position and collect rewards. Specify the stake by its index (0-based).
email
string
required
Customer’s email
stake_index
integer
required
Index of the stake position (from /stake-info)
await fetch("https://tokens.shakesco.com/unstake", {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ email: "customer@example.com", stake_index: 0 }),
});
{ "tx_hash": "0xabc..." }

POST /prune-inactive-stakes

Remove all unlocked (inactive) stake entries from storage for a customer. Call this periodically to keep the contract state clean.
email
string
required
Customer’s email
await fetch("https://tokens.shakesco.com/prune-inactive-stakes", {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ email: "customer@example.com" }),
});
{ "tx_hash": "0xabc..." }

Read Endpoints

GET /staking-rate

Returns the base staking rate configured for your business.
const res = await fetch("https://tokens.shakesco.com/staking-rate", {
  headers: { Authorization: `Bearer ${API_KEY}` },
});
{
  "base_duration": "31536000",
  "base_reward_percent": "2000",
  "is_set": true
}

GET /calculate-staking-reward?duration=2592000

Calculate what reward percent a specific lock duration would earn.
duration
string
required
Duration in seconds
const res = await fetch(
  "https://tokens.shakesco.com/calculate-staking-reward?duration=2592000",
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);
{ "reward_percent": "500" }
reward_percent is in basis points. "500" = 5%.

GET /stake-info?email=…&stake_index=0

Details about a specific stake position.
email
string
required
Customer’s email
stake_index
integer
required
0-based stake index
{
  "amount": "100000000000000000000",
  "start_time": "1715000000",
  "lock_duration": "2592000",
  "reward_percent": "500",
  "active": true
}

GET /stake-rewards?email=…&stake_index=0

Accrued rewards for a specific stake, claimable on unstake.
{ "rewards": "1500000000000000000" }

GET /stake-count?email=…

Number of stake positions for a customer.
{ "stake_count": 2 }

GET /total-staked?email=…

Total tokens locked across all active stakes.
{ "total_staked": "200000000000000000000" }