@lifi/composer-sdk 0.6.3 → 0.7.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/dist/authoring/FlowBuilderCore.cjs +16 -3
- package/dist/authoring/FlowBuilderCore.cjs.map +1 -1
- package/dist/authoring/FlowBuilderCore.d.cts +12 -4
- package/dist/authoring/FlowBuilderCore.d.ts +12 -4
- package/dist/authoring/FlowBuilderCore.js +19 -3
- package/dist/authoring/FlowBuilderCore.js.map +1 -1
- package/dist/authoring/handles.cjs.map +1 -1
- package/dist/authoring/handles.d.cts +35 -1
- package/dist/authoring/handles.d.ts +35 -1
- package/dist/authoring/handles.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/generated/config.generated.cjs.map +1 -1
- package/dist/generated/config.generated.d.cts +500 -6
- package/dist/generated/config.generated.d.ts +500 -6
- package/dist/generated/operations.generated.cjs +7 -0
- package/dist/generated/operations.generated.cjs.map +1 -1
- package/dist/generated/operations.generated.d.cts +20 -5
- package/dist/generated/operations.generated.d.ts +20 -5
- package/dist/generated/operations.generated.js +7 -0
- package/dist/generated/operations.generated.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/authoring/FlowBuilderCore.ts +55 -18
- package/src/authoring/handles.ts +67 -0
- package/src/examples/splitAndZap.ts +9 -8
- package/src/generated/config.generated.ts +516 -5
- package/src/generated/operations.generated.ts +52 -3
- package/src/index.ts +5 -1
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// Regenerate with: yarn workspace @lifi/composer-sdk generate
|
|
3
3
|
|
|
4
4
|
import type { FlowBuilderInternal } from '../authoring/FlowBuilderCore.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
Bindable,
|
|
7
|
+
FamilyCount,
|
|
8
|
+
FamilySource,
|
|
9
|
+
OutputFamilyHandles,
|
|
10
|
+
OutputHandle,
|
|
11
|
+
} from '../authoring/handles.js';
|
|
6
12
|
import type {
|
|
7
13
|
CoreCallResult,
|
|
8
14
|
SignatureBind,
|
|
@@ -30,6 +36,7 @@ import type {
|
|
|
30
36
|
CoreEmitEvent2Config,
|
|
31
37
|
CoreEmitEvent3Config,
|
|
32
38
|
CoreEmitEvent4Config,
|
|
39
|
+
CorePartitionConfig,
|
|
33
40
|
CorePeekConfig,
|
|
34
41
|
CoreRawCallConfig,
|
|
35
42
|
CoreSplitConfig,
|
|
@@ -53,7 +60,7 @@ import type {
|
|
|
53
60
|
ParaswapBuyConfig,
|
|
54
61
|
} from './config.generated.js';
|
|
55
62
|
|
|
56
|
-
/** Split a resource into two outputs by basis-point ratio */
|
|
63
|
+
/** Split a resource into two outputs by basis-point ratio. Output `a` receives `bps` of the source, rounded up, and `b` takes the remainder. */
|
|
57
64
|
export interface CoreSplitArgs {
|
|
58
65
|
readonly bind: {
|
|
59
66
|
readonly source: Bindable<'resource'>;
|
|
@@ -62,6 +69,22 @@ export interface CoreSplitArgs {
|
|
|
62
69
|
readonly guards?: readonly TypedGuard<'a' | 'b'>[];
|
|
63
70
|
}
|
|
64
71
|
|
|
72
|
+
/** Partition a resource into one output per basis-point share. `bps` lists 2 to 16 shares summing to 10000; output `parts.i` receives share i, rounded down, and the last part takes the remainder. */
|
|
73
|
+
export interface CorePartitionArgs<
|
|
74
|
+
TBps extends FamilySource<CorePartitionConfig['bps']> = FamilySource<
|
|
75
|
+
CorePartitionConfig['bps']
|
|
76
|
+
>,
|
|
77
|
+
> {
|
|
78
|
+
readonly bind: {
|
|
79
|
+
readonly source: Bindable<'resource'>;
|
|
80
|
+
};
|
|
81
|
+
readonly config: Omit<CorePartitionConfig, 'bps'> & {
|
|
82
|
+
readonly bps: TBps &
|
|
83
|
+
FamilyCount<NoInfer<TBps>, Readonly<CorePartitionConfig['bps']>>;
|
|
84
|
+
};
|
|
85
|
+
readonly guards?: readonly TypedGuard<`parts.${number}`>[];
|
|
86
|
+
}
|
|
87
|
+
|
|
65
88
|
/** Merge two same-token resources into one by addition */
|
|
66
89
|
export interface CoreMergeArgs {
|
|
67
90
|
readonly bind: {
|
|
@@ -575,6 +598,14 @@ export interface CoreSplitOutputs {
|
|
|
575
598
|
readonly b: OutputHandle<'resource'>;
|
|
576
599
|
}
|
|
577
600
|
|
|
601
|
+
export interface CorePartitionOutputs<
|
|
602
|
+
TBps extends FamilySource<CorePartitionConfig['bps']> = FamilySource<
|
|
603
|
+
CorePartitionConfig['bps']
|
|
604
|
+
>,
|
|
605
|
+
> {
|
|
606
|
+
readonly parts: OutputFamilyHandles<TBps>;
|
|
607
|
+
}
|
|
608
|
+
|
|
578
609
|
export interface CoreMergeOutputs {
|
|
579
610
|
readonly merged: OutputHandle<'resource'>;
|
|
580
611
|
}
|
|
@@ -683,8 +714,15 @@ export interface FlySwapOutputs {
|
|
|
683
714
|
|
|
684
715
|
export type GeneratedOps = {
|
|
685
716
|
readonly core: {
|
|
686
|
-
/** Split a resource into two outputs by basis-point ratio — original id: "core.split" */
|
|
717
|
+
/** Split a resource into two outputs by basis-point ratio. Output `a` receives `bps` of the source, rounded up, and `b` takes the remainder. — original id: "core.split" */
|
|
687
718
|
readonly split: (nodeId: string, args: CoreSplitArgs) => CoreSplitOutputs;
|
|
719
|
+
/** Partition a resource into one output per basis-point share. `bps` lists 2 to 16 shares summing to 10000; output `parts.i` receives share i, rounded down, and the last part takes the remainder. — original id: "core.partition" */
|
|
720
|
+
readonly partition: <
|
|
721
|
+
const TBps extends FamilySource<CorePartitionConfig['bps']>,
|
|
722
|
+
>(
|
|
723
|
+
nodeId: string,
|
|
724
|
+
args: CorePartitionArgs<TBps>,
|
|
725
|
+
) => CorePartitionOutputs<TBps>;
|
|
688
726
|
/** Merge two same-token resources into one by addition — original id: "core.merge" */
|
|
689
727
|
readonly merge: (nodeId: string, args: CoreMergeArgs) => CoreMergeOutputs;
|
|
690
728
|
/** Add two unsigned integers (a + b) — original id: "core.add" */
|
|
@@ -908,6 +946,17 @@ export const bindGeneratedOps = (
|
|
|
908
946
|
a: 'resource',
|
|
909
947
|
b: 'resource',
|
|
910
948
|
} as const),
|
|
949
|
+
partition: <const TBps extends FamilySource<CorePartitionConfig['bps']>>(
|
|
950
|
+
nodeId: string,
|
|
951
|
+
args: CorePartitionArgs<TBps>,
|
|
952
|
+
) =>
|
|
953
|
+
builder.call(
|
|
954
|
+
nodeId,
|
|
955
|
+
'core.partition',
|
|
956
|
+
args,
|
|
957
|
+
{ parts: 'resource' } as const,
|
|
958
|
+
{ parts: 'bps' } as const,
|
|
959
|
+
) as unknown as CorePartitionOutputs<TBps>,
|
|
911
960
|
merge: (nodeId: string, args: CoreMergeArgs) =>
|
|
912
961
|
builder.call(nodeId, 'core.merge', { ...args, config: {} }, {
|
|
913
962
|
merged: 'resource',
|
package/src/index.ts
CHANGED
|
@@ -101,7 +101,8 @@ export type {
|
|
|
101
101
|
ContinuationOutcome,
|
|
102
102
|
Check,
|
|
103
103
|
CheckComparator,
|
|
104
|
-
|
|
104
|
+
SettlementWire,
|
|
105
|
+
SettlementEscrowWire,
|
|
105
106
|
ContinuationPlanWire,
|
|
106
107
|
} from '@lifi/compose-spec';
|
|
107
108
|
export {
|
|
@@ -122,6 +123,9 @@ export type {
|
|
|
122
123
|
InputHandle,
|
|
123
124
|
ResourceInputHandle,
|
|
124
125
|
OutputHandle,
|
|
126
|
+
OutputFamilyHandles,
|
|
127
|
+
FamilyCount,
|
|
128
|
+
FamilySource,
|
|
125
129
|
AnyHandle,
|
|
126
130
|
} from './authoring/handles.js';
|
|
127
131
|
export { isInputHandle, isOutputHandle } from './authoring/handles.js';
|