Fix: Correct JSON mapping for checkTokenInPool and getSwapFromTokenMaxLimit API responses
This commit is contained in:
parent
e6677015d9
commit
334aa07f9f
@ -452,9 +452,7 @@ func (as *HTTPAccountService) GetSwapFromTokenMaxLimit(ctx context.Context, pool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (as *HTTPAccountService) getSwapFromTokenMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokeAddress, publicKey string) (*models.MaxLimitResult, error) {
|
func (as *HTTPAccountService) getSwapFromTokenMaxLimit(ctx context.Context, poolAddress, fromTokenAddress, toTokeAddress, publicKey string) (*models.MaxLimitResult, error) {
|
||||||
var r struct {
|
var r models.MaxLimitResult
|
||||||
MaxPoolLimitResult models.MaxLimitResult `json:"max"`
|
|
||||||
}
|
|
||||||
|
|
||||||
ep, err := url.JoinPath(config.PoolSwappableVouchersURL, poolAddress, "limit", fromTokenAddress, toTokeAddress, publicKey)
|
ep, err := url.JoinPath(config.PoolSwappableVouchersURL, poolAddress, "limit", fromTokenAddress, toTokeAddress, publicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -465,8 +463,11 @@ func (as *HTTPAccountService) getSwapFromTokenMaxLimit(ctx context.Context, pool
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = doRequest(ctx, req, &r)
|
_, err = doRequest(ctx, req, &r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &r.MaxPoolLimitResult, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *HTTPAccountService) CheckTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
|
func (as *HTTPAccountService) CheckTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
|
||||||
@ -479,9 +480,7 @@ func (as *HTTPAccountService) CheckTokenInPool(ctx context.Context, poolAddress,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (as *HTTPAccountService) checkTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
|
func (as *HTTPAccountService) checkTokenInPool(ctx context.Context, poolAddress, tokenAddress string) (*models.TokenInPoolResult, error) {
|
||||||
var r struct {
|
var r models.TokenInPoolResult
|
||||||
TokenInPoolResult models.TokenInPoolResult `json:"canSwapFrom"`
|
|
||||||
}
|
|
||||||
|
|
||||||
ep, err := url.JoinPath(config.PoolSwappableVouchersURL, poolAddress, "check", tokenAddress)
|
ep, err := url.JoinPath(config.PoolSwappableVouchersURL, poolAddress, "check", tokenAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -492,8 +491,11 @@ func (as *HTTPAccountService) checkTokenInPool(ctx context.Context, poolAddress,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = doRequest(ctx, req, &r)
|
_, err = doRequest(ctx, req, &r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &r.TokenInPoolResult, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Use actual custodial api to request available alias
|
// TODO: Use actual custodial api to request available alias
|
||||||
|
Loading…
Reference in New Issue
Block a user