Skip to content

Commit

Permalink
feat: customMessageTypeRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
mhagel committed Sep 11, 2022
1 parent 315e426 commit 0851010
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
60 changes: 60 additions & 0 deletions packages/api/src/tx/customMessageTypeRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import {
MsgCancel,
MsgCreateClass,
MsgSend,
MsgBridge,
MsgCreateBatch,
MsgCreateProject,
MsgMintBatchCredits,
MsgRetire,
MsgUpdateClassAdmin,
MsgUpdateClassIssuers,
MsgUpdateProjectMetadata,
MsgUpdateProjectAdmin,
} from '../generated/regen/ecocredit/v1/tx';
import {
MsgCreate,
MsgPut,
MsgTake,
} from '../generated/regen/ecocredit/basket/v1/tx';
import {
MsgBuyDirect,
MsgSell,
MsgUpdateSellOrders,
MsgCancelSellOrder,
} from '../generated/regen/ecocredit/marketplace/v1/tx';
import { GeneratedType } from '@cosmjs/proto-signing';

const ecocreditRegistry: Array<[string, GeneratedType]> = [
[MsgCancel.$type, MsgCancel],
[MsgCreateClass.$type, MsgCreateClass],
[MsgSend.$type, MsgSend],
[MsgBridge.$type, MsgBridge],
[MsgCreateBatch.$type, MsgCreateBatch],
[MsgCreateProject.$type, MsgCreateProject],
[MsgMintBatchCredits.$type, MsgMintBatchCredits],
[MsgRetire.$type, MsgRetire],
[MsgUpdateClassAdmin.$type, MsgUpdateClassAdmin],
[MsgUpdateClassIssuers.$type, MsgUpdateClassIssuers],
[MsgUpdateProjectMetadata.$type, MsgUpdateProjectMetadata],
[MsgUpdateProjectAdmin.$type, MsgUpdateProjectAdmin],
];

const basketRegistry: Array<[string, GeneratedType]> = [
[MsgCreate.$type, MsgCreate],
[MsgPut.$type, MsgPut],
[MsgTake.$type, MsgTake],
];

const marketplaceRegistry: Array<[string, GeneratedType]> = [
[MsgBuyDirect.$type, MsgBuyDirect],
[MsgSell.$type, MsgSell],
[MsgUpdateSellOrders.$type, MsgUpdateSellOrders],
[MsgCancelSellOrder.$type, MsgCancelSellOrder],
];

export const customRegistry = [
...ecocreditRegistry,
...basketRegistry,
...marketplaceRegistry,
];
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AminoMsg, Coin as AminoCoin } from '@cosmjs/amino';
import { AminoMsg } from '@cosmjs/amino';
import { AminoConverter } from '@cosmjs/stargate';
import { MsgCreateProject } from '../../../../generated/regen/ecocredit/v1/tx';

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/tx/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { createEcocreditAminoConverters } from './ecocredit/converters';
export { createEcocreditAminoConverters } from './ecocredit/converters';

0 comments on commit 0851010

Please sign in to comment.