@agoric/portfolio-api 0.1.1-dev-409d5b4.0.409d5b4 → 0.1.1-dev-a62e38f.0.a62e38f

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-409d5b4.0.409d5b4",
3
+ "version": "0.1.1-dev-a62e38f.0.a62e38f",
4
4
  "description": "API for Portfolio management",
5
5
  "type": "module",
6
6
  "files": [
@@ -21,7 +21,12 @@
21
21
  "lint:eslint": "yarn run -T eslint .",
22
22
  "lint:types": "yarn run -T tsc"
23
23
  },
24
+ "dependencies": {
25
+ "@agoric/orchestration": "0.1.1-dev-a62e38f.0.a62e38f",
26
+ "@endo/common": "^1.2.13"
27
+ },
24
28
  "devDependencies": {
29
+ "@agoric/internal": "0.3.3-dev-a62e38f.0.a62e38f",
25
30
  "ava": "^5.3.0",
26
31
  "c8": "^10.1.3",
27
32
  "ts-blank-space": "^0.6.2",
@@ -51,5 +56,5 @@
51
56
  "engines": {
52
57
  "node": "^20.9 || ^22.11"
53
58
  },
54
- "gitHead": "409d5b473e613fa67bb2fb022ee5e785f10d6b3d"
59
+ "gitHead": "a62e38f05bf0b676c708b7861b88b2b70b841469"
55
60
  }
@@ -28,6 +28,12 @@ export namespace AxelarChain {
28
28
  let Ethereum: "Ethereum";
29
29
  let Optimism: "Optimism";
30
30
  }
31
+ /**
32
+ * cf. https://chainlist.org/
33
+ * XXX this probably belongs in @agoric/orchestration
34
+ * @type {Readonly<Record<ClusterName, Readonly<Partial<Record<AxelarChain, bigint>>>>>}
35
+ */
36
+ export const Eip155ChainIds: Readonly<Record<ClusterName, Readonly<Partial<Record<AxelarChain, bigint>>>>>;
31
37
  export type SupportedChain = (typeof SupportedChain)[keyof typeof SupportedChain];
