Skip to content

Commit 855f30b

Browse files
committed
refactor: use new cosmic-proto
1 parent 68c300a commit 855f30b

File tree

12 files changed

+60
-206
lines changed

12 files changed

+60
-206
lines changed

packages/agoric-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@agoric/assert": "^0.6.0",
4141
"@agoric/cache": "^0.3.2",
4242
"@agoric/casting": "^0.4.2",
43-
"@agoric/cosmic-proto": "^0.3.0",
43+
"@agoric/cosmic-proto": "^0.4.0",
4444
"@agoric/ertp": "^0.16.2",
4545
"@agoric/governance": "^0.10.3",
4646
"@agoric/inter-protocol": "^0.16.1",

packages/agoric-cli/src/publish.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import {
99
makeLeaderFromRpcAddresses,
1010
makeCastingSpec,
1111
} from '@agoric/casting';
12-
import { DirectSecp256k1HdWallet, Registry } from '@cosmjs/proto-signing';
13-
import { defaultRegistryTypes } from '@cosmjs/stargate';
12+
import { getSigningAgoricClientOptions } from '@agoric/cosmic-proto';
13+
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
1414
import { stringToPath } from '@cosmjs/crypto';
1515
import { Decimal } from '@cosmjs/math';
1616
import { fromBech32 } from '@cosmjs/encoding';
1717

