@agoric/governance 0.10.4-dev-fa844b5.0 → 0.10.4-dev-21fe8d9.0

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.
Files changed (81) hide show
  1. package/exported.d.ts +37 -0
  2. package/exported.js +1 -1
  3. package/package.json +15 -14
  4. package/src/binaryVoteCounter.d.ts +19 -0
  5. package/src/binaryVoteCounter.d.ts.map +1 -0
  6. package/src/binaryVoteCounter.js +4 -0
  7. package/src/breakTie.d.ts +3 -0
  8. package/src/breakTie.d.ts.map +1 -0
  9. package/src/breakTie.js +4 -0
  10. package/src/closingRule.d.ts +7 -0
  11. package/src/closingRule.d.ts.map +1 -0
  12. package/src/closingRule.js +4 -0
  13. package/src/committee.d.ts +27 -0
  14. package/src/committee.d.ts.map +1 -0
  15. package/src/committee.js +4 -0
  16. package/src/constants.d.ts +16 -0
  17. package/src/constants.d.ts.map +1 -0
  18. package/src/contractGovernance/assertions.d.ts +7 -0
  19. package/src/contractGovernance/assertions.d.ts.map +1 -0
  20. package/src/contractGovernance/governApi.d.ts +32 -0
  21. package/src/contractGovernance/governApi.d.ts.map +1 -0
  22. package/src/contractGovernance/governApi.js +4 -0
  23. package/src/contractGovernance/governFilter.d.ts +31 -0
  24. package/src/contractGovernance/governFilter.d.ts.map +1 -0
  25. package/src/contractGovernance/governFilter.js +4 -0
  26. package/src/contractGovernance/governParam.d.ts +39 -0
  27. package/src/contractGovernance/governParam.d.ts.map +1 -0
  28. package/src/contractGovernance/governParam.js +3 -0
  29. package/src/contractGovernance/paramManager.d.ts +49 -0
  30. package/src/contractGovernance/paramManager.d.ts.map +1 -0
  31. package/src/contractGovernance/paramManager.js +5 -1
  32. package/src/contractGovernance/typedParamManager.d.ts +38 -0
  33. package/src/contractGovernance/typedParamManager.d.ts.map +1 -0
  34. package/src/contractGovernance/typedParamManager.js +5 -0
  35. package/src/contractGovernor.d.ts +29 -0
  36. package/src/contractGovernor.d.ts.map +1 -0
  37. package/src/contractGovernor.js +4 -0
  38. package/src/contractGovernorKit.d.ts +46 -0
  39. package/src/contractGovernorKit.d.ts.map +1 -0
  40. package/src/contractGovernorKit.js +4 -0
  41. package/src/contractHelper.d.ts +121 -0
  42. package/src/contractHelper.d.ts.map +1 -0
  43. package/src/contractHelper.js +4 -0
  44. package/src/electorateTools.d.ts +50 -0
  45. package/src/electorateTools.d.ts.map +1 -0
  46. package/src/electorateTools.js +4 -0
  47. package/src/index.d.ts +9 -0
  48. package/src/index.d.ts.map +1 -0
  49. package/src/index.js +5 -3
  50. package/src/multiCandidateVoteCounter.d.ts +19 -0
  51. package/src/multiCandidateVoteCounter.d.ts.map +1 -0
  52. package/src/multiCandidateVoteCounter.js +4 -0
  53. package/src/noActionElectorate.d.ts +13 -0
  54. package/src/noActionElectorate.d.ts.map +1 -0
  55. package/src/noActionElectorate.js +4 -0
  56. package/src/question.d.ts +31 -0
  57. package/src/question.d.ts.map +1 -0
  58. package/src/question.js +4 -0
  59. package/src/quorumCounter.d.ts +6 -0
  60. package/src/quorumCounter.d.ts.map +1 -0
  61. package/src/quorumCounter.js +4 -0
  62. package/src/typeGuards.d.ts +210 -0
  63. package/src/typeGuards.d.ts.map +1 -0
  64. package/src/types.d.ts +562 -0
  65. package/src/types.d.ts.map +1 -0
  66. package/src/types.js +2 -1
  67. package/src/validators.d.ts +21 -0
  68. package/src/validators.d.ts.map +1 -0
  69. package/src/validators.js +4 -0
  70. package/src/voterKit.d.ts +14 -0
  71. package/src/voterKit.d.ts.map +1 -0
  72. package/src/voterKit.js +4 -0
  73. package/tools/puppetContractGovernor.d.ts +53 -0
  74. package/tools/puppetContractGovernor.d.ts.map +1 -0
  75. package/tools/puppetContractGovernor.js +4 -2
  76. package/tools/puppetGovernance.d.ts +102 -0
  77. package/tools/puppetGovernance.d.ts.map +1 -0
  78. package/tools/puppetGovernance.js +4 -0
  79. package/tools/storageDoc.d.ts +10 -0
  80. package/tools/storageDoc.d.ts.map +1 -0
  81. package/src/types-ambient.js +0 -731
