From 4af3ea6e75eea0796029893f92e7031a1959ee5d Mon Sep 17 00:00:00 2001 From: byeongsu-hong Date: Tue, 12 Mar 2024 10:58:22 +0900 Subject: [PATCH] feat: hexed address --- script/deploy/warp.ts | 8 ++++++-- script/shared/context.ts | 6 +++++- script/shared/contract.ts | 10 +++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/script/deploy/warp.ts b/script/deploy/warp.ts index 848f39bb..bf6426e8 100644 --- a/script/deploy/warp.ts +++ b/script/deploy/warp.ts @@ -73,7 +73,9 @@ export async function deployNativeTokenWarp( { ctx, client, network }: Dependencies, mailbox: string, config: WarpTokenConfig<'native'>, -): Promise<{ type: 'hpl_warp_native'; address: string } | undefined> { +): Promise< + { type: 'hpl_warp_native'; address: string; hexed: string } | undefined +> { const deployments = ctx.deployments; const preload = deployments?.warp?.native?.find((v) => v.id === config.id); @@ -102,7 +104,9 @@ export async function deployCw20TokenWarp( { ctx, client, network }: Dependencies, mailbox: string, config: WarpTokenConfig<'cw20'>, -): Promise<{ type: 'hpl_warp_cw20'; address: string } | undefined> { +): Promise< + { type: 'hpl_warp_cw20'; address: string; hexed: string } | undefined +> { const deployments = ctx.deployments; const preload = deployments?.warp?.cw20?.find((v) => v.id === config.id); diff --git a/script/shared/context.ts b/script/shared/context.ts index caca6a2b..0410bc0d 100644 --- a/script/shared/context.ts +++ b/script/shared/context.ts @@ -4,7 +4,11 @@ import path from 'path'; import { defaultContextPath } from './constants'; import { ContractNames } from './contract'; -type typed = { type: T; address: string }; +type typed = { + type: T; + address: string; + hexed: string; +}; export type ContextIsm = | (typed<'hpl_ism_aggregate'> & { diff --git a/script/shared/contract.ts b/script/shared/contract.ts index 370f782c..e2749c38 100644 --- a/script/shared/contract.ts +++ b/script/shared/contract.ts @@ -4,7 +4,7 @@ import { Client } from './config'; import { contractNames } from './constants'; import { Context } from './context'; import { Logger } from './logger'; -import { waitTx } from './utils'; +import { extractByte32AddrFromBech32, waitTx } from './utils'; const logger = new Logger('contract'); @@ -15,7 +15,7 @@ export async function deployContract( { wasm, stargate, signer }: Client, contractName: T, initMsg: object, -): Promise<{ type: T; address: string }> { +): Promise<{ type: T; address: string; hexed: string }> { logger.debug(`deploying ${contractName}`); const codeId = ctx.artifacts[contractName]; @@ -36,7 +36,11 @@ export async function deployContract( } logger.info(`deployed ${contractName} at ${res.contractAddress}`); - return { type: contractName, address: res.contractAddress }; + return { + type: contractName, + address: res.contractAddress, + hexed: extractByte32AddrFromBech32(res.contractAddress), + }; } export async function executeContract(