Compare commits
No commits in common. "81fbc2574c30a6884b5395bc3fcff498d87ab6c9" and "e6677015d90777e6e330421ffcfc0dd6067aac96" have entirely different histories.
81fbc2574c
...
e6677015d9
@ -392,7 +392,7 @@ func (as *HTTPAccountService) getPoolSwappableFromVouchers(ctx context.Context,
|
|||||||
func (as *HTTPAccountService) GetPoolSwappableVouchers(ctx context.Context, poolAddress, publicKey string) ([]dataserviceapi.TokenHoldings, error) {
|
func (as *HTTPAccountService) GetPoolSwappableVouchers(ctx context.Context, poolAddress, publicKey string) ([]dataserviceapi.TokenHoldings, error) {
|
||||||
svc := dev.NewDevAccountService(ctx, as.SS)
|
svc := dev.NewDevAccountService(ctx, as.SS)
|
||||||
if as.UseApi {
|
if as.UseApi {
|
||||||
return as.getPoolSwappableVouchers(ctx, poolAddress, publicKey)
|
return as.getPoolSwappableFromVouchers(ctx, poolAddress, publicKey)
|
||||||
} else {
|
} else {
|
||||||
return svc.GetPoolSwappableVouchers(ctx, poolAddress, publicKey)
|
return svc.GetPoolSwappableVouchers(ctx, poolAddress, publicKey)
|
||||||
}
|
}
|
||||||
@ -452,7 +452,9 @@ 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 models.MaxLimitResult
|
var r struct {
|
||||||
|
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 {
|
||||||
@ -463,11 +465,8 @@ 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, nil
|
return &r.MaxPoolLimitResult, 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) {
|
||||||
@ -480,7 +479,9 @@ 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 models.TokenInPoolResult
|
var r struct {
|
||||||
|
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 {
|
||||||
@ -491,11 +492,8 @@ 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, nil
|
return &r.TokenInPoolResult, 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