kill-switch-mcp 1.2.14 → 1.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.
- package/dist/server.js +30 -18
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -3929,7 +3929,7 @@ var TOURNAMENT_ABI = [
|
|
|
3929
3929
|
{
|
|
3930
3930
|
name: "hasDeposited",
|
|
3931
3931
|
type: "function",
|
|
3932
|
-
inputs: [{ name: "", type: "
|
|
3932
|
+
inputs: [{ name: "", type: "bytes32" }],
|
|
3933
3933
|
outputs: [{ name: "", type: "bool" }],
|
|
3934
3934
|
stateMutability: "view"
|
|
3935
3935
|
}
|
|
@@ -4081,11 +4081,12 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
4081
4081
|
const have = formatUnits(balance, 6);
|
|
4082
4082
|
throw new Error(`Insufficient balance. Need $${needed} USDC, have $${have}.`);
|
|
4083
4083
|
}
|
|
4084
|
+
const usernameBytes = pad(stringToHex(username), { size: 32 });
|
|
4084
4085
|
const alreadyDeposited = await pub.readContract({
|
|
4085
4086
|
address: tournamentAddress,
|
|
4086
4087
|
abi: TOURNAMENT_ABI,
|
|
4087
4088
|
functionName: "hasDeposited",
|
|
4088
|
-
args: [
|
|
4089
|
+
args: [usernameBytes]
|
|
4089
4090
|
});
|
|
4090
4091
|
if (alreadyDeposited) {
|
|
4091
4092
|
throw new Error("You have already deposited in this tournament.");
|
|
@@ -4097,25 +4098,36 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
4097
4098
|
}
|
|
4098
4099
|
const keyAuth = readKeyAuthorization();
|
|
4099
4100
|
const sponsorOpts = feePayerUrl ? { feePayer: true } : {};
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
})
|
|
4101
|
+
let approveHash;
|
|
4102
|
+
try {
|
|
4103
|
+
approveHash = await walletClient.writeContract({
|
|
4104
|
+
address: USDC_ADDRESS,
|
|
4105
|
+
abi: ERC20_ABI,
|
|
4106
|
+
functionName: "approve",
|
|
4107
|
+
args: [tournamentAddress, buyIn],
|
|
4108
|
+
...sponsorOpts
|
|
4109
|
+
});
|
|
4110
|
+
} catch (e) {
|
|
4111
|
+
if (keyAuth && e.message?.includes("KeyNotFound")) {
|
|
4112
|
+
approveHash = await walletClient.writeContract({
|
|
4113
|
+
address: USDC_ADDRESS,
|
|
4114
|
+
abi: ERC20_ABI,
|
|
4115
|
+
functionName: "approve",
|
|
4116
|
+
args: [tournamentAddress, buyIn],
|
|
4117
|
+
keyAuthorization: keyAuth,
|
|
4118
|
+
gas: 700000n,
|
|
4119
|
+
...sponsorOpts
|
|
4120
|
+
});
|
|
4121
|
+
} else {
|
|
4122
|
+
throw e;
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4110
4125
|
await pub.waitForTransactionReceipt({ hash: approveHash });
|
|
4111
|
-
const usernameBytes = pad(stringToHex(username), { size: 32 });
|
|
4112
4126
|
const depositHash = await walletClient.writeContract({
|
|
4113
4127
|
address: tournamentAddress,
|
|
4114
4128
|
abi: TOURNAMENT_ABI,
|
|
4115
4129
|
functionName: "deposit",
|
|
4116
4130
|
args: [usernameBytes],
|
|
4117
|
-
...keyAuth ? { keyAuthorization: keyAuth } : {},
|
|
4118
|
-
...gasOpts,
|
|
4119
4131
|
...sponsorOpts
|
|
4120
4132
|
});
|
|
4121
4133
|
await pub.waitForTransactionReceipt({ hash: depositHash });
|
|
@@ -4153,7 +4165,7 @@ YOU are the brain of your bot. Your human talks strategy, you execute it in the
|
|
|
4153
4165
|
|
|
4154
4166
|
1. \`login\` — connects to the game (creates account if needed)
|
|
4155
4167
|
2. \`join_game\` — shows available games and buy-in tiers, or joins an existing queued game
|
|
4156
|
-
3. \`wait_for_game_start\` —
|
|
4168
|
+
3. \`wait_for_game_start\` — waits up to 60s for the match to begin. **Loop this**: if it times out, check if you're still in lobby and call it again. Games can take minutes to fill.
|
|
4157
4169
|
4. \`execute_code\` — fight! Use \`bot\`, \`sdk\`, and \`actions\` globals.
|
|
4158
4170
|
|
|
4159
4171
|
Before writing any execute_code, read \`killswitch://sdk-reference\` for the complete API.
|
|
@@ -5030,7 +5042,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
5030
5042
|
if (!connection) {
|
|
5031
5043
|
return errorResponse("Not connected. Call login first.");
|
|
5032
5044
|
}
|
|
5033
|
-
const timeoutSecs = Math.min(Math.max(args?.timeout ||
|
|
5045
|
+
const timeoutSecs = Math.min(Math.max(args?.timeout || 60, 10), 600);
|
|
5034
5046
|
const ARENA_MIN_X = 3077;
|
|
5035
5047
|
const ARENA_MAX_X = 3134;
|
|
5036
5048
|
const ARENA_MIN_Z = 3324;
|
|
@@ -5062,7 +5074,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
5062
5074
|
}
|
|
5063
5075
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
5064
5076
|
}
|
|
5065
|
-
return errorResponse(`
|
|
5077
|
+
return errorResponse(`Still waiting for the match to begin (${timeoutSecs}s elapsed). The game needs 2+ players to start the countdown. Call wait_for_game_start again to keep waiting.`);
|
|
5066
5078
|
}
|
|
5067
5079
|
case "join_game": {
|
|
5068
5080
|
const connection = getActiveConnection();
|