Compare commits
No commits in common. "fe897cca84f23124f1a2ce67bde12be69219894e" and "a705443786fd41178db22994f076fdd854ca4c38" have entirely different histories.
fe897cca84
...
a705443786
@ -27,7 +27,6 @@ const (
|
|||||||
ExternalSMSPrefix = "/api/v1/external"
|
ExternalSMSPrefix = "/api/v1/external"
|
||||||
AliasUpdatePrefix = "/api/v1/internal/update"
|
AliasUpdatePrefix = "/api/v1/internal/update"
|
||||||
CreditSendPrefix = "/api/v1/credit-send"
|
CreditSendPrefix = "/api/v1/credit-send"
|
||||||
CreditSendReverseQuotePrefix = "/api/v1/pool/reverse-quote"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -60,7 +59,6 @@ var (
|
|||||||
ExternalSMSURL string
|
ExternalSMSURL string
|
||||||
AliasUpdateURL string
|
AliasUpdateURL string
|
||||||
CreditSendURL string
|
CreditSendURL string
|
||||||
CreditSendReverseQuoteURL string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setBase() error {
|
func setBase() error {
|
||||||
@ -110,7 +108,6 @@ func LoadConfig() error {
|
|||||||
ExternalSMSURL, _ = url.JoinPath(externalSMSBase, ExternalSMSPrefix)
|
ExternalSMSURL, _ = url.JoinPath(externalSMSBase, ExternalSMSPrefix)
|
||||||
AliasUpdateURL, _ = url.JoinPath(aliasEnsURLBase, AliasUpdatePrefix)
|
AliasUpdateURL, _ = url.JoinPath(aliasEnsURLBase, AliasUpdatePrefix)
|
||||||
CreditSendURL, _ = url.JoinPath(dataURLBase, CreditSendPrefix)
|
CreditSendURL, _ = url.JoinPath(dataURLBase, CreditSendPrefix)
|
||||||
CreditSendReverseQuoteURL, _ = url.JoinPath(dataURLBase, CreditSendReverseQuotePrefix)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -914,10 +914,3 @@ func (das *DevAccountService) GetCreditSendMaxLimit(ctx context.Context, poolAdd
|
|||||||
MaxSAT: "3507692",
|
MaxSAT: "3507692",
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (das *DevAccountService) GetCreditSendReverseQuote(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount string) (*models.CreditSendReverseQouteResult, error) {
|
|
||||||
return &models.CreditSendReverseQouteResult{
|
|
||||||
InputAmount: "3076923",
|
|
||||||
OutputAmount: "40000000",
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|||||||
@ -25,8 +25,3 @@ type CreditSendLimitsResult struct {
|
|||||||
MaxRAT string `json:"maxRAT"`
|
MaxRAT string `json:"maxRAT"`
|
||||||
MaxSAT string `json:"maxSAT"`
|
MaxSAT string `json:"maxSAT"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreditSendReverseQouteResult struct {
|
|
||||||
InputAmount string `json:"inputAmount"`
|
|
||||||
OutputAmount string `json:"outputAmount"`
|
|
||||||
}
|
|
||||||
|
|||||||
@ -31,5 +31,4 @@ type AccountService interface {
|
|||||||
GetSwapFromTokenMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.MaxLimitResult, error)
|
GetSwapFromTokenMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.MaxLimitResult, error)
|
||||||
CheckTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error)
|
CheckTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error)
|
||||||
GetCreditSendMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.CreditSendLimitsResult, error)
|
GetCreditSendMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.CreditSendLimitsResult, error)
|
||||||
GetCreditSendReverseQuote(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount string) (*models.CreditSendReverseQouteResult, error)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -762,26 +762,6 @@ func (as *HTTPAccountService) GetCreditSendMaxLimit(ctx context.Context, poolAdd
|
|||||||
return &r, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCreditSendReverseQuote calls the API to getthe reverse quote for sending RAT amount
|
|
||||||
func (as *HTTPAccountService) GetCreditSendReverseQuote(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount string) (*models.CreditSendReverseQouteResult, error) {
|
|
||||||
var r models.CreditSendReverseQouteResult
|
|
||||||
|
|
||||||
ep, err := url.JoinPath(config.CreditSendReverseQuoteURL, poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
req, err := http.NewRequest("GET", ep, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
_, err = doRequest(ctx, req, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &r, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: remove eth-custodial api dependency
|
// TODO: remove eth-custodial api dependency
|
||||||
func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
||||||
var okResponse api.OKResponse
|
var okResponse api.OKResponse
|
||||||
|
|||||||
@ -125,8 +125,3 @@ func (m MockAccountService) GetCreditSendMaxLimit(ctx context.Context, poolAddre
|
|||||||
args := m.Called(poolAddress, fromTokenAddress, toTokenAddress, publicKey)
|
args := m.Called(poolAddress, fromTokenAddress, toTokenAddress, publicKey)
|
||||||
return args.Get(0).(*models.CreditSendLimitsResult), args.Error(1)
|
return args.Get(0).(*models.CreditSendLimitsResult), args.Error(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m MockAccountService) GetCreditSendReverseQuote(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount string) (*models.CreditSendReverseQouteResult, error) {
|
|
||||||
args := m.Called(poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount)
|
|
||||||
return args.Get(0).(*models.CreditSendReverseQouteResult), args.Error(1)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -128,7 +128,3 @@ func (m TestAccountService) CheckTokenInPool(ctx context.Context, poolAddress, t
|
|||||||
func (m TestAccountService) GetCreditSendMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.CreditSendLimitsResult, error) {
|
func (m TestAccountService) GetCreditSendMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.CreditSendLimitsResult, error) {
|
||||||
return &models.CreditSendLimitsResult{}, nil
|
return &models.CreditSendLimitsResult{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m TestAccountService) GetCreditSendReverseQuote(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, toTokenAMount string) (*models.CreditSendReverseQouteResult, error) {
|
|
||||||
return &models.CreditSendReverseQouteResult{}, nil
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user