Compare commits
No commits in common. "master" and "update-alias" have entirely different histories.
master
...
update-ali
@ -32,19 +32,6 @@ type HTTPAccountService struct {
|
|||||||
UseApi bool
|
UseApi bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// symbolReplacements holds mappings of invalid symbols → valid ones
|
|
||||||
var symbolReplacements = map[string]string{
|
|
||||||
"USD₮": "USDT",
|
|
||||||
}
|
|
||||||
|
|
||||||
// sanitizeSymbol replaces known invalid token symbols with normalized ones
|
|
||||||
func sanitizeSymbol(symbol string) string {
|
|
||||||
if replacement, ok := symbolReplacements[symbol]; ok {
|
|
||||||
return replacement
|
|
||||||
}
|
|
||||||
return symbol
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - trackingId: A unique identifier for the account.This should be obtained from a previous call to
|
// - trackingId: A unique identifier for the account.This should be obtained from a previous call to
|
||||||
// CreateAccount or a similar function that returns an AccountResponse. The `trackingId` field in the
|
// CreateAccount or a similar function that returns an AccountResponse. The `trackingId` field in the
|
||||||
@ -143,11 +130,6 @@ func (as *HTTPAccountService) FetchVouchers(ctx context.Context, publicKey strin
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize symbols before returning
|
|
||||||
for i := range r.Holdings {
|
|
||||||
r.Holdings[i].TokenSymbol = sanitizeSymbol(r.Holdings[i].TokenSymbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Holdings, nil
|
return r.Holdings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,11 +156,6 @@ func (as *HTTPAccountService) FetchTransactions(ctx context.Context, publicKey s
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize symbols before returning
|
|
||||||
for i := range r.Transfers {
|
|
||||||
r.Transfers[i].TokenSymbol = sanitizeSymbol(r.Transfers[i].TokenSymbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Transfers, nil
|
return r.Transfers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,9 +177,6 @@ func (as *HTTPAccountService) VoucherData(ctx context.Context, address string) (
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize symbols before returning
|
|
||||||
r.TokenDetails.TokenSymbol = sanitizeSymbol(r.TokenDetails.TokenSymbol)
|
|
||||||
|
|
||||||
_, err = doRequest(ctx, req, &r)
|
_, err = doRequest(ctx, req, &r)
|
||||||
return &r.TokenDetails, err
|
return &r.TokenDetails, err
|
||||||
}
|
}
|
||||||
@ -393,6 +367,7 @@ func (as *HTTPAccountService) GetPoolSwappableFromVouchers(ctx context.Context,
|
|||||||
svc := dev.NewDevAccountService(ctx, as.SS)
|
svc := dev.NewDevAccountService(ctx, as.SS)
|
||||||
return svc.GetPoolSwappableFromVouchers(ctx, poolAddress, publicKey)
|
return svc.GetPoolSwappableFromVouchers(ctx, poolAddress, publicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *HTTPAccountService) getPoolSwappableFromVouchers(ctx context.Context, poolAddress, publicKey string) ([]dataserviceapi.TokenHoldings, error) {
|
func (as *HTTPAccountService) getPoolSwappableFromVouchers(ctx context.Context, poolAddress, publicKey string) ([]dataserviceapi.TokenHoldings, error) {
|
||||||
@ -408,14 +383,6 @@ func (as *HTTPAccountService) getPoolSwappableFromVouchers(ctx context.Context,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = doRequest(ctx, req, &r)
|
_, err = doRequest(ctx, req, &r)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize symbols before returning
|
|
||||||
for i := range r.PoolSwappableVouchers {
|
|
||||||
r.PoolSwappableVouchers[i].TokenSymbol = sanitizeSymbol(r.PoolSwappableVouchers[i].TokenSymbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.PoolSwappableVouchers, nil
|
return r.PoolSwappableVouchers, nil
|
||||||
}
|
}
|
||||||
@ -456,15 +423,6 @@ func (as HTTPAccountService) getPoolSwappableVouchers(ctx context.Context, poolA
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, err = doRequest(ctx, req, &r)
|
_, err = doRequest(ctx, req, &r)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize symbols before returning
|
|
||||||
for i := range r.PoolSwappableVouchers {
|
|
||||||
r.PoolSwappableVouchers[i].TokenSymbol = sanitizeSymbol(r.PoolSwappableVouchers[i].TokenSymbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.PoolSwappableVouchers, nil
|
return r.PoolSwappableVouchers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user