shll-skills 5.4.0 → 5.4.2
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/SKILL.md +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/mcp.js +19 -20
- package/dist/mcp.mjs +19 -20
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/mcp.ts +19 -19
package/SKILL.md
CHANGED
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/dist/mcp.js
CHANGED
|
@@ -665,29 +665,29 @@ async function checkAgentExpiry(tokenId) {
|
|
|
665
665
|
pc.readContract({ address: config.nfa, abi: AGENT_NFA_CHECK_ABI, functionName: "ownerOf", args: [tokenId] })
|
|
666
666
|
]);
|
|
667
667
|
const now = BigInt(Math.floor(Date.now() / 1e3));
|
|
668
|
-
if (now >
|
|
668
|
+
if (now > userExpires) {
|
|
669
669
|
return {
|
|
670
|
-
|
|
670
|
+
blocked: true,
|
|
671
671
|
content: [{
|
|
672
672
|
type: "text",
|
|
673
673
|
text: JSON.stringify({
|
|
674
674
|
status: "error",
|
|
675
|
-
message: `Agent token-id ${tokenId}
|
|
676
|
-
expiredAt: new Date(Number(
|
|
675
|
+
message: `Agent token-id ${tokenId} rental has EXPIRED (expired at ${new Date(Number(userExpires) * 1e3).toISOString()}). Please renew at https://shll.run/me or use a different token-id.`,
|
|
676
|
+
expiredAt: new Date(Number(userExpires) * 1e3).toISOString(),
|
|
677
677
|
action: "renew"
|
|
678
678
|
})
|
|
679
679
|
}]
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
|
-
if (now >
|
|
682
|
+
if (now > operatorExpires) {
|
|
683
683
|
return {
|
|
684
|
-
|
|
684
|
+
blocked: true,
|
|
685
685
|
content: [{
|
|
686
686
|
type: "text",
|
|
687
687
|
text: JSON.stringify({
|
|
688
688
|
status: "error",
|
|
689
|
-
message: `Agent token-id ${tokenId}
|
|
690
|
-
expiredAt: new Date(Number(
|
|
689
|
+
message: `Agent token-id ${tokenId} operator authorization has EXPIRED (expired at ${new Date(Number(operatorExpires) * 1e3).toISOString()}). Please renew at https://shll.run/me or use a different token-id.`,
|
|
690
|
+
expiredAt: new Date(Number(operatorExpires) * 1e3).toISOString(),
|
|
691
691
|
action: "renew"
|
|
692
692
|
})
|
|
693
693
|
}]
|
|
@@ -699,8 +699,7 @@ async function checkAgentExpiry(tokenId) {
|
|
|
699
699
|
const isOwner = owner.toLowerCase() === runnerAddr;
|
|
700
700
|
if (!isOperator && !isRenter && !isOwner) {
|
|
701
701
|
return {
|
|
702
|
-
|
|
703
|
-
// reuse expired flag to block execution
|
|
702
|
+
blocked: true,
|
|
704
703
|
content: [{
|
|
705
704
|
type: "text",
|
|
706
705
|
text: JSON.stringify({
|
|
@@ -720,7 +719,7 @@ async function checkAgentExpiry(tokenId) {
|
|
|
720
719
|
}]
|
|
721
720
|
};
|
|
722
721
|
}
|
|
723
|
-
return {
|
|
722
|
+
return { blocked: false };
|
|
724
723
|
}
|
|
725
724
|
function policyRejectionHelp(reason, tokenId) {
|
|
726
725
|
const consoleUrl = `https://shll.run/agent/0xE98DCdbf370D7b52c9A2b88F79bEF514A5375a2b/${tokenId}/console/safety`;
|
|
@@ -842,7 +841,7 @@ server.tool(
|
|
|
842
841
|
const { publicClient, policyClient } = createClients();
|
|
843
842
|
const tokenId = BigInt(token_id);
|
|
844
843
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
845
|
-
if (expiryCheck.
|
|
844
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
846
845
|
const vault = await policyClient.getVault(tokenId);
|
|
847
846
|
const fromToken = resolveToken(from);
|
|
848
847
|
const toToken = resolveToken(to);
|
|
@@ -974,7 +973,7 @@ server.tool(
|
|
|
974
973
|
const { publicClient, policyClient } = createClients();
|
|
975
974
|
const tokenId = BigInt(token_id);
|
|
976
975
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
977
|
-
if (expiryCheck.
|
|
976
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
978
977
|
const symbol = token.toUpperCase();
|
|
979
978
|
const vTokenAddr = VENUS_VTOKENS[symbol];
|
|
980
979
|
if (!vTokenAddr) return { content: [{ type: "text", text: JSON.stringify({ error: `Unsupported: ${symbol}. Use: ${Object.keys(VENUS_VTOKENS).join(", ")}` }) }] };
|
|
@@ -1012,7 +1011,7 @@ server.tool(
|
|
|
1012
1011
|
const { policyClient } = createClients();
|
|
1013
1012
|
const tokenId = BigInt(token_id);
|
|
1014
1013
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1015
|
-
if (expiryCheck.
|
|
1014
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1016
1015
|
const symbol = token.toUpperCase();
|
|
1017
1016
|
const vTokenAddr = VENUS_VTOKENS[symbol];
|
|
1018
1017
|
if (!vTokenAddr) return { content: [{ type: "text", text: JSON.stringify({ error: `Unsupported: ${symbol}` }) }] };
|
|
@@ -1070,7 +1069,7 @@ server.tool(
|
|
|
1070
1069
|
const { policyClient } = createClients();
|
|
1071
1070
|
const tokenId = BigInt(token_id);
|
|
1072
1071
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1073
|
-
if (expiryCheck.
|
|
1072
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1074
1073
|
const tokenInfo = resolveToken(token);
|
|
1075
1074
|
const amt = parseAmount(amount, tokenInfo.decimals);
|
|
1076
1075
|
const recipient = to;
|
|
@@ -1168,7 +1167,7 @@ server.tool(
|
|
|
1168
1167
|
const { policyClient } = createClients();
|
|
1169
1168
|
const tokenId = BigInt(token_id);
|
|
1170
1169
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1171
|
-
if (expiryCheck.
|
|
1170
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1172
1171
|
const amt = (0, import_viem2.parseEther)(amount);
|
|
1173
1172
|
const data = (0, import_viem2.encodeFunctionData)({ abi: WBNB_ABI, functionName: "deposit" });
|
|
1174
1173
|
const action = { target: WBNB, value: amt, data };
|
|
@@ -1189,7 +1188,7 @@ server.tool(
|
|
|
1189
1188
|
const { policyClient } = createClients();
|
|
1190
1189
|
const tokenId = BigInt(token_id);
|
|
1191
1190
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1192
|
-
if (expiryCheck.
|
|
1191
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1193
1192
|
const amt = (0, import_viem2.parseEther)(amount);
|
|
1194
1193
|
const data = (0, import_viem2.encodeFunctionData)({ abi: WBNB_ABI, functionName: "withdraw", args: [amt] });
|
|
1195
1194
|
const action = { target: WBNB, value: 0n, data };
|
|
@@ -1427,7 +1426,7 @@ server.tool(
|
|
|
1427
1426
|
const { account, publicClient, policyClient, config } = createClients();
|
|
1428
1427
|
const tokenId = BigInt(token_id);
|
|
1429
1428
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1430
|
-
if (expiryCheck.
|
|
1429
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1431
1430
|
const walletClient = (0, import_viem2.createWalletClient)({ account, chain: import_chains2.bsc, transport: (0, import_viem2.http)(config.rpc) });
|
|
1432
1431
|
const policies = await policyClient.getPolicies(tokenId);
|
|
1433
1432
|
const results = [];
|
|
@@ -1531,7 +1530,7 @@ server.tool(
|
|
|
1531
1530
|
const { policyClient } = createClients();
|
|
1532
1531
|
const tokenId = BigInt(token_id);
|
|
1533
1532
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1534
|
-
if (expiryCheck.
|
|
1533
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1535
1534
|
const action = {
|
|
1536
1535
|
target,
|
|
1537
1536
|
value: BigInt(value),
|
|
@@ -1578,7 +1577,7 @@ server.tool(
|
|
|
1578
1577
|
const { policyClient } = createClients();
|
|
1579
1578
|
const tokenId = BigInt(token_id);
|
|
1580
1579
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1581
|
-
if (expiryCheck.
|
|
1580
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1582
1581
|
const actions = rawActions.map((a) => ({
|
|
1583
1582
|
target: a.target,
|
|
1584
1583
|
value: BigInt(a.value || "0"),
|
package/dist/mcp.mjs
CHANGED
|
@@ -176,29 +176,29 @@ async function checkAgentExpiry(tokenId) {
|
|
|
176
176
|
pc.readContract({ address: config.nfa, abi: AGENT_NFA_CHECK_ABI, functionName: "ownerOf", args: [tokenId] })
|
|
177
177
|
]);
|
|
178
178
|
const now = BigInt(Math.floor(Date.now() / 1e3));
|
|
179
|
-
if (now >
|
|
179
|
+
if (now > userExpires) {
|
|
180
180
|
return {
|
|
181
|
-
|
|
181
|
+
blocked: true,
|
|
182
182
|
content: [{
|
|
183
183
|
type: "text",
|
|
184
184
|
text: JSON.stringify({
|
|
185
185
|
status: "error",
|
|
186
|
-
message: `Agent token-id ${tokenId}
|
|
187
|
-
expiredAt: new Date(Number(
|
|
186
|
+
message: `Agent token-id ${tokenId} rental has EXPIRED (expired at ${new Date(Number(userExpires) * 1e3).toISOString()}). Please renew at https://shll.run/me or use a different token-id.`,
|
|
187
|
+
expiredAt: new Date(Number(userExpires) * 1e3).toISOString(),
|
|
188
188
|
action: "renew"
|
|
189
189
|
})
|
|
190
190
|
}]
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
if (now >
|
|
193
|
+
if (now > operatorExpires) {
|
|
194
194
|
return {
|
|
195
|
-
|
|
195
|
+
blocked: true,
|
|
196
196
|
content: [{
|
|
197
197
|
type: "text",
|
|
198
198
|
text: JSON.stringify({
|
|
199
199
|
status: "error",
|
|
200
|
-
message: `Agent token-id ${tokenId}
|
|
201
|
-
expiredAt: new Date(Number(
|
|
200
|
+
message: `Agent token-id ${tokenId} operator authorization has EXPIRED (expired at ${new Date(Number(operatorExpires) * 1e3).toISOString()}). Please renew at https://shll.run/me or use a different token-id.`,
|
|
201
|
+
expiredAt: new Date(Number(operatorExpires) * 1e3).toISOString(),
|
|
202
202
|
action: "renew"
|
|
203
203
|
})
|
|
204
204
|
}]
|
|
@@ -210,8 +210,7 @@ async function checkAgentExpiry(tokenId) {
|
|
|
210
210
|
const isOwner = owner.toLowerCase() === runnerAddr;
|
|
211
211
|
if (!isOperator && !isRenter && !isOwner) {
|
|
212
212
|
return {
|
|
213
|
-
|
|
214
|
-
// reuse expired flag to block execution
|
|
213
|
+
blocked: true,
|
|
215
214
|
content: [{
|
|
216
215
|
type: "text",
|
|
217
216
|
text: JSON.stringify({
|
|
@@ -231,7 +230,7 @@ async function checkAgentExpiry(tokenId) {
|
|
|
231
230
|
}]
|
|
232
231
|
};
|
|
233
232
|
}
|
|
234
|
-
return {
|
|
233
|
+
return { blocked: false };
|
|
235
234
|
}
|
|
236
235
|
function policyRejectionHelp(reason, tokenId) {
|
|
237
236
|
const consoleUrl = `https://shll.run/agent/0xE98DCdbf370D7b52c9A2b88F79bEF514A5375a2b/${tokenId}/console/safety`;
|
|
@@ -353,7 +352,7 @@ server.tool(
|
|
|
353
352
|
const { publicClient, policyClient } = createClients();
|
|
354
353
|
const tokenId = BigInt(token_id);
|
|
355
354
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
356
|
-
if (expiryCheck.
|
|
355
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
357
356
|
const vault = await policyClient.getVault(tokenId);
|
|
358
357
|
const fromToken = resolveToken(from);
|
|
359
358
|
const toToken = resolveToken(to);
|
|
@@ -485,7 +484,7 @@ server.tool(
|
|
|
485
484
|
const { publicClient, policyClient } = createClients();
|
|
486
485
|
const tokenId = BigInt(token_id);
|
|
487
486
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
488
|
-
if (expiryCheck.
|
|
487
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
489
488
|
const symbol = token.toUpperCase();
|
|
490
489
|
const vTokenAddr = VENUS_VTOKENS[symbol];
|
|
491
490
|
if (!vTokenAddr) return { content: [{ type: "text", text: JSON.stringify({ error: `Unsupported: ${symbol}. Use: ${Object.keys(VENUS_VTOKENS).join(", ")}` }) }] };
|
|
@@ -523,7 +522,7 @@ server.tool(
|
|
|
523
522
|
const { policyClient } = createClients();
|
|
524
523
|
const tokenId = BigInt(token_id);
|
|
525
524
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
526
|
-
if (expiryCheck.
|
|
525
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
527
526
|
const symbol = token.toUpperCase();
|
|
528
527
|
const vTokenAddr = VENUS_VTOKENS[symbol];
|
|
529
528
|
if (!vTokenAddr) return { content: [{ type: "text", text: JSON.stringify({ error: `Unsupported: ${symbol}` }) }] };
|
|
@@ -581,7 +580,7 @@ server.tool(
|
|
|
581
580
|
const { policyClient } = createClients();
|
|
582
581
|
const tokenId = BigInt(token_id);
|
|
583
582
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
584
|
-
if (expiryCheck.
|
|
583
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
585
584
|
const tokenInfo = resolveToken(token);
|
|
586
585
|
const amt = parseAmount(amount, tokenInfo.decimals);
|
|
587
586
|
const recipient = to;
|
|
@@ -679,7 +678,7 @@ server.tool(
|
|
|
679
678
|
const { policyClient } = createClients();
|
|
680
679
|
const tokenId = BigInt(token_id);
|
|
681
680
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
682
|
-
if (expiryCheck.
|
|
681
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
683
682
|
const amt = parseEther(amount);
|
|
684
683
|
const data = encodeFunctionData({ abi: WBNB_ABI, functionName: "deposit" });
|
|
685
684
|
const action = { target: WBNB, value: amt, data };
|
|
@@ -700,7 +699,7 @@ server.tool(
|
|
|
700
699
|
const { policyClient } = createClients();
|
|
701
700
|
const tokenId = BigInt(token_id);
|
|
702
701
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
703
|
-
if (expiryCheck.
|
|
702
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
704
703
|
const amt = parseEther(amount);
|
|
705
704
|
const data = encodeFunctionData({ abi: WBNB_ABI, functionName: "withdraw", args: [amt] });
|
|
706
705
|
const action = { target: WBNB, value: 0n, data };
|
|
@@ -938,7 +937,7 @@ server.tool(
|
|
|
938
937
|
const { account, publicClient, policyClient, config } = createClients();
|
|
939
938
|
const tokenId = BigInt(token_id);
|
|
940
939
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
941
|
-
if (expiryCheck.
|
|
940
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
942
941
|
const walletClient = createWalletClient({ account, chain: bsc, transport: http(config.rpc) });
|
|
943
942
|
const policies = await policyClient.getPolicies(tokenId);
|
|
944
943
|
const results = [];
|
|
@@ -1042,7 +1041,7 @@ server.tool(
|
|
|
1042
1041
|
const { policyClient } = createClients();
|
|
1043
1042
|
const tokenId = BigInt(token_id);
|
|
1044
1043
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1045
|
-
if (expiryCheck.
|
|
1044
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1046
1045
|
const action = {
|
|
1047
1046
|
target,
|
|
1048
1047
|
value: BigInt(value),
|
|
@@ -1089,7 +1088,7 @@ server.tool(
|
|
|
1089
1088
|
const { policyClient } = createClients();
|
|
1090
1089
|
const tokenId = BigInt(token_id);
|
|
1091
1090
|
const expiryCheck = await checkAgentExpiry(tokenId);
|
|
1092
|
-
if (expiryCheck.
|
|
1091
|
+
if (expiryCheck.blocked) return { content: expiryCheck.content };
|
|
1093
1092
|
const actions = rawActions.map((a) => ({
|
|
1094
1093
|
target: a.target,
|
|
1095
1094
|
value: BigInt(a.value || "0"),
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/mcp.ts
CHANGED
|
@@ -217,27 +217,27 @@ async function checkAgentExpiry(tokenId: bigint) {
|
|
|
217
217
|
pc.readContract({ address: config.nfa as Address, abi: AGENT_NFA_CHECK_ABI, functionName: "ownerOf", args: [tokenId] }) as Promise<Address>,
|
|
218
218
|
]);
|
|
219
219
|
const now = BigInt(Math.floor(Date.now() / 1000));
|
|
220
|
-
if (now >
|
|
220
|
+
if (now > userExpires) {
|
|
221
221
|
return {
|
|
222
|
-
|
|
222
|
+
blocked: true,
|
|
223
223
|
content: [{
|
|
224
224
|
type: "text" as const, text: JSON.stringify({
|
|
225
225
|
status: "error",
|
|
226
|
-
message: `Agent token-id ${tokenId}
|
|
227
|
-
expiredAt: new Date(Number(
|
|
226
|
+
message: `Agent token-id ${tokenId} rental has EXPIRED (expired at ${new Date(Number(userExpires) * 1000).toISOString()}). Please renew at https://shll.run/me or use a different token-id.`,
|
|
227
|
+
expiredAt: new Date(Number(userExpires) * 1000).toISOString(),
|
|
228
228
|
action: "renew",
|
|
229
229
|
})
|
|
230
230
|
}],
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
if (now >
|
|
233
|
+
if (now > operatorExpires) {
|
|
234
234
|
return {
|
|
235
|
-
|
|
235
|
+
blocked: true,
|
|
236
236
|
content: [{
|
|
237
237
|
type: "text" as const, text: JSON.stringify({
|
|
238
238
|
status: "error",
|
|
239
|
-
message: `Agent token-id ${tokenId}
|
|
240
|
-
expiredAt: new Date(Number(
|
|
239
|
+
message: `Agent token-id ${tokenId} operator authorization has EXPIRED (expired at ${new Date(Number(operatorExpires) * 1000).toISOString()}). Please renew at https://shll.run/me or use a different token-id.`,
|
|
240
|
+
expiredAt: new Date(Number(operatorExpires) * 1000).toISOString(),
|
|
241
241
|
action: "renew",
|
|
242
242
|
})
|
|
243
243
|
}],
|
|
@@ -250,7 +250,7 @@ async function checkAgentExpiry(tokenId: bigint) {
|
|
|
250
250
|
const isOwner = owner.toLowerCase() === runnerAddr;
|
|
251
251
|
if (!isOperator && !isRenter && !isOwner) {
|
|
252
252
|
return {
|
|
253
|
-
|
|
253
|
+
blocked: true,
|
|
254
254
|
content: [{
|
|
255
255
|
type: "text" as const, text: JSON.stringify({
|
|
256
256
|
status: "error",
|
|
@@ -269,7 +269,7 @@ async function checkAgentExpiry(tokenId: bigint) {
|
|
|
269
269
|
}],
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
-
return {
|
|
272
|
+
return { blocked: false };
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
// Policy rejection → actionable user guidance
|
|
@@ -408,7 +408,7 @@ server.tool(
|
|
|
408
408
|
async ({ token_id, from, to, amount, dex, slippage }) => {
|
|
409
409
|
const { publicClient, policyClient } = createClients();
|
|
410
410
|
const tokenId = BigInt(token_id);
|
|
411
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
411
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
412
412
|
const vault = await policyClient.getVault(tokenId);
|
|
413
413
|
|
|
414
414
|
const fromToken = resolveToken(from);
|
|
@@ -551,7 +551,7 @@ server.tool(
|
|
|
551
551
|
async ({ token_id, token, amount }) => {
|
|
552
552
|
const { publicClient, policyClient } = createClients();
|
|
553
553
|
const tokenId = BigInt(token_id);
|
|
554
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
554
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
555
555
|
const symbol = token.toUpperCase();
|
|
556
556
|
const vTokenAddr = VENUS_VTOKENS[symbol];
|
|
557
557
|
if (!vTokenAddr) return { content: [{ type: "text" as const, text: JSON.stringify({ error: `Unsupported: ${symbol}. Use: ${Object.keys(VENUS_VTOKENS).join(", ")}` }) }] };
|
|
@@ -597,7 +597,7 @@ server.tool(
|
|
|
597
597
|
async ({ token_id, token, amount }) => {
|
|
598
598
|
const { policyClient } = createClients();
|
|
599
599
|
const tokenId = BigInt(token_id);
|
|
600
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
600
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
601
601
|
const symbol = token.toUpperCase();
|
|
602
602
|
const vTokenAddr = VENUS_VTOKENS[symbol];
|
|
603
603
|
if (!vTokenAddr) return { content: [{ type: "text" as const, text: JSON.stringify({ error: `Unsupported: ${symbol}` }) }] };
|
|
@@ -662,7 +662,7 @@ server.tool(
|
|
|
662
662
|
async ({ token_id, token, amount, to }) => {
|
|
663
663
|
const { policyClient } = createClients();
|
|
664
664
|
const tokenId = BigInt(token_id);
|
|
665
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
665
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
666
666
|
const tokenInfo = resolveToken(token);
|
|
667
667
|
const amt = parseAmount(amount, tokenInfo.decimals);
|
|
668
668
|
const recipient = to as Address;
|
|
@@ -769,7 +769,7 @@ server.tool(
|
|
|
769
769
|
async ({ token_id, amount }) => {
|
|
770
770
|
const { policyClient } = createClients();
|
|
771
771
|
const tokenId = BigInt(token_id);
|
|
772
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
772
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
773
773
|
const amt = parseEther(amount);
|
|
774
774
|
const data = encodeFunctionData({ abi: WBNB_ABI, functionName: "deposit" });
|
|
775
775
|
const action: Action = { target: WBNB as Address, value: amt, data };
|
|
@@ -793,7 +793,7 @@ server.tool(
|
|
|
793
793
|
async ({ token_id, amount }) => {
|
|
794
794
|
const { policyClient } = createClients();
|
|
795
795
|
const tokenId = BigInt(token_id);
|
|
796
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
796
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
797
797
|
const amt = parseEther(amount);
|
|
798
798
|
const data = encodeFunctionData({ abi: WBNB_ABI, functionName: "withdraw", args: [amt] });
|
|
799
799
|
const action: Action = { target: WBNB as Address, value: 0n, data };
|
|
@@ -1061,7 +1061,7 @@ server.tool(
|
|
|
1061
1061
|
|
|
1062
1062
|
const { account, publicClient, policyClient, config } = createClients();
|
|
1063
1063
|
const tokenId = BigInt(token_id);
|
|
1064
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
1064
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
1065
1065
|
const walletClient = createWalletClient({ account, chain: bsc, transport: http(config.rpc) });
|
|
1066
1066
|
const policies = await policyClient.getPolicies(tokenId);
|
|
1067
1067
|
const results: string[] = [];
|
|
@@ -1183,7 +1183,7 @@ server.tool(
|
|
|
1183
1183
|
async ({ token_id, target, data, value }) => {
|
|
1184
1184
|
const { policyClient } = createClients();
|
|
1185
1185
|
const tokenId = BigInt(token_id);
|
|
1186
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
1186
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
1187
1187
|
const action: Action = {
|
|
1188
1188
|
target: target as Address,
|
|
1189
1189
|
value: BigInt(value),
|
|
@@ -1232,7 +1232,7 @@ server.tool(
|
|
|
1232
1232
|
async ({ token_id, actions: rawActions }) => {
|
|
1233
1233
|
const { policyClient } = createClients();
|
|
1234
1234
|
const tokenId = BigInt(token_id);
|
|
1235
|
-
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.
|
|
1235
|
+
const expiryCheck = await checkAgentExpiry(tokenId); if (expiryCheck.blocked) return { content: expiryCheck.content! };
|
|
1236
1236
|
const actions: Action[] = rawActions.map(a => ({
|
|
1237
1237
|
target: a.target as Address,
|
|
1238
1238
|
value: BigInt(a.value || "0"),
|