paralith-mcp 0.4.6 → 0.4.8
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.
- package/README.md +53 -52
- package/dist/bridge.mjs +462 -22
- package/dist/chains.json +14 -72
- package/dist/client.mjs +9249 -8777
- package/dist/graph.json +101 -24
- package/dist/http.mjs +291 -157
- package/dist/server.mjs +309 -163
- package/package.json +52 -52
package/dist/server.mjs
CHANGED
|
@@ -390,6 +390,80 @@ var init_setup = __esm({
|
|
|
390
390
|
}
|
|
391
391
|
});
|
|
392
392
|
|
|
393
|
+
// ../rune-ao/src/lib/shard-route.mjs
|
|
394
|
+
function shardBucket(address) {
|
|
395
|
+
if (typeof address !== "string" || address === "") return null;
|
|
396
|
+
let h = 0;
|
|
397
|
+
for (const byte of encoder.encode(address)) h = (h * 31 + byte) % 2147483647;
|
|
398
|
+
return h % SHARD_BUCKETS;
|
|
399
|
+
}
|
|
400
|
+
function evenShardBuckets(ids) {
|
|
401
|
+
return Array.from(
|
|
402
|
+
{ length: SHARD_BUCKETS },
|
|
403
|
+
(_, bucket) => ids[Math.floor(bucket * ids.length / SHARD_BUCKETS)]
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
function shardMap(processes = {}) {
|
|
407
|
+
const game = processes.game || "";
|
|
408
|
+
const shards = { ...processes.shards || {} };
|
|
409
|
+
const ids = Object.keys(shards).sort();
|
|
410
|
+
const market = processes.market || "";
|
|
411
|
+
const lobby = processes.lobby || "";
|
|
412
|
+
if (ids.length === 0) {
|
|
413
|
+
return { game, sharded: false, shards: {}, buckets: [], pids: game ? [game] : [], market, lobby };
|
|
414
|
+
}
|
|
415
|
+
for (const id of ids) {
|
|
416
|
+
if (!SHARD_ID.test(id) || !PID.test(shards[id])) {
|
|
417
|
+
throw new Error(`graph shard ${JSON.stringify(id)} is not <shard id>: <process id>`);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const buckets = Array.isArray(processes.shardBuckets) && processes.shardBuckets.length ? [...processes.shardBuckets] : evenShardBuckets(ids);
|
|
421
|
+
if (buckets.length !== SHARD_BUCKETS || !buckets.every((id) => shards[id])) {
|
|
422
|
+
throw new Error(`graph shardBuckets must be ${SHARD_BUCKETS} ids from shards`);
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
game: game || shards[buckets[0]],
|
|
426
|
+
sharded: true,
|
|
427
|
+
shards,
|
|
428
|
+
buckets,
|
|
429
|
+
pids: ids.map((id) => shards[id]),
|
|
430
|
+
market,
|
|
431
|
+
lobby
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function shardOf(map, address) {
|
|
435
|
+
if (!map?.sharded) return "";
|
|
436
|
+
const bucket = shardBucket(address);
|
|
437
|
+
return bucket === null ? "" : map.buckets[bucket];
|
|
438
|
+
}
|
|
439
|
+
function processFor(map, address) {
|
|
440
|
+
const id = shardOf(map, address);
|
|
441
|
+
return id ? map.shards[id] : map?.game || "";
|
|
442
|
+
}
|
|
443
|
+
function gameTargets(map) {
|
|
444
|
+
if (!map?.sharded) return map?.game ? [{ shard: "", process: map.game }] : [];
|
|
445
|
+
return Object.keys(map.shards).sort().map((shard) => ({ shard, process: map.shards[shard] }));
|
|
446
|
+
}
|
|
447
|
+
async function fanOut(map, attempt) {
|
|
448
|
+
return Promise.all(gameTargets(map).map(async (target) => {
|
|
449
|
+
try {
|
|
450
|
+
return { ...target, value: await attempt(target) };
|
|
451
|
+
} catch (error) {
|
|
452
|
+
return { ...target, error: error instanceof Error ? error.message : String(error) };
|
|
453
|
+
}
|
|
454
|
+
}));
|
|
455
|
+
}
|
|
456
|
+
var SHARD_BUCKETS, SHARD_ID, PID, encoder;
|
|
457
|
+
var init_shard_route = __esm({
|
|
458
|
+
"../rune-ao/src/lib/shard-route.mjs"() {
|
|
459
|
+
"use strict";
|
|
460
|
+
SHARD_BUCKETS = 64;
|
|
461
|
+
SHARD_ID = /^[a-z0-9]{1,8}$/;
|
|
462
|
+
PID = /^[A-Za-z0-9_-]{43}$/;
|
|
463
|
+
encoder = new TextEncoder();
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
|
|
393
467
|
// src/runtime.mjs
|
|
394
468
|
var runtime_exports = {};
|
|
395
469
|
__export(runtime_exports, {
|
|
@@ -397,8 +471,12 @@ __export(runtime_exports, {
|
|
|
397
471
|
NODE: () => NODE,
|
|
398
472
|
PROCESS_ALIASES: () => PROCESS_ALIASES,
|
|
399
473
|
READ_ONLY: () => READ_ONLY,
|
|
474
|
+
SHARDS: () => SHARDS,
|
|
475
|
+
TOKENS: () => TOKENS,
|
|
476
|
+
TOKEN_DECIMALS: () => TOKEN_DECIMALS,
|
|
400
477
|
chains: () => chains,
|
|
401
478
|
formatAtoms: () => formatAtoms,
|
|
479
|
+
gameFor: () => gameFor,
|
|
402
480
|
graph: () => graph,
|
|
403
481
|
parseAmount: () => parseAmount,
|
|
404
482
|
processId: () => processId,
|
|
@@ -431,8 +509,14 @@ function runtime() {
|
|
|
431
509
|
return loaded;
|
|
432
510
|
}
|
|
433
511
|
async function readKey(process2, key, node = NODE) {
|
|
512
|
+
let pid = processId(process2);
|
|
513
|
+
if (SHARDS.sharded && pid === graph.processes.game) {
|
|
514
|
+
if (key.startsWith("player-")) pid = gameFor(key.slice(7));
|
|
515
|
+
else if (SHARDS.market && /^market/.test(key)) pid = SHARDS.market;
|
|
516
|
+
else if (SHARDS.lobby && key === "challenges") pid = SHARDS.lobby;
|
|
517
|
+
}
|
|
434
518
|
const res = await fetch(
|
|
435
|
-
`${node}/${
|
|
519
|
+
`${node}/${pid}~process@1.0/now/${key}`,
|
|
436
520
|
{ headers: { accept: "text/plain" }, signal: AbortSignal.timeout(6e4) }
|
|
437
521
|
);
|
|
438
522
|
if (res.status === 404) return null;
|
|
@@ -478,26 +562,40 @@ async function until(what, read, done, timeoutMs = 6e5, everyMs = 3e3) {
|
|
|
478
562
|
await sleep(everyMs);
|
|
479
563
|
}
|
|
480
564
|
}
|
|
481
|
-
var HERE, DIST, graph, NODE, chains, PROCESS_ALIASES, ID, READ_ONLY, loaded, HTML, sleep;
|
|
565
|
+
var HERE, DIST, graph, NODE, SHARDS, gameFor, chains, PROCESS_ALIASES, TOKENS, TOKEN_DECIMALS, ID, READ_ONLY, loaded, HTML, sleep;
|
|
482
566
|
var init_runtime = __esm({
|
|
483
567
|
"src/runtime.mjs"() {
|
|
484
568
|
init_ans104();
|
|
485
569
|
init_keys();
|
|
486
570
|
init_agents();
|
|
571
|
+
init_shard_route();
|
|
487
572
|
HERE = path4.dirname(fileURLToPath(import.meta.url));
|
|
488
573
|
DIST = fs4.existsSync(path4.join(HERE, "graph.json")) ? HERE : path4.join(HERE, "..", "dist");
|
|
489
574
|
graph = JSON.parse(fs4.readFileSync(path4.join(DIST, "graph.json"), "utf8"));
|
|
490
575
|
NODE = graph.node.replace(/\/$/, "");
|
|
576
|
+
SHARDS = shardMap(graph.processes);
|
|
577
|
+
gameFor = (address) => processFor(SHARDS, address) || graph.processes.game;
|
|
491
578
|
chains = JSON.parse(fs4.readFileSync(path4.join(DIST, "chains.json"), "utf8"));
|
|
492
579
|
PROCESS_ALIASES = {
|
|
493
580
|
game: graph.processes.game,
|
|
494
581
|
rune: graph.processes.rune,
|
|
495
582
|
pusd: graph.processes.pusd,
|
|
496
583
|
...graph.processes.dao ? { dao: graph.processes.dao } : {},
|
|
497
|
-
|
|
584
|
+
...graph.processes.gold ? { gold: graph.processes.gold } : {},
|
|
498
585
|
"token-venue": graph.processes.externalVenue,
|
|
499
|
-
...Object.fromEntries(Object.entries(graph.processes.
|
|
586
|
+
...Object.fromEntries(Object.entries(graph.processes.berries ?? {}).filter(([, v]) => v).map(([k, v]) => [`${k}-token`, v])),
|
|
587
|
+
// Sharded: each shard by its id (`game` is bucket 0's), the market, the lobby.
|
|
588
|
+
...Object.fromEntries(Object.entries(graph.processes.shards ?? {}).map(([id, pid]) => [`game-${id}`, pid])),
|
|
589
|
+
...graph.processes.market ? { market: graph.processes.market } : {},
|
|
590
|
+
...graph.processes.lobby ? { lobby: graph.processes.lobby } : {}
|
|
500
591
|
};
|
|
592
|
+
TOKENS = Object.fromEntries(Object.entries({
|
|
593
|
+
rune: graph.processes.rune,
|
|
594
|
+
gold: graph.processes.gold,
|
|
595
|
+
pusd: graph.processes.pusd,
|
|
596
|
+
...Object.fromEntries(Object.entries(graph.processes.berries ?? {}).map(([k, v]) => [`${k}_berry`, v]))
|
|
597
|
+
}).filter(([, id]) => id));
|
|
598
|
+
TOKEN_DECIMALS = { gold: 2 };
|
|
501
599
|
ID = /^[A-Za-z0-9_-]{43}$/;
|
|
502
600
|
READ_ONLY = !process.env.PARALITH_MNEMONIC && !process.env.PARALITH_MNEMONIC_FILE;
|
|
503
601
|
loaded = null;
|
|
@@ -512,7 +610,7 @@ var init_package = __esm({
|
|
|
512
610
|
"package.json"() {
|
|
513
611
|
package_default = {
|
|
514
612
|
name: "paralith-mcp",
|
|
515
|
-
version: "0.4.
|
|
613
|
+
version: "0.4.8",
|
|
516
614
|
description: "MCP server for Paralith on AO: an AI with one 24-word phrase plays Rune Realm, trades and bridges PUSD; plus paralith-bridge, the bridge operator CLI (TEST deployment).",
|
|
517
615
|
license: "UNLICENSED",
|
|
518
616
|
homepage: "https://docs.paralithmarkets.com/ai/mcp",
|
|
@@ -780,9 +878,17 @@ async function player2(address) {
|
|
|
780
878
|
async function findBattle(id) {
|
|
781
879
|
const fleet = await readKey("game", "battlefleet").catch(() => null);
|
|
782
880
|
const workers = (fleet?.workers ?? []).map((w) => w.workerProcessId).filter(Boolean);
|
|
783
|
-
const
|
|
881
|
+
const games = SHARDS.sharded ? SHARDS.pids : ["game"];
|
|
882
|
+
const found = await Promise.all([...games.map((g) => readKey(g, `battle-op-${id}`)), ...workers.map((w) => readKey(w, `battle-${id}`))].map((read) => read.catch(() => null)));
|
|
784
883
|
return found.find((b) => b && typeof b === "object") ?? null;
|
|
785
884
|
}
|
|
885
|
+
async function perShard(read) {
|
|
886
|
+
return Object.fromEntries((await fanOut(SHARDS, ({ process: process2 }) => read(process2))).map(({ shard, value, error }) => [shard, value ?? { error }]));
|
|
887
|
+
}
|
|
888
|
+
function arenaTiers(api, who) {
|
|
889
|
+
if (who || !SHARDS.sharded) return api.readArenaTiers({ process: gameFor(who ?? "") });
|
|
890
|
+
return perShard((process2) => api.readArenaTiers({ process: process2 }));
|
|
891
|
+
}
|
|
786
892
|
function registerGame(server) {
|
|
787
893
|
tool(
|
|
788
894
|
server,
|
|
@@ -803,31 +909,27 @@ function registerGame(server) {
|
|
|
803
909
|
"game_catalog",
|
|
804
910
|
"The game rules as data: activity costs/gains, arena terms, element effectiveness, free moves (Rally, Mend), hunt capture odds, items, level-up rules and every move pool. Free, unsigned.",
|
|
805
911
|
{},
|
|
806
|
-
async () =>
|
|
807
|
-
const catalog = await (await me()).api.readCatalog();
|
|
808
|
-
if (catalog?.levelUp) {
|
|
809
|
-
catalog.levelUp = { ...catalog.levelUp, costDivisor: 32, cost: "ceil(targetLevel^2 / 32) Rune" };
|
|
810
|
-
}
|
|
811
|
-
return catalog;
|
|
812
|
-
},
|
|
912
|
+
async () => (await me()).api.readCatalog(),
|
|
813
913
|
READ
|
|
814
914
|
);
|
|
815
915
|
tool(
|
|
816
916
|
server,
|
|
817
917
|
"game_world",
|
|
818
|
-
"Shared world state: access rules, factions, arena difficulty tiers, open PvP challenges and the leaderboard (top 10). Free, unsigned.",
|
|
819
|
-
{},
|
|
820
|
-
async () => {
|
|
821
|
-
const { api } = await me();
|
|
918
|
+
"Shared world state: access rules, factions, arena difficulty tiers (the pots on your shard), open PvP challenges and the leaderboard (top 10). Free, unsigned.",
|
|
919
|
+
{ address: z2.string().optional().describe("Whose shard's arena pots; omit for yours.") },
|
|
920
|
+
async ({ address }) => {
|
|
921
|
+
const { api, address: mine } = await me();
|
|
922
|
+
const who = address ?? mine;
|
|
822
923
|
const [access, factions, tiers, challenges, leaderboard] = await Promise.all([
|
|
823
924
|
readKey("game", "access"),
|
|
824
925
|
api.readFactions(),
|
|
825
|
-
api
|
|
926
|
+
arenaTiers(api, who),
|
|
826
927
|
api.readChallenges(),
|
|
827
928
|
api.readLeaderboard()
|
|
828
929
|
]);
|
|
930
|
+
const { admitted, pending, purchased, ...policy } = access ?? {};
|
|
829
931
|
return {
|
|
830
|
-
access,
|
|
932
|
+
access: access && policy,
|
|
831
933
|
factions: factions?.map(({ members, ...f }) => f),
|
|
832
934
|
arenaTiers: tiers,
|
|
833
935
|
openChallenges: challenges,
|
|
@@ -852,7 +954,7 @@ function registerGame(server) {
|
|
|
852
954
|
tool(
|
|
853
955
|
server,
|
|
854
956
|
"game_companion",
|
|
855
|
-
"Care for and manage companions. feed: 1 berry, +20 energy for a berry of its own element, +10 for any other. play: 10 energy + 1 berry, +25 happiness after 15 min. quest: 25 energy + 25 happiness, 1 h, then exp and Gold. claim: collect a finished play/quest. store (1 Rune; moves a companion into the collection) / retrieve / set_active / transfer manage the collection. adopt: once, if you have a faction but no companion.",
|
|
957
|
+
"Care for and manage companions. feed: 1 berry, +20 energy for a berry of its own element, +10 for any other. play: 10 energy + 1 berry, +25 happiness after 15 min. quest: 25 energy + 25 happiness, 1 h, then exp and Gold. claim: collect a finished play/quest. store (1 Rune; moves a companion into the collection) / retrieve / set_active / transfer manage the collection; a transfer to an account on another shard is pending (player.moving) until that shard lands it. adopt: once, if you have a faction but no companion.",
|
|
856
958
|
{
|
|
857
959
|
action: z2.enum(["feed", "play", "quest", "claim", "adopt", "store", "retrieve", "set_active", "transfer"]),
|
|
858
960
|
monster_id: z2.string().optional().describe("Companion id; omit for the active one."),
|
|
@@ -924,9 +1026,14 @@ function registerGame(server) {
|
|
|
924
1026
|
tool(
|
|
925
1027
|
server,
|
|
926
1028
|
"game_shop_quote",
|
|
927
|
-
"The NPC realm shop's current Gold prices (bid/ask) and stock for berries,
|
|
928
|
-
{},
|
|
929
|
-
async () =>
|
|
1029
|
+
"The NPC realm shop's current Gold prices (bid/ask) and stock for berries and Rune, on your shard (each shard has its own desks). Free, unsigned.",
|
|
1030
|
+
{ address: z2.string().optional().describe("Whose shard's desks; omit for yours.") },
|
|
1031
|
+
async ({ address }) => {
|
|
1032
|
+
const { api, address: mine } = await me();
|
|
1033
|
+
const who = address ?? mine;
|
|
1034
|
+
if (who || !SHARDS.sharded) return api.readEconomy({ process: gameFor(who ?? "") });
|
|
1035
|
+
return perShard((process2) => api.readEconomy({ process: process2 }));
|
|
1036
|
+
},
|
|
930
1037
|
READ
|
|
931
1038
|
);
|
|
932
1039
|
tool(
|
|
@@ -1045,7 +1152,7 @@ function registerGame(server) {
|
|
|
1045
1152
|
tool(
|
|
1046
1153
|
server,
|
|
1047
1154
|
"hunt_begin",
|
|
1048
|
-
"Start a hunt with a companion. Entry fee:
|
|
1155
|
+
"Start a hunt with a companion. Entry fee: 5 of each berry, 25 energy and 25 happiness, not refunded. Up to 3 Rune go with the run and come back when it ends, unless a capture spends them.",
|
|
1049
1156
|
{ monster_id: z2.string().describe("Companion to hunt with (see game_player).") },
|
|
1050
1157
|
async ({ monster_id }) => (await me()).api.beginHunt(monster_id),
|
|
1051
1158
|
WRITE,
|
|
@@ -1067,7 +1174,7 @@ function registerGame(server) {
|
|
|
1067
1174
|
tool(
|
|
1068
1175
|
server,
|
|
1069
1176
|
"hunt_act",
|
|
1070
|
-
"Act in your live hunt. A hunt is one encounter. search: find the wild creature (once per hunt). attack: one round with a move; losing ends the run. After a win: capture (one try with 1-3 Rune
|
|
1177
|
+
"Act in your live hunt. A hunt is one encounter. search: find the wild creature (once per hunt). attack: one round with a move; losing ends the run. After a win: capture (one try with 1-3 Rune, consumed either way, ends the run) or end. end: finish the run and get unspent supplies back. retry_settlement: re-send a stuck final.",
|
|
1071
1178
|
{
|
|
1072
1179
|
action: z2.enum(["search", "attack", "capture", "end", "retry_settlement"]),
|
|
1073
1180
|
move: z2.string().optional(),
|
|
@@ -1111,20 +1218,21 @@ function registerGame(server) {
|
|
|
1111
1218
|
tool(
|
|
1112
1219
|
server,
|
|
1113
1220
|
"companion_market",
|
|
1114
|
-
"Trade companions for in-game Rune (listings: companion_market_browse). list: sell a companion from your collection (never the active one; game_companion store moves it there for 1 Rune). buy
|
|
1221
|
+
"Trade companions for in-game Rune (listings: companion_market_browse). list: sell a companion from your collection (never the active one; game_companion store moves it there for 1 Rune). buy: listing_id and its price -- the market sells only at exactly the price you name (and listing_shard: the listing's shard, when it names one); the price is held (player.buying) until the market answers with the companion or the Rune. cancel: by listing_id.",
|
|
1115
1222
|
{
|
|
1116
1223
|
action: z2.enum(["list", "buy", "cancel"]),
|
|
1117
1224
|
monster_id: z2.string().optional(),
|
|
1118
1225
|
price: z2.number().int().min(1).max(1e6).optional(),
|
|
1119
|
-
listing_id: z2.string().optional()
|
|
1226
|
+
listing_id: z2.string().optional(),
|
|
1227
|
+
listing_shard: z2.string().optional()
|
|
1120
1228
|
},
|
|
1121
|
-
async ({ action, monster_id, price, listing_id }) => {
|
|
1229
|
+
async ({ action, monster_id, price, listing_id, listing_shard }) => {
|
|
1122
1230
|
const { api } = await me();
|
|
1123
1231
|
switch (action) {
|
|
1124
1232
|
case "list":
|
|
1125
1233
|
return api.listMonster(need(monster_id, "monster_id"), need(price, "price"));
|
|
1126
1234
|
case "buy":
|
|
1127
|
-
return api.buyListing(need(listing_id, "listing_id"));
|
|
1235
|
+
return api.buyListing(need(listing_id, "listing_id"), need(price, "price"), listing_shard ?? "");
|
|
1128
1236
|
case "cancel":
|
|
1129
1237
|
return api.cancelListing(need(listing_id, "listing_id"));
|
|
1130
1238
|
}
|
|
@@ -1134,26 +1242,44 @@ function registerGame(server) {
|
|
|
1134
1242
|
);
|
|
1135
1243
|
tool(
|
|
1136
1244
|
server,
|
|
1137
|
-
"
|
|
1138
|
-
"Move
|
|
1139
|
-
{
|
|
1140
|
-
async ({
|
|
1141
|
-
const { api } = await me();
|
|
1142
|
-
if (direction === "withdraw") return api.withdrawRune(amount);
|
|
1143
|
-
return api.depositRuneToGame(String(BigInt(amount) * 1000000n));
|
|
1144
|
-
},
|
|
1245
|
+
"asset_withdraw",
|
|
1246
|
+
"Move whole units of an in-game asset out to its token in your wallet (minted by the game; the in-game balance is deducted first). Gold: at least 10. Only wallet tokens trade on the exchange.",
|
|
1247
|
+
{ asset: ASSET, amount: z2.number().int().positive().describe("Whole units.") },
|
|
1248
|
+
async ({ asset, amount }) => (await me()).api.assetWithdraw(asset, amount),
|
|
1145
1249
|
WRITE,
|
|
1146
1250
|
asPlayer
|
|
1147
1251
|
);
|
|
1148
1252
|
tool(
|
|
1149
1253
|
server,
|
|
1150
|
-
"
|
|
1151
|
-
"
|
|
1152
|
-
{},
|
|
1153
|
-
async () => {
|
|
1254
|
+
"asset_deposit",
|
|
1255
|
+
"Move whole units of a token from your wallet into the game: the token burns them and the game credits your account. Needs a game account (game_join first): without one it is refused, since the game would hold the burned tokens. Whole units only; a fraction left from trading stays in the wallet.",
|
|
1256
|
+
{ asset: ASSET, amount: z2.number().int().positive().describe("Whole units.") },
|
|
1257
|
+
async ({ asset, amount }) => {
|
|
1154
1258
|
const { api, address } = await me();
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1259
|
+
const p = address ? await api.readPlayer(address) : null;
|
|
1260
|
+
if (!p?.faction) throw new Error("This wallet has no Rune Realm account, so a deposit would not be credited. Call game_join first.");
|
|
1261
|
+
return api.assetDeposit(asset, amount);
|
|
1262
|
+
},
|
|
1263
|
+
WRITE
|
|
1264
|
+
);
|
|
1265
|
+
tool(
|
|
1266
|
+
server,
|
|
1267
|
+
"berry_claim",
|
|
1268
|
+
"Claim today's free berry tokens to your wallet: one berry kind per wallet per UTC day, 1-10 of it, the amount set by the current UTC hour. Once per day. preview: show the berry and the amount for each hour left today, sending nothing.",
|
|
1269
|
+
{ preview: z2.boolean().optional() },
|
|
1270
|
+
async ({ preview }) => {
|
|
1271
|
+
const { api, address } = await me();
|
|
1272
|
+
const now = Date.now();
|
|
1273
|
+
const { berry } = api.berryClaimFor(address, Math.floor(now / DAY_MS));
|
|
1274
|
+
const hour = Math.floor(now / HOUR_MS);
|
|
1275
|
+
if (preview) {
|
|
1276
|
+
const left = 24 - hour % 24;
|
|
1277
|
+
return { berry, hours: Array.from({ length: left }, (_, i) => ({
|
|
1278
|
+
from: new Date((hour + i) * HOUR_MS).toISOString(),
|
|
1279
|
+
amount: api.claimAmountFor(address, hour + i)
|
|
1280
|
+
})) };
|
|
1281
|
+
}
|
|
1282
|
+
return { berry, reply: await api.claimBerry(berry) };
|
|
1157
1283
|
},
|
|
1158
1284
|
WRITE
|
|
1159
1285
|
);
|
|
@@ -1174,16 +1300,20 @@ function need(value, name) {
|
|
|
1174
1300
|
if (value === void 0 || value === null || value === "") throw new Error(`${name} is required for this action`);
|
|
1175
1301
|
return value;
|
|
1176
1302
|
}
|
|
1177
|
-
var FACTIONS, BERRIES, SHOP_ITEMS, seenBy, asPlayer, battleView, huntView;
|
|
1303
|
+
var FACTIONS, BERRIES, SHOP_ITEMS, ASSET, seenBy, DAY_MS, HOUR_MS, asPlayer, battleView, huntView;
|
|
1178
1304
|
var init_game = __esm({
|
|
1179
1305
|
"src/game.mjs"() {
|
|
1180
1306
|
init_runtime();
|
|
1307
|
+
init_shard_route();
|
|
1181
1308
|
init_tool();
|
|
1182
1309
|
init_views();
|
|
1183
1310
|
FACTIONS = ["Sky Nomads", "Aqua Guardians", "Inferno Blades", "Stone Titans"];
|
|
1184
1311
|
BERRIES = ["air_berry", "fire_berry", "rock_berry", "water_berry"];
|
|
1185
|
-
SHOP_ITEMS = [...BERRIES, "
|
|
1312
|
+
SHOP_ITEMS = [...BERRIES, "rune"];
|
|
1313
|
+
ASSET = z2.enum(["rune", "gold", ...BERRIES]);
|
|
1186
1314
|
seenBy = (b, address) => b && typeof b === "object" ? Object.defineProperty(b, "viewer", { value: address, enumerable: false, configurable: true }) : b;
|
|
1315
|
+
DAY_MS = 864e5;
|
|
1316
|
+
HOUR_MS = 36e5;
|
|
1187
1317
|
asPlayer = (r) => r?.address && r?.inventory ? player(r) : r;
|
|
1188
1318
|
battleView = (b) => b?.id ? battle(b, b.viewer) : b;
|
|
1189
1319
|
huntView = (r) => r?.runId ? hunt(r) : asPlayer(r);
|
|
@@ -1192,9 +1322,9 @@ var init_game = __esm({
|
|
|
1192
1322
|
|
|
1193
1323
|
// src/exchange.mjs
|
|
1194
1324
|
import { z as z3 } from "zod";
|
|
1195
|
-
async function terms(
|
|
1325
|
+
async function terms() {
|
|
1196
1326
|
const { api } = await runtime();
|
|
1197
|
-
const process2 =
|
|
1327
|
+
const process2 = BOOK();
|
|
1198
1328
|
const [info, markets] = await Promise.all([readKey(process2, "vaultinfo"), api.readVenueMarkets(process2)]);
|
|
1199
1329
|
const assets = info?.Assets ?? {};
|
|
1200
1330
|
return { process: process2, assets, markets: markets ?? {}, den: (asset) => Number(assets[asset]?.denomination ?? 0) };
|
|
@@ -1223,10 +1353,10 @@ function registerExchange(server) {
|
|
|
1223
1353
|
tool(
|
|
1224
1354
|
server,
|
|
1225
1355
|
"exchange_markets",
|
|
1226
|
-
"List
|
|
1227
|
-
{
|
|
1228
|
-
async (
|
|
1229
|
-
const t = await terms(
|
|
1356
|
+
"List the book's markets (every one quoted in Gold) with lot, tick, taker fee (bps), minimums and status, plus asset denominations. Free.",
|
|
1357
|
+
{},
|
|
1358
|
+
async () => {
|
|
1359
|
+
const t = await terms();
|
|
1230
1360
|
return { process: t.process, assets: t.assets, markets: t.markets };
|
|
1231
1361
|
},
|
|
1232
1362
|
READ
|
|
@@ -1235,9 +1365,9 @@ function registerExchange(server) {
|
|
|
1235
1365
|
server,
|
|
1236
1366
|
"exchange_book",
|
|
1237
1367
|
"Depth for one market in human units: best bid/ask, top 10 levels each side, price band and today's candle. Free.",
|
|
1238
|
-
{
|
|
1239
|
-
async ({
|
|
1240
|
-
const t = await terms(
|
|
1368
|
+
{ item: z3.string().describe("Base asset or market, e.g. fire, rune or fire_gold.") },
|
|
1369
|
+
async ({ item }) => {
|
|
1370
|
+
const t = await terms();
|
|
1241
1371
|
const m = marketFor(t, item);
|
|
1242
1372
|
const { api } = await runtime();
|
|
1243
1373
|
const book = (await api.readVenueBook(t.process))?.[m.id];
|
|
@@ -1266,10 +1396,10 @@ function registerExchange(server) {
|
|
|
1266
1396
|
tool(
|
|
1267
1397
|
server,
|
|
1268
1398
|
"exchange_position",
|
|
1269
|
-
"Balances
|
|
1270
|
-
{
|
|
1271
|
-
async ({
|
|
1272
|
-
const t = await terms(
|
|
1399
|
+
"Balances on the book (free, and where each asset sits) with open orders and recent fills, all in human units; yours unless address is given. Free.",
|
|
1400
|
+
{ address: z3.string().optional() },
|
|
1401
|
+
async ({ address }) => {
|
|
1402
|
+
const t = await terms();
|
|
1273
1403
|
const { api, wallets } = await runtime();
|
|
1274
1404
|
const who = address ?? wallets?.ao.address;
|
|
1275
1405
|
if (!who) throw new Error("This server has no wallet; pass an address.");
|
|
@@ -1307,19 +1437,18 @@ function registerExchange(server) {
|
|
|
1307
1437
|
tool(
|
|
1308
1438
|
server,
|
|
1309
1439
|
"exchange_order",
|
|
1310
|
-
"Place a limit order. price is
|
|
1440
|
+
"Place a limit order. price is Gold per whole base unit; quantity is whole base units. Funds are routed from your book balance, or deposited from your wallet if short, in one signature. In-game balances are not on the book: asset_withdraw them to your wallet first. tif: GTC (rest), IOC (fill what you can now), FOK (all or nothing), PostOnly (never take).",
|
|
1311
1441
|
{
|
|
1312
|
-
venue: VENUE,
|
|
1313
1442
|
side: z3.enum(["buy", "sell"]),
|
|
1314
|
-
item: z3.string(),
|
|
1443
|
+
item: z3.string().describe("Base asset or market, e.g. fire, rune or fire_gold."),
|
|
1315
1444
|
price: z3.string().describe('Decimal, e.g. "12.5".'),
|
|
1316
1445
|
quantity: z3.string().describe('Decimal, e.g. "3".'),
|
|
1317
1446
|
tif: z3.enum(["GTC", "IOC", "FOK", "PostOnly"]).optional(),
|
|
1318
1447
|
stp: z3.enum(["CancelResting", "Reject", "CancelBoth"]).optional(),
|
|
1319
1448
|
expires_in: z3.number().int().positive().optional().describe("Seconds a GTC order may rest.")
|
|
1320
1449
|
},
|
|
1321
|
-
async ({
|
|
1322
|
-
const t = await terms(
|
|
1450
|
+
async ({ side: side2, item, price, quantity, tif, stp, expires_in }) => {
|
|
1451
|
+
const t = await terms();
|
|
1323
1452
|
const m = marketFor(t, item);
|
|
1324
1453
|
const wire = toWire(t, m, price, quantity);
|
|
1325
1454
|
const { api, wallets } = await runtime();
|
|
@@ -1339,7 +1468,7 @@ function registerExchange(server) {
|
|
|
1339
1468
|
}
|
|
1340
1469
|
return {
|
|
1341
1470
|
outcome,
|
|
1342
|
-
route: { from: reply.pending.fromWallet !== "0" ? "wallet" :
|
|
1471
|
+
route: { from: reply.pending.fromWallet !== "0" ? "wallet" : "book" },
|
|
1343
1472
|
...outcome.state === "pending" ? { note: "Still settling; check exchange_position shortly. Do not re-place." } : {}
|
|
1344
1473
|
};
|
|
1345
1474
|
},
|
|
@@ -1349,12 +1478,12 @@ function registerExchange(server) {
|
|
|
1349
1478
|
server,
|
|
1350
1479
|
"exchange_cancel",
|
|
1351
1480
|
"Cancel one order by order_id (as returned by exchange_order / exchange_position), or all your orders (optionally one item).",
|
|
1352
|
-
{
|
|
1353
|
-
async ({
|
|
1481
|
+
{ order_id: z3.string().optional(), all: z3.boolean().optional(), item: z3.string().optional() },
|
|
1482
|
+
async ({ order_id, all, item }) => {
|
|
1354
1483
|
const { api } = await runtime();
|
|
1355
|
-
if (all) return api.cancelAllVenueOrders(
|
|
1484
|
+
if (all) return api.cancelAllVenueOrders(BOOK(), item);
|
|
1356
1485
|
if (!order_id) throw new Error("Give order_id, or all: true.");
|
|
1357
|
-
return api.cancelVenueOrder(
|
|
1486
|
+
return api.cancelVenueOrder(BOOK(), order_id);
|
|
1358
1487
|
},
|
|
1359
1488
|
WRITE
|
|
1360
1489
|
);
|
|
@@ -1362,9 +1491,9 @@ function registerExchange(server) {
|
|
|
1362
1491
|
server,
|
|
1363
1492
|
"exchange_amend",
|
|
1364
1493
|
"Change a resting GTC/PostOnly order's price and/or quantity (human units, like exchange_order).",
|
|
1365
|
-
{
|
|
1366
|
-
async ({
|
|
1367
|
-
const t = await terms(
|
|
1494
|
+
{ order_id: z3.string(), item: z3.string(), price: z3.string().optional(), quantity: z3.string().optional() },
|
|
1495
|
+
async ({ order_id, item, price, quantity }) => {
|
|
1496
|
+
const t = await terms();
|
|
1368
1497
|
const m = marketFor(t, item);
|
|
1369
1498
|
const wire = toWire(t, m, price ?? "1", quantity ?? formatAtoms(BigInt(m.lot), t.den(m.base)));
|
|
1370
1499
|
const { api } = await runtime();
|
|
@@ -1378,33 +1507,29 @@ function registerExchange(server) {
|
|
|
1378
1507
|
tool(
|
|
1379
1508
|
server,
|
|
1380
1509
|
"exchange_transfer",
|
|
1381
|
-
"Move
|
|
1382
|
-
{
|
|
1383
|
-
|
|
1384
|
-
|
|
1510
|
+
"Move tokens between your wallet and the book. deposit: from your wallet. withdraw: back to your wallet. amount is decimal units. Between the game and your wallet, use asset_withdraw / asset_deposit.",
|
|
1511
|
+
{
|
|
1512
|
+
direction: z3.enum(["deposit", "withdraw"]),
|
|
1513
|
+
asset: z3.string().describe("gold, rune, air, water, fire or rock."),
|
|
1514
|
+
amount: z3.string()
|
|
1515
|
+
},
|
|
1516
|
+
async ({ direction, asset, amount }) => {
|
|
1517
|
+
const t = await terms();
|
|
1385
1518
|
const { api } = await runtime();
|
|
1386
|
-
if (direction === "withdraw")
|
|
1387
|
-
if (venue === "game" && !/^\d+$/.test(amount)) throw new Error("The game takes back whole units; withdraw a whole number and leave the fraction.");
|
|
1388
|
-
return api.withdrawFromVenue(t.process, asset, parseAmount(amount, t.den(asset)).toString());
|
|
1389
|
-
}
|
|
1390
|
-
if (venue === "game") {
|
|
1391
|
-
if (!/^\d+$/.test(amount)) throw new Error("Game assets move in whole units.");
|
|
1392
|
-
return api.sendToVenue(asset, Number(amount));
|
|
1393
|
-
}
|
|
1519
|
+
if (direction === "withdraw") return api.withdrawFromVenue(t.process, asset, parseAmount(amount, t.den(asset)).toString());
|
|
1394
1520
|
const token = t.assets[asset]?.process;
|
|
1395
|
-
if (!token) throw new Error(`"${asset}" is not a token on
|
|
1521
|
+
if (!token) throw new Error(`"${asset}" is not a token on the book. Assets: ${Object.keys(t.assets).join(", ")}`);
|
|
1396
1522
|
return api.depositTokenToVenue(token, t.process, parseAmount(amount, t.den(asset)).toString());
|
|
1397
1523
|
},
|
|
1398
1524
|
WRITE
|
|
1399
1525
|
);
|
|
1400
1526
|
}
|
|
1401
|
-
var
|
|
1527
|
+
var BOOK, unitPrice, units, human;
|
|
1402
1528
|
var init_exchange = __esm({
|
|
1403
1529
|
"src/exchange.mjs"() {
|
|
1404
1530
|
init_runtime();
|
|
1405
1531
|
init_tool();
|
|
1406
|
-
|
|
1407
|
-
venueProcess = (venue) => venue === "game" ? graph.processes.internalVenue : graph.processes.externalVenue;
|
|
1532
|
+
BOOK = () => graph.processes.externalVenue;
|
|
1408
1533
|
unitPrice = (t, m, perLot) => formatAtoms(BigInt(perLot) * 10n ** BigInt(t.den(m.base)) / BigInt(m.lot), t.den(m.quote));
|
|
1409
1534
|
units = (t, m, lots) => formatAtoms(BigInt(lots) * BigInt(m.lot), t.den(m.base));
|
|
1410
1535
|
human = (t, free) => Object.fromEntries(Object.entries(free ?? {}).map(([asset, atoms]) => [asset, formatAtoms(atoms, t.den(asset))]));
|
|
@@ -1479,7 +1604,7 @@ function baseChain(w) {
|
|
|
1479
1604
|
return write({ address: cfg.bridge, abi: BRIDGE, functionName: "deposit", args: [token.address, amount, ao] });
|
|
1480
1605
|
},
|
|
1481
1606
|
/** Submit a signed withdrawal: the set's signatures, sorted by signer. */
|
|
1482
|
-
async claim(w2, set, namespace) {
|
|
1607
|
+
async claim(w2, set, namespace, epoch) {
|
|
1483
1608
|
const RELEASE = parseAbi(["function release(uint64 withdrawalId, address token, address to, uint256 amount, bytes[] sigs)"]);
|
|
1484
1609
|
const id = BigInt(namespace) << 32n | BigInt(w2.id);
|
|
1485
1610
|
const inner = keccak256(encodeAbiParameters(
|
|
@@ -1487,12 +1612,24 @@ function baseChain(w) {
|
|
|
1487
1612
|
{ type: "bytes32" },
|
|
1488
1613
|
{ type: "uint256" },
|
|
1489
1614
|
{ type: "address" },
|
|
1615
|
+
{ type: "bytes32" },
|
|
1616
|
+
{ type: "uint64" },
|
|
1490
1617
|
{ type: "uint64" },
|
|
1491
1618
|
{ type: "address" },
|
|
1492
1619
|
{ type: "address" },
|
|
1493
1620
|
{ type: "uint256" }
|
|
1494
1621
|
],
|
|
1495
|
-
[
|
|
1622
|
+
[
|
|
1623
|
+
keccak256(toBytes("PARALITH_RELEASE_V2")),
|
|
1624
|
+
BigInt(cfg.chainId),
|
|
1625
|
+
cfg.bridge,
|
|
1626
|
+
rootHex(PUSD),
|
|
1627
|
+
BigInt(epoch),
|
|
1628
|
+
id,
|
|
1629
|
+
w2.token,
|
|
1630
|
+
w2.to,
|
|
1631
|
+
BigInt(w2.amount)
|
|
1632
|
+
]
|
|
1496
1633
|
));
|
|
1497
1634
|
const allowed = new Set(set.map((m) => m.base.toLowerCase()));
|
|
1498
1635
|
const rows = await Promise.all(set.filter((m) => w2.sigs?.[m.ao]).map(async (m) => ({
|
|
@@ -1546,7 +1683,7 @@ function solanaChain(w) {
|
|
|
1546
1683
|
if (!info) return DAILY_FAUCET;
|
|
1547
1684
|
const day = info.data.readBigUInt64LE(8);
|
|
1548
1685
|
const claimed = info.data.readBigUInt64LE(16);
|
|
1549
|
-
return day === BigInt(Math.floor(Date.now() /
|
|
1686
|
+
return day === BigInt(Math.floor(Date.now() / DAY_MS2)) ? DAILY_FAUCET - claimed : DAILY_FAUCET;
|
|
1550
1687
|
},
|
|
1551
1688
|
faucet: (amount) => send2(new TransactionInstruction({
|
|
1552
1689
|
programId: program,
|
|
@@ -1576,14 +1713,16 @@ function solanaChain(w) {
|
|
|
1576
1713
|
})),
|
|
1577
1714
|
/** Submit a signed withdrawal: one Ed25519 precompile instruction holding the
|
|
1578
1715
|
* members' signatures over the release message, then `release`. */
|
|
1579
|
-
claim(w2, set, namespace) {
|
|
1716
|
+
claim(w2, set, namespace, epoch) {
|
|
1580
1717
|
const id = BigInt(namespace) << 32n | BigInt(w2.id);
|
|
1581
1718
|
const amount = BigInt(w2.amount);
|
|
1582
1719
|
const to = new PublicKey(w2.to);
|
|
1583
1720
|
const signed = set.filter((m) => w2.sigs?.[m.ao]);
|
|
1584
1721
|
const msg = Buffer.concat([
|
|
1585
|
-
Buffer.from("
|
|
1722
|
+
Buffer.from("PARALITH_RELEASE_V2"),
|
|
1586
1723
|
program.toBuffer(),
|
|
1724
|
+
rootBytes(PUSD),
|
|
1725
|
+
u64(epoch),
|
|
1587
1726
|
u64(id),
|
|
1588
1727
|
mint.toBuffer(),
|
|
1589
1728
|
to.toBuffer(),
|
|
@@ -1761,7 +1900,7 @@ function registerBridge(server) {
|
|
|
1761
1900
|
},
|
|
1762
1901
|
WRITE
|
|
1763
1902
|
);
|
|
1764
|
-
const nudgeNodes = () => Promise.all((chains.nodes ?? []).map((n) => fetch(`${n.url}/~bridge@1.0/nudge`, { signal: AbortSignal.timeout(1e4) }).catch(() => {
|
|
1903
|
+
const nudgeNodes = () => Promise.all((chains.nodes ?? []).map((n) => fetch(`${n.url}/~bridge-attestor@1.0/nudge`, { signal: AbortSignal.timeout(1e4) }).catch(() => {
|
|
1765
1904
|
})));
|
|
1766
1905
|
tool(
|
|
1767
1906
|
server,
|
|
@@ -1805,7 +1944,7 @@ function registerBridge(server) {
|
|
|
1805
1944
|
if (!wait) return out;
|
|
1806
1945
|
const info = await readKey(PUSD, "bridgeinfo");
|
|
1807
1946
|
const set = info?.attestors ?? [];
|
|
1808
|
-
const k = Math.floor(
|
|
1947
|
+
const k = Math.floor(set.length / 2) + 1;
|
|
1809
1948
|
const signed = (w2) => set.filter((m) => w2?.sigs?.[m.ao]).length;
|
|
1810
1949
|
const list = await until(
|
|
1811
1950
|
`${k} node signatures`,
|
|
@@ -1814,7 +1953,7 @@ function registerBridge(server) {
|
|
|
1814
1953
|
9e5
|
|
1815
1954
|
);
|
|
1816
1955
|
const w = list.find((x) => x.id === String(reply.WithdrawalId));
|
|
1817
|
-
const tx = await c.claim(w, set, Number(info.namespace));
|
|
1956
|
+
const tx = await c.claim(w, set, Number(info.namespace), Number(info.epoch));
|
|
1818
1957
|
if (!own) return { ...out, status: "released", tx };
|
|
1819
1958
|
const after = await until("release", () => c.balance(), (b) => b >= before + BigInt(w.amount), 3e5);
|
|
1820
1959
|
return { ...out, status: "released", tx, received: formatAtoms(after - before) };
|
|
@@ -1835,15 +1974,21 @@ function registerBridge(server) {
|
|
|
1835
1974
|
READ
|
|
1836
1975
|
);
|
|
1837
1976
|
}
|
|
1838
|
-
var DAILY_FAUCET,
|
|
1977
|
+
var DAILY_FAUCET, DAY_MS2, CHAIN, PUSD, rootBytes, rootHex, faucetToken, pusdBalance;
|
|
1839
1978
|
var init_bridge = __esm({
|
|
1840
1979
|
"src/bridge.mjs"() {
|
|
1841
1980
|
init_runtime();
|
|
1842
1981
|
init_tool();
|
|
1843
1982
|
DAILY_FAUCET = 100000000n;
|
|
1844
|
-
|
|
1983
|
+
DAY_MS2 = 864e5;
|
|
1845
1984
|
CHAIN = z4.enum(["base", "solana", "sui"]);
|
|
1846
1985
|
PUSD = graph.processes.pusd;
|
|
1986
|
+
rootBytes = (id) => {
|
|
1987
|
+
const bytes = Buffer.from(id, "base64url");
|
|
1988
|
+
if (bytes.length !== 32) throw new Error("Canonical PUSD root must decode to 32 bytes.");
|
|
1989
|
+
return bytes;
|
|
1990
|
+
};
|
|
1991
|
+
rootHex = (id) => `0x${rootBytes(id).toString("hex")}`;
|
|
1847
1992
|
faucetToken = (cfg) => (cfg.tokens ?? []).find((t) => t.faucet) ?? cfg.tokens?.[0];
|
|
1848
1993
|
pusdBalance = (address) => readAtoms(PUSD, `balance-${address}`);
|
|
1849
1994
|
}
|
|
@@ -1932,7 +2077,7 @@ function registerDao(server) {
|
|
|
1932
2077
|
tool(
|
|
1933
2078
|
server,
|
|
1934
2079
|
"dao_stake",
|
|
1935
|
-
"stake: transfer
|
|
2080
|
+
"stake: transfer RUNE from your wallet into the DAO (counts as active stake at once). unstake: move active stake to cooling (amount omitted = all); it pays out after the unstake delay, or later if a vote locks it. withdraw: pay out cooling stake whose release time has passed. Use asset_withdraw rune first if your RUNE is in the game.",
|
|
1936
2081
|
{ action: z5.enum(["stake", "unstake", "withdraw"]), amount: z5.string().optional().describe("RUNE, decimal.") },
|
|
1937
2082
|
async ({ action, amount }) => {
|
|
1938
2083
|
const { api, wallets } = await runtime();
|
|
@@ -2024,9 +2169,9 @@ var init_dao = __esm({
|
|
|
2024
2169
|
|
|
2025
2170
|
// src/vaults.mjs
|
|
2026
2171
|
import { z as z6 } from "zod";
|
|
2027
|
-
async function terms2(
|
|
2172
|
+
async function terms2() {
|
|
2028
2173
|
const { api } = await runtime();
|
|
2029
|
-
const process2 =
|
|
2174
|
+
const process2 = BOOK2();
|
|
2030
2175
|
const [info, markets] = await Promise.all([readKey(process2, "vaultinfo"), api.readVenueMarkets(process2)]);
|
|
2031
2176
|
const assets = info?.Assets ?? {};
|
|
2032
2177
|
return { process: process2, markets: markets ?? {}, den: (asset) => Number(assets[asset]?.denomination ?? 0) };
|
|
@@ -2066,10 +2211,10 @@ function registerVaults(server) {
|
|
|
2066
2211
|
tool(
|
|
2067
2212
|
server,
|
|
2068
2213
|
"vault_list",
|
|
2069
|
-
"Strategy vaults on
|
|
2070
|
-
{
|
|
2071
|
-
async ({
|
|
2072
|
-
const t = await terms2(
|
|
2214
|
+
"Strategy vaults on the book (one amm, active and grid per market): status, holdings, locked and burned share with their value and unlock dates, spacing, crank budget. Whole units. Optionally one market. Free.",
|
|
2215
|
+
{ item: z6.string().optional().describe("Base asset or market, e.g. fire or rune_gold.") },
|
|
2216
|
+
async ({ item }) => {
|
|
2217
|
+
const t = await terms2();
|
|
2073
2218
|
const { api } = await runtime();
|
|
2074
2219
|
const all = await api.readVenueVaults(t.process);
|
|
2075
2220
|
const out = {};
|
|
@@ -2086,9 +2231,9 @@ function registerVaults(server) {
|
|
|
2086
2231
|
server,
|
|
2087
2232
|
"vault_position",
|
|
2088
2233
|
"Vault shares held by an address (yours unless given): shares, unlocked shares, locks with dates, and the value they own in whole units. Free.",
|
|
2089
|
-
{
|
|
2090
|
-
async ({
|
|
2091
|
-
const t = await terms2(
|
|
2234
|
+
{ address: z6.string().optional() },
|
|
2235
|
+
async ({ address }) => {
|
|
2236
|
+
const t = await terms2();
|
|
2092
2237
|
const { api, wallets } = await runtime();
|
|
2093
2238
|
const who = address ?? wallets?.ao.address;
|
|
2094
2239
|
if (!who) throw new Error("This server has no wallet; pass an address.");
|
|
@@ -2111,9 +2256,8 @@ function registerVaults(server) {
|
|
|
2111
2256
|
tool(
|
|
2112
2257
|
server,
|
|
2113
2258
|
"vault_deposit",
|
|
2114
|
-
"Deposit into a strategy vault. base and quote are MAXIMA in whole units: the vault takes them in its own ratio and uses only what that needs (a vault's first deposit needs both and sets its price). Funds must be in your
|
|
2259
|
+
"Deposit into a strategy vault. base and quote are MAXIMA in whole units: the vault takes them in its own ratio and uses only what that needs (a vault's first deposit needs both and sets its price). Funds must be in your book balance (exchange_transfer deposit first); what is short on the market is moved there in the same signature. lock_days locks the new shares; burn gives them up forever (cannot be undone). Active and grid lose heavily in trends.",
|
|
2115
2260
|
{
|
|
2116
|
-
venue: VENUE2,
|
|
2117
2261
|
item: z6.string(),
|
|
2118
2262
|
strategy: STRATEGY,
|
|
2119
2263
|
base: z6.string().describe("Most base to put in, decimal."),
|
|
@@ -2121,9 +2265,9 @@ function registerVaults(server) {
|
|
|
2121
2265
|
lock_days: z6.number().int().positive().max(3650).optional(),
|
|
2122
2266
|
burn: z6.boolean().optional()
|
|
2123
2267
|
},
|
|
2124
|
-
async ({
|
|
2268
|
+
async ({ item, strategy, base: base2, quote, lock_days, burn }) => {
|
|
2125
2269
|
if (lock_days && burn) throw new Error("Lock or burn, not both.");
|
|
2126
|
-
const t = await terms2(
|
|
2270
|
+
const t = await terms2();
|
|
2127
2271
|
const m = marketFor2(t, item);
|
|
2128
2272
|
const { api } = await runtime();
|
|
2129
2273
|
return api.depositVenueVault(
|
|
@@ -2132,7 +2276,7 @@ function registerVaults(server) {
|
|
|
2132
2276
|
strategy,
|
|
2133
2277
|
parseAmount(base2, t.den(m.base)),
|
|
2134
2278
|
parseAmount(quote, t.den(m.quote)),
|
|
2135
|
-
{ lockFor: lock_days ? lock_days *
|
|
2279
|
+
{ lockFor: lock_days ? lock_days * DAY_MS3 : void 0, burn: !!burn }
|
|
2136
2280
|
);
|
|
2137
2281
|
},
|
|
2138
2282
|
WRITE
|
|
@@ -2140,19 +2284,18 @@ function registerVaults(server) {
|
|
|
2140
2284
|
tool(
|
|
2141
2285
|
server,
|
|
2142
2286
|
"vault_shares",
|
|
2143
|
-
'Act on your UNLOCKED vault shares: withdraw (paid in kind to your
|
|
2287
|
+
'Act on your UNLOCKED vault shares: withdraw (paid in kind to your book balance on that market; works while trading is paused), lock for lock_days, or burn (forever; the value stays in the vault). shares is a number or "all".',
|
|
2144
2288
|
{
|
|
2145
|
-
venue: VENUE2,
|
|
2146
2289
|
item: z6.string(),
|
|
2147
2290
|
strategy: STRATEGY,
|
|
2148
2291
|
action: z6.enum(["withdraw", "lock", "burn"]),
|
|
2149
2292
|
shares: z6.string().describe('"all" or a whole number of shares.'),
|
|
2150
2293
|
lock_days: z6.number().int().positive().max(3650).optional()
|
|
2151
2294
|
},
|
|
2152
|
-
async ({
|
|
2295
|
+
async ({ item, strategy, action, shares, lock_days }) => {
|
|
2153
2296
|
if (action === "lock" && !lock_days) throw new Error("A lock needs lock_days.");
|
|
2154
2297
|
if (shares !== "all" && !/^\d+$/.test(shares)) throw new Error('shares is "all" or a whole number.');
|
|
2155
|
-
const t = await terms2(
|
|
2298
|
+
const t = await terms2();
|
|
2156
2299
|
const m = marketFor2(t, item);
|
|
2157
2300
|
const { api } = await runtime();
|
|
2158
2301
|
return api.venueVaultShares(
|
|
@@ -2161,7 +2304,7 @@ function registerVaults(server) {
|
|
|
2161
2304
|
strategy,
|
|
2162
2305
|
action,
|
|
2163
2306
|
shares === "all" ? "all" : BigInt(shares),
|
|
2164
|
-
lock_days ? lock_days *
|
|
2307
|
+
lock_days ? lock_days * DAY_MS3 : void 0
|
|
2165
2308
|
);
|
|
2166
2309
|
},
|
|
2167
2310
|
WRITE
|
|
@@ -2170,9 +2313,9 @@ function registerVaults(server) {
|
|
|
2170
2313
|
server,
|
|
2171
2314
|
"vault_fund",
|
|
2172
2315
|
"Add to a vault's crank budget, in whole quote units. Anyone may; holders do not own it. It pays whoever cranks the vault when its orders need requoting.",
|
|
2173
|
-
{
|
|
2174
|
-
async ({
|
|
2175
|
-
const t = await terms2(
|
|
2316
|
+
{ item: z6.string(), strategy: STRATEGY, amount: z6.string() },
|
|
2317
|
+
async ({ item, strategy, amount }) => {
|
|
2318
|
+
const t = await terms2();
|
|
2176
2319
|
const m = marketFor2(t, item);
|
|
2177
2320
|
const { api } = await runtime();
|
|
2178
2321
|
return api.fundVenueVault(t.process, m.base, strategy, parseAmount(amount, t.den(m.quote)));
|
|
@@ -2183,9 +2326,9 @@ function registerVaults(server) {
|
|
|
2183
2326
|
server,
|
|
2184
2327
|
"vault_crank",
|
|
2185
2328
|
"Requote a vault whose orders expired or were refused. Pays you 1% of its crank budget if it changed something and nobody was paid for it in the last 60 s; otherwise it pays nothing. Fills never need a crank. Worth it only when vault_list shows a dueAt that has passed; a vault that is not due answers idle.",
|
|
2186
|
-
{
|
|
2187
|
-
async ({
|
|
2188
|
-
const t = await terms2(
|
|
2329
|
+
{ item: z6.string(), strategy: STRATEGY },
|
|
2330
|
+
async ({ item, strategy }) => {
|
|
2331
|
+
const t = await terms2();
|
|
2189
2332
|
const m = marketFor2(t, item);
|
|
2190
2333
|
const { api } = await runtime();
|
|
2191
2334
|
return api.crankVenueVault(t.process, m.base, strategy);
|
|
@@ -2193,15 +2336,14 @@ function registerVaults(server) {
|
|
|
2193
2336
|
WRITE
|
|
2194
2337
|
);
|
|
2195
2338
|
}
|
|
2196
|
-
var
|
|
2339
|
+
var STRATEGY, BOOK2, DAY_MS3, pct, iso2;
|
|
2197
2340
|
var init_vaults = __esm({
|
|
2198
2341
|
"src/vaults.mjs"() {
|
|
2199
2342
|
init_runtime();
|
|
2200
2343
|
init_tool();
|
|
2201
|
-
VENUE2 = z6.enum(["game", "token"]).describe("game: items vs Gold. token: element tokens vs TEST-RUNE.");
|
|
2202
2344
|
STRATEGY = z6.enum(["amm", "active", "grid"]).describe("amm: passive, steady, close to holding. active: concentrated, best sideways, loses most in trends. grid: fixed steps, best range-bound, loses in trends.");
|
|
2203
|
-
|
|
2204
|
-
|
|
2345
|
+
BOOK2 = () => graph.processes.externalVenue;
|
|
2346
|
+
DAY_MS3 = 864e5;
|
|
2205
2347
|
pct = (part, whole) => BigInt(whole || 0) > 0n ? `${(Number(BigInt(part || 0) * 10000n / BigInt(whole)) / 100).toFixed(2)}%` : "0%";
|
|
2206
2348
|
iso2 = (ms) => ms && Number(ms) > 0 ? new Date(Number(ms)).toISOString() : void 0;
|
|
2207
2349
|
}
|
|
@@ -2256,7 +2398,6 @@ function registerShow(server) {
|
|
|
2256
2398
|
monster_id: z7.string().optional().describe("companion: which one; omit for the active companion."),
|
|
2257
2399
|
battle_id: z7.string().optional().describe("battle: a specific battle, with worker."),
|
|
2258
2400
|
worker: z7.string().optional().describe("battle: the battle worker process id."),
|
|
2259
|
-
venue: z7.enum(["game", "token"]).optional().describe("market/vault/position. Default token."),
|
|
2260
2401
|
market: z7.string().optional().describe("market/vault: the market, as exchange_markets lists it."),
|
|
2261
2402
|
vault: z7.enum(["amm", "active", "grid"]).optional(),
|
|
2262
2403
|
chain: z7.enum(["base", "solana", "sui"]).optional().describe("bridge: with tx, one transfer."),
|
|
@@ -2294,9 +2435,9 @@ var init_show = __esm({
|
|
|
2294
2435
|
battle: (a) => a.battle_id && a.worker ? link(GAME, "battle", { w: a.worker, b: a.battle_id, a: a.address }) : link(GAME, "battle", { a: need2(a, "address") }),
|
|
2295
2436
|
companion: (a) => link(GAME, "companion", { a: need2(a, "address"), m: a.monster_id }),
|
|
2296
2437
|
hunt: (a) => link(GAME, "hunt", { a: need2(a, "address") }),
|
|
2297
|
-
market: (a) => link(TRADE, "market", { venue:
|
|
2298
|
-
vault: (a) => link(TRADE, "vault", { venue:
|
|
2299
|
-
position: (a) => link(TRADE, "position", { venue:
|
|
2438
|
+
market: (a) => link(TRADE, "market", { venue: "token", m: need2(a, "market") }),
|
|
2439
|
+
vault: (a) => link(TRADE, "vault", { venue: "token", m: need2(a, "market"), v: a.vault ?? "amm" }),
|
|
2440
|
+
position: (a) => link(TRADE, "position", { venue: "token", a: need2(a, "address") }),
|
|
2300
2441
|
bridge: (a) => link(TRADE, "bridge", { a: a.address, chain: a.chain, tx: a.tx })
|
|
2301
2442
|
};
|
|
2302
2443
|
}
|
|
@@ -2334,7 +2475,7 @@ async function report({ name, addresses: a }) {
|
|
|
2334
2475
|
}
|
|
2335
2476
|
const [p, tokens, venues, redemptions] = await Promise.all([
|
|
2336
2477
|
api.readPlayer(a.ao).catch(() => null),
|
|
2337
|
-
Promise.all(Object.entries(
|
|
2478
|
+
Promise.all(Object.entries(TOKENS).map(async ([t, id]) => [t, await readAtoms(id, `balance-${a.ao}`).catch(() => 0n)])),
|
|
2338
2479
|
Promise.all(Object.entries(VENUES).map(async ([v, pid]) => [
|
|
2339
2480
|
v,
|
|
2340
2481
|
await api.readVenuePosition(pid, a.ao).catch(() => null),
|
|
@@ -2352,6 +2493,7 @@ async function report({ name, addresses: a }) {
|
|
|
2352
2493
|
faction: p.faction,
|
|
2353
2494
|
gold: p.gold,
|
|
2354
2495
|
rune: p.inventory?.rune ?? 0,
|
|
2496
|
+
berries: Object.fromEntries(BERRIES2.map((b) => [b, p.inventory?.[b] ?? 0])),
|
|
2355
2497
|
companion: c && { name: c.name, level: c.level, exp: c.exp, energy: c.energy, happiness: c.happiness },
|
|
2356
2498
|
arena: { wins: p.wins ?? 0, losses: p.losses ?? 0, rating: p.rating, sessionBattlesLeft: p.battlesRemaining ?? 0 },
|
|
2357
2499
|
...p.battleFleet ? { inBattle: p.battleFleet.battleId } : {},
|
|
@@ -2362,7 +2504,7 @@ async function report({ name, addresses: a }) {
|
|
|
2362
2504
|
if (raw && Number(raw.exp ?? 0) >= Number(raw.nextLevelExp ?? Infinity)) todo.push("Companion can level up (game_level_up).");
|
|
2363
2505
|
if (c && (c.energy < 25 || c.happiness < 25)) todo.push("Companion is below the arena's 25 energy/happiness: feed or play.");
|
|
2364
2506
|
}
|
|
2365
|
-
const held = Object.fromEntries(tokens.filter(([, v]) => v > 0n).map(([t, v]) => [t, formatAtoms(v)]));
|
|
2507
|
+
const held = Object.fromEntries(tokens.filter(([, v]) => v > 0n).map(([t, v]) => [t, formatAtoms(v, TOKEN_DECIMALS[t] ?? 6)]));
|
|
2366
2508
|
if (Object.keys(held).length) out.tokens = held;
|
|
2367
2509
|
const trading = {};
|
|
2368
2510
|
for (const [v, pos, vaults] of venues) {
|
|
@@ -2386,7 +2528,7 @@ function registerProgress(server) {
|
|
|
2386
2528
|
tool(
|
|
2387
2529
|
server,
|
|
2388
2530
|
"progress",
|
|
2389
|
-
'How an agent is doing, in one free read: game (companion, Gold, Rune, arena record, live battle or hunt), tokens, open orders and vault shares on
|
|
2531
|
+
'How an agent is doing, in one free read: game (companion, Gold, Rune, berries, arena record, live battle or hunt), tokens, open orders and vault shares on the book, pending bridge redemptions, chain gas, and what needs doing next. who: omit for yourself, "all" for every agent set up on this machine, an agent name (claude, codex, grok) or an AO address.',
|
|
2390
2532
|
{ who: z8.string().optional() },
|
|
2391
2533
|
async ({ who }) => {
|
|
2392
2534
|
const list = await Promise.all((await targets(who)).map(report));
|
|
@@ -2395,7 +2537,7 @@ function registerProgress(server) {
|
|
|
2395
2537
|
READ
|
|
2396
2538
|
);
|
|
2397
2539
|
}
|
|
2398
|
-
var VENUES, count;
|
|
2540
|
+
var VENUES, BERRIES2, count;
|
|
2399
2541
|
var init_progress = __esm({
|
|
2400
2542
|
"src/progress.mjs"() {
|
|
2401
2543
|
init_runtime();
|
|
@@ -2404,7 +2546,8 @@ var init_progress = __esm({
|
|
|
2404
2546
|
init_keys();
|
|
2405
2547
|
init_bridge();
|
|
2406
2548
|
init_views();
|
|
2407
|
-
VENUES = {
|
|
2549
|
+
VENUES = { book: graph.processes.externalVenue };
|
|
2550
|
+
BERRIES2 = ["air_berry", "water_berry", "fire_berry", "rock_berry"];
|
|
2408
2551
|
count = (x) => Array.isArray(x) ? x.length : Object.values(x ?? {}).reduce((n, v) => n + Number(v || 0), 0);
|
|
2409
2552
|
}
|
|
2410
2553
|
});
|
|
@@ -2424,15 +2567,15 @@ function buildServer() {
|
|
|
2424
2567
|
tool(
|
|
2425
2568
|
server,
|
|
2426
2569
|
"wallet",
|
|
2427
|
-
"Your addresses on AO, Base, Solana and Sui (all from one phrase) and your AO-side balances: in-game Gold and Rune,
|
|
2570
|
+
"Your addresses on AO, Base, Solana and Sui (all from one phrase) and your AO-side balances: in-game Gold, Rune and berries; the Rune, Gold and berry tokens; and PUSD. First call derives the AO key (~30 s, then cached).",
|
|
2428
2571
|
{},
|
|
2429
2572
|
async () => {
|
|
2430
2573
|
const { api, wallets } = await runtime();
|
|
2431
2574
|
const ao = wallets.ao.address;
|
|
2432
2575
|
const player3 = await api.readPlayer(ao).catch(() => null);
|
|
2433
2576
|
const tokens = {};
|
|
2434
|
-
for (const [name, id] of Object.entries(
|
|
2435
|
-
tokens[name] = formatAtoms(await readAtoms(id, `balance-${ao}`).catch(() => 0n));
|
|
2577
|
+
for (const [name, id] of Object.entries(TOKENS)) {
|
|
2578
|
+
tokens[name] = formatAtoms(await readAtoms(id, `balance-${ao}`).catch(() => 0n), TOKEN_DECIMALS[name] ?? 6);
|
|
2436
2579
|
}
|
|
2437
2580
|
return {
|
|
2438
2581
|
addresses: publicAddresses(wallets),
|
|
@@ -2446,7 +2589,7 @@ function buildServer() {
|
|
|
2446
2589
|
tool(
|
|
2447
2590
|
server,
|
|
2448
2591
|
"read_state",
|
|
2449
|
-
`Read any published key of any process, free: /<process>~process@1.0/now/<key>. process is an id or an alias (${Object.keys(PROCESS_ALIASES).join(", ")}). Returns null when absent. Common keys: game: player-<address>, catalogref (the catalog's id, not catalog), leaderboard, factions, arenatiers, challenges, economy, economybook, market, markethistory, battlefleet, huntconfig, access. rune and
|
|
2592
|
+
`Read any published key of any process, free: /<process>~process@1.0/now/<key>. process is an id or an alias (${Object.keys(PROCESS_ALIASES).join(", ")}). Returns null when absent. Common keys: game: player-<address>, catalogref (the catalog's id, not catalog), leaderboard, factions, arenatiers, challenges, economy, economybook, market, markethistory, battlefleet, huntconfig, access, assetprocesses, supply. Sharded, leaderboard, factions, users, arenatiers, economy, economybook, access and supply are each shard's own: read them from game-<shard> (the game_* tools merge them or pick yours). rune, gold and <berry>-token: balance-<address>, tokeninfo (not info), totalsupply. pusd: balance-<address>, bridgeinfo, withdrawals. dao: daoinfo, proposals. token-venue: balance-<address>, vaultinfo, vaultpairs.`,
|
|
2450
2593
|
{ process: z9.string(), key: z9.string() },
|
|
2451
2594
|
async ({ process: process2, key }) => readKey(process2, key),
|
|
2452
2595
|
READ
|
|
@@ -2508,35 +2651,38 @@ var init_build = __esm({
|
|
|
2508
2651
|
init_progress();
|
|
2509
2652
|
init_update();
|
|
2510
2653
|
DOCS = process.env.PARALITH_DOCS_URL || "https://docs.paralithmarkets.com";
|
|
2511
|
-
INSTRUCTIONS = `Paralith on AO (HyperBEAM): Rune Realm (a companion game),
|
|
2512
|
-
|
|
2654
|
+
INSTRUCTIONS = `Paralith on AO (HyperBEAM): Rune Realm (a companion game), an order book quoted in Gold, and the PUSD bridge.
|
|
2655
|
+
PUSD and the DAO are TEST deployments. Reads are free; every write is a signed message (a few seconds round trip, longer under load).
|
|
2513
2656
|
|
|
2514
2657
|
Start: wallet -> game_player. No account? game_join (pick a faction).
|
|
2515
2658
|
Core loop: game_daily once a day; game_companion feed/play keep energy and happiness up, quest then claim earns exp and Gold;
|
|
2516
2659
|
game_level_up when exp allows; game_learn_move when an offer is pending (it expires at the next level-up).
|
|
2517
2660
|
Arena: arena_enter (25 energy + 25 happiness, 4 fights), arena_fight mode=bot, then arena_attack each round
|
|
2518
2661
|
(read arena_battle for moves and uses left; Rally and Mend are free once each), arena_end leave when done.
|
|
2519
|
-
Hunt: hunt_begin (
|
|
2520
|
-
-> hunt_act search -> attack until defeated -> capture (1-3 Rune
|
|
2521
|
-
|
|
2662
|
+
Hunt: hunt_begin (25 energy + 25 happiness and 5 of each berry, not refunded; up to 3 Rune set aside and returned unless a capture spends them)
|
|
2663
|
+
-> hunt_act search -> attack until defeated -> capture (1-3 Rune) or end. One encounter per hunt.
|
|
2664
|
+
Game <-> wallet: asset_withdraw (in-game -> token; Gold at least 10) / asset_deposit (token -> in-game; needs a game account) for rune, gold and the four berries, whole units.
|
|
2665
|
+
Markets: exchange_markets / exchange_book / exchange_order on the one book: air, water, fire, rock and rune, each quoted in Gold.
|
|
2522
2666
|
Vaults (pooled liquidity, one amm/active/grid per market): vault_list, vault_position, vault_deposit, vault_shares (withdraw/lock/burn), vault_fund, vault_crank.
|
|
2523
|
-
|
|
2524
|
-
DAO (stake
|
|
2667
|
+
Bridge: bridge_balances, bridge_faucet, bridge_deposit, bridge_redeem.
|
|
2668
|
+
DAO (stake RUNE; a passed proposal may send one attached message): dao_info, dao_proposals, dao_stake stake/unstake/withdraw, dao_propose, dao_vote.
|
|
2525
2669
|
|
|
2526
2670
|
HOW RESOURCES FLOW. When asked for a resource, find its path here, check what you hold (progress), then say the route before acting.
|
|
2527
|
-
- Gold
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2671
|
+
- Rune, Gold and the four berries each exist twice: an in-game balance (what the game spends) and a wallet token (what the
|
|
2672
|
+
exchange trades). asset_withdraw and asset_deposit convert 1:1 in whole units; token fractions only come from trading.
|
|
2673
|
+
- Gold. Earn in game: quest claims and arena bot wins, which share one 60 Gold allowance per 20 h (play pays happiness only);
|
|
2674
|
+
selling berries or Rune to the shop (game_shop sell). On the exchange: sell a berry or Rune for the GOLD token.
|
|
2675
|
+
Spend: arena stakes, shop buys; GOLD token buys on the exchange.
|
|
2676
|
+
- Berries. Get: joining, crates (game_daily, game_lootbox), buying with Gold (game_shop); berry tokens from
|
|
2677
|
+
berry_claim (free, one berry kind per wallet per UTC day, 1-10 set by the hour) or the exchange. To use them in game,
|
|
2678
|
+
game_join first (a wallet with no account cannot deposit), then asset_deposit.
|
|
2679
|
+
Use: feed the companion, the hunt entry fee (5 of each berry), arena boosts.
|
|
2680
|
+
- Rune. Get: (1) the shop, only if game_shop_quote shows an ask (it often only bids); (2) sell a companion on companion_market;
|
|
2681
|
+
(3) the token route: berry_claim -> exchange_order sell the berry for GOLD -> exchange_order buy rune -> asset_deposit rune
|
|
2682
|
+
(the deposit needs a game account: game_join first).
|
|
2683
|
+
Public accounts accrue no Rune from game_daily (pass holders only).
|
|
2537
2684
|
Spend in-game Rune: game_level_up (ceil(L^2/32) for level L), hunt capture, companion_market buys, game_companion store (1 Rune).
|
|
2538
|
-
|
|
2539
|
-
- Element tokens (TEST-EARTH/AIR/FIRE/WATER): element_claim daily; trade against TEST-RUNE on the token venue; vault liquidity.
|
|
2685
|
+
RUNE token: exchange, vaults, dao_stake.
|
|
2540
2686
|
- PUSD: bridge in TEST-USDC from Base, Solana or Sui (needs that chain's gas, which the user funds; bridge_faucet gives TEST-USDC).
|
|
2541
2687
|
No PUSD market is listed yet. bridge_redeem waits for k attestor signatures and submits the release (needs destination-chain gas).
|
|
2542
2688
|
- Vaults: deposit both sides of a market to earn from its strategy; withdraw with vault_shares.
|
|
@@ -2552,14 +2698,14 @@ A refusal ({"error": ...}) costs nothing. Use game_catalog for exact costs and m
|
|
|
2552
2698
|
READ_ONLY_INSTRUCTIONS = `This endpoint is READ-ONLY: it explains the protocol and reads live state for any address, free.
|
|
2553
2699
|
To play, trade or bridge, run the local server with a wallet phrase: ${DOCS}/ai/mcp
|
|
2554
2700
|
|
|
2555
|
-
Paralith on AO (HyperBEAM): Rune Realm (a companion game),
|
|
2556
|
-
|
|
2701
|
+
Paralith on AO (HyperBEAM): Rune Realm (a companion game), an order book quoted in Gold, and the PUSD bridge.
|
|
2702
|
+
PUSD and the DAO are TEST deployments. Pass an address wherever a tool takes one.
|
|
2557
2703
|
|
|
2558
2704
|
- Game: game_player (account, companions, live battle or hunt), game_catalog (rules, costs, move stats),
|
|
2559
2705
|
game_world (factions, arena tiers, open challenges, leaderboard), arena_battle (address or battle_id), hunt_state (address),
|
|
2560
2706
|
game_shop_quote (NPC shop prices and stock), companion_market_browse (listings and recent sales).
|
|
2561
|
-
- Markets: exchange_markets / exchange_book / exchange_position on
|
|
2562
|
-
vault_list, vault_position.
|
|
2707
|
+
- Markets: exchange_markets / exchange_book / exchange_position on the one book (air, water, fire, rock and rune, each quoted
|
|
2708
|
+
in Gold); vault_list, vault_position.
|
|
2563
2709
|
- Bridge and DAO: bridge_info, bridge_status, dao_info, dao_proposals, dao_stake_info.
|
|
2564
2710
|
- Anything else: progress (one address across everything), read_state (any published key), protocol_docs.
|
|
2565
2711
|
|