@swarm-tips/client 0.2.1 → 0.2.3
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/SBOM.spdx.json +5 -5
- package/dist/coordination-game/chains.d.ts +52 -0
- package/dist/coordination-game/chains.js +52 -0
- package/dist/coordination-game/evm/index.d.ts +1 -0
- package/dist/coordination-game/evm/index.js +1 -0
- package/dist/coordination-game/index.d.ts +1 -0
- package/dist/coordination-game/index.js +1 -0
- package/dist/coordination-game/protocol.js +11 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/shillbot/api.d.ts +1 -0
- package/dist/shillbot/switchboard.js +19 -7
- package/dist/swarm/index.js +1 -1
- package/package.json +2 -1
package/SBOM.spdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"spdxVersion": "SPDX-2.3",
|
|
3
3
|
"dataLicense": "CC0-1.0",
|
|
4
4
|
"SPDXID": "SPDXRef-DOCUMENT",
|
|
5
|
-
"name": "@swarm-tips/client-0.2.
|
|
6
|
-
"documentNamespace": "https://swarm.tips/sbom/client/0.2.
|
|
5
|
+
"name": "@swarm-tips/client-0.2.3",
|
|
6
|
+
"documentNamespace": "https://swarm.tips/sbom/client/0.2.3",
|
|
7
7
|
"creationInfo": {
|
|
8
|
-
"created": "2026-09-
|
|
8
|
+
"created": "2026-09-09T05:14:05.500Z",
|
|
9
9
|
"creators": [
|
|
10
10
|
"Tool: sdk/client/scripts/generate-sbom.mjs",
|
|
11
11
|
"Organization: Swarm Tips"
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
{
|
|
16
16
|
"name": "@swarm-tips/client",
|
|
17
17
|
"SPDXID": "SPDXRef-Package",
|
|
18
|
-
"versionInfo": "0.2.
|
|
19
|
-
"downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.2.
|
|
18
|
+
"versionInfo": "0.2.3",
|
|
19
|
+
"downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.2.3",
|
|
20
20
|
"filesAnalyzed": false,
|
|
21
21
|
"licenseConcluded": "MIT",
|
|
22
22
|
"licenseDeclared": "MIT"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Canonical Coordination Game deployments, generated from the public chain registry. */
|
|
2
|
+
export declare const COORDINATION_GAME_DEPLOYMENTS: {
|
|
3
|
+
readonly "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": {
|
|
4
|
+
readonly displayName: "Solana Devnet";
|
|
5
|
+
readonly network: "testnet";
|
|
6
|
+
readonly namespace: "solana";
|
|
7
|
+
readonly coordinationGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P";
|
|
8
|
+
readonly crossChainGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P";
|
|
9
|
+
readonly stakeBaseUnits: 50000000n;
|
|
10
|
+
readonly maxTrancheBaseUnits: 100000000n;
|
|
11
|
+
};
|
|
12
|
+
readonly "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
|
|
13
|
+
readonly displayName: "Solana Mainnet";
|
|
14
|
+
readonly network: "mainnet";
|
|
15
|
+
readonly namespace: "solana";
|
|
16
|
+
readonly coordinationGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P";
|
|
17
|
+
readonly crossChainGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P";
|
|
18
|
+
readonly stakeBaseUnits: 68482585n;
|
|
19
|
+
readonly maxTrancheBaseUnits: 100000000n;
|
|
20
|
+
};
|
|
21
|
+
readonly "eip155:84532": {
|
|
22
|
+
readonly displayName: "Base Sepolia";
|
|
23
|
+
readonly network: "testnet";
|
|
24
|
+
readonly namespace: "eip155";
|
|
25
|
+
readonly coordinationGame: "0x4FBBceb96D2814b5d4ac26089Eb7E43471533253";
|
|
26
|
+
readonly crossChainGame: "0x7Cc7667f4B71c8eb1D4d3fADE088BFD8d01290AB";
|
|
27
|
+
readonly stakeBaseUnits: 3200000000000000n;
|
|
28
|
+
readonly maxTrancheBaseUnits: 6400000000000000n;
|
|
29
|
+
};
|
|
30
|
+
readonly "eip155:8453": {
|
|
31
|
+
readonly displayName: "Base";
|
|
32
|
+
readonly network: "mainnet";
|
|
33
|
+
readonly namespace: "eip155";
|
|
34
|
+
readonly coordinationGame: "0xd585baE48901513202dAEb7d4feE4Af508a96234";
|
|
35
|
+
readonly crossChainGame: "0x44aC6Eb44692Bcf724d7975B91B299E2c553Ca12";
|
|
36
|
+
readonly stakeBaseUnits: 2700000000000000n;
|
|
37
|
+
readonly maxTrancheBaseUnits: 5400000000000000n;
|
|
38
|
+
};
|
|
39
|
+
readonly "eip155:1": {
|
|
40
|
+
readonly displayName: "Ethereum";
|
|
41
|
+
readonly network: "mainnet";
|
|
42
|
+
readonly namespace: "eip155";
|
|
43
|
+
readonly coordinationGame: "0x265818b054E8413Bab870e0Ce0D8aB68400CF0F9";
|
|
44
|
+
readonly crossChainGame: "0xb84638E5d03AE68c5dC58408e05C001918A23fe9";
|
|
45
|
+
readonly stakeBaseUnits: 2700000000000000n;
|
|
46
|
+
readonly maxTrancheBaseUnits: 5400000000000000n;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type CoordinationGameChainId = keyof typeof COORDINATION_GAME_DEPLOYMENTS;
|
|
50
|
+
export type CoordinationGameDeployment = (typeof COORDINATION_GAME_DEPLOYMENTS)[CoordinationGameChainId];
|
|
51
|
+
/** Return the pinned deployment for a supported CAIP-2 chain ID. */
|
|
52
|
+
export declare function coordinationGameDeployment(chainId: string): CoordinationGameDeployment | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Canonical Coordination Game deployments, generated from the public chain registry. */
|
|
2
|
+
export const COORDINATION_GAME_DEPLOYMENTS = {
|
|
3
|
+
"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": {
|
|
4
|
+
displayName: "Solana Devnet",
|
|
5
|
+
network: "testnet",
|
|
6
|
+
namespace: "solana",
|
|
7
|
+
coordinationGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P",
|
|
8
|
+
crossChainGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P",
|
|
9
|
+
stakeBaseUnits: 50000000n,
|
|
10
|
+
maxTrancheBaseUnits: 100000000n,
|
|
11
|
+
},
|
|
12
|
+
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
|
|
13
|
+
displayName: "Solana Mainnet",
|
|
14
|
+
network: "mainnet",
|
|
15
|
+
namespace: "solana",
|
|
16
|
+
coordinationGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P",
|
|
17
|
+
crossChainGame: "2qqVk7kUqffnahiJpcQJCsSd8ErbEUgKTgCn1zYsw64P",
|
|
18
|
+
stakeBaseUnits: 68482585n,
|
|
19
|
+
maxTrancheBaseUnits: 100000000n,
|
|
20
|
+
},
|
|
21
|
+
"eip155:84532": {
|
|
22
|
+
displayName: "Base Sepolia",
|
|
23
|
+
network: "testnet",
|
|
24
|
+
namespace: "eip155",
|
|
25
|
+
coordinationGame: "0x4FBBceb96D2814b5d4ac26089Eb7E43471533253",
|
|
26
|
+
crossChainGame: "0x7Cc7667f4B71c8eb1D4d3fADE088BFD8d01290AB",
|
|
27
|
+
stakeBaseUnits: 3200000000000000n,
|
|
28
|
+
maxTrancheBaseUnits: 6400000000000000n,
|
|
29
|
+
},
|
|
30
|
+
"eip155:8453": {
|
|
31
|
+
displayName: "Base",
|
|
32
|
+
network: "mainnet",
|
|
33
|
+
namespace: "eip155",
|
|
34
|
+
coordinationGame: "0xd585baE48901513202dAEb7d4feE4Af508a96234",
|
|
35
|
+
crossChainGame: "0x44aC6Eb44692Bcf724d7975B91B299E2c553Ca12",
|
|
36
|
+
stakeBaseUnits: 2700000000000000n,
|
|
37
|
+
maxTrancheBaseUnits: 5400000000000000n,
|
|
38
|
+
},
|
|
39
|
+
"eip155:1": {
|
|
40
|
+
displayName: "Ethereum",
|
|
41
|
+
network: "mainnet",
|
|
42
|
+
namespace: "eip155",
|
|
43
|
+
coordinationGame: "0x265818b054E8413Bab870e0Ce0D8aB68400CF0F9",
|
|
44
|
+
crossChainGame: "0xb84638E5d03AE68c5dC58408e05C001918A23fe9",
|
|
45
|
+
stakeBaseUnits: 2700000000000000n,
|
|
46
|
+
maxTrancheBaseUnits: 5400000000000000n,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
/** Return the pinned deployment for a supported CAIP-2 chain ID. */
|
|
50
|
+
export function coordinationGameDeployment(chainId) {
|
|
51
|
+
return COORDINATION_GAME_DEPLOYMENTS[chainId];
|
|
52
|
+
}
|
|
@@ -81,8 +81,17 @@ export function decodeTournament(data) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
export function decodeTournamentStats(data) {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Stats readers need only the two u64 fields through byte 80. Accept that
|
|
85
|
+
// prefix so lightweight RPC fixtures and partial account slices do not need
|
|
86
|
+
// the trailing `finalized` byte required by the full decoder.
|
|
87
|
+
if (data.length < 80) {
|
|
88
|
+
throw new RangeError(`Tournament stats data too short: ${data.length} bytes`);
|
|
89
|
+
}
|
|
90
|
+
const view = viewOf(data);
|
|
91
|
+
return {
|
|
92
|
+
prizeLamports: view.getBigUint64(64, true),
|
|
93
|
+
gameCount: Number(view.getBigUint64(72, true)),
|
|
94
|
+
};
|
|
86
95
|
}
|
|
87
96
|
function hasCommitted(commit) {
|
|
88
97
|
return Array.from(commit).some((byte) => byte !== 0);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The unified client package version. Functional APIs live in typed subpaths. */
|
|
2
|
-
export declare const CLIENT_VERSION: "0.2.
|
|
2
|
+
export declare const CLIENT_VERSION: "0.2.3";
|
|
3
3
|
export declare const CLIENT_MANIFEST_SCHEMA: "swarm.client-manifest/v1";
|
|
4
4
|
export { SwarmClientError } from "./errors.js";
|
|
5
5
|
export type { SwarmClientErrorCode, SwarmClientErrorOptions } from "./errors.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** The unified client package version. Functional APIs live in typed subpaths. */
|
|
2
|
-
export const CLIENT_VERSION = "0.2.
|
|
2
|
+
export const CLIENT_VERSION = "0.2.3";
|
|
3
3
|
export const CLIENT_MANIFEST_SCHEMA = "swarm.client-manifest/v1";
|
|
4
4
|
export { SwarmClientError } from "./errors.js";
|
package/dist/shillbot/api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Connection, type BlockhashWithExpiryBlockHeight } from "@solana/web3.js";
|
|
2
2
|
import { HttpClient, type HttpClientOptions } from "../http.js";
|
|
3
3
|
import { type Action, type TransactionInspection, type WalletSignCallback } from "./index.js";
|
|
4
|
+
export type { Action } from "./index.js";
|
|
4
5
|
export interface PreparedTransactionResponse {
|
|
5
6
|
message?: string;
|
|
6
7
|
task_id?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AnchorProvider, Program } from "@coral-xyz/anchor";
|
|
2
|
+
import BN from "bn.js";
|
|
2
3
|
import { Buffer } from "buffer";
|
|
3
4
|
import { OracleJob } from "@switchboard-xyz/common/protos";
|
|
4
5
|
import { ComputeBudgetProgram, Keypair, PublicKey, Secp256k1Program, SystemProgram, TransactionInstruction, TransactionMessage, VersionedTransaction, } from "@solana/web3.js";
|
|
@@ -14,7 +15,6 @@ const SWITCHBOARD_PROGRAMS = {
|
|
|
14
15
|
};
|
|
15
16
|
const CROSSBAR_URL = "https://crossbar.switchboard.xyz";
|
|
16
17
|
const SWITCHBOARD_GATEWAY_API_VERSION = "1.0.0";
|
|
17
|
-
const anchorRuntime = anchor.default ?? anchor;
|
|
18
18
|
async function jsonResponse(response, description) {
|
|
19
19
|
if (!response.ok) {
|
|
20
20
|
throw new Error(`${description} failed with HTTP ${response.status}`);
|
|
@@ -120,11 +120,23 @@ function associatedTokenAddress(mint, owner) {
|
|
|
120
120
|
export async function buildSwitchboardCrankAndVerify(request) {
|
|
121
121
|
const switchboardProgramId = SWITCHBOARD_PROGRAMS[request.network];
|
|
122
122
|
const dummy = Keypair.generate();
|
|
123
|
-
const
|
|
124
|
-
|
|
123
|
+
const signDummy = async (transaction) => {
|
|
124
|
+
if ("partialSign" in transaction)
|
|
125
|
+
transaction.partialSign(dummy);
|
|
126
|
+
else
|
|
127
|
+
transaction.sign([dummy]);
|
|
128
|
+
return transaction;
|
|
129
|
+
};
|
|
130
|
+
const dummyWallet = {
|
|
131
|
+
publicKey: dummy.publicKey,
|
|
132
|
+
signTransaction: signDummy,
|
|
133
|
+
signAllTransactions: async (transactions) => Promise.all(transactions.map(signDummy)),
|
|
134
|
+
};
|
|
135
|
+
const provider = new AnchorProvider(request.connection, dummyWallet, { commitment: "confirmed" });
|
|
136
|
+
const idl = await Program.fetchIdl(switchboardProgramId, provider);
|
|
125
137
|
if (!idl)
|
|
126
138
|
throw new Error("failed to fetch Switchboard IDL");
|
|
127
|
-
const program = new
|
|
139
|
+
const program = new Program(idl, provider);
|
|
128
140
|
const switchboardAccounts = program.account;
|
|
129
141
|
const feedData = (await switchboardAccounts.pullFeedAccountData.fetch(request.feed));
|
|
130
142
|
const feedHashHex = Buffer.from(feedData.feedHash).toString("hex");
|
|
@@ -152,8 +164,8 @@ export async function buildSwitchboardCrankAndVerify(request) {
|
|
|
152
164
|
const oracleStats = oraclePubkeys.map((oracle) => PublicKey.findProgramAddressSync([Buffer.from("OracleStats"), oracle.toBuffer()], switchboardProgramId)[0]);
|
|
153
165
|
const feeds = response.median_responses.map((median) => median.feed_hash === feedHashHex ? request.feed : PublicKey.default);
|
|
154
166
|
const submit = program.instruction.pullFeedSubmitResponseConsensus({
|
|
155
|
-
slot: new
|
|
156
|
-
values: response.median_responses.map((median) => new
|
|
167
|
+
slot: new BN(response.slot),
|
|
168
|
+
values: response.median_responses.map((median) => new BN(median.value)),
|
|
157
169
|
}, {
|
|
158
170
|
accounts: {
|
|
159
171
|
queue: queuePubkey,
|
package/dist/swarm/index.js
CHANGED
|
@@ -49,7 +49,7 @@ export class SwarmClient {
|
|
|
49
49
|
async toolCount() {
|
|
50
50
|
const headers = { "Content-Type": "application/json", Accept: "application/json, text/event-stream" };
|
|
51
51
|
try {
|
|
52
|
-
const init = await this.fetchImpl(`${this.baseUrl}/mcp`, { method: "POST", headers, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: "2025-03-26", capabilities: {}, clientInfo: { name: "swarm-client", version: "0.2.
|
|
52
|
+
const init = await this.fetchImpl(`${this.baseUrl}/mcp`, { method: "POST", headers, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: "2025-03-26", capabilities: {}, clientInfo: { name: "swarm-client", version: "0.2.3" } } }) });
|
|
53
53
|
if (!init.ok)
|
|
54
54
|
return null;
|
|
55
55
|
const session = init.headers.get("mcp-session-id");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swarm-tips/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Typed browser and Node.js clients for Swarm Tips, Shillbot, and Coordination Game",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@coral-xyz/anchor": "^0.32.1",
|
|
97
97
|
"@solana/web3.js": "^1.98.4",
|
|
98
98
|
"@switchboard-xyz/common": "^5.7.0",
|
|
99
|
+
"bn.js": "^5.2.2",
|
|
99
100
|
"bs58": "^6.0.0",
|
|
100
101
|
"buffer": "^6.0.3",
|
|
101
102
|
"js-sha256": "^0.11.0"
|