Skip to content

Commit

Permalink
Set memo field to MsgTransfer messages
Browse files Browse the repository at this point in the history
  • Loading branch information
luckychess committed Aug 13, 2024
1 parent 4ed2615 commit f6bf7c9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion relayer/chains/cosmos/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ func (cc *CosmosProvider) MsgTransfer(
dstAddr string,
amount sdk.Coin,
info provider.PacketInfo,
memo string,
) (provider.RelayerMessage, error) {
acc, err := cc.Address()
if err != nil {
Expand All @@ -808,6 +809,7 @@ func (cc *CosmosProvider) MsgTransfer(
Sender: acc,
Receiver: dstAddr,
TimeoutTimestamp: info.TimeoutTimestamp,
Memo: memo,
}

// If the timeoutHeight is 0 then we don't need to explicitly set it on the MsgTransfer
Expand Down Expand Up @@ -1746,7 +1748,7 @@ func (cc *CosmosProvider) SetWithExtensionOptions(txf tx.Factory) (tx.Factory, e
for _, opt := range cc.PCfg.ExtensionOptions {
max, ok := sdkmath.NewIntFromString(opt.Value)
if !ok {
return txf,errors.New("invalid opt value")
return txf, errors.New("invalid opt value")
}
extensionOption := ethermint.ExtensionOptionDynamicFeeTx{
MaxPriorityPrice: max,
Expand Down
4 changes: 3 additions & 1 deletion relayer/chains/penumbra/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ func (cc *PenumbraProvider) MsgTransfer(
dstAddr string,
amount sdk.Coin,
info provider.PacketInfo,
memo string,
) (provider.RelayerMessage, error) {
acc, err := cc.Address()
if err != nil {
Expand All @@ -1011,6 +1012,7 @@ func (cc *PenumbraProvider) MsgTransfer(
Sender: acc,
Receiver: dstAddr,
TimeoutTimestamp: info.TimeoutTimestamp,
Memo: memo,
}

// If the timeoutHeight is 0 then we don't need to explicitly set it on the MsgTransfer
Expand Down Expand Up @@ -2254,7 +2256,7 @@ func (cc *PenumbraProvider) waitForBlockInclusion(
return cc.mkTxResult(res)
}
if strings.Contains(err.Error(), "transaction indexing is disabled") {
return nil,errors.New("cannot determine success/failure of tx because transaction indexing is disabled on rpc url")
return nil, errors.New("cannot determine success/failure of tx because transaction indexing is disabled on rpc url")
}
case <-ctx.Done():
return nil, ctx.Err()
Expand Down
2 changes: 1 addition & 1 deletion relayer/packet-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *Chain) SendTransferMsg(
TimeoutTimestamp: timeoutTimestamp,
}

msg, err := c.ChainProvider.MsgTransfer(dstAddr, amount, pi)
msg, err := c.ChainProvider.MsgTransfer(dstAddr, amount, pi, memo)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion relayer/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ type ChainProvider interface {
NextSeqRecv(ctx context.Context, msgTransfer PacketInfo, height uint64) (PacketProof, error)

// MsgTransfer constructs a MsgTransfer message ready to write to the chain.
MsgTransfer(dstAddr string, amount sdk.Coin, info PacketInfo) (RelayerMessage, error)
MsgTransfer(dstAddr string, amount sdk.Coin, info PacketInfo, memo string) (RelayerMessage, error)

// MsgRecvPacket takes the packet information from a MsgTransfer along with the packet commitment,
// and assembles a full MsgRecvPacket ready to write to the chain.
Expand Down

0 comments on commit f6bf7c9

Please sign in to comment.