@lifi/compose-spec 0.4.1 → 0.5.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 +1 -1
- package/dist/index.cjs +37 -33
- package/dist/index.d.cts +88 -45
- package/dist/index.d.ts +88 -45
- package/dist/index.js +36 -30
- package/package.json +3 -10
- package/src/compile.ts +87 -21
- package/src/constructors.ts +1 -7
- package/src/continuation.ts +9 -9
- package/src/flowSchema.ts +0 -7
- package/src/index.ts +12 -6
- package/src/ref.ts +33 -0
- package/src/resource.ts +5 -0
- package/src/route.ts +22 -10
- package/src/zodSchemas.ts +4 -13
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install @lifi/compose-spec
|
|
|
16
16
|
- **Resource types** — `Resource`, `Availability`, `OutputAmount`, `SimulatedAmounts`, plus helpers like `erc20Token`, `foldResource`, `resourceKey`
|
|
17
17
|
- **Manifest types** — `ComposeManifest`, `ManifestOperation`, `ManifestGuard`, `ManifestMaterialiser`, `ManifestPrecondition`
|
|
18
18
|
- **Port types** — `ResourcePort`, `HandlePort`, `OpInputPort`, `OpOutputPort`, and type guards
|
|
19
|
-
- **Ref utilities** — `parseRef`, `foldRef`, `refKey` for working with flow references
|
|
19
|
+
- **Ref utilities** — `ref` to build bind refs (`ref.input('amount')`, `ref.context.sender`, `ref('nodeId.port')`), plus `parseRef`, `foldRef`, `refKey` for working with flow references
|
|
20
20
|
- **Constructors** — `linear`, `copy`, `handle`, `native`, `erc20`, `resource`, `readResource`, `opHandle`, `resourceOutput`
|
|
21
21
|
- **Zod schemas** — Runtime validation for manifests, ports, guards, and operations
|
|
22
22
|
- **Effect schemas** — `FlowSchema`, `ResourceSchema`, `CallSchema`, etc. for flow document validation
|
package/dist/index.cjs
CHANGED
|
@@ -50,7 +50,6 @@ __export(index_exports, {
|
|
|
50
50
|
ContinuationOutcomeSchema: () => ContinuationOutcomeSchema,
|
|
51
51
|
ContinuationPlanSchema: () => ContinuationPlanSchema,
|
|
52
52
|
ContinuationPlanZod: () => ContinuationPlanZod,
|
|
53
|
-
ContinuationSchema: () => ContinuationSchema,
|
|
54
53
|
EVM_NATIVE_SENTINEL: () => EVM_NATIVE_SENTINEL,
|
|
55
54
|
Erc20BalanceDeltaGteSpecSchema: () => Erc20BalanceDeltaGteSpecSchema,
|
|
56
55
|
Erc20BalanceGteSpecSchema: () => Erc20BalanceGteSpecSchema,
|
|
@@ -106,7 +105,6 @@ __export(index_exports, {
|
|
|
106
105
|
foldResource: () => foldResource,
|
|
107
106
|
getChainCapabilities: () => getChainCapabilities,
|
|
108
107
|
handle: () => handle,
|
|
109
|
-
inputRef: () => inputRef,
|
|
110
108
|
isAsErc20Chain: () => isAsErc20Chain,
|
|
111
109
|
isContextKey: () => isContextKey,
|
|
112
110
|
isEQCheck: () => isEQCheck,
|
|
@@ -133,11 +131,11 @@ __export(index_exports, {
|
|
|
133
131
|
normalizeNativeTokenAddress: () => normalizeNativeTokenAddress,
|
|
134
132
|
normalizeResource: () => normalizeResource,
|
|
135
133
|
opHandle: () => opHandle,
|
|
136
|
-
outputRef: () => outputRef,
|
|
137
134
|
parseRef: () => parseRef,
|
|
138
135
|
providerKindByName: () => providerKindByName,
|
|
139
136
|
providerKindNames: () => providerKindNames,
|
|
140
137
|
readResource: () => readResource,
|
|
138
|
+
ref: () => ref,
|
|
141
139
|
refKey: () => refKey,
|
|
142
140
|
resource: () => resource,
|
|
143
141
|
resourceKey: () => resourceKey,
|
|
@@ -275,17 +273,12 @@ var CallSchema = import_effect.Schema.Struct({
|
|
|
275
273
|
),
|
|
276
274
|
guards: import_effect.Schema.optional(import_effect.Schema.Array(AppliedGuardSchema))
|
|
277
275
|
});
|
|
278
|
-
var ContinuationSchema = import_effect.Schema.Struct({
|
|
279
|
-
awaits: import_effect.Schema.String,
|
|
280
|
-
flowId: import_effect.Schema.String
|
|
281
|
-
});
|
|
282
276
|
var FlowSchema = import_effect.Schema.Struct({
|
|
283
277
|
version: import_effect.Schema.Literal(1),
|
|
284
278
|
id: import_effect.Schema.String,
|
|
285
279
|
chainId: ChainIdSchema,
|
|
286
280
|
inputs: import_effect.Schema.Array(FlowInputSchema),
|
|
287
|
-
nodes: import_effect.Schema.Array(CallSchema)
|
|
288
|
-
continuations: import_effect.Schema.optional(import_effect.Schema.Array(ContinuationSchema))
|
|
281
|
+
nodes: import_effect.Schema.Array(CallSchema)
|
|
289
282
|
});
|
|
290
283
|
|
|
291
284
|
// src/continuation.ts
|
|
@@ -315,16 +308,21 @@ var ContinuationIntentSchema = import_effect2.Schema.Struct({
|
|
|
315
308
|
continuationFlow: import_effect2.Schema.optional(FlowSchema),
|
|
316
309
|
validity: import_effect2.Schema.Struct({ expiresAtMs: import_effect2.Schema.Number }),
|
|
317
310
|
perpetual: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
318
|
-
provider: import_effect2.Schema.optional(import_effect2.Schema.String)
|
|
311
|
+
provider: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
312
|
+
// Funding-path mode. The HTTP wire contract is documented by
|
|
313
|
+
// `ComposeActionsSchema` in `@lifi/api-schemas`.
|
|
314
|
+
funding: import_effect2.Schema.optional(import_effect2.Schema.Literal("inline", "external"))
|
|
319
315
|
});
|
|
320
316
|
var Phase1ArtifactSchema = import_effect2.Schema.Union(
|
|
321
317
|
import_effect2.Schema.Struct({
|
|
322
318
|
kind: import_effect2.Schema.Literal("transaction"),
|
|
319
|
+
funding: import_effect2.Schema.Literal("inline", "external"),
|
|
323
320
|
transactionRequest: import_effect2.Schema.optional(
|
|
324
321
|
import_effect2.Schema.Struct({
|
|
325
322
|
to: import_effect2.Schema.String,
|
|
326
323
|
data: import_effect2.Schema.String,
|
|
327
|
-
value: import_effect2.Schema.String
|
|
324
|
+
value: import_effect2.Schema.String,
|
|
325
|
+
chainId: import_effect2.Schema.Number
|
|
328
326
|
})
|
|
329
327
|
)
|
|
330
328
|
}),
|
|
@@ -544,10 +542,6 @@ var providerKindByName = {
|
|
|
544
542
|
};
|
|
545
543
|
|
|
546
544
|
// src/constructors.ts
|
|
547
|
-
var inputRef = (port) => ({ $ref: `input.${port}` });
|
|
548
|
-
var outputRef = (node, port) => ({
|
|
549
|
-
$ref: `${node}.${port}`
|
|
550
|
-
});
|
|
551
545
|
var optionalProp = (key, value) => value !== void 0 && value !== null ? { [key]: value } : {};
|
|
552
546
|
var linear = (name, type) => ({
|
|
553
547
|
name,
|
|
@@ -614,12 +608,12 @@ var RESERVED_REF_SCOPES = /* @__PURE__ */ new Set([
|
|
|
614
608
|
"literal"
|
|
615
609
|
]);
|
|
616
610
|
var isRef = (v) => typeof v === "object" && v !== null && "$ref" in v && typeof v.$ref === "string";
|
|
617
|
-
var parseRef = (
|
|
618
|
-
const dot =
|
|
611
|
+
var parseRef = (ref2) => {
|
|
612
|
+
const dot = ref2.$ref.indexOf(".");
|
|
619
613
|
if (dot === -1)
|
|
620
|
-
throw new Error(`Invalid ref: "${
|
|
621
|
-
const prefix =
|
|
622
|
-
const suffix =
|
|
614
|
+
throw new Error(`Invalid ref: "${ref2.$ref}" (must contain a dot)`);
|
|
615
|
+
const prefix = ref2.$ref.slice(0, dot);
|
|
616
|
+
const suffix = ref2.$ref.slice(dot + 1);
|
|
623
617
|
if (prefix === "input") return { scope: "input", port: suffix };
|
|
624
618
|
if (prefix === "context") {
|
|
625
619
|
if (!isContextKey(suffix))
|
|
@@ -628,12 +622,28 @@ var parseRef = (ref) => {
|
|
|
628
622
|
}
|
|
629
623
|
return { scope: "output", node: prefix, port: suffix };
|
|
630
624
|
};
|
|
631
|
-
var
|
|
632
|
-
if (
|
|
633
|
-
|
|
634
|
-
|
|
625
|
+
var buildRef = (path) => {
|
|
626
|
+
if (path.indexOf(".") < 1)
|
|
627
|
+
throw new Error(
|
|
628
|
+
`Invalid ref: "${path}" (must be a dotpath like "input.name" or "nodeId.port")`
|
|
629
|
+
);
|
|
630
|
+
const built = { $ref: path };
|
|
631
|
+
parseRef(built);
|
|
632
|
+
return built;
|
|
633
|
+
};
|
|
634
|
+
var ref = Object.assign(buildRef, {
|
|
635
|
+
input: (port) => buildRef(`input.${port}`),
|
|
636
|
+
context: {
|
|
637
|
+
sender: buildRef("context.sender"),
|
|
638
|
+
executionAddress: buildRef("context.executionAddress")
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
var foldRef = (ref2, cases) => {
|
|
642
|
+
if (ref2.scope === "input") return cases.input(ref2.port);
|
|
643
|
+
if (ref2.scope === "context") return cases.context(ref2.key);
|
|
644
|
+
return cases.output(ref2.node, ref2.port);
|
|
635
645
|
};
|
|
636
|
-
var refKey = (
|
|
646
|
+
var refKey = (ref2) => foldRef(parseRef(ref2), {
|
|
637
647
|
input: (port) => `input:${port}`,
|
|
638
648
|
context: (key) => `context:${key}`,
|
|
639
649
|
output: (node, port) => `output:${node}:${port}`
|
|
@@ -794,11 +804,7 @@ var ComposeManifestZod = import_zod.default.object({
|
|
|
794
804
|
var Phase1ArtifactZod = import_zod.default.discriminatedUnion("kind", [
|
|
795
805
|
import_zod.default.object({
|
|
796
806
|
kind: import_zod.default.literal("transaction"),
|
|
797
|
-
|
|
798
|
-
to: import_zod.default.string(),
|
|
799
|
-
data: import_zod.default.string(),
|
|
800
|
-
value: import_zod.default.string()
|
|
801
|
-
}).optional()
|
|
807
|
+
funding: import_zod.default.enum(["inline", "external"])
|
|
802
808
|
}),
|
|
803
809
|
import_zod.default.object({
|
|
804
810
|
kind: import_zod.default.literal("signables"),
|
|
@@ -916,7 +922,6 @@ var ContinuationPlanZod = import_zod.default.object({
|
|
|
916
922
|
ContinuationOutcomeSchema,
|
|
917
923
|
ContinuationPlanSchema,
|
|
918
924
|
ContinuationPlanZod,
|
|
919
|
-
ContinuationSchema,
|
|
920
925
|
EVM_NATIVE_SENTINEL,
|
|
921
926
|
Erc20BalanceDeltaGteSpecSchema,
|
|
922
927
|
Erc20BalanceGteSpecSchema,
|
|
@@ -972,7 +977,6 @@ var ContinuationPlanZod = import_zod.default.object({
|
|
|
972
977
|
foldResource,
|
|
973
978
|
getChainCapabilities,
|
|
974
979
|
handle,
|
|
975
|
-
inputRef,
|
|
976
980
|
isAsErc20Chain,
|
|
977
981
|
isContextKey,
|
|
978
982
|
isEQCheck,
|
|
@@ -999,11 +1003,11 @@ var ContinuationPlanZod = import_zod.default.object({
|
|
|
999
1003
|
normalizeNativeTokenAddress,
|
|
1000
1004
|
normalizeResource,
|
|
1001
1005
|
opHandle,
|
|
1002
|
-
outputRef,
|
|
1003
1006
|
parseRef,
|
|
1004
1007
|
providerKindByName,
|
|
1005
1008
|
providerKindNames,
|
|
1006
1009
|
readResource,
|
|
1010
|
+
ref,
|
|
1007
1011
|
refKey,
|
|
1008
1012
|
resource,
|
|
1009
1013
|
resourceKey,
|
package/dist/index.d.cts
CHANGED
|
@@ -138,10 +138,6 @@ declare const CallSchema: Schema.Struct<{
|
|
|
138
138
|
readonly value: typeof Schema.Unknown;
|
|
139
139
|
}]>>>;
|
|
140
140
|
}>;
|
|
141
|
-
declare const ContinuationSchema: Schema.Struct<{
|
|
142
|
-
awaits: typeof Schema.String;
|
|
143
|
-
flowId: typeof Schema.String;
|
|
144
|
-
}>;
|
|
145
141
|
declare const FlowSchema: Schema.Struct<{
|
|
146
142
|
version: Schema.Literal<[1]>;
|
|
147
143
|
id: typeof Schema.String;
|
|
@@ -195,10 +191,6 @@ declare const FlowSchema: Schema.Struct<{
|
|
|
195
191
|
readonly value: typeof Schema.Unknown;
|
|
196
192
|
}]>>>;
|
|
197
193
|
}>>;
|
|
198
|
-
continuations: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
199
|
-
awaits: typeof Schema.String;
|
|
200
|
-
flowId: typeof Schema.String;
|
|
201
|
-
}>>>;
|
|
202
194
|
}>;
|
|
203
195
|
type SolType = typeof SolTypeSchema.Type;
|
|
204
196
|
type ResourceInput = typeof ResourceInputSchema.Type;
|
|
@@ -209,7 +201,6 @@ type LiteralBinding = typeof LiteralBindingSchema.Type;
|
|
|
209
201
|
type BindValue = typeof BindValueSchema.Type;
|
|
210
202
|
type AppliedGuard = typeof AppliedGuardSchema.Type;
|
|
211
203
|
type Call = typeof CallSchema.Type;
|
|
212
|
-
type Continuation = typeof ContinuationSchema.Type;
|
|
213
204
|
type Flow = typeof FlowSchema.Type;
|
|
214
205
|
|
|
215
206
|
declare const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
@@ -299,23 +290,22 @@ declare const ContinuationIntentSchema: Schema.Struct<{
|
|
|
299
290
|
readonly value: typeof Schema.Unknown;
|
|
300
291
|
}]>>>;
|
|
301
292
|
}>>;
|
|
302
|
-
continuations: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
303
|
-
awaits: typeof Schema.String;
|
|
304
|
-
flowId: typeof Schema.String;
|
|
305
|
-
}>>>;
|
|
306
293
|
}>>;
|
|
307
294
|
validity: Schema.Struct<{
|
|
308
295
|
expiresAtMs: typeof Schema.Number;
|
|
309
296
|
}>;
|
|
310
297
|
perpetual: Schema.optional<typeof Schema.Boolean>;
|
|
311
298
|
provider: Schema.optional<typeof Schema.String>;
|
|
299
|
+
funding: Schema.optional<Schema.Literal<["inline", "external"]>>;
|
|
312
300
|
}>;
|
|
313
301
|
declare const Phase1ArtifactSchema: Schema.Union<[Schema.Struct<{
|
|
314
302
|
kind: Schema.Literal<["transaction"]>;
|
|
303
|
+
funding: Schema.Literal<["inline", "external"]>;
|
|
315
304
|
transactionRequest: Schema.optional<Schema.Struct<{
|
|
316
305
|
to: typeof Schema.String;
|
|
317
306
|
data: typeof Schema.String;
|
|
318
307
|
value: typeof Schema.String;
|
|
308
|
+
chainId: typeof Schema.Number;
|
|
319
309
|
}>>;
|
|
320
310
|
}>, Schema.Struct<{
|
|
321
311
|
kind: Schema.Literal<["signables"]>;
|
|
@@ -500,10 +490,6 @@ declare const ContinuationPlanSchema: Schema.Struct<{
|
|
|
500
490
|
readonly value: typeof Schema.Unknown;
|
|
501
491
|
}]>>>;
|
|
502
492
|
}>>;
|
|
503
|
-
continuations: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
504
|
-
awaits: typeof Schema.String;
|
|
505
|
-
flowId: typeof Schema.String;
|
|
506
|
-
}>>>;
|
|
507
493
|
}>;
|
|
508
494
|
check: Schema.transform<Schema.Union<[Schema.Struct<{
|
|
509
495
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
@@ -795,6 +781,7 @@ type ProducedResource = Resource & {
|
|
|
795
781
|
readonly availability: Availability;
|
|
796
782
|
readonly simulated?: SimulatedAmounts;
|
|
797
783
|
readonly owner: string;
|
|
784
|
+
readonly etaSeconds?: number;
|
|
798
785
|
};
|
|
799
786
|
declare const erc20Resource: (token: string, chainId: number) => Resource;
|
|
800
787
|
declare const nativeResource: (chainId: number) => Resource;
|
|
@@ -1386,11 +1373,10 @@ declare const ComposeManifestZod: z.ZodObject<{
|
|
|
1386
1373
|
}, z.core.$strip>;
|
|
1387
1374
|
declare const Phase1ArtifactZod: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1388
1375
|
kind: z.ZodLiteral<"transaction">;
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
}, z.core.$strip>>;
|
|
1376
|
+
funding: z.ZodEnum<{
|
|
1377
|
+
inline: "inline";
|
|
1378
|
+
external: "external";
|
|
1379
|
+
}>;
|
|
1394
1380
|
}, z.core.$strip>, z.ZodObject<{
|
|
1395
1381
|
kind: z.ZodLiteral<"signables">;
|
|
1396
1382
|
typedData: z.ZodArray<z.ZodUnknown>;
|
|
@@ -1804,6 +1790,12 @@ interface ComposeRun {
|
|
|
1804
1790
|
readonly maxPriceImpactBps?: number;
|
|
1805
1791
|
readonly sweepTo?: SweepTo;
|
|
1806
1792
|
readonly simulationPolicy?: SimulationPolicy;
|
|
1793
|
+
/**
|
|
1794
|
+
* Also simulate the final user-facing transaction. Defaults to `false`;
|
|
1795
|
+
* reverts honour `simulationPolicy` and a success is echoed back as
|
|
1796
|
+
* `userProgramSimulation`.
|
|
1797
|
+
*/
|
|
1798
|
+
readonly simulateUserProgram?: boolean;
|
|
1807
1799
|
readonly checkOnChainAllowances?: boolean;
|
|
1808
1800
|
}
|
|
1809
1801
|
interface ComposeCompileRequest {
|
|
@@ -1840,34 +1832,56 @@ interface SimulationRevert {
|
|
|
1840
1832
|
}
|
|
1841
1833
|
interface ComposeTransactionRequest {
|
|
1842
1834
|
readonly to: string;
|
|
1835
|
+
readonly chainId: number;
|
|
1843
1836
|
readonly data: string;
|
|
1844
1837
|
readonly value: string;
|
|
1845
1838
|
readonly gasLimit?: string;
|
|
1846
1839
|
}
|
|
1847
|
-
interface
|
|
1848
|
-
readonly
|
|
1849
|
-
readonly
|
|
1840
|
+
interface ComposeAction {
|
|
1841
|
+
readonly kind: 'transaction';
|
|
1842
|
+
readonly purpose: 'approval' | 'execute' | 'fundEscrow';
|
|
1843
|
+
readonly submitter: 'signer' | 'anyone';
|
|
1844
|
+
readonly transactionRequest: ComposeTransactionRequest;
|
|
1845
|
+
readonly nodeId?: string;
|
|
1850
1846
|
}
|
|
1851
1847
|
interface ComposeContinuationData {
|
|
1852
|
-
readonly continuations?: readonly ComposeContinuation[];
|
|
1853
1848
|
readonly phase1ByNode?: Record<string, Phase1ArtifactWire>;
|
|
1854
1849
|
readonly continuationPlans?: Record<string, ContinuationPlanWire>;
|
|
1855
1850
|
}
|
|
1856
1851
|
interface SpendEntry {
|
|
1852
|
+
readonly input: string;
|
|
1857
1853
|
readonly token: string;
|
|
1854
|
+
readonly chainId: number;
|
|
1858
1855
|
readonly amount: string;
|
|
1856
|
+
readonly nodeId?: string;
|
|
1857
|
+
}
|
|
1858
|
+
interface ComposeFee {
|
|
1859
|
+
readonly input: string;
|
|
1860
|
+
readonly token: string;
|
|
1861
|
+
readonly recipient: 'lifi' | 'integrator';
|
|
1862
|
+
readonly recipientAddress: string;
|
|
1863
|
+
readonly bps: number;
|
|
1864
|
+
readonly amount?: string;
|
|
1865
|
+
}
|
|
1866
|
+
interface ComposeUserProgramSimulation {
|
|
1867
|
+
readonly status: 'ok';
|
|
1868
|
+
readonly returnData: string;
|
|
1869
|
+
}
|
|
1870
|
+
interface ComposeFill {
|
|
1871
|
+
readonly spends: readonly SpendEntry[];
|
|
1872
|
+
readonly validUntilMs?: number;
|
|
1859
1873
|
}
|
|
1860
1874
|
interface ComposeCompileSuccessData extends ComposeContinuationData {
|
|
1861
1875
|
readonly producedResources: Record<string, ProducedResource>;
|
|
1862
|
-
readonly transactionRequest
|
|
1876
|
+
readonly transactionRequest?: ComposeTransactionRequest;
|
|
1877
|
+
readonly actions?: readonly ComposeAction[];
|
|
1863
1878
|
readonly userProxy: string;
|
|
1864
1879
|
readonly priceImpact?: PriceImpact;
|
|
1865
1880
|
readonly approvals?: readonly ApprovalEntry[];
|
|
1866
|
-
readonly
|
|
1867
|
-
readonly
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
readonly verificationDescriptor?: VerificationDescriptor;
|
|
1881
|
+
readonly fees?: readonly ComposeFee[];
|
|
1882
|
+
readonly userProgramSimulation?: ComposeUserProgramSimulation;
|
|
1883
|
+
readonly fill?: ComposeFill;
|
|
1884
|
+
readonly verificationByNode?: Record<string, VerificationDescriptor>;
|
|
1871
1885
|
}
|
|
1872
1886
|
interface ComposeCompilePartialData extends ComposeContinuationData {
|
|
1873
1887
|
readonly producedResources: Record<string, ProducedResource>;
|
|
@@ -1875,6 +1889,9 @@ interface ComposeCompilePartialData extends ComposeContinuationData {
|
|
|
1875
1889
|
readonly userProxy: string;
|
|
1876
1890
|
readonly simulationRevert: SimulationRevert;
|
|
1877
1891
|
readonly approvals?: readonly ApprovalEntry[];
|
|
1892
|
+
readonly actions?: readonly ComposeAction[];
|
|
1893
|
+
readonly fees?: readonly ComposeFee[];
|
|
1894
|
+
readonly userProgramSimulation?: ComposeUserProgramSimulation;
|
|
1878
1895
|
}
|
|
1879
1896
|
type ComposeCompileResult = (ComposeCompileSuccessData & {
|
|
1880
1897
|
readonly status: 'success';
|
|
@@ -1963,8 +1980,6 @@ interface OpHandleOptions<Opt extends boolean = boolean> {
|
|
|
1963
1980
|
readonly units?: HandleUnits;
|
|
1964
1981
|
readonly optional?: Opt;
|
|
1965
1982
|
}
|
|
1966
|
-
declare const inputRef: (port: string) => Ref;
|
|
1967
|
-
declare const outputRef: (node: string, port: string) => Ref;
|
|
1968
1983
|
declare const linear: <N extends string, T extends SolType>(name: N, type: T) => Port & {
|
|
1969
1984
|
readonly name: N;
|
|
1970
1985
|
readonly type: T;
|
|
@@ -2037,6 +2052,22 @@ declare const isContextKey: (key: string) => key is ContextKey;
|
|
|
2037
2052
|
declare const RESERVED_REF_SCOPES: ReadonlySet<string>;
|
|
2038
2053
|
declare const isRef: (v: unknown) => v is Ref;
|
|
2039
2054
|
declare const parseRef: (ref: Ref) => ParsedRef;
|
|
2055
|
+
/** A ref path: a dotpath such as `input.amount` or `nodeId.port`. */
|
|
2056
|
+
type RefPath = `${string}.${string}`;
|
|
2057
|
+
/**
|
|
2058
|
+
* Builds a bind ref. `ref.input(port)` for a flow input, `ref.context.*` for a
|
|
2059
|
+
* context ref, and a dotpath for a node output (`ref('deposit.shares')`).
|
|
2060
|
+
* Prefer the named forms: `parseRef` reads an unrecognised prefix as a node id,
|
|
2061
|
+
* so a misspelled `input.`/`context.` silently becomes an output ref.
|
|
2062
|
+
*/
|
|
2063
|
+
interface RefBuilder {
|
|
2064
|
+
(path: RefPath): Ref;
|
|
2065
|
+
input(port: string): Ref;
|
|
2066
|
+
readonly context: {
|
|
2067
|
+
readonly [K in ContextKey]: Ref;
|
|
2068
|
+
};
|
|
2069
|
+
}
|
|
2070
|
+
declare const ref: RefBuilder;
|
|
2040
2071
|
declare const foldRef: <R>(ref: ParsedRef, cases: {
|
|
2041
2072
|
readonly input: (port: string) => R;
|
|
2042
2073
|
readonly context: (key: ContextKey) => R;
|
|
@@ -2154,16 +2185,18 @@ declare const normalizeNativeTokenAddress: (token: string, chainId: number) => s
|
|
|
2154
2185
|
* format is always a decimal string, which the SDK serialises for you.
|
|
2155
2186
|
*
|
|
2156
2187
|
* `/compose/route` trades authoring power for brevity. Instead of a full flow
|
|
2157
|
-
* document it takes a single from/to token pair; the server builds a
|
|
2158
|
-
*
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2188
|
+
* document it takes a single from/to token pair; the server builds a one-node
|
|
2189
|
+
* zap flow with a `directDeposit` input on the caller's behalf and runs it
|
|
2190
|
+
* through the same compile pipeline as `POST /compose`. It routes through
|
|
2191
|
+
* `lifi.zap` unless the pair is reachable only asynchronously and the request
|
|
2192
|
+
* set `allowAsyncRoutes`, in which case it uses `lifi.zapAsync`. As of today
|
|
2193
|
+
* the flow it builds is a single zap step — one edge of the server's routing
|
|
2194
|
+
* catalog — and it is meant to author richer flows later, which this request
|
|
2195
|
+
* shape is deliberately agnostic about. Its response body is byte-identical to
|
|
2196
|
+
* that of `POST /compose` — the enveloped `ComposeCompileSuccessData` on HTTP
|
|
2197
|
+
* 200 and `ComposeCompilePartialData` on HTTP 206 — so this file declares only
|
|
2198
|
+
* the request shape and reuses `ComposeCompileResult` from `./compile.js` for
|
|
2199
|
+
* the result.
|
|
2167
2200
|
*
|
|
2168
2201
|
* These are the single source of truth for the request shape, hand-authored
|
|
2169
2202
|
* here for the same reason as `./compile.ts` and `./simulate.ts` rather than
|
|
@@ -2269,6 +2302,16 @@ interface ComposeRouteRequest {
|
|
|
2269
2302
|
* omitting approvals that are already sufficient. Defaults to `false`.
|
|
2270
2303
|
*/
|
|
2271
2304
|
readonly checkOnChainAllowances?: boolean;
|
|
2305
|
+
/**
|
|
2306
|
+
* Accept a route whose output is delivered only after the initiating
|
|
2307
|
+
* transaction settles (`availability: 'future'` on the produced resource).
|
|
2308
|
+
* Such a route obliges you to track settlement rather than treat the
|
|
2309
|
+
* transaction as completing the job, and carries no slippage floor, so it is
|
|
2310
|
+
* opt-in. Defaults to `false` server-side, which leaves a pair reachable
|
|
2311
|
+
* only asynchronously rejected with `no_route_error` and guarantees every
|
|
2312
|
+
* produced resource is `availability: 'now'`.
|
|
2313
|
+
*/
|
|
2314
|
+
readonly allowAsyncRoutes?: boolean;
|
|
2272
2315
|
}
|
|
2273
2316
|
|
|
2274
2317
|
/**
|
|
@@ -2471,4 +2514,4 @@ declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, cases: {
|
|
|
2471
2514
|
readonly runtime: () => R;
|
|
2472
2515
|
}) => R;
|
|
2473
2516
|
|
|
2474
|
-
export { type AppliedGuard, AppliedGuardSchema, type ApprovalEntry, AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, type AssertedPredicate, AssertedPredicateSchema, type AssertedPredicateWire, AssertedPredicateZod, type AssertionOwner, AssertionOwnerSchema, type AssertionSpec, AssertionSpecSchema, type AssertionSpecWire, AssertionSpecZod, type Availability, type BindValue, BindValueSchema, Bytes32HexSchema, CONTINUATION_COMMITMENT_OP_ID, type Call, CallCheckSpecSchema, CallSchema, type ChainCapabilities, type Check, type CheckComparator, CheckSchema, CheckZod, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type
|
|
2517
|
+
export { type AppliedGuard, AppliedGuardSchema, type ApprovalEntry, AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, type AssertedPredicate, AssertedPredicateSchema, type AssertedPredicateWire, AssertedPredicateZod, type AssertionOwner, AssertionOwnerSchema, type AssertionSpec, AssertionSpecSchema, type AssertionSpecWire, AssertionSpecZod, type Availability, type BindValue, BindValueSchema, Bytes32HexSchema, CONTINUATION_COMMITMENT_OP_ID, type Call, CallCheckSpecSchema, CallSchema, type ChainCapabilities, type Check, type CheckComparator, CheckSchema, CheckZod, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorKind, type ComposeFee, type ComposeFill, type ComposeManifest, ComposeManifestZod, type ComposeRouteRequest, type ComposeRun, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ContextKey, type ContinuationIntent, ContinuationIntentSchema, type ContinuationOutcome, ContinuationOutcomeSchema, type ContinuationPlan, ContinuationPlanSchema, type ContinuationPlanWire, ContinuationPlanZod, EVM_NATIVE_SENTINEL, type Erc20AllowancePrecondition, type Erc20AllowanceRequirement, Erc20BalanceDeltaGteSpecSchema, Erc20BalanceGteSpecSchema, type Erc20BalancePrecondition, type Erc20BalanceRequirement, type FailedPreparedOp, type FlashloanMaterialiserInput, type Flow, type FlowInput, FlowInputSchema, FlowSchema, type GenericComposeError, type GenericComposeErrorKind, type GuardCompatibility, GuardCompatibilityZod, type GuardSelector, GuardSelectorZod, HANDLE_UNITS, type HandleInput, HandleInputSchema, type HandlePort, HandlePortZod, type HandleUnits, HandleUnitsZod, HexStringSchema, InputPortZod, type InputSpec, type LiteralBinding, LiteralBindingSchema, type ManifestGuard, ManifestGuardZod, type ManifestMaterialiser, ManifestMaterialiserZod, type ManifestOperation, ManifestOperationZod, type ManifestPrecondition, ManifestPreconditionZod, type MaterialiserConfigOf, type MaterialiserInput, type MaterialiserInputBase, type MaterialiserInputOf, type MaterialiserMetadata, type MaterialiserResolution, NativeBalanceDeltaGteSpecSchema, NativeBalanceGteSpecSchema, type NativeBalancePrecondition, type NativeBalanceRequirement, type NativeErc20, type OpInputPort, type OpOutputPort, type OutputAmount, OutputPortZod, PROVIDER_KIND, type ParsedRef, type Phase1Artifact, Phase1ArtifactSchema, type Phase1ArtifactWire, Phase1ArtifactZod, type Port, type Precondition, type PreconditionBase, type PreconditionConfigOf, type PreconditionOf, type PreparationComposeError, type PriceImpact, type ProducedResource, type ProviderKindName, RESERVED_REF_SCOPES, type Ref, type RefBuilder, type RefPath, RefSchema, type RefScope, type Resource, type ResourceInput, ResourceInputSchema, type ResourceOutputPort, ResourceOutputPortZod, type ResourcePort, ResourcePortZod, ResourceSchema, type RouteAmount, type RouteAmountAll, type RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, STATIC_SOL_TYPES, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulatedAmounts, type SimulationPolicy, type SimulationRevert, type SimulationRevertComposeError, type SlotFinderRequirement, type SolType, SolTypeSchema, type SpendEntry, type StaticSolType, StaticSolTypeZod, type SweepTo, TEMPO_CHAIN_ID, TEMPO_NATIVE_ERC20, type TrackedBalance, type VerificationDescriptor, VerificationDescriptorSchema, type VerificationDescriptorWire, VerificationDescriptorZod, canonicalAssertedPredicate, canonicalNativeAddress, copy, erc20, erc20Allowance, erc20Balance, erc20Resource, erc20Token, flowInputMode, flowInputResource, flowInputType, foldMaterialiserMetadata, foldRef, foldResource, getChainCapabilities, handle, isAsErc20Chain, isContextKey, isEQCheck, isERC20Resource, isErc20AllowancePrecondition, isFutureResourceOutput, isGTECheck, isHandlePort, isLTECheck, isMaterialiserInput, isMsgValueNative, isNativeAddressForChain, isNativeBalancePrecondition, isNativeResource, isRef, isResourceInput, isResourceOutputPort, isResourcePort, isStaticSolType, linear, native, nativeBalance, nativeResource, normalizeNativeTokenAddress, normalizeResource, opHandle, parseRef, providerKindByName, providerKindNames, readResource, ref, refKey, resource, resourceKey, resourceOutput, resourceToken, resourcesEqual };
|