package/exported.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ /* eslint-disable -- doesn't understand .d.ts */
2
+
3
+ export * from './src/types.js';
4
+
5
+ // XXX re-export types into global namespace, for consumers that expect these to
6
+ // be ambient. Why the _ prefix? Because without it TS gets confused between the
7
+ // import and export symbols. h/t https://stackoverflow.com/a/66588974
8
+ // Note one big downside vs ambients is that these types will appear to be on `globalThis`.
9
+ // UNTIL https://github.com/Agoric/agoric-sdk/issues/6512
10
+ import {
11
+ GovernanceFacetKit as _GovernanceFacetKit,
12
+ GovernanceTerms as _GovernanceTerms,
13
+ GovernorCreatorFacet as _GovernorCreatorFacet,
14
+ GovernanceSubscriptionState as _GovernanceSubscriptionState,
15
+ GovernorStartedInstallationKit as _GovernorStartedInstallationKit,
16
+ GovernedCreatorFacet as _GovernedCreatorFacet,
17
+ ParamStateRecord as _ParamStateRecord,
18
+ GovernedPublicFacet as _GovernedPublicFacet,
19
+ CommitteeElectoratePublic as _CommitteeElectoratePublic,
20
+ GovernedApis as _GovernedApis,
21
+ GovernableStartFn as _GovernableStartFn,
22
+ } from './src/types.js';
23
+ declare global {
24
+ export {
25
+ _CommitteeElectoratePublic as CommitteeElectoratePublic,
26
+ _GovernableStartFn as GovernableStartFn,
27
+ _GovernanceFacetKit as GovernanceFacetKit,
28
+ _GovernanceSubscriptionState as GovernanceSubscriptionState,
29
+ _GovernanceTerms as GovernanceTerms,
30
+ _GovernedApis as GovernedApis,
31
+ _GovernedCreatorFacet as GovernedCreatorFacet,
32
+ _GovernedPublicFacet as GovernedPublicFacet,
33
+ _GovernorCreatorFacet as GovernorCreatorFacet,
34
+ _GovernorStartedInstallationKit as GovernorStartedInstallationKit,
35
+ _ParamStateRecord as ParamStateRecord,
36
+ };
37
+ }
package/exported.js CHANGED
@@ -1 +1 @@
1
- import './src/types-ambient.js';
1
+ // Dummy file for .d.ts twin to declare ambients
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/governance",
3
- "version": "0.10.4-dev-fa844b5.0+fa844b5",
3
+ "version": "0.10.4-dev-21fe8d9.0+21fe8d9",
4
4
  "description": "Core governance support",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -10,8 +10,8 @@
10
10
  "scripts": {
11
11
  "build": "yarn build:bundles",
12
12
  "build:bundles": "node ./scripts/build-bundles.js",
13
- "prepack": "echo \"export {}; \" | cat - src/types-ambient.js > src/types.js && tsc --build --clean tsconfig.build.json",
14
- "postpack": "git clean -f '*.d.ts*' src/types.js",
13
+ "prepack": "tsc --build tsconfig.build.json",
14
+ "postpack": "git clean -f '*.d.ts*'",
15
15
  "test": "ava",
16
16
  "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
17
17
  "test:xs": "exit 0",
@@ -31,15 +31,15 @@
31
31
  },
32
32
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
33
33
  "dependencies": {
34
- "@agoric/assert": "0.6.1-dev-fa844b5.0+fa844b5",
35
- "@agoric/ertp": "0.16.3-dev-fa844b5.0+fa844b5",
36
- "@agoric/internal": "0.3.3-dev-fa844b5.0+fa844b5",
37
- "@agoric/network": "0.1.1-dev-fa844b5.0+fa844b5",
38
- "@agoric/notifier": "0.6.3-dev-fa844b5.0+fa844b5",
39
- "@agoric/store": "0.9.3-dev-fa844b5.0+fa844b5",
40
- "@agoric/time": "0.3.3-dev-fa844b5.0+fa844b5",
41
- "@agoric/vat-data": "0.5.3-dev-fa844b5.0+fa844b5",
42
- "@agoric/zoe": "0.26.3-dev-fa844b5.0+fa844b5",
34
+ "@agoric/assert": "0.6.1-dev-21fe8d9.0+21fe8d9",
35
+ "@agoric/ertp": "0.16.3-dev-21fe8d9.0+21fe8d9",
36
+ "@agoric/internal": "0.3.3-dev-21fe8d9.0+21fe8d9",
37
+ "@agoric/network": "0.1.1-dev-21fe8d9.0+21fe8d9",
38
+ "@agoric/notifier": "0.6.3-dev-21fe8d9.0+21fe8d9",
39
+ "@agoric/store": "0.9.3-dev-21fe8d9.0+21fe8d9",
40
+ "@agoric/time": "0.3.3-dev-21fe8d9.0+21fe8d9",
41
+ "@agoric/vat-data": "0.5.3-dev-21fe8d9.0+21fe8d9",
42
+ "@agoric/zoe": "0.26.3-dev-21fe8d9.0+21fe8d9",
43
43
  "@endo/bundle-source": "^3.2.1",
44
44
  "@endo/captp": "^4.1.0",
45
45
  "@endo/eventual-send": "^1.2.0",
@@ -50,7 +50,7 @@
50
50
  "import-meta-resolve": "^2.2.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@agoric/swingset-vat": "0.32.3-dev-fa844b5.0+fa844b5",
53
+ "@agoric/swingset-vat": "0.32.3-dev-21fe8d9.0+21fe8d9",
54
54
  "@endo/bundle-source": "^3.2.1",
55
55
  "@endo/init": "^1.1.0",
56
56
  "ava": "^5.3.0",
@@ -61,6 +61,7 @@
61
61
  "src/",
62
62
  "tools/",
63
63
  "exported.js",
64
+ "exported.d.ts",
64
65
  "NEWS.md"
65
66
  ],
