11import { stringify as yamlStringify } from 'yaml' ;
22
33import { buildArtifact as coreBuildArtifact } from '@hyperlane-xyz/core/buildArtifact.js' ;
4- import { AltVMCoreModule } from '@hyperlane-xyz/deploy-sdk' ;
5- import { GasAction , ProtocolType } from '@hyperlane-xyz/provider-sdk' ;
4+ import { createCoreWriter } from '@hyperlane-xyz/deploy-sdk' ;
5+ import {
6+ GasAction ,
7+ ProtocolType ,
8+ coreConfigToArtifact ,
9+ coreResultToDeployedAddresses ,
10+ } from '@hyperlane-xyz/provider-sdk' ;
611import { type ChainAddresses } from '@hyperlane-xyz/registry' ;
712import {
813 type ChainName ,
@@ -29,6 +34,7 @@ import {
2934 validateCoreIsmCompatibility ,
3035} from './utils.js' ;
3136import { getSubmitterByStrategy } from './warp.js' ;
37+ import { ArtifactState } from '@hyperlane-xyz/provider-sdk/artifact' ;
3238
3339interface DeployParams {
3440 context : WriteCommandContext ;
@@ -111,17 +117,18 @@ export async function runCoreDeploy(params: DeployParams) {
111117 const userAddress = signer . getSignerAddress ( ) ;
112118 const initialBalances = await getBalances ( context , [ chain ] , userAddress ) ;
113119
114- const coreModule = await AltVMCoreModule . create ( {
115- chain,
116- config : validateCoreConfigForAltVM ( config , chain ) ,
117- chainLookup : altVmChainLookup ( multiProvider ) ,
118- signer,
119- } ) ;
120+ const validatedConfig = validateCoreConfigForAltVM ( config , chain ) ;
121+ const chainLookup = altVmChainLookup ( multiProvider ) ;
122+ const metadata = chainLookup . getChainMetadata ( chain ) ;
123+
124+ const coreWriter = createCoreWriter ( metadata , chainLookup , signer ) ;
125+ const coreArtifact = coreConfigToArtifact ( validatedConfig , chainLookup ) ;
126+ const [ result ] = await coreWriter . create ( coreArtifact ) ;
120127
121128 await completeDeploy ( context , 'core' , initialBalances , userAddress , [
122129 chain ,
123130 ] ) ;
124- deployedAddresses = coreModule . serialize ( ) ;
131+ deployedAddresses = coreResultToDeployedAddresses ( result ) ;
125132 }
126133 }
127134
@@ -178,18 +185,18 @@ export async function runCoreApply(params: ApplyParams) {
178185 } ) ;
179186
180187 const validatedConfig = validateCoreConfigForAltVM ( config , chain ) ;
181-
182- const coreModule = new AltVMCoreModule (
183- altVmChainLookup ( multiProvider ) ,
184- signer ,
185- {
186- chain,
187- config : validatedConfig ,
188- addresses : deployedCoreAddresses ,
188+ const chainLookup = altVmChainLookup ( multiProvider ) ;
189+ const metadata = chainLookup . getChainMetadata ( chain ) ;
190+
191+ const coreWriter = createCoreWriter ( metadata , chainLookup , signer ) ;
192+ const coreArtifact = coreConfigToArtifact ( validatedConfig , chainLookup ) ;
193+ const transactions = await coreWriter . update ( {
194+ artifactState : ArtifactState . DEPLOYED ,
195+ config : coreArtifact . config ,
196+ deployed : {
197+ address : deployedCoreAddresses . mailbox ,
189198 } ,
190- ) ;
191-
192- const transactions = await coreModule . update ( validatedConfig ) ;
199+ } ) ;
193200
194201 if ( transactions . length ) {
195202 logGray ( 'Updating deployed core contracts' ) ;
0 commit comments