@telaro/sacp 1.0.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.
Files changed (75) hide show
  1. package/INTEGRATION.md +238 -0
  2. package/README.md +253 -0
  3. package/dist/codec.d.ts +35 -0
  4. package/dist/codec.d.ts.map +1 -0
  5. package/dist/codec.js +63 -0
  6. package/dist/codec.js.map +1 -0
  7. package/dist/constants.d.ts +50 -0
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/constants.js +50 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/dispatcher.d.ts +87 -0
  12. package/dist/dispatcher.d.ts.map +1 -0
  13. package/dist/dispatcher.js +175 -0
  14. package/dist/dispatcher.js.map +1 -0
  15. package/dist/events.d.ts +93 -0
  16. package/dist/events.d.ts.map +1 -0
  17. package/dist/events.js +142 -0
  18. package/dist/events.js.map +1 -0
  19. package/dist/index.d.ts +38 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +39 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/job.d.ts +99 -0
  24. package/dist/job.d.ts.map +1 -0
  25. package/dist/job.js +297 -0
  26. package/dist/job.js.map +1 -0
  27. package/dist/lst.d.ts +52 -0
  28. package/dist/lst.d.ts.map +1 -0
  29. package/dist/lst.js +58 -0
  30. package/dist/lst.js.map +1 -0
  31. package/dist/negotiation.d.ts +66 -0
  32. package/dist/negotiation.d.ts.map +1 -0
  33. package/dist/negotiation.js +184 -0
  34. package/dist/negotiation.js.map +1 -0
  35. package/dist/offering.d.ts +65 -0
  36. package/dist/offering.d.ts.map +1 -0
  37. package/dist/offering.js +190 -0
  38. package/dist/offering.js.map +1 -0
  39. package/dist/pdas.d.ts +44 -0
  40. package/dist/pdas.d.ts.map +1 -0
  41. package/dist/pdas.js +95 -0
  42. package/dist/pdas.js.map +1 -0
  43. package/dist/runtime.d.ts +244 -0
  44. package/dist/runtime.d.ts.map +1 -0
  45. package/dist/runtime.js +481 -0
  46. package/dist/runtime.js.map +1 -0
  47. package/dist/signer.d.ts +107 -0
  48. package/dist/signer.d.ts.map +1 -0
  49. package/dist/signer.js +94 -0
  50. package/dist/signer.js.map +1 -0
  51. package/dist/take_rate.d.ts +44 -0
  52. package/dist/take_rate.d.ts.map +1 -0
  53. package/dist/take_rate.js +141 -0
  54. package/dist/take_rate.js.map +1 -0
  55. package/dist/timeout.d.ts +35 -0
  56. package/dist/timeout.d.ts.map +1 -0
  57. package/dist/timeout.js +113 -0
  58. package/dist/timeout.js.map +1 -0
  59. package/dist/types.d.ts +39 -0
  60. package/dist/types.d.ts.map +1 -0
  61. package/dist/types.js +13 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/validation.d.ts +133 -0
  64. package/dist/validation.d.ts.map +1 -0
  65. package/dist/validation.js +315 -0
  66. package/dist/validation.js.map +1 -0
  67. package/dist/watcher.d.ts +67 -0
  68. package/dist/watcher.d.ts.map +1 -0
  69. package/dist/watcher.js +176 -0
  70. package/dist/watcher.js.map +1 -0
  71. package/dist/wormhole.d.ts +88 -0
  72. package/dist/wormhole.d.ts.map +1 -0
  73. package/dist/wormhole.js +152 -0
  74. package/dist/wormhole.js.map +1 -0
  75. package/package.json +138 -0
