crewpay-solana-agent-kit-plugin 0.1.1 → 0.2.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/README.md +5 -7
- package/dist/client.d.ts +9 -21
- package/dist/client.js +15 -59
- package/dist/index.d.ts +12 -92
- package/dist/index.js +12 -23
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -11,24 +11,22 @@ import { SolanaAgentKit } from 'solana-agent-kit'
|
|
|
11
11
|
import { CrewPayPlugin } from 'crewpay-solana-agent-kit-plugin'
|
|
12
12
|
|
|
13
13
|
const agent = new SolanaAgentKit(wallet, rpcUrl, config).use(CrewPayPlugin)
|
|
14
|
-
await agent.methods.crewDryRun({ name: 'Desk Cat', ticker: 'DCAT', autoHire: { seats: 3 } })
|
|
15
|
-
// human
|
|
14
|
+
const dry = await agent.methods.crewDryRun({ name: 'Desk Cat', ticker: 'DCAT', autoHire: { seats: 3 } })
|
|
15
|
+
// human opens dry.approvalUrl…
|
|
16
16
|
await agent.methods.crewLaunch({
|
|
17
17
|
name: 'Desk Cat',
|
|
18
18
|
ticker: 'DCAT',
|
|
19
19
|
autoHire: { seats: 3 },
|
|
20
|
-
|
|
21
|
-
humanConfirmed: true,
|
|
22
|
-
confirmPhrase: 'APPROVE_SOL_SPEND',
|
|
20
|
+
dryRunId: dry.dryRunId,
|
|
23
21
|
})
|
|
24
22
|
```
|
|
25
23
|
|
|
26
24
|
## Safety
|
|
27
25
|
|
|
28
|
-
- Dry-run first;
|
|
26
|
+
- Dry-run first; human opens `approvalUrl`; launch with `dryRunId`
|
|
29
27
|
- Env keys only (`CREWPAY_API_KEY` / `CREW_AGENT_API_KEY`, `CREW_LAUNCHER_KEY`)
|
|
30
28
|
- Fee map **60/15/25**; buyback cron not live yet
|
|
31
|
-
- Prefer MCP: `npx -y crewpay-mcp@1.2.
|
|
29
|
+
- Prefer MCP: `npx -y crewpay-mcp@1.2.3` or https://mcp.crewpay.dev/mcp
|
|
32
30
|
|
|
33
31
|
## Links
|
|
34
32
|
|
package/dist/client.d.ts
CHANGED
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
* Minimal CrewPay REST client for framework plugins.
|
|
3
3
|
* Keys from env only — never accept private keys as function arguments.
|
|
4
4
|
*
|
|
5
|
-
* Spend
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Spend gate: POST /api/agent/launch/dry-run returns dryRunId + approvalUrl
|
|
6
|
+
* (no approve secret). Operator opens approvalUrl and wallet-signs.
|
|
7
|
+
* Launch/wire require dryRunId after approval. Image content is bound by sha256.
|
|
8
8
|
*/
|
|
9
9
|
export declare const DEFAULT_API_URL = "https://api.crewpay.dev";
|
|
10
|
-
/** Exact phrase a human must supply for SOL-spending calls. */
|
|
11
|
-
export declare const SOL_SPEND_CONFIRM_PHRASE = "APPROVE_SOL_SPEND";
|
|
12
10
|
export type CrewPayEnv = {
|
|
13
11
|
apiUrl?: string;
|
|
14
12
|
apiKey?: string;
|
|
15
13
|
launcherKey?: string;
|
|
16
14
|
};
|
|
17
15
|
export declare function loadCrewPayEnv(overrides?: CrewPayEnv): Required<Pick<CrewPayEnv, 'apiUrl'>> & CrewPayEnv;
|
|
18
|
-
/** Canonical hash of launch fields so dry-run and launch bodies must match. */
|
|
19
|
-
export declare function hashLaunchBody(body: Record<string, unknown>): string;
|
|
20
16
|
export declare class CrewPayClient {
|
|
21
17
|
private readonly env;
|
|
22
18
|
constructor(env?: ReturnType<typeof loadCrewPayEnv>);
|
|
@@ -32,27 +28,19 @@ export declare class CrewPayClient {
|
|
|
32
28
|
model?: string;
|
|
33
29
|
}): Promise<unknown>;
|
|
34
30
|
autohire(body: Record<string, unknown>): Promise<unknown>;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
confirmPhraseRequired: string;
|
|
38
|
-
tip: string;
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* Real launch — spends SOL. Requires a prior dryRunToken for this body plus
|
|
42
|
-
* humanConfirmed and confirmPhrase APPROVE_SOL_SPEND.
|
|
43
|
-
*/
|
|
31
|
+
/** Server dry-run — returns plan + dryRunId + approvalUrl (no approve secret). */
|
|
32
|
+
dryRun(body: Record<string, unknown>): Promise<unknown>;
|
|
44
33
|
launch(body: Record<string, unknown>, opts: {
|
|
45
|
-
|
|
46
|
-
confirmPhrase: string;
|
|
47
|
-
dryRunToken: string;
|
|
34
|
+
dryRunId: string;
|
|
48
35
|
}): Promise<unknown>;
|
|
49
36
|
wireFees(body: {
|
|
50
37
|
mint: string;
|
|
51
38
|
mode?: string;
|
|
52
39
|
crew?: unknown[];
|
|
40
|
+
name?: string;
|
|
41
|
+
ticker?: string;
|
|
53
42
|
}, opts: {
|
|
54
|
-
|
|
55
|
-
confirmPhrase: string;
|
|
43
|
+
dryRunId: string;
|
|
56
44
|
}): Promise<unknown>;
|
|
57
45
|
crank(body: {
|
|
58
46
|
mint: string;
|
package/dist/client.js
CHANGED
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
* Minimal CrewPay REST client for framework plugins.
|
|
3
3
|
* Keys from env only — never accept private keys as function arguments.
|
|
4
4
|
*
|
|
5
|
-
* Spend
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Spend gate: POST /api/agent/launch/dry-run returns dryRunId + approvalUrl
|
|
6
|
+
* (no approve secret). Operator opens approvalUrl and wallet-signs.
|
|
7
|
+
* Launch/wire require dryRunId after approval. Image content is bound by sha256.
|
|
8
8
|
*/
|
|
9
|
-
import { createHash, randomBytes } from 'node:crypto';
|
|
10
9
|
export const DEFAULT_API_URL = 'https://api.crewpay.dev';
|
|
11
|
-
/** Exact phrase a human must supply for SOL-spending calls. */
|
|
12
|
-
export const SOL_SPEND_CONFIRM_PHRASE = 'APPROVE_SOL_SPEND';
|
|
13
|
-
const pendingDryRuns = new Map();
|
|
14
|
-
const DRY_RUN_TTL_MS = 30 * 60 * 1000;
|
|
15
10
|
export function loadCrewPayEnv(overrides = {}) {
|
|
16
11
|
return {
|
|
17
12
|
apiUrl: (overrides.apiUrl || process.env.CREW_API_URL || DEFAULT_API_URL).replace(/\/$/, ''),
|
|
@@ -24,29 +19,6 @@ export function loadCrewPayEnv(overrides = {}) {
|
|
|
24
19
|
'',
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
|
-
/** Canonical hash of launch fields so dry-run and launch bodies must match. */
|
|
28
|
-
export function hashLaunchBody(body) {
|
|
29
|
-
const pick = {
|
|
30
|
-
name: body.name,
|
|
31
|
-
ticker: body.ticker,
|
|
32
|
-
description: body.description ?? null,
|
|
33
|
-
mode: body.mode ?? 'agent',
|
|
34
|
-
initialBuySol: body.initialBuySol ?? 0,
|
|
35
|
-
imageUrl: body.imageUrl ?? null,
|
|
36
|
-
autoHire: body.autoHire ?? null,
|
|
37
|
-
crew: body.crew ?? null,
|
|
38
|
-
holderKol: body.holderKol ?? false,
|
|
39
|
-
};
|
|
40
|
-
return createHash('sha256').update(JSON.stringify(pick)).digest('hex');
|
|
41
|
-
}
|
|
42
|
-
function assertSpendConfirm(opts, action) {
|
|
43
|
-
if (opts.humanConfirmed !== true) {
|
|
44
|
-
throw new Error(`${action} blocked: humanConfirmed must be true after an explicit human approval`);
|
|
45
|
-
}
|
|
46
|
-
if (opts.confirmPhrase !== SOL_SPEND_CONFIRM_PHRASE) {
|
|
47
|
-
throw new Error(`${action} blocked: confirmPhrase must be exactly "${SOL_SPEND_CONFIRM_PHRASE}" (human-supplied; do not invent)`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
22
|
export class CrewPayClient {
|
|
51
23
|
env;
|
|
52
24
|
constructor(env = loadCrewPayEnv()) {
|
|
@@ -102,52 +74,36 @@ export class CrewPayClient {
|
|
|
102
74
|
body: JSON.stringify(body),
|
|
103
75
|
});
|
|
104
76
|
}
|
|
105
|
-
|
|
106
|
-
|
|
77
|
+
/** Server dry-run — returns plan + dryRunId + approvalUrl (no approve secret). */
|
|
78
|
+
dryRun(body) {
|
|
79
|
+
return this.fetch('/api/agent/launch/dry-run', {
|
|
107
80
|
method: 'POST',
|
|
108
81
|
auth: true,
|
|
109
82
|
body: JSON.stringify(body),
|
|
110
83
|
});
|
|
111
|
-
const dryRunToken = randomBytes(16).toString('hex');
|
|
112
|
-
pendingDryRuns.set(dryRunToken, {
|
|
113
|
-
bodyHash: hashLaunchBody(body),
|
|
114
|
-
expiresAt: Date.now() + DRY_RUN_TTL_MS,
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
...(typeof data === 'object' && data ? data : { result: data }),
|
|
118
|
-
dryRunToken,
|
|
119
|
-
confirmPhraseRequired: SOL_SPEND_CONFIRM_PHRASE,
|
|
120
|
-
tip: `To launch: pass the same body + dryRunToken + humanConfirmed:true + confirmPhrase:"${SOL_SPEND_CONFIRM_PHRASE}" (human must supply the phrase).`,
|
|
121
|
-
};
|
|
122
84
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Real launch — spends SOL. Requires a prior dryRunToken for this body plus
|
|
125
|
-
* humanConfirmed and confirmPhrase APPROVE_SOL_SPEND.
|
|
126
|
-
*/
|
|
127
85
|
launch(body, opts) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
throw new Error('Launch blocked: missing/expired dryRunToken — call dryRun first and reuse its dryRunToken');
|
|
132
|
-
}
|
|
133
|
-
if (pending.bodyHash !== hashLaunchBody(body)) {
|
|
134
|
-
throw new Error('Launch blocked: body does not match the dry-run that issued dryRunToken');
|
|
86
|
+
const dryRunId = String(opts.dryRunId || '').trim();
|
|
87
|
+
if (!dryRunId) {
|
|
88
|
+
throw new Error('Launch blocked: dryRunId required — dry-run, operator wallet-approves on approvalUrl, then launch');
|
|
135
89
|
}
|
|
136
|
-
pendingDryRuns.delete(opts.dryRunToken);
|
|
137
90
|
return this.fetch('/api/agent/launch', {
|
|
138
91
|
method: 'POST',
|
|
139
92
|
auth: true,
|
|
140
93
|
launcher: true,
|
|
141
|
-
body: JSON.stringify(body),
|
|
94
|
+
body: JSON.stringify({ ...body, dryRunId }),
|
|
142
95
|
});
|
|
143
96
|
}
|
|
144
97
|
wireFees(body, opts) {
|
|
145
|
-
|
|
98
|
+
const dryRunId = String(opts.dryRunId || '').trim();
|
|
99
|
+
if (!dryRunId) {
|
|
100
|
+
throw new Error('Wire-fees blocked: dryRunId required — dry-run with intent=wire-fees, wallet-approve, then wire');
|
|
101
|
+
}
|
|
146
102
|
return this.fetch('/api/agent/wire-fees', {
|
|
147
103
|
method: 'POST',
|
|
148
104
|
auth: true,
|
|
149
105
|
launcher: true,
|
|
150
|
-
body: JSON.stringify(body),
|
|
106
|
+
body: JSON.stringify({ ...body, dryRunId }),
|
|
151
107
|
});
|
|
152
108
|
}
|
|
153
109
|
crank(body) {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,17 +8,12 @@ export declare const CrewPayPlugin: {
|
|
|
8
8
|
methods: {
|
|
9
9
|
crewDiscover: () => Promise<unknown>;
|
|
10
10
|
crewAutohire: (_agent: unknown, body: Record<string, unknown>) => Promise<unknown>;
|
|
11
|
-
crewDryRun: (_agent: unknown, body: Record<string, unknown>) => Promise<
|
|
12
|
-
dryRunToken: string;
|
|
13
|
-
confirmPhraseRequired: string;
|
|
14
|
-
tip: string;
|
|
15
|
-
}>;
|
|
11
|
+
crewDryRun: (_agent: unknown, body: Record<string, unknown>) => Promise<unknown>;
|
|
16
12
|
crewLaunch: (_agent: unknown, body: Record<string, unknown>) => Promise<unknown>;
|
|
17
13
|
crewWireFees: (_agent: unknown, body: {
|
|
18
14
|
mint: string;
|
|
19
15
|
mode?: string;
|
|
20
|
-
|
|
21
|
-
confirmPhrase?: string;
|
|
16
|
+
dryRunId?: string;
|
|
22
17
|
}) => Promise<unknown>;
|
|
23
18
|
crewCrank: (_agent: unknown, body: {
|
|
24
19
|
mint: string;
|
|
@@ -76,74 +71,8 @@ export declare const CrewPayPlugin: {
|
|
|
76
71
|
}, {
|
|
77
72
|
seats?: number | undefined;
|
|
78
73
|
}>>;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
dryRunToken: z.ZodOptional<z.ZodString>;
|
|
82
|
-
}, "humanConfirmed" | "confirmPhrase" | "dryRunToken">, "passthrough", z.ZodTypeAny, z.objectOutputType<Omit<{
|
|
83
|
-
name: z.ZodString;
|
|
84
|
-
ticker: z.ZodString;
|
|
85
|
-
description: z.ZodOptional<z.ZodString>;
|
|
86
|
-
mode: z.ZodOptional<z.ZodEnum<["split", "buyback", "raid", "agent"]>>;
|
|
87
|
-
initialBuySol: z.ZodOptional<z.ZodNumber>;
|
|
88
|
-
imageUrl: z.ZodOptional<z.ZodString>;
|
|
89
|
-
autoHire: z.ZodOptional<z.ZodObject<{
|
|
90
|
-
seats: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
}, "strip", z.ZodTypeAny, {
|
|
92
|
-
seats?: number | undefined;
|
|
93
|
-
}, {
|
|
94
|
-
seats?: number | undefined;
|
|
95
|
-
}>>;
|
|
96
|
-
humanConfirmed: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
-
confirmPhrase: z.ZodOptional<z.ZodString>;
|
|
98
|
-
dryRunToken: z.ZodOptional<z.ZodString>;
|
|
99
|
-
}, "humanConfirmed" | "confirmPhrase" | "dryRunToken">, z.ZodTypeAny, "passthrough">, z.objectInputType<Omit<{
|
|
100
|
-
name: z.ZodString;
|
|
101
|
-
ticker: z.ZodString;
|
|
102
|
-
description: z.ZodOptional<z.ZodString>;
|
|
103
|
-
mode: z.ZodOptional<z.ZodEnum<["split", "buyback", "raid", "agent"]>>;
|
|
104
|
-
initialBuySol: z.ZodOptional<z.ZodNumber>;
|
|
105
|
-
imageUrl: z.ZodOptional<z.ZodString>;
|
|
106
|
-
autoHire: z.ZodOptional<z.ZodObject<{
|
|
107
|
-
seats: z.ZodOptional<z.ZodNumber>;
|
|
108
|
-
}, "strip", z.ZodTypeAny, {
|
|
109
|
-
seats?: number | undefined;
|
|
110
|
-
}, {
|
|
111
|
-
seats?: number | undefined;
|
|
112
|
-
}>>;
|
|
113
|
-
humanConfirmed: z.ZodOptional<z.ZodBoolean>;
|
|
114
|
-
confirmPhrase: z.ZodOptional<z.ZodString>;
|
|
115
|
-
dryRunToken: z.ZodOptional<z.ZodString>;
|
|
116
|
-
}, "humanConfirmed" | "confirmPhrase" | "dryRunToken">, z.ZodTypeAny, "passthrough">>;
|
|
117
|
-
handler: (_agent: unknown, input: Record<string, unknown>) => Promise<{
|
|
118
|
-
status: string;
|
|
119
|
-
data: {
|
|
120
|
-
dryRunToken: string;
|
|
121
|
-
confirmPhraseRequired: string;
|
|
122
|
-
tip: string;
|
|
123
|
-
};
|
|
124
|
-
}>;
|
|
125
|
-
} | {
|
|
126
|
-
name: string;
|
|
127
|
-
similes: string[];
|
|
128
|
-
description: string;
|
|
129
|
-
schema: z.ZodObject<{
|
|
130
|
-
name: z.ZodString;
|
|
131
|
-
ticker: z.ZodString;
|
|
132
|
-
description: z.ZodOptional<z.ZodString>;
|
|
133
|
-
mode: z.ZodOptional<z.ZodEnum<["split", "buyback", "raid", "agent"]>>;
|
|
134
|
-
initialBuySol: z.ZodOptional<z.ZodNumber>;
|
|
135
|
-
imageUrl: z.ZodOptional<z.ZodString>;
|
|
136
|
-
autoHire: z.ZodOptional<z.ZodObject<{
|
|
137
|
-
seats: z.ZodOptional<z.ZodNumber>;
|
|
138
|
-
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
seats?: number | undefined;
|
|
140
|
-
}, {
|
|
141
|
-
seats?: number | undefined;
|
|
142
|
-
}>>;
|
|
143
|
-
humanConfirmed: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
-
confirmPhrase: z.ZodOptional<z.ZodString>;
|
|
145
|
-
dryRunToken: z.ZodOptional<z.ZodString>;
|
|
146
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
74
|
+
dryRunId: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, "dryRunId">, "passthrough", z.ZodTypeAny, z.objectOutputType<Omit<{
|
|
147
76
|
name: z.ZodString;
|
|
148
77
|
ticker: z.ZodString;
|
|
149
78
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -157,10 +86,8 @@ export declare const CrewPayPlugin: {
|
|
|
157
86
|
}, {
|
|
158
87
|
seats?: number | undefined;
|
|
159
88
|
}>>;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
dryRunToken: z.ZodOptional<z.ZodString>;
|
|
163
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
89
|
+
dryRunId: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "dryRunId">, z.ZodTypeAny, "passthrough">, z.objectInputType<Omit<{
|
|
164
91
|
name: z.ZodString;
|
|
165
92
|
ticker: z.ZodString;
|
|
166
93
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -174,10 +101,8 @@ export declare const CrewPayPlugin: {
|
|
|
174
101
|
}, {
|
|
175
102
|
seats?: number | undefined;
|
|
176
103
|
}>>;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
dryRunToken: z.ZodOptional<z.ZodString>;
|
|
180
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
104
|
+
dryRunId: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, "dryRunId">, z.ZodTypeAny, "passthrough">>;
|
|
181
106
|
handler: (_agent: unknown, input: Record<string, unknown>) => Promise<{
|
|
182
107
|
status: string;
|
|
183
108
|
data: unknown;
|
|
@@ -189,24 +114,20 @@ export declare const CrewPayPlugin: {
|
|
|
189
114
|
schema: z.ZodObject<{
|
|
190
115
|
mint: z.ZodString;
|
|
191
116
|
mode: z.ZodOptional<z.ZodString>;
|
|
192
|
-
|
|
193
|
-
confirmPhrase: z.ZodString;
|
|
117
|
+
dryRunId: z.ZodOptional<z.ZodString>;
|
|
194
118
|
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
humanConfirmed: boolean;
|
|
196
|
-
confirmPhrase: string;
|
|
197
119
|
mint: string;
|
|
198
120
|
mode?: string | undefined;
|
|
121
|
+
dryRunId?: string | undefined;
|
|
199
122
|
}, {
|
|
200
|
-
humanConfirmed: boolean;
|
|
201
|
-
confirmPhrase: string;
|
|
202
123
|
mint: string;
|
|
203
124
|
mode?: string | undefined;
|
|
125
|
+
dryRunId?: string | undefined;
|
|
204
126
|
}>;
|
|
205
127
|
handler: (_agent: unknown, input: {
|
|
206
128
|
mint: string;
|
|
207
129
|
mode?: string;
|
|
208
|
-
|
|
209
|
-
confirmPhrase: string;
|
|
130
|
+
dryRunId: string;
|
|
210
131
|
}) => Promise<{
|
|
211
132
|
status: string;
|
|
212
133
|
data: unknown;
|
|
@@ -229,6 +150,5 @@ export declare const CrewPayPlugin: {
|
|
|
229
150
|
data: unknown;
|
|
230
151
|
}>;
|
|
231
152
|
})[];
|
|
232
|
-
initialize(): void;
|
|
233
153
|
};
|
|
234
154
|
export default CrewPayPlugin;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Docs: https://docs.sendai.fun/docs/v2/setup/quickstart
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { CrewPayClient, loadCrewPayEnv
|
|
6
|
+
import { CrewPayClient, loadCrewPayEnv } from './client.js';
|
|
7
7
|
const launchBodySchema = z
|
|
8
8
|
.object({
|
|
9
9
|
name: z.string().min(2).max(32),
|
|
@@ -13,16 +13,14 @@ const launchBodySchema = z
|
|
|
13
13
|
initialBuySol: z.number().min(0).max(10).optional(),
|
|
14
14
|
imageUrl: z.string().url().optional(),
|
|
15
15
|
autoHire: z.object({ seats: z.number().int().min(1).max(10).optional() }).optional(),
|
|
16
|
-
|
|
17
|
-
confirmPhrase: z.string().optional(),
|
|
18
|
-
dryRunToken: z.string().optional(),
|
|
16
|
+
dryRunId: z.string().optional(),
|
|
19
17
|
})
|
|
20
18
|
.passthrough();
|
|
21
19
|
function api() {
|
|
22
20
|
return new CrewPayClient(loadCrewPayEnv());
|
|
23
21
|
}
|
|
24
22
|
function stripGateFields(body) {
|
|
25
|
-
const { humanConfirmed: _h, confirmPhrase: _c, dryRunToken:
|
|
23
|
+
const { dryRunId: _d, humanConfirmed: _h, confirmPhrase: _c, dryRunToken: _t, ...rest } = body;
|
|
26
24
|
return rest;
|
|
27
25
|
}
|
|
28
26
|
export const CrewPayPlugin = {
|
|
@@ -34,15 +32,10 @@ export const CrewPayPlugin = {
|
|
|
34
32
|
crewLaunch: async (_agent, body) => {
|
|
35
33
|
const parsed = launchBodySchema.parse(body);
|
|
36
34
|
return api().launch(stripGateFields(parsed), {
|
|
37
|
-
|
|
38
|
-
confirmPhrase: parsed.confirmPhrase || '',
|
|
39
|
-
dryRunToken: parsed.dryRunToken || '',
|
|
35
|
+
dryRunId: parsed.dryRunId || '',
|
|
40
36
|
});
|
|
41
37
|
},
|
|
42
|
-
crewWireFees: async (_agent, body) => api().wireFees({ mint: body.mint, mode: body.mode }, {
|
|
43
|
-
humanConfirmed: body.humanConfirmed === true,
|
|
44
|
-
confirmPhrase: body.confirmPhrase || '',
|
|
45
|
-
}),
|
|
38
|
+
crewWireFees: async (_agent, body) => api().wireFees({ mint: body.mint, mode: body.mode }, { dryRunId: body.dryRunId || '' }),
|
|
46
39
|
crewCrank: async (_agent, body) => api().crank(body),
|
|
47
40
|
crewProof: async () => api().proof(),
|
|
48
41
|
},
|
|
@@ -72,8 +65,8 @@ export const CrewPayPlugin = {
|
|
|
72
65
|
{
|
|
73
66
|
name: 'CREW_LAUNCH_DRY_RUN',
|
|
74
67
|
similes: ['crew dry run', 'dry-run launch'],
|
|
75
|
-
description: 'Dry-run launch — returns
|
|
76
|
-
schema: launchBodySchema.omit({
|
|
68
|
+
description: 'Dry-run launch — returns dryRunId + approvalUrl required for CREW_LAUNCH',
|
|
69
|
+
schema: launchBodySchema.omit({ dryRunId: true }),
|
|
77
70
|
handler: async (_agent, input) => ({
|
|
78
71
|
status: 'success',
|
|
79
72
|
data: await api().dryRun(input),
|
|
@@ -82,16 +75,14 @@ export const CrewPayPlugin = {
|
|
|
82
75
|
{
|
|
83
76
|
name: 'CREW_LAUNCH',
|
|
84
77
|
similes: ['crew launch', 'launch pump coin'],
|
|
85
|
-
description:
|
|
78
|
+
description: 'Mainnet launch. Approval is optional. Operators can require human approval per key. Fee map 60/15/25; buyback not live.',
|
|
86
79
|
schema: launchBodySchema,
|
|
87
80
|
handler: async (_agent, input) => {
|
|
88
81
|
const parsed = launchBodySchema.parse(input);
|
|
89
82
|
return {
|
|
90
83
|
status: 'success',
|
|
91
84
|
data: await api().launch(stripGateFields(parsed), {
|
|
92
|
-
|
|
93
|
-
confirmPhrase: parsed.confirmPhrase || '',
|
|
94
|
-
dryRunToken: parsed.dryRunToken || '',
|
|
85
|
+
dryRunId: parsed.dryRunId || '',
|
|
95
86
|
}),
|
|
96
87
|
};
|
|
97
88
|
},
|
|
@@ -99,16 +90,15 @@ export const CrewPayPlugin = {
|
|
|
99
90
|
{
|
|
100
91
|
name: 'CREW_WIRE_FEES',
|
|
101
92
|
similes: ['wire fees', 'lock fee shares'],
|
|
102
|
-
description:
|
|
93
|
+
description: 'Wire fee-shares (SOL). dryRunId optional unless requireApproval is on.',
|
|
103
94
|
schema: z.object({
|
|
104
95
|
mint: z.string(),
|
|
105
96
|
mode: z.string().optional(),
|
|
106
|
-
|
|
107
|
-
confirmPhrase: z.string(),
|
|
97
|
+
dryRunId: z.string().optional(),
|
|
108
98
|
}),
|
|
109
99
|
handler: async (_agent, input) => ({
|
|
110
100
|
status: 'success',
|
|
111
|
-
data: await api().wireFees({ mint: input.mint, mode: input.mode }, {
|
|
101
|
+
data: await api().wireFees({ mint: input.mint, mode: input.mode }, { dryRunId: input.dryRunId }),
|
|
112
102
|
}),
|
|
113
103
|
},
|
|
114
104
|
{
|
|
@@ -129,6 +119,5 @@ export const CrewPayPlugin = {
|
|
|
129
119
|
handler: async () => ({ status: 'success', data: await api().proof() }),
|
|
130
120
|
},
|
|
131
121
|
],
|
|
132
|
-
initialize() { },
|
|
133
122
|
};
|
|
134
123
|
export default CrewPayPlugin;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crewpay-solana-agent-kit-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Solana Agent Kit plugin for CrewPay
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Solana Agent Kit plugin for CrewPay \u2014 discover/autohire/dry-run/launch/wire/crank/proof. Fee map 60/15/25; buyback not live; dryRunId after approvalUrl required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tsc -p tsconfig.json"
|
|
21
|
-
"prepublishOnly": "npm run build"
|
|
20
|
+
"build": "tsc -p tsconfig.json"
|
|
22
21
|
},
|
|
23
22
|
"keywords": [
|
|
24
23
|
"solana-agent-kit",
|
|
@@ -48,5 +47,6 @@
|
|
|
48
47
|
},
|
|
49
48
|
"publishConfig": {
|
|
50
49
|
"access": "public"
|
|
51
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"private": false
|
|
52
52
|
}
|