Skip to content

Commit

Permalink
feat: parse ethermint accounts in toBaseAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCQL committed Mar 10, 2024
1 parent 5933f63 commit 7df01d9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## `v0.0.60`

### Features

- Parse `EthermintAccount` in `toBaseAccount` util function

## `v0.0.59`

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cosmes",
"version": "0.0.59",
"version": "0.0.60",
"private": false,
"packageManager": "[email protected]",
"sideEffects": false,
Expand Down
8 changes: 8 additions & 0 deletions src/client/utils/toBaseAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CosmosVestingV1beta1BaseVestingAccount as BaseVestingAccount,
CosmosVestingV1beta1ContinuousVestingAccount as ContinuousVestingAccount,
CosmosVestingV1beta1DelayedVestingAccount as DelayedVesting,
EthermintTypesV1EthAccount as EthermintAccount,
InjectiveTypesV1beta1EthAccount as InjectiveAccount,
CosmosVestingV1beta1PeriodicVestingAccount as PeriodicVestingAccount,
} from "cosmes/protobufs";
Expand Down Expand Up @@ -56,6 +57,13 @@ export function toBaseAccount({ typeUrl, value }: Any): BaseAccount {
}
return baseAccount;
}
case EthermintAccount.typeName: {
const { baseAccount } = EthermintAccount.fromBinary(value);
if (!baseAccount) {
throw new Error(ERR_UNABLE_TO_RESOLVE_BASE_ACCOUNT);
}
return baseAccount;
}
default: {
throw new Error(`${ERR_UNKNOWN_ACCOUNT_TYPE}: ${typeUrl.slice(1)}`);
}
Expand Down

0 comments on commit 7df01d9

Please sign in to comment.