@vincentai/cli 0.1.1 → 0.1.3
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/commands/polymarket/bet.js +5 -5
- package/dist/commands/secret/create.js +13 -11
- package/dist/commands/secret/list.js +3 -1
- package/dist/commands/secret/relink.js +1 -2
- package/dist/commands/trade-manager/create-rule.js +7 -7
- package/dist/commands/trade-manager/delete-rule.js +2 -4
- package/dist/commands/trade-manager/events.js +2 -4
- package/dist/commands/trade-manager/health.js +2 -2
- package/dist/commands/trade-manager/list-rules.js +2 -2
- package/dist/commands/trade-manager/positions.js +2 -4
- package/dist/commands/trade-manager/status.js +2 -2
- package/dist/commands/trade-manager/update-rule.js +5 -5
- package/dist/commands/wallet/swap.js +5 -5
- package/dist/commands/wallet/transfer-between.js +6 -6
- package/dist/index.js +4 -2
- package/dist/lib/client.js +12 -15
- package/dist/lib/keystore.js +1 -1
- package/dist/lib/types.js +13 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseArgs, getRequired,
|
|
1
|
+
import { parseArgs, getRequired, getRequiredNumber, getNumber, hasFlag, showHelp, } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
3
|
import { vincentPost } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
@@ -17,11 +17,11 @@ export async function run(argv) {
|
|
|
17
17
|
const body = {
|
|
18
18
|
tokenId: getRequired(flags, 'token-id'),
|
|
19
19
|
side: getRequired(flags, 'side'),
|
|
20
|
-
amount:
|
|
20
|
+
amount: getRequiredNumber(flags, 'amount'),
|
|
21
21
|
};
|
|
22
|
-
const price =
|
|
23
|
-
if (price)
|
|
24
|
-
body.price =
|
|
22
|
+
const price = getNumber(flags, 'price');
|
|
23
|
+
if (price !== undefined)
|
|
24
|
+
body.price = price;
|
|
25
25
|
const res = await vincentPost('/api/skills/polymarket/bet', apiKey, body);
|
|
26
26
|
console.log(JSON.stringify(res, null, 2));
|
|
27
27
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { parseArgs, getRequired,
|
|
1
|
+
import { parseArgs, getRequired, getNumber, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { vincentPost } from '../../lib/client.js';
|
|
3
3
|
import { storeKey } from '../../lib/keystore.js';
|
|
4
|
+
import { validateSecretType } from '../../lib/types.js';
|
|
4
5
|
export async function run(argv) {
|
|
5
6
|
const { flags } = parseArgs(argv);
|
|
6
7
|
if (hasFlag(flags, 'help')) {
|
|
@@ -15,27 +16,28 @@ export async function run(argv) {
|
|
|
15
16
|
]);
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
const type = getRequired(flags, 'type');
|
|
19
|
+
const type = validateSecretType(getRequired(flags, 'type'));
|
|
19
20
|
const memo = getRequired(flags, 'memo');
|
|
20
|
-
const chainId =
|
|
21
|
+
const chainId = getNumber(flags, 'chain-id');
|
|
21
22
|
const body = { type, memo };
|
|
22
|
-
if (chainId)
|
|
23
|
-
body.chainId =
|
|
23
|
+
if (chainId !== undefined)
|
|
24
|
+
body.chainId = chainId;
|
|
24
25
|
const res = (await vincentPost('/api/secrets', null, body));
|
|
25
|
-
const apiKey = res.
|
|
26
|
-
const
|
|
26
|
+
const { secret, apiKey: apiKeyObj, claimUrl } = res.data;
|
|
27
|
+
const apiKey = apiKeyObj.key;
|
|
28
|
+
const keyId = apiKeyObj.id;
|
|
29
|
+
const secretId = secret.id;
|
|
27
30
|
storeKey({
|
|
28
31
|
id: keyId,
|
|
29
32
|
apiKey,
|
|
30
33
|
type,
|
|
31
34
|
memo,
|
|
32
|
-
secretId
|
|
35
|
+
secretId,
|
|
33
36
|
createdAt: new Date().toISOString(),
|
|
34
37
|
});
|
|
35
38
|
console.log(JSON.stringify({
|
|
36
39
|
keyId,
|
|
37
|
-
claimUrl
|
|
38
|
-
|
|
39
|
-
secretId: res.secretId || res.id,
|
|
40
|
+
claimUrl,
|
|
41
|
+
secretId,
|
|
40
42
|
}, null, 2));
|
|
41
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseArgs, getOptional, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { listKeys } from '../../lib/keystore.js';
|
|
3
|
+
import { validateSecretType } from '../../lib/types.js';
|
|
3
4
|
export async function run(argv) {
|
|
4
5
|
const { flags } = parseArgs(argv);
|
|
5
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -11,7 +12,8 @@ export async function run(argv) {
|
|
|
11
12
|
]);
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
const
|
|
15
|
+
const rawType = getOptional(flags, 'type');
|
|
16
|
+
const type = rawType !== undefined ? validateSecretType(rawType) : undefined;
|
|
15
17
|
const keys = listKeys(type);
|
|
16
18
|
console.log(JSON.stringify(keys.map((k) => ({ id: k.id, type: k.type, memo: k.memo, createdAt: k.createdAt })), null, 2));
|
|
17
19
|
}
|
|
@@ -14,8 +14,7 @@ export async function run(argv) {
|
|
|
14
14
|
relinkToken: token,
|
|
15
15
|
apiKeyName: 'Re-linked API Key',
|
|
16
16
|
}));
|
|
17
|
-
const secret = res.
|
|
18
|
-
const apiKeyObj = res.apiKey;
|
|
17
|
+
const { secret, apiKey: apiKeyObj } = res.data;
|
|
19
18
|
const apiKey = apiKeyObj.key;
|
|
20
19
|
const keyId = apiKeyObj.id;
|
|
21
20
|
const type = secret.type;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseArgs, getRequired,
|
|
1
|
+
import { parseArgs, getRequired, getRequiredNumber, getNumber, hasFlag, showHelp, } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentPost
|
|
3
|
+
import { vincentPost } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -23,12 +23,12 @@ export async function run(argv) {
|
|
|
23
23
|
marketId: getRequired(flags, 'market-id'),
|
|
24
24
|
tokenId: getRequired(flags, 'token-id'),
|
|
25
25
|
ruleType: getRequired(flags, 'rule-type'),
|
|
26
|
-
triggerPrice:
|
|
26
|
+
triggerPrice: getRequiredNumber(flags, 'trigger-price'),
|
|
27
27
|
action: { type: 'SELL_ALL' },
|
|
28
28
|
};
|
|
29
|
-
const trailingPercent =
|
|
30
|
-
if (trailingPercent)
|
|
31
|
-
body.trailingPercent =
|
|
32
|
-
const res = await vincentPost('/api/rules', apiKey, body
|
|
29
|
+
const trailingPercent = getNumber(flags, 'trailing-percent');
|
|
30
|
+
if (trailingPercent !== undefined)
|
|
31
|
+
body.trailingPercent = trailingPercent;
|
|
32
|
+
const res = await vincentPost('/api/skills/polymarket/rules', apiKey, body);
|
|
33
33
|
console.log(JSON.stringify(res, null, 2));
|
|
34
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs, getRequired, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentDelete
|
|
3
|
+
import { vincentDelete } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -12,8 +12,6 @@ export async function run(argv) {
|
|
|
12
12
|
}
|
|
13
13
|
const apiKey = resolveApiKey(flags, 'POLYMARKET_WALLET');
|
|
14
14
|
const ruleId = getRequired(flags, 'rule-id');
|
|
15
|
-
const res = await vincentDelete(`/api/rules/${ruleId}`, apiKey
|
|
16
|
-
baseUrl: getTradeManagerBaseUrl(),
|
|
17
|
-
});
|
|
15
|
+
const res = await vincentDelete(`/api/skills/polymarket/rules/${ruleId}`, apiKey);
|
|
18
16
|
console.log(JSON.stringify(res, null, 2));
|
|
19
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs, getOptional, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentGet
|
|
3
|
+
import { vincentGet } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -23,8 +23,6 @@ export async function run(argv) {
|
|
|
23
23
|
const offset = getOptional(flags, 'offset');
|
|
24
24
|
if (offset)
|
|
25
25
|
params.offset = offset;
|
|
26
|
-
const res = await vincentGet('/api/events', apiKey, params
|
|
27
|
-
baseUrl: getTradeManagerBaseUrl(),
|
|
28
|
-
});
|
|
26
|
+
const res = await vincentGet('/api/skills/polymarket/rules/events', apiKey, params);
|
|
29
27
|
console.log(JSON.stringify(res, null, 2));
|
|
30
28
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { parseArgs, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
|
-
import { vincentGet
|
|
2
|
+
import { vincentGet } from '../../lib/client.js';
|
|
3
3
|
export async function run(argv) {
|
|
4
4
|
const { flags } = parseArgs(argv);
|
|
5
5
|
if (hasFlag(flags, 'help')) {
|
|
6
6
|
showHelp('trade-manager health', []);
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
const res = await vincentGet('/health', null
|
|
9
|
+
const res = await vincentGet('/health', null);
|
|
10
10
|
console.log(JSON.stringify(res, null, 2));
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs, getOptional, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentGet
|
|
3
|
+
import { vincentGet } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -15,6 +15,6 @@ export async function run(argv) {
|
|
|
15
15
|
const status = getOptional(flags, 'status');
|
|
16
16
|
if (status)
|
|
17
17
|
params.status = status;
|
|
18
|
-
const res = await vincentGet('/api/rules', apiKey, params
|
|
18
|
+
const res = await vincentGet('/api/skills/polymarket/rules', apiKey, params);
|
|
19
19
|
console.log(JSON.stringify(res, null, 2));
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentGet
|
|
3
|
+
import { vincentGet } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -8,8 +8,6 @@ export async function run(argv) {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
const apiKey = resolveApiKey(flags, 'POLYMARKET_WALLET');
|
|
11
|
-
const res = await vincentGet('/api/positions', apiKey
|
|
12
|
-
baseUrl: getTradeManagerBaseUrl(),
|
|
13
|
-
});
|
|
11
|
+
const res = await vincentGet('/api/skills/polymarket/rules/positions', apiKey);
|
|
14
12
|
console.log(JSON.stringify(res, null, 2));
|
|
15
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentGet
|
|
3
|
+
import { vincentGet } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -8,6 +8,6 @@ export async function run(argv) {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
const apiKey = resolveApiKey(flags, 'POLYMARKET_WALLET');
|
|
11
|
-
const res = await vincentGet('/status', apiKey
|
|
11
|
+
const res = await vincentGet('/api/skills/polymarket/rules/status', apiKey);
|
|
12
12
|
console.log(JSON.stringify(res, null, 2));
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseArgs, getRequired, hasFlag, showHelp } from '../../lib/args.js';
|
|
1
|
+
import { parseArgs, getRequired, getRequiredNumber, hasFlag, showHelp } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
|
-
import { vincentPatch
|
|
3
|
+
import { vincentPatch } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
5
5
|
const { flags } = parseArgs(argv);
|
|
6
6
|
if (hasFlag(flags, 'help')) {
|
|
@@ -13,8 +13,8 @@ export async function run(argv) {
|
|
|
13
13
|
}
|
|
14
14
|
const apiKey = resolveApiKey(flags, 'POLYMARKET_WALLET');
|
|
15
15
|
const ruleId = getRequired(flags, 'rule-id');
|
|
16
|
-
const res = await vincentPatch(`/api/rules/${ruleId}`, apiKey, {
|
|
17
|
-
triggerPrice:
|
|
18
|
-
}
|
|
16
|
+
const res = await vincentPatch(`/api/skills/polymarket/rules/${ruleId}`, apiKey, {
|
|
17
|
+
triggerPrice: getRequiredNumber(flags, 'trigger-price'),
|
|
18
|
+
});
|
|
19
19
|
console.log(JSON.stringify(res, null, 2));
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseArgs, getRequired,
|
|
1
|
+
import { parseArgs, getRequired, getRequiredNumber, getNumber, hasFlag, showHelp, } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
3
|
import { vincentPost } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
@@ -24,12 +24,12 @@ export async function run(argv) {
|
|
|
24
24
|
sellToken: getRequired(flags, 'sell-token'),
|
|
25
25
|
buyToken: getRequired(flags, 'buy-token'),
|
|
26
26
|
sellAmount: getRequired(flags, 'sell-amount'),
|
|
27
|
-
chainId:
|
|
27
|
+
chainId: getRequiredNumber(flags, 'chain-id'),
|
|
28
28
|
};
|
|
29
29
|
if (subcommand === 'execute') {
|
|
30
|
-
const slippage =
|
|
31
|
-
if (slippage)
|
|
32
|
-
body.slippageBps =
|
|
30
|
+
const slippage = getNumber(flags, 'slippage');
|
|
31
|
+
if (slippage !== undefined)
|
|
32
|
+
body.slippageBps = slippage;
|
|
33
33
|
}
|
|
34
34
|
const res = await vincentPost(`/api/skills/evm-wallet/swap/${subcommand}`, apiKey, body);
|
|
35
35
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseArgs, getRequired,
|
|
1
|
+
import { parseArgs, getRequired, getRequiredNumber, getNumber, hasFlag, showHelp, } from '../../lib/args.js';
|
|
2
2
|
import { resolveApiKey } from '../../lib/keystore.js';
|
|
3
3
|
import { vincentPost, vincentGet } from '../../lib/client.js';
|
|
4
4
|
export async function run(argv) {
|
|
@@ -43,15 +43,15 @@ export async function run(argv) {
|
|
|
43
43
|
}
|
|
44
44
|
const body = {
|
|
45
45
|
toSecretId: getRequired(flags, 'to-secret-id'),
|
|
46
|
-
fromChainId:
|
|
47
|
-
toChainId:
|
|
46
|
+
fromChainId: getRequiredNumber(flags, 'from-chain'),
|
|
47
|
+
toChainId: getRequiredNumber(flags, 'to-chain'),
|
|
48
48
|
tokenIn: getRequired(flags, 'token-in'),
|
|
49
49
|
tokenInAmount: getRequired(flags, 'amount'),
|
|
50
50
|
tokenOut: getRequired(flags, 'token-out'),
|
|
51
51
|
};
|
|
52
|
-
const slippage =
|
|
53
|
-
if (slippage)
|
|
54
|
-
body.slippage =
|
|
52
|
+
const slippage = getNumber(flags, 'slippage');
|
|
53
|
+
if (slippage !== undefined)
|
|
54
|
+
body.slippage = slippage;
|
|
55
55
|
const res = await vincentPost(`/api/skills/evm-wallet/transfer-between-secrets/${subcommand}`, apiKey, body);
|
|
56
56
|
console.log(JSON.stringify(res, null, 2));
|
|
57
57
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const pkg = require('../package.json');
|
|
2
5
|
const COMMANDS = {
|
|
3
6
|
secret: {
|
|
4
7
|
create: () => import('./commands/secret/create.js'),
|
|
@@ -74,7 +77,7 @@ async function main() {
|
|
|
74
77
|
process.exit(0);
|
|
75
78
|
}
|
|
76
79
|
if (argv[0] === '--version' || argv[0] === '-v') {
|
|
77
|
-
console.log(
|
|
80
|
+
console.log(pkg.version);
|
|
78
81
|
process.exit(0);
|
|
79
82
|
}
|
|
80
83
|
const group = argv[0];
|
|
@@ -108,4 +111,3 @@ main().catch((err) => {
|
|
|
108
111
|
console.error(`Error: ${message}`);
|
|
109
112
|
process.exit(1);
|
|
110
113
|
});
|
|
111
|
-
export {};
|
package/dist/lib/client.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
const DEFAULT_BASE_URL = 'https://heyvincent.ai';
|
|
2
|
-
const TRADE_MANAGER_BASE_URL = 'http://localhost:19000';
|
|
3
2
|
function getBaseUrl() {
|
|
4
3
|
return process.env.VINCENT_BASE_URL || DEFAULT_BASE_URL;
|
|
5
4
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
async function request(method, path, apiKey, body, opts) {
|
|
10
|
-
const base = opts?.baseUrl || getBaseUrl();
|
|
5
|
+
async function request(method, path, apiKey, body) {
|
|
6
|
+
const base = getBaseUrl();
|
|
11
7
|
const url = `${base}${path}`;
|
|
12
8
|
const headers = {};
|
|
13
9
|
if (apiKey) {
|
|
@@ -30,9 +26,10 @@ async function request(method, path, apiKey, body, opts) {
|
|
|
30
26
|
data = text;
|
|
31
27
|
}
|
|
32
28
|
if (!res.ok) {
|
|
29
|
+
const err = data?.error;
|
|
33
30
|
const msg = typeof data === 'object' && data !== null
|
|
34
31
|
? data.message ||
|
|
35
|
-
|
|
32
|
+
(typeof err === 'string' ? err : err?.message) ||
|
|
36
33
|
text
|
|
37
34
|
: text;
|
|
38
35
|
console.error(`API error (${res.status}): ${msg}`);
|
|
@@ -40,7 +37,7 @@ async function request(method, path, apiKey, body, opts) {
|
|
|
40
37
|
}
|
|
41
38
|
return data;
|
|
42
39
|
}
|
|
43
|
-
export function vincentGet(path, apiKey, params
|
|
40
|
+
export function vincentGet(path, apiKey, params) {
|
|
44
41
|
let fullPath = path;
|
|
45
42
|
if (params) {
|
|
46
43
|
const entries = Object.entries(params).filter(([, v]) => v !== undefined && v !== '');
|
|
@@ -48,14 +45,14 @@ export function vincentGet(path, apiKey, params, opts) {
|
|
|
48
45
|
fullPath += '?' + new URLSearchParams(entries).toString();
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
return request('GET', fullPath, apiKey
|
|
48
|
+
return request('GET', fullPath, apiKey);
|
|
52
49
|
}
|
|
53
|
-
export function vincentPost(path, apiKey, body
|
|
54
|
-
return request('POST', path, apiKey, body
|
|
50
|
+
export function vincentPost(path, apiKey, body) {
|
|
51
|
+
return request('POST', path, apiKey, body);
|
|
55
52
|
}
|
|
56
|
-
export function vincentDelete(path, apiKey
|
|
57
|
-
return request('DELETE', path, apiKey
|
|
53
|
+
export function vincentDelete(path, apiKey) {
|
|
54
|
+
return request('DELETE', path, apiKey);
|
|
58
55
|
}
|
|
59
|
-
export function vincentPatch(path, apiKey, body
|
|
60
|
-
return request('PATCH', path, apiKey, body
|
|
56
|
+
export function vincentPatch(path, apiKey, body) {
|
|
57
|
+
return request('PATCH', path, apiKey, body);
|
|
61
58
|
}
|
package/dist/lib/keystore.js
CHANGED
|
@@ -22,7 +22,7 @@ export function storeKey(keyData) {
|
|
|
22
22
|
const dir = getDirForType(keyData.type);
|
|
23
23
|
mkdirSync(dir, { recursive: true });
|
|
24
24
|
const filePath = join(dir, `${keyData.id}.json`);
|
|
25
|
-
writeFileSync(filePath, JSON.stringify(keyData, null, 2) + '\n');
|
|
25
|
+
writeFileSync(filePath, JSON.stringify(keyData, null, 2) + '\n', { mode: 0o600 });
|
|
26
26
|
}
|
|
27
27
|
export function getKey(keyId) {
|
|
28
28
|
const root = getCredentialsRoot();
|
package/dist/lib/types.js
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
const VALID_SECRET_TYPES = [
|
|
2
|
+
'EVM_WALLET',
|
|
3
|
+
'POLYMARKET_WALLET',
|
|
4
|
+
'RAW_SIGNER',
|
|
5
|
+
'DATA_SOURCES',
|
|
6
|
+
];
|
|
7
|
+
export function validateSecretType(value) {
|
|
8
|
+
if (!VALID_SECRET_TYPES.includes(value)) {
|
|
9
|
+
console.error(`Invalid secret type "${value}". Expected one of: ${VALID_SECRET_TYPES.join(', ')}`);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|