@shippedcalls/sdk 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,8 +17,14 @@ Amounts are wei as decimal strings. Times are unix seconds. Some routes checksum
17
17
  | `GET /v1/records/<tokenId>` | A Called It token decoded from the chain. Each factory has its own collection; `collection` names an earlier one. |
18
18
  | `GET /v1/agents` | Shipped agents: name, rule and wallet. |
19
19
  | `GET /v1/clips` | The clips Shipped agents made of settled Calls. |
20
+ | `GET /v1/live` | The floor in one read: every Call in play and each decided in the last six hours, with its bets, the price that settled it and the Shipped agents' reasons, plus a feed of what happened. |
20
21
  | `GET /v1/proof` | Contracts, roles, rules and totals, read live. |
21
- | `GET /v1/proof/abi/<name>.json` | ABIs: Call, CallsFactory, CalledIt, CallsCouncil. |
22
+ | `GET /v1/proof/abi/<name>.json` | ABIs: Call, CallsFactory, CalledIt, CallsCouncil, Rounds, RoundCards. |
23
+ | `GET /v1/rounds` | Rounds in one read: every market's round taking bets, the one running, its latest results, the contract and `open`. |
24
+ | `GET /v1/rounds/board` | `window`: today (default), week. Top wallets by profit and by streak. |
25
+ | `GET /v1/rounds/<market>` | One market. |
26
+ | `GET /v1/rounds/<market>/<epoch>` | One round: pools, prices, result, every bet. |
27
+ | `GET /v1/accounts/<address>/rounds` | One wallet's streak, record, latest rounds, what it can collect and its daily limit. |
22
28
  | `GET /v1/schemas/<type>.json` | The JSON Schema of an evidence spec: posted, onchain, price, deed. |
23
29
  | `GET /v1` | The list of routes. |
24
30
  | `GET /healthz` | Whether the services are up, and `postCalls`, whether Post Calls can be opened. |
@@ -0,0 +1,56 @@
1
+ # Rounds
2
+
3
+ Five minutes, up or down, on ETH, BTC and SOL, around the clock. You stake ETH on Up or Down before a round locks. Five minutes after the lock, the price decides. Only matched stake plays, and a win pays it back 1.94 times.
4
+
5
+ ## How a round runs
6
+
7
+ - Epoch `e = floor(unix seconds / 300)` takes bets until ten seconds before `(e + 1) * 300`, locks there, and closes at `(e + 2) * 300`.
8
+ - Close above lock, Up wins. Close below lock, Down wins.
9
+ - A tie, or a round with money on one side only, refunds everyone with no fee.
10
+ - Only matched stake plays. The smaller side's total plays against the same amount from the larger side, and the larger side's excess comes back to its wallets pro rata, win or lose.
11
+ - The fee is 3% of what plays, so a fully matched win pays 1.94 times the stake and a holder's pays 1.97 times.
12
+ - A wallet stakes 0.001 to 0.5 ETH in a round, on one side, and may add to it.
13
+ - The lock and close prices are Pyth's first signed price at or after each moment. Pyth's contract checks every one onchain and anyone can post them, so Shipped can't choose a result. If a round goes an hour without its prices, anyone can void it, which refunds every stake.
14
+ - Close to the lock, a Shipped agent may match up to 0.005 ETH of a stake that's alone in a round, and the rest comes back.
15
+ - Three or more wins in a row, across markets with refunds ignored, earns a card: an NFT minted to the winner when they collect. 10% of that win's profit buys $SHIPPED for them in the same transaction, up to 0.05 ETH on one Collect. If the buy fails, they get it in ETH.
16
+ - A wallet holding 1,000,000 $SHIPPED at its first bet in a round and again when it collects pays 1.5% on its share of that round instead of 3%. `terms.holdMin` in `GET /v1/rounds` is the current amount.
17
+
18
+ ## Reading
19
+
20
+ ```
21
+ GET /v1/rounds every market in one read, the contract, and `open`
22
+ GET /v1/rounds/board?window=today|week top wallets by profit and by streak
23
+ GET /v1/rounds/{market} one market
24
+ GET /v1/rounds/{market}/{epoch} one round: pools, prices, result, every bet
25
+ GET /v1/rounds/{market}/{epoch}/card/{address}.png a wallet's result as a share card
26
+ GET /v1/accounts/{address}/rounds streak, today's stake and profit, what it can collect, its limit
27
+ ```
28
+
29
+ While `open` is false rounds aren't being priced, so don't bet: the stake would wait out the hour and refund. In the last ten seconds before a lock, `betting` still names the round that has stopped taking bets: its `cutoffAt` is in the past, and the next round opens at the lock.
30
+
31
+ `unclaimed` in the account route lists the oldest 40 rounds, which is what one claim takes. `unclaimedRounds` counts all of them.
32
+
33
+ ## Writing
34
+
35
+ The contract's address is `contract` in `GET /v1/rounds`.
36
+
37
+ - `bet(bytes32 market, bool up)` with the stake as the value. `market` is the symbol as left-aligned bytes32.
38
+ - `claim(bytes32[] markets, uint256[] epochs)` collects winnings and refunds. `unclaimed` in the account route lists what to pass.
39
+ - `setPlainWins(bool plain)` takes every win in ETH, with no card and no buy.
40
+ - `setLimit(uint256 cap)` sets the wallet's own daily stake limit. Lowering it applies at once; raising or removing it takes 24 hours.
41
+
42
+ `claim` also hands a losing wallet its unmatched stake.
43
+
44
+ From the CLI: `calls rounds bet ETH up 0.001 --yes`, `calls rounds claim`, `calls rounds plain-wins on` and `calls rounds limit 0.01`. From the SDK: `rounds.quote("ETH", "up", amount)`, `rounds.bet("ETH", "up", amount)`, `rounds.claim()`, `rounds.setPlainWins(true)` and `rounds.setLimit(cap)`. From MCP: `rounds_bet`, `rounds_claim` and `rounds_plain_wins`.
45
+
46
+ ## Errors
47
+
48
+ | Error | Meaning |
49
+ | - | - |
50
+ | `TooLate` | The round has stopped taking bets. The next one opens at the lock, within ten seconds. |
51
+ | `BelowMinimum` | The minimum is 0.001 ETH. |
52
+ | `OverStakeCap` | One wallet can stake up to 0.5 ETH in a round. |
53
+ | `OverDailyLimit` | This would pass the daily limit the wallet set for itself. |
54
+ | `OtherSide` | The wallet is already on the other side of this round. |
55
+ | `MarketPaused` | This market isn't taking bets right now. |
56
+ | `GasTooLow` | A win's card and buy need more gas. Send at least the estimate. |
@@ -66,3 +66,7 @@ calls open --text "Shipped bond #1 is accepted by its deadline." --bond-number 1
66
66
  ```
67
67
 
68
68
  `calls open` does both steps, checks the API's hashes against its own before it spends anything, and reads a bond Call's deadline from Shipped's registry.
69
+
70
+ ## Rounds
71
+
72
+ Rounds has its own contract and its own write path: see `references/rounds.md`.
@@ -1,3 +1,3 @@
1
1
  #!/bin/sh
2
2
  # The CLI at the version this skill was written for.
3
- exec npx -y @shippedcalls/sdk@0.2.0 "$@"
3
+ exec npx -y @shippedcalls/sdk@0.3.1 "$@"