Skip to content

Commit

Permalink
fix wallet extract-id CLI (#10892)
Browse files Browse the repository at this point in the history
closes: #10891

## Description

A recent refactor of agoric-cli introduced an error. It wasn't caught by typecheck because the callsite was `any`. 

### Security Considerations
none

### Scaling Considerations
none

### Documentation Considerations
none

### Testing Considerations
This PR doesn't have a runtime regression test because this is a very uncommon code path which does have _some_ CI coverage in a3p-integration (1d01880) 

### Upgrade Considerations
Not run on chain.
  • Loading branch information
mergify[bot] authored Jan 24, 2025
2 parents d461b05 + 3303811 commit b2cb709
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 78.19
"atLeast": 78.73
}
}
21 changes: 12 additions & 9 deletions packages/agoric-cli/src/commands/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const makeWalletCommand = async command => {
'wallet commands',
);

/** @param {string} literalOrName */
const normalizeAddress = literalOrName =>
normalizeAddressWithOptions(literalOrName, wallet.opts());

Expand Down Expand Up @@ -112,9 +113,9 @@ export const makeWalletCommand = async command => {
.action(async function (opts) {
const offerStr = fs.readFileSync(opts.file).toString();

const { unserializer } = await makeVstorageKit({ fetch }, networkConfig);
const { marshaller } = makeVstorageKit({ fetch }, networkConfig);

const offerObj = unserializer.fromCapData(JSON.parse(offerStr));
const offerObj = marshaller.fromCapData(JSON.parse(offerStr));
console.log(offerObj);
});

Expand All @@ -127,9 +128,9 @@ export const makeWalletCommand = async command => {
.action(async function (opts) {
const offerStr = fs.readFileSync(opts.offer).toString();

const { unserializer } = await makeVstorageKit({ fetch }, networkConfig);
const { marshaller } = makeVstorageKit({ fetch }, networkConfig);

const offerObj = unserializer.fromCapData(JSON.parse(offerStr));
const offerObj = marshaller.fromCapData(JSON.parse(offerStr));
console.log(offerObj.offer.id);
});

Expand Down Expand Up @@ -204,7 +205,7 @@ export const makeWalletCommand = async command => {
.command('list')
.description('list all wallets in vstorage')
.action(async function () {
const { vstorage } = await makeVstorageKit({ fetch }, networkConfig);
const { vstorage } = makeVstorageKit({ fetch }, networkConfig);
const wallets = await vstorage.keys('published.wallet');
process.stdout.write(wallets.join('\n'));
});
Expand All @@ -218,17 +219,19 @@ export const makeWalletCommand = async command => {
normalizeAddress,
)
.action(async function (opts) {
const { readPublished, unserializer, ...vsk } = makeVstorageKit(
{ fetch },
networkConfig,
);
const {
readPublished,
marshaller: unserializer,
...vsk
} = makeVstorageKit({ fetch }, networkConfig);
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);

const leader = makeLeader(networkConfig.rpcAddrs[0]);
const follower = await makeFollower(
`:published.wallet.${opts.from}`,
leader,
{
// @ts-expect-error xxx follower/marshaller types
unserializer,
},
);
Expand Down
2 changes: 2 additions & 0 deletions packages/agoric-cli/src/lib/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { execFileSync as execFileSyncAmbient } from 'child_process';

/**
* @import {MinimalNetworkConfig} from '@agoric/client-utils';
* @import {ParamsSDKType} from '@agoric/cosmic-proto/agoric/swingset/swingset.js';
*/

const agdBinary = 'agd';
Expand Down Expand Up @@ -132,6 +133,7 @@ harden(execSwingsetTransaction);
/**
*
* @param {MinimalNetworkConfig} net
* @returns {ParamsSDKType}
*/
// TODO fetch by HTTP instead of shelling out https://github.com/Agoric/agoric-sdk/issues/9200
export const fetchSwingsetParams = net => {
Expand Down
2 changes: 1 addition & 1 deletion packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 91.37
"atLeast": 91.27
}
}
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 90.93
"atLeast": 91.57
}
}
2 changes: 1 addition & 1 deletion packages/casting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 88.99
"atLeast": 89.22
}
}
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
"timeout": "20m"
},
"typeCoverage": {
"atLeast": 83.84
"atLeast": 83.4
}
}
2 changes: 1 addition & 1 deletion packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 89.49
"atLeast": 89.48
}
}
2 changes: 1 addition & 1 deletion packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 95.58
"atLeast": 95.62
}
}
2 changes: 1 addition & 1 deletion packages/internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 93.06
"atLeast": 93.04
}
}
2 changes: 1 addition & 1 deletion packages/orchestration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 97.29
"atLeast": 97.77
}
}
2 changes: 1 addition & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
"timeout": "2m"
},
"typeCoverage": {
"atLeast": 89.53
"atLeast": 89.69
}
}
2 changes: 1 addition & 1 deletion packages/swingset-liveslots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 75.24
"atLeast": 75.2
}
}
2 changes: 1 addition & 1 deletion packages/vats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 91.21
"atLeast": 90.43
}
}
2 changes: 1 addition & 1 deletion packages/xsnap-lockdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 73.6
"atLeast": 73.54
}
}
2 changes: 1 addition & 1 deletion packages/zoe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 85.06
"atLeast": 85.11
}
}

0 comments on commit b2cb709

Please sign in to comment.