Skip to content

Commit

Permalink
Add category and chains flags to verify (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
GAllen98 authored Jan 15, 2025
1 parent 3661720 commit 5daaf48
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
24 changes: 23 additions & 1 deletion src/commands/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,29 @@ export const verifyCommand = new Command()
"To verify a plugin we need the url for a public repository containing the plugin's code",
)
.option(
"-v, --version <versionNumber>",
"-v, --version [versionNumber]",
"Specify the version of the plugin in case of an update",
)
.option(
"-c, --categories [categories]",
"List some categories that describe the type of plugin you're verifying. Example: -c DeFi,Investing",
(categories) =>
categories && typeof categories === "string" && categories.length > 0
? categories.split(",")
: null,
)
.option(
"-x, --chains [chainIds]",
"If your plugin works on specific evm chains, you can specify them so your plugin is easier to find. If your plugin does not work on evm you can ignore this flag. Example: -x 1,8453",
(str) => {
// convert comma separated numbers on a string to an int array
if (!str || typeof str !== "string" || str.length === 0) {
return null;
}
const strArray = str.split(",");
return strArray.map((num) => parseInt(num));
},
)
.action(async (options) => {
const url = options.url || deployedUrl;

Expand Down Expand Up @@ -49,5 +69,7 @@ export const verifyCommand = new Command()
email: options.email,
repo: options.repo,
version: options.version,
categories: options.categories,
chains: options.chains,
});
});
28 changes: 15 additions & 13 deletions src/services/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ export class PluginService {
repo,
version,
accountId,
categories,
chains,
}: {
pluginId: string;
email: string;
repo: string;
version?: string;
accountId?: string;
categories?: string[];
chains?: number[];
}): Promise<void> {
const message = await this.auth.getAuthentication(accountId);
if (!message) {
Expand All @@ -111,19 +115,17 @@ export class PluginService {
}

try {
//const res = await fetch(`${this.bitteUrls.BASE_URL}/verify/${pluginId}`, {
const res = await fetch(
`http://localhost:3001/api/ai-plugins/verify/${pluginId}`,
{
method: "POST",
headers: { "bitte-api-key": message },
body: JSON.stringify({
repo: repo,
email: email,
version: version,
}),
},
);
const res = await fetch(`${this.bitteUrls.BASE_URL}/verify/${pluginId}`, {
method: "POST",
headers: { "bitte-api-key": message },
body: JSON.stringify({
repo: repo,
email: email,
version: version,
categories: categories,
chains: chains,
}),
});

if (res.ok) {
console.log(
Expand Down

0 comments on commit 5daaf48

Please sign in to comment.