66
67
  "ava": {
@@ -78,5 +79,5 @@
78
79
  "typeCoverage": {
79
80
  "atLeast": 89.27
80
81
  },
81
- "gitHead": "fa844b51a10ab02af61af19207c164c99c2d8d8c"
82
+ "gitHead": "21fe8d921225214fb388191548ad63d81912e65f"
82
83
  }
@@ -0,0 +1,19 @@
1
+ /** @type {BuildVoteCounter} */
2
+ export const makeBinaryVoteCounter: BuildVoteCounter;
3
+ /**
4
+ * @param {ZCF<{questionSpec: QuestionSpec, quorumThreshold: bigint}>} zcf
5
+ * @param {{outcomePublisher: Publisher<OutcomeRecord>}} outcomePublisher
6
+ */
7
+ export function start(zcf: ZCF<{
8
+ questionSpec: QuestionSpec;
9
+ quorumThreshold: bigint;
10
+ }>, { outcomePublisher }: {
11
+ outcomePublisher: Publisher<OutcomeRecord>;
12
+ }): {
13
+ publicFacet: import("./types.js").VoteCounterPublicFacet;
14
+ creatorFacet: import("./types.js").VoteCounterCreatorFacet;
15
+ };
16
+ import type { BuildVoteCounter } from './types.js';
17
+ import type { QuestionSpec } from './types.js';
18
+ import type { OutcomeRecord } from './types.js';
19
+ //# sourceMappingURL=binaryVoteCounter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binaryVoteCounter.d.ts","sourceRoot":"","sources":["binaryVoteCounter.js"],"names":[],"mappings":"AA4CA,+BAA+B;AAC/B,qDA6JE;AAMF;;;GAGG;AACH;;qBAH6D,MAAM;;;;;;EAqBlE;sCAlNyF,YAAY;kCAAZ,YAAY;mCAAZ,YAAY"}
@@ -17,6 +17,10 @@ import {
17
17
  } from './typeGuards.js';
18
18
  import { makeQuorumCounter } from './quorumCounter.js';
19
19
 
20
+ /**
21
+ * @import {BuildVoteCounter, OutcomeRecord, Position, QuestionSpec, VoteStatistics} from './types.js';
22
+ */
23
+
20
24
  const { Fail } = assert;
21
25
 