32
38
  export namespace SupportedChain {
33
39
  let Arbitrum_1: "Arbitrum";
@@ -43,6 +49,21 @@ export namespace SupportedChain {
43
49
  export let agoric: "agoric";
44
50
  export let noble: "noble";
45
51
  }
52
+ /**
53
+ * cf. https://chainagnostic.org/CAIPs/caip-2
54
+ * Please keep in sync with ../../../services/ymax-planner/src/support.ts `spectrumChainIds`
55
+ *
56
+ * XXX this probably belongs in @agoric/orchestration
57
+ *
58
+ * @type {Readonly<Record<ClusterName, Readonly<Partial<Record<SupportedChain, CaipChainId>>>>>}
59
+ */
60
+ export const CaipChainIds: Readonly<Record<ClusterName, Readonly<Partial<Record<SupportedChain, CaipChainId>>>>>;
61
+ /**
62
+ * cf. https://developers.circle.com/stablecoins/usdc-contract-addresses
63
+ * XXX this might belong in @agoric/orchestration
64
+ * @type {Readonly<Record<ClusterName, Readonly<Partial<Record<SupportedChain, string>>>>>}
65
+ */
66
+ export const UsdcTokenIds: Readonly<Record<ClusterName, Readonly<Partial<Record<SupportedChain, string>>>>>;
46
67
  /**
47
68
  * Strategies for portfolio rebalancing of bulk deposits.
48
69
  */
@@ -56,4 +77,6 @@ export namespace RebalanceStrategy {
56
77
  * This corresponds to 100 uusdc, i.e., $0.0001 for USDC.
57
78
  */
58
79
  export const ACCOUNT_DUST_EPSILON: 100n;
80
+ import type { ClusterName } from '@agoric/internal';
81
+ import type { CaipChainId } from '@agoric/orchestration';
59
82
  //# sourceMappingURL=constants.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;gCAmBpD,CAAC,OAAO,iBAAiB,EAAE,MAAM,OAAO,iBAAiB,CAAC;;;;;AAgBpE;;;GAGG;AACH,mCAAoC,IAAI,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.js"],"names":[],"mappings":";;;4BAYU,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;;;;;;;;AAWxD;;;;GAIG;AACH,6BAFU,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAkBrF;6BAIQ,CAAC,OAAO,cAAc,EAAE,MAAM,OAAO,cAAc,CAAC;;;;;;;;;;;;;;;AAmB9D;;;;;;;GAOG;AACH,2BAFU,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAgB7F;AAGF;;;;GAIG;AACH,2BAFU,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAwBxF;;;;gCAMQ,CAAC,OAAO,iBAAiB,EAAE,MAAM,OAAO,iBAAiB,CAAC;;;;;AAgBpE;;;GAGG;AACH,mCAAoC,IAAI,CAAC;iCArKV,kBAAkB;iCAClB,uBAAuB"}
package/src/constants.js CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  /// <reference types="ses" />
4
4
 
5
+ import { objectMap } from '@endo/common/object-map.js';
6
+
7
+ /** @import {ClusterName} from '@agoric/internal'; */
8
+ /** @import {CaipChainId} from '@agoric/orchestration'; */
9
+
5
10
  /**
6
11
  * Yield protocols for Proof of Concept.
7
12
  *
@@ -42,6 +47,30 @@ export const AxelarChain = /** @type {const} */ ({
42
47
  });
43
48
  harden(AxelarChain);
44
49
 
50
+ /**
51
+ * cf. https://chainlist.org/
52
+ * XXX this probably belongs in @agoric/orchestration
53
+ * @type {Readonly<Record<ClusterName, Readonly<Partial<Record<AxelarChain, bigint>>>>>}
54
+ */
55
+ export const Eip155ChainIds = {
56
+ mainnet: {
57
+ Arbitrum: 42161n,
58
+ Avalanche: 43114n,
59
+ Base: 8453n,
60
+ Ethereum: 1n,
61
+ Optimism: 10n,
62
+ },
63
+ testnet: {
64
+ Arbitrum: 421614n, // Sepolia
65
+ Avalanche: 43113n, // Fuji
66
+ Base: 84532n, // Sepolia
67
+ Ethereum: 11155111n, // Sepolia
68
+ Optimism: 11155420n, // Sepolia
69
+ },
70
+ local: {},
71
+ };
72
+ harden(Eip155ChainIds);
73
+
45
74
  /**
46
75
  * @enum {(typeof SupportedChain)[keyof typeof SupportedChain]}
47
76
  */
@@ -59,6 +88,64 @@ export const SupportedChain = /** @type {const} */ ({
59
88
  });
60
89
  harden(SupportedChain);
61
90
 
91
+ /** @type {(eip155ChainId: bigint) => CaipChainId} */
92
+ const caipChainIdFromEip155 = chainId => `eip155:${chainId}`;
93
+
94
+ /**
95
+ * cf. https://chainagnostic.org/CAIPs/caip-2
96
+ * Please keep in sync with ../../../services/ymax-planner/src/support.ts `spectrumChainIds`
97
+ *
98
+ * XXX this probably belongs in @agoric/orchestration
99
+ *
100
+ * @type {Readonly<Record<ClusterName, Readonly<Partial<Record<SupportedChain, CaipChainId>>>>>}
101
+ */
102
+ export const CaipChainIds = {
103
+ mainnet: {
104
+ ...objectMap(Eip155ChainIds.mainnet, caipChainIdFromEip155),
105
+ agoric: 'cosmos:agoric-3',
106
+ noble: 'cosmos:noble-1',
107
+ },
108
+ testnet: {
109
+ ...objectMap(Eip155ChainIds.testnet, caipChainIdFromEip155),
110
+ agoric: 'cosmos:agoricdev-25',
111
+ noble: 'cosmos:grand-1',
112
+ },
113
+ local: {
114
+ ...objectMap(Eip155ChainIds.local, caipChainIdFromEip155),
115
+ },
116
+ };
117
+ harden(CaipChainIds);
118
+
119
+ /**
120
+ * cf. https://developers.circle.com/stablecoins/usdc-contract-addresses
121
+ * XXX this might belong in @agoric/orchestration
122
+ * @type {Readonly<Record<ClusterName, Readonly<Partial<Record<SupportedChain, string>>>>>}
123
+ */
124
+ export const UsdcTokenIds = {
125
+ mainnet: {
126
+ Arbitrum: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
127
+ Avalanche: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
128
+ Base: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
129
+ Ethereum: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
130
+ Optimism: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
131
+ agoric:
132
+ 'ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9',
133
+ noble: 'usdc',
134
+ },
135
+ testnet: {
136
+ Arbitrum: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d', // Sepolia
137
+ Avalanche: '0x5425890298aed601595a70AB815c96711a31Bc65', // Fuji
138
+ Base: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // Sepolia
139
+ Ethereum: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // Sepolia
140
+ Optimism: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7', // Sepolia
141
+ agoric:
142
+ 'ibc/75F84596DDE9EE93010620701FFED959F3FFA1D0979F6773DE994FFEEA7D32F3',
143
+ noble: 'usdc',
144
+ },
145
+ local: {},
146
+ };
147
+ harden(UsdcTokenIds);
148
+
62
149
  /**
63
150
  * Strategies for portfolio rebalancing of bulk deposits.
64
151
  *