mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-10 04:57:31 +03:00
Added parseExchangeTradeTransaction
This commit is contained in:
31
README.md
31
README.md
@@ -37,6 +37,8 @@ Orion’s SDK is free to use and does not require an API key or registration. Re
|
||||
- [Price Feed Websocket Stream](#price-feed-websocket-stream)
|
||||
- [About our fetching system](#about-our-fetching-system)
|
||||
- [Using contracts](#using-contracts)
|
||||
- [Utils](#utils)
|
||||
- [Parsing trade transactions](#parsing-trade-transactions)
|
||||
|
||||
## Install
|
||||
|
||||
@@ -548,3 +550,32 @@ const { candles, timeStart, timeEnd } = await simpleFetch(
|
||||
## Using contracts
|
||||
|
||||
Use package [@orionprotocol/contracts](https://github.com/orionprotocol/contracts)
|
||||
|
||||
## Utils
|
||||
|
||||
### Parsing trade transactions
|
||||
|
||||
```ts
|
||||
import { utils } from "@orionprotocol/sdk";
|
||||
|
||||
// Examples:
|
||||
// fillThroughOrionPool: https://bscscan.com/tx/0xe311fb927b938e1e484b7660b5c4bd0aa9c97c86f6e1f681d6867dabc8a702fe
|
||||
// swapThroughOrionPool: https://bscscan.com/tx/0xb9c93851f605b8b5a906dbc9363eae0aa6635ce41ffb6bf540d954f9138bf58c
|
||||
// fillOrders: https://bscscan.com/tx/0x860b8820ece1a5af11b2459b6bd1a025e7cdc86a1d7e1e3d73558db6e72974d4
|
||||
|
||||
const data = utils.parseExchangeTradeTransaction({
|
||||
data: "0x4c36fc72000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000004a817c80000000000000000000000000000000000000000000000000000000000019595c700000000000000000000000000000000000000000000000000000000000002a000000000000000000000000050abeb3e61167365d0a7dd7b3301a8ae27016d760000000000000000000000002d23c313feac4810d9d014f840741363fccba675000000000000000000000000e4ca1f75eca6214393fce1c1b316c237664eaa8e00000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000e4ca1f75eca6214393fce1c1b316c237664eaa8e00000000000000000000000000000000000000000000000000000004a817c8000000000000000000000000000000000000000000000000000000000006df56a00000000000000000000000000000000000000000000000000000000003f7efc600000000000000000000000000000000000000000000000000000182dff605d000000000000000000000000000000000000000000000000000000182e2465cb60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000411b7b9908456b6d0b97e411b3585de8ed2c7c1db9a39d2f5f81fc8ed765f0575d29cd9ebd0533e3eeb819d70971bf7bd705c52871c7a00ba67c738040a69895911c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000e52ccf7b6ce4817449f2e6fa7efd7b567803e4b4000000000000000000000000e4ca1f75eca6214393fce1c1b316c237664eaa8e00000000000000000000000055d398326f99059ff775485246999027b3197955",
|
||||
});
|
||||
|
||||
switch (data.type) {
|
||||
case "fillOrders":
|
||||
console.log(data.args.orders.buyOrder);
|
||||
break;
|
||||
case "fillThroughOrionPool":
|
||||
console.log(data.args.order);
|
||||
break;
|
||||
case "swapThroughOrionPool":
|
||||
console.log(data.args.amount_spend);
|
||||
break;
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user