22
26
  const validateBinaryQuestionSpec = questionSpec => {
@@ -0,0 +1,3 @@
1
+ export function breakTie(positions: Position[], n: number): Position[];
2
+ import type { Position } from './types.js';
3
+ //# sourceMappingURL=breakTie.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakTie.d.ts","sourceRoot":"","sources":["breakTie.js"],"names":[],"mappings":"AA4BO,mDAHI,MAAM,cAKhB;8BA7B0B,YAAY"}
package/src/breakTie.js CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @import {Position} from './types.js';
3
+ */
4
+
1
5
  /**
2
6
  * Randomly shuffle an array
3
7
  * https://stackoverflow.com/a/12646864
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @import {CloseVoting} from './types.js';
3
+ */
4
+ /** @type {CloseVoting} */
5
+ export const scheduleClose: CloseVoting;
6
+ import type { CloseVoting } from './types.js';
7
+ //# sourceMappingURL=closingRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closingRule.d.ts","sourceRoot":"","sources":["closingRule.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH,0BAA0B;AAC1B,wCAQE;iCAZ4B,YAAY"}
@@ -5,6 +5,10 @@
5
5
  import { E } from '@endo/eventual-send';
6
6
  import { Far } from '@endo/marshal';
7
7
 
8
+ /**
9
+ * @import {CloseVoting} from './types.js';
10
+ */
11
+
8
12
  /** @type {CloseVoting} */
9
13
  export const scheduleClose = (closingRule, closeVoting) => {
10
14
  const { timer, deadline } = closingRule;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @typedef { ElectorateCreatorFacet & {
3
+ * getVoterInvitations: () => Promise<Invitation<{ voter: { castBallotFor(handle: any, choice?: any, ): void}}>>[]
4
+ * }} CommitteeElectorateCreatorFacet
5
+ */
6
+ /** @type {ContractMeta} */
7
+ export const meta: ContractMeta;
8
+ export function start(zcf: ZCF<{
9
+ committeeName: string;
10
+ committeeSize: number;
11
+ }>, privateArgs: {
12
+ storageNode: ERef<StorageNode>;
13
+ marshaller: ERef<Marshaller<unknown>>;
14
+ }, baggage: import('@agoric/vat-data').Baggage): {
15
+ creatorFacet: CommitteeElectorateCreatorFacet;
16
+ publicFacet: CommitteeElectoratePublic;
17
+ };
18
+ export type CommitteeElectorateCreatorFacet = ElectorateCreatorFacet & {
19
+ getVoterInvitations: () => Promise<Invitation<{
20
+ voter: {
21
+ castBallotFor(handle: any, choice?: any): void;
22
+ };
23
+ }>>[];
24
+ };
25
+ import type { CommitteeElectoratePublic } from './types.js';
26
+ import type { ElectorateCreatorFacet } from './types.js';
27
+ //# sourceMappingURL=committee.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"committee.d.ts","sourceRoot":"","sources":["committee.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AAEH,2BAA2B;AAC3B,mBADW,YAAY,CAOrB;AAoBK,2BARI,IAAI;IACd,aAAiB,EAAE,MAAM,CAAC;IAC1B,aAAiB,EAAE,MAAM,CAAC;CACvB,CAAC;;;YAEM,OAAO,kBAAkB,EAAE,OAAO;kBACjB,+BAA+B;;EAkI1D;;yBA/JyB,MAAM,QAAQ,WAAW;QAAE,KAAK,EAAE;YAAE,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAK,IAAI,CAAA;SAAC,CAAA;KAAC,CAAC,CAAC,EAAE;;+CAPH,YAAY;4CAAZ,YAAY"}
package/src/committee.js CHANGED
@@ -16,6 +16,10 @@ import { QuorumRule } from './question.js';
16
16
  import { ElectorateCreatorI, ElectoratePublicI } from './typeGuards.js';
17
17
  import { prepareVoterKit } from './voterKit.js';
18
18
 
19
+ /**
20
+ * @import {ElectorateCreatorFacet, CommitteeElectoratePublic, QuestionDetails, OutcomeRecord, AddQuestion} from './types.js';
21
+ */
22
+
19
23
  const { ceilDivide } = natSafeMath;
20
24
 
21
25
  /**
@@ -0,0 +1,16 @@
1
+ export namespace ParamTypes {
2
+ let AMOUNT: "amount";
3
+ let BRAND: "brand";
4
+ let INSTALLATION: "installation";
5
+ let INSTANCE: "instance";
6
+ let INVITATION: "invitation";
7
+ let NAT: "nat";
8
+ let RATIO: "ratio";
9
+ let STRING: "string";
10
+ let PASSABLE_RECORD: "record";
11
+ let TIMESTAMP: "timestamp";
12
+ let RELATIVE_TIME: "relativeTime";
13
+ let UNKNOWN: "unknown";
14
+ }
15
+ export type ParamType = (typeof ParamTypes)[keyof typeof ParamTypes];
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.js"],"names":[],"mappings":";;;;;;;;;;;;;;wBAuBc,CAAA,iBAAiB,EAAC,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export function makeLooksLikeBrand(name: any): (brand: Brand) => void;
2
+ export function makeAssertInstallation(name: any): (installation: any) => void;
3
+ export function makeAssertInstance(name: any): (instance: any) => void;
4
+ export function makeAssertBrandedRatio(name: any, modelRatio: any): (ratio: any) => boolean;
5
+ export function assertRelativeTime(value: any): void;
6
+ export function assertTimestamp(value: any): void;
7
+ //# sourceMappingURL=assertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["assertions.js"],"names":[],"mappings":"AAOA,uDACc,KAAK,UAIlB;AAGD,+EAMC;AAGD,uEAMC;AAGD,4FASC;AAGD,qDAEC;AAGD,kDAEC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * manage contracts that allow governance to invoke functions.
3
+ *
4
+ * @param {ERef<{ [methodName: string]: (...args: any) => unknown }>} governedApis
5
+ * @param {Array<string | symbol>} governedNames names of the governed API methods
6
+ * @param {ERef<import('@agoric/time').TimerService>} timer
7
+ * @param {() => Promise<PoserFacet>} getUpdatedPoserFacet
8
+ * @returns {ApiGovernor}
9
+ */
10
+ export function setupApiGovernance(governedApis: ERef<{
11
+ [methodName: string]: (...args: any) => unknown;
12
+ }>, governedNames: Array<string | symbol>, timer: ERef<import("@agoric/time").TimerService>, getUpdatedPoserFacet: () => Promise<PoserFacet>): ApiGovernor;
13
+ /**
14
+ * Make a pair of positions for a question about whether to invoke an API. If
15
+ * the vote passes, the method will be called on the governedApis facet with the
16
+ * arguments that were provided.
17
+ *
18
+ * @param {string} apiMethodName
19
+ * @param {unknown[]} methodArgs
20
+ */
21
+ export function makeApiInvocationPositions(apiMethodName: string, methodArgs: unknown[]): {
22
+ positive: {
23
+ apiMethodName: string;
24
+ methodArgs: unknown[];
25
+ };
26
+ negative: {
27
+ dontInvoke: string;
28
+ };
29
+ };
30
+ import type { PoserFacet } from '../types.js';
31
+ import type { ApiGovernor } from '../types.js';
32
+ //# sourceMappingURL=governApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governApi.d.ts","sourceRoot":"","sources":["governApi.js"],"names":[],"mappings":"AA+BA;;;;;;;;GAQG;AACH;oCANkD,GAAG,KAAK,OAAO;mBACtD,MAAM,MAAM,GAAG,MAAM,CAAC,kHA2FhC;AA7GD;;;;;;;GAOG;AACH,0DAHW,MAAM,cACN,OAAO,EAAE;;;;;;;;EAMnB;gCAjB4F,aAAa;iCAAb,aAAa"}
@@ -9,6 +9,10 @@ import {
9
9
  coerceQuestionSpec,
10
10
  } from '../question.js';
11
11
 
12
+ /**
13
+ * @import {Position, ApiGovernor, ApiInvocationIssue, PoserFacet, VoteOnApiInvocation} from '../types.js';
14
+ */
15
+
12
16
  const { Fail, quote: q } = assert;
13
17
 
14
18
  /**
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Setup to allow governance to block some invitations.
3
+ *
4
+ * @param {ERef<import('@agoric/time').TimerService>} timer
5
+ * @param {() => Promise<PoserFacet>} getUpdatedPoserFacet
6
+ * @param {GovernedCreatorFacet<{}>} governedCF
7
+ * @returns {FilterGovernor}
8
+ */
9
+ export function setupFilterGovernance(timer: ERef<import("@agoric/time").TimerService>, getUpdatedPoserFacet: () => Promise<PoserFacet>, governedCF: GovernedCreatorFacet<{}>): FilterGovernor;
10
+ /**
11
+ * @import {Position, ApiGovernor, ApiInvocationIssue, PoserFacet, VoteOnApiInvocation, FilterGovernor, GovernedCreatorFacet, OfferFilterIssue, VoteOnOfferFilter} from '../types.js';
12
+ */
13
+ /**
14
+ * Make a pair of positions for a question about whether to update the offer
15
+ * filter. If the vote passes, the list of blocked invitation strings will be
16
+ * updated.
17
+ *
18
+ * @param {string[]} strings
19
+ */
20
+ export function makeOfferFilterPositions(strings: string[]): {
21
+ positive: {
22
+ strings: string[];
23
+ };
24
+ negative: {
25
+ dontUpdate: string[];
26
+ };
27
+ };
28
+ import type { PoserFacet } from '../types.js';
29
+ import type { GovernedCreatorFacet } from '../types.js';
30
+ import type { FilterGovernor } from '../types.js';
31
+ //# sourceMappingURL=governFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governFilter.d.ts","sourceRoot":"","sources":["governFilter.js"],"names":[],"mappings":"AA6BA;;;;;;;GAOG;AACH,+LAmEC;AA5FD;;GAEG;AAEH;;;;;;GAMG;AACH,kDAFW,MAAM,EAAE;;;;;;;EAMlB;gCAduK,aAAa;0CAAb,aAAa;oCAAb,aAAa"}
@@ -10,6 +10,10 @@ import {
10
10
  coerceQuestionSpec,
11
11
  } from '../question.js';
12
12
 
13
+ /**
14
+ * @import {Position, ApiGovernor, ApiInvocationIssue, PoserFacet, VoteOnApiInvocation, FilterGovernor, GovernedCreatorFacet, OfferFilterIssue, VoteOnOfferFilter} from '../types.js';
15
+ */
16
+
13
17
  /**
14
18
  * Make a pair of positions for a question about whether to update the offer
15
19
  * filter. If the vote passes, the list of blocked invitation strings will be
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @param {ERef<ParamManagerRetriever>} paramManagerRetriever
3
+ * @param {Instance} contractInstance
4
+ * @param {import('@agoric/time').TimerService} timer
5
+ * @param {() => Promise<PoserFacet>} getUpdatedPoserFacet
6
+ * @returns {ParamGovernor}
7
+ */
8
+ export function setupParamGovernance(paramManagerRetriever: ERef<ParamManagerRetriever>, contractInstance: Instance, timer: import('@agoric/time').TimerService, getUpdatedPoserFacet: () => Promise<PoserFacet>): ParamGovernor;
9
+ /**
10
+ * Return a record containing the positive and negative positions for a
11
+ * question on changing the param to the proposedValue.
12
+ *
13
+ * @param {Record<string, ParamValue>} changes
14
+ * @returns {ParamChangePositions}
15
+ */
16
+ export function makeParamChangePositions(changes: Record<string, unknown>): ParamChangePositions;
17
+ /**
18
+ * assert that the parameter described by paramSpec is proposed to be changed in
19
+ * the question described by questionSpec.
20
+ *
21
+ * @param {{ parameterName: string, paramPath: unknown}} paramSpec
22
+ * @param {QuestionSpec<ParamChangeIssue<unknown>>} questionSpec
23
+ */
24
+ export function assertBallotConcernsParam(paramSpec: {
25
+ parameterName: string;
26
+ paramPath: unknown;
27
+ }, questionSpec: QuestionSpec<ParamChangeIssue<unknown>>): void;
28
+ /**
29
+ * The electorate that governs changes to the contract's parameters. It must be
30
+ * declared in the governed contract.
31
+ */
32
+ export const CONTRACT_ELECTORATE: "Electorate";
33
+ import type { ParamManagerRetriever } from '../types.js';
34
+ import type { PoserFacet } from '../types.js';
35
+ import type { ParamGovernor } from '../types.js';
36
+ import type { ParamChangePositions } from '../types.js';
37
+ import type { ParamChangeIssue } from '../types.js';
38
+ import type { QuestionSpec } from '../types.js';
39
+ //# sourceMappingURL=governParam.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governParam.d.ts","sourceRoot":"","sources":["governParam.js"],"names":[],"mappings":"AAwDA;;;;;;GAMG;AACH,2GALW,QAAQ,SACR,OAAO,cAAc,EAAE,YAAY,kEA0F7C;AA9HD;;;;;;GAMG;AACH,iGAMC;AAED;;;;;;GAMG;AACH,qDAHW;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,+DAYtD;AArCD;;;GAGG;AACH,+CAAyC;2CATsI,aAAa;gCAAb,aAAa;mCAAb,aAAa;0CAAb,aAAa;sCAAb,aAAa;kCAAb,aAAa"}
@@ -9,6 +9,9 @@ import {
9
9
  QuorumRule,
10
10
  } from '../question.js';
11
11
  import { ParamChangesQuestionDetailsShape } from '../typeGuards.js';
12
+ /**
13
+ * @import {ParamValue, ParamChangePositions, QuestionSpec, ChangeParamsPosition, ParamChangeIssue, ParamGovernor, ParamManagerRetriever, PoserFacet, VoteOnParamChanges} from '../types.js';
14
+ */
12
15
 
13
16
  const { Fail } = assert;
14
17
 
@@ -0,0 +1,49 @@
1
+ export type ParamManagerBuilder = {
2
+ addAmount: (name: string, value: Amount) => ParamManagerBuilder;
3
+ addBrand: (name: string, value: Brand) => ParamManagerBuilder;
4
+ addInstallation: (name: string, value: Installation) => ParamManagerBuilder;
5
+ addInstance: (name: string, value: Instance) => ParamManagerBuilder;
6
+ addInvitation: (name: string, value: Invitation) => ParamManagerBuilder;
7
+ addNat: (name: string, value: bigint) => ParamManagerBuilder;
8
+ addRatio: (name: string, value: Ratio) => ParamManagerBuilder;
9
+ addRecord: (name: string, value: import('@endo/marshal').CopyRecord<unknown>) => ParamManagerBuilder;
10
+ addString: (name: string, value: string) => ParamManagerBuilder;
11
+ addTimestamp: (name: string, value: import('@agoric/time').Timestamp) => ParamManagerBuilder;
12
+ addRelativeTime: (name: string, value: import('@agoric/time').RelativeTime) => ParamManagerBuilder;
13
+ addUnknown: (name: string, value: any) => ParamManagerBuilder;
14
+ build: () => AnyParamManager;
15
+ };
16
+ /**
17
+ * @param {ParamManagerBase} paramManager
18
+ * @param {{[CONTRACT_ELECTORATE]: ParamValueTyped<'invitation'>}} governedParams
19
+ */
20
+ export function assertElectorateMatches(paramManager: ParamManagerBase, governedParams: {
21
+ Electorate: ParamValueTyped<"invitation">;
22
+ }): void;
23
+ /**
24
+ * @typedef {object} ParamManagerBuilder
25
+ * @property {(name: string, value: Amount) => ParamManagerBuilder} addAmount
26
+ * @property {(name: string, value: Brand) => ParamManagerBuilder} addBrand
27
+ * @property {(name: string, value: Installation) => ParamManagerBuilder} addInstallation
28
+ * @property {(name: string, value: Instance) => ParamManagerBuilder} addInstance
29
+ * @property {(name: string, value: Invitation) => ParamManagerBuilder} addInvitation
30
+ * @property {(name: string, value: bigint) => ParamManagerBuilder} addNat
31
+ * @property {(name: string, value: Ratio) => ParamManagerBuilder} addRatio
32
+ * @property {(name: string, value: import('@endo/marshal').CopyRecord<unknown>) => ParamManagerBuilder} addRecord
33
+ * @property {(name: string, value: string) => ParamManagerBuilder} addString
34
+ * @property {(name: string, value: import('@agoric/time').Timestamp) => ParamManagerBuilder} addTimestamp
35
+ * @property {(name: string, value: import('@agoric/time').RelativeTime) => ParamManagerBuilder} addRelativeTime
36
+ * @property {(name: string, value: any) => ParamManagerBuilder} addUnknown
37
+ * @property {() => AnyParamManager} build
38
+ */
39
+ /**
40
+ * @param {import('@agoric/notifier').StoredPublisherKit<GovernanceSubscriptionState>} publisherKit
41
+ * @param {ERef<ZoeService>} [zoe]
42
+ */
43
+ export function makeParamManagerBuilder(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, zoe?: ERef<ZoeService> | undefined): ParamManagerBuilder;
44
+ import type { AnyParamManager } from '../types.js';
45
+ import type { ParamManagerBase } from '../types.js';
46
+ import { CONTRACT_ELECTORATE } from './governParam.js';
47
+ import type { ParamValueTyped } from '../types.js';
48
+ import type { GovernanceSubscriptionState } from '../types.js';
49
+ //# sourceMappingURL=paramManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paramManager.d.ts","sourceRoot":"","sources":["paramManager.js"],"names":[],"mappings":";eA4Cc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,mBAAmB;cACpD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,mBAAmB;qBACnD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,KAAK,mBAAmB;iBAC1D,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,KAAK,mBAAmB;mBACtD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,mBAAmB;YACxD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,mBAAmB;cACpD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,mBAAmB;eACnD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,mBAAmB;eACzF,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,mBAAmB;kBACpD,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,cAAc,EAAE,SAAS,KAAK,mBAAmB;qBAC9E,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,cAAc,EAAE,YAAY,KAAK,mBAAmB;gBACjF,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,mBAAmB;;;AA7B/D;;;GAGG;AACH;;SAUC;AAED;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,2LAgXC;qCA1ZiI,aAAa;sCAAb,aAAa;oCAH3G,kBAAkB;qCAG4E,aAAa;iDAAb,aAAa"}
@@ -18,6 +18,10 @@ import {
18
18
  } from './assertions.js';
19
19
  import { CONTRACT_ELECTORATE } from './governParam.js';
20
20
 
21
+ /**
22
+ * @import {AnyParamManager, GovernanceSubscriptionState, ParamManagerBase, ParamStateRecord, ParamValueTyped, UpdateParams} from '../types.js';
23
+ */
24
+
21
25
  const { Fail, quote: q } = assert;
22
26
 
23
27
  /**
@@ -90,7 +94,7 @@ const makeParamManagerBuilder = (publisherKit, zoe) => {
90
94
  * @param {Keyword} name
91
95
  * @param {unknown} value
92
96
  * @param {(val) => void} assertion
93
- * @param {ParamType} type
97
+ * @param {import('../constants.js').ParamType} type
94
98
  */
95
99
  const buildCopyParam = (name, value, assertion, type) => {
96
100
  let current;
@@ -0,0 +1,38 @@
1
+ export function makeParamManager<T extends Record<string, SyncSpecTuple | AsyncSpecTuple>>(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, spec: T, zcf: ZCF): TypedParamManager<{ [K in keyof T]: T[K][0]; }>;
2
+ export function makeParamManagerSync<T extends Record<string, SyncSpecTuple>>(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, spec: T): TypedParamManager<{ [K in keyof T]: T[K][0]; }>;
3
+ export function makeParamManagerFromTerms<I extends Record<string, Invitation<unknown, undefined>> & {
4
+ Electorate: Invitation;
5
+ }, M extends ParamTypesMap>(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, zcf: ZCF<GovernanceTerms<M>>, invitations: I, paramTypesMap: M): TypedParamManager<M & { [K in keyof I]: "invitation"; }>;
6
+ export type ParamTypesMap = {
7
+ [x: string]: ParamType;
8
+ };
9
+ export type ParamTypesMapFromRecord<M extends ParamStateRecord> = { [R in keyof M]: M[R]["type"]; };
10
+ export type ParamRecordsFromTypes<M extends ParamTypesMap> = { [T in keyof M]: {
11
+ type: M[T];
12
+ value: ParamValueForType<M[T]>;
13
+ }; };
14
+ export type Getters<M extends ParamTypesMap> = { [K in keyof M as `get${string & K}`]: () => ParamValueForType<M[K]>; };
15
+ export type Updaters<T extends ParamTypesMap> = { [K in keyof T as `update${string & K}`]: (value: ParamValueForType<T[K]>) => void; };
16
+ export type TypedParamManager<M extends ParamTypesMap> = ParamManagerBase & Getters<M> & Updaters<M> & {
17
+ readonly: () => Getters<M>;
18
+ } & {
19
+ updateParams: UpdateParams;
20
+ };
21
+ /**
22
+ * param spec tuple
23
+ */
24
+ export type ST<T extends ParamType> = [type: T, value: ParamValueForType<T>];
25
+ export type InvitationParam = {
26
+ type: 'invitation';
27
+ value: Amount<'set'>;
28
+ };
29
+ export type SyncSpecTuple = [type: "amount", value: globalThis.Amount<any>] | [type: "brand", value: globalThis.Brand] | [type: "installation", value: Installation<any>] | [type: "instance", value: Instance] | [type: "nat", value: bigint] | [type: "ratio", value: Ratio] | [type: "string", value: string] | [type: "timestamp", value: import("@agoric/time").Timestamp] | [type: "relativeTime", value: import("@agoric/time").RelativeTime] | [type: "unknown", value: unknown];
30
+ export type AsyncSpecTuple = ['invitation', Invitation];
31
+ import type { GovernanceSubscriptionState } from '../types.js';
32
+ import type { GovernanceTerms } from '../types.js';
33
+ import type { ParamType } from '../constants.js';
34
+ import type { ParamStateRecord } from '../types.js';
35
+ import type { ParamValueForType } from '../types.js';
36
+ import type { ParamManagerBase } from '../types.js';
37
+ import type { UpdateParams } from '../types.js';
38
+ //# sourceMappingURL=typedParamManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typedParamManager.d.ts","sourceRoot":"","sources":["typedParamManager.js"],"names":[],"mappings":"AAyFO,mMAHI,GAAG,mDAwBb;AAaM,kOAWN;AAYM;gBARiD,UAAU;gPAmCjE;;;;;;;;;;+HA3IiF,IAAI;;cAMhB,MAAM,QAAQ,CAAC,CAAC;;;;;;;;8BAoBzE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAA;CAAE;4BAO5C,4bASK;6BAEL,CAAC,YAAY,EAAE,UAAU,CAAC;iDAtE2M,aAAa;qCAAb,aAAa;+BACnO,iBAAiB;sCADqM,aAAa;uCAAb,aAAa;sCAAb,aAAa;kCAAb,aAAa"}
@@ -5,6 +5,11 @@ import { makeParamManagerBuilder } from './paramManager.js';
5
5
 
6
6
  const { Fail, quote: q } = assert;
7
7
 
8
+ /**
9
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, GovernanceSubscriptionState, GovernanceTerms, ParamManagerBase, ParamStateRecord, ParamValueForType, UpdateParams} from '../types.js';
10
+ * @import {ParamType} from '../constants.js';
11
+ */
12
+
8
13
  /**
9
14
  * @typedef {Record<Keyword, ParamType>} ParamTypesMap
10
15
  */
@@ -0,0 +1,29 @@
1
+ /** @type {ContractMeta} */
2
+ export const meta: ContractMeta;
3
+ export function validateQuestionDetails(zoe: ERef<ZoeService>, electorate: Instance, details: ParamChangeIssueDetails): Promise<[void, void, void]>;
4
+ export function validateQuestionFromCounter(zoe: ERef<ZoeService>, electorate: Instance, voteCounter: Instance): Promise<[void, void, void]>;
5
+ export function start<SF extends GovernableStartFn>(zcf: ZCF<{
6
+ timer: import('@agoric/time').TimerService;
7
+ governedContractInstallation: Installation<SF>;
8
+ governed: {
9
+ issuerKeywordRecord: IssuerKeywordRecord;
10
+ terms: {
11
+ governedParams: {
12
+ [CONTRACT_ELECTORATE]: import('./contractGovernance/typedParamManager.js').InvitationParam;
13
+ };
14
+ };
15
+ label?: string;
16
+ };
17
+ }>, privateArgs: {
18
+ governed: Record<string, unknown>;
19
+ }, baggage: import('@agoric/vat-data').Baggage): Promise<{
20
+ creatorFacet: GovernorCreatorFacet<SF>;
21
+ publicFacet: GovernorPublic;
22
+ }>;
23
+ export type ContractGovernorTerms = StandardTerms;
24
+ import type { ParamChangeIssueDetails } from './types.js';
25
+ import type { GovernableStartFn } from './types.js';
26
+ import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js';
27
+ import type { GovernorCreatorFacet } from './types.js';
28
+ import type { GovernorPublic } from './types.js';
29
+ //# sourceMappingURL=contractGovernor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractGovernor.d.ts","sourceRoot":"","sources":["contractGovernor.js"],"names":[],"mappings":"AAiBA,2BAA2B;AAC3B,mBADW,YAAY,CAGrB;AAYK,2EAHI,QAAQ,iEAmBlB;AAYM,+EAHI,QAAQ,eACR,QAAQ,+BAWlB;AA0FM;WAjBK,OAAO,cAAc,EAAE,YAAY;;cAEhC;QACd,mBAAyB,EAAE,mBAAmB,CAAC;QAC/C,KAAW,EAAE;YAAC,cAAc,EAAE;gBAAC,qBAAqB,EAAE,OAAO,2CAA2C,EAAE,eAAe,CAAA;aAAC,CAAA;SAAC,CAAC;QAC5H,KAAW,CAAC,EAAE,MAAM,CAAC;KAChB;iBAEK;IACV,QAAY,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,WAKO,OAAO,kBAAkB,EAAE,OAAO;;;GA6D5C;oCAjJY,aAAa;6CA/DyE,YAAY;uCAAZ,YAAY;oCAL3E,qCAAqC;0CAK0B,YAAY;oCAAZ,YAAY"}
@@ -7,6 +7,10 @@ import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js';
7
7
  import { prepareContractGovernorKit } from './contractGovernorKit.js';
8
8
  import { ParamChangesQuestionDetailsShape } from './typeGuards.js';
9
9
 
10
+ /**
11
+ * @import {GovernableStartFn, GovernorCreatorFacet, GovernorPublic, ParamChangeIssueDetails} from './types.js';
12
+ */
13
+
10
14
  const { Fail } = assert;
11
15
 
12
16
  const trace = makeTracer('CGov', false);