kill-switch-mcp 1.2.14 → 1.2.15
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 +24 -12
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -4097,16 +4097,30 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
4097
4097
|
}
|
|
4098
4098
|
const keyAuth = readKeyAuthorization();
|
|
4099
4099
|
const sponsorOpts = feePayerUrl ? { feePayer: true } : {};
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
})
|
|
4100
|
+
let approveHash;
|
|
4101
|
+
try {
|
|
4102
|
+
approveHash = await walletClient.writeContract({
|
|
4103
|
+
address: USDC_ADDRESS,
|
|
4104
|
+
abi: ERC20_ABI,
|
|
4105
|
+
functionName: "approve",
|
|
4106
|
+
args: [tournamentAddress, buyIn],
|
|
4107
|
+
...sponsorOpts
|
|
4108
|
+
});
|
|
4109
|
+
} catch (e) {
|
|
4110
|
+
if (keyAuth && e.message?.includes("KeyNotFound")) {
|
|
4111
|
+
approveHash = await walletClient.writeContract({
|
|
4112
|
+
address: USDC_ADDRESS,
|
|
4113
|
+
abi: ERC20_ABI,
|
|
4114
|
+
functionName: "approve",
|
|
4115
|
+
args: [tournamentAddress, buyIn],
|
|
4116
|
+
keyAuthorization: keyAuth,
|
|
4117
|
+
gas: 700000n,
|
|
4118
|
+
...sponsorOpts
|
|
4119
|
+
});
|
|
4120
|
+
} else {
|
|
4121
|
+
throw e;
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4110
4124
|
await pub.waitForTransactionReceipt({ hash: approveHash });
|
|
4111
4125
|
const usernameBytes = pad(stringToHex(username), { size: 32 });
|
|
4112
4126
|
const depositHash = await walletClient.writeContract({
|
|
@@ -4114,8 +4128,6 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
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 });
|