cyberdyne-mcp 0.6.8 → 0.6.9
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/cli.js +2 -2
- package/dist/evm-signer.js +4 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/src/cli.ts +3 -3
- package/src/evm-signer.ts +8 -2
- package/src/server.ts +2 -2
package/dist/cli.js
CHANGED
|
@@ -133,8 +133,8 @@ export async function runPost(argv) {
|
|
|
133
133
|
console.error("→ signing the budget authorization…");
|
|
134
134
|
const signedPayment = await signAuthCapture(requirements);
|
|
135
135
|
const fee = res.deployFee;
|
|
136
|
-
console.error(`→ paying the deploy fee (${
|
|
137
|
-
const feeTx = await payDeployFee({
|
|
136
|
+
console.error(`→ paying the deploy fee (${fee.amount} ${fee.token} ≈ ${usd(fee.usd)}) from your wallet…`);
|
|
137
|
+
const feeTx = await payDeployFee({ amount: fee.amount, decimals: fee.decimals, recipient: fee.recipient, token: fee.token });
|
|
138
138
|
console.error(` ✓ fee paid — ${feeTx}`);
|
|
139
139
|
console.error("→ freezing the budget (authorize)…");
|
|
140
140
|
const authed = await c.rest("POST", `/api/tasks/${taskId}/authorize`, { body: { signedPayment, fee_tx_hash: feeTx } });
|
package/dist/evm-signer.js
CHANGED
|
@@ -55,11 +55,14 @@ const ERC20_TRANSFER_ABI = [
|
|
|
55
55
|
*/
|
|
56
56
|
export async function payDeployFee(params) {
|
|
57
57
|
const wallet = createWalletClient({ account: account(), chain: chain(), transport: http(process.env.CYBERDYNE_RPC_URL) });
|
|
58
|
+
// Scale by the TOKEN's decimals, not a hardcoded 6. Using 6 for an 18-decimal
|
|
59
|
+
// token (BNKR/GITLAWB) underpaid the fee 10^12× → permanent fee_unverified.
|
|
60
|
+
const value = parseUnits(params.amount.toFixed(params.decimals), params.decimals);
|
|
58
61
|
const hash = await wallet.writeContract({
|
|
59
62
|
address: params.token,
|
|
60
63
|
abi: ERC20_TRANSFER_ABI,
|
|
61
64
|
functionName: "transfer",
|
|
62
|
-
args: [params.recipient,
|
|
65
|
+
args: [params.recipient, value],
|
|
63
66
|
chain: chain(),
|
|
64
67
|
});
|
|
65
68
|
// Wait until the fee tx is ≥1 block deep BEFORE returning, so the platform's
|
package/dist/server.js
CHANGED
|
@@ -209,7 +209,7 @@ server.tool("authorize_task", "Freeze the bounty budget on-chain (the second ste
|
|
|
209
209
|
}
|
|
210
210
|
if (!feeTx && deploy_fee) {
|
|
211
211
|
const f = deploy_fee;
|
|
212
|
-
feeTx = await payDeployFee({
|
|
212
|
+
feeTx = await payDeployFee({ amount: f.amount, decimals: f.decimals, recipient: f.recipient, token: f.token });
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -125,7 +125,7 @@ export async function runPost(argv: string[]): Promise<void> {
|
|
|
125
125
|
const res = await c.rest<{
|
|
126
126
|
task: { id: string; escrow_status?: string };
|
|
127
127
|
authIntent?: { requirements?: unknown };
|
|
128
|
-
deployFee?: { usd: number; recipient: string; token: string };
|
|
128
|
+
deployFee?: { amount: number; decimals: number; usd: number; recipient: string; token: string };
|
|
129
129
|
}>("POST", "/api/tasks", { body });
|
|
130
130
|
const taskId = res.task?.id;
|
|
131
131
|
console.error(` ✓ posted — task ${taskId}`);
|
|
@@ -155,8 +155,8 @@ export async function runPost(argv: string[]): Promise<void> {
|
|
|
155
155
|
const signedPayment = await signAuthCapture(requirements);
|
|
156
156
|
|
|
157
157
|
const fee = res.deployFee;
|
|
158
|
-
console.error(`→ paying the deploy fee (${
|
|
159
|
-
const feeTx = await payDeployFee({
|
|
158
|
+
console.error(`→ paying the deploy fee (${fee.amount} ${fee.token} ≈ ${usd(fee.usd)}) from your wallet…`);
|
|
159
|
+
const feeTx = await payDeployFee({ amount: fee.amount, decimals: fee.decimals, recipient: fee.recipient, token: fee.token });
|
|
160
160
|
console.error(` ✓ fee paid — ${feeTx}`);
|
|
161
161
|
|
|
162
162
|
console.error("→ freezing the budget (authorize)…");
|
package/src/evm-signer.ts
CHANGED
|
@@ -57,16 +57,22 @@ const ERC20_TRANSFER_ABI = [
|
|
|
57
57
|
* this gas (CYBERDYNE absorbs none). USDC is 6-dp (v1 pool settles in USDC).
|
|
58
58
|
*/
|
|
59
59
|
export async function payDeployFee(params: {
|
|
60
|
-
|
|
60
|
+
/** Fee in the FEE TOKEN's own units (NOT USD). The platform pins this at post. */
|
|
61
|
+
amount: number;
|
|
62
|
+
/** The fee token's ERC-20 decimals (USDC=6, BNKR/GITLAWB=18, dynamic varies). */
|
|
63
|
+
decimals: number;
|
|
61
64
|
recipient: string;
|
|
62
65
|
token: string;
|
|
63
66
|
}): Promise<string> {
|
|
64
67
|
const wallet = createWalletClient({ account: account(), chain: chain(), transport: http(process.env.CYBERDYNE_RPC_URL) });
|
|
68
|
+
// Scale by the TOKEN's decimals, not a hardcoded 6. Using 6 for an 18-decimal
|
|
69
|
+
// token (BNKR/GITLAWB) underpaid the fee 10^12× → permanent fee_unverified.
|
|
70
|
+
const value = parseUnits(params.amount.toFixed(params.decimals), params.decimals);
|
|
65
71
|
const hash = await wallet.writeContract({
|
|
66
72
|
address: params.token as `0x${string}`,
|
|
67
73
|
abi: ERC20_TRANSFER_ABI,
|
|
68
74
|
functionName: "transfer",
|
|
69
|
-
args: [params.recipient as `0x${string}`,
|
|
75
|
+
args: [params.recipient as `0x${string}`, value],
|
|
70
76
|
chain: chain(),
|
|
71
77
|
});
|
|
72
78
|
// Wait until the fee tx is ≥1 block deep BEFORE returning, so the platform's
|
package/src/server.ts
CHANGED
|
@@ -254,8 +254,8 @@ server.tool(
|
|
|
254
254
|
payload = await signAuthCapture(requirements);
|
|
255
255
|
}
|
|
256
256
|
if (!feeTx && deploy_fee) {
|
|
257
|
-
const f = deploy_fee as { usd: number; recipient: string; token: string };
|
|
258
|
-
feeTx = await payDeployFee({
|
|
257
|
+
const f = deploy_fee as { amount: number; decimals: number; usd: number; recipient: string; token: string };
|
|
258
|
+
feeTx = await payDeployFee({ amount: f.amount, decimals: f.decimals, recipient: f.recipient, token: f.token });
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
}
|