@aurora-is-near/intents-connect 7.32.2 → 7.33.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,31 @@
1
+ import { IntentsConnectActionsApi } from './types';
2
+ import { AsyncRecipe, Recipe, StepContext } from '../types/recipe';
3
+ export type ActionRecipeOptions<TParams> = Omit<Recipe<TParams>, 'buildSteps' | 'type'> & {
4
+ /** The actions API client (`createIntentsConnectActionsApi`). */
5
+ api: Pick<IntentsConnectActionsApi, 'resolveAction'>;
6
+ /** The hosted action's id, e.g. `aave-v3-borrow`. */
7
+ actionId: string;
8
+ version: number;
9
+ /**
10
+ * Pins the definition and script the integration was built against: a
11
+ * changed action fails with `IntentsConnectActionsApiError.isHashMismatch`
12
+ * instead of running steps nobody reviewed, and a resolution carrying
13
+ * another hash or version fails with `ACTION_MISMATCH`.
14
+ */
15
+ expectedSha256Hash?: string;
16
+ /**
17
+ * The action's inputs for one build. `ctx.amount` is opaque on EVM (it may
18
+ * be `{MIN_AMOUNT_OUT}`) and changes between builds of one steps-only
19
+ * preview, so map it through rather than fixing it at recipe creation.
20
+ */
21
+ inputs: (ctx: StepContext, params: TParams) => Record<string, unknown>;
22
+ };
23
+ /**
24
+ * An EVM recipe whose steps come from a hosted action: each `buildSteps`
25
+ * resolves the action with the inputs `inputs(ctx, params)` returns and
26
+ * returns the resolved steps. The runner builds the creation body as for any
27
+ * recipe (quote, metadata, fee handling), so the recipe's static fields must
28
+ * describe what the action resolves to; `actionMatchesRecipe` checks that on
29
+ * every build and throws `ACTION_MISMATCH` otherwise.
30
+ */
31
+ export declare const actionRecipe: <TParams>({ api, actionId, version, expectedSha256Hash, inputs, ...recipe }: ActionRecipeOptions<TParams>) => AsyncRecipe<TParams>;
@@ -0,0 +1,8 @@
1
+ import { IntentsConnectActionsApi, IntentsConnectActionsApiOptions } from './types';
2
+ /**
3
+ * Client for the Intents Connect actions API: the catalog of hosted actions
4
+ * and their resolution into execution creation bodies. Both endpoints are
5
+ * public, so no API key is sent. Execution creation stays on the execution
6
+ * API (`createIntentsConnectApi`); `actionRecipe` connects the two.
7
+ */
8
+ export declare const createIntentsConnectActionsApi: (options: IntentsConnectActionsApiOptions) => IntentsConnectActionsApi;
@@ -0,0 +1,4 @@
1
+ export { actionRecipe } from './actionRecipe';
2
+ export type { ActionRecipeOptions } from './actionRecipe';
3
+ export { createIntentsConnectActionsApi } from './createIntentsConnectActionsApi';
4
+ export type { ActionCatalogEntry, ActionResolution, IntentsConnectActionsApi, IntentsConnectActionsApiOptions, ResolveActionRequest, ResolvedExecution, } from './types';
@@ -0,0 +1,70 @@
1
+ import { ExecutionMetadata } from '../api/types';
2
+ import { FetchLike } from '../http';
3
+ import { ExecutionStep, ExecutionType, QuoteRequest } from '../types/execution';
4
+ export type IntentsConnectActionsApiOptions = {
5
+ /** The actions API origin, e.g. `https://intents-connect-actions-demo.aurora.dev`. */
6
+ baseUrl: string;
7
+ /** Defaults to global `fetch`. */
8
+ fetch?: FetchLike;
9
+ /** Milliseconds. Defaults to 15_000. */
10
+ timeout?: number;
11
+ };
12
+ /** One action version in `GET /api/v1/actions`. */
13
+ export type ActionCatalogEntry = {
14
+ /** Stable lowercase id, e.g. `aave-v3-borrow`. */
15
+ id: string;
16
+ /** Unsigned integer; each version is kept for callers that pin it. */
17
+ version: number;
18
+ name: string;
19
+ description: string;
20
+ templateFormat: 'starlark';
21
+ /** Backend chain ids the action resolves to, e.g. `["base", "arb"]`. */
22
+ supportedChains: string[];
23
+ /** JSON Schema 2020-12 of the action's `inputs`. */
24
+ inputSchema: Record<string, unknown>;
25
+ /** The Starlark source. */
26
+ script: string;
27
+ /** Lowercase hex SHA-256 of the definition bytes, a NUL byte and the script bytes. */
28
+ sha256Hash: string;
29
+ };
30
+ export type ResolveActionRequest = {
31
+ version: number;
32
+ /**
33
+ * Pins the exact definition and script: a different server hash answers
34
+ * 409 (`IntentsConnectActionsApiError.isHashMismatch`) before the script runs.
35
+ */
36
+ expectedSha256Hash?: string;
37
+ inputs: Record<string, unknown>;
38
+ };
39
+ /**
40
+ * The execution creation body an action resolves to. A body with `quote` goes
41
+ * to `POST /api/v1/executions/{wallet}` (bridge-in, or an out-operation with
42
+ * `outOperation: true`); one with a top-level `destinationAsset` goes to
43
+ * `/steps`. Backend placeholders such as `{INTERMEDIARY}` and
44
+ * `{MIN_AMOUNT_OUT}` are left in for creation to substitute.
45
+ */
46
+ export type ResolvedExecution = {
47
+ version: '1.0';
48
+ type: ExecutionType;
49
+ quote?: QuoteRequest;
50
+ destinationAsset?: string;
51
+ outOperation?: boolean;
52
+ dry?: boolean;
53
+ metadata?: ExecutionMetadata;
54
+ steps: ExecutionStep[];
55
+ addressLookupTables?: string[];
56
+ publicKey?: string;
57
+ };
58
+ /** `POST /api/v1/actions/{id}/resolve`. */
59
+ export type ActionResolution = {
60
+ actionId: string;
61
+ version: number;
62
+ /** Derived by the server from the execution's asset. */
63
+ executionChain: string;
64
+ actionSha256Hash: string;
65
+ execution: ResolvedExecution;
66
+ };
67
+ export type IntentsConnectActionsApi = {
68
+ listActions: () => Promise<ActionCatalogEntry[]>;
69
+ resolveAction: (actionId: string, request: ResolveActionRequest) => Promise<ActionResolution>;
70
+ };