Compare commits

..

No commits in common. "ee434dba69805dd3cac368a2b4870cf12c5372bd" and "3b85167ad84ae5ef20c2306fe83c8219120bae30" have entirely different histories.

4 changed files with 19 additions and 55 deletions

View File

@ -870,6 +870,7 @@ func (das *DevAccountService) GetPoolSwappableVouchers(ctx context.Context, pool
} }
func (das *DevAccountService) GetSwapFromTokenMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.MaxLimitResult, error) { func (das *DevAccountService) GetSwapFromTokenMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokenAddress, publicKey string) (*models.MaxLimitResult, error) {
p, ok := das.pools[poolAddress] p, ok := das.pools[poolAddress]
if !ok { if !ok {
return nil, fmt.Errorf("Pool address: %v not found ", poolAddress) return nil, fmt.Errorf("Pool address: %v not found ", poolAddress)
@ -883,9 +884,3 @@ func (das *DevAccountService) GetSwapFromTokenMaxLimit(ctx context.Context, pool
Max: limit, Max: limit,
}, nil }, nil
} }
func (das *DevAccountService) CheckTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
return &models.TokenInPoolResult{
CanSwapFrom: true,
}, nil
}

View File

@ -16,7 +16,3 @@ type PoolSwapResult struct {
type MaxLimitResult struct { type MaxLimitResult struct {
Max string `json:"max"` Max string `json:"max"`
} }
type TokenInPoolResult struct {
CanSwapFrom bool `json:"canSwapFrom"`
}

View File

@ -469,33 +469,6 @@ func (as *HTTPAccountService) getSwapFromTokenMaxLimit(ctx context.Context, pool
return &r.MaxPoolLimitResult, nil return &r.MaxPoolLimitResult, nil
} }
func (as *HTTPAccountService) CheckTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
if as.UseApi {
return as.checkTokenInPool(ctx, poolAddress, tokenAddress)
} else {
svc := dev.NewDevAccountService(ctx, as.SS)
return svc.CheckTokenInPool(ctx, poolAddress, tokenAddress)
}
}
func (as *HTTPAccountService) checkTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
var r struct {
TokenInPoolResult models.TokenInPoolResult `json:"canSwapFrom"`
}
ep, err := url.JoinPath(config.PoolSwappableVouchersURL, poolAddress, "check", tokenAddress)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", ep, nil)
if err != nil {
return nil, err
}
_, err = doRequest(ctx, req, &r)
return &r.TokenInPoolResult, nil
}
// TODO: Use actual custodial api to request available alias // TODO: Use actual custodial api to request available alias
func (as *HTTPAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { func (as *HTTPAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) {
if as.SS == nil { if as.SS == nil {