go-libs's People
Forkers
songky bitlyfe-io jdtruth88 safecomet-inc avinashpandit galadrin lamontef varirious pptphutho ubozov marhaba-defi harrychendev secretworldbsc valerid isabella232 universefeeler samkenxstream renaissancelab vignesh-innblockchain mysaleslee common-base-project mother-earth me-motherearth musinit wuzhanfly nitin1259 liam-trust jozgonzalez erkansukgen doperiddle carlcarl wchh maxwellcotto qct leohuntlucky danishahmed111 montha20 ngqinzhego-libs's Issues
Add library code for defining apis that require hmac signature
Client does not support custom headers per request.
cl := InitClient("someapi.com", ...)
func someHttpHandler(params) {
// currently you can do the following but it will affect other processes that use the same client
cl.SetHeader("some-key", params["some-value"])
cl.Get(...)
// we could do something like this
cl.NewRequest("GET").WithHeader("some-key", params["some-value"]).Do(...)
}
Add binance dex client
Migrate Asset ID
[gin] add unixfile graceful shutdown listener
[Client] Remove extra ? when query is empty
url="https://3rdparty-apis.coinmarketcap.com/v1/cryptocurrency/widget?id=1027&convert=USD?"
Add Crypto.org Chain
Review current rabbitmq producer health check
Existing mq health check can be improved, so it checks more then connection state.
Possible approach:
func checkChannelHealth(channel *amqp.Channel) {
_, err := channel.ExchangeDeclarePassive(
"healthcheck", // name
"direct", // type
true, // durable
false, // auto-deleted
false, // internal
false, // no-wait
nil, // arguments
)
if err != nil {
fmt.Println("Channel is not healthy:", err)
} else {
fmt.Println("Channel is healthy")
}
}
[MQ] Add reconnection logic for producer
For mq producer implement next logic:
- publish attempt returns error.
- check if the error is connection-related.
- try to reconnect for 5 times with increasing of the timeout
Transactions Format V2
Types to support:
- Coin transfers
- Token transfers
- Swaps (from to asset)
- Staking (delegations / undelegations), claim rewards, vote ... redelegating
- Smart contract calls (deposit, claim) - function name + values, raw data
- Pre build actions. Approve asset 1.
- Collectibles Transfers
- Governance Vote #1 Yes/No.
- DEX (New, Cancel, Execute, Fill)
Small use cases:
- Lending (Borrow n AAVE, Lend 20 COMP, MINT 102 SPX)
- Provide liquidity pool ETH<>DAI
- Deposit funds to L2 network (could live in smart contract)
Discussion points
- How to support any action format?
- How to localize?
- How to add new events and stay compatible?
Additional support for:
- transactions types
- offset and limit - (pagination)
- timestamp
- versioning
/transactions?types=transfer|token_transfer&from_timestamp=123&version=3&page=1&limit=10
Old Coin Transfer:
{
"id":"0x05a9c7b75f57d7489dc143eb51600315439a324cdc2f749a27b99d7d395a7fe5",
"coin":10000714,
"from":"0x4982085C9e2F89F2eCb8131Eca71aFAD896e89CB",
"to":"0x377E196Acd9215A881fc101A64AAa6CA0b0a75D6",
"fee":"441000000000000",
"date":1611012545,
"block":4110960,
"status":"completed",
"sequence":12604,
"type":"transfer",
"direction":"outgoing",
"memo":"",
"metadata":{
"value":"2000000000000000",
"symbol":"BNB",
"decimals":18
}
}
New Coin Transfer Format:
{
"id":"0x05a9c7b75f57d7489dc143eb51600315439a324cdc2f749a27b99d7d395a7fe5",
"asset_id":"c714",
"from":"0x4982085C9e2F89F2eCb8131Eca71aFAD896e89CB",
"to":"0x377E196Acd9215A881fc101A64AAa6CA0b0a75D6",
"fee": {
"asset": "c714_cTWT",
"value": "441000000000000"
},
"date":1611012545,
"block":4110960,
"status":"completed",
"sequence":12604,
"direction":"outgoing",
"memo":"",
}
"transfers": [{
"from":"0x4982085C9e2F89F2eCb8131Eca71aFAD896e89CB",
"to":"0x377E196Acd9215A881fc101A64AAa6CA0b0a75D6",
"asset": "c714",
"value":"2000000000000000",
}]
"swaps": [{
"from": {
"address": "0x4982085C9e2F89F2eCb8131Eca71aFAD896e89CB"
"asset": "c714"
"value":"2000000000000000",
},
"to": {
"address": "0x377E196Acd9215A881fc101A64AAa6CA0b0a75D6"
"asset": "c714"
"value":"2000000000000000",
}
}],
"smart_contract_call": {
}
status
: pending
, completed
, error
Is should wait connect to RabbitMQ or not?
[hmac handlers] use go-libs/crypto
Re-use this code
Line 65 in 0d0deaa
Place all clients urls in config file
There are a lot of lines with hardcoded URLs like
func (c Client) FetchMarketPairs(limit int) (pairs []MarketPair, err error) {
params := url.Values{"limit": {strconv.Itoa(limit)}}
err = c.req.Get(&pairs, "/api/v1/markets", params)
return pairs, err
}
What if we move it out from these methods and place in config file, so it would be easier to track and change it in future
Add ability to customize Sentry options
https://github.com/trustwallet/golibs/blob/master/network/middleware/sentry.go#L12 - it would be great to have ability to pass specific options, like sample rate and so on
Check if path starts with / in client.go GetBase
Upgrade go version to 1.18
Add stream waiting
[Codegen] coins.go may have duplicated symbol item
Currently we has a preferredSymbol
to work around it
Add Viper / bindEnvVar
Switch to up to date rabbit mq library
The library we are using for rabbitmq is not maintained any longer streadway/amqp#500 (comment) We should consider switching to https://github.com/rabbitmq/amqp091-go It has some useful features, like PublishWithContext()
Refactor metrics initializer
Make labels var optional so it doesn't require passing nil
.
https://github.com/trustwallet/go-libs/blob/master/metrics/metrics.go#L32
Coins utility methods
Add AssetID() func to coin
Extend ordered set with Size() and ValueAt(idx int) functions
Generate coins based on wallet core config
https://github.com/trustwallet/golibs/blob/master/coin/coins.go
Ideally we should include all coins from here: https://github.com/trustwallet/wallet-core/blob/master/coins.json
Zcoin -> Firo
[Queue Consumer] Log message on error.
When a consumer has MaxRetries set and this was the final retry, also log the message on error.
Merge token transfer and native token transfer
Upgrade go version to 1.17
Token left
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.