Skip to content

Commit

Permalink
fix: addPad
Browse files Browse the repository at this point in the history
  • Loading branch information
byeongsu-hong committed Feb 27, 2024
1 parent d6302a7 commit 55b3fef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions script/commands/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ contractCmd
{
dispatch: {
dest_domain: parseInt(destDomain),
recipient_addr: addPad(
recipientAddr.startsWith("0x")
? recipientAddr.slice(2)
: recipientAddr
),
recipient_addr: addPad(recipientAddr),
msg_body: Buffer.from(msgBody, "utf-8").toString("hex"),
},
},
Expand Down
6 changes: 1 addition & 5 deletions script/commands/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,7 @@ async function handleLink(_: any, cmd: Command) {
const linkResp = await executeContract(deps.client, route, {
set_route: {
domain: opts.targetDomain,
route: addPad(
opts.warpAddress.startsWith("0x")
? opts.warpAddress.slice(2)
: opts.warpAddress
),
route: addPad(opts.warpAddress),
},
});

Expand Down
6 changes: 5 additions & 1 deletion script/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "@cosmjs/proto-signing";
import { GasPrice, SigningStargateClient } from "@cosmjs/stargate";
import { Secp256k1, keccak256 } from "@cosmjs/crypto";
import { addPad } from "./utils";

export type IsmType =
| {
Expand Down Expand Up @@ -156,7 +157,10 @@ export async function getSigningClient(
const wallet =
signer.split(" ").length > 1
? await DirectSecp256k1HdWallet.fromMnemonic(signer, { prefix: hrp })
: await DirectSecp256k1Wallet.fromKey(Buffer.from(signer, "hex"), hrp);
: await DirectSecp256k1Wallet.fromKey(
Buffer.from(addPad(signer), "hex"),
hrp
);

const [account] = await wallet.getAccounts();
const gasPrice = GasPrice.fromString(`${gas.price}${gas.denom}`);
Expand Down

0 comments on commit 55b3fef

Please sign in to comment.