@@ -0,0 +1,88 @@
1
+ import { Connection, PublicKey, TransactionInstruction, type Signer } from "@solana/web3.js";
2
+ /**
3
+ * Cross-chain settlement publish via Wormhole.
4
+ *
5
+ * `publish_settlement_vaa` is a permissionless instruction on
6
+ * `sacp_job` that fires a Wormhole VAA whenever a Job is in the
7
+ * `Settled` state. The VAA payload is consumed by any EVM-side
8
+ * relayer interested in mirroring sACP settlements (Base ERC-8183,
9
+ * generic ACP relays, agent dashboards).
10
+ *
11
+ * Payload layout (big-endian, EVM-friendly):
12
+ * [0] version (currently 1)
13
+ * [1..5] magic ("sACP")
14
+ * [5..13] job_id (u64 BE)
15
+ * [13] winner (0 = Client, 1 = Provider)
16
+ * [14..46] evaluator pubkey (32 bytes)
17
+ * [46..54] amount (u64 BE)
18
+ * [54..62] settled_at (i64 BE — unix seconds)
19
+ * [62] state (always 4 = Settled)
20
+ */
21
+ /** Wormhole core bridge program IDs. */
22
+ export declare const WORMHOLE_CORE_BRIDGE_MAINNET: PublicKey;
23
+ export declare const WORMHOLE_CORE_BRIDGE_DEVNET: PublicKey;
24
+ /** PDA helpers — Wormhole core bridge owns these. */
25
+ export declare function findWormholeBridgePda(wormholeProgram: PublicKey): [PublicKey, number];
26
+ export declare function findWormholeFeeCollectorPda(wormholeProgram: PublicKey): [PublicKey, number];
27
+ /** sACP emitter PDA — distinct from Telaro's `["emitter"]`. */
28
+ export declare function findSacpEmitterPda(): [PublicKey, number];
29
+ /** Wormhole sequence PDA — derived from emitter. */
30
+ export declare function findWormholeSequencePda(wormholeProgram: PublicKey, emitter: PublicKey): [PublicKey, number];
31
+ export interface PublishSettlementVaaParams {
32
+ payer: PublicKey;
33
+ /** Fresh ephemeral keypair public key — Wormhole takes ownership. */
34
+ wormholeMessage: PublicKey;
35
+ jobId: bigint;
36
+ nonce: number;
37
+ /** Defaults to devnet. Override with `WORMHOLE_CORE_BRIDGE_MAINNET`. */
38
+ wormholeProgram?: PublicKey;
39
+ }
40
+ export declare function buildPublishSettlementVaaIx(params: PublishSettlementVaaParams): {
41
+ ix: TransactionInstruction;
42
+ wormholeEmitter: PublicKey;
43
+ wormholeSequence: PublicKey;
44
+ };
45
+ /**
46
+ * Convenience: build, sign, send, and confirm a
47
+ * `publish_settlement_vaa` transaction in one call. Generates a fresh
48
+ * Wormhole message keypair internally so the caller doesn't have to
49
+ * remember the rotating-keypair convention.
50
+ *
51
+ * Returns the signature, the message account pubkey (for indexers to
52
+ * fetch the VAA from), and the post-publish Wormhole sequence number.
53
+ *
54
+ * For more control (e.g. batching the publish with other instructions
55
+ * in a single tx) use `buildPublishSettlementVaaIx` directly.
56
+ */
57
+ export declare function publishSettlementVaa(connection: Connection, payer: Signer, jobId: bigint, options?: {
58
+ nonce?: number;
59
+ wormholeProgram?: PublicKey;
60
+ commitment?: "confirmed" | "finalized";
61
+ }): Promise<{
62
+ signature: string;
63
+ wormholeMessage: PublicKey;
64
+ wormholeSequence: PublicKey;
65
+ wormholeEmitter: PublicKey;
66
+ }>;
67
+ /**
68
+ * Decode a settlement VAA payload back into structured fields. Useful
69
+ * for relayers / indexers reading Wormhole messages.
70
+ */
71
+ export interface DecodedSacpSettlement {
72
+ version: number;
73
+ jobId: bigint;
74
+ winner: 0 | 1;
75
+ evaluator: PublicKey;
76
+ /** v2+ only. `null` on v1 payloads (legacy). */
77
+ provider: PublicKey | null;
78
+ amount: bigint;
79
+ settledAt: bigint;
80
+ state: number;
81
+ }
82
+ /**
83
+ * Decode an sACP settlement VAA payload. Handles both:
84
+ * - v1 (63 bytes): no provider pubkey. Returned with `provider = null`.
85
+ * - v2 (95 bytes): includes the provider pubkey at offset 46.
86
+ */
87
+ export declare function decodeSettlementPayload(payload: Uint8Array): DecodedSacpSettlement | null;
88
+ //# sourceMappingURL=wormhole.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wormhole.d.ts","sourceRoot":"","sources":["../src/wormhole.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,SAAS,EAKT,sBAAsB,EAEtB,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wCAAwC;AACxC,eAAO,MAAM,4BAA4B,WAExC,CAAC;AACF,eAAO,MAAM,2BAA2B,WAEvC,CAAC;AAEF,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,SAAS,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAErF;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,SAAS,GACzB,CAAC,SAAS,EAAE,MAAM,CAAC,CAKrB;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAKxD;AAED,oDAAoD;AACpD,wBAAg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;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,GAClB,qBAAqB,GAAG,IAAI,CA4C9B"}
@@ -0,0 +1,152 @@
1
+ import { Keypair, PublicKey, SYSVAR_CLOCK_PUBKEY, SYSVAR_RENT_PUBKEY, SystemProgram, Transaction, TransactionInstruction, sendAndConfirmTransaction, } from "@solana/web3.js";
2
+ import { encodeInstruction } from "./codec.js";
3
+ import { SACP_PROGRAM_ID } from "./constants.js";
4
+ import { findJobPda } from "./pdas.js";
5
+ /**
6
+ * Cross-chain settlement publish via Wormhole.
7
+ *
8
+ * `publish_settlement_vaa` is a permissionless instruction on
9
+ * `sacp_job` that fires a Wormhole VAA whenever a Job is in the
10
+ * `Settled` state. The VAA payload is consumed by any EVM-side
11
+ * relayer interested in mirroring sACP settlements (Base ERC-8183,
12
+ * generic ACP relays, agent dashboards).
13
+ *
14
+ * Payload layout (big-endian, EVM-friendly):
15
+ * [0] version (currently 1)
16
+ * [1..5] magic ("sACP")
17
+ * [5..13] job_id (u64 BE)
18
+ * [13] winner (0 = Client, 1 = Provider)
19
+ * [14..46] evaluator pubkey (32 bytes)
20
+ * [46..54] amount (u64 BE)
21
+ * [54..62] settled_at (i64 BE — unix seconds)
22
+ * [62] state (always 4 = Settled)
23
+ */
24
+ /** Wormhole core bridge program IDs. */
25
+ export const WORMHOLE_CORE_BRIDGE_MAINNET = new PublicKey("worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth");
26
+ export const WORMHOLE_CORE_BRIDGE_DEVNET = new PublicKey("3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5");
27
+ /** PDA helpers — Wormhole core bridge owns these. */
28
+ export function findWormholeBridgePda(wormholeProgram) {
29
+ return PublicKey.findProgramAddressSync([Buffer.from("Bridge")], wormholeProgram);
30
+ }
31
+ export function findWormholeFeeCollectorPda(wormholeProgram) {
32
+ return PublicKey.findProgramAddressSync([Buffer.from("fee_collector")], wormholeProgram);
33
+ }
34
+ /** sACP emitter PDA — distinct from Telaro's `["emitter"]`. */
35
+ export function findSacpEmitterPda() {
36
+ return PublicKey.findProgramAddressSync([Buffer.from("sacp_emitter")], SACP_PROGRAM_ID);
37
+ }
38
+ /** Wormhole sequence PDA — derived from emitter. */
39
+ export function findWormholeSequencePda(wormholeProgram, emitter) {
40
+ return PublicKey.findProgramAddressSync([Buffer.from("Sequence"), emitter.toBuffer()], wormholeProgram);
41
+ }
42
+ export function buildPublishSettlementVaaIx(params) {
43
+ const wh = params.wormholeProgram ?? WORMHOLE_CORE_BRIDGE_DEVNET;
44
+ const [jobPda] = findJobPda(params.jobId);
45
+ const [wormholeBridge] = findWormholeBridgePda(wh);
46
+ const [wormholeFeeCollector] = findWormholeFeeCollectorPda(wh);
47
+ const [wormholeEmitter] = findSacpEmitterPda();
48
+ const [wormholeSequence] = findWormholeSequencePda(wh, wormholeEmitter);
49
+ // Nonce: 4-byte little-endian unsigned. Borsh u32.
50
+ const nonceBytes = Buffer.alloc(4);
51
+ nonceBytes.writeUInt32LE(params.nonce >>> 0);
52
+ const data = encodeInstruction("publish_settlement_vaa", nonceBytes);
53
+ const ix = new TransactionInstruction({
54
+ programId: SACP_PROGRAM_ID,
55
+ keys: [
56
+ { pubkey: jobPda, isSigner: false, isWritable: false },
57
+ { pubkey: params.payer, isSigner: true, isWritable: true },
58
+ { pubkey: params.wormholeMessage, isSigner: true, isWritable: true },
59
+ { pubkey: wh, isSigner: false, isWritable: false },
60
+ { pubkey: wormholeBridge, isSigner: false, isWritable: true },
61
+ { pubkey: wormholeEmitter, isSigner: false, isWritable: false },
62
+ { pubkey: wormholeSequence, isSigner: false, isWritable: true },
63
+ { pubkey: wormholeFeeCollector, isSigner: false, isWritable: true },
64
+ { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },
65
+ { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
66
+ { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
67
+ ],
68
+ data,
69
+ });
70
+ return { ix, wormholeEmitter, wormholeSequence };
71
+ }
72
+ /**
73
+ * Convenience: build, sign, send, and confirm a
74
+ * `publish_settlement_vaa` transaction in one call. Generates a fresh
75
+ * Wormhole message keypair internally so the caller doesn't have to
76
+ * remember the rotating-keypair convention.
77
+ *
78
+ * Returns the signature, the message account pubkey (for indexers to
79
+ * fetch the VAA from), and the post-publish Wormhole sequence number.
80
+ *
81
+ * For more control (e.g. batching the publish with other instructions
82
+ * in a single tx) use `buildPublishSettlementVaaIx` directly.
83
+ */
84
+ export async function publishSettlementVaa(connection, payer, jobId, options = {}) {
85
+ const wormholeMessage = Keypair.generate();
86
+ const { ix, wormholeEmitter, wormholeSequence } = buildPublishSettlementVaaIx({
87
+ payer: payer.publicKey,
88
+ wormholeMessage: wormholeMessage.publicKey,
89
+ jobId,
90
+ nonce: options.nonce ?? Math.floor(Math.random() * 0xffffffff),
91
+ wormholeProgram: options.wormholeProgram,
92
+ });
93
+ const signature = await sendAndConfirmTransaction(connection, new Transaction().add(ix), [payer, wormholeMessage], { commitment: options.commitment ?? "confirmed" });
94
+ return {
95
+ signature,
96
+ wormholeMessage: wormholeMessage.publicKey,
97
+ wormholeSequence,
98
+ wormholeEmitter,
99
+ };
100
+ }
101
+ /**
102
+ * Decode an sACP settlement VAA payload. Handles both:
103
+ * - v1 (63 bytes): no provider pubkey. Returned with `provider = null`.
104
+ * - v2 (95 bytes): includes the provider pubkey at offset 46.
105
+ */
106
+ export function decodeSettlementPayload(payload) {
107
+ if (payload.length !== 63 && payload.length !== 95)
108
+ return null;
109
+ const buf = Buffer.from(payload);
110
+ const version = buf.readUInt8(0);
111
+ const magic = buf.subarray(1, 5).toString("utf8");
112
+ if (magic !== "sACP")
113
+ return null;
114
+ const jobId = buf.readBigUInt64BE(5);
115
+ const winner = buf.readUInt8(13);
116
+ if (winner !== 0 && winner !== 1)
117
+ return null;
118
+ const evaluator = new PublicKey(buf.subarray(14, 46));
119
+ if (payload.length === 63) {
120
+ // v1 layout — no provider field.
121
+ const amount = buf.readBigUInt64BE(46);
122
+ const settledAt = buf.readBigInt64BE(54);
123
+ const state = buf.readUInt8(62);
124
+ return {
125
+ version,
126
+ jobId,
127
+ winner: winner,
128
+ evaluator,
129
+ provider: null,
130
+ amount,
131
+ settledAt,
132
+ state,
133
+ };
134
+ }
135
+ // v2 layout — provider at [46..78], amount at [78..86], settledAt at
136
+ // [86..94], state at [94].
137
+ const provider = new PublicKey(buf.subarray(46, 78));
138
+ const amount = buf.readBigUInt64BE(78);
139
+ const settledAt = buf.readBigInt64BE(86);
140
+ const state = buf.readUInt8(94);
141
+ return {
142
+ version,
143
+ jobId,
144
+ winner: winner,
145
+ evaluator,
146
+ provider,
147
+ amount,
148
+ settledAt,
149
+ state,
150
+ };
151
+ }
152
+ //# sourceMappingURL=wormhole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wormhole.js","sourceRoot":"","sources":["../src/wormhole.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,yBAAyB,GAE1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wCAAwC;AACxC,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,SAAS,CACvD,6CAA6C,CAC9C,CAAC;AACF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,SAAS,CACtD,8CAA8C,CAC/C,CAAC;AAEF,qDAAqD;AACrD,MAAM,UAAU,qBAAqB,CAAC,eAA0B;IAC9D,OAAO,SAAS,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAA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AK;KACN,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,138 @@
1
+ {
2
+ "name": "@telaro/sacp",
3
+ "version": "1.0.0",
4
+ "description": "Solana Agent Commerce Protocol (sACP) — TypeScript SDK. Job lifecycle escrow + bonded validator registry on Solana, ERC-8183 compatible. Reference implementation by Telaro Protocol.",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./job": {
15
+ "types": "./dist/job.d.ts",
16
+ "import": "./dist/job.js"
17
+ },
18
+ "./validation": {
19
+ "types": "./dist/validation.d.ts",
20
+ "import": "./dist/validation.js"
21
+ },
22
+ "./events": {
23
+ "types": "./dist/events.d.ts",
24
+ "import": "./dist/events.js"
25
+ },
26
+ "./wormhole": {
27
+ "types": "./dist/wormhole.d.ts",
28
+ "import": "./dist/wormhole.js"
29
+ },
30
+ "./lst": {
31
+ "types": "./dist/lst.d.ts",
32
+ "import": "./dist/lst.js"
33
+ },
34
+ "./take-rate": {
35
+ "types": "./dist/take_rate.d.ts",
36
+ "import": "./dist/take_rate.js"
37
+ },
38
+ "./runtime": {
39
+ "types": "./dist/runtime.d.ts",
40
+ "import": "./dist/runtime.js"
41
+ },
42
+ "./signer": {
43
+ "types": "./dist/signer.d.ts",
44
+ "import": "./dist/signer.js"
45
+ },
46
+ "./watcher": {
47
+ "types": "./dist/watcher.d.ts",
48
+ "import": "./dist/watcher.js"
49
+ },
50
+ "./dispatcher": {
51
+ "types": "./dist/dispatcher.d.ts",
52
+ "import": "./dist/dispatcher.js"
53
+ },
54
+ "./offering": {
55
+ "types": "./dist/offering.d.ts",
56
+ "import": "./dist/offering.js"
57
+ },
58
+ "./timeout": {
59
+ "types": "./dist/timeout.d.ts",
60
+ "import": "./dist/timeout.js"
61
+ },
62
+ "./negotiation": {
63
+ "types": "./dist/negotiation.d.ts",
64
+ "import": "./dist/negotiation.js"
65
+ }
66
+ },
67
+ "files": [
68
+ "dist",
69
+ "README.md",
70
+ "INTEGRATION.md"
71
+ ],
72
+ "dependencies": {
73
+ "@solana/web3.js": "^1.95.0",
74
+ "@coral-xyz/anchor": "^0.31.0",
75
+ "@noble/hashes": "^1.5.0"
76
+ },
77
+ "devDependencies": {
78
+ "@types/node": "^22.0.0",
79
+ "@types/express": "^4.17.21",
80
+ "typescript": "^5.5.0",
81
+ "tsx": "^4.16.0",
82
+ "express": "^4.21.0",
83
+ "@solana/spl-token": "^0.4.0",
84
+ "@modelcontextprotocol/sdk": "^1.0.0"
85
+ },
86
+ "publishConfig": {
87
+ "access": "public"
88
+ },
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "git+https://github.com/Telaro-Protocol/Telaro-Protocol.git",
92
+ "directory": "packages/sacp"
93
+ },
94
+ "homepage": "https://sacp.dev",
95
+ "bugs": {
96
+ "url": "https://github.com/Telaro-Protocol/Telaro-Protocol/issues"
97
+ },
98
+ "engines": {
99
+ "node": ">=20"
100
+ },
101
+ "keywords": [
102
+ "agent-commerce",
103
+ "ai-agents",
104
+ "anchor",
105
+ "erc-8004",
106
+ "erc-8183",
107
+ "escrow",
108
+ "sacp",
109
+ "solana",
110
+ "telaro",
111
+ "validation-registry"
112
+ ],
113
+ "type": "module",
114
+ "scripts": {
115
+ "build": "tsc -p tsconfig.json",
116
+ "typecheck": "tsc --noEmit",
117
+ "clean": "rm -rf dist",
118
+ "smoke": "tsx tests/devnet-smoke.ts",
119
+ "smoke:validation": "tsx tests/devnet-validation.ts",
120
+ "smoke:dispute": "tsx tests/devnet-dispute.ts",
121
+ "smoke:reclaim": "tsx tests/devnet-reclaim.ts",
122
+ "smoke:all": "tsx tests/devnet-smoke.ts && tsx tests/devnet-dispute.ts && tsx tests/devnet-reclaim.ts && tsx tests/devnet-validation.ts",
123
+ "smoke:bonded": "tsx tests/devnet-bonded-evaluator.ts",
124
+ "smoke:negative": "tsx tests/devnet-negative.ts",
125
+ "smoke:wormhole": "tsx tests/devnet-wormhole.ts",
126
+ "smoke:jitosol": "tsx tests/devnet-jitosol.ts",
127
+ "smoke:wormhole-reclaim": "tsx tests/devnet-wormhole-reclaim.ts",
128
+ "smoke:take-rate": "tsx tests/devnet-take-rate.ts",
129
+ "smoke:runtime": "tsx tests/devnet-runtime.ts",
130
+ "smoke:v09": "tsx tests/devnet-v09.ts",
131
+ "smoke:v09-phase56": "tsx tests/devnet-v09-phase56.ts",
132
+ "smoke:phase7": "tsx tests/devnet-phase7.ts",
133
+ "smoke:phase8": "tsx tests/devnet-phase8.ts",
134
+ "smoke:phantom": "tsx tests/devnet-phantom.ts",
135
+ "smoke:x402": "tsx tests/devnet-x402.ts",
136
+ "smoke:mcp-server": "tsx tests/devnet-mcp-server.ts"
137
+ }
138
+ }