diff --git a/go/extensions/codec.go b/go/extensions/codec.go index 19d17820..acb04d00 100644 --- a/go/extensions/codec.go +++ b/go/extensions/codec.go @@ -34,5 +34,8 @@ func RegisterCodec(codec *amino.Codec) { codec.RegisterConcrete(&MsgAddLiquidity{}, "irismod/coinswap/MsgAddLiquidity", nil) codec.RegisterConcrete(&MsgRemoveLiquidity{}, "irismod/coinswap/MsgRemoveLiquidity", nil) codec.RegisterConcrete(&CoinswapParams{}, "irismod/coinswap/Params", nil) + codec.RegisterConcrete(&MsgCreateHTLC{}, "irishub/htlc/MsgCreateHTLC", nil) + codec.RegisterConcrete(&MsgClaimHTLC{}, "irishub/htlc/MsgClaimHTLC", nil) + codec.RegisterConcrete(&MsgRefundHTLC{}, "irishub/htlc/MsgRefundHTLC", nil) } diff --git a/go/extensions/htlc.go b/go/extensions/htlc.go new file mode 100644 index 00000000..3ae9c331 --- /dev/null +++ b/go/extensions/htlc.go @@ -0,0 +1,26 @@ +package extensions + +import ( + sdk "github.com/cosmos/amino-js/go/lib/cosmos/cosmos-sdk/types" +) + +type MsgCreateHTLC struct { + Sender sdk.AccAddress `json:"sender"` // the initiator address + To sdk.AccAddress `json:"to"` // the destination address + ReceiverOnOtherChain string `json:"receiver_on_other_chain"` // the claim receiving address on the other chain + Amount sdk.Coins `json:"amount"` // the amount to be transferred + HashLock []byte `json:"hash_lock"` // the hash lock generated from secret (and timestamp if provided) + Timestamp uint64 `json:"timestamp"` // if provided, used to generate the hash lock together with secret + TimeLock uint64 `json:"time_lock"` // the time span after which the HTLC will expire +} + +type MsgClaimHTLC struct { + Sender sdk.AccAddress `json:"sender"` // the initiator address + HashLock []byte `json:"hash_lock"` // the hash lock identifying the HTLC to be claimed + Secret []byte `json:"secret"` // the secret with which to claim +} + +type MsgRefundHTLC struct { + Sender sdk.AccAddress `json:"sender"` // the initiator address + HashLock []byte `json:"hash_lock"` // the hash lock identifying the HTLC to be refunded +} \ No newline at end of file