@aurora-is-near/intents-connect 7.20.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 +176 -0
- package/dist/api/createIntentsConnectApi.d.ts +31 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/types.d.ts +93 -0
- package/dist/chains.d.ts +27 -0
- package/dist/chunks/recovery-BBQaAcqE.js +1034 -0
- package/dist/chunks/recovery-BBQaAcqE.js.map +1 -0
- package/dist/errors.d.ts +94 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +7 -0
- package/dist/machine/context.d.ts +39 -0
- package/dist/machine/guards/checks/amountMustExceedFee.d.ts +2 -0
- package/dist/machine/guards/checks/destinationTokenIsTouched.d.ts +12 -0
- package/dist/machine/guards/checks/feeMustBeEstimated.d.ts +9 -0
- package/dist/machine/guards/checks/memoPresentForStellar.d.ts +6 -0
- package/dist/machine/guards/checks/mustBeSignedBeforeDeposit.d.ts +8 -0
- package/dist/machine/guards/checks/mustHaveSigningPayload.d.ts +7 -0
- package/dist/machine/guards/checks/noExecutionInFlight.d.ts +7 -0
- package/dist/machine/guards/checks/originNetworkMatches.d.ts +5 -0
- package/dist/machine/guards/checks/publicKeyMatchesStandard.d.ts +7 -0
- package/dist/machine/guards/checks/quoteMustNotHaveMoved.d.ts +8 -0
- package/dist/machine/guards/checks/recipientOnlyOnOutOperation.d.ts +11 -0
- package/dist/machine/guards/checks/round1MustBeStepless.d.ts +8 -0
- package/dist/machine/guards/checks/stepShapeIsLegal.d.ts +7 -0
- package/dist/machine/guards/checks/stepsRequiredForRealCreate.d.ts +6 -0
- package/dist/machine/guards/checks/strategiesAreExclusive.d.ts +17 -0
- package/dist/machine/guards/index.d.ts +19 -0
- package/dist/machine/index.d.ts +4 -0
- package/dist/machine/machine.d.ts +50 -0
- package/dist/machine/phases.d.ts +48 -0
- package/dist/react/IntentsConnectProvider.d.ts +12 -0
- package/dist/react/context.d.ts +12 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +149 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/useExecution.d.ts +42 -0
- package/dist/recovery.d.ts +27 -0
- package/dist/runner/createExecutionRunner.d.ts +2 -0
- package/dist/runner/index.d.ts +2 -0
- package/dist/runner/types.d.ts +146 -0
- package/dist/signers/index.d.ts +2 -0
- package/dist/signers/intentsConnect.d.ts +43 -0
- package/dist/signers/standards/encoding.d.ts +15 -0
- package/dist/signers/standards/erc191.d.ts +18 -0
- package/dist/signers/standards/index.d.ts +12 -0
- package/dist/signers/standards/nep413.d.ts +22 -0
- package/dist/signers/standards/rawEd25519.d.ts +20 -0
- package/dist/signers/standards/sep53.d.ts +22 -0
- package/dist/types/execution.d.ts +133 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/providers.d.ts +63 -0
- package/dist/types/recipe.d.ts +38 -0
- package/dist/types/signing.d.ts +70 -0
- package/dist/types/transfer.d.ts +60 -0
- package/dist/types/wallet.d.ts +53 -0
- package/package.json +54 -0
- package/react/package.json +8 -0
- package/src/api/createIntentsConnectApi.test.ts +146 -0
- package/src/api/createIntentsConnectApi.ts +263 -0
- package/src/api/generated/conformance.ts +233 -0
- package/src/api/generated/openapi.ts +995 -0
- package/src/api/index.ts +17 -0
- package/src/api/types.ts +138 -0
- package/src/chains.ts +103 -0
- package/src/errors.ts +234 -0
- package/src/index.ts +73 -0
- package/src/logger.ts +21 -0
- package/src/machine/context.ts +56 -0
- package/src/machine/guards/checks/amountMustExceedFee.ts +14 -0
- package/src/machine/guards/checks/destinationTokenIsTouched.ts +31 -0
- package/src/machine/guards/checks/feeMustBeEstimated.ts +22 -0
- package/src/machine/guards/checks/memoPresentForStellar.ts +20 -0
- package/src/machine/guards/checks/mustBeSignedBeforeDeposit.ts +17 -0
- package/src/machine/guards/checks/mustHaveSigningPayload.ts +19 -0
- package/src/machine/guards/checks/noExecutionInFlight.ts +19 -0
- package/src/machine/guards/checks/originNetworkMatches.ts +23 -0
- package/src/machine/guards/checks/publicKeyMatchesStandard.ts +28 -0
- package/src/machine/guards/checks/quoteMustNotHaveMoved.ts +20 -0
- package/src/machine/guards/checks/recipientOnlyOnOutOperation.ts +23 -0
- package/src/machine/guards/checks/round1MustBeStepless.ts +17 -0
- package/src/machine/guards/checks/stepShapeIsLegal.ts +79 -0
- package/src/machine/guards/checks/stepsRequiredForRealCreate.ts +12 -0
- package/src/machine/guards/checks/strategiesAreExclusive.ts +35 -0
- package/src/machine/guards/guards.test.ts +317 -0
- package/src/machine/guards/index.ts +22 -0
- package/src/machine/index.ts +15 -0
- package/src/machine/machine.test.ts +131 -0
- package/src/machine/machine.ts +113 -0
- package/src/machine/phases.ts +81 -0
- package/src/react/IntentsConnectProvider.tsx +61 -0
- package/src/react/context.ts +34 -0
- package/src/react/index.ts +14 -0
- package/src/react/useExecution.test.tsx +281 -0
- package/src/react/useExecution.ts +246 -0
- package/src/recovery.test.ts +44 -0
- package/src/recovery.ts +45 -0
- package/src/runner/createExecutionRunner.test.ts +1388 -0
- package/src/runner/createExecutionRunner.ts +1156 -0
- package/src/runner/index.ts +9 -0
- package/src/runner/types.ts +148 -0
- package/src/signers/index.ts +7 -0
- package/src/signers/intentsConnect.ts +210 -0
- package/src/signers/signers.test.ts +415 -0
- package/src/signers/standards/encoding.ts +89 -0
- package/src/signers/standards/erc191.ts +61 -0
- package/src/signers/standards/index.ts +20 -0
- package/src/signers/standards/nep413.ts +84 -0
- package/src/signers/standards/rawEd25519.ts +46 -0
- package/src/signers/standards/sep53.ts +74 -0
- package/src/tests/setup.ts +4 -0
- package/src/types/execution.ts +177 -0
- package/src/types/index.ts +6 -0
- package/src/types/providers.ts +71 -0
- package/src/types/recipe.ts +41 -0
- package/src/types/signing.ts +99 -0
- package/src/types/transfer.ts +90 -0
- package/src/types/wallet.ts +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# @aurora-is-near/intents-connect
|
|
2
|
+
|
|
3
|
+
Headless client for the Aurora **Intents Connect** execution API: bridge any
|
|
4
|
+
asset from any chain, then execute contract calls on the destination chain from
|
|
5
|
+
a service-controlled *intermediary* account.
|
|
6
|
+
|
|
7
|
+
No React, no chain SDKs. Its only runtime dependencies are `valtio-fsm` and
|
|
8
|
+
`@scure/base`.
|
|
9
|
+
|
|
10
|
+
## What it does for you
|
|
11
|
+
|
|
12
|
+
A new integration is a **step builder**. Everything else — intermediary
|
|
13
|
+
resolution, fee arithmetic, the four signing standards, deposit routing,
|
|
14
|
+
polling, 409 and expiry recovery — is handled here.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {
|
|
18
|
+
createIntentsConnectApi,
|
|
19
|
+
createExecutionRunner,
|
|
20
|
+
type Recipe,
|
|
21
|
+
} from '@aurora-is-near/intents-connect';
|
|
22
|
+
|
|
23
|
+
const USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
|
|
24
|
+
|
|
25
|
+
// `amount` is opaque — a literal atomic string, or the {MIN_AMOUNT_OUT}
|
|
26
|
+
// placeholder. Template it; never inspect it. That is what lets one builder
|
|
27
|
+
// serve both fee strategies.
|
|
28
|
+
const supply: Recipe<{ pool: string }> = {
|
|
29
|
+
id: 'aave-supply',
|
|
30
|
+
intent: 'aave_supply',
|
|
31
|
+
title: 'Supply to Aave',
|
|
32
|
+
flow: 'bridge-in',
|
|
33
|
+
type: 'evm',
|
|
34
|
+
destination: { chain: 'base', assetId: 'nep141:base-…', tokenAddress: USDC },
|
|
35
|
+
buildSteps: ({ intermediary, amount }, { pool }) => [
|
|
36
|
+
{ to: USDC, functionSignature: 'approve(address,uint256)',
|
|
37
|
+
parameters: [pool, amount], value: '0' },
|
|
38
|
+
{ to: pool, functionSignature: 'supply(address,uint256,address,uint16)',
|
|
39
|
+
parameters: [USDC, amount, intermediary, '0'], value: '0' },
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const runner = createExecutionRunner({
|
|
44
|
+
api: createIntentsConnectApi({ baseUrl, apiKeyProxyUrl }),
|
|
45
|
+
wallet: connector,
|
|
46
|
+
onEvent: (event) => console.log(event),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await runner.run({
|
|
50
|
+
recipe: supply,
|
|
51
|
+
params: { pool: '0x…' },
|
|
52
|
+
quote: { originAsset, destinationAsset, amount, swapType: 'EXACT_INPUT', slippageTolerance: 100 },
|
|
53
|
+
originChain: 'base',
|
|
54
|
+
originToken: { contractAddress: USDC, decimals: 6 },
|
|
55
|
+
depositViaWallet: true,
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Lifecycle
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
idle → resolving-identity → planning → creating → awaiting-signature → submitting
|
|
63
|
+
│
|
|
64
|
+
┌───────────────────────────────┤
|
|
65
|
+
▼ ▼
|
|
66
|
+
awaiting-deposit ───────────────────► settling
|
|
67
|
+
│ │
|
|
68
|
+
└──► expired ──┐ ▼
|
|
69
|
+
└────► success | failed
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Two phases behave in non-obvious ways:
|
|
73
|
+
|
|
74
|
+
- **Signing happens before the deposit.** The service holds a pre-signed batch
|
|
75
|
+
and fires it when the bridge settles. A deposit address is therefore never
|
|
76
|
+
exposed until the signature is submitted — enforced by a guard.
|
|
77
|
+
- **`expired` is not terminal.** A deposit that settles late revives an
|
|
78
|
+
execution straight to `OPERATION_PROCESSING`, so polling continues.
|
|
79
|
+
|
|
80
|
+
## Fee strategies
|
|
81
|
+
|
|
82
|
+
The gas fee is charged in the *destination* token and the backend appends its own
|
|
83
|
+
fee-transfer step, so `spendable + networkFee ≤ quote.minAmountOut`. That is
|
|
84
|
+
circular — the amount depends on the fee, the fee on the steps, the steps on the
|
|
85
|
+
amount. Two ways out:
|
|
86
|
+
|
|
87
|
+
| | `{ kind: 'placeholder' }` (default) | `{ kind: 'threeRound' }` |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| Create calls | 1 | 3 (dry, dry, real) |
|
|
90
|
+
| Who sizes the amount | the service | you |
|
|
91
|
+
| Exact figure before signing | no | yes, via the `quoted` event |
|
|
92
|
+
|
|
93
|
+
## Wallets
|
|
94
|
+
|
|
95
|
+
`WalletConnector` is the only wallet seam. Bring your own, or use a
|
|
96
|
+
`@aurora-is-near/intents-connect-wallet-*` package. It supplies the address,
|
|
97
|
+
signing standard, providers, and the deposit transfer.
|
|
98
|
+
|
|
99
|
+
Signing standards implemented: `erc191`, `raw_ed25519`, `nep413`, `sep53`.
|
|
100
|
+
`tip191` (Tron) and `ton_connect` (TON) are not yet covered.
|
|
101
|
+
|
|
102
|
+
## Guards
|
|
103
|
+
|
|
104
|
+
Every protocol precondition is a named guard throwing a `GuardError` with a
|
|
105
|
+
`GuardCode` — `FEE_NOT_ESTIMATED`, `QUOTE_MOVED`,
|
|
106
|
+
`DEPOSIT_BEFORE_SIGNATURE`, `EXECUTION_IN_FLIGHT`, `MEMO_REQUIRED` and others.
|
|
107
|
+
They exist so the failure names the cause instead of surfacing an opaque 400.
|
|
108
|
+
|
|
109
|
+
## Keeping up with the API
|
|
110
|
+
|
|
111
|
+
The wire contract is pinned against the live OpenAPI document:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
yarn generate:api # refresh src/api/generated/openapi.ts
|
|
115
|
+
yarn typecheck # conformance assertions fail if the contract drifted
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The generated file is committed and is **not** part of the public API — none of
|
|
119
|
+
the 26 schemas declare `required`, so every generated field is optional and
|
|
120
|
+
exposing them would erase the invariants the guards enforce. Instead
|
|
121
|
+
`src/api/generated/conformance.ts` asserts our hand-written types still match,
|
|
122
|
+
with errors that name what moved:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Type '"OPERATION_REFUNDED"' does not satisfy the constraint 'never'
|
|
126
|
+
Type '"depositAddress"' does not satisfy the constraint 'never'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Point it at another environment with
|
|
130
|
+
`INTENTS_CONNECT_OPENAPI_URL=<url> yarn generate:api`.
|
|
131
|
+
|
|
132
|
+
One deviation is pinned deliberately: the document types step `parameters` as
|
|
133
|
+
`array` of `object`, which generates an uninhabited element type. Parameters are
|
|
134
|
+
ABI scalars, so `Step['parameters']` stays `string[]` and the assertion starts
|
|
135
|
+
failing once the spec is corrected.
|
|
136
|
+
|
|
137
|
+
## React
|
|
138
|
+
|
|
139
|
+
The bindings ship in this package under the `/react` subpath — the root export
|
|
140
|
+
stays headless and never resolves `react`:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { createExecutionRunner } from '@aurora-is-near/intents-connect';
|
|
144
|
+
import {
|
|
145
|
+
IntentsConnectProvider,
|
|
146
|
+
useExecution,
|
|
147
|
+
} from '@aurora-is-near/intents-connect/react';
|
|
148
|
+
|
|
149
|
+
<IntentsConnectProvider api={api} wallet={connector}>
|
|
150
|
+
<Deposit />
|
|
151
|
+
</IntentsConnectProvider>;
|
|
152
|
+
|
|
153
|
+
function Deposit() {
|
|
154
|
+
const { phase, depositAddress, isBusy, run } = useExecution();
|
|
155
|
+
// `depositAddress` is only ever set after the signature is submitted, so a QR
|
|
156
|
+
// rendered from it cannot get the ordering wrong.
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`react` is an **optional** peer dependency, so a Node, worker or CLI consumer
|
|
161
|
+
installs nothing extra and importing the root works without React present.
|
|
162
|
+
|
|
163
|
+
Notes:
|
|
164
|
+
|
|
165
|
+
- A runner is created **per `useExecution` call**, not per provider, so two
|
|
166
|
+
concurrent executions never share a machine.
|
|
167
|
+
- State is read through valtio's `useSnapshot`, so a component only re-renders
|
|
168
|
+
for fields it actually reads.
|
|
169
|
+
- `run`, `resume` and `cancel` always **reject** rather than throwing
|
|
170
|
+
synchronously, so `run(plan).catch(…)` behaves.
|
|
171
|
+
|
|
172
|
+
## Wallets
|
|
173
|
+
|
|
174
|
+
Deposit transfers and wallet connection live in
|
|
175
|
+
[`@aurora-is-near/intents-connect-wallet`](../intents-connect-wallet), one
|
|
176
|
+
subpath per chain.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IntentsConnectApi } from './types';
|
|
2
|
+
export type FetchLike = (input: string, init?: {
|
|
3
|
+
method?: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
body?: string;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
ok: boolean;
|
|
9
|
+
status: number;
|
|
10
|
+
text: () => Promise<string>;
|
|
11
|
+
}>;
|
|
12
|
+
export type IntentsConnectApiOptions = {
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
/**
|
|
15
|
+
* Sent as `x-api-key` on create calls.
|
|
16
|
+
*
|
|
17
|
+
* Prefer `apiKeyProxyUrl` in a browser: the key prices per-key fees
|
|
18
|
+
* server-side and should not ship in client code.
|
|
19
|
+
*/
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Base URL of your own server that injects `x-api-key` and forwards to the
|
|
23
|
+
* Intents Connect API. When set, create calls go here instead of `baseUrl`.
|
|
24
|
+
*/
|
|
25
|
+
apiKeyProxyUrl?: string;
|
|
26
|
+
/** Defaults to global `fetch`. */
|
|
27
|
+
fetch?: FetchLike;
|
|
28
|
+
/** Milliseconds. Defaults to 30_000. */
|
|
29
|
+
timeout?: number;
|
|
30
|
+
};
|
|
31
|
+
export declare const createIntentsConnectApi: (options: IntentsConnectApiOptions) => IntentsConnectApi;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createIntentsConnectApi } from './createIntentsConnectApi';
|
|
2
|
+
export type { FetchLike, IntentsConnectApiOptions, } from './createIntentsConnectApi';
|
|
3
|
+
export type { CreateExecutionBody, CreateStepsExecutionBody, ExecutionMetadata, IntentsConnectApi, ListExecutionsQuery, RecordDepositBody, SubmitSignatureBody, SupportedToken, SupportedTokensFlow, SupportedTokensResult, } from './types';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Execution, ExecutionStatus, ExecutionType, Intermediary, QuoteRequest, Step, SubmitStatus } from '../types/execution';
|
|
2
|
+
import { DeleteSignatureEnvelope, SignatureEnvelope } from '../types/signing';
|
|
3
|
+
export type ExecutionMetadata = {
|
|
4
|
+
title: string;
|
|
5
|
+
intent: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type CreateExecutionBody = {
|
|
10
|
+
version: '1.0';
|
|
11
|
+
type: ExecutionType;
|
|
12
|
+
quote: QuoteRequest;
|
|
13
|
+
steps: Step[];
|
|
14
|
+
metadata: ExecutionMetadata;
|
|
15
|
+
dry: boolean;
|
|
16
|
+
outOperation?: boolean;
|
|
17
|
+
/** Required for a TON origin — a TON address cannot yield its public key. */
|
|
18
|
+
publicKey?: string;
|
|
19
|
+
};
|
|
20
|
+
export type SubmitSignatureBody = SignatureEnvelope & {
|
|
21
|
+
executionId: string;
|
|
22
|
+
};
|
|
23
|
+
export type RecordDepositBody = {
|
|
24
|
+
txHash: string;
|
|
25
|
+
depositAddress: string;
|
|
26
|
+
/** Required for MEMO-mode origins (Stellar) — a 404 without it. */
|
|
27
|
+
memo?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Steps-only execution: no 1Click quote — the intermediary is expected to
|
|
31
|
+
* already hold the destination token. Non-dry responses carry a signing
|
|
32
|
+
* payload in `details`, exactly like a bridge-in create.
|
|
33
|
+
*/
|
|
34
|
+
export type CreateStepsExecutionBody = {
|
|
35
|
+
version: '1.0';
|
|
36
|
+
/** Defaults to `evm` server-side when omitted. */
|
|
37
|
+
type?: ExecutionType;
|
|
38
|
+
/** 1Click asset id of the destination token. */
|
|
39
|
+
destinationAsset?: string;
|
|
40
|
+
steps: Step[];
|
|
41
|
+
metadata?: ExecutionMetadata;
|
|
42
|
+
dry: boolean;
|
|
43
|
+
/** Solana destinations only — base58 Address Lookup Table accounts. */
|
|
44
|
+
addressLookupTables?: string[];
|
|
45
|
+
/** Required for a TON origin — a TON address cannot yield its public key. */
|
|
46
|
+
publicKey?: string;
|
|
47
|
+
};
|
|
48
|
+
export type SupportedToken = {
|
|
49
|
+
assetId?: string;
|
|
50
|
+
blockchain?: string;
|
|
51
|
+
contractAddress?: string;
|
|
52
|
+
decimals?: number;
|
|
53
|
+
price?: number;
|
|
54
|
+
priceUpdatedAt?: string;
|
|
55
|
+
symbol?: string;
|
|
56
|
+
};
|
|
57
|
+
export type SupportedTokensResult = {
|
|
58
|
+
in?: SupportedToken[];
|
|
59
|
+
out?: SupportedToken[];
|
|
60
|
+
};
|
|
61
|
+
export type SupportedTokensFlow = 'inOperation' | 'outOperation';
|
|
62
|
+
export type ListExecutionsQuery = {
|
|
63
|
+
id?: string;
|
|
64
|
+
/**
|
|
65
|
+
* A single status or several. The API accepts a comma-separated list, which is
|
|
66
|
+
* what lets one call cover every status holding the in-flight lock.
|
|
67
|
+
*/
|
|
68
|
+
status?: ExecutionStatus | readonly ExecutionStatus[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The full call surface of the Intents Connect API.
|
|
72
|
+
*
|
|
73
|
+
* `x-api-key` is attached to the create calls only. It fetches a 1Click quote
|
|
74
|
+
* and prices per-key fees, so it is required on every create round — dry or
|
|
75
|
+
* not — and is neither required nor sent on the others.
|
|
76
|
+
*/
|
|
77
|
+
export type IntentsConnectApi = {
|
|
78
|
+
getIntermediary: (wallet: string, options?: {
|
|
79
|
+
publicKey?: string;
|
|
80
|
+
}) => Promise<Intermediary>;
|
|
81
|
+
createExecution: (wallet: string, body: CreateExecutionBody) => Promise<Execution>;
|
|
82
|
+
/** Steps-only execution — spends the intermediary's existing balance. */
|
|
83
|
+
createStepsExecution: (wallet: string, body: CreateStepsExecutionBody) => Promise<Execution>;
|
|
84
|
+
/** Token lists the API currently supports, cached server-side from 1Click. */
|
|
85
|
+
listSupportedTokens: (flow?: SupportedTokensFlow) => Promise<SupportedTokensResult>;
|
|
86
|
+
submitSignature: (wallet: string, body: SubmitSignatureBody) => Promise<{
|
|
87
|
+
status: SubmitStatus;
|
|
88
|
+
}>;
|
|
89
|
+
recordDeposit: (body: RecordDepositBody) => Promise<void>;
|
|
90
|
+
/** The API answers with an ARRAY even when filtering by a single id. */
|
|
91
|
+
listExecutions: (wallet: string, query?: ListExecutionsQuery) => Promise<Execution[]>;
|
|
92
|
+
deleteExecution: (wallet: string, executionId: string, signature: DeleteSignatureEnvelope) => Promise<void>;
|
|
93
|
+
};
|
package/dist/chains.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain-family routing. Mirrors `packages/intents-swap-widget/src/utils/chains`
|
|
3
|
+
* but carries only what deposit routing needs — no chain SDKs.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EVM_CHAINS: Set<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Numeric EVM chain ids for the chains above. Used by `resume()` to rebuild a
|
|
8
|
+
* deposit transfer from an execution alone — the EVM transfer path refuses to
|
|
9
|
+
* run without a target chain id. Mirrors the widget's `EVM_CHAIN_IDS_MAP`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EVM_CHAIN_IDS: Record<string, number>;
|
|
12
|
+
export type ChainFamily = 'evm' | 'sol' | 'stellar' | 'near';
|
|
13
|
+
/**
|
|
14
|
+
* Decodes the origin chain and token address baked into a bridged asset id:
|
|
15
|
+
* `nep141:gnosis-0x2a22….omft.near` → `{ chain: 'gnosis', tokenAddress: '0x2a22…' }`,
|
|
16
|
+
* `nep141:base.omft.near` → `{ chain: 'base' }` (the chain's native asset).
|
|
17
|
+
*
|
|
18
|
+
* Returns `undefined` for anything that is not an `*.omft.near` bridged form
|
|
19
|
+
* (NEAR-native nep141 tokens, nep245 multi-tokens) — callers must treat that
|
|
20
|
+
* as "origin unknown", not as an error.
|
|
21
|
+
*/
|
|
22
|
+
export declare const parseOriginAsset: (assetId: string) => {
|
|
23
|
+
chain: string;
|
|
24
|
+
tokenAddress?: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
export declare const isEvmChain: (chain: string) => boolean;
|
|
27
|
+
export declare const getChainFamily: (chain: string) => ChainFamily | undefined;
|