Skip to content

Commit 7df01d9

Browse files
committed
feat: parse ethermint accounts in toBaseAccount
1 parent 5933f63 commit 7df01d9

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## `v0.0.60`
4+
5+
### Features
6+
7+
- Parse `EthermintAccount` in `toBaseAccount` util function
8+
39
## `v0.0.59`
410

511
### Fixes

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cosmes",
3-
"version": "0.0.59",
3+
"version": "0.0.60",
44
"private": false,
55
"packageManager": "pnpm@8.3.0",
66
"sideEffects": false,

src/client/utils/toBaseAccount.ts

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
CosmosVestingV1beta1BaseVestingAccount as BaseVestingAccount,
55
CosmosVestingV1beta1ContinuousVestingAccount as ContinuousVestingAccount,
66
CosmosVestingV1beta1DelayedVestingAccount as DelayedVesting,
7+
EthermintTypesV1EthAccount as EthermintAccount,
78
InjectiveTypesV1beta1EthAccount as InjectiveAccount,
89
CosmosVestingV1beta1PeriodicVestingAccount as PeriodicVestingAccount,
910
} from "cosmes/protobufs";
@@ -56,6 +57,13 @@ export function toBaseAccount({ typeUrl, value }: Any): BaseAccount {
5657
}
5758
return baseAccount;
5859
}
60+
case EthermintAccount.typeName: {
61+
const { baseAccount } = EthermintAccount.fromBinary(value);
62+
if (!baseAccount) {
63+
throw new Error(ERR_UNABLE_TO_RESOLVE_BASE_ACCOUNT);
64+
}
65+
return baseAccount;
66+
}
5967
default: {
6068
throw new Error(`${ERR_UNKNOWN_ACCOUNT_TYPE}: ${typeUrl.slice(1)}`);
6169
}

0 commit comments

Comments
 (0)