molly-cli 0.1.0 → 0.1.1
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/campaign.js +37 -12
- package/dist/index.js +1 -1
- package/package.json +6 -6
|
@@ -2,7 +2,7 @@ import { resolveConfig } from "../lib/config-manager.js";
|
|
|
2
2
|
import { buildClient, buildReadClient } from "../lib/client.js";
|
|
3
3
|
import { writeAndWait, readContract } from "../lib/tx.js";
|
|
4
4
|
import { output, outputError } from "../lib/output.js";
|
|
5
|
-
import { EXIT_TX_ERROR, EXIT_NETWORK_ERROR, EXIT_INPUT_ERROR } from "../lib/errors.js";
|
|
5
|
+
import { EXIT_TX_ERROR, EXIT_NETWORK_ERROR, EXIT_INPUT_ERROR, } from "../lib/errors.js";
|
|
6
6
|
function getAddress(cmd) {
|
|
7
7
|
const globals = cmd.optsWithGlobals();
|
|
8
8
|
const address = globals.address;
|
|
@@ -78,7 +78,9 @@ export function registerCampaign(program) {
|
|
|
78
78
|
try {
|
|
79
79
|
const config = resolveConfig({ network: globals.network });
|
|
80
80
|
const { client } = buildReadClient(config);
|
|
81
|
-
const data = await readContract(client, address, "get_submissions", [
|
|
81
|
+
const data = await readContract(client, address, "get_submissions", [
|
|
82
|
+
missionId,
|
|
83
|
+
]);
|
|
82
84
|
output({ ok: true, data }, pretty);
|
|
83
85
|
}
|
|
84
86
|
catch (err) {
|
|
@@ -106,15 +108,17 @@ export function registerCampaign(program) {
|
|
|
106
108
|
campaign
|
|
107
109
|
.command("submit <mission-id> <post-url>")
|
|
108
110
|
.description("Submit a post to a campaign mission")
|
|
109
|
-
.option("--referrer <code>", "Referrer code", "")
|
|
110
111
|
.action(async (missionId, postUrl, opts, cmd) => {
|
|
111
112
|
const globals = cmd.optsWithGlobals();
|
|
112
113
|
const pretty = globals.pretty;
|
|
113
114
|
const address = getAddress(cmd);
|
|
114
115
|
try {
|
|
115
|
-
const config = resolveConfig({
|
|
116
|
+
const config = resolveConfig({
|
|
117
|
+
privateKey: globals.privateKey,
|
|
118
|
+
network: globals.network,
|
|
119
|
+
});
|
|
116
120
|
const { client } = buildClient(config);
|
|
117
|
-
const { hash } = await writeAndWait(client, address, "submit_post", [missionId, postUrl
|
|
121
|
+
const { hash } = await writeAndWait(client, address, "submit_post", [missionId, postUrl], { timeout: globals.timeout });
|
|
118
122
|
output({ ok: true, hash, missionId, postUrl }, pretty);
|
|
119
123
|
}
|
|
120
124
|
catch (err) {
|
|
@@ -129,7 +133,10 @@ export function registerCampaign(program) {
|
|
|
129
133
|
const pretty = globals.pretty;
|
|
130
134
|
const address = getAddress(cmd);
|
|
131
135
|
try {
|
|
132
|
-
const config = resolveConfig({
|
|
136
|
+
const config = resolveConfig({
|
|
137
|
+
privateKey: globals.privateKey,
|
|
138
|
+
network: globals.network,
|
|
139
|
+
});
|
|
133
140
|
const { client } = buildClient(config);
|
|
134
141
|
const { hash } = await writeAndWait(client, address, "resubmit_post", [missionId, postUrl], { timeout: globals.timeout });
|
|
135
142
|
output({ ok: true, hash, missionId, postUrl }, pretty);
|
|
@@ -146,7 +153,10 @@ export function registerCampaign(program) {
|
|
|
146
153
|
const pretty = globals.pretty;
|
|
147
154
|
const address = getAddress(cmd);
|
|
148
155
|
try {
|
|
149
|
-
const config = resolveConfig({
|
|
156
|
+
const config = resolveConfig({
|
|
157
|
+
privateKey: globals.privateKey,
|
|
158
|
+
network: globals.network,
|
|
159
|
+
});
|
|
150
160
|
const { client } = buildClient(config);
|
|
151
161
|
const { hash } = await writeAndWait(client, address, "retry_submission", [missionId, postUrl], { timeout: globals.timeout });
|
|
152
162
|
output({ ok: true, hash, missionId, postUrl }, pretty);
|
|
@@ -163,7 +173,10 @@ export function registerCampaign(program) {
|
|
|
163
173
|
const pretty = globals.pretty;
|
|
164
174
|
const address = getAddress(cmd);
|
|
165
175
|
try {
|
|
166
|
-
const config = resolveConfig({
|
|
176
|
+
const config = resolveConfig({
|
|
177
|
+
privateKey: globals.privateKey,
|
|
178
|
+
network: globals.network,
|
|
179
|
+
});
|
|
167
180
|
const { client } = buildClient(config);
|
|
168
181
|
const { hash } = await writeAndWait(client, address, "bridge_period_distribution", [parseInt(period, 10)], { timeout: globals.timeout });
|
|
169
182
|
output({ ok: true, hash, period: parseInt(period, 10) }, pretty);
|
|
@@ -180,7 +193,10 @@ export function registerCampaign(program) {
|
|
|
180
193
|
const pretty = globals.pretty;
|
|
181
194
|
const address = getAddress(cmd);
|
|
182
195
|
try {
|
|
183
|
-
const config = resolveConfig({
|
|
196
|
+
const config = resolveConfig({
|
|
197
|
+
privateKey: globals.privateKey,
|
|
198
|
+
network: globals.network,
|
|
199
|
+
});
|
|
184
200
|
const { client } = buildClient(config);
|
|
185
201
|
const { hash } = await writeAndWait(client, address, "challenge_deleted_post", [postId], { timeout: globals.timeout });
|
|
186
202
|
output({ ok: true, hash, postId }, pretty);
|
|
@@ -197,7 +213,10 @@ export function registerCampaign(program) {
|
|
|
197
213
|
const pretty = globals.pretty;
|
|
198
214
|
const address = getAddress(cmd);
|
|
199
215
|
try {
|
|
200
|
-
const config = resolveConfig({
|
|
216
|
+
const config = resolveConfig({
|
|
217
|
+
privateKey: globals.privateKey,
|
|
218
|
+
network: globals.network,
|
|
219
|
+
});
|
|
201
220
|
const { client } = buildClient(config);
|
|
202
221
|
const { hash } = await writeAndWait(client, address, "disqualify_submission", [postId], { timeout: globals.timeout });
|
|
203
222
|
output({ ok: true, hash, postId }, pretty);
|
|
@@ -218,7 +237,10 @@ export function registerCampaign(program) {
|
|
|
218
237
|
const pretty = globals.pretty;
|
|
219
238
|
const address = getAddress(cmd);
|
|
220
239
|
try {
|
|
221
|
-
const config = resolveConfig({
|
|
240
|
+
const config = resolveConfig({
|
|
241
|
+
privateKey: globals.privateKey,
|
|
242
|
+
network: globals.network,
|
|
243
|
+
});
|
|
222
244
|
const { client } = buildClient(config);
|
|
223
245
|
const args = [
|
|
224
246
|
opts.whitelisted || null,
|
|
@@ -241,7 +263,10 @@ export function registerCampaign(program) {
|
|
|
241
263
|
const pretty = globals.pretty;
|
|
242
264
|
const address = getAddress(cmd);
|
|
243
265
|
try {
|
|
244
|
-
const config = resolveConfig({
|
|
266
|
+
const config = resolveConfig({
|
|
267
|
+
privateKey: globals.privateKey,
|
|
268
|
+
network: globals.network,
|
|
269
|
+
});
|
|
245
270
|
const { client } = buildClient(config);
|
|
246
271
|
const { hash } = await writeAndWait(client, address, "update_campaign_duration_periods", [parseInt(periods, 10)], { timeout: globals.timeout });
|
|
247
272
|
output({ ok: true, hash, periods: parseInt(periods, 10) }, pretty);
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { registerCampaign } from "./commands/campaign.js";
|
|
|
9
9
|
const program = new Command();
|
|
10
10
|
program
|
|
11
11
|
.name("molly")
|
|
12
|
-
.description("CLI for AI bots to interact with GenLayer via
|
|
12
|
+
.description("CLI for AI bots to interact with GenLayer via Molly")
|
|
13
13
|
.version("0.1.0")
|
|
14
14
|
.option("--network <url>", "GenLayer RPC URL")
|
|
15
15
|
.option("--private-key <key>", "Private key (overrides config)")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "molly-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI for AI bots to interact with the GenLayer blockchain via
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "CLI for AI bots to interact with the GenLayer blockchain via Molly",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"molly": "./dist/index.js"
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/genlayerlabs/
|
|
16
|
+
"url": "git+https://github.com/genlayerlabs/mollyfun.git",
|
|
17
17
|
"directory": "cli"
|
|
18
18
|
},
|
|
19
|
-
"homepage": "https://github.com/genlayerlabs/
|
|
19
|
+
"homepage": "https://github.com/genlayerlabs/mollyfun/tree/main/cli",
|
|
20
20
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/genlayerlabs/
|
|
21
|
+
"url": "https://github.com/genlayerlabs/mollyfun/issues"
|
|
22
22
|
},
|
|
23
23
|
"author": "GenLayer Labs",
|
|
24
24
|
"engines": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"keywords": [
|
|
40
40
|
"genlayer",
|
|
41
|
-
"
|
|
41
|
+
"mollyfun",
|
|
42
42
|
"moltbook",
|
|
43
43
|
"cli",
|
|
44
44
|
"ai",
|