Skip to content

Commit

Permalink
Merge pull request #462 from icon-project/feat/stellar-cluster-connec…
Browse files Browse the repository at this point in the history
…tion

feat: implement cluster connection recv_message in stellar
  • Loading branch information
sherpalden authored Dec 13, 2024
2 parents d5b6e2d + d52648a commit 13fec5f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions relayer/chains/steller/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,21 @@ func (p *Provider) newContractCallArgs(msg relayertypes.Message) (*xdr.InvokeCon
stellerMsg.ScvData(),
},
}, nil
case evtypes.PacketAcknowledged:
scConnAddr, err := p.scContractAddr(p.cfg.Contracts[relayertypes.ConnectionContract])
if err != nil {
return nil, err
}
return &xdr.InvokeContractArgs{
ContractAddress: *scConnAddr,
FunctionName: xdr.ScSymbol("recv_message_with_signatures"),
Args: []xdr.ScVal{
stellerMsg.ScvSrc(),
stellerMsg.ScvSn(),
stellerMsg.ScvData(),
stellerMsg.ScvSignatures(),
},
}, nil
case evtypes.CallMessage:
scXcallAddr, err := p.scContractAddr(p.cfg.Contracts[relayertypes.XcallContract])
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions relayer/chains/steller/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,14 @@ func (m StellerMsg) ScvData() xdr.ScVal {
scVal, _ := xdr.NewScVal(xdr.ScValTypeScvBytes, xdr.ScBytes(m.Data))
return scVal
}

func (m StellerMsg) ScvSignatures() xdr.ScVal {
var scSignatures xdr.ScVec
for _, sign := range m.Signatures {
scVal, _ := xdr.NewScVal(xdr.ScValTypeScvBytes, xdr.ScBytes(sign))
scSignatures = append(scSignatures, scVal)
}

scValSignatures, _ := xdr.NewScVal(xdr.ScValTypeScvVec, xdr.ScVec(scSignatures))
return scValSignatures
}

0 comments on commit 13fec5f

Please sign in to comment.