@agoric/portfolio-api 0.1.1-dev-488dec7.0.488dec7 → 0.1.1-dev-b85a94d.0.b85a94d
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
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-b85a94d.0.b85a94d",
|
|
4
4
|
"description": "API for Portfolio management",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,13 +46,14 @@
|
|
|
46
46
|
"generate:ymax-machine": "npx tsx scripts/gen-ymax-machine.mts"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@agoric/internal": "0.3.3-dev-
|
|
50
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
49
|
+
"@agoric/internal": "0.3.3-dev-b85a94d.0.b85a94d",
|
|
50
|
+
"@agoric/orchestration": "0.1.1-dev-b85a94d.0.b85a94d",
|
|
51
51
|
"@endo/common": "^1.2.13",
|
|
52
52
|
"@endo/errors": "^1.2.13",
|
|
53
53
|
"@endo/patterns": "^1.7.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@endo/far": "^1.1.14",
|
|
56
57
|
"@types/js-yaml": "^4",
|
|
57
58
|
"ajv": "^6.12.6",
|
|
58
59
|
"ava": "^7.0.0",
|
|
@@ -88,5 +89,5 @@
|
|
|
88
89
|
"engines": {
|
|
89
90
|
"node": "^20.9 || ^22.11"
|
|
90
91
|
},
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "b85a94d36a78e1fac36766d1cb9649c5db9e869c"
|
|
92
93
|
}
|
|
@@ -29,8 +29,8 @@ export interface ChainSpec {
|
|
|
29
29
|
/** minimum delta amount for planned moves involving this chain */
|
|
30
30
|
readonly deltaSoftMin?: NatValue;
|
|
31
31
|
}
|
|
32
|
-
type BlockWithdrawReason = 'LOW_LIQUIDITY';
|
|
33
|
-
type BlockDepositReason = BlockWithdrawReason | 'AT_CAPACITY';
|
|
32
|
+
export type BlockWithdrawReason = null | 'LOW_LIQUIDITY';
|
|
33
|
+
export type BlockDepositReason = BlockWithdrawReason | 'AT_CAPACITY';
|
|
34
34
|
export type PoolKey = InstrumentId;
|
|
35
35
|
export interface PoolSpec {
|
|
36
36
|
readonly pool: PoolKey;
|
|
@@ -84,5 +84,4 @@ export interface NetworkSpec {
|
|
|
84
84
|
readonly localPlaces?: LocalPlaceSpec[];
|
|
85
85
|
readonly links: LinkSpec[];
|
|
86
86
|
}
|
|
87
|
-
export {};
|
|
88
87
|
//# sourceMappingURL=network-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-spec.d.ts","sourceRoot":"","sources":["network-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,UAAU,GACV,eAAe,GACf,aAAa,GACb,QAAQ,GACR,OAAO,CAAC;AACZ;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,gBAAgB,GAChB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,UAAU,CAAC;AAGf,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,eAAe,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,QAAQ,EAAE,CAAC;CAC5B"}
|
package/src/target-balances.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export type ComputeTargetBalancesOptions<C extends AssetPlaceRef, T extends stri
|
|
|
26
26
|
* target sink is unavailable or suppressed.
|
|
27
27
|
*/
|
|
28
28
|
depositFromChain?: SupportedChain;
|
|
29
|
+
instrumentBlocks?: {
|
|
30
|
+
noDepositInstruments: Set<AssetPlaceRef>;
|
|
31
|
+
noWithdrawInstruments: Set<AssetPlaceRef>;
|
|
32
|
+
};
|
|
29
33
|
};
|
|
30
34
|
/**
|
|
31
35
|
* Derive target balances for allocation keys, suppressing small changes and
|
|
@@ -38,5 +42,5 @@ export type ComputeTargetBalancesOptions<C extends AssetPlaceRef, T extends stri
|
|
|
38
42
|
* Returns only entries whose values change by at least ACCOUNT_DUST_EPSILON
|
|
39
43
|
* compared to current.
|
|
40
44
|
*/
|
|
41
|
-
export declare const computeTargetBalances: <C extends AssetPlaceRef, T extends string & keyof TargetAllocation>({ brand, currentBalances, balanceDelta, targetAllocation, network, depositFromChain, }: ComputeTargetBalancesOptions<C, T>) => Partial<Record<C | T, NatAmount>>;
|
|
45
|
+
export declare const computeTargetBalances: <C extends AssetPlaceRef, T extends string & keyof TargetAllocation>({ brand, currentBalances, balanceDelta, targetAllocation, network, depositFromChain, instrumentBlocks, }: ComputeTargetBalancesOptions<C, T>) => Partial<Record<C | T, NatAmount>>;
|
|
42
46
|
//# sourceMappingURL=target-balances.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-balances.d.ts","sourceRoot":"","sources":["target-balances.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAO5E,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE,O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AC,CAAC;IACpB,qEAAqE;IACrE,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/C;;;OAGG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC;IACtD,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAClC,gBAAgB,CAAC,EAAE;QACjB,oBAAoB,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;QACzC,qBAAqB,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;KAC3C,CAAC;CACH,CAAC;AAwFF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAChC,CAAC,SAAS,aAAa,EACvB,CAAC,SAAS,MAAM,GAAG,MAAM,gBAAgB,EACzC,0GAQC,4BAA4B,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAqPvE,CAAC"}
|
package/src/target-balances.js
CHANGED
|
@@ -47,6 +47,10 @@ hardenOrFreeze(TargetBalanceError);
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
50
54
|
|
|
51
55
|
|
|
52
56
|
;
|
|
@@ -156,7 +160,10 @@ export const computeTargetBalances = (
|
|
|
156
160
|
targetAllocation = {},
|
|
157
161
|
network,
|
|
158
162
|
depositFromChain,
|
|
163
|
+
instrumentBlocks,
|
|
159
164
|
} ) => {
|
|
165
|
+
const { noDepositInstruments, noWithdrawInstruments } =
|
|
166
|
+
instrumentBlocks ?? {};
|
|
160
167
|
const currentValues = objectMap(
|
|
161
168
|
currentBalances ,
|
|
162
169
|
amount => amount.value,
|
|
@@ -204,14 +211,23 @@ export const computeTargetBalances = (
|
|
|
204
211
|
weight = 0n,
|
|
205
212
|
) => {
|
|
206
213
|
const placeData = getPlaceData(place, network);
|
|
214
|
+
const { blockDepositReason, blockWithdrawReason } = placeData.pool ?? {};
|
|
207
215
|
return {
|
|
208
216
|
place,
|
|
209
217
|
chain: placeData.chain,
|
|
210
218
|
weight,
|
|
211
219
|
current: getOwn(currentValues, place) ?? 0n,
|
|
212
|
-
blockDeposit: !!placeData.pool?.blockDepositReason,
|
|
213
|
-
blockWithdraw: !!placeData.pool?.blockWithdrawReason,
|
|
214
220
|
deltaSoftMin: placeData.chain.deltaSoftMin ?? DEFAULT_DELTA_SOFT_MIN,
|
|
221
|
+
// `network` can force an instrument to be blocked or unblocked, but
|
|
222
|
+
// otherwise it's based upon dynamic status.
|
|
223
|
+
blockDeposit:
|
|
224
|
+
blockDepositReason !== undefined
|
|
225
|
+
? !!blockDepositReason
|
|
226
|
+
: !!noDepositInstruments?.has(place),
|
|
227
|
+
blockWithdraw:
|
|
228
|
+
blockWithdrawReason !== undefined
|
|
229
|
+
? !!blockWithdrawReason
|
|
230
|
+
: !!noWithdrawInstruments?.has(place),
|
|
215
231
|
|
|
216
232
|
target: 0n,
|
|
217
233
|
delta: 0n,
|