@provablehq/aleo-bridge-sdk 0.8.0-rc.0 → 0.11.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 +327 -261
- package/dist/agent/index.d.ts +8 -7
- package/dist/agent/index.js +1 -1
- package/dist/chunk-NTWXJE7R.js +93 -0
- package/dist/chunk-NTWXJE7R.js.map +1 -0
- package/dist/chunk-OU6GVGG7.js +606 -0
- package/dist/chunk-OU6GVGG7.js.map +1 -0
- package/dist/createBridgeClient-DzmEyXfG.d.ts +1058 -0
- package/dist/index.d.ts +495 -177
- package/dist/index.js +3085 -830
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +8 -6
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/solana/index.d.ts +113 -0
- package/dist/solana/index.js +15 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana-D5Qr6SLa.d.ts +725 -0
- package/package.json +20 -6
- package/dist/chunk-KG3LFIU5.js +0 -61
- package/dist/chunk-KG3LFIU5.js.map +0 -1
- package/dist/createBridgeClient-CjHY-JvW.d.ts +0 -779
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { AgentTool } from '@provablehq/veil-core/agent';
|
|
2
2
|
export { AgentTool, AgentToolHandler, AgentToolSchema } from '@provablehq/veil-core/agent';
|
|
3
|
-
import {
|
|
3
|
+
import { K as BridgeClient } from '../createBridgeClient-DzmEyXfG.js';
|
|
4
4
|
import '@provablehq/veil-core';
|
|
5
|
+
import '../solana-D5Qr6SLa.js';
|
|
5
6
|
import 'viem';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* Creates tools an agent can use to discover and describe cross-chain transfers.
|
|
9
10
|
*
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* The tools list supported assets and routes, validate an amount and recipient,
|
|
12
|
+
* and quote current costs when the selected route exposes them. They cannot
|
|
13
|
+
* request a signature, submit a transaction, or move funds.
|
|
13
14
|
*
|
|
14
|
-
* @param client
|
|
15
|
-
* @returns
|
|
15
|
+
* @param client Bridge client supplying the supported asset and route catalog.
|
|
16
|
+
* @returns Non-fund-moving agent tools for discovering and describing transfers.
|
|
16
17
|
*
|
|
17
18
|
* @example
|
|
18
19
|
* const tools = createBridgeAgentTools(createBridgeClient())
|
package/dist/agent/index.js
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// src/agent/tools.ts
|
|
2
|
+
function createBridgeAgentTools(client) {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
schema: {
|
|
6
|
+
name: "bridge_list_assets",
|
|
7
|
+
description: "List assets available for cross-chain transfers. Returns each chain representation, symbol, decimal precision, and public token identifier without contacting a chain or wallet.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
environment: { type: "string", enum: ["mainnet", "testnet"] },
|
|
12
|
+
chainId: { type: "string" },
|
|
13
|
+
symbol: { type: "string" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
handler: async (params) => {
|
|
18
|
+
const filters = params;
|
|
19
|
+
return client.registry.getAssets({
|
|
20
|
+
...filters,
|
|
21
|
+
environment: filters.environment ?? client.environment
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
schema: {
|
|
27
|
+
name: "bridge_list_routes",
|
|
28
|
+
description: "List supported ways to move assets between chains and the provider responsible for each direction. A metadata-required route is recognized but cannot move funds until its deployed contracts or programs are reviewed.",
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
environment: { type: "string", enum: ["mainnet", "testnet"] },
|
|
33
|
+
protocol: { type: "string", enum: ["xreserve", "hyperlane"] },
|
|
34
|
+
sourceChainId: { type: "string" },
|
|
35
|
+
destinationChainId: { type: "string" },
|
|
36
|
+
symbol: { type: "string" },
|
|
37
|
+
includeUnavailable: { type: "boolean" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
handler: async (params) => {
|
|
42
|
+
const filters = params;
|
|
43
|
+
return client.registry.getRoutes({
|
|
44
|
+
...filters,
|
|
45
|
+
environment: filters.environment ?? client.environment
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
schema: {
|
|
51
|
+
name: "bridge_quote_transfer",
|
|
52
|
+
description: "Validate and price an intended transfer between two chains through xReserve or Hyperlane. This tool reads current chain or provider state where the selected route exposes live costs, but does not request a wallet signature or move funds.",
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: "object",
|
|
55
|
+
properties: {
|
|
56
|
+
source: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: { chain: { type: "string" }, asset: { type: "string" } },
|
|
59
|
+
required: ["chain", "asset"]
|
|
60
|
+
},
|
|
61
|
+
destination: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: { chain: { type: "string" }, asset: { type: "string" } },
|
|
64
|
+
required: ["chain", "asset"]
|
|
65
|
+
},
|
|
66
|
+
bridgeProtocol: { type: "string", enum: ["xreserve", "hyperlane"] },
|
|
67
|
+
amount: { type: "string", description: "Positive decimal amount in source-asset display units." },
|
|
68
|
+
recipient: { type: "string" },
|
|
69
|
+
sender: { type: "string" },
|
|
70
|
+
mintMode: { type: "string", enum: ["public", "record", "private"] }
|
|
71
|
+
},
|
|
72
|
+
required: ["source", "destination", "amount", "recipient"]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
handler: async (params) => jsonSafe(await client.quote(params))
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
function jsonSafe(value) {
|
|
80
|
+
if (typeof value === "bigint") return value.toString();
|
|
81
|
+
if (Array.isArray(value)) return value.map(jsonSafe);
|
|
82
|
+
if (value && typeof value === "object") {
|
|
83
|
+
return Object.fromEntries(
|
|
84
|
+
Object.entries(value).map(([key, entry]) => [key, jsonSafe(entry)])
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
createBridgeAgentTools
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=chunk-NTWXJE7R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agent/tools.ts"],"sourcesContent":["import type { AgentTool } from '@provablehq/veil-core/agent'\nimport type { BridgeClient } from '../clients/createBridgeClient.js'\nimport type { GetAssetsParameters, GetRoutesParameters } from '../types/protocol.js'\n\n/**\n * Creates tools an agent can use to discover and describe cross-chain transfers.\n *\n * The tools list supported assets and routes, validate an amount and recipient,\n * and quote current costs when the selected route exposes them. They cannot\n * request a signature, submit a transaction, or move funds.\n *\n * @param client Bridge client supplying the supported asset and route catalog.\n * @returns Non-fund-moving agent tools for discovering and describing transfers.\n *\n * @example\n * const tools = createBridgeAgentTools(createBridgeClient())\n */\nexport function createBridgeAgentTools(client: BridgeClient): AgentTool[] {\n return [\n {\n schema: {\n name: 'bridge_list_assets',\n description: 'List assets available for cross-chain transfers. Returns each chain representation, symbol, decimal precision, and public token identifier without contacting a chain or wallet.',\n inputSchema: {\n type: 'object',\n properties: {\n environment: { type: 'string', enum: ['mainnet', 'testnet'] },\n chainId: { type: 'string' },\n symbol: { type: 'string' },\n },\n },\n },\n handler: async (params) => {\n const filters = params as GetAssetsParameters\n return client.registry.getAssets({\n ...filters,\n environment: filters.environment ?? client.environment,\n })\n },\n },\n {\n schema: {\n name: 'bridge_list_routes',\n description: 'List supported ways to move assets between chains and the provider responsible for each direction. A metadata-required route is recognized but cannot move funds until its deployed contracts or programs are reviewed.',\n inputSchema: {\n type: 'object',\n properties: {\n environment: { type: 'string', enum: ['mainnet', 'testnet'] },\n protocol: { type: 'string', enum: ['xreserve', 'hyperlane'] },\n sourceChainId: { type: 'string' },\n destinationChainId: { type: 'string' },\n symbol: { type: 'string' },\n includeUnavailable: { type: 'boolean' },\n },\n },\n },\n handler: async (params) => {\n const filters = params as GetRoutesParameters\n return client.registry.getRoutes({\n ...filters,\n environment: filters.environment ?? client.environment,\n })\n },\n },\n {\n schema: {\n name: 'bridge_quote_transfer',\n description: 'Validate and price an intended transfer between two chains through xReserve or Hyperlane. This tool reads current chain or provider state where the selected route exposes live costs, but does not request a wallet signature or move funds.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'object',\n properties: { chain: { type: 'string' }, asset: { type: 'string' } },\n required: ['chain', 'asset'],\n },\n destination: {\n type: 'object',\n properties: { chain: { type: 'string' }, asset: { type: 'string' } },\n required: ['chain', 'asset'],\n },\n bridgeProtocol: { type: 'string', enum: ['xreserve', 'hyperlane'] },\n amount: { type: 'string', description: 'Positive decimal amount in source-asset display units.' },\n recipient: { type: 'string' },\n sender: { type: 'string' },\n mintMode: { type: 'string', enum: ['public', 'record', 'private'] },\n },\n required: ['source', 'destination', 'amount', 'recipient'],\n },\n },\n handler: async (params) => jsonSafe(await client.quote(params as Parameters<BridgeClient['quote']>[0])),\n },\n ]\n}\n\n/** Converts atomic bigint amounts into decimal strings accepted by JSON-based agent transports. */\nfunction jsonSafe(value: unknown): unknown {\n if (typeof value === 'bigint') return value.toString()\n if (Array.isArray(value)) return value.map(jsonSafe)\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value).map(([key, entry]) => [key, jsonSafe(entry)]),\n )\n }\n return value\n}\n"],"mappings":";AAiBO,SAAS,uBAAuB,QAAmC;AACxE,SAAO;AAAA,IACL;AAAA,MACE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,UACX,MAAM;AAAA,UACN,YAAY;AAAA,YACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,WAAW,SAAS,EAAE;AAAA,YAC5D,SAAS,E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