@agoric/governance 0.10.4-upgrade-14-dev-c8f9e7b.0 → 0.10.4-upgrade-16-fi-dev-8879538.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 (80) hide show
  1. package/exported.d.ts +32 -0
  2. package/exported.js +1 -1
  3. package/package.json +35 -29
  4. package/src/binaryVoteCounter.d.ts +6 -3
  5. package/src/binaryVoteCounter.d.ts.map +1 -1
  6. package/src/binaryVoteCounter.js +6 -2
  7. package/src/breakTie.d.ts +1 -0
  8. package/src/breakTie.d.ts.map +1 -1
  9. package/src/breakTie.js +4 -0
  10. package/src/closingRule.d.ts +4 -0
  11. package/src/closingRule.d.ts.map +1 -1
  12. package/src/closingRule.js +4 -0
  13. package/src/committee.d.ts +12 -8
  14. package/src/committee.d.ts.map +1 -1
  15. package/src/committee.js +24 -11
  16. package/src/constants.d.ts +12 -12
  17. package/src/constants.d.ts.map +1 -1
  18. package/src/contractGovernance/governApi.d.ts +11 -8
  19. package/src/contractGovernance/governApi.d.ts.map +1 -1
  20. package/src/contractGovernance/governApi.js +8 -3
  21. package/src/contractGovernance/governFilter.d.ts +8 -2
  22. package/src/contractGovernance/governFilter.d.ts.map +1 -1
  23. package/src/contractGovernance/governFilter.js +5 -1
  24. package/src/contractGovernance/governParam.d.ts +9 -2
  25. package/src/contractGovernance/governParam.d.ts.map +1 -1
  26. package/src/contractGovernance/governParam.js +6 -1
  27. package/src/contractGovernance/paramManager.d.ts +13 -9
  28. package/src/contractGovernance/paramManager.d.ts.map +1 -1
  29. package/src/contractGovernance/paramManager.js +18 -14
  30. package/src/contractGovernance/typedParamManager.d.ts +19 -10
  31. package/src/contractGovernance/typedParamManager.d.ts.map +1 -1
  32. package/src/contractGovernance/typedParamManager.js +5 -0
  33. package/src/contractGovernor.d.ts +11 -5
  34. package/src/contractGovernor.d.ts.map +1 -1
  35. package/src/contractGovernor.js +19 -9
  36. package/src/contractGovernorKit.d.ts +14 -48
  37. package/src/contractGovernorKit.d.ts.map +1 -1
  38. package/src/contractGovernorKit.js +56 -10
  39. package/src/contractHelper.d.ts +68 -78
  40. package/src/contractHelper.d.ts.map +1 -1
  41. package/src/contractHelper.js +21 -21
  42. package/src/electorateTools.d.ts +21 -17
  43. package/src/electorateTools.d.ts.map +1 -1
  44. package/src/electorateTools.js +20 -12
  45. package/src/index.js +3 -6
  46. package/src/multiCandidateVoteCounter.d.ts +6 -3
  47. package/src/multiCandidateVoteCounter.d.ts.map +1 -1
  48. package/src/multiCandidateVoteCounter.js +8 -4
  49. package/src/noActionElectorate.d.ts +6 -1
  50. package/src/noActionElectorate.d.ts.map +1 -1
  51. package/src/noActionElectorate.js +11 -2
  52. package/src/question.d.ts +15 -11
  53. package/src/question.d.ts.map +1 -1
  54. package/src/question.js +5 -0
  55. package/src/quorumCounter.d.ts +1 -1
  56. package/src/quorumCounter.d.ts.map +1 -1
  57. package/src/quorumCounter.js +4 -0
  58. package/src/typeGuards.d.ts +91 -54
  59. package/src/typeGuards.d.ts.map +1 -1
  60. package/src/types.d.ts +59 -62
  61. package/src/types.d.ts.map +1 -1
  62. package/src/types.js +35 -27
  63. package/src/validators.d.ts +5 -0
  64. package/src/validators.d.ts.map +1 -1
  65. package/src/validators.js +6 -3
  66. package/src/voterKit.d.ts +6 -11
  67. package/src/voterKit.d.ts.map +1 -1
  68. package/src/voterKit.js +4 -0
  69. package/tools/puppetContractGovernor.d.ts +15 -11
  70. package/tools/puppetContractGovernor.d.ts.map +1 -1
  71. package/tools/puppetContractGovernor.js +7 -5
  72. package/tools/puppetGovernance.d.ts +31 -30
  73. package/tools/puppetGovernance.d.ts.map +1 -1
  74. package/tools/puppetGovernance.js +6 -4
  75. package/tools/storageDoc.d.ts +3 -3
  76. package/tools/storageDoc.d.ts.map +1 -1
  77. package/CHANGELOG.md +0 -456
  78. package/src/types-ambient.d.ts +0 -1047
  79. package/src/types-ambient.d.ts.map +0 -1
  80. package/src/types-ambient.js +0 -731
@@ -1,5 +1,6 @@
1
1
  export const GOVERNANCE_STORAGE_KEY: "governance";
2
- export function validateElectorate(zcf: ZCF<GovernanceTerms<{}> & {}>, paramManager: import('./contractGovernance/typedParamManager').TypedParamManager<unknown>): Promise<void>;
2
+ export function validateElectorate(zcf: ZCF<GovernanceTerms<{}>>, paramManager: import("./contractGovernance/typedParamManager.js").TypedParamManager<any>): Promise<true>;
3
+ import type { GovernanceTerms } from './types.js';
3
4
  /**
4
5
  * Helper for the 90% of contracts that will have only a single set of
5
6
  * parameters. Using this for managed parameters, a contract only has to
@@ -12,7 +13,7 @@ export function validateElectorate(zcf: ZCF<GovernanceTerms<{}> & {}>, paramMana
12
13
  * parameter values, and the governance guarantees only hold if they're not used
13
14
  * directly by the governed contract.
14
15
  *
15
- * @template {import('./contractGovernance/typedParamManager').ParamTypesMap} M
16
+ * @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} M
16
17
  * Map of types of custom governed terms
17
18
  * @param {ZCF<GovernanceTerms<M>>} zcf
18
19
  * @param {Invitation} initialPoserInvitation
@@ -20,92 +21,77 @@ export function validateElectorate(zcf: ZCF<GovernanceTerms<{}> & {}>, paramMana
20
21
  * @param {ERef<StorageNode>} [storageNode]
21
22
  * @param {ERef<Marshaller>} [marshaller]
22
23
  */
23
- export function handleParamGovernance<M extends import("./contractGovernance/typedParamManager.js").ParamTypesMap>(zcf: ZCF<GovernanceTerms<M>>, initialPoserInvitation: Invitation, paramTypesMap: M, storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<Marshaller<unknown>> | undefined): {
24
+ export function handleParamGovernance<M extends import("./contractGovernance/typedParamManager.js").ParamTypesMap>(zcf: ZCF<GovernanceTerms<M>>, initialPoserInvitation: Invitation, paramTypesMap: M, storageNode?: globalThis.ERef<globalThis.StorageNode> | undefined, marshaller?: globalThis.ERef<{
25
+ toCapData: import("@endo/marshal").ToCapData<unknown>;
26
+ fromCapData: import("@endo/marshal").FromCapData<unknown>;
27
+ serialize: import("@endo/marshal").ToCapData<unknown>;
28
+ unserialize: import("@endo/marshal").FromCapData<unknown>;
29
+ }> | undefined): {
24
30
  publicMixin: {
25
- getAmount: (name: string) => Amount<AssetKind>;
26
- getBrand: (name: string) => Brand<AssetKind>;
31
+ getAmount: (name: string) => globalThis.Amount;
32
+ getBrand: (name: string) => globalThis.Brand;
27
33
  getInstance: (name: string) => Instance;
28
34
  getInstallation: (name: string) => Installation<any>;
29
- getInvitationAmount: (name: string) => Amount<"set">;
35
+ getInvitationAmount: (name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>;
30
36
  getNat: (name: string) => bigint;
31
37
  getRatio: (name: string) => Ratio;
32
38
  getString: (name: string) => string;
33
- getTimestamp: (name: string) => import("@agoric/time/src/types.js").TimestampRecord;
34
- getRelativeTime: (name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord;
39
+ getTimestamp: (name: string) => import("@agoric/time").TimestampRecord;
40
+ getRelativeTime: (name: string) => import("@agoric/time").RelativeTimeRecord;
35
41
  getUnknown: (name: string) => any;
36
- getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
37
- getGovernedParams: () => ERef<ParamStateRecord>;
42
+ getSubscription: () => globalThis.StoredSubscription<GovernanceSubscriptionState>;
43
+ getGovernedParams: () => globalThis.ERef<import("./types.js").ParamStateRecord>;
38
44
  };
39
45
  augmentPublicFacet: <PF extends {}>(originalPublicFacet: PF) => GovernedPublicFacet<PF>;
40
46
  augmentVirtualPublicFacet: <OPF extends {}>(originalPublicFacet: OPF) => OPF & {
41
- getAmount: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
42
- getBrand: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
43
- getInstance: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
44
- getInstallation: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
45
- getInvitationAmount: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
46
- getNat: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
47
- getRatio: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
48
- getString: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
49
- getTimestamp: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
50
- getRelativeTime: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
51
- getUnknown: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
52
- getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
53
- getGovernedParams: () => ERef<ParamStateRecord>;
54
- } & import("@endo/eventual-send").RemotableBrand<{}, OPF & {
55
- getAmount: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
56
- getBrand: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
57
- getInstance: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
58
- getInstallation: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
59
- getInvitationAmount: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
60
- getNat: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
61
- getRatio: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
62
- getString: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
63
- getTimestamp: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
64
- getRelativeTime: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
65
- getUnknown: import("@agoric/vat-data/src/types.js").PlusContext<never, ((name: string) => Amount<AssetKind>) | ((name: string) => Brand<AssetKind>) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => Amount<"set">) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time/src/types.js").TimestampRecord) | ((name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord) | ((name: string) => any)>;
66
- getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
67
- getGovernedParams: () => ERef<ParamStateRecord>;
47
+ getBrand: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
48
+ getInstallation: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
49
+ getInstance: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
50
+ getAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
51
+ getInvitationAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
52
+ getNat: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
53
+ getRatio: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
54
+ getString: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
55
+ getTimestamp: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
56
+ getRelativeTime: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
57
+ getUnknown: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
58
+ getSubscription: () => globalThis.StoredSubscription<GovernanceSubscriptionState>;
59
+ getGovernedParams: () => globalThis.ERef<import("./types.js").ParamStateRecord>;
60
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, OPF & {
61
+ getBrand: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
62
+ getInstallation: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
63
+ getInstance: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
64
+ getAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
65
+ getInvitationAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
66
+ getNat: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
67
+ getRatio: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
68
+ getString: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
69
+ getTimestamp: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
70
+ getRelativeTime: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
71
+ getUnknown: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
72
+ getSubscription: () => globalThis.StoredSubscription<GovernanceSubscriptionState>;
73
+ getGovernedParams: () => globalThis.ERef<import("./types.js").ParamStateRecord>;
68
74
  }>;
69
75
  makeGovernorFacet: <CF extends {}>(originalCreatorFacet: CF, governedApis?: {} | undefined) => GovernedCreatorFacet<CF>;
70
76
  makeFarGovernorFacet: <CF_1 extends {}>(limitedCreatorFacet: CF_1, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => GovernedCreatorFacet<CF_1>;
71
- makeVirtualGovernorFacet: (limitedCreatorFacet: {
77
+ makeVirtualGovernorFacet: <LCF extends {
72
78
  [methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown;
73
- }) => {
74
- governorFacet: import("@agoric/vat-data/src/types.js").FunctionsPlusContext<unknown, GovernedCreatorFacet<{
75
- [methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown;
76
- }>>;
77
- limitedCreatorFacet: {
78
- [methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown;
79
- };
79
+ }>(limitedCreatorFacet: LCF) => {
80
+ governorFacet: import("@agoric/swingset-liveslots").FunctionsPlusContext<unknown, GovernedCreatorFacet<LCF>>;
81
+ limitedCreatorFacet: LCF;
80
82
  };
81
- makeDurableGovernorFacet: <CF_2>(baggage: MapStore<string, unknown>, limitedCreatorFacet: CF_2, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => {
82
- governorFacet: {
83
+ makeDurableGovernorFacet: <CF_2>(baggage: import("@agoric/vat-data").Baggage, limitedCreatorFacet: CF_2, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => {
84
+ governorFacet: import("@endo/exo").Guarded<{
83
85
  getParamMgrRetriever: () => {
84
86
  get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
85
87
  Electorate: "invitation";
86
88
  }>;
87
- } & import("@endo/eventual-send").RemotableBrand<{}, {
89
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
88
90
  get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
89
91
  Electorate: "invitation";
90
92
  }>;
91
93
  }>;
92
- getInvitation: (name: any) => Promise<Invitation<unknown, never>>;
93
- getLimitedCreatorFacet: () => CF_2;
94
- /** @type {() => GovernedApis} */
95
- getGovernedApis: () => GovernedApis;
96
- getGovernedApiNames: () => string[];
97
- setOfferFilter: (strings: any) => Promise<void>;
98
- } & import("@endo/eventual-send").RemotableBrand<{}, {
99
- getParamMgrRetriever: () => {
100
- get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
101
- Electorate: "invitation";
102
- }>;
103
- } & import("@endo/eventual-send").RemotableBrand<{}, {
104
- get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
105
- Electorate: "invitation";
106
- }>;
107
- }>;
108
- getInvitation: (name: any) => Promise<Invitation<unknown, never>>;
94
+ getInvitation: (name: any) => Promise<Invitation<unknown, undefined>>;
109
95
  getLimitedCreatorFacet: () => CF_2;
110
96
  /** @type {() => GovernedApis} */
111
97
  getGovernedApis: () => GovernedApis;
@@ -119,18 +105,22 @@ export function handleParamGovernance<M extends import("./contractGovernance/typ
119
105
  }>;
120
106
  };
121
107
  export namespace publicMixinAPI {
122
- const getSubscription: any;
123
- const getGovernedParams: any;
124
- const getAmount: any;
125
- const getBrand: any;
126
- const getInstance: any;
127
- const getInstallation: any;
128
- const getInvitationAmount: any;
129
- const getNat: any;
130
- const getRatio: any;
131
- const getString: any;
132
- const getTimestamp: any;
133
- const getRelativeTime: any;
134
- const getUnknown: any;
108
+ let getSubscription: import("@endo/patterns").MethodGuard;
109
+ let getGovernedParams: import("@endo/patterns").MethodGuard;
110
+ let getAmount: import("@endo/patterns").MethodGuard;
111
+ let getBrand: import("@endo/patterns").MethodGuard;
112
+ let getInstance: import("@endo/patterns").MethodGuard;
113
+ let getInstallation: import("@endo/patterns").MethodGuard;
114
+ let getInvitationAmount: import("@endo/patterns").MethodGuard;
115
+ let getNat: import("@endo/patterns").MethodGuard;
116
+ let getRatio: import("@endo/patterns").MethodGuard;
117
+ let getString: import("@endo/patterns").MethodGuard;
118
+ let getTimestamp: import("@endo/patterns").MethodGuard;
119
+ let getRelativeTime: import("@endo/patterns").MethodGuard;
120
+ let getUnknown: import("@endo/patterns").MethodGuard;
135
121
  }
122
+ import type { GovernanceSubscriptionState } from './types.js';
123
+ import type { GovernedPublicFacet } from './types.js';
124
+ import type { GovernedCreatorFacet } from './types.js';
125
+ import type { GovernedApis } from './types.js';
136
126
  //# sourceMappingURL=contractHelper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contractHelper.d.ts","sourceRoot":"","sources":["contractHelper.js"],"names":[],"mappings":"AAcA,kDAAmD;AAsB5C,wCAHI,IAAI,gBAAgB,EAAE,CAAC,GAAG,EAAE,CAAC,gBAC7B,OAAO,wCAAwC,EAAE,iBAAiB,CAAC,OAAO,CAAC,iBAerF;AAyLD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yKALW,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wHAtImB,OAAO;;yCAuCC,OAAO,WAAW,OAAO,EAAE,KAAK,OAAO;;;6CAAvC,OAAO,WAAW,OAAO,EAAE,KAAK,OAAO;;;6CAAvC,OAAO,WAAW,OAAO,EAAE,KAAK,OAAO;;;qJAgC/C,OAAO;;;;;;;;;;;;;YAkBvC,iCAAiC;mCAAhB,YAAY;;;;;;;;;;;;;;;YAA7B,iCAAiC;mCAAhB,YAAY;;;;;;;;;EAuEpC"}
1
+ {"version":3,"file":"contractHelper.d.ts","sourceRoot":"","sources":["contractHelper.js"],"names":[],"mappings":"AAkBA,kDAAmD;AAwB5C,gFAFI,OAAO,2CAA2C,EAAE,iBAAiB,CAAC,GAAG,CAAC,iBAQpF;qCAnCqO,YAAY;AA6NlP;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sCAJW,CAAC,kIADD,UAAU,iBACV,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wHAxI4B,OAAO;;yCAuCI,OAAO,WAAW,OAAO,EAAE,KAAK,OAAO;;;;;8CA+B7E,OAAO,kBAAkB,EAAE,OAAO,8EAEP,OAAO;;;;;;;;;;;;;YAkBvC,iCAAiC;;;;;;;;;;EAuExC;;;;;;;;;;;;;;;;iDAtQqO,YAAY;yCAAZ,YAAY;0CAAZ,YAAY;kCAAZ,YAAY"}
@@ -2,15 +2,19 @@ import { Far } from '@endo/marshal';
2
2
  import { makeStoredPublisherKit } from '@agoric/notifier';
3
3
  import { getMethodNames, objectMap } from '@agoric/internal';
4
4
  import { ignoreContext, prepareExo } from '@agoric/vat-data';
5
- import { keyEQ, M } from '@agoric/store';
5
+ import { M } from '@agoric/store';
6
6
  import { AmountShape, BrandShape } from '@agoric/ertp';
7
7
  import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time';
8
8
  import { E } from '@endo/eventual-send';
9
- import { assertElectorateMatches } from './contractGovernance/paramManager.js';
10
9
  import { makeParamManagerFromTerms } from './contractGovernance/typedParamManager.js';
11
10
  import { GovernorFacetShape } from './typeGuards.js';
11
+ import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js';
12
12
 
13
- const { Fail, quote: q } = assert;
13
+ /**
14
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, GovernanceSubscriptionState, GovernanceTerms, GovernedApis, GovernedCreatorFacet, GovernedPublicFacet} from './types.js';
15
+ */
16
+
17
+ const { Fail } = assert;
14
18
 
15
19
  export const GOVERNANCE_STORAGE_KEY = 'governance';
16
20
 
@@ -31,31 +35,26 @@ const publicMixinAPI = harden({
31
35
  });
32
36
 
33
37
  /**
38
+ * Verify that the electorate is represented by a live invitation.
39
+ *
34
40
  * @param {ZCF<GovernanceTerms<{}> & {}>} zcf
35
- * @param {import('./contractGovernance/typedParamManager').TypedParamManager<unknown>} paramManager
41
+ * @param {import('./contractGovernance/typedParamManager.js').TypedParamManager<any>} paramManager
36
42
  */
37
43
  export const validateElectorate = (zcf, paramManager) => {
38
- const { governedParams } = zcf.getTerms();
39
- return E.when(paramManager.getParams(), finishedParams => {
40
- try {
41
- keyEQ(governedParams, finishedParams) ||
42
- Fail`The 'governedParams' term must be an object like ${q(
43
- finishedParams,
44
- )}, but was ${q(governedParams)}`;
45
- assertElectorateMatches(paramManager, governedParams);
46
- } catch (err) {
47
- zcf.shutdownWithFailure(err);
48
- }
49
- });
44
+ const invitation = paramManager.getInternalParamValue(CONTRACT_ELECTORATE);
45
+ return E.when(
46
+ E(zcf.getInvitationIssuer()).isLive(invitation),
47
+ isLive => isLive || Fail`Electorate invitation is not live.`,
48
+ );
50
49
  };
51
50
  harden(validateElectorate);
52
51
 
53
52
  /**
54
53
  * Utility function for `makeParamGovernance`.
55
54
  *
56
- * @template T
55
+ * @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} T
57
56
  * @param {ZCF<GovernanceTerms<{}> & {}>} zcf
58
- * @param {import('./contractGovernance/typedParamManager').TypedParamManager<T>} paramManager
57
+ * @param {import('./contractGovernance/typedParamManager.js').TypedParamManager<T>} paramManager
59
58
  */
60
59
  const facetHelpers = (zcf, paramManager) => {
61
60
  // validate async to wait for params to be finished
@@ -152,10 +151,11 @@ const facetHelpers = (zcf, paramManager) => {
152
151
  *
153
152
  * @see {makeDurableGovernorFacet}
154
153
  *
155
- * @param {{ [methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown}} limitedCreatorFacet
154
+ * @template {{ [methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown}} LCF
155
+ * @param {LCF} limitedCreatorFacet
156
156
  */
157
157
  const makeVirtualGovernorFacet = limitedCreatorFacet => {
158
- /** @type {import('@agoric/vat-data/src/types.js').FunctionsPlusContext<unknown, GovernedCreatorFacet<limitedCreatorFacet>>} */
158
+ /** @type {import('@agoric/swingset-liveslots').FunctionsPlusContext<unknown, GovernedCreatorFacet<limitedCreatorFacet>>} */
159
159
  const governorFacet = harden({
160
160
  getParamMgrRetriever: () =>
161
161
  Far('paramRetriever', { get: () => paramManager }),
@@ -244,7 +244,7 @@ const facetHelpers = (zcf, paramManager) => {
244
244
  * parameter values, and the governance guarantees only hold if they're not used
245
245
  * directly by the governed contract.
246
246
  *
247
- * @template {import('./contractGovernance/typedParamManager').ParamTypesMap} M
247
+ * @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} M
248
248
  * Map of types of custom governed terms
249
249
  * @param {ZCF<GovernanceTerms<M>>} zcf
250
250
  * @param {Invitation} initialPoserInvitation
@@ -1,46 +1,50 @@
1
1
  export type QuestionRecord = {
2
- voteCap: ERef<VoteCounterCreatorFacet>;
2
+ voteCap: globalThis.ERef<VoteCounterCreatorFacet>;
3
3
  publicFacet: VoteCounterPublicFacet;
4
- deadline: import('@agoric/time/src/types').Timestamp;
4
+ deadline: import("@agoric/time").Timestamp;
5
5
  };
6
- export type StartCounter = (zcf: ZCF, questionSpec: QuestionSpec, quorumThreshold: unknown, voteCounter: ERef<Installation>, questionStore: MapStore<Handle<'Question'>, QuestionRecord>, questionPublisher: Publisher<unknown>, outcomePublisher: Publisher<OutcomeRecord>) => AddQuestionReturn;
6
+ /**
7
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn} from './types.js';
8
+ */
7
9
  /**
8
10
  * @typedef {object} QuestionRecord
9
11
  * @property {ERef<VoteCounterCreatorFacet>} voteCap
10
12
  * @property {VoteCounterPublicFacet} publicFacet
11
- * @property {import('@agoric/time/src/types').Timestamp} deadline
13
+ * @property {import('@agoric/time').Timestamp} deadline
12
14
  */
13
15
  /**
14
- * @callback StartCounter
16
+ * Start up a new Counter for a question
17
+ *
15
18
  * @param {ZCF} zcf
16
19
  * @param {QuestionSpec} questionSpec
17
20
  * @param {unknown} quorumThreshold
18
21
  * @param {ERef<Installation>} voteCounter
19
22
  * @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
20
- * @param {Publisher<unknown>} questionPublisher
23
+ * @param {Publisher<unknown>} questionsPublisher
21
24
  * @param {Publisher<OutcomeRecord>} outcomePublisher
22
- * @returns {AddQuestionReturn}
23
- */
24
- /**
25
- * Start up a new Counter for a question
26
- *
27
- * @type {StartCounter}
25
+ * @returns {Promise<AddQuestionReturn>}
28
26
  */
29
- export const startCounter: StartCounter;
27
+ export function startCounter(zcf: ZCF, questionSpec: QuestionSpec, quorumThreshold: unknown, voteCounter: ERef<Installation>, questionStore: MapStore<Handle<"Question">, QuestionRecord>, questionsPublisher: Publisher<unknown>, outcomePublisher: globalThis.Publisher<OutcomeRecord>): Promise<AddQuestionReturn>;
30
28
  /** @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore */
31
- export function getOpenQuestions(questionStore: MapStore<Handle<'Question'>, QuestionRecord>): Promise<any>;
29
+ export function getOpenQuestions(questionStore: MapStore<Handle<"Question">, QuestionRecord>): Promise<any>;
32
30
  /**
33
31
  * @param {ERef<Handle<'Question'>>} questionHandleP
34
32
  * @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
35
33
  */
36
- export function getQuestion(questionHandleP: ERef<Handle<'Question'>>, questionStore: MapStore<Handle<'Question'>, QuestionRecord>): Promise<Question>;
34
+ export function getQuestion(questionHandleP: ERef<Handle<"Question">>, questionStore: MapStore<Handle<"Question">, QuestionRecord>): Promise<import("./types.js").Question>;
37
35
  /**
38
36
  * @param {ZCF} zcf
39
37
  * @param {AddQuestion} addQuestion
40
38
  */
41
39
  export function getPoserInvitation(zcf: ZCF, addQuestion: AddQuestion): Promise<Invitation<{
42
40
  addQuestion: AddQuestion;
43
- } & import("@endo/eventual-send").RemotableBrand<{}, {
41
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
44
42
  addQuestion: AddQuestion;
45
- }>, never>>;
43
+ }>, undefined>>;
44
+ import type { VoteCounterCreatorFacet } from './types.js';
45
+ import type { VoteCounterPublicFacet } from './types.js';
46
+ import type { QuestionSpec } from './types.js';
47
+ import type { OutcomeRecord } from './types.js';
48
+ import type { AddQuestionReturn } from './types.js';
49
+ import type { AddQuestion } from './types.js';
46
50
  //# sourceMappingURL=electorateTools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"electorateTools.d.ts","sourceRoot":"","sources":["electorateTools.js"],"names":[],"mappings":";aAKc,KAAK,uBAAuB,CAAC;iBAC7B,sBAAsB;cACtB,OAAO,wBAAwB,EAAE,SAAS;;iCAK7C,GAAG,gBACH,YAAY,mBACZ,OAAO,eACP,KAAK,YAAY,CAAC,iBAClB,SAAS,OAAO,UAAU,CAAC,EAAE,cAAc,CAAC,qBAC5C,UAAU,OAAO,CAAC,oBAClB,UAAU,aAAa,CAAC,KACtB,iBAAiB;AAhB9B;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,2BAFU,YAAY,CAsCpB;AAEF,0EAA0E;AAC1E,gDADY,SAAS,OAAO,UAAU,CAAC,EAAE,cAAc,CAAC,gBAYvD;AAED;;;GAGG;AACH,6CAHW,KAAK,OAAO,UAAU,CAAC,CAAC,iBACxB,SAAS,OAAO,UAAU,CAAC,EAAE,cAAc,CAAC,qBAKpD;AAEH;;;GAGG;AACH,wCAHW,GAAG,eACH,WAAW;;;;YAKrB"}
1
+ {"version":3,"file":"electorateTools.d.ts","sourceRoot":"","sources":["electorateTools.js"],"names":[],"mappings":";;;cAYc,OAAO,cAAc,EAAE,SAAS;;AAR9C;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,kCATW,GAAG,+CAEH,OAAO,eACP,IAAI,CAAC,YAAY,CAAC,iBAClB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,sBAC5C,SAAS,CAAC,OAAO,CAAC,qFAwC5B;AAED,0EAA0E;AAC1E,gDADY,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,gBAYvD;AAED;;;GAGG;AACH,6CAHW,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,iBACxB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,0CAKpD;AAEH;;;GAGG;AACH,wCAHW,GAAG;;;;gBAcb;6CAlG8H,YAAY;4CAAZ,YAAY;kCAAZ,YAAY;mCAAZ,YAAY;uCAAZ,YAAY;iCAAZ,YAAY"}
@@ -1,29 +1,29 @@
1
+ import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
1
2
  import { E } from '@endo/eventual-send';
2
3
  import { deeplyFulfilled, Far } from '@endo/marshal';
3
4
 
5
+ /**
6
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn} from './types.js';
7
+ */
8
+
4
9
  /**
5
10
  * @typedef {object} QuestionRecord
6
11
  * @property {ERef<VoteCounterCreatorFacet>} voteCap
7
12
  * @property {VoteCounterPublicFacet} publicFacet
8
- * @property {import('@agoric/time/src/types').Timestamp} deadline
13
+ * @property {import('@agoric/time').Timestamp} deadline
9
14
  */
10
15
 
11
16
  /**
12
- * @callback StartCounter
17
+ * Start up a new Counter for a question
18
+ *
13
19
  * @param {ZCF} zcf
14
20
  * @param {QuestionSpec} questionSpec
15
21
  * @param {unknown} quorumThreshold
16
22
  * @param {ERef<Installation>} voteCounter
17
23
  * @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
18
- * @param {Publisher<unknown>} questionPublisher
24
+ * @param {Publisher<unknown>} questionsPublisher
19
25
  * @param {Publisher<OutcomeRecord>} outcomePublisher
20
- * @returns {AddQuestionReturn}
21
- */
22
-
23
- /**
24
- * Start up a new Counter for a question
25
- *
26
- * @type {StartCounter}
26
+ * @returns {Promise<AddQuestionReturn>}
27
27
  */
28
28
  const startCounter = async (
29
29
  zcf,
@@ -91,8 +91,16 @@ const getQuestion = (questionHandleP, questionStore) =>
91
91
  * @param {AddQuestion} addQuestion
92
92
  */
93
93
  const getPoserInvitation = (zcf, addQuestion) => {
94
- const questionPoserHandler = () => Far(`questionPoser`, { addQuestion });
95
- return zcf.makeInvitation(questionPoserHandler, `questionPoser`);
94
+ const questionPoserHandler = seat => {
95
+ seat.exit();
96
+ return Far(`questionPoser`, { addQuestion });
97
+ };
98
+ return zcf.makeInvitation(
99
+ questionPoserHandler,
100
+ `questionPoser`,
101
+ undefined,
102
+ EmptyProposalShape,
103
+ );
96
104
  };
97
105
 
98
106
  harden(startCounter);
package/src/index.js CHANGED
@@ -1,9 +1,6 @@
1
- // Ambient types. https://github.com/Agoric/agoric-sdk/issues/6512
2
- import '@agoric/swingset-vat/src/vats/network/types.js';
3
- import '@agoric/ertp/exported.js';
4
- import '@agoric/zoe/exported.js';
5
-
6
- import './types-ambient.js';
1
+ /// <reference types="@agoric/internal/exported" />
2
+ /// <reference types="@agoric/ertp/exported" />
3
+ /// <reference types="@agoric/zoe/exported" />
7
4
 
8
5
  export {
9
6
  ChoiceMethod,
@@ -8,9 +8,12 @@ export function start(zcf: ZCF<{
8
8
  questionSpec: QuestionSpec;
9
9
  quorumThreshold: bigint;
10
10
  }>, { outcomePublisher }: {
11
- outcomePublisher: Publisher<MultiOutcomeRecord>;
11
+ outcomePublisher: globalThis.Publisher<MultiOutcomeRecord>;
12
12
  }): {
13
- publicFacet: MultiVoteCounterPublicFacet;
14
- creatorFacet: VoteCounterCreatorFacet;
13
+ publicFacet: import("./types.js").MultiVoteCounterPublicFacet;
14
+ creatorFacet: import("./types.js").VoteCounterCreatorFacet;
15
15
  };
16
+ import type { BuildMultiVoteCounter } from './types.js';
17
+ import type { QuestionSpec } from './types.js';
18
+ import type { MultiOutcomeRecord } from './types.js';
16
19
  //# sourceMappingURL=multiCandidateVoteCounter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"multiCandidateVoteCounter.d.ts","sourceRoot":"","sources":["multiCandidateVoteCounter.js"],"names":[],"mappings":"AAgCA,oCAAoC;AACpC,4CADW,qBAAqB,CAwL9B;AAEF;;;GAGG;AACH;kBAH8B,YAAY;qBAAmB,MAAM;0BACxD;IAAC,gBAAgB,EAAE,UAAU,kBAAkB,CAAC,CAAA;CAAC;;;EAgB3D"}
1
+ {"version":3,"file":"multiCandidateVoteCounter.d.ts","sourceRoot":"","sources":["multiCandidateVoteCounter.js"],"names":[],"mappings":"AAoCA,oCAAoC;AACpC,kEAuLE;AAEF;;;GAGG;AACH;;qBAH6D,MAAM;;;;;;EAiBlE;2CA5NmG,YAAY;kCAAZ,YAAY;wCAAZ,YAAY"}
@@ -17,6 +17,10 @@ import {
17
17
  import { makeQuorumCounter } from './quorumCounter.js';
18
18
  import { breakTie } from './breakTie.js';
19
19
 
20
+ /**
21
+ * @import {QuestionSpec, BuildMultiVoteCounter, MultiOutcomeRecord, Position, VoteStatistics} from './types.js';
22
+ */
23
+
20
24
  const { Fail } = assert;
21
25
 
22
26
  const validateQuestionSpec = questionSpec => {
@@ -96,7 +100,7 @@ const makeMultiCandidateVoteCounter = (
96
100
  outcome: 'fail',
97
101
  reason: 'No quorum',
98
102
  };
99
- E(publisher).publish(voteOutcome);
103
+ void E(publisher).publish(voteOutcome);
100
104
  return;
101
105
  }
102
106
 
@@ -139,7 +143,7 @@ const makeMultiCandidateVoteCounter = (
139
143
  outcomePromise.resolve(untiedPositions.concat(tieWinners));
140
144
  }
141
145
 
142
- E.when(outcomePromise.promise, winPositions => {
146
+ void E.when(outcomePromise.promise, winPositions => {
143
147
  /** @type { MultiOutcomeRecord } */
144
148
  const voteOutcome = {
145
149
  question: details.questionHandle,
@@ -169,10 +173,10 @@ const makeMultiCandidateVoteCounter = (
169
173
  chosenPositions.length <= maxChoices ||
170
174
  Fail`The number of choices exceeds the max choices.`;
171
175
 
172
- chosenPositions.forEach(position => {
176
+ for (const position of chosenPositions) {
173
177
  positionIncluded(positions, position) ||
174
178
  Fail`The specified choice is not a legal position: ${position}.`;
175
- });
179
+ }
176
180
 
177
181
  const completedBallot = harden({ chosen: chosenPositions, shares });
178
182
 
@@ -1,8 +1,13 @@
1
+ /**
2
+ * @import {ElectoratePublic, ElectorateCreatorFacet} from './types.js';
3
+ */
1
4
  /**
2
5
  * This Electorate visibly has no members, takes no votes, and approves no
3
6
  * changes.
4
7
  *
5
8
  * @type {ContractStartFn<ElectoratePublic, ElectorateCreatorFacet>}
6
9
  */
7
- export const start: ContractStartFn<ElectoratePublic, ElectorateCreatorFacet>;
10
+ export const start: ContractStartFn<ElectoratePublic, ElectorateCreatorFacet, any, any>;
11
+ import type { ElectoratePublic } from './types.js';
12
+ import type { ElectorateCreatorFacet } from './types.js';
8
13
  //# sourceMappingURL=noActionElectorate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noActionElectorate.d.ts","sourceRoot":"","sources":["noActionElectorate.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,oBAFW,gBAAgB,gBAAgB,EAAE,sBAAsB,CAAC,CA+ClE"}
1
+ {"version":3,"file":"noActionElectorate.d.ts","sourceRoot":"","sources":["noActionElectorate.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;;;;GAKG;AACH,wFAiDE;sCA1DyD,YAAY;4CAAZ,YAAY"}
@@ -1,9 +1,14 @@
1
1
  import { makePublishKit } from '@agoric/notifier';
2
2
  import { makePromiseKit } from '@endo/promise-kit';
3
3
  import { makeExo } from '@agoric/store';
4
+ import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
4
5
 
5
6
  import { ElectoratePublicI, ElectorateCreatorI } from './typeGuards.js';
6
7
 
8
+ /**
9
+ * @import {ElectoratePublic, ElectorateCreatorFacet} from './types.js';
10
+ */
11
+
7
12
  /**
8
13
  * This Electorate visibly has no members, takes no votes, and approves no
9
14
  * changes.
@@ -37,8 +42,12 @@ const start = zcf => {
37
42
 
38
43
  const creatorFacet = makeExo('creatorFacet', ElectorateCreatorI, {
39
44
  getPoserInvitation() {
40
- return zcf.makeInvitation(() => {},
41
- `noActionElectorate doesn't allow posing questions`);
45
+ return zcf.makeInvitation(
46
+ () => {},
47
+ `noActionElectorate doesn't allow posing questions`,
48
+ undefined,
49
+ EmptyProposalShape,
50
+ );
42
51
  },
43
52
  addQuestion(_instance, _question) {
44
53
  throw Error(`noActionElectorate doesn't add questions.`);