18-
import { MsgInstallBundle } from '@agoric/cosmic-proto/swingset/msgs.js';
19-
2018
// https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go
2119
const Agoric = {
2220
Bech32MainPrefix: 'agoric',
@@ -38,11 +36,6 @@ const Agoric = {
3836
const hdPath = (coinType = 118, account = 0) =>
3937
stringToPath(`m/44'/${coinType}'/${account}'/0/0`);
4038

41-
const registry = new Registry([
42-
...defaultRegistryTypes,
43-
[Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle],
44-
]);
45-
4639
/**
4740
* @typedef {object} JsonHttpRequest
4841
* @property {string} hostname
@@ -290,8 +283,8 @@ export const makeCosmosBundlePublisher = ({
290283

291284
// AWAIT
292285
const stargateClient = await connectWithSigner(endpoint, wallet, {
286+
...getSigningAgoricClientOptions(),
293287
gasPrice: Agoric.gasPrice,
294-
registry,
295288
});
296289

297290
// AWAIT

packages/boot/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"license": "Apache-2.0",
2020
"dependencies": {
2121
"@agoric/assert": "^0.6.0",
22+
"@agoric/cosmic-proto": "^0.4.0",
2223
"@agoric/builders": "^0.1.0",
2324
"@agoric/cosmic-swingset": "^0.41.3",
2425
"@agoric/ertp": "^0.16.2",

packages/boot/tools/supports.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
import type { ExecutionContext as AvaT } from 'ava';
2727

2828
import { makeRunUtils } from '@agoric/swingset-vat/tools/run-utils.js';
29+
import type { CoreEvalSDKType } from '@agoric/cosmic-proto/dist/codegen/agoric/swingset/swingset';
2930

3031
const trace = makeTracer('BSTSupport', false);
3132

@@ -172,7 +173,7 @@ export const makeProposalExtractor = ({ childProcess, fs }: Powers) => {
172173
loadAndRmPkgFile(permit),
173174
loadAndRmPkgFile(script),
174175
]);
175-
return { json_permits: permits, js_code: code };
176+
return { json_permits: permits, js_code: code } as CoreEvalSDKType;
176177
}),
177178
);
178179

packages/casting/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"node-fetch": "^2.6.0"
3939
},
4040
"devDependencies": {
41-
"@agoric/cosmic-proto": "^0.3.0",
41+
"@agoric/cosmic-proto": "^0.4.0",
4242
"@endo/ses-ava": "^1.1.2",
4343
"@types/node-fetch": "^2.6.2",
4444
"ava": "^5.3.0",

packages/casting/test/test-interpose-net-access.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
// @ts-check
22
/* global globalThis */
3-
import anyTest from 'ava';
4-
import {
5-
createProtobufRpcClient,
6-
QueryClient,
7-
setupBankExtension,
8-
} from '@cosmjs/stargate';
3+
import { QueryClient, setupBankExtension } from '@cosmjs/stargate';
94
import { Tendermint34Client } from '@cosmjs/tendermint-rpc';
10-
import { QueryClientImpl } from '@agoric/cosmic-proto/vstorage/query.js';
5+
import anyTest from 'ava';
116

7+
import { agoric } from '@agoric/cosmic-proto';
128
import { makeHttpClient } from '../src/makeHttpClient.js';
139
import { captureIO, replayIO, web1, web2 } from './net-access-fixture.js';
1410

@@ -81,12 +77,13 @@ test(`vstorage query: Children (RECORDING: ${RECORDING})`, async t => {
8177
: { fetch: replayIO(web2), web: new Map() };
8278
const rpcClient = makeHttpClient(scenario2.endpoint, fetchMock);
8379

80+
t.is(agoric.vstorage.Children.typeUrl, '/agoric.vstorage.Children');
81+
8482
const tmClient = await Tendermint34Client.create(rpcClient);
8583
const qClient = new QueryClient(tmClient);
86-
const rpc = createProtobufRpcClient(qClient);
87-
const queryService = new QueryClientImpl(rpc);
84+
const queryService = agoric.vstorage.createRpcQueryExtension(qClient);
8885

89-
const children = await queryService.Children({ path: '' });
86+
const children = await queryService.children({ path: '' });
9087
if (io.recording) {
9188
t.snapshot(web);
9289
}

packages/cosmic-swingset/src/params.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export const encodeQueueSizes = queueSizes =>
2929
return { key, size };
3030
});
3131

32-
// Map the SwingSet parameters to a deterministic data structure.
32+
/**
33+
* Map the SwingSet parameters to a deterministic data structure.
34+
* @param {import('@agoric/cosmic-proto/dist/codegen/agoric/swingset/swingset.js').ParamsSDKType} params
35+
*/
3336
export const parseParams = params => {
3437
const {
3538
beans_per_unit: rawBeansPerUnit,

packages/cosmic-swingset/src/sim-params.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export const defaultQueueMax = [
7676
makeQueueSize(QueueInbound, defaultInboundQueueMax),
7777
];
7878

79+
/**
80+
* @type {import('@agoric/cosmic-proto/dist/codegen/agoric/swingset/swingset.js').ParamsSDKType}
81+
*/
7982
export const DEFAULT_SIM_SWINGSET_PARAMS = {
8083
beans_per_unit: defaultBeansPerUnit,
8184
fee_unit_price: defaultFeeUnitPrice,

packages/smart-wallet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"lint:eslint": "eslint ."
1717
},
1818
"devDependencies": {
19-
"@agoric/cosmic-proto": "^0.3.0",
19+
"@agoric/cosmic-proto": "^0.4.0",
2020
"@agoric/swingset-vat": "^0.32.2",
2121
"@endo/bundle-source": "^3.1.0",
2222
"@endo/captp": "^4.0.4",

packages/smart-wallet/src/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import type { ERef } from '@endo/far';
99
import type { CapData } from '@endo/marshal';
10-
import type { MsgWalletSpendAction } from '@agoric/cosmic-proto/swingset/msgs';
10+
import type { agoric } from '@agoric/cosmic-proto';
1111
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
1212
import type { OfferSpec } from './offers.js';
1313

@@ -40,7 +40,7 @@ export type BridgeActionCapData = WalletCapData<
4040
/**
4141
* Defined by walletAction struct in msg_server.go
4242
*
43-
* @see {MsgWalletSpendAction} and walletSpendAction in msg_server.go
43+
* @see {agoric.swingset.MsgWalletAction} and walletSpendAction in msg_server.go
4444
*/
4545
export type WalletActionMsg = {
4646
type: 'WALLET_ACTION';
@@ -55,7 +55,7 @@ export type WalletActionMsg = {
5555
/**
5656
* Defined by walletSpendAction struct in msg_server.go
5757
*
58-
* @see {MsgWalletSpendAction} and walletSpendAction in msg_server.go
58+
* @see {agoric.swingset.MsgWalletSpendAction} and walletSpendAction in msg_server.go
5959
*/
6060
export type WalletSpendActionMsg = {
6161
type: 'WALLET_SPEND_ACTION';

0 commit comments

Comments
 (0)