-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package assetsmanager | ||
|
||
import ( | ||
"github.com/trustwallet/go-libs/client" | ||
) | ||
|
||
type Client struct { | ||
req client.Request | ||
} | ||
|
||
func InitClient(url string, errorHandler client.HttpErrorHandler) Client { | ||
return Client{ | ||
req: client.InitJSONClient(url, errorHandler), | ||
} | ||
} | ||
|
||
func (c *Client) ValidateAssetInfo(req *AssetValidationReq) (result AssetValidationResp, err error) { | ||
err = c.req.Post(&result, "/v1/validate/asset_info", req) | ||
return result, err | ||
} | ||
|
||
func (c *Client) GetTagValues() (result TagValuesResp, err error) { | ||
err = c.req.Get(&result, "/v1/values/tags", nil) | ||
return result, 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,52 @@ | ||
package assetsmanager | ||
|
||
type ( | ||
AssetValidationReq struct { | ||
Name *string `json:"name,omitempty"` | ||
Symbol *string `json:"symbol,omitempty"` | ||
Type *string `json:"type,omitempty"` | ||
Decimals *int `json:"decimals,omitempty"` | ||
Description *string `json:"description,omitempty"` | ||
Website *string `json:"website,omitempty"` | ||
Explorer *string `json:"explorer,omitempty"` | ||
Research string `json:"research,omitempty"` | ||
Status *string `json:"status,omitempty"` | ||
ID *string `json:"id,omitempty"` | ||
Links []struct { | ||
Name *string `json:"name,omitempty"` | ||
URL *string `json:"url,omitempty"` | ||
} `json:"links,omitempty"` | ||
ShortDesc *string `json:"short_desc,omitempty"` | ||
Audit *string `json:"audit,omitempty"` | ||
AuditReport *string `json:"audit_report,omitempty"` | ||
Tags []string `json:"tags,omitempty"` | ||
Code *string `json:"code,omitempty"` | ||
Ticker *string `json:"ticker,omitempty"` | ||
ExplorerEth *string `json:"explorer-ETH,omitempty"` | ||
Address *string `json:"address,omitempty"` | ||
Twitter *string `json:"twitter,omitempty"` | ||
CoinMarketcap *string `json:"coinmarketcap,omitempty"` | ||
DataSource *string `json:"data_source,omitempty"` | ||
} | ||
|
||
AssetValidationResp struct { | ||
Status string `json:"status"` | ||
Errors []Error `json:"errors"` | ||
} | ||
|
||
Error struct { | ||
Message string `json:"message"` | ||
} | ||
) | ||
|
||
type ( | ||
TagValuesResp struct { | ||
Tags []Tag `json:"tags"` | ||
} | ||
|
||
Tag struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
} | ||
) |
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