@agoric/orchestration 0.1.1-dev-84de950.0 → 0.1.1-dev-4c65fc2.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/orchestration",
3
- "version": "0.1.1-dev-84de950.0+84de950",
3
+ "version": "0.1.1-dev-4c65fc2.0+4c65fc2",
4
4
  "description": "Chain abstraction for Agoric's orchestration clients",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -29,17 +29,17 @@
29
29
  },
30
30
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
31
31
  "dependencies": {
32
- "@agoric/assert": "0.6.1-dev-84de950.0+84de950",
33
- "@agoric/cosmic-proto": "0.4.1-dev-84de950.0+84de950",
34
- "@agoric/ertp": "0.16.3-dev-84de950.0+84de950",
35
- "@agoric/internal": "0.3.3-dev-84de950.0+84de950",
36
- "@agoric/network": "0.1.1-dev-84de950.0+84de950",
37
- "@agoric/notifier": "0.6.3-dev-84de950.0+84de950",
38
- "@agoric/store": "0.9.3-dev-84de950.0+84de950",
39
- "@agoric/vat-data": "0.5.3-dev-84de950.0+84de950",
40
- "@agoric/vats": "0.15.2-dev-84de950.0+84de950",
41
- "@agoric/zoe": "0.26.3-dev-84de950.0+84de950",
42
- "@agoric/zone": "0.2.3-dev-84de950.0+84de950",
32
+ "@agoric/assert": "0.6.1-dev-4c65fc2.0+4c65fc2",
33
+ "@agoric/cosmic-proto": "0.4.1-dev-4c65fc2.0+4c65fc2",
34
+ "@agoric/ertp": "0.16.3-dev-4c65fc2.0+4c65fc2",
35
+ "@agoric/internal": "0.3.3-dev-4c65fc2.0+4c65fc2",
36
+ "@agoric/network": "0.1.1-dev-4c65fc2.0+4c65fc2",
37
+ "@agoric/notifier": "0.6.3-dev-4c65fc2.0+4c65fc2",
38
+ "@agoric/store": "0.9.3-dev-4c65fc2.0+4c65fc2",
39
+ "@agoric/vat-data": "0.5.3-dev-4c65fc2.0+4c65fc2",
40
+ "@agoric/vats": "0.15.2-dev-4c65fc2.0+4c65fc2",
41
+ "@agoric/zoe": "0.26.3-dev-4c65fc2.0+4c65fc2",
42
+ "@agoric/zone": "0.2.3-dev-4c65fc2.0+4c65fc2",
43
43
  "@endo/base64": "^1.0.4",
44
44
  "@endo/far": "^1.1.1",
45
45
  "@endo/marshal": "^1.4.1",
@@ -49,8 +49,7 @@
49
49
  "@cosmjs/amino": "^0.32.3",
50
50
  "@cosmjs/proto-signing": "^0.32.3",
51
51
  "@endo/ses-ava": "^1.2.1",
52
- "ava": "^5.3.1",
53
- "cosmjs-types": "^0.9.0"
52
+ "ava": "^5.3.1"
54
53
  },
55
54
  "ava": {
56
55
  "extensions": {
@@ -82,5 +81,5 @@
82
81
  "typeCoverage": {
83
82
  "atLeast": 96.39
84
83
  },
85
- "gitHead": "84de950e98dd32588616e38f63d97a72a440b134"
84
+ "gitHead": "4c65fc27a3e151be82ad228d58a7610d51b3c4a2"
86
85
  }
@@ -11,12 +11,13 @@ import { M, prepareExoClassKit } from '@agoric/vat-data';
11
11
  import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
12
12
  import { decodeBase64 } from '@endo/base64';
13
13
  import { E } from '@endo/far';
14
- import { txToBase64 } from '../utils/tx.js';
14
+ import { Any } from '@agoric/cosmic-proto/google/protobuf/any';
15
15
 
16
16
  /**
17
17
  * @import { ChainAccount, ChainAddress } from '../types.js';
18
18
  * @import { RecorderKit, MakeRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
19
19
  * @import { Baggage } from '@agoric/swingset-liveslots';
20
+ * @import {AnyJson} from '@agoric/cosmic-proto';
20
21
  */
21
22
 
22
23
  const trace = makeTracer('StakingAccountHolder');
@@ -109,12 +110,14 @@ export const prepareStakingAccountHolder = (baggage, makeRecorderKit, zcf) => {
109
110
  const delegatorAddress = this.state.chainAddress;
110
111
 
111
112
  const result = await E(account).executeEncodedTx([
112
- txToBase64(
113
- MsgDelegate.toProtoMsg({
114
- delegatorAddress,
115
- validatorAddress,
116
- amount,
117
- }),
113
+ /** @type {AnyJson} */ (
114
+ Any.toJSON(
115
+ MsgDelegate.toProtoMsg({
116
+ delegatorAddress,
117
+ validatorAddress,
118
+ amount,
119
+ }),
120
+ )
118
121
  ),
119
122
  ]);
120
123
 
@@ -18,7 +18,7 @@ import '@agoric/network/exported.js';
18
18
  const { Fail, bare } = assert;
19
19
  const trace = makeTracer('Orchestration');
20
20
 
21
- /** @import {Proto3Msg} from './utils/tx.js'; */
21
+ /** @import {AnyJson} from '@agoric/cosmic-proto'; */
22
22
 
23
23
  // TODO improve me
24
24
  /** @typedef {string} ChainAddress */
@@ -124,7 +124,7 @@ const prepareChainAccount = zone =>
124
124
  return this.state.port;
125
125
  },
126
126
  /**
127
- * @param {Proto3Msg[]} msgs
127
+ * @param {AnyJson[]} msgs
128
128
  * @param {Omit<TxBody, 'messages'>} [opts]
129
129
  * @returns {Promise<string>} - base64 encoded bytes string. Can be decoded using the corresponding `Msg*Response` object.
130
130
  * @throws {Error} if packet fails to send or an error is returned
package/src/utils/tx.js CHANGED
@@ -1,24 +1,20 @@
1
1
  // @ts-check
2
2
  import { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
3
- import { decodeBase64, encodeBase64 } from '@endo/base64';
4
-
5
- /** @typedef {{ typeUrl: string; value: string; }} Proto3Msg */
3
+ import { encodeBase64 } from '@endo/base64';
4
+ import { Any } from '@agoric/cosmic-proto/google/protobuf/any';
6
5
 
7
6
  /**
8
7
  * Makes an IBC packet from an array of messages. Expects the `value` of each message
9
8
  * to be base64 encoded bytes.
10
9
  * Skips checks for malformed messages in favor of interface guards.
11
- * @param {Proto3Msg[]} msgs
10
+ * @param {import('@agoric/cosmic-proto').AnyJson[]} msgs
12
11
  * // XXX intellisense does not seem to infer well here
13
12
  * @param {Omit<TxBody, 'messages'>} [opts]
14
13
  * @returns {string} - IBC TX packet
15
14
  * @throws {Error} if malformed messages are provided
16
15
  */
17
16
  export function makeTxPacket(msgs, opts) {
18
- const messages = msgs.map(msg => ({
19
- typeUrl: msg.typeUrl,
20
- value: decodeBase64(msg.value),
21
- }));
17
+ const messages = msgs.map(Any.fromJSON);
22
18
  const bytes = TxBody.encode(
23
19
  TxBody.fromPartial({
24
20
  messages,
@@ -34,19 +30,6 @@ export function makeTxPacket(msgs, opts) {
34
30
  }
35
31
  harden(makeTxPacket);
36
32
 
37
- /**
38
- * base64 encode an EncodeObject for cross-vat communication
39
- * @param {{ typeUrl: string, value: Uint8Array }} tx
40
- * @returns {Proto3Msg}
41
- */
42
- export function txToBase64(tx) {
43
- return {
44
- typeUrl: tx.typeUrl,
45
- value: encodeBase64(tx.value),
46
- };
47
- }
48
- harden(txToBase64);
49
-
50
33
  /**
51
34
  * Looks for a result or error key in the response string, and returns
52
35
  * a Base64Bytes string. This string can be decoded using the corresponding