clawntenna 0.12.7 → 0.12.8
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/{chunk-T4XLWYPQ.js → chunk-AIISNOCB.js} +2 -2
- package/dist/cli/{chunk-QENCMD4F.js → chunk-AK26RTP5.js} +1 -1
- package/dist/cli/{chunk-7CKZWKH5.js → chunk-AQHFWEZF.js} +18 -3
- package/dist/cli/index.js +55 -16
- package/dist/cli/{skill-NMABLUB5.js → skill-HV2NNR3H.js} +2 -2
- package/dist/cli/{state-W5B24KOL.js → state-73B57RGU.js} +2 -2
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/heartbeat.md +2 -2
- package/package.json +1 -1
- package/skill.json +1 -1
- package/skill.md +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
CONFIG_DIR,
|
|
4
4
|
loadCredentials,
|
|
5
5
|
output
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AQHFWEZF.js";
|
|
7
7
|
|
|
8
8
|
// src/cli/state.ts
|
|
9
9
|
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
@@ -21,7 +21,7 @@ function initState(address) {
|
|
|
21
21
|
startedAt: now,
|
|
22
22
|
lastScanAt: now,
|
|
23
23
|
mode: "active",
|
|
24
|
-
skillVersion: "0.12.
|
|
24
|
+
skillVersion: "0.12.8",
|
|
25
25
|
lastSkillCheck: now
|
|
26
26
|
},
|
|
27
27
|
chains: {
|
|
@@ -4446,6 +4446,16 @@ var Clawntenna = class _Clawntenna {
|
|
|
4446
4446
|
this.ecdhPrivateKey = privateKey;
|
|
4447
4447
|
this.ecdhPublicKey = publicKey;
|
|
4448
4448
|
}
|
|
4449
|
+
/**
|
|
4450
|
+
* Export loaded ECDH keypair as hex strings for credential persistence.
|
|
4451
|
+
*/
|
|
4452
|
+
getECDHKeypairHex() {
|
|
4453
|
+
if (!this.ecdhPrivateKey || !this.ecdhPublicKey) return null;
|
|
4454
|
+
return {
|
|
4455
|
+
privateKey: ethers.hexlify(this.ecdhPrivateKey),
|
|
4456
|
+
publicKey: ethers.hexlify(this.ecdhPublicKey)
|
|
4457
|
+
};
|
|
4458
|
+
}
|
|
4449
4459
|
/**
|
|
4450
4460
|
* Register ECDH public key on-chain.
|
|
4451
4461
|
*/
|
|
@@ -4996,8 +5006,8 @@ function validateKeyAddress(creds) {
|
|
|
4996
5006
|
}
|
|
4997
5007
|
}
|
|
4998
5008
|
async function runPostInit(address) {
|
|
4999
|
-
const { initState } = await import("./state-
|
|
5000
|
-
const { copySkillFiles } = await import("./skill-
|
|
5009
|
+
const { initState } = await import("./state-73B57RGU.js");
|
|
5010
|
+
const { copySkillFiles } = await import("./skill-HV2NNR3H.js");
|
|
5001
5011
|
const stateResult = initState(address);
|
|
5002
5012
|
const skillResult = copySkillFiles();
|
|
5003
5013
|
return { stateResult, skillResult };
|
|
@@ -5139,6 +5149,10 @@ function loadCredentials() {
|
|
|
5139
5149
|
}
|
|
5140
5150
|
return null;
|
|
5141
5151
|
}
|
|
5152
|
+
function saveCredentials(credentials) {
|
|
5153
|
+
mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
|
|
5154
|
+
writeFileSync(CREDS_PATH, JSON.stringify(credentials, null, 2), { mode: 384 });
|
|
5155
|
+
}
|
|
5142
5156
|
|
|
5143
5157
|
// src/cli/util.ts
|
|
5144
5158
|
function parseCommonFlags(flags) {
|
|
@@ -5204,7 +5218,8 @@ export {
|
|
|
5204
5218
|
chainIdForCredentials,
|
|
5205
5219
|
CONFIG_DIR,
|
|
5206
5220
|
init,
|
|
5207
|
-
loadCredentials
|
|
5221
|
+
loadCredentials,
|
|
5222
|
+
saveCredentials
|
|
5208
5223
|
};
|
|
5209
5224
|
/*! Bundled license information:
|
|
5210
5225
|
|
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
stateInit
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AIISNOCB.js";
|
|
5
5
|
import {
|
|
6
6
|
showHeartbeat,
|
|
7
7
|
showSkill,
|
|
8
8
|
showSkillJson
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AK26RTP5.js";
|
|
10
10
|
import {
|
|
11
11
|
REGISTRY_ABI,
|
|
12
12
|
chainIdForCredentials,
|
|
@@ -15,8 +15,9 @@ import {
|
|
|
15
15
|
loadCredentials,
|
|
16
16
|
output,
|
|
17
17
|
outputError,
|
|
18
|
-
parseCommonFlags
|
|
19
|
-
|
|
18
|
+
parseCommonFlags,
|
|
19
|
+
saveCredentials
|
|
20
|
+
} from "./chunk-AQHFWEZF.js";
|
|
20
21
|
|
|
21
22
|
// src/cli/send.ts
|
|
22
23
|
async function send(topicId, message, flags) {
|
|
@@ -170,11 +171,14 @@ async function whoami(appId, flags) {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
const creds = loadCredentials();
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
const chainId = chainIdForCredentials(flags.chain);
|
|
175
|
+
const chainCreds = creds?.chains[chainId];
|
|
176
|
+
const [ecdhRegistered, ecdhStored] = await Promise.all([
|
|
177
|
+
client.hasPublicKey(address).catch(() => false),
|
|
178
|
+
Promise.resolve(Boolean(chainCreds?.ecdh?.privateKey))
|
|
179
|
+
]);
|
|
180
|
+
result.ecdhRegistered = ecdhRegistered;
|
|
181
|
+
result.ecdhStored = ecdhStored;
|
|
178
182
|
if (json) {
|
|
179
183
|
output(result, true);
|
|
180
184
|
} else {
|
|
@@ -187,7 +191,9 @@ async function whoami(appId, flags) {
|
|
|
187
191
|
console.log(`Member: ${result.isMember}`);
|
|
188
192
|
console.log(`Agent: ${result.hasAgentIdentity}${result.agentTokenId ? ` (token #${result.agentTokenId})` : ""}`);
|
|
189
193
|
}
|
|
190
|
-
|
|
194
|
+
const ecdhStatus = result.ecdhRegistered ? "registered on-chain" : "not registered";
|
|
195
|
+
const ecdhStorage = result.ecdhStored ? "stored locally" : "not stored locally";
|
|
196
|
+
console.log(`ECDH: ${ecdhStatus} (${ecdhStorage})`);
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
|
|
@@ -793,13 +799,46 @@ async function keysRegister(flags) {
|
|
|
793
799
|
await client.deriveECDHFromWallet();
|
|
794
800
|
}
|
|
795
801
|
if (!json) console.log("Registering ECDH public key on-chain...");
|
|
796
|
-
|
|
797
|
-
|
|
802
|
+
let txHash = null;
|
|
803
|
+
let blockNumber;
|
|
804
|
+
let registeredOnChain = false;
|
|
805
|
+
try {
|
|
806
|
+
const tx = await client.registerPublicKey();
|
|
807
|
+
const receipt = await tx.wait();
|
|
808
|
+
txHash = tx.hash;
|
|
809
|
+
blockNumber = receipt?.blockNumber;
|
|
810
|
+
registeredOnChain = true;
|
|
811
|
+
} catch (error) {
|
|
812
|
+
if (!(error instanceof Error) || !error.message.includes("Public key already registered on-chain")) {
|
|
813
|
+
throw error;
|
|
814
|
+
}
|
|
815
|
+
registeredOnChain = true;
|
|
816
|
+
}
|
|
817
|
+
const keypair = client.getECDHKeypairHex();
|
|
818
|
+
if (creds && keypair) {
|
|
819
|
+
if (!creds.chains[chainId]) {
|
|
820
|
+
creds.chains[chainId] = {
|
|
821
|
+
name: flags.chain,
|
|
822
|
+
ecdh: null,
|
|
823
|
+
apps: {}
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
creds.chains[chainId].ecdh = {
|
|
827
|
+
privateKey: keypair.privateKey,
|
|
828
|
+
publicKey: keypair.publicKey,
|
|
829
|
+
registered: registeredOnChain
|
|
830
|
+
};
|
|
831
|
+
saveCredentials(creds);
|
|
832
|
+
}
|
|
798
833
|
if (json) {
|
|
799
|
-
output({ txHash
|
|
834
|
+
output({ txHash, blockNumber, chain: flags.chain, registered: registeredOnChain }, true);
|
|
800
835
|
} else {
|
|
801
|
-
|
|
802
|
-
|
|
836
|
+
if (txHash) {
|
|
837
|
+
console.log(`TX: ${txHash}`);
|
|
838
|
+
console.log(`Confirmed in block ${blockNumber}`);
|
|
839
|
+
} else {
|
|
840
|
+
console.log("ECDH public key was already registered on-chain.");
|
|
841
|
+
}
|
|
803
842
|
}
|
|
804
843
|
}
|
|
805
844
|
async function keysCheck(address, flags) {
|
|
@@ -1372,7 +1411,7 @@ async function resolveTopicId(client, {
|
|
|
1372
1411
|
}
|
|
1373
1412
|
|
|
1374
1413
|
// src/cli/index.ts
|
|
1375
|
-
var VERSION = "0.12.
|
|
1414
|
+
var VERSION = "0.12.8";
|
|
1376
1415
|
var HELP = `
|
|
1377
1416
|
clawntenna v${VERSION}
|
|
1378
1417
|
Encrypted on-chain coordination for wallets, apps, and agents
|
package/dist/index.cjs
CHANGED
|
@@ -1647,6 +1647,16 @@ var Clawntenna = class _Clawntenna {
|
|
|
1647
1647
|
this.ecdhPrivateKey = privateKey;
|
|
1648
1648
|
this.ecdhPublicKey = publicKey;
|
|
1649
1649
|
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Export loaded ECDH keypair as hex strings for credential persistence.
|
|
1652
|
+
*/
|
|
1653
|
+
getECDHKeypairHex() {
|
|
1654
|
+
if (!this.ecdhPrivateKey || !this.ecdhPublicKey) return null;
|
|
1655
|
+
return {
|
|
1656
|
+
privateKey: import_ethers.ethers.hexlify(this.ecdhPrivateKey),
|
|
1657
|
+
publicKey: import_ethers.ethers.hexlify(this.ecdhPublicKey)
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1650
1660
|
/**
|
|
1651
1661
|
* Register ECDH public key on-chain.
|
|
1652
1662
|
*/
|