-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add updater auto (BEP2) * Add omitempty property to other asset fields * Refactor code * Implement generating of tokens list * Implement createTokenListJSON * Fix review comments
- Loading branch information
Showing
19 changed files
with
591 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package dex | ||
|
||
import ( | ||
"net/url" | ||
"strconv" | ||
|
||
"github.com/trustwallet/go-libs/client" | ||
) | ||
|
||
type Client struct { | ||
req client.Request | ||
} | ||
|
||
func NewClient(url string, errorHandler client.HttpErrorHandler) *Client { | ||
return &Client{req: client.InitClient(url, errorHandler)} | ||
} | ||
|
||
func (c *Client) GetMarketPairs(limit int) (pairs []MarketPair, err error) { | ||
params := url.Values{ | ||
"limit": {strconv.Itoa(limit)}, | ||
} | ||
err = c.req.Get(&pairs, "/v1/markets", params) | ||
|
||
return pairs, err | ||
} | ||
|
||
func (c *Client) GetTokensList(limit int) (tokens []Token, err error) { | ||
params := url.Values{ | ||
"limit": {strconv.Itoa(limit)}, | ||
} | ||
err = c.req.Get(&tokens, "/v1/tokens", params) | ||
|
||
return tokens, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dex | ||
|
||
type ( | ||
MarketPair struct { | ||
BaseAssetSymbol string `json:"base_asset_symbol"` | ||
LotSize string `json:"lot_size"` | ||
QuoteAssetSymbol string `json:"quote_asset_symbol"` | ||
TickSize string `json:"tick_size"` | ||
} | ||
|
||
Token struct { | ||
Symbol string `json:"symbol"` | ||
Name string `json:"name"` | ||
OriginalSymbol string `json:"original_symbol"` | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package explorer | ||
|
||
import ( | ||
"net/url" | ||
"strconv" | ||
|
||
"github.com/trustwallet/go-libs/client" | ||
) | ||
|
||
type Client struct { | ||
req client.Request | ||
} | ||
|
||
func NewClient(url string, errorHandler client.HttpErrorHandler) *Client { | ||
return &Client{req: client.InitClient(url, errorHandler)} | ||
} | ||
|
||
func (c *Client) GetBep2Assets(page, rows int) (assets Bep2Assets, err error) { | ||
params := url.Values{ | ||
"page": {strconv.Itoa(page)}, | ||
"rows": {strconv.Itoa(rows)}, | ||
} | ||
err = c.req.Get(&assets, "/api/v1/assets", params) | ||
|
||
return assets, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package explorer | ||
|
||
type ( | ||
Bep2Asset struct { | ||
Asset string `json:"asset"` | ||
Name string `json:"name"` | ||
AssetImg string `json:"assetImg"` | ||
MappedAsset string `json:"mappedAsset"` | ||
Decimals int `json:"decimals"` | ||
} | ||
|
||
Bep2Assets struct { | ||
AssetInfoList []Bep2Asset `json:"assetInfoList"` | ||
} | ||
) |
Oops, something went wrong.