@agoric/vats 0.15.2-dev-4c9a859.0 → 0.15.2-dev-c74c628.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 +16 -15
- package/src/localchain.d.ts +18 -17
- package/src/localchain.d.ts.map +1 -1
- package/src/localchain.js +13 -13
- package/src/proposals/localchain-proposal.d.ts +32 -8
- package/src/proposals/localchain-test.d.ts.map +1 -1
- package/src/proposals/localchain-test.js +9 -7
- package/src/vat-localchain.d.ts +32 -8
- package/src/vat-localchain.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/vats",
|
|
3
|
-
"version": "0.15.2-dev-
|
|
3
|
+
"version": "0.15.2-dev-c74c628.0+c74c628",
|
|
4
4
|
"description": "Agoric's Vat library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -22,18 +22,19 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/assert": "0.6.1-dev-
|
|
26
|
-
"@agoric/
|
|
27
|
-
"@agoric/
|
|
28
|
-
"@agoric/
|
|
29
|
-
"@agoric/
|
|
30
|
-
"@agoric/
|
|
31
|
-
"@agoric/
|
|
32
|
-
"@agoric/
|
|
33
|
-
"@agoric/
|
|
34
|
-
"@agoric/
|
|
35
|
-
"@agoric/
|
|
36
|
-
"@agoric/
|
|
25
|
+
"@agoric/assert": "0.6.1-dev-c74c628.0+c74c628",
|
|
26
|
+
"@agoric/cosmic-proto": "0.4.1-dev-c74c628.0+c74c628",
|
|
27
|
+
"@agoric/ertp": "0.16.3-dev-c74c628.0+c74c628",
|
|
28
|
+
"@agoric/governance": "0.10.4-dev-c74c628.0+c74c628",
|
|
29
|
+
"@agoric/internal": "0.3.3-dev-c74c628.0+c74c628",
|
|
30
|
+
"@agoric/network": "0.1.1-dev-c74c628.0+c74c628",
|
|
31
|
+
"@agoric/notifier": "0.6.3-dev-c74c628.0+c74c628",
|
|
32
|
+
"@agoric/store": "0.9.3-dev-c74c628.0+c74c628",
|
|
33
|
+
"@agoric/swingset-vat": "0.32.3-dev-c74c628.0+c74c628",
|
|
34
|
+
"@agoric/time": "0.3.3-dev-c74c628.0+c74c628",
|
|
35
|
+
"@agoric/vat-data": "0.5.3-dev-c74c628.0+c74c628",
|
|
36
|
+
"@agoric/zoe": "0.26.3-dev-c74c628.0+c74c628",
|
|
37
|
+
"@agoric/zone": "0.2.3-dev-c74c628.0+c74c628",
|
|
37
38
|
"@endo/far": "^1.1.1",
|
|
38
39
|
"@endo/import-bundle": "^1.1.1",
|
|
39
40
|
"@endo/marshal": "^1.4.1",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"jessie.js": "^0.3.4"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
48
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-c74c628.0+c74c628",
|
|
48
49
|
"@endo/bundle-source": "^3.2.2",
|
|
49
50
|
"@endo/init": "^1.1.1",
|
|
50
51
|
"ava": "^5.3.0",
|
|
@@ -77,5 +78,5 @@
|
|
|
77
78
|
"typeCoverage": {
|
|
78
79
|
"atLeast": 89.58
|
|
79
80
|
},
|
|
80
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "c74c62863bb9de77e66f8d909058804912e72528"
|
|
81
82
|
}
|
package/src/localchain.d.ts
CHANGED
|
@@ -44,39 +44,40 @@ export function prepareLocalChainTools(zone: import('@agoric/base-zone').Zone):
|
|
|
44
44
|
*/
|
|
45
45
|
deposit(payment: Payment): Promise<globalThis.Amount<globalThis.AssetKind>>;
|
|
46
46
|
/**
|
|
47
|
-
* @param {
|
|
48
|
-
* @returns {Promise<
|
|
47
|
+
* @param {import('@agoric/cosmic-proto').TypedJson<unknown>[]} messages
|
|
48
|
+
* @returns {Promise<import('@agoric/cosmic-proto').TypedJson[]>}
|
|
49
49
|
*/
|
|
50
|
-
executeTx(messages:
|
|
50
|
+
executeTx(messages: import('@agoric/cosmic-proto').TypedJson<unknown>[]): Promise<import('@agoric/cosmic-proto').TypedJson[]>;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* Make a single query to the local chain. Will reject with an error if
|
|
54
54
|
* the query fails. Otherwise, return the response as a JSON-compatible
|
|
55
55
|
* object.
|
|
56
56
|
*
|
|
57
|
-
* @param {
|
|
58
|
-
* @returns {Promise<
|
|
57
|
+
* @param {import('@agoric/cosmic-proto').TypedJson} request
|
|
58
|
+
* @returns {Promise<import('@agoric/cosmic-proto').TypedJson>}
|
|
59
59
|
*/
|
|
60
|
-
query(request:
|
|
60
|
+
query(request: import('@agoric/cosmic-proto').TypedJson): Promise<import('@agoric/cosmic-proto').TypedJson>;
|
|
61
61
|
/**
|
|
62
62
|
* Send a batch of query requests to the local chain. Unless there is a
|
|
63
63
|
* system error, will return all results to indicate their success or
|
|
64
64
|
* failure.
|
|
65
65
|
*
|
|
66
|
-
* @param {
|
|
67
|
-
* @returns {Promise<
|
|
66
|
+
* @param {import('@agoric/cosmic-proto').TypedJson[]} requests
|
|
67
|
+
* @returns {Promise<
|
|
68
|
+
* {
|
|
69
|
+
* error?: string;
|
|
70
|
+
* reply: import('@agoric/cosmic-proto').TypedJson;
|
|
71
|
+
* }[]
|
|
72
|
+
* >}
|
|
68
73
|
*/
|
|
69
|
-
queryMany(requests:
|
|
74
|
+
queryMany(requests: import('@agoric/cosmic-proto').TypedJson[]): Promise<{
|
|
70
75
|
error?: string;
|
|
71
|
-
reply:
|
|
76
|
+
reply: import('@agoric/cosmic-proto').TypedJson;
|
|
72
77
|
}[]>;
|
|
73
78
|
};
|
|
74
79
|
}>;
|
|
75
80
|
};
|
|
76
|
-
export type Proto3Jsonable = {
|
|
77
|
-
'@type': string;
|
|
78
|
-
[x: string]: unknown;
|
|
79
|
-
};
|
|
80
81
|
export type LocalChainPowers = {
|
|
81
82
|
system: import('./types.js').ScopedBridgeManager;
|
|
82
83
|
bankManager: import('./vat-bank.js').BankManager;
|
|
@@ -98,10 +99,10 @@ declare function prepareLocalChainAccount(zone: import('@agoric/base-zone').Zone
|
|
|
98
99
|
*/
|
|
99
100
|
deposit(payment: Payment): Promise<globalThis.Amount<globalThis.AssetKind>>;
|
|
100
101
|
/**
|
|
101
|
-
* @param {
|
|
102
|
-
* @returns {Promise<
|
|
102
|
+
* @param {import('@agoric/cosmic-proto').TypedJson<unknown>[]} messages
|
|
103
|
+
* @returns {Promise<import('@agoric/cosmic-proto').TypedJson[]>}
|
|
103
104
|
*/
|
|
104
|
-
executeTx(messages:
|
|
105
|
+
executeTx(messages: import('@agoric/cosmic-proto').TypedJson<unknown>[]): Promise<import('@agoric/cosmic-proto').TypedJson[]>;
|
|
105
106
|
}>;
|
|
106
107
|
export {};
|
|
107
108
|
//# sourceMappingURL=localchain.d.ts.map
|
package/src/localchain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localchain.d.ts","sourceRoot":"","sources":["localchain.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localchain.d.ts","sourceRoot":"","sources":["localchain.js"],"names":[],"mappings":"AA6BA;;;;GAMG;AAuDH;;;;GAIG;AAEH;;;;GAIG;AAEH;;GAEG;AAsGI,6CADK,OAAO,mBAAmB,EAAE,IAAI;;;YA9EpC;;;;eAIG;;;;YAgBH;;;;;eAKG;;;gBApGL;;;;;;mBAMG;iCADQ,OAAO;gBAYlB;;;mBAGG;oCAFQ,OAAO,sBAAsB,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,GACjD,QAAQ,OAAO,sBAAsB,EAAE,SAAS,EAAE,CAAC;;YA0F9D;;;;;;;eAOG;2BAFQ,OAAO,sBAAsB,EAAE,SAAS,GACtC,QAAQ,OAAO,sBAAsB,EAAE,SAAS,CAAC;YAa9D;;;;;;;;;;;;eAYG;gCAPQ,OAAO,sBAAsB,EAAE,SAAS,EAAE,GACxC,QACZ;gBACA,KAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,KAAW,EAAE,OAAO,sBAAsB,EAAE,SAAS,CAAC;aACjD,EAAE,CACJ;;;EAoBX;+BA3MY;IACZ,MAAU,EAAE,OAAO,YAAY,EAAE,mBAAmB,CAAC;IACrD,WAAe,EAAE,OAAO,eAAe,EAAE,WAAW,CAAC;CAClD;yBAES,SACZ,MAAU,gBAAgB,EAC1B,gBAAoB,CAAC,MAAM,gBAAgB,CAAC,CACzC;gCA2ES,QACZ,WAAe,QAAQ,WAAW,+BAA+B,CAAC,CAAC,CAAC,CACjE;8BAyHU,WAAW,6BAA6B,CAAC;4BACzC,WAAW,eAAe,CAAC,gBAAgB,CAAC,CAAC;yBAC7C,aAAa,CAAC,QAAQ,CAAC;AAnLrC,qDAAqD;AACrD,gDADY,OAAO,mBAAmB,EAAE,IAAI;;IAetC;;;;;;OAMG;qBADQ,OAAO;IAYlB;;;OAGG;wBAFQ,OAAO,sBAAsB,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,GACjD,QAAQ,OAAO,sBAAsB,EAAE,SAAS,EAAE,CAAC;GAkBnE"}
|
package/src/localchain.js
CHANGED
|
@@ -5,13 +5,6 @@ import { AmountShape } from '@agoric/ertp';
|
|
|
5
5
|
|
|
6
6
|
const { Fail, bare } = assert;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {{
|
|
10
|
-
* '@type': string;
|
|
11
|
-
* [x: string]: unknown;
|
|
12
|
-
* }} Proto3Jsonable
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
8
|
/**
|
|
16
9
|
* @typedef {{
|
|
17
10
|
* system: import('./types.js').ScopedBridgeManager;
|
|
@@ -75,11 +68,13 @@ const prepareLocalChainAccount = zone =>
|
|
|
75
68
|
return E(allegedPurse).deposit(payment);
|
|
76
69
|
},
|
|
77
70
|
/**
|
|
78
|
-
* @param {
|
|
79
|
-
* @returns {Promise<
|
|
71
|
+
* @param {import('@agoric/cosmic-proto').TypedJson<unknown>[]} messages
|
|
72
|
+
* @returns {Promise<import('@agoric/cosmic-proto').TypedJson[]>}
|
|
80
73
|
*/
|
|
81
74
|
async executeTx(messages) {
|
|
82
75
|
const { address, powers } = this.state;
|
|
76
|
+
messages.length > 0 || Fail`need at least one message to execute`;
|
|
77
|
+
|
|
83
78
|
const obj = {
|
|
84
79
|
type: 'VLOCALCHAIN_EXECUTE_TX',
|
|
85
80
|
// This address is the only one that `VLOCALCHAIN_EXECUTE_TX` will
|
|
@@ -169,8 +164,8 @@ const prepareLocalChain = (zone, createAccount) =>
|
|
|
169
164
|
* the query fails. Otherwise, return the response as a JSON-compatible
|
|
170
165
|
* object.
|
|
171
166
|
*
|
|
172
|
-
* @param {
|
|
173
|
-
* @returns {Promise<
|
|
167
|
+
* @param {import('@agoric/cosmic-proto').TypedJson} request
|
|
168
|
+
* @returns {Promise<import('@agoric/cosmic-proto').TypedJson>}
|
|
174
169
|
*/
|
|
175
170
|
async query(request) {
|
|
176
171
|
const requests = harden([request]);
|
|
@@ -188,8 +183,13 @@ const prepareLocalChain = (zone, createAccount) =>
|
|
|
188
183
|
* system error, will return all results to indicate their success or
|
|
189
184
|
* failure.
|
|
190
185
|
*
|
|
191
|
-
* @param {
|
|
192
|
-
* @returns {Promise<
|
|
186
|
+
* @param {import('@agoric/cosmic-proto').TypedJson[]} requests
|
|
187
|
+
* @returns {Promise<
|
|
188
|
+
* {
|
|
189
|
+
* error?: string;
|
|
190
|
+
* reply: import('@agoric/cosmic-proto').TypedJson;
|
|
191
|
+
* }[]
|
|
192
|
+
* >}
|
|
193
193
|
*/
|
|
194
194
|
async queryMany(requests) {
|
|
195
195
|
const { powers } = this.state;
|
|
@@ -68,12 +68,24 @@ export type LocalChainVats = {
|
|
|
68
68
|
createAccount(): Promise<import("@endo/exo").Guarded<{
|
|
69
69
|
getAddress(): Promise<string>;
|
|
70
70
|
deposit(payment: globalThis.Payment): Promise<globalThis.Amount<globalThis.AssetKind>>;
|
|
71
|
-
executeTx(messages:
|
|
71
|
+
executeTx(messages: {
|
|
72
|
+
'@type': string;
|
|
73
|
+
}[]): Promise<{
|
|
74
|
+
'@type': string;
|
|
75
|
+
}[]>;
|
|
72
76
|
}>>;
|
|
73
|
-
query(request:
|
|
74
|
-
|
|
77
|
+
query(request: {
|
|
78
|
+
'@type': string;
|
|
79
|
+
}): Promise<{
|
|
80
|
+
'@type': string;
|
|
81
|
+
}>;
|
|
82
|
+
queryMany(requests: {
|
|
83
|
+
'@type': string;
|
|
84
|
+
}[]): Promise<{
|
|
75
85
|
error?: string | undefined;
|
|
76
|
-
reply:
|
|
86
|
+
reply: {
|
|
87
|
+
'@type': string;
|
|
88
|
+
};
|
|
77
89
|
}[]>;
|
|
78
90
|
};
|
|
79
91
|
}>;
|
|
@@ -86,12 +98,24 @@ export type LocalChainVats = {
|
|
|
86
98
|
createAccount(): Promise<import("@endo/exo").Guarded<{
|
|
87
99
|
getAddress(): Promise<string>;
|
|
88
100
|
deposit(payment: globalThis.Payment): Promise<globalThis.Amount<globalThis.AssetKind>>;
|
|
89
|
-
executeTx(messages:
|
|
101
|
+
executeTx(messages: {
|
|
102
|
+
'@type': string;
|
|
103
|
+
}[]): Promise<{
|
|
104
|
+
'@type': string;
|
|
105
|
+
}[]>;
|
|
90
106
|
}>>;
|
|
91
|
-
query(request:
|
|
92
|
-
|
|
107
|
+
query(request: {
|
|
108
|
+
'@type': string;
|
|
109
|
+
}): Promise<{
|
|
110
|
+
'@type': string;
|
|
111
|
+
}>;
|
|
112
|
+
queryMany(requests: {
|
|
113
|
+
'@type': string;
|
|
114
|
+
}[]): Promise<{
|
|
93
115
|
error?: string | undefined;
|
|
94
|
-
reply:
|
|
116
|
+
reply: {
|
|
117
|
+
'@type': string;
|
|
118
|
+
};
|
|
95
119
|
}[]>;
|
|
96
120
|
};
|
|
97
121
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localchain-test.d.ts","sourceRoot":"","sources":["localchain-test.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localchain-test.d.ts","sourceRoot":"","sources":["localchain-test.js"],"names":[],"mappings":"AAaO,0EARI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,UAAgB,EAAE,OAAO,kBAAkB,EAAE,UAAU,CAAC;KACnD,CAAC;CACH;IAE2C,OAAO,EAA3C;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;kBA4DpC;AAEM;;;;;;;;;;;;;;EAYL"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { E } from '@endo/far';
|
|
3
|
+
import { typedJson } from '@agoric/cosmic-proto';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @param {BootstrapPowers & {
|
|
@@ -31,19 +32,20 @@ export const testLocalChain = async (
|
|
|
31
32
|
console.info('created account', lca);
|
|
32
33
|
const address = await E(lca).getAddress();
|
|
33
34
|
console.info('address', address);
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
const queryMsg = typedJson('/cosmos.bank.v1beta1.QueryAllBalancesRequest', {
|
|
36
37
|
address,
|
|
37
38
|
});
|
|
39
|
+
const balances = await E(localchain).query(queryMsg);
|
|
38
40
|
console.info('balances', balances);
|
|
41
|
+
|
|
39
42
|
await E(lca)
|
|
40
43
|
.executeTx([
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
to_address: address,
|
|
44
|
+
typedJson('/cosmos.bank.v1beta1.MsgSend', {
|
|
45
|
+
fromAddress: address,
|
|
46
|
+
toAddress: address,
|
|
45
47
|
amount: [{ denom: 'ucosm', amount: '1' }],
|
|
46
|
-
},
|
|
48
|
+
}),
|
|
47
49
|
])
|
|
48
50
|
.then(
|
|
49
51
|
res => console.info('unexpected executeTx result', res),
|
package/src/vat-localchain.d.ts
CHANGED
|
@@ -13,12 +13,24 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
13
13
|
createAccount(): Promise<import("@endo/exo").Guarded<{
|
|
14
14
|
getAddress(): Promise<string>;
|
|
15
15
|
deposit(payment: globalThis.Payment): Promise<globalThis.Amount<globalThis.AssetKind>>;
|
|
16
|
-
executeTx(messages:
|
|
16
|
+
executeTx(messages: {
|
|
17
|
+
'@type': string;
|
|
18
|
+
}[]): Promise<{
|
|
19
|
+
'@type': string;
|
|
20
|
+
}[]>;
|
|
17
21
|
}>>;
|
|
18
|
-
query(request:
|
|
19
|
-
|
|
22
|
+
query(request: {
|
|
23
|
+
'@type': string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
'@type': string;
|
|
26
|
+
}>;
|
|
27
|
+
queryMany(requests: {
|
|
28
|
+
'@type': string;
|
|
29
|
+
}[]): Promise<{
|
|
20
30
|
error?: string | undefined;
|
|
21
|
-
reply:
|
|
31
|
+
reply: {
|
|
32
|
+
'@type': string;
|
|
33
|
+
};
|
|
22
34
|
}[]>;
|
|
23
35
|
};
|
|
24
36
|
}>;
|
|
@@ -37,12 +49,24 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
37
49
|
createAccount(): Promise<import("@endo/exo").Guarded<{
|
|
38
50
|
getAddress(): Promise<string>;
|
|
39
51
|
deposit(payment: globalThis.Payment): Promise<globalThis.Amount<globalThis.AssetKind>>;
|
|
40
|
-
executeTx(messages:
|
|
52
|
+
executeTx(messages: {
|
|
53
|
+
'@type': string;
|
|
54
|
+
}[]): Promise<{
|
|
55
|
+
'@type': string;
|
|
56
|
+
}[]>;
|
|
41
57
|
}>>;
|
|
42
|
-
query(request:
|
|
43
|
-
|
|
58
|
+
query(request: {
|
|
59
|
+
'@type': string;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
'@type': string;
|
|
62
|
+
}>;
|
|
63
|
+
queryMany(requests: {
|
|
64
|
+
'@type': string;
|
|
65
|
+
}[]): Promise<{
|
|
44
66
|
error?: string | undefined;
|
|
45
|
-
reply:
|
|
67
|
+
reply: {
|
|
68
|
+
'@type': string;
|
|
69
|
+
};
|
|
46
70
|
}[]>;
|
|
47
71
|
};
|
|
48
72
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-localchain.d.ts","sourceRoot":"","sources":["vat-localchain.js"],"names":[],"mappings":"AAMO;IAKH;;;;;OAKG
|
|
1
|
+
{"version":3,"file":"vat-localchain.d.ts","sourceRoot":"","sources":["vat-localchain.js"],"names":[],"mappings":"AAMO;IAKH;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IALH;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKN;4BAEa,WAAW,sBAAsB,CAAC"}
|