This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Protubuf type registry (#171)
Co-authored-by: Tom <[email protected]> Co-authored-by: Sandoche ADITTANE <[email protected]>
- Loading branch information
1 parent
089da3d
commit 8216395
Showing
58 changed files
with
495 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './authz.js' | ||
export * from './generic.js' | ||
export * from './registry.js' | ||
export * from './stake.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { authzRegistryTypes } from './registry' | ||
|
||
import { MsgGrant, MsgRevoke, MsgExec } from '../../proto/cosmos/authz/tx' | ||
import { Grant, GenericAuthorization } from '../../proto/cosmos/authz/authz' | ||
import { | ||
StakeAuthorization, | ||
// eslint-disable-next-line camelcase | ||
StakeAuthorization_Validators, | ||
} from '../../proto/cosmos/staking/authz' | ||
|
||
describe('test authz registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(authzRegistryTypes).toStrictEqual([ | ||
Grant, | ||
MsgGrant, | ||
MsgRevoke, | ||
MsgExec, | ||
GenericAuthorization, | ||
StakeAuthorization, | ||
// eslint-disable-next-line camelcase | ||
StakeAuthorization_Validators, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MsgGrant, MsgRevoke, MsgExec } from '../../proto/cosmos/authz/tx.js' | ||
import { Grant, GenericAuthorization } from '../../proto/cosmos/authz/authz.js' | ||
import { | ||
StakeAuthorization, | ||
// eslint-disable-next-line camelcase | ||
StakeAuthorization_Validators, | ||
} from '../../proto/cosmos/staking/authz.js' | ||
|
||
export const authzRegistryTypes = [ | ||
Grant, | ||
MsgGrant, | ||
MsgRevoke, | ||
MsgExec, | ||
GenericAuthorization, | ||
StakeAuthorization, | ||
// eslint-disable-next-line camelcase | ||
StakeAuthorization_Validators, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './msgSend.js' | ||
export * from './registry.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { bankRegistryTypes } from './registry' | ||
|
||
import { MsgSend, MsgMultiSend } from '../../proto/cosmos/bank/tx' | ||
import { Metadata } from '../../proto/cosmos/bank/bank.js' | ||
|
||
describe('test bank registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(bankRegistryTypes).toStrictEqual([MsgSend, MsgMultiSend, Metadata]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { MsgSend, MsgMultiSend } from '../../proto/cosmos/bank/tx.js' | ||
import { Metadata } from '../../proto/cosmos/bank/bank.js' | ||
|
||
export const bankRegistryTypes = [MsgSend, MsgMultiSend, Metadata] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Timestamp } from '@bufbuild/protobuf' | ||
import { baseRegistryTypes } from './baseRegistry' | ||
import { Coin } from '../proto/cosmos/base/coin' | ||
|
||
describe('test base registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(baseRegistryTypes).toStrictEqual([Timestamp, Coin]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Timestamp } from '@bufbuild/protobuf' | ||
import { Coin } from '../proto/cosmos/base/coin.js' | ||
|
||
export const baseRegistryTypes = [Timestamp, Coin] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './keys.js' | ||
export * from './registry.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { cryptoRegistryTypes } from './registry' | ||
|
||
import { PubKey as ED25519PubKey } from '../../proto/cosmos/crypto/ed25519/keys' | ||
import { PubKey as EthSecp256k1PubKey } from '../../proto/ethermint/crypto/keys.js' | ||
|
||
describe('test crypto registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(cryptoRegistryTypes).toStrictEqual([ | ||
ED25519PubKey, | ||
EthSecp256k1PubKey, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { PubKey as ED25519PubKey } from '../../proto/cosmos/crypto/ed25519/keys.js' | ||
import { PubKey as EthSecp256k1PubKey } from '../../proto/ethermint/crypto/keys.js' | ||
|
||
export const cryptoRegistryTypes = [ED25519PubKey, EthSecp256k1PubKey] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './distribution.js' | ||
export * from './registry.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { distributionRegistryTypes } from './registry' | ||
|
||
import { | ||
MsgWithdrawDelegatorReward, | ||
MsgWithdrawValidatorCommission, | ||
MsgSetWithdrawAddress, | ||
MsgFundCommunityPool, | ||
} from '../../proto/cosmos/distribution/tx' | ||
|
||
describe('test distribution registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(distributionRegistryTypes).toStrictEqual([ | ||
MsgWithdrawDelegatorReward, | ||
MsgWithdrawValidatorCommission, | ||
MsgSetWithdrawAddress, | ||
MsgFundCommunityPool, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { | ||
MsgWithdrawDelegatorReward, | ||
MsgWithdrawValidatorCommission, | ||
MsgSetWithdrawAddress, | ||
MsgFundCommunityPool, | ||
} from '../../proto/cosmos/distribution/tx.js' | ||
|
||
export const distributionRegistryTypes = [ | ||
MsgWithdrawDelegatorReward, | ||
MsgWithdrawValidatorCommission, | ||
MsgSetWithdrawAddress, | ||
MsgFundCommunityPool, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { erc20RegistryTypes } from './registry' | ||
|
||
import { MsgConvertCoin, MsgConvertERC20 } from '../../proto/evmos/erc20/tx' | ||
import { | ||
RegisterCoinProposal, | ||
RegisterERC20Proposal, | ||
} from '../../proto/evmos/erc20/erc20' | ||
|
||
describe('test erc20 registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(erc20RegistryTypes).toStrictEqual([ | ||
MsgConvertCoin, | ||
MsgConvertERC20, | ||
RegisterCoinProposal, | ||
RegisterERC20Proposal, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MsgConvertCoin, MsgConvertERC20 } from '../../proto/evmos/erc20/tx.js' | ||
import { | ||
RegisterCoinProposal, | ||
RegisterERC20Proposal, | ||
} from '../../proto/evmos/erc20/erc20.js' | ||
|
||
export const erc20RegistryTypes = [ | ||
MsgConvertCoin, | ||
MsgConvertERC20, | ||
RegisterCoinProposal, | ||
RegisterERC20Proposal, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './msgEthereumTx.js' | ||
export * from './web3Extension.js' | ||
export * from './dynamicFee.js' | ||
export * from './registry.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { evmRegistryTypes } from './registry' | ||
|
||
import { ExtensionOptionDynamicFeeTx } from '../../proto/ethermint/types/dynamicFee' | ||
import { | ||
MsgEthereumTx, | ||
LegacyTx, | ||
AccessListTx, | ||
DynamicFeeTx, | ||
} from '../../proto/ethermint/evm/tx' | ||
import { ExtensionOptionsWeb3Tx } from '../../proto/ethermint/types/web3' | ||
|
||
describe('test evm registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(evmRegistryTypes).toStrictEqual([ | ||
ExtensionOptionDynamicFeeTx, | ||
MsgEthereumTx, | ||
LegacyTx, | ||
AccessListTx, | ||
DynamicFeeTx, | ||
ExtensionOptionsWeb3Tx, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ExtensionOptionDynamicFeeTx } from '../../proto/ethermint/types/dynamicFee.js' | ||
import { | ||
MsgEthereumTx, | ||
LegacyTx, | ||
AccessListTx, | ||
DynamicFeeTx, | ||
} from '../../proto/ethermint/evm/tx.js' | ||
import { ExtensionOptionsWeb3Tx } from '../../proto/ethermint/types/web3.js' | ||
|
||
export const evmRegistryTypes = [ | ||
ExtensionOptionDynamicFeeTx, | ||
MsgEthereumTx, | ||
LegacyTx, | ||
AccessListTx, | ||
DynamicFeeTx, | ||
ExtensionOptionsWeb3Tx, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './msgDeposit.js' | ||
export * from './msgSubmitProposal.js' | ||
export * from './msgVote.js' | ||
export * from './registry.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { govRegistryTypes } from './registry' | ||
|
||
import { | ||
MsgDeposit, | ||
MsgSubmitProposal, | ||
MsgVote, | ||
MsgVoteWeighted, | ||
} from '../../proto/cosmos/gov/tx' | ||
|
||
describe('test gov registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(govRegistryTypes).toStrictEqual([ | ||
MsgDeposit, | ||
MsgSubmitProposal, | ||
MsgVote, | ||
MsgVoteWeighted, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { | ||
MsgDeposit, | ||
MsgSubmitProposal, | ||
MsgVote, | ||
MsgVoteWeighted, | ||
} from '../../proto/cosmos/gov/tx.js' | ||
|
||
export const govRegistryTypes = [ | ||
MsgDeposit, | ||
MsgSubmitProposal, | ||
MsgVote, | ||
MsgVoteWeighted, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './ibcMsgTransfer.js' | ||
export * from './registry.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ibcRegistryTypes } from './registry' | ||
|
||
import { MsgTransfer } from '../../proto/cosmos-ibc/ibc/applications/tx' | ||
import { Height } from '../../proto/cosmos-ibc/ibc/core/client' | ||
|
||
describe('test ibc registry types against expected', () => { | ||
it('exactly equals expected types', () => { | ||
expect(ibcRegistryTypes).toStrictEqual([MsgTransfer, Height]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { MsgTransfer } from '../../proto/cosmos-ibc/ibc/applications/tx.js' | ||
import { Height } from '../../proto/cosmos-ibc/ibc/core/client.js' | ||
|
||
export const ibcRegistryTypes = [MsgTransfer, Height] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.