nyxora 1.4.10 → 1.5.0
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/agent/reasoning.js
CHANGED
|
@@ -21,6 +21,8 @@ const createWallet_1 = require("../web3/skills/createWallet");
|
|
|
21
21
|
const checkSecurity_1 = require("../web3/skills/checkSecurity");
|
|
22
22
|
const marketAnalysis_1 = require("../web3/skills/marketAnalysis");
|
|
23
23
|
const checkPortfolio_1 = require("../web3/skills/checkPortfolio");
|
|
24
|
+
const checkAddress_1 = require("../web3/skills/checkAddress");
|
|
25
|
+
const getMyAddress_1 = require("../web3/skills/getMyAddress");
|
|
24
26
|
const limitOrderManager_1 = require("./limitOrderManager");
|
|
25
27
|
const updateProfile_1 = require("./updateProfile");
|
|
26
28
|
const updateSecurityPolicy_1 = require("../system/skills/updateSecurityPolicy");
|
|
@@ -215,6 +217,8 @@ async function processUserInput(input, role = 'user', onProgress) {
|
|
|
215
217
|
checkSecurity_1.checkSecurityToolDefinition,
|
|
216
218
|
marketAnalysis_1.marketAnalysisToolDefinition,
|
|
217
219
|
checkPortfolio_1.checkPortfolioToolDefinition,
|
|
220
|
+
checkAddress_1.checkAddressToolDefinition,
|
|
221
|
+
getMyAddress_1.getMyAddressToolDefinition,
|
|
218
222
|
limitOrderManager_1.createLimitOrderToolDefinition,
|
|
219
223
|
limitOrderManager_1.listLimitOrdersToolDefinition,
|
|
220
224
|
limitOrderManager_1.cancelLimitOrderToolDefinition,
|
|
@@ -317,6 +321,14 @@ async function processUserInput(input, role = 'user', onProgress) {
|
|
|
317
321
|
result = await (0, checkPortfolio_1.checkPortfolio)(args.chainName, args.address);
|
|
318
322
|
break;
|
|
319
323
|
}
|
|
324
|
+
case 'check_address': {
|
|
325
|
+
result = await (0, checkAddress_1.checkAddress)(args.chainName, args.address);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case 'get_my_address': {
|
|
329
|
+
result = await (0, getMyAddress_1.getMyAddress)();
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
320
332
|
case 'create_limit_order': {
|
|
321
333
|
if (config.permissions?.web3?.allow_swap === false) {
|
|
322
334
|
result = `[Security Blocked] Runtime Permission Denied: Limit orders require swap permissions. Update config.yaml to allow.`;
|
package/dist/gateway/server.js
CHANGED
|
@@ -17,6 +17,8 @@ const pluginManager_1 = require("../system/pluginManager");
|
|
|
17
17
|
const transfer_1 = require("../web3/skills/transfer");
|
|
18
18
|
const swapToken_1 = require("../web3/skills/swapToken");
|
|
19
19
|
const getBalance_1 = require("../web3/skills/getBalance");
|
|
20
|
+
const checkAddress_1 = require("../web3/skills/checkAddress");
|
|
21
|
+
const getMyAddress_1 = require("../web3/skills/getMyAddress");
|
|
20
22
|
const getPrice_1 = require("../web3/skills/getPrice");
|
|
21
23
|
const bridgeToken_1 = require("../web3/skills/bridgeToken");
|
|
22
24
|
const mintNft_1 = require("../web3/skills/mintNft");
|
|
@@ -102,7 +104,9 @@ app.get('/api/skills', (req, res) => {
|
|
|
102
104
|
swapToken_1.swapTokenToolDefinition,
|
|
103
105
|
bridgeToken_1.bridgeTokenToolDefinition,
|
|
104
106
|
mintNft_1.mintNftToolDefinition,
|
|
105
|
-
customTx_1.customTxToolDefinition
|
|
107
|
+
customTx_1.customTxToolDefinition,
|
|
108
|
+
checkAddress_1.checkAddressToolDefinition,
|
|
109
|
+
getMyAddress_1.getMyAddressToolDefinition
|
|
106
110
|
]);
|
|
107
111
|
});
|
|
108
112
|
app.get('/api/transactions', (req, res) => {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkAddressToolDefinition = void 0;
|
|
4
|
+
exports.checkAddress = checkAddress;
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const config_1 = require("../config");
|
|
7
|
+
async function checkAddress(chainName, address) {
|
|
8
|
+
try {
|
|
9
|
+
if (!(0, viem_1.isAddress)(address)) {
|
|
10
|
+
return `Address validation failed: '${address}' is not a valid Web3 address format.`;
|
|
11
|
+
}
|
|
12
|
+
const client = (0, config_1.getPublicClient)(chainName);
|
|
13
|
+
// Check if the address has bytecode (which means it's a Smart Contract)
|
|
14
|
+
const bytecode = await client.getBytecode({ address: address });
|
|
15
|
+
// Also get the balance just for additional info
|
|
16
|
+
const balanceWei = await client.getBalance({ address: address });
|
|
17
|
+
let result = `Address: ${address}\n`;
|
|
18
|
+
result += `Status: Valid Format\n`;
|
|
19
|
+
if (bytecode && bytecode !== '0x') {
|
|
20
|
+
result += `Type: Smart Contract\n`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
result += `Type: EOA (Externally Owned Account / Standard Wallet)\n`;
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return `Failed to check address: ${error.message}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.checkAddressToolDefinition = {
|
|
32
|
+
type: "function",
|
|
33
|
+
function: {
|
|
34
|
+
name: "check_address",
|
|
35
|
+
description: "Validate a Web3 address and determine if it is an EOA (standard wallet) or a Smart Contract.",
|
|
36
|
+
parameters: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
chainName: {
|
|
40
|
+
type: "string",
|
|
41
|
+
enum: ["ethereum", "base", "bsc", "arbitrum", "optimism", "sepolia"],
|
|
42
|
+
description: "The name of the blockchain to check the address on."
|
|
43
|
+
},
|
|
44
|
+
address: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "The 0x... address to check."
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
required: ["chainName", "address"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMyAddressToolDefinition = void 0;
|
|
4
|
+
exports.getMyAddress = getMyAddress;
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
async function getMyAddress() {
|
|
7
|
+
try {
|
|
8
|
+
const address = (0, config_1.getAddress)();
|
|
9
|
+
if (!address) {
|
|
10
|
+
return "Error: Could not retrieve public address from the keystore.";
|
|
11
|
+
}
|
|
12
|
+
return `Your Public Address is: ${address}`;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return `Failed to get public address: ${error.message}`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.getMyAddressToolDefinition = {
|
|
19
|
+
type: "function",
|
|
20
|
+
function: {
|
|
21
|
+
name: "get_my_address",
|
|
22
|
+
description: "Retrieve the agent's own public wallet address derived from the local keystore.",
|
|
23
|
+
parameters: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {},
|
|
26
|
+
required: []
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|