2024-04-01 13:39:17 +00:00
|
|
|
package paraswap
|
|
|
|
|
2024-07-18 20:14:42 +00:00
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/status-im/status-go/services/wallet/thirdparty"
|
|
|
|
)
|
2024-05-14 19:11:16 +00:00
|
|
|
|
2024-06-12 20:14:30 +00:00
|
|
|
type SwapSide string
|
|
|
|
|
|
|
|
const (
|
|
|
|
SellSide = SwapSide("SELL")
|
|
|
|
BuySide = SwapSide("BUY")
|
|
|
|
)
|
|
|
|
|
2024-04-01 13:39:17 +00:00
|
|
|
type ClientV5 struct {
|
2024-07-18 20:14:42 +00:00
|
|
|
httpClient *thirdparty.HTTPClient
|
|
|
|
chainID uint64
|
|
|
|
partnerID string
|
|
|
|
partnerAddress common.Address
|
|
|
|
partnerFeePcnt float64
|
2024-04-01 13:39:17 +00:00
|
|
|
}
|
|
|
|
|
2024-07-18 20:14:42 +00:00
|
|
|
func NewClientV5(
|
|
|
|
chainID uint64,
|
|
|
|
partnerID string,
|
|
|
|
partnerAddress common.Address,
|
|
|
|
partnerFeePcnt float64) *ClientV5 {
|
2024-04-01 13:39:17 +00:00
|
|
|
return &ClientV5{
|
2024-07-18 20:14:42 +00:00
|
|
|
httpClient: thirdparty.NewHTTPClient(),
|
|
|
|
chainID: chainID,
|
|
|
|
partnerID: partnerID,
|
|
|
|
partnerAddress: partnerAddress,
|
|
|
|
partnerFeePcnt: partnerFeePcnt,
|
2024-04-01 13:39:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ClientV5) SetChainID(chainID uint64) {
|
|
|
|
c.chainID = chainID
|
|
|
|
}
|
2024-07-18 20:14:42 +00:00
|
|
|
|
|
|
|
func (c *ClientV5) SetPartnerAddress(partnerAddress common.Address) {
|
|
|
|
c.partnerAddress = partnerAddress
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ClientV5) SetPartnerFeePcnt(partnerFeePcnt float64) {
|
|
|
|
c.partnerFeePcnt = partnerFeePcnt
|
|
|
|
}
|