@agoric/portfolio-api 0.1.1-dev-8b1bc2c.0.8b1bc2c → 0.1.1-dev-53f6813.0.53f6813
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 +4 -3
- package/src/constants.d.ts +12 -2
- package/src/constants.d.ts.map +1 -1
- package/src/constants.js +7 -1
- package/src/type-guards.d.ts +10 -0
- package/src/type-guards.d.ts.map +1 -0
- package/src/type-guards.ts +17 -0
- package/src/types.d.ts +8 -1
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +11 -2
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-53f6813.0.53f6813",
|
|
4
4
|
"description": "API for Portfolio management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"ava": "^5.3.0",
|
|
26
26
|
"c8": "^10.1.3",
|
|
27
|
-
"ts-blank-space": "^0.6.2"
|
|
27
|
+
"ts-blank-space": "^0.6.2",
|
|
28
|
+
"tsd": "^0.33.0"
|
|
28
29
|
},
|
|
29
30
|
"ava": {
|
|
30
31
|
"extensions": {
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": "^20.9 || ^22.11"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "53f6813712affe082ef230f91b43f56e10d99371"
|
|
54
55
|
}
|
package/src/constants.d.ts
CHANGED
|
@@ -30,8 +30,18 @@ export namespace AxelarChain {
|
|
|
30
30
|
}
|
|
31
31
|
export type SupportedChain = (typeof SupportedChain)[keyof typeof SupportedChain];
|
|
32
32
|
export namespace SupportedChain {
|
|
33
|
-
let
|
|
34
|
-
|
|
33
|
+
let Arbitrum_1: "Arbitrum";
|
|
34
|
+
export { Arbitrum_1 as Arbitrum };
|
|
35
|
+
let Avalanche_1: "Avalanche";
|
|
36
|
+
export { Avalanche_1 as Avalanche };
|
|
37
|
+
let Base_1: "Base";
|
|
38
|
+
export { Base_1 as Base };
|
|
39
|
+
let Ethereum_1: "Ethereum";
|
|
40
|
+
export { Ethereum_1 as Ethereum };
|
|
41
|
+
let Optimism_1: "Optimism";
|
|
42
|
+
export { Optimism_1 as Optimism };
|
|
43
|
+
export let agoric: "agoric";
|
|
44
|
+
export let noble: "noble";
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
47
|
* Strategies for portfolio rebalancing of bulk deposits.
|
package/src/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.js"],"names":[],"mappings":";;;4BAOU,CAAC,OAAO,aAAa,EAAE,MAAM,OAAO,aAAa,CAAC;;;;;;;;;;;;;qCAgBlD,CAAC,OAAO,sBAAsB,EAAE,MAAM,OAAO,sBAAsB,CAAC;;;;;;0BAUpE,CAAC,OAAO,WAAW,EAAE,MAAM,OAAO,WAAW,CAAC;;;;;;;;6BAY9C,CAAC,OAAO,cAAc,EAAE,MAAM,OAAO,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.js"],"names":[],"mappings":";;;4BAOU,CAAC,OAAO,aAAa,EAAE,MAAM,OAAO,aAAa,CAAC;;;;;;;;;;;;;qCAgBlD,CAAC,OAAO,sBAAsB,EAAE,MAAM,OAAO,sBAAsB,CAAC;;;;;;0BAUpE,CAAC,OAAO,WAAW,EAAE,MAAM,OAAO,WAAW,CAAC;;;;;;;;6BAY9C,CAAC,OAAO,cAAc,EAAE,MAAM,OAAO,cAAc,CAAC;;;;;;;;;;;;;;;;;;gCAmBpD,CAAC,OAAO,iBAAiB,EAAE,MAAM,OAAO,iBAAiB,CAAC"}
|
package/src/constants.js
CHANGED
|
@@ -46,7 +46,13 @@ harden(AxelarChain);
|
|
|
46
46
|
* @enum {(typeof SupportedChain)[keyof typeof SupportedChain]}
|
|
47
47
|
*/
|
|
48
48
|
export const SupportedChain = /** @type {const} */ ({
|
|
49
|
-
...AxelarChain
|
|
49
|
+
// ...AxelarChain works locally but gets lost in .d.ts generation
|
|
50
|
+
Arbitrum: 'Arbitrum',
|
|
51
|
+
Avalanche: 'Avalanche',
|
|
52
|
+
Base: 'Base',
|
|
53
|
+
Ethereum: 'Ethereum',
|
|
54
|
+
Optimism: 'Optimism',
|
|
55
|
+
// Unique to this object
|
|
50
56
|
agoric: 'agoric',
|
|
51
57
|
noble: 'noble',
|
|
52
58
|
// XXX: check privateArgs for chainInfo for all of these
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InterChainAccountRef, LocalChainAccountRef } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Does it match the pattern, without regard to supported chains.
|
|
4
|
+
*/
|
|
5
|
+
export declare const isLocalChainAccountRef: (ref: string) => ref is LocalChainAccountRef;
|
|
6
|
+
/**
|
|
7
|
+
* Does it match the pattern, without regard to supported chains.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isInterChainAccountRef: (ref: string) => ref is InterChainAccountRef;
|
|
10
|
+
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,KACV,GAAG,IAAI,oBAA2C,CAAC;AAGtD;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,KACV,GAAG,IAAI,oBAA2C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InterChainAccountRef, LocalChainAccountRef } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Does it match the pattern, without regard to supported chains.
|
|
5
|
+
*/
|
|
6
|
+
export const isLocalChainAccountRef = (
|
|
7
|
+
ref: string,
|
|
8
|
+
): ref is LocalChainAccountRef => ref.startsWith('+');
|
|
9
|
+
harden(isLocalChainAccountRef);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Does it match the pattern, without regard to supported chains.
|
|
13
|
+
*/
|
|
14
|
+
export const isInterChainAccountRef = (
|
|
15
|
+
ref: string,
|
|
16
|
+
): ref is InterChainAccountRef => ref.startsWith('@');
|
|
17
|
+
harden(isInterChainAccountRef);
|
package/src/types.d.ts
CHANGED
|
@@ -4,7 +4,13 @@ import type { SupportedChain, YieldProtocol } from './constants.js';
|
|
|
4
4
|
import type { InstrumentId } from './instruments.js';
|
|
5
5
|
import type { PublishedTx } from './resolver.js';
|
|
6
6
|
export type SeatKeyword = 'Cash' | 'Deposit';
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Reference to a local chain accounts (LCA).
|
|
9
|
+
* '+agoric' is published as `depositAddress`
|
|
10
|
+
*/
|
|
11
|
+
export type LocalChainAccountRef = '+agoric';
|
|
12
|
+
export type InterChainAccountRef = `@${SupportedChain}`;
|
|
13
|
+
export type AssetPlaceRef = `<${SeatKeyword}>` | LocalChainAccountRef | InterChainAccountRef | InstrumentId;
|
|
8
14
|
type Empty = Record<never, NatAmount>;
|
|
9
15
|
/**
|
|
10
16
|
* Proposal shapes for portfolio operations.
|
|
@@ -97,6 +103,7 @@ export type StatusFor = {
|
|
|
97
103
|
accountIdByChain: Partial<Record<SupportedChain, AccountId>>;
|
|
98
104
|
accountsPending?: SupportedChain[];
|
|
99
105
|
depositAddress?: Bech32Address;
|
|
106
|
+
/** Noble Forwarding Address (NFA) registered by the contract for the `@agoric` address */
|
|
100
107
|
nobleForwardingAddress?: Bech32Address;
|
|
101
108
|
targetAllocation?: TargetAllocation;
|
|
102
109
|
/** incremented by the contract every time the user sends a transaction that the planner should respond to */
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,MAAM,MAAM,aAAa,GACrB,IAAI,WAAW,GAAG,GAClB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,IAAI,cAAc,EAAE,CAAC;AAExD,MAAM,MAAM,aAAa,GACrB,IAAI,WAAW,GAAG,GAClB,oBAAoB,GAC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C;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,YAAY,EAAE,SAAS,CAAC;QACxB,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,CAAC;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -10,10 +10,18 @@ import type { PublishedTx } from './resolver.js';
|
|
|
10
10
|
|
|
11
11
|
export type SeatKeyword = 'Cash' | 'Deposit';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Reference to a local chain accounts (LCA).
|
|
15
|
+
* '+agoric' is published as `depositAddress`
|
|
16
|
+
*/
|
|
17
|
+
export type LocalChainAccountRef = '+agoric';
|
|
18
|
+
|
|
19
|
+
export type InterChainAccountRef = `@${SupportedChain}`;
|
|
20
|
+
|
|
13
21
|
export type AssetPlaceRef =
|
|
14
22
|
| `<${SeatKeyword}>`
|
|
15
|
-
|
|
|
16
|
-
|
|
|
23
|
+
| LocalChainAccountRef
|
|
24
|
+
| InterChainAccountRef
|
|
17
25
|
| InstrumentId;
|
|
18
26
|
|
|
19
27
|
type Empty = Record<never, NatAmount>;
|
|
@@ -80,6 +88,7 @@ export type StatusFor = {
|
|
|
80
88
|
accountIdByChain: Partial<Record<SupportedChain, AccountId>>;
|
|
81
89
|
accountsPending?: SupportedChain[];
|
|
82
90
|
depositAddress?: Bech32Address;
|
|
91
|
+
/** Noble Forwarding Address (NFA) registered by the contract for the `@agoric` address */
|
|
83
92
|
nobleForwardingAddress?: Bech32Address;
|
|
84
93
|
targetAllocation?: TargetAllocation;
|
|
85
94
|
/** incremented by the contract every time the user sends a transaction that the planner should respond to */
|