optimized-order-obtain
v0.2.1
Published
```ts import { encodeOrder, Order } from 'optimized-order-obtain'
Downloads
6
Readme
Optimized Order Obtain
import { encodeOrder, Order } from 'optimized-order-obtain'
const response = await fetch(`https://endpoint.com/contract_address`, {
headers: { 'x-api-key': 'your api key' },
})
const json = (await response.json()) as { orders: Order[] }
const order = json.orders[0]
const { value, gasLimit } = order
const from = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
const { to, data } = encodeOrder(order.type, order.args, from)
const transaction = { from, to, value, data, gasLimit }