Coder Social home page Coder Social logo

bonedaddy / go-blocknative Goto Github PK

View Code? Open in Web Editor NEW
29.0 4.0 23.0 181 KB

blocknative websocket api client in golang

License: Apache License 2.0

Go 99.66% Makefile 0.34%
blocknative blocknative-api websockets ethereum ethereum-events blockchain golang smart-contracts defi

go-blocknative's Introduction

go-blocknative

go-blocknative provides an api client for blocknative's websocket api. It allows subscribing to events by address or by transaction id and handles correct initialization as required by the documentation. It also includes the ability to store commands sent to the api in a history buffer, such that in the event of a connection failure we can restablish the current session as blocknative does not handle this on their end.

Usage

This library provides functionality to subscribe to events from blocknatives API using either transaction hashes or addresses. In addition it provides a number of different message types as indicated below

Message Types

BaseMessage

The BaseMessage struct contains all required fields that need to be sent in messages to blocknative's API. To easily construct new base messages for the mainnet you can use NewBaseMessageMainnet("yourApiKey").

TxSubscribe

The TxSubscribe struct is used when subscribing/unsubscribing to events by transaction hash. If you want to send a message to subscribe to events use NewTxSubscribe supplying a base message along with the transaction hash to subscribe to. If you want to send a message to unsubscribe from events use NewTxUnsubscribe supplying a base message along with the transaction hash to unsubscribe from

AddressSubscribe

The AddressSubscribe struct is like TxSubscribe but allows subscribing/unsubscribing to events by ethereum account addresses. If you want to send a message to subscribe to events use NewAddressSubscribe supplying a base message along with the address to subscribe to. If you want to send a message to unsubscribe from events use NewAddressUnsubcribe.

EthTxPayload

When subscribe to events the EthTxPayload will be returned anytime an event is received for a transaction or address we are subscribed to. It is suitable for generalized processing of events, however you will likely want to use a use-case specific structure for better processing. Depending on the contract events being emitted they may have more information that what can be captured by this structure.

Examples

The examples folder has some full running examples. Note that you should be familiar with the mechanics of github.com/gorilla/websockets as this library essentially just provides helper functions around the websockets library

TODO

  • Enable message history buffer usage
  • Enable connection drop handling
  • Enable better error handling
  • Enable optional payload and subscription parameters
  • Enable configuration usage

go-blocknative's People

Contributors

bonedaddy avatar krasi-georgiev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

go-blocknative's Issues

Enable DEFI5 Event Parsing

map[connectionId:e0ababd374b2b7761d6a27ba5e9e79ca8ddf157e6ea3b1fa58c9f50836be044e event:map[blockchain:map[network:main system:ethereum] categoryCode:activeAddress contractCall:map[contractAddress:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D contractType:Uniswap V2: Router02 methodName:removeLiquidityETHWithPermit params:map[amountETHMin:859881966673787704 amountTokenMin:16919820275280125713 approveMax:false deadline:1611876389 liquidity:3757900000000000000 r:0x54e7d5c05b5f5bf1814e4ade59ae64c65091543f416baef9f4dd7fc0990fe2ad s:0x04b701d9283b86797716f0df23a27b8bebf9f727fa7e33ae1968d0e3dfdb5717 to:0x42d4C197036BD9984cA652303e07dD29fA6bdB37 token:0xfa6de2697D59E88Ed7Fc4dFE5A33daC43565ea41 v:27]] dappId:b257a861-2f67-4b6d-b4ee-310a959e4cf9 eventCode:txConfirmed timeStamp:2021-01-28T23:09:14.804Z transaction:map[asset: blockHash:0xa9e6409e38e5f611eff749ce37b0cf5a9fd2b5d01c27a4f0cde018e183abef40 blockNumber:1.1747225e+07 blockTimeStamp:2021-01-28T23:09:09.000Z blocksPending:5 counterparty: direction: from:0x42d4C197036BD9984cA652303e07dD29fA6bdB37 gas:294847 gasPrice:107000000000 gasUsed:169980 hash:0xbe748487080023db5a2ccb932bd548adba561cff0df506462d5b700284f72291 input:0xded9382a000000000000000000000000fa6de2697d59e88ed7fc4dfe5a33dac43565ea410000000000000000000000000000000000000000000000003426be23c970c000000000000000000000000000000000000000000000000000eacf46e533861f110000000000000000000000000000000000000000000000000beeea17c45afb3800000000000000000000000042d4c197036bd9984ca652303e07dd29fa6bdb3700000000000000000000000000000000000000000000000000000000601348250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b54e7d5c05b5f5bf1814e4ade59ae64c65091543f416baef9f4dd7fc0990fe2ad04b701d9283b86797716f0df23a27b8bebf9f727fa7e33ae1968d0e3dfdb5717 internalTransactions:[map[from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:263931 gasUsed:263931 input:0xd505accf00000000000000000000000042d4c197036bd9984ca652303e07dd29fa6bdb370000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000000000000000000000000000003426be23c970c0000000000000000000000000000000000000000000000000000000000060134825000000000000000000000000000000000000000000000000000000000000001b54e7d5c05b5f5bf1814e4ade59ae64c65091543f416baef9f4dd7fc0990fe2ad04b701d9283b86797716f0df23a27b8bebf9f727fa7e33ae1968d0e3dfdb5717 to:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 type:CALL value:0] map[contractCall:map[contractAddress:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 contractAlias:UNI-V2 contractDecimals:18 contractName:Uniswap V2 contractType:erc20 decimalValue:3.7579 methodName:transferFrom params:map[_from:0x42d4C197036BD9984cA652303e07dD29fA6bdB37 _to:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13 _value:3757900000000000000]] from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:228505 gasUsed:228505 input:0x23b872dd00000000000000000000000042d4c197036bd9984ca652303e07dd29fa6bdb370000000000000000000000008dcba0b75c1038c4babbdc0ff3bd9a8f6979dd130000000000000000000000000000000000000000000000003426be23c970c000 to:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 type:CALL value:0] map[from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:195170 gasUsed:195170 input:0x89afcb440000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d to:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 type:CALL value:0] map[contractCall:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 contractAlias:  contractDecimals:18 contractType:erc20 methodName:balanceOf params:map[_owner:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13]] from:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 gas:173815 gasUsed:173815 input:0x70a082310000000000000000000000008dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 to:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 type:DELEGATECALL value:0] map[contractCall:map[contractAddress:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 contractAlias:WETH contractDecimals:18 contractName:Wrapped Ether contractType:erc20 decimalValue:0.864202981581696185 methodName:transfer params:map[_to:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D _value:864202981581696185]] from:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 gas:158108 gasUsed:158108 input:0xa9059cbb0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000000000000000000000000000000bfe44087302acb9 to:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 type:CALL value:0] map[contractCall:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 contractAlias:DEFI5 contractDecimals:18 contractName:DEFI Top 5 Tokens Index contractType:erc20 decimalValue:17.004844497768970566 methodName:transfer params:map[_to:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D _value:17004844497768970566]] from:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 gas:126839 gasUsed:126839 input:0xa9059cbb0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000000000000000000000000000ebfd57f9a6467946 to:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 type:CALL value:0] map[contractCall:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 contractAlias:  contractDecimals:18 contractType:erc20 decimalValue:17.004844497768970566 methodName:transfer params:map[_to:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D _value:17004844497768970566]] from:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 gas:122162 gasUsed:122162 input:0xa9059cbb0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000000000000000000000000000ebfd57f9a6467946 to:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 type:DELEGATECALL value:0] map[contractCall:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 contractAlias:  contractDecimals:18 contractType:erc20 methodName:balanceOf params:map[_owner:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13]] from:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 gas:85373 gasUsed:85373 input:0x70a082310000000000000000000000008dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 to:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 type:DELEGATECALL value:0] map[contractCall:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 contractAlias:DEFI5 contractDecimals:18 contractName:DEFI Top 5 Tokens Index contractType:erc20 decimalValue:17.004844497768970566 methodName:transfer params:map[_to:0x42d4C197036BD9984cA652303e07dD29fA6bdB37 _value:17004844497768970566]] from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:63691 gasUsed:63691 input:0xa9059cbb00000000000000000000000042d4c197036bd9984ca652303e07dd29fa6bdb37000000000000000000000000000000000000000000000000ebfd57f9a6467946 to:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 type:CALL value:0] map[contractCall:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 contractAlias:  contractDecimals:18 contractType:erc20 decimalValue:17.004844497768970566 methodName:transfer params:map[_to:0x42d4C197036BD9984cA652303e07dD29fA6bdB37 _value:17004844497768970566]] from:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 gas:60001 gasUsed:60001 input:0xa9059cbb00000000000000000000000042d4c197036bd9984ca652303e07dd29fa6bdb37000000000000000000000000000000000000000000000000ebfd57f9a6467946 to:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 type:DELEGATECALL value:0] map[from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:48013 gasUsed:48013 input:0x2e1a7d4d0000000000000000000000000000000000000000000000000bfe44087302acb9 to:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 type:CALL value:0] map[contractCall:map[contractAddress:0x7a250d5630b4cf539739df2c5dacb4c659f2488d contractAlias: contractType:Uniswap V2: Router02 methodName:unknown_method params:map[]] from:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 gas:2300 gasUsed:2300 input:0x to:0x7a250d5630b4cf539739df2c5dacb4c659f2488d type:CALL value:864202981581696185] map[from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d input:0x to:0x42d4c197036bd9984ca652303e07dd29fa6bdb37 type:CALL value:864202981581696185]] monitorId:GETH_1_D_PROD monitorVersion:0.79.5 netBalanceChanges:[map[address:0x7a250d5630b4cf539739df2c5dacb4c659f2488d balanceChanges:[map[asset:map[contractAddress:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 symbol:UNI-V2 type:erc20] breakdown:[map[amount:-3757900000000000000 counterparty:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13]] delta:-3757900000000000000] map[asset:map[contractAddress:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 symbol:WETH type:erc20] breakdown:[map[amount:864202981581696185 counterparty:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13]] delta:864202981581696185] map[asset:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 symbol:  type:erc20] breakdown:[map[amount:17004844497768970566 counterparty:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41]] delta:17004844497768970566]]] map[address:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13 balanceChanges:[map[asset:map[contractAddress:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 symbol:UNI-V2 type:erc20] breakdown:[map[amount:3757900000000000000 counterparty:0x7a250d5630b4cf539739df2c5dacb4c659f2488d]] delta:3757900000000000000] map[asset:map[contractAddress:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 symbol:WETH type:erc20] breakdown:[map[amount:-864202981581696185 counterparty:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D]] delta:-864202981581696185] map[asset:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 symbol:DEFI5 type:erc20] breakdown:[map[amount:-17004844497768970566 counterparty:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D]] delta:-17004844497768970566]]] map[address:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 balanceChanges:[map[asset:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 symbol:  type:erc20] breakdown:[map[amount:-17004844497768970566 counterparty:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] map[amount:-17004844497768970566 counterparty:0x42d4C197036BD9984cA652303e07dD29fA6bdB37]] delta:-34009688995537941132]]] map[address:0x42d4C197036BD9984cA652303e07dD29fA6bdB37 balanceChanges:[map[asset:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 symbol:DEFI5 type:erc20] breakdown:[map[amount:17004844497768970566 counterparty:0x7a250d5630b4cf539739df2c5dacb4c659f2488d]] delta:17004844497768970566] map[asset:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 symbol:  type:erc20] breakdown:[map[amount:17004844497768970566 counterparty:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41]] delta:17004844497768970566] map[asset:map[symbol:ETH type:ether] breakdown:[map[amount:864202981581696185 counterparty:0x7a250d5630b4cf539739df2c5dacb4c659f2488d]] delta:864202981581696185]]] map[address:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 balanceChanges:[map[asset:map[symbol:ETH type:ether] breakdown:[map[amount:-864202981581696185 counterparty:0x7a250d5630b4cf539739df2c5dacb4c659f2488d]] delta:-864202981581696185]]]] nonce:3074 pendingBlockNumber:1.174722e+07 pendingTimeStamp:2021-01-28T23:08:02.953Z status:confirmed timePending:71920 to:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D transactionIndex:104 value:0 watchedAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41]] serverVersion:0.87.4 status:ok timeStamp:2021-01-28T23:09:14.804Z userAgent:Go-http-client/1.1 version:0]
2021/01/28 15:09:19 receive message:
map[connectionId:e0ababd374b2b7761d6a27ba5e9e79ca8ddf157e6ea3b1fa58c9f50836be044e event:map[blockchain:map[network:main system:ethereum] categoryCode:activeAddress contractCall:map[contractAddress:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D contractType:Uniswap V2: Router02 methodName:swapExactETHForTokens params:map[amountOutMin:115284323602407287313 deadline:1611875861 path:[0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0xfa6de2697D59E88Ed7Fc4dFE5A33daC43565ea41] to:0x24aD99C8F2A372816AA10DC1726e87196781fb84]] dappId:b257a861-2f67-4b6d-b4ee-310a959e4cf9 eventCode:txConfirmed timeStamp:2021-01-28T23:09:14.804Z transaction:map[asset: blockHash:0xa9e6409e38e5f611eff749ce37b0cf5a9fd2b5d01c27a4f0cde018e183abef40 blockNumber:1.1747225e+07 blockTimeStamp:2021-01-28T23:09:09.000Z blocksPending:5 counterparty: direction: from:0x24aD99C8F2A372816AA10DC1726e87196781fb84 gas:212163 gasPrice:107000000000 gasUsed:103990 hash:0x8a8dc408cd40a9963639981670d8bbb774a180232b55fc640a3c7527c48cdcff input:0x7ff36ab50000000000000000000000000000000000000000000000063fe431838caaea11000000000000000000000000000000000000000000000000000000000000008000000000000000000000000024ad99c8f2a372816aa10dc1726e87196781fb8400000000000000000000000000000000000000000000000000000000601346150000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000fa6de2697d59e88ed7fc4dfe5a33dac43565ea41 internalTransactions:[map[from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:172493 gasUsed:172493 input:0xd0e30db0 to:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 type:CALL value:5950000000000000000] map[contractCall:map[contractAddress:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 contractAlias:WETH contractDecimals:18 contractName:Wrapped Ether contractType:erc20 decimalValue:5.95 methodName:transfer params:map[_to:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13 _value:5950000000000000000]] from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:147791 gasUsed:147791 input:0xa9059cbb0000000000000000000000008dcba0b75c1038c4babbdc0ff3bd9a8f6979dd130000000000000000000000000000000000000000000000005292a579bd930000 to:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 type:CALL value:0] map[from:0x7a250d5630b4cf539739df2c5dacb4c659f2488d gas:133801 gasUsed:133801 input:0x022c0d9f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006500cf1cd31855e5300000000000000000000000024ad99c8f2a372816aa10dc1726e87196781fb8400000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000 to:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 type:CALL value:0] map[contractCall:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 contractAlias:DEFI5 contractDecimals:18 contractName:DEFI Top 5 Tokens Index contractType:erc20 decimalValue:116.448715528613486163 methodName:transfer params:map[_to:0x24aD99C8F2A372816AA10DC1726e87196781fb84 _value:116448715528613486163]] from:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 gas:121467 gasUsed:121467 input:0xa9059cbb00000000000000000000000024ad99c8f2a372816aa10dc1726e87196781fb84000000000000000000000000000000000000000000000006500cf1cd31855e53 to:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 type:CALL value:0] map[contractCall:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 contractAlias:  contractDecimals:18 contractType:erc20 decimalValue:116.448715528613486163 methodName:transfer params:map[_to:0x24aD99C8F2A372816AA10DC1726e87196781fb84 _value:116448715528613486163]] from:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 gas:116874 gasUsed:116874 input:0xa9059cbb00000000000000000000000024ad99c8f2a372816aa10dc1726e87196781fb84000000000000000000000000000000000000000000000006500cf1cd31855e53 to:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 type:DELEGATECALL value:0] map[contractCall:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 contractAlias:  contractDecimals:18 contractType:erc20 methodName:balanceOf params:map[_owner:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13]] from:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 gas:94602 gasUsed:94602 input:0x70a082310000000000000000000000008dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13 to:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 type:DELEGATECALL value:0]] monitorId:GETH_1_D_PROD monitorVersion:0.79.5 netBalanceChanges:[map[address:0x7a250d5630b4cf539739df2c5dacb4c659f2488d balanceChanges:[map[asset:map[symbol:ETH type:ether] breakdown:[map[amount:-5950000000000000000 counterparty:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2]] delta:-5950000000000000000] map[asset:map[contractAddress:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 symbol:WETH type:erc20] breakdown:[map[amount:-5950000000000000000 counterparty:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13]] delta:-5950000000000000000]]] map[address:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 balanceChanges:[map[asset:map[symbol:ETH type:ether] breakdown:[map[amount:5950000000000000000 counterparty:0x7a250d5630b4cf539739df2c5dacb4c659f2488d]] delta:5950000000000000000]]] map[address:0x8dCBa0B75c1038c4BaBBdc0Ff3bD9a8f6979Dd13 balanceChanges:[map[asset:map[contractAddress:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 symbol:WETH type:erc20] breakdown:[map[amount:5950000000000000000 counterparty:0x7a250d5630b4cf539739df2c5dacb4c659f2488d]] delta:5950000000000000000] map[asset:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 symbol:DEFI5 type:erc20] breakdown:[map[amount:-116448715528613486163 counterparty:0x24aD99C8F2A372816AA10DC1726e87196781fb84]] delta:-116448715528613486163]]] map[address:0x24aD99C8F2A372816AA10DC1726e87196781fb84 balanceChanges:[map[asset:map[contractAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 symbol:DEFI5 type:erc20] breakdown:[map[amount:116448715528613486163 counterparty:0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13]] delta:116448715528613486163] map[asset:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 symbol:  type:erc20] breakdown:[map[amount:116448715528613486163 counterparty:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41]] delta:116448715528613486163]]] map[address:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41 balanceChanges:[map[asset:map[contractAddress:0x71ed5fa0fde7b6dd8bc0dc25f7235d477e0faf77 symbol:  type:erc20] breakdown:[map[amount:-116448715528613486163 counterparty:0x24aD99C8F2A372816AA10DC1726e87196781fb84]] delta:-116448715528613486163]]]] nonce:15 pendingBlockNumber:1.174722e+07 pendingTimeStamp:2021-01-28T23:08:21.669Z status:confirmed timePending:53197 to:0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D transactionIndex:257 value:5950000000000000000 watchedAddress:0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41]] serverVersion:0.87.4 status:ok timeStamp:2021-01-28T23:09:14.804Z userAgent:Go-http-client/1.1 version:0]

TODO

Features

Documentation

  • Update example to showcase using configurations

The server response timestamp in the payload doesn't conform to the parsing format

Here is an example code to replicate

https://github.com/cryptoriums/mempmon/tree/b27fc9cae0edd858b0fb1d840c3b513ed4fafe42

err:parsing time ""2021-04-13T12:15:29.327Z"" as ""2006-01-02T15:04:05 Z07:00"": cannot parse "Z"" as " 

This happens because the json parsing doesn't recognise the format from the json payload.
to resolve the API server needs to return the format properly or need to implement custom json unmarshaling

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.