Skip to content

Commit

Permalink
Fix simulate evmos
Browse files Browse the repository at this point in the history
  • Loading branch information
harisato committed Dec 6, 2022
1 parent 1f11a14 commit 8cda0b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/common/error.map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,19 @@ export const ErrorMap = {
Message: 'Missing account_auth when call indexer account info!',
},
CANNOT_GET_ACCOUNT_NUMBER_OR_SEQUENCE: {
Code: 'E042',
Code: 'E043',
Message: 'Can not get account number or sequence from indexer!',
},
CANNOT_CONNECT_TO_CHAIN: {
Code: 'E043',
Code: 'E044',
Message: 'Can not connect to chain!',
},
TX_SIMULATION_FAILED: {
Code: 'E044',
Code: 'E045',
Message: 'Tx simulation failed!',
},
INVALID_SAFE: {
Code: 'E045',
Code: 'E046',
Message: 'Invalid safe!',
},
C001: {
Expand Down
7 changes: 6 additions & 1 deletion src/simulate/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { REGISTRY_GENERATED_TYPES } from 'src/common/constants/app.constant';
import { coins } from '@cosmjs/amino';
import { IndexerClient } from 'src/utils/apis/IndexerClient';
import { encodePubkeyEvmos } from 'src/chains';

export class SimulateUtils {
public static makeBodyBytes(messages: any[], prefix: string): Uint8Array {
Expand Down Expand Up @@ -53,8 +54,12 @@ export class SimulateUtils {
const defaultFee = SimulateUtils.getDefaultFee(denom);
const signers: boolean[] = Array(totalOwner).fill(false);

const encodedPubkey = chainId.startsWith('evmos')
? encodePubkeyEvmos(safePubkey)
: encodePubkey(safePubkey);

const signerInfo: SignerInfo = {
publicKey: encodePubkey(safePubkey),
publicKey: encodedPubkey,
modeInfo: {
multi: {
bitarray: makeCompactBitArray(signers),
Expand Down

0 comments on commit 8cda0b3

Please sign in to comment.