Skip to content

Commit

Permalink
feat: hexed address
Browse files Browse the repository at this point in the history
  • Loading branch information
byeongsu-hong committed Mar 12, 2024
1 parent ae3dc92 commit 4af3ea6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions script/deploy/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion script/shared/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import path from 'path';
import { defaultContextPath } from './constants';
import { ContractNames } from './contract';

type typed<T extends ContractNames> = { type: T; address: string };
type typed<T extends ContractNames> = {
type: T;
address: string;
hexed: string;
};

export type ContextIsm =
| (typed<'hpl_ism_aggregate'> & {
Expand Down
10 changes: 7 additions & 3 deletions script/shared/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -15,7 +15,7 @@ export async function deployContract<T extends ContractNames>(
{ 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];
Expand All @@ -36,7 +36,11 @@ export async function deployContract<T extends ContractNames>(
}

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(
Expand Down

0 comments on commit 4af3ea6

Please sign in to comment.