Compare commits
No commits in common. "fe897cca84f23124f1a2ce67bde12be69219894e" and "a705443786fd41178db22994f076fdd854ca4c38" have entirely different histories.
fe897cca84
...
a705443786
@ -7,27 +7,26 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
createAccountPath = "/api/v2/account/create"
|
createAccountPath = "/api/v2/account/create"
|
||||||
trackStatusPath = "/api/track"
|
trackStatusPath = "/api/track"
|
||||||
balancePathPrefix = "/api/account"
|
balancePathPrefix = "/api/account"
|
||||||
trackPath = "/api/v2/account/status"
|
trackPath = "/api/v2/account/status"
|
||||||
tokenTransferPrefix = "/api/v2/token/transfer"
|
tokenTransferPrefix = "/api/v2/token/transfer"
|
||||||
voucherHoldingsPathPrefix = "/api/v1/holdings"
|
voucherHoldingsPathPrefix = "/api/v1/holdings"
|
||||||
voucherTransfersPathPrefix = "/api/v1/transfers/last10"
|
voucherTransfersPathPrefix = "/api/v1/transfers/last10"
|
||||||
voucherDataPathPrefix = "/api/v1/token"
|
voucherDataPathPrefix = "/api/v1/token"
|
||||||
SendSMSPrefix = "api/v1/external/upsell"
|
SendSMSPrefix = "api/v1/external/upsell"
|
||||||
poolDepositPrefix = "/api/v2/pool/deposit"
|
poolDepositPrefix = "/api/v2/pool/deposit"
|
||||||
poolSwapQoutePrefix = "/api/v2/pool/quote"
|
poolSwapQoutePrefix = "/api/v2/pool/quote"
|
||||||
poolSwapPrefix = "/api/v2/pool/swap"
|
poolSwapPrefix = "/api/v2/pool/swap"
|
||||||
topPoolsPrefix = "/api/v1/pool/top"
|
topPoolsPrefix = "/api/v1/pool/top"
|
||||||
retrievePoolDetailsPrefix = "/api/v1/pool/reverse"
|
retrievePoolDetailsPrefix = "/api/v1/pool/reverse"
|
||||||
poolSwappableVouchersPrefix = "/api/v1/pool"
|
poolSwappableVouchersPrefix = "/api/v1/pool"
|
||||||
AliasRegistrationPrefix = "/api/v1/internal/register"
|
AliasRegistrationPrefix = "/api/v1/internal/register"
|
||||||
AliasResolverPrefix = "/api/v1/resolve"
|
AliasResolverPrefix = "/api/v1/resolve"
|
||||||
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 (
|
||||||
@ -40,27 +39,26 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CreateAccountURL string
|
CreateAccountURL string
|
||||||
TrackStatusURL string
|
TrackStatusURL string
|
||||||
BalanceURL string
|
BalanceURL string
|
||||||
TrackURL string
|
TrackURL string
|
||||||
TokenTransferURL string
|
TokenTransferURL string
|
||||||
VoucherHoldingsURL string
|
VoucherHoldingsURL string
|
||||||
VoucherTransfersURL string
|
VoucherTransfersURL string
|
||||||
VoucherDataURL string
|
VoucherDataURL string
|
||||||
PoolDepositURL string
|
PoolDepositURL string
|
||||||
PoolSwapQuoteURL string
|
PoolSwapQuoteURL string
|
||||||
PoolSwapURL string
|
PoolSwapURL string
|
||||||
TopPoolsURL string
|
TopPoolsURL string
|
||||||
RetrievePoolDetailsURL string
|
RetrievePoolDetailsURL string
|
||||||
PoolSwappableVouchersURL string
|
PoolSwappableVouchersURL string
|
||||||
SendSMSURL string
|
SendSMSURL string
|
||||||
AliasRegistrationURL string
|
AliasRegistrationURL string
|
||||||
AliasResolverURL string
|
AliasResolverURL string
|
||||||
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