Skip to content

Commit ddf6232

Browse files
authored
fix: add repayment chain id to api (#68)
1 parent 636d15a commit ddf6232

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

api/handlers/signing.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ const (
2323
)
2424

2525
type SigningBody struct {
26-
ChainId uint64
27-
DepositId string `json:"depositId"`
28-
Nonce *BigInt `json:"nonce"`
29-
Protocol ProtocolType `json:"protocol"`
30-
LiquidityPool string `json:"liquidityPool"`
31-
Caller string `json:"caller"`
32-
Calldata string `json:"calldata"`
33-
DepositTxHash string `json:"depositTxHash"`
34-
BorrowAmount *BigInt `json:"borrowAmount"`
26+
ChainId uint64
27+
DepositId string `json:"depositId"`
28+
Nonce *BigInt `json:"nonce"`
29+
Protocol ProtocolType `json:"protocol"`
30+
LiquidityPool string `json:"liquidityPool"`
31+
Caller string `json:"caller"`
32+
Calldata string `json:"calldata"`
33+
DepositTxHash string `json:"depositTxHash"`
34+
BorrowAmount *BigInt `json:"borrowAmount"`
35+
RepaymentChainId uint64 `jsoin:"repaymentChainId"`
3536
}
3637

3738
type SigningHandler struct {
@@ -71,14 +72,15 @@ func (h *SigningHandler) HandleSigning(w http.ResponseWriter, r *http.Request) {
7172
{
7273
depositId, _ := new(big.Int).SetString(b.DepositId, 10)
7374
m = evmMessage.NewAcrossMessage(0, b.ChainId, &evmMessage.AcrossData{
74-
DepositId: depositId,
75-
Nonce: b.Nonce.Int,
76-
LiquidityPool: common.HexToAddress(b.LiquidityPool),
77-
Caller: common.HexToAddress(b.Caller),
78-
Source: 0,
79-
Destination: b.ChainId,
80-
ErrChn: errChn,
81-
DepositTxHash: common.HexToHash(b.DepositTxHash),
75+
DepositId: depositId,
76+
Nonce: b.Nonce.Int,
77+
LiquidityPool: common.HexToAddress(b.LiquidityPool),
78+
Caller: common.HexToAddress(b.Caller),
79+
Source: 0,
80+
Destination: b.ChainId,
81+
ErrChn: errChn,
82+
DepositTxHash: common.HexToHash(b.DepositTxHash),
83+
RepaymentChainID: b.RepaymentChainId,
8284
})
8385
}
8486
case MayanProtocol:

api/handlers/signing_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,12 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_AcrossSuccess() {
263263
handler := handlers.NewSigningHandler(msgChn, s.chains)
264264

265265
input := handlers.SigningBody{
266-
DepositId: "1000",
267-
Protocol: "across",
268-
LiquidityPool: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
269-
Caller: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
270-
Nonce: &handlers.BigInt{big.NewInt(1001)},
266+
DepositId: "1000",
267+
Protocol: "across",
268+
LiquidityPool: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
269+
Caller: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
270+
Nonce: &handlers.BigInt{big.NewInt(1001)},
271+
RepaymentChainId: 5,
271272
}
272273
body, _ := json.Marshal(input)
273274

@@ -282,6 +283,7 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_AcrossSuccess() {
282283
go func() {
283284
msg := <-msgChn
284285
ad := msg[0].Data.(*across.AcrossData)
286+
s.Equal(ad.RepaymentChainID, uint64(5))
285287
ad.ErrChn <- nil
286288
}()
287289

0 commit comments

Comments
 (0)