@t2000/engine 1.24.0 → 1.24.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/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ALL_NAVI_ASSETS, getDecimalsForCoinType, resolveSymbol, isInRegistry, normalizeCoinType, assertAllowedAsset, normalizeAsset, SUPPORTED_ASSETS, getSwapQuote, resolveTokenType, extractTransferDetails, classifyTransaction } from '@t2000/sdk';
|
|
2
|
+
import { ALL_NAVI_ASSETS, getDecimalsForCoinType, resolveSymbol, isInRegistry, normalizeCoinType, assertAllowedAsset, normalizeAsset, SUPPORTED_ASSETS, getSwapQuote, getPendingRewardsByAddress, resolveTokenType, extractTransferDetails, classifyTransaction } from '@t2000/sdk';
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
4
|
import { readdirSync, readFileSync } from 'fs';
|
|
5
5
|
import { join } from 'path';
|
|
@@ -5225,10 +5225,21 @@ var pendingRewardsTool = buildTool({
|
|
|
5225
5225
|
// across turns within the same session.
|
|
5226
5226
|
cacheable: false,
|
|
5227
5227
|
async call(_input, context) {
|
|
5228
|
-
const agent = requireAgent(context);
|
|
5229
5228
|
let rewards;
|
|
5230
5229
|
try {
|
|
5231
|
-
|
|
5230
|
+
const agent = context.agent;
|
|
5231
|
+
if (agent && typeof agent.getPendingRewards === "function") {
|
|
5232
|
+
rewards = await agent.getPendingRewards();
|
|
5233
|
+
} else if (context.walletAddress) {
|
|
5234
|
+
rewards = await getPendingRewardsByAddress(
|
|
5235
|
+
context.walletAddress,
|
|
5236
|
+
context.suiRpcUrl
|
|
5237
|
+
);
|
|
5238
|
+
} else {
|
|
5239
|
+
throw new Error(
|
|
5240
|
+
"pending_rewards requires either context.agent (CLI path) or context.walletAddress + context.suiRpcUrl (audric path)."
|
|
5241
|
+
);
|
|
5242
|
+
}
|
|
5232
5243
|
} catch (err) {
|
|
5233
5244
|
const errAny = err;
|
|
5234
5245
|
const isProtocolDown = errAny?.code === "PROTOCOL_UNAVAILABLE";
|