@provablehq/aleo-bridge-sdk 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.
@@ -0,0 +1,28 @@
1
+ import { McpServer } from '@provablehq/veil-core/mcp';
2
+ export { McpServer, McpToolDefinition } from '@provablehq/veil-core/mcp';
3
+ import { K as BridgeClient } from '../createBridgeClient-DzmEyXfG.js';
4
+ import '@provablehq/veil-core';
5
+ import '../solana-D5Qr6SLa.js';
6
+ import 'viem';
7
+
8
+ /**
9
+ * Creates an MCP server for discovering and describing cross-chain transfers.
10
+ *
11
+ * The exposed tools list assets and routes and quote a proposed transfer,
12
+ * including current costs where the selected route exposes them. They cannot
13
+ * request a signature, submit a transaction, or move funds.
14
+ *
15
+ * Exposed via subpath export: `import { createBridgeMcpServer } from '@provablehq/aleo-bridge-sdk/mcp'`.
16
+ *
17
+ * @param client Bridge client supplying the supported asset and route catalog.
18
+ * @returns MCP server exposing the non-fund-moving bridge tools.
19
+ *
20
+ * @example
21
+ * const server = createBridgeMcpServer(client)
22
+ * const routes = await server.handleToolCall('bridge_list_routes', {
23
+ * protocol: 'xreserve',
24
+ * })
25
+ */
26
+ declare function createBridgeMcpServer(client: BridgeClient): McpServer;
27
+
28
+ export { createBridgeMcpServer };
@@ -0,0 +1,13 @@
1
+ import {
2
+ createBridgeAgentTools
3
+ } from "../chunk-NTWXJE7R.js";
4
+
5
+ // src/mcp/index.ts
6
+ import { toMcpServer } from "@provablehq/veil-core/mcp";
7
+ function createBridgeMcpServer(client) {
8
+ return toMcpServer(createBridgeAgentTools(client));
9
+ }
10
+ export {
11
+ createBridgeMcpServer
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mcp/index.ts"],"sourcesContent":["import { toMcpServer, type McpServer } from '@provablehq/veil-core/mcp'\nimport { createBridgeAgentTools } from '../agent/tools.js'\nimport type { BridgeClient } from '../clients/createBridgeClient.js'\n\nexport type { McpServer, McpToolDefinition } from '@provablehq/veil-core/mcp'\n\n/**\n * Creates an MCP server for discovering and describing cross-chain transfers.\n *\n * The exposed tools list assets and routes and quote a proposed transfer,\n * including current costs where the selected route exposes them. They cannot\n * request a signature, submit a transaction, or move funds.\n *\n * Exposed via subpath export: `import { createBridgeMcpServer } from '@provablehq/aleo-bridge-sdk/mcp'`.\n *\n * @param client Bridge client supplying the supported asset and route catalog.\n * @returns MCP server exposing the non-fund-moving bridge tools.\n *\n * @example\n * const server = createBridgeMcpServer(client)\n * const routes = await server.handleToolCall('bridge_list_routes', {\n * protocol: 'xreserve',\n * })\n */\nexport function createBridgeMcpServer(client: BridgeClient): McpServer {\n return toMcpServer(createBridgeAgentTools(client))\n}\n"],"mappings":";;;;;AAAA,SAAS,mBAAmC;AAwBrC,SAAS,sBAAsB,QAAiC;AACrE,SAAO,YAAY,uBAAuB,MAAM,CAAC;AACnD;","names":[]}
@@ -0,0 +1,113 @@
1
+ import * as _solana_kit from '@solana/kit';
2
+ import { K as SolanaHyperlaneRouteMetadata } from '../solana-D5Qr6SLa.js';
3
+ export { D as DEFAULT_SOLANA_RPC_URL, W as SolanaRpcClient, X as createSolanaRpcClient } from '../solana-D5Qr6SLa.js';
4
+
5
+ /**
6
+ * Lazily imports the optional `@solana/kit` peer dependency.
7
+ *
8
+ * This is the only module in the package permitted to import `@solana/kit`
9
+ * directly, so applications that never use Solana do not load the optional
10
+ * dependency. The import is performed at most once per process and does not
11
+ * contact a chain or wallet.
12
+ *
13
+ * @returns The `@solana/kit` module namespace once dynamic import resolves.
14
+ * @throws BridgeError When `@solana/kit` cannot be resolved, naming the
15
+ * install command and wrapping the original module-resolution error as
16
+ * `cause`.
17
+ *
18
+ * @example
19
+ * const kit = await loadKit()
20
+ * const signer = await kit.createKeyPairSignerFromBytes(secretKeyBytes)
21
+ */
22
+ declare function loadKit(): Promise<typeof _solana_kit>;
23
+
24
+ /**
25
+ * Identifies one Solana account entry in a compiled instruction's account list.
26
+ *
27
+ * @property address Base58-encoded Solana account address.
28
+ * @property signer Whether the transaction must carry this account's signature.
29
+ * @property writable Whether the runtime may write to this account during the instruction.
30
+ */
31
+ type SolanaAccountMeta = {
32
+ address: string;
33
+ signer: boolean;
34
+ writable: boolean;
35
+ };
36
+ /**
37
+ * Selects the route, parties, and amount for one Sealevel `TransferRemote` instruction.
38
+ *
39
+ * @property metadata Reviewed static accounts and domain for the Solana Hyperlane Warp Route.
40
+ * @property senderAddress Base58 address of the wallet funding the transfer; signs and pays rent.
41
+ * @property uniqueMessageAddress Base58 address of a fresh, caller-supplied signer that seeds the
42
+ * dispatched-message and gas-payment program-derived addresses and proves transaction uniqueness.
43
+ * @property recipientAleoAddress Aleo `aleo1…` address receiving the transfer on the destination chain.
44
+ * @property amountLamports Amount to transfer, in lamports.
45
+ */
46
+ type BuildTransferRemoteParameters = {
47
+ metadata: SolanaHyperlaneRouteMetadata;
48
+ senderAddress: string;
49
+ uniqueMessageAddress: string;
50
+ recipientAleoAddress: string;
51
+ amountLamports: bigint;
52
+ };
53
+ /**
54
+ * Builds the Solana instruction that commits SOL to a Hyperlane transfer bound for Aleo.
55
+ *
56
+ * The result is unsigned and cannot move funds until the sender and unique
57
+ * message account sign it and a client broadcasts it. Every program account is
58
+ * supplied by reviewed route metadata or derived from the unique message key;
59
+ * no network or wallet is contacted. The encoding is verified byte-for-byte
60
+ * against `test/fixtures/sealevel-transfer-remote.json`.
61
+ *
62
+ * @param params Route metadata, transfer parties, and the lamport amount to move.
63
+ * @returns The Warp Route program, ordered accounts, and raw 77-byte instruction data needed to assemble the transaction.
64
+ * @throws BridgeError When `amountLamports` does not fit the instruction's 32-byte unsigned width,
65
+ * or when `recipientAleoAddress` is not a valid Aleo address.
66
+ *
67
+ * @example
68
+ * const instruction = await buildTransferRemoteInstruction({
69
+ * metadata: route.solana,
70
+ * senderAddress: await walletClient.getAddress(),
71
+ * uniqueMessageAddress: uniqueSigner.address,
72
+ * recipientAleoAddress: 'aleo1…',
73
+ * amountLamports: 1_000_000_000n,
74
+ * })
75
+ */
76
+ declare function buildTransferRemoteInstruction(params: BuildTransferRemoteParameters): Promise<{
77
+ programAddress: string;
78
+ accounts: SolanaAccountMeta[];
79
+ data: Uint8Array;
80
+ }>;
81
+
82
+ /**
83
+ * Computes the lamport gas payment a Sealevel interchain gas paymaster (IGP)
84
+ * quotes for delivering a message to a given destination domain.
85
+ *
86
+ * Decodes the supplied IGP account's gas-oracle table and applies the
87
+ * paymaster's `compute_gas_fee` formula (SEALEVEL_NOTES.md §4) without
88
+ * contacting Solana. `igpAccountData` must be the terminal, quoted `Igp`
89
+ * account — the one an `OverheadIgp` wrapper's own `inner` field points at,
90
+ * not the `OverheadIgp` wrapper account itself — and `gasAmount` must be the
91
+ * warp token's own `destination_gas` value for the domain, not derived from
92
+ * the message.
93
+ *
94
+ * @param params.igpAccountData Raw account data of the terminal Sealevel `Igp` account.
95
+ * @param params.destinationDomain Hyperlane domain the transfer is bound for.
96
+ * @param params.gasAmount Destination gas units to quote, as reported by the warp token's `destination_gas` configuration.
97
+ * @returns The gas payment required, in lamports.
98
+ * @throws BridgeError When `igpAccountData` has no gas-oracle entry for `destinationDomain`.
99
+ *
100
+ * @example
101
+ * const lamports = quoteIgpGasPayment({
102
+ * igpAccountData: await rpc.getAccountData(route.igpAccount) ?? new Uint8Array(),
103
+ * destinationDomain: route.destinationDomain,
104
+ * gasAmount: BigInt(route.destinationGasAmount),
105
+ * })
106
+ */
107
+ declare function quoteIgpGasPayment(params: {
108
+ igpAccountData: Uint8Array;
109
+ destinationDomain: number;
110
+ gasAmount: bigint;
111
+ }): bigint;
112
+
113
+ export { type BuildTransferRemoteParameters, type SolanaAccountMeta, buildTransferRemoteInstruction, loadKit, quoteIgpGasPayment };
@@ -0,0 +1,15 @@
1
+ import {
2
+ DEFAULT_SOLANA_RPC_URL,
3
+ buildTransferRemoteInstruction,
4
+ createSolanaRpcClient,
5
+ loadKit,
6
+ quoteIgpGasPayment
7
+ } from "../chunk-OU6GVGG7.js";
8
+ export {
9
+ DEFAULT_SOLANA_RPC_URL,
10
+ buildTransferRemoteInstruction,
11
+ createSolanaRpcClient,
12
+ loadKit,
13
+ quoteIgpGasPayment
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}