@agoric/portfolio-api 0.1.1-dev-fe77bfe.0.fe77bfe → 0.1.1-dev-6ce1cfd.0.6ce1cfd
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-6ce1cfd.0.6ce1cfd",
|
|
4
4
|
"description": "API for Portfolio management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"generate:ymax-machine": "npx tsx scripts/gen-ymax-machine.mts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agoric/internal": "0.3.3-dev-
|
|
31
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
30
|
+
"@agoric/internal": "0.3.3-dev-6ce1cfd.0.6ce1cfd",
|
|
31
|
+
"@agoric/orchestration": "0.1.1-dev-6ce1cfd.0.6ce1cfd",
|
|
32
32
|
"@endo/common": "^1.2.13",
|
|
33
33
|
"@endo/errors": "^1.2.13",
|
|
34
34
|
"@endo/patterns": "^1.7.0"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": "^20.9 || ^22.11"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6ce1cfd05fd9608126491636eb6658078d91cba9"
|
|
73
73
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Constants and configuration for portfolio contract deployment
|
|
3
|
+
*
|
|
4
|
+
* This module exports domain knowledge about portfolio contract deployment,
|
|
5
|
+
* including wallet store keys, control addresses, and contract names.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Wallet store key where the contract control facet is delivered
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
export const YMAX_CONTROL_WALLET_KEY: string;
|
|
12
|
+
/**
|
|
13
|
+
* Known portfolio contract names in agoricNames.instance
|
|
14
|
+
* @type {readonly ['ymax0', 'ymax1']}
|
|
15
|
+
*/
|
|
16
|
+
export const PORTFOLIO_CONTRACT_NAMES: readonly ["ymax0", "ymax1"];
|
|
17
|
+
/**
|
|
18
|
+
* Control account addresses per contract and network
|
|
19
|
+
* Source: https://www.mintscan.io/agoric/proposals/111 (for ymax0/main)
|
|
20
|
+
*
|
|
21
|
+
* @type {{
|
|
22
|
+
* ymax0: {
|
|
23
|
+
* main: string;
|
|
24
|
+
* devnet: string;
|
|
25
|
+
* };
|
|
26
|
+
* ymax1: {
|
|
27
|
+
* main: string;
|
|
28
|
+
* devnet: string;
|
|
29
|
+
* };
|
|
30
|
+
* }}
|
|
31
|
+
*/
|
|
32
|
+
export const CONTROL_ADDRESSES: {
|
|
33
|
+
ymax0: {
|
|
34
|
+
main: string;
|
|
35
|
+
devnet: string;
|
|
36
|
+
};
|
|
37
|
+
ymax1: {
|
|
38
|
+
main: string;
|
|
39
|
+
devnet: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export function getControlAddress(contractName: (typeof PORTFOLIO_CONTRACT_NAMES)[number], network: "main" | "devnet"): string;
|
|
43
|
+
export function isPortfolioContract(name: string): name is "ymax0" | "ymax1";
|
|
44
|
+
//# sourceMappingURL=portfolio-constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolio-constants.d.ts","sourceRoot":"","sources":["portfolio-constants.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,sCAFU,MAAM,CAEqC;AAErD;;;GAGG;AACH,uCAFU,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAKlC;AAEH;;;;;;;;;;;;;;GAcG;AACH,gCAXU;IACL,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAWF;AAUK,gDALI,CAAA,OAAO,wBAAwB,EAAC,MAAM,CAAC,WACvC,MAAM,GAAG,QAAQ,GACf,MAAM,CAclB;AAQM,0CAHI,MAAM,6BAOhB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Constants and configuration for portfolio contract deployment
|
|
3
|
+
*
|
|
4
|
+
* This module exports domain knowledge about portfolio contract deployment,
|
|
5
|
+
* including wallet store keys, control addresses, and contract names.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Wallet store key where the contract control facet is delivered
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
export const YMAX_CONTROL_WALLET_KEY = 'ymaxControl';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Known portfolio contract names in agoricNames.instance
|
|
16
|
+
* @type {readonly ['ymax0', 'ymax1']}
|
|
17
|
+
*/
|
|
18
|
+
export const PORTFOLIO_CONTRACT_NAMES = /** @type {const} */ ([
|
|
19
|
+
'ymax0',
|
|
20
|
+
'ymax1',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Control account addresses per contract and network
|
|
25
|
+
* Source: https://www.mintscan.io/agoric/proposals/111 (for ymax0/main)
|
|
26
|
+
*
|
|
27
|
+
* @type {{
|
|
28
|
+
* ymax0: {
|
|
29
|
+
* main: string;
|
|
30
|
+
* devnet: string;
|
|
31
|
+
* };
|
|
32
|
+
* ymax1: {
|
|
33
|
+
* main: string;
|
|
34
|
+
* devnet: string;
|
|
35
|
+
* };
|
|
36
|
+
* }}
|
|
37
|
+
*/
|
|
38
|
+
export const CONTROL_ADDRESSES = {
|
|
39
|
+
ymax0: {
|
|
40
|
+
main: 'agoric1e80twfutmrm3wrk3fysjcnef4j82mq8dn6nmcq',
|
|
41
|
+
devnet: 'agoric10utru593dspjwfewcgdak8lvp9tkz0xttvcnxv',
|
|
42
|
+
},
|
|
43
|
+
ymax1: {
|
|
44
|
+
main: 'agoric18dx5f8ck5xy2dgkgeyp2w478dztxv3z2mnz928',
|
|
45
|
+
devnet: 'agoric1awsr6hpn4t44jfrrnf5xr70mz4zrg5glvft6sl',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the control address for a contract on a specific network
|
|
51
|
+
*
|
|
52
|
+
* @param {typeof PORTFOLIO_CONTRACT_NAMES[number]} contractName
|
|
53
|
+
* @param {'main' | 'devnet'} network
|
|
54
|
+
* @returns {string} The control account address
|
|
55
|
+
* @throws {Error} If contract or network is invalid
|
|
56
|
+
*/
|
|
57
|
+
export const getControlAddress = (contractName, network) => {
|
|
58
|
+
if (!PORTFOLIO_CONTRACT_NAMES.includes(contractName)) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Invalid contract name: ${contractName}. Must be one of: ${PORTFOLIO_CONTRACT_NAMES.join(', ')}`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
if (network !== 'main' && network !== 'devnet') {
|
|
64
|
+
throw new Error(`Invalid network: ${network}. Must be 'main' or 'devnet'`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return CONTROL_ADDRESSES[contractName][network];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Validate that a contract name is a known portfolio contract
|
|
72
|
+
*
|
|
73
|
+
* @param {string} name
|
|
74
|
+
* @returns {name is typeof PORTFOLIO_CONTRACT_NAMES[number]}
|
|
75
|
+
*/
|
|
76
|
+
export const isPortfolioContract = name => {
|
|
77
|
+
return PORTFOLIO_CONTRACT_NAMES.includes(
|
|
78
|
+
/** @type {typeof PORTFOLIO_CONTRACT_NAMES[number]} */ (name),
|
|
79
|
+
);
|
|
80
|
+
};
|