Skip to content

Commit c35956d

Browse files
authored
chore: move IBC utils and types to network package (#12629)
refs: [AGO-349: Update UI to use accountState for target contract](https://linear.app/agoric/issue/AGO-349/update-ui-to-use-accountstate-for-target-contract) ## Description I need to update the ymax ui to the latest orchestration package to get the latest type and utils, however doing so introduces a runtime dependency on the `@agoric/vats` package in `utils/address.js` (which is needed for the `sameEvmAddress` tool). Because of build complication ymax ui excludes `@agoric/vats` by manually resolving it to an empty package. The only runtime dependency of orchestration onto the vats package is actually for some IBC utils, which were in its `tools` folder. This change moves those to the `network` package in its `src`, along with some related types and cleaning up the legacy allowance of src -> tools import it was enjoying, ultimately moving the vats package to a dev and optional peer dependency of orchestration (for types/test usage, and tools usage respectively). ### Security Considerations None ### Scaling Considerations None ### Documentation Considerations Some moved types kept re-export from their original path. ### Testing Considerations Existing linting and tests should keep passing. ### Upgrade Considerations This shouldn't break anything but NPM consumers may no longer get some types automatically resolving now that `vats` is only a dev dependency of `orchestration`.
1 parent f8bd523 commit c35956d

58 files changed

Lines changed: 193 additions & 154 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

multichain-testing/tools/address.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import type { IBCChannelID, IBCConnectionID, IBCPortID } from '@agoric/vats';
21
import {
2+
type IBCChannelID,
3+
type IBCConnectionID,
4+
type IBCPortID,
35
type LocalIbcAddress,
46
type RemoteIbcAddress,
5-
} from '@agoric/vats/tools/ibc-utils.js';
7+
} from '@agoric/network/ibc';
68

7-
// XXX consider moving to vats/tools/ibc-utils by updating current values or renaming as `NEGOTIATED_...`
9+
// XXX consider moving into network/src/ibc/utils by updating current values or renaming as `NEGOTIATED_...`
810
// These take those values and build off of them
911
const REMOTE_ADDR_RE =
1012
/^(?<hops>(?:\/ibc-hop\/[^/]+)*)\/ibc-port\/(?<portID>[^/]+)\/(?<order>ordered|unordered)\/(?<version>{[^}]+})\/ibc-channel\/(?<channelID>[^/]+)$/;

multichain-testing/yarn.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ __metadata:
406406
"@agoric/store": "workspace:*"
407407
"@agoric/time": "workspace:*"
408408
"@agoric/vat-data": "workspace:*"
409-
"@agoric/vats": "workspace:*"
410409
"@agoric/vow": "workspace:*"
411410
"@agoric/zoe": "workspace:*"
412411
"@agoric/zone": "workspace:*"
@@ -421,6 +420,11 @@ __metadata:
421420
"@noble/hashes": "npm:~1.5.0"
422421
bech32: "npm:^2.0.0"
423422
bs58: "npm:^6.0.0"
423+
peerDependencies:
424+
"@agoric/vats": "workspace:*"
425+
peerDependenciesMeta:
426+
"@agoric/vats":
427+
optional: true
424428
languageName: node
425429
linkType: soft
426430

packages/boot/tools/ibc/mocks.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// @ts-check
22
import { createMockAckMap } from '@agoric/orchestration/tools/ibc-mocks.js';
3-
import type { IBCChannelID, IBCEvent, IBCMethod } from '@agoric/vats';
4-
5-
/** @import { IBCChannelID, IBCMethod, IBCEvent } from '@agoric/vats'; */
3+
import type { IBCChannelID } from '@agoric/network/ibc';
4+
import type { IBCEvent, IBCMethod } from '@agoric/vats';
65

76
const responses = {
87
// {"result":"+/cosmos.staking.v1beta1.MsgDelegateResponse"}

packages/builders/scripts/orchestration/get-chain-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
66
import { fetchNetworkConfig } from '@agoric/client-utils';
77

88
/**
9-
* @import {IBCChannelID, IBCConnectionID} from '@agoric/vats';
10-
* @import {CosmosChainInfo, IBCConnectionInfo} from '@agoric/orchestration'
9+
* @import {IBCChannelID, IBCConnectionID, IBCConnectionInfo} from '@agoric/network/ibc';
10+
* @import {CosmosChainInfo} from '@agoric/orchestration'
1111
*/
1212

1313
/** @param {string[]} strs */

packages/fast-usdc-contract/src/exos/settler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ import type {
4949
import { coerceAccountId } from '@agoric/orchestration/src/utils/address.js';
5050
import type { WithdrawToSeat } from '@agoric/orchestration/src/utils/zoe-tools.js';
5151
import { mustMatch, type MapStore } from '@agoric/store';
52-
import type { IBCChannelID, IBCPacket, VTransferIBCEvent } from '@agoric/vats';
52+
import type { IBCChannelID } from '@agoric/network/ibc';
53+
import type { IBCPacket, VTransferIBCEvent } from '@agoric/vats';
5354
import type { TargetRegistration } from '@agoric/vats/src/bridge-target.js';
5455
import type { Vow, VowTools } from '@agoric/vow';
5556
import type { ZCF } from '@agoric/zoe/src/zoeService/zoe.js';

packages/fast-usdc-contract/src/fast-usdc.contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import {
1919
type Denom,
2020
type DenomAmount,
2121
type DenomDetail,
22-
type IBCConnectionInfo,
2322
type OrchestrationAccount,
2423
type OrchestrationPowers,
2524
type OrchestrationTools,
2625
} from '@agoric/orchestration';
26+
import type { IBCConnectionInfo } from '@agoric/network/ibc';
2727
import type { HostForGuest } from '@agoric/orchestration/src/facade.js';
2828
import { makeZoeTools } from '@agoric/orchestration/src/utils/zoe-tools.js';
2929
import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js';

packages/fast-usdc-deploy/src/fast-usdc-reconfigure.build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getManifestForUpdateNobleICA } from './update-noble-ica.core.js';
1212

1313
/**
1414
* @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
15-
* @import {IBCConnectionInfo} from '@agoric/orchestration'
15+
* @import {IBCConnectionInfo} from '@agoric/network/ibc'
1616
* @import {Passable} from '@endo/marshal'
1717
*/
1818

packages/fast-usdc-deploy/src/update-noble-ica.core.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const makeRatio = (numerator, numeratorBrand, denominator = 100n) =>
2121
/**
2222
* @import {CopyRecord} from '@endo/pass-style';
2323
* @import {Brand, Ratio} from '@agoric/ertp';
24-
* @import {CosmosChainInfo, IBCConnectionInfo} from '@agoric/orchestration';
24+
* @import {IBCConnectionInfo} from '@agoric/network/ibc';
25+
* @import {CosmosChainInfo} from '@agoric/orchestration';
2526
* @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js';
2627
* @import {BundleID} from '@agoric/swingset-vat';
2728
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js';

packages/fast-usdc-deploy/src/upgrade-evm-dests.core.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const { make } = AmountMath;
1616
/**
1717
* @import {CopyRecord} from '@endo/pass-style';
1818
* @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js';
19-
* @import {CosmosChainInfo, IBCConnectionInfo} from '@agoric/orchestration';
19+
* @import {IBCConnectionInfo} from '@agoric/network/ibc';
20+
* @import {CosmosChainInfo} from '@agoric/orchestration';
2021
* @import {BundleID} from '@agoric/swingset-vat';
2122
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js';
2223
* @import {FastUSDCCorePowers} from './start-fast-usdc.core.js';

packages/fast-usdc-deploy/test/fu-sim-iter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js';
2020
import type { CosmosChainAddress } from '@agoric/orchestration';
2121
import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js';
2222
import type { OfferSpec } from '@agoric/smart-wallet/src/offers.js';
23-
import type { IBCChannelID } from '@agoric/vats';
23+
import type { IBCChannelID } from '@agoric/network/ibc';
2424
import { makePromiseKit } from '@endo/promise-kit';
2525
import { configurations } from '../src/utils/deploy-config.js';
2626
import { type WalletFactoryTestContext } from './walletFactory.js';

0 commit comments

Comments
 (0)