Skip to content

Commit

Permalink
Fix proto pkg gravity exports and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianBorst committed Nov 15, 2023
1 parent ebdd12c commit e36a7a6
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
57 changes: 46 additions & 11 deletions packages/proto/src/messages/gravity/gravity.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,55 @@
import { createMsgBid } from './msgSendToEth'
import { MsgBid } from '../../proto/auction/v1/msgs_pb'
import { createMsgSendToEth } from './msgSendToEth'
import { createMsgCancelSendToEth } from './msgCancelSendToEth'
import { createMsgRequestBatch } from './msgRequestBatch'
import { createMsgExecuteIbcAutoForwards } from './msgExecuteIbcAutoForwards'

import { MsgSendToEth, MsgCancelSendToEth, MsgRequestBatch, MsgExecuteIbcAutoForwards } from '../../proto/gravity/v1/msgs_pb'
import { from, to, denom } from '../../proto/tests/utils'
import { JSONOptions } from '../../registry/registry'

describe('test Auction Module message generation', () => {
it('correctly wraps MsgBid', () => {
const id = '1'
describe('test Gravity Module message generation', () => {
it('correctly wraps MsgSendToEth', () => {
const amount = '10000000'
const msg = createMsgSendToEth(from, to, amount, denom, amount, amount)

expect(msg.message.toJson(JSONOptions)).toStrictEqual({
sender: from,
eth_dest: to,
amount,
denom,
bridge_fee: amount,
chain_fee: amount,
})
expect(msg.path).toStrictEqual(MsgSendToEth.typeName)
})

it('correctly wraps MsgCancelSendToEth', () => {
const msg = createMsgCancelSendToEth(from)

expect(msg.message.toJson(JSONOptions)).toStrictEqual({
sender: from,
})
expect(msg.path).toStrictEqual(MsgCancelSendToEth.typeName)
})

it('correctly wraps MsgRequestBatch', () => {
const msg = createMsgRequestBatch(from, denom)

expect(msg.message.toJson(JSONOptions)).toStrictEqual({
sender: from,
denom,
})
expect(msg.path).toStrictEqual(MsgRequestBatch.typeName)
})

it('correctly wraps MsgExecuteIbcAutoForwards', () => {
const amount = '10000000'
const msg = createMsgBid(id, from, amount, amount)
const msg = createMsgExecuteIbcAutoForwards(from, amount)

expect(msg.message.toJson(JSONOptions)).toStrictEqual({
auction_id: id,
bidder: from,
amount: amount,
bid_fee: amount,
sender: from,
forwards_to_clear: amount,
})
expect(msg.path).toStrictEqual(MsgBid.typeName)
expect(msg.path).toStrictEqual(MsgExecuteIbcAutoForwards.typeName)
})
})
4 changes: 4 additions & 0 deletions packages/proto/src/messages/gravity/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export * from './msgSendToEth'
export * from './msgCancelSendToEth'
export * from './msgRequestBatch'
export * from './msgExecuteIbcAutoForwards'

export * from './registry'
export * from './aminoRegistry'

0 comments on commit e36a7a6

Please sign in to comment.