@telaro/erc8004-bridge 0.1.0

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 ADDED
@@ -0,0 +1,100 @@
1
+ # @telaro/erc8004-bridge
2
+
3
+ JavaScript SDK for the Telaro ERC-8004 bridge. Decode Wormhole payloads
4
+ published by the Telaro Solana program, encode `receivePublish` calldata
5
+ for the `TelaroErc8004Receiver` Solidity contract on EVM, and derive the
6
+ canonical Solana emitter address that anchors the trust path.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pnpm add @telaro/erc8004-bridge @solana/web3.js
12
+ # optional, only if you use encodeReceivePublishCalldata
13
+ pnpm add viem
14
+ ```
15
+
16
+ ## What this does
17
+
18
+ The Telaro Solana program (`programs/telaro/src/instructions/register_to_erc8004.rs`)
19
+ publishes a Wormhole message every time an agent registers or updates
20
+ its on-chain score. The receiver contract on Base
21
+ (`packages/erc8004-bridge/evm/src/TelaroErc8004Receiver.sol`) verifies
22
+ the VAA, mints or updates the corresponding ERC-8004 IdentityRegistry
23
+ entry, and writes a `bonded` feedback into the ReputationRegistry.
24
+
25
+ This SDK lets external relayers and indexers talk to that pipeline
26
+ without forking the contract code.
27
+
28
+ ## Surface
29
+
30
+ ```ts
31
+ import {
32
+ // emitter derivation
33
+ findEmitterPda,
34
+ pubkeyToBytes32,
35
+
36
+ // payload codec
37
+ encodePublishPayload,
38
+ decodePublishPayload,
39
+ type PublishPayload,
40
+
41
+ // calldata builder
42
+ encodeReceivePublishCalldata,
43
+
44
+ // ABI fragments for event filters
45
+ RECEIVER_ABI_FRAGMENTS,
46
+ } from "@telaro/erc8004-bridge";
47
+ ```
48
+
49
+ ### Derive the emitter address
50
+
51
+ ```ts
52
+ import { PublicKey } from "@solana/web3.js";
53
+ import { findEmitterPda, pubkeyToBytes32 } from "@telaro/erc8004-bridge";
54
+
55
+ const TELARO_PROGRAM = new PublicKey("3DUrvVWEziYLtEbiDtfxqh1ioXRFX6DNvV4iTsGed2rs");
56
+ const [emitter] = findEmitterPda(TELARO_PROGRAM);
57
+ console.log("solanaEmitter:", pubkeyToBytes32(emitter));
58
+ ```
59
+
60
+ ### Decode a VAA payload
61
+
62
+ ```ts
63
+ import { decodePublishPayload } from "@telaro/erc8004-bridge";
64
+
65
+ const decoded = decodePublishPayload(vaaPayloadBytes);
66
+ console.log("agent:", decoded.agentPda);
67
+ console.log("score:", decoded.score);
68
+ console.log("bond:", decoded.bondAtomic.toString());
69
+ console.log("uri:", decoded.agentUri);
70
+ ```
71
+
72
+ ### Submit a VAA to the receiver
73
+
74
+ ```ts
75
+ import { encodeReceivePublishCalldata } from "@telaro/erc8004-bridge";
76
+
77
+ const data = await encodeReceivePublishCalldata(encodedVm);
78
+ await wallet.sendTransaction({
79
+ to: TELARO_RECEIVER_ADDRESS,
80
+ data,
81
+ value: 0n,
82
+ });
83
+ ```
84
+
85
+ ## Payload layout
86
+
87
+ The bytes the Solana program emits inside the Wormhole VAA payload:
88
+
89
+ | Offset | Size | Field |
90
+ |---|---|---|
91
+ | 0 | 1 | version u8 |
92
+ | 1 | 32 | agent_pda bytes32 |
93
+ | 33 | 20 | evm_address |
94
+ | 53 | 2 | score u16 BE |
95
+ | 55 | 8 | bond_atomic u64 BE |
96
+ | 63 | 4 | agent_uri_len u32 BE |
97
+ | 67 | N | agent_uri utf-8 |
98
+
99
+ Total: 67 + N bytes. The encode + decode helpers in this package are
100
+ the JS mirror of `_decodePayload` in `TelaroErc8004Receiver.sol`.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @telaro/erc8004-bridge — JavaScript SDK for the Solana → EVM
3
+ * ERC-8004 bridge.
4
+ *
5
+ * What this SDK gives you:
6
+ *
7
+ * 1. Decode the canonical Telaro publish payload (the bytes inside
8
+ * the Wormhole VAA emitted by the Solana program's
9
+ * `register_to_erc8004` instruction). Reverse of the Solidity
10
+ * `_decodePayload` in TelaroErc8004Receiver.
11
+ * 2. Encode a payload from the JS side (for testing the receiver or
12
+ * for an alternative emitter that publishes the same shape).
13
+ * 3. Encode a `receivePublish(bytes encodedVm)` calldata so any
14
+ * EVM relayer / Safe / Squads can submit the VAA without
15
+ * hand-rolling viem.
16
+ * 4. Derive the Solana emitter pubkey (PDA `["emitter"]` under the
17
+ * Telaro program id).
18
+ *
19
+ * What this SDK does NOT do:
20
+ *
21
+ * - Fetch the VAA from a Wormhole guardian. Use Wormhole SDK or a
22
+ * guardian RPC for that.
23
+ * - Sign or submit the transaction. Wire that up with viem,
24
+ * ethers, or your preferred EVM client. The SDK gives you the
25
+ * calldata.
26
+ */
27
+ import { PublicKey } from "@solana/web3.js";
28
+ export declare const EMITTER_SEED = "emitter";
29
+ /** Canonical payload version byte that the Solana program publishes. */
30
+ export declare const PAYLOAD_VERSION = 1;
31
+ /**
32
+ * Derive the Solana emitter PDA used by the Telaro program when posting
33
+ * Wormhole messages. The Solidity receiver pins this as `solanaEmitter`
34
+ * (a bytes32). Use this helper to compute the matching value before
35
+ * deploying the receiver.
36
+ */
37
+ export declare function findEmitterPda(programId: PublicKey): [PublicKey, number];
38
+ /** Encode a Solana pubkey as `bytes32` for Solidity contract args. */
39
+ export declare function pubkeyToBytes32(pubkey: PublicKey): string;
40
+ export interface PublishPayload {
41
+ /** Should be 1. Versioned in case the layout changes. */
42
+ version: number;
43
+ /** 32-byte agent PDA on Solana. */
44
+ agentPda: Uint8Array;
45
+ /** 20-byte EVM address. Lowercase hex starting with 0x. */
46
+ evmAddress: string;
47
+ /** 0..1000 score. */
48
+ score: number;
49
+ /** Bond in atomic units. */
50
+ bondAtomic: bigint;
51
+ /** Free-form metadata URI. */
52
+ agentUri: string;
53
+ }
54
+ /**
55
+ * Encode a publish payload into the wire bytes the Solana program emits.
56
+ *
57
+ * Layout (matches `TelaroErc8004Receiver._decodePayload`):
58
+ * 1 version u8
59
+ * 32 agent_pda bytes32
60
+ * 20 evm_address address
61
+ * 2 score u16 BE
62
+ * 8 bond_atomic u64 BE
63
+ * 4 agent_uri_len u32 BE
64
+ * N agent_uri utf-8
65
+ */
66
+ export declare function encodePublishPayload(p: PublishPayload): Uint8Array;
67
+ /** Reverse of `encodePublishPayload`. */
68
+ export declare function decodePublishPayload(payload: Uint8Array): PublishPayload;
69
+ /**
70
+ * Encode a `receivePublish(bytes encodedVm)` call for
71
+ * `TelaroErc8004Receiver`. Returns hex calldata ready to attach to a
72
+ * transaction. viem (peer dep) is lazy-loaded so importing the SDK
73
+ * doesn't drag it in unless you call this.
74
+ */
75
+ export declare function encodeReceivePublishCalldata(encodedVm: Uint8Array): Promise<`0x${string}`>;
76
+ export declare const RECEIVER_ABI_FRAGMENTS: readonly ["function receivePublish(bytes encodedVm)", "function agentIdOf(bytes32 agentPda) view returns (uint256)", "function consumedVm(bytes32 vmHash) view returns (bool)", "event AgentRegistered(uint256 indexed agentId, bytes32 indexed agentPda, address indexed evmAddress, uint16 score, uint64 bondAtomic)", "event AgentRepublished(uint256 indexed agentId, bytes32 indexed agentPda, uint16 score, uint64 bondAtomic)"];
77
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,wEAAwE;AACxE,eAAO,MAAM,eAAe,IAAI,CAAC;AAIjC;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAKxE;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEzD;AAID,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,QAAQ,EAAE,UAAU,CAAC;IACrB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,cAAc,GAAG,UAAU,CAoClE;AAED,yCAAyC;AACzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,cAAc,CA0BxE;AAID;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CASxB;AAED,eAAO,MAAM,sBAAsB,waAMzB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @telaro/erc8004-bridge — JavaScript SDK for the Solana → EVM
3
+ * ERC-8004 bridge.
4
+ *
5
+ * What this SDK gives you:
6
+ *
7
+ * 1. Decode the canonical Telaro publish payload (the bytes inside
8
+ * the Wormhole VAA emitted by the Solana program's
9
+ * `register_to_erc8004` instruction). Reverse of the Solidity
10
+ * `_decodePayload` in TelaroErc8004Receiver.
11
+ * 2. Encode a payload from the JS side (for testing the receiver or
12
+ * for an alternative emitter that publishes the same shape).
13
+ * 3. Encode a `receivePublish(bytes encodedVm)` calldata so any
14
+ * EVM relayer / Safe / Squads can submit the VAA without
15
+ * hand-rolling viem.
16
+ * 4. Derive the Solana emitter pubkey (PDA `["emitter"]` under the
17
+ * Telaro program id).
18
+ *
19
+ * What this SDK does NOT do:
20
+ *
21
+ * - Fetch the VAA from a Wormhole guardian. Use Wormhole SDK or a
22
+ * guardian RPC for that.
23
+ * - Sign or submit the transaction. Wire that up with viem,
24
+ * ethers, or your preferred EVM client. The SDK gives you the
25
+ * calldata.
26
+ */
27
+ import { PublicKey } from "@solana/web3.js";
28
+ // ─────────────────────── constants ──────────────────────────────────
29
+ export const EMITTER_SEED = "emitter";
30
+ /** Canonical payload version byte that the Solana program publishes. */
31
+ export const PAYLOAD_VERSION = 1;
32
+ // ─────────────────────── derivation ─────────────────────────────────
33
+ /**
34
+ * Derive the Solana emitter PDA used by the Telaro program when posting
35
+ * Wormhole messages. The Solidity receiver pins this as `solanaEmitter`
36
+ * (a bytes32). Use this helper to compute the matching value before
37
+ * deploying the receiver.
38
+ */
39
+ export function findEmitterPda(programId) {
40
+ return PublicKey.findProgramAddressSync([Buffer.from(EMITTER_SEED)], programId);
41
+ }
42
+ /** Encode a Solana pubkey as `bytes32` for Solidity contract args. */
43
+ export function pubkeyToBytes32(pubkey) {
44
+ return "0x" + Buffer.from(pubkey.toBytes()).toString("hex");
45
+ }
46
+ /**
47
+ * Encode a publish payload into the wire bytes the Solana program emits.
48
+ *
49
+ * Layout (matches `TelaroErc8004Receiver._decodePayload`):
50
+ * 1 version u8
51
+ * 32 agent_pda bytes32
52
+ * 20 evm_address address
53
+ * 2 score u16 BE
54
+ * 8 bond_atomic u64 BE
55
+ * 4 agent_uri_len u32 BE
56
+ * N agent_uri utf-8
57
+ */
58
+ export function encodePublishPayload(p) {
59
+ if (p.agentPda.length !== 32) {
60
+ throw new Error(`agentPda must be 32 bytes (got ${p.agentPda.length})`);
61
+ }
62
+ const evmHex = p.evmAddress.replace(/^0x/, "");
63
+ if (evmHex.length !== 40) {
64
+ throw new Error(`evmAddress must be 20 bytes / 40 hex chars (got ${evmHex.length})`);
65
+ }
66
+ if (p.score < 0 || p.score > 0xffff) {
67
+ throw new Error(`score out of u16 range (got ${p.score})`);
68
+ }
69
+ if (p.bondAtomic < 0n || p.bondAtomic > 0xffffffffffffffffn) {
70
+ throw new Error(`bondAtomic out of u64 range`);
71
+ }
72
+ const uriBytes = new TextEncoder().encode(p.agentUri);
73
+ const totalLen = 67 + uriBytes.length;
74
+ const out = new Uint8Array(totalLen);
75
+ out[0] = p.version & 0xff;
76
+ out.set(p.agentPda, 1);
77
+ for (let i = 0; i < 20; i++) {
78
+ out[33 + i] = parseInt(evmHex.slice(i * 2, i * 2 + 2), 16);
79
+ }
80
+ out[53] = (p.score >> 8) & 0xff;
81
+ out[54] = p.score & 0xff;
82
+ for (let i = 0; i < 8; i++) {
83
+ out[55 + i] = Number((p.bondAtomic >> BigInt(8 * (7 - i))) & 0xffn);
84
+ }
85
+ const uriLen = uriBytes.length;
86
+ out[63] = (uriLen >>> 24) & 0xff;
87
+ out[64] = (uriLen >>> 16) & 0xff;
88
+ out[65] = (uriLen >>> 8) & 0xff;
89
+ out[66] = uriLen & 0xff;
90
+ out.set(uriBytes, 67);
91
+ return out;
92
+ }
93
+ /** Reverse of `encodePublishPayload`. */
94
+ export function decodePublishPayload(payload) {
95
+ if (payload.length < 67) {
96
+ throw new Error(`payload too short (${payload.length} < 67)`);
97
+ }
98
+ const version = payload[0];
99
+ const agentPda = payload.slice(1, 33);
100
+ let evmHex = "";
101
+ for (let i = 0; i < 20; i++) {
102
+ evmHex += payload[33 + i].toString(16).padStart(2, "0");
103
+ }
104
+ const evmAddress = "0x" + evmHex;
105
+ const score = (payload[53] << 8) | payload[54];
106
+ let bondAtomic = 0n;
107
+ for (let i = 0; i < 8; i++) {
108
+ bondAtomic = (bondAtomic << 8n) | BigInt(payload[55 + i]);
109
+ }
110
+ const uriLen = (payload[63] << 24) |
111
+ (payload[64] << 16) |
112
+ (payload[65] << 8) |
113
+ payload[66];
114
+ if (payload.length < 67 + uriLen) {
115
+ throw new Error("uri overflow");
116
+ }
117
+ const agentUri = new TextDecoder("utf-8").decode(payload.slice(67, 67 + uriLen));
118
+ return { version, agentPda: new Uint8Array(agentPda), evmAddress, score, bondAtomic, agentUri };
119
+ }
120
+ // ─────────────────────── receiver calldata ──────────────────────────
121
+ /**
122
+ * Encode a `receivePublish(bytes encodedVm)` call for
123
+ * `TelaroErc8004Receiver`. Returns hex calldata ready to attach to a
124
+ * transaction. viem (peer dep) is lazy-loaded so importing the SDK
125
+ * doesn't drag it in unless you call this.
126
+ */
127
+ export async function encodeReceivePublishCalldata(encodedVm) {
128
+ const { encodeFunctionData, parseAbi } = await import("viem");
129
+ const abi = parseAbi(["function receivePublish(bytes encodedVm)"]);
130
+ const vmHex = ("0x" + Buffer.from(encodedVm).toString("hex"));
131
+ return encodeFunctionData({
132
+ abi,
133
+ functionName: "receivePublish",
134
+ args: [vmHex],
135
+ });
136
+ }
137
+ export const RECEIVER_ABI_FRAGMENTS = [
138
+ "function receivePublish(bytes encodedVm)",
139
+ "function agentIdOf(bytes32 agentPda) view returns (uint256)",
140
+ "function consumedVm(bytes32 vmHash) view returns (bool)",
141
+ "event AgentRegistered(uint256 indexed agentId, bytes32 indexed agentPda, address indexed evmAddress, uint16 score, uint64 bondAtomic)",
142
+ "event AgentRepublished(uint256 indexed agentId, bytes32 indexed agentPda, uint16 score, uint64 bondAtomic)",
143
+ ];
144
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,uEAAuE;AAEvE,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AAEtC,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AAEjC,uEAAuE;AAEvE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,SAAoB;IACjD,OAAO,SAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAC3B,SAAS,CACV,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC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;IACD,MAAM,QAAQ,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IACjF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAClG,CAAC;AAED,uEAAuE;AAEvE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,SAAqB;IAErB,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAkB,CAAC;IAC/E,OAAO,kBAAkB,CAAC;QACxB,GAAG;QACH,YAAY,EAAE,gBAAgB;QAC9B,IAAI,EAAE,CAAC,KAAK,CAAC;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,0CAA0C;IAC1C,6DAA6D;IAC7D,yDAAyD;IACzD,uIAAuI;IACvI,4GAA4G;CACpG,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@telaro/erc8004-bridge",
3
+ "version": "0.1.0",
4
+ "description": "JavaScript SDK for the Telaro ERC-8004 bridge. Decode Wormhole payloads published by Telaro's Solana program, encode receivePublish calldata for TelaroErc8004Receiver on EVM, and derive the Solana emitter address that anchors the trust path.",
5
+ "license": "MIT",
6
+ "homepage": "https://telaro.xyz",
7
+ "repository": "https://github.com/Telaro-Protocol/telaro-protocol",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.json",
24
+ "test": "node --import tsx/esm --test tests/*.test.ts"
25
+ },
26
+ "dependencies": {
27
+ "@solana/web3.js": "^1.95.0"
28
+ },
29
+ "peerDependencies": {
30
+ "viem": "^2.0.0"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "viem": {
34
+ "optional": true
35
+ }
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.0.0",
39
+ "tsx": "^4.16.0",
40
+ "typescript": "^5.5.0",
41
+ "viem": "^2.52.0"
42
+ },
43
+ "keywords": [
44
+ "erc-8004",
45
+ "telaro",
46
+ "wormhole",
47
+ "bridge",
48
+ "evm",
49
+ "solana",
50
+ "agent"
51
+ ]
52
+ }