@agoric/portfolio-api 0.1.1-dev-df9efa9.0.df9efa9 → 0.1.1-dev-1321e4f.0.1321e4f
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/package.json +2 -2
- package/src/types.d.ts +31 -7
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +38 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/portfolio-api",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-1321e4f.0.1321e4f",
|
|
4
4
|
"description": "API for Portfolio management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": "^20.9 || ^22.11"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "1321e4f23e1d88f8f5b35ae00273a5ba6001e46b"
|
|
55
55
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -65,22 +65,40 @@ export type FlowDetail = {
|
|
|
65
65
|
} | {
|
|
66
66
|
type: 'rebalance';
|
|
67
67
|
};
|
|
68
|
+
/** linked list of concurrent failures, including dependencies */
|
|
69
|
+
export type FlowErrors = {
|
|
70
|
+
step: number;
|
|
71
|
+
how: string;
|
|
72
|
+
error: string;
|
|
73
|
+
next?: FlowErrors;
|
|
74
|
+
};
|
|
68
75
|
export type FlowStatus = {
|
|
69
76
|
state: 'run';
|
|
77
|
+
/** minimum currently running step */
|
|
70
78
|
step: number;
|
|
71
79
|
how: string;
|
|
72
|
-
|
|
80
|
+
/** currently running steps, when executing concurrently */
|
|
81
|
+
steps?: number[];
|
|
82
|
+
}
|
|
83
|
+
/** @deprecated - contract no longer does automatic recovery */
|
|
84
|
+
| {
|
|
73
85
|
state: 'undo';
|
|
74
86
|
step: number;
|
|
75
87
|
how: string;
|
|
76
88
|
} | {
|
|
77
89
|
state: 'done';
|
|
78
|
-
} | {
|
|
90
|
+
} | ({
|
|
79
91
|
state: 'fail';
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
} & FlowErrors);
|
|
93
|
+
export type MovementDesc = {
|
|
94
|
+
amount: NatAmount;
|
|
95
|
+
src: AssetPlaceRef;
|
|
96
|
+
dest: AssetPlaceRef;
|
|
97
|
+
/** for example: GMP fee */
|
|
98
|
+
fee?: NatAmount;
|
|
99
|
+
/** for example: { usdnOut: 98n } */
|
|
100
|
+
detail?: Record<string, bigint>;
|
|
101
|
+
claim?: boolean;
|
|
84
102
|
};
|
|
85
103
|
export type FlowStep = {
|
|
86
104
|
how: string;
|
|
@@ -88,6 +106,11 @@ export type FlowStep = {
|
|
|
88
106
|
src: AssetPlaceRef;
|
|
89
107
|
dest: AssetPlaceRef;
|
|
90
108
|
};
|
|
109
|
+
export type FundsFlowPlan = {
|
|
110
|
+
flow: MovementDesc[];
|
|
111
|
+
/** default to full order */
|
|
112
|
+
order?: [target: number, prereqs: number[]][];
|
|
113
|
+
};
|
|
91
114
|
export type PortfolioKey = `portfolio${number}`;
|
|
92
115
|
export type FlowKey = `flow${number}`;
|
|
93
116
|
export type StatusFor = {
|
|
@@ -120,8 +143,9 @@ export type StatusFor = {
|
|
|
120
143
|
totalIn: NatAmount;
|
|
121
144
|
totalOut: NatAmount;
|
|
122
145
|
};
|
|
123
|
-
flow: FlowStatus;
|
|
146
|
+
flow: FlowStatus & FlowDetail;
|
|
124
147
|
flowSteps: FlowStep[];
|
|
148
|
+
flowOrder: FundsFlowPlan['order'];
|
|
125
149
|
};
|
|
126
150
|
/**
|
|
127
151
|
* Names suitable for use as `publicInvitationMaker` in {@link ContractInvitationSpec}.
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,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AC,CAAC;KAC9C,CAAC;IACF,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE;QACV,YAAY,EAAE,YAAY,CAAC;KAC5B,CAAC;IACF,SAAS,EAAE;QACT,YAAY,EAAE,YAAY,EAAE,CAAC;QAC7B,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;QAC7D,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;QACnC,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,0FAA0F;QAC1F,sBAAsB,CAAC,EAAE,aAAa,CAAC;QACvC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,6GAA6G;QAC7G,aAAa,EAAE,MAAM,CAAC;QACtB,yGAAyG;QACzG,cAAc,EAAE,MAAM,CAAC;QACvB,2CAA2C;QAC3C,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;KAC5C,CAAC;IACF,QAAQ,EAAE;QACR,QAAQ,EAAE,aAAa,CAAC;QACxB,SAAS,EAAE,SAAS,CAAC;QACrB,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,CAAC;IACF,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,6BAA6B,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAC1C,SAAS,GACT,UAAU,GACV,WAAW,GACX,iBAAiB,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -64,17 +64,51 @@ export type FlowDetail =
|
|
|
64
64
|
| { type: 'deposit'; amount: NatAmount }
|
|
65
65
|
| { type: 'rebalance' }; // aka simpleRebalance
|
|
66
66
|
|
|
67
|
+
/** linked list of concurrent failures, including dependencies */
|
|
68
|
+
export type FlowErrors = {
|
|
69
|
+
step: number;
|
|
70
|
+
how: string;
|
|
71
|
+
error: string;
|
|
72
|
+
next?: FlowErrors;
|
|
73
|
+
};
|
|
74
|
+
|
|
67
75
|
export type FlowStatus =
|
|
68
|
-
| {
|
|
76
|
+
| {
|
|
77
|
+
state: 'run';
|
|
78
|
+
/** minimum currently running step */
|
|
79
|
+
step: number;
|
|
80
|
+
how: string;
|
|
81
|
+
/** currently running steps, when executing concurrently */
|
|
82
|
+
steps?: number[];
|
|
83
|
+
}
|
|
84
|
+
/** @deprecated - contract no longer does automatic recovery */
|
|
69
85
|
| { state: 'undo'; step: number; how: string }
|
|
70
86
|
| { state: 'done' }
|
|
71
|
-
| { state: 'fail'
|
|
87
|
+
| ({ state: 'fail' } & FlowErrors);
|
|
88
|
+
|
|
89
|
+
export type MovementDesc = {
|
|
90
|
+
amount: NatAmount;
|
|
91
|
+
src: AssetPlaceRef;
|
|
92
|
+
dest: AssetPlaceRef;
|
|
93
|
+
/** for example: GMP fee */
|
|
94
|
+
fee?: NatAmount;
|
|
95
|
+
/** for example: { usdnOut: 98n } */
|
|
96
|
+
detail?: Record<string, bigint>;
|
|
97
|
+
claim?: boolean;
|
|
98
|
+
};
|
|
72
99
|
|
|
73
100
|
export type FlowStep = {
|
|
74
101
|
how: string;
|
|
75
102
|
amount: NatAmount;
|
|
76
103
|
src: AssetPlaceRef;
|
|
77
104
|
dest: AssetPlaceRef;
|
|
105
|
+
// XXX all parts: fee etc.
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type FundsFlowPlan = {
|
|
109
|
+
flow: MovementDesc[];
|
|
110
|
+
/** default to full order */
|
|
111
|
+
order?: [target: number, prereqs: number[]][];
|
|
78
112
|
};
|
|
79
113
|
|
|
80
114
|
export type PortfolioKey = `portfolio${number}`;
|
|
@@ -110,8 +144,9 @@ export type StatusFor = {
|
|
|
110
144
|
totalIn: NatAmount;
|
|
111
145
|
totalOut: NatAmount;
|
|
112
146
|
};
|
|
113
|
-
flow: FlowStatus;
|
|
147
|
+
flow: FlowStatus & FlowDetail;
|
|
114
148
|
flowSteps: FlowStep[];
|
|
149
|
+
flowOrder: FundsFlowPlan['order'];
|
|
115
150
|
};
|
|
116
151
|
|
|
117
152
|
/**
|