@agoric/zoe 0.26.3-dev-0001c49.0 → 0.26.3-dev-a0953fe.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/zoe",
|
|
3
|
-
"version": "0.26.3-dev-
|
|
3
|
+
"version": "0.26.3-dev-a0953fe.0+a0953fe",
|
|
4
4
|
"description": "Zoe: the Smart Contract Framework for Offer Enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/zoeService/zoe.js",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agoric/assert": "0.6.1-dev-
|
|
47
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
48
|
-
"@agoric/internal": "0.3.3-dev-
|
|
49
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-dev-
|
|
51
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
52
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
53
|
-
"@agoric/time": "0.3.3-dev-
|
|
54
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
46
|
+
"@agoric/assert": "0.6.1-dev-a0953fe.0+a0953fe",
|
|
47
|
+
"@agoric/ertp": "0.16.3-dev-a0953fe.0+a0953fe",
|
|
48
|
+
"@agoric/internal": "0.3.3-dev-a0953fe.0+a0953fe",
|
|
49
|
+
"@agoric/notifier": "0.6.3-dev-a0953fe.0+a0953fe",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-a0953fe.0+a0953fe",
|
|
51
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-a0953fe.0+a0953fe",
|
|
52
|
+
"@agoric/swingset-vat": "0.32.3-dev-a0953fe.0+a0953fe",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-a0953fe.0+a0953fe",
|
|
54
|
+
"@agoric/vat-data": "0.5.3-dev-a0953fe.0+a0953fe",
|
|
55
55
|
"@endo/bundle-source": "^2.7.0",
|
|
56
56
|
"@endo/captp": "^3.1.4",
|
|
57
57
|
"@endo/eventual-send": "^0.17.5",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"yargs-parser": "^21.1.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
67
|
+
"@agoric/kmarshal": "0.1.1-dev-a0953fe.0+a0953fe",
|
|
68
68
|
"@endo/init": "^0.5.59",
|
|
69
69
|
"ava": "^5.3.0",
|
|
70
70
|
"c8": "^7.13.0",
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"typeCoverage": {
|
|
138
138
|
"atLeast": 81.5
|
|
139
139
|
},
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "a0953fe7d6d64fb37d426f69c087aa2d0a7ca4fe"
|
|
141
141
|
}
|
|
@@ -244,4 +244,4 @@ type ContractStartFnResult<PF, CF> = {
|
|
|
244
244
|
creatorInvitation?: Promise<Invitation<R, A>> | undefined;
|
|
245
245
|
};
|
|
246
246
|
type ContractOf<S> = import('../zoeService/utils').ContractOf<S>;
|
|
247
|
-
type AdminFacet = import('../zoeService/utils').AdminFacet
|
|
247
|
+
type AdminFacet = import('../zoeService/utils').AdminFacet<any>;
|
|
@@ -11,16 +11,6 @@ type ContractFacet<T extends {} = {}> = {
|
|
|
11
11
|
readonly [P in keyof T]: T[P] extends Callable ? T[P] : never;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type AdminFacet = {
|
|
15
|
-
// Completion, which is currently any
|
|
16
|
-
getVatShutdownPromise: () => Promise<any>;
|
|
17
|
-
upgradeContract: (
|
|
18
|
-
contractBundleId: string,
|
|
19
|
-
newPrivateArgs?: any,
|
|
20
|
-
) => Promise<VatUpgradeResults>;
|
|
21
|
-
restartContract: (newPrivateArgs?: any) => Promise<VatUpgradeResults>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
14
|
/**
|
|
25
15
|
* Installation of a contract, typed by its start function.
|
|
26
16
|
*/
|
|
@@ -46,11 +36,29 @@ type ContractStartFunction = (
|
|
|
46
36
|
baggage?: Baggage,
|
|
47
37
|
) => ERef<{ creatorFacet?: {}; publicFacet?: {} }>;
|
|
48
38
|
|
|
39
|
+
export type AdminFacet<SF extends ContractStartFunction> = {
|
|
40
|
+
// Completion, which is currently any
|
|
41
|
+
getVatShutdownPromise: () => Promise<any>;
|
|
42
|
+
upgradeContract: Parameters<SF>[1] extends undefined
|
|
43
|
+
? (contractBundleId: string) => Promise<VatUpgradeResults>
|
|
44
|
+
: (
|
|
45
|
+
contractBundleId: string,
|
|
46
|
+
newPrivateArgs: Parameters<SF>[1],
|
|
47
|
+
) => Promise<VatUpgradeResults>;
|
|
48
|
+
restartContract: Parameters<SF>[1] extends undefined
|
|
49
|
+
? () => Promise<VatUpgradeResults>
|
|
50
|
+
: (newPrivateArgs: Parameters<SF>[1]) => Promise<VatUpgradeResults>;
|
|
51
|
+
};
|
|
52
|
+
|
|
49
53
|
type StartParams<SF> = SF extends ContractStartFunction
|
|
50
|
-
?
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
? Parameters<SF>[1] extends undefined
|
|
55
|
+
? {
|
|
56
|
+
terms: ReturnType<Parameters<SF>[0]['getTerms']>;
|
|
57
|
+
}
|
|
58
|
+
: {
|
|
59
|
+
terms: ReturnType<Parameters<SF>[0]['getTerms']>;
|
|
60
|
+
privateArgs: Parameters<SF>[1];
|
|
61
|
+
}
|
|
54
62
|
: never;
|
|
55
63
|
|
|
56
64
|
type StartResult<S> = S extends (...args: any) => Promise<infer U>
|
|
@@ -72,13 +80,13 @@ type StartContractInstance<C> = (
|
|
|
72
80
|
publicFacet: C['publicFacet'];
|
|
73
81
|
instance: Instance;
|
|
74
82
|
creatorInvitation: C['creatorInvitation'];
|
|
75
|
-
adminFacet: AdminFacet
|
|
83
|
+
adminFacet: AdminFacet<any>;
|
|
76
84
|
}>;
|
|
77
85
|
|
|
78
86
|
/** The result of `startInstance` */
|
|
79
87
|
export type StartedInstanceKit<SF> = {
|
|
80
88
|
instance: Instance<SF>;
|
|
81
|
-
adminFacet: AdminFacet
|
|
89
|
+
adminFacet: AdminFacet<SF>;
|
|
82
90
|
// theses are empty by default. the return type will override
|
|
83
91
|
creatorFacet: {};
|
|
84
92
|
publicFacet: {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StartedInstanceKit } from './utils';
|
|
2
|
+
|
|
3
|
+
const someContractStartFn = (
|
|
4
|
+
zcf: ZCF,
|
|
5
|
+
privateArgs: { someNumber: number; someString: string },
|
|
6
|
+
) => {};
|
|
7
|
+
|
|
8
|
+
type PsmInstanceKit = StartedInstanceKit<typeof someContractStartFn>;
|
|
9
|
+
|
|
10
|
+
const psmInstanceKit: PsmInstanceKit = null as any;
|
|
11
|
+
|
|
12
|
+
// @ts-expect-error missing privateArgs argument
|
|
13
|
+
void psmInstanceKit.adminFacet.restartContract();
|
|
14
|
+
|
|
15
|
+
const partial = {
|
|
16
|
+
someNumber: 1,
|
|
17
|
+
};
|
|
18
|
+
// @ts-expect-error missing member of privateArgs argument
|
|
19
|
+
void psmInstanceKit.adminFacet.restartContract(partial);
|
|
20
|
+
|
|
21
|
+
// valid privateArgs now with 'marshaller'
|
|
22
|
+
void psmInstanceKit.adminFacet.restartContract({
|
|
23
|
+
...partial,
|
|
24
|
+
someString: 'str',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// @ts-expect-error missing member of privateArgs argument
|
|
28
|
+
void psmInstanceKit.adminFacet.upgradeContract('whatever', partial);
|
|
29
|
+
// valid privateArgs now with 'marshaller'
|
|
30
|
+
void psmInstanceKit.adminFacet.upgradeContract('whatever', {
|
|
31
|
+
...partial,
|
|
32
|
+
someString: 'str',
|
|
33
|
+
});
|