kill-switch-mcp 1.2.13 → 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 -9
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -4097,14 +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
|
-
|
|
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
|
+
}
|
|
4108
4124
|
await pub.waitForTransactionReceipt({ hash: approveHash });
|
|
4109
4125
|
const usernameBytes = pad(stringToHex(username), { size: 32 });
|
|
4110
4126
|
const depositHash = await walletClient.writeContract({
|
|
@@ -4112,7 +4128,6 @@ async function joinTournament(tournamentAddress, username) {
|
|
|
4112
4128
|
abi: TOURNAMENT_ABI,
|
|
4113
4129
|
functionName: "deposit",
|
|
4114
4130
|
args: [usernameBytes],
|
|
4115
|
-
...keyAuth ? { keyAuthorization: keyAuth } : {},
|
|
4116
4131
|
...sponsorOpts
|
|
4117
4132
|
});
|
|
4118
4133
|
await pub.waitForTransactionReceipt({ hash: depositHash });
|