kill-switch-mcp 1.2.5 → 1.2.7
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/dist/server.js +18 -18
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -15,6 +15,7 @@ import { existsSync as existsSync3 } from "fs";
|
|
|
15
15
|
import { readFile as readFile2 } from "fs/promises";
|
|
16
16
|
import { join as join3 } from "path";
|
|
17
17
|
import { homedir as homedir3 } from "os";
|
|
18
|
+
import { exec } from "child_process";
|
|
18
19
|
|
|
19
20
|
// src/sdk/types.ts
|
|
20
21
|
var PRAYER_NAMES = [
|
|
@@ -3851,23 +3852,16 @@ import {
|
|
|
3851
3852
|
createWalletClient,
|
|
3852
3853
|
http,
|
|
3853
3854
|
formatUnits,
|
|
3854
|
-
defineChain,
|
|
3855
3855
|
stringToHex,
|
|
3856
3856
|
pad
|
|
3857
3857
|
} from "viem";
|
|
3858
3858
|
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";
|
|
3859
|
+
import { Account } from "viem/tempo";
|
|
3860
|
+
import { tempoModerato, tempo } from "viem/chains";
|
|
3859
3861
|
var WALLET_DIR = join2(homedir2(), ".killswitch");
|
|
3860
3862
|
var WALLET_FILE = join2(WALLET_DIR, "access-key.json");
|
|
3861
|
-
var TEMPO_RPC = process.env.TEMPO_RPC_URL || "https://rpc.moderato.tempo.xyz";
|
|
3862
3863
|
var TEMPO_CHAIN_ID = parseInt(process.env.TEMPO_CHAIN_ID || "42431");
|
|
3863
|
-
var tempoChain =
|
|
3864
|
-
id: TEMPO_CHAIN_ID,
|
|
3865
|
-
name: TEMPO_CHAIN_ID === 4217 ? "Tempo" : "Tempo Testnet",
|
|
3866
|
-
nativeCurrency: { name: "USD", symbol: "USD", decimals: 18 },
|
|
3867
|
-
rpcUrls: {
|
|
3868
|
-
default: { http: [TEMPO_RPC] }
|
|
3869
|
-
}
|
|
3870
|
-
});
|
|
3864
|
+
var tempoChain = TEMPO_CHAIN_ID === 4217 ? tempo : tempoModerato;
|
|
3871
3865
|
var USDC_ADDRESS = process.env.USDC_ADDRESS || "0x20c0000000000000000000000000000000000000";
|
|
3872
3866
|
var FACTORY_ADDRESS = process.env.FACTORY_ADDRESS;
|
|
3873
3867
|
var PENDING_FILE = join2(WALLET_DIR, "pending-wallet.json");
|
|
@@ -4003,8 +3997,8 @@ function getPublicClient() {
|
|
|
4003
3997
|
transport: http()
|
|
4004
3998
|
});
|
|
4005
3999
|
}
|
|
4006
|
-
function getWalletClient(privateKey) {
|
|
4007
|
-
const account =
|
|
4000
|
+
function getWalletClient(privateKey, parentAddress) {
|
|
4001
|
+
const account = Account.fromSecp256k1(privateKey, { access: parentAddress });
|
|
4008
4002
|
return createWalletClient({
|
|
4009
4003
|
account,
|
|
4010
4004
|
chain: tempoChain,
|
|
@@ -4082,7 +4076,7 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
4082
4076
|
throw new Error("No game wallet found. Run setup_game_wallet first.");
|
|
4083
4077
|
}
|
|
4084
4078
|
const pub = getPublicClient();
|
|
4085
|
-
const walletClient = getWalletClient(wallet.accessKeyPrivate);
|
|
4079
|
+
const walletClient = getWalletClient(wallet.accessKeyPrivate, wallet.accountAddress);
|
|
4086
4080
|
const buyIn = await pub.readContract({
|
|
4087
4081
|
address: tournamentAddress,
|
|
4088
4082
|
abi: TOURNAMENT_ABI,
|
|
@@ -4130,6 +4124,13 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
4130
4124
|
}
|
|
4131
4125
|
|
|
4132
4126
|
// src/server.ts
|
|
4127
|
+
function openInBrowser(url) {
|
|
4128
|
+
const command = process.platform === "darwin" ? `open "${url}"` : process.platform === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
|
|
4129
|
+
exec(command, (error) => {
|
|
4130
|
+
if (error)
|
|
4131
|
+
console.error(`[MCP] Failed to open browser: ${error.message}`);
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4133
4134
|
var SERVER_URL2 = (() => {
|
|
4134
4135
|
const idx = process.argv.indexOf("--server");
|
|
4135
4136
|
if (idx !== -1 && process.argv[idx + 1])
|
|
@@ -5170,6 +5171,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
5170
5171
|
};
|
|
5171
5172
|
}
|
|
5172
5173
|
const { accessKeyAddress, authorizeUrl } = initiateWalletSetup();
|
|
5174
|
+
openInBrowser(authorizeUrl);
|
|
5173
5175
|
return {
|
|
5174
5176
|
content: [{
|
|
5175
5177
|
type: "text",
|
|
@@ -5178,18 +5180,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
5178
5180
|
"",
|
|
5179
5181
|
`Access key: ${accessKeyAddress}`,
|
|
5180
5182
|
"",
|
|
5181
|
-
"
|
|
5183
|
+
"A browser window has been opened to set up your wallet.",
|
|
5182
5184
|
"",
|
|
5183
|
-
`
|
|
5185
|
+
`If it didn't open, use this link: ${authorizeUrl}`,
|
|
5184
5186
|
"",
|
|
5185
|
-
"
|
|
5187
|
+
"In the browser:",
|
|
5186
5188
|
"1. Create a Tempo account using Face ID / Touch ID (or sign in)",
|
|
5187
5189
|
"2. Authorize Kill Switch to manage game deposits (one tap)",
|
|
5188
5190
|
"",
|
|
5189
5191
|
"No wallet app needed — just your browser and biometrics.",
|
|
5190
5192
|
"",
|
|
5191
|
-
"━━━ AFTER YOU'RE DONE ━━━",
|
|
5192
|
-
"",
|
|
5193
5193
|
"Come back here and run setup_game_wallet again to confirm."
|
|
5194
5194
|
].join(`
|
|
5195
5195
|
`)
|