0.2.5 • Published 4 months ago

lootex v0.2.5

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Lootex SDK

Prerequisites

  • Node.js >= 18
  • A https://*.lootex.dev domain if you are developing client-side applications

Installation

npm install lootex

Usage Guide

1. Create a Lootex Client

First, initialize the Lootex client:

import { createLootexClient } from 'lootex';

const lootex = createLootexClient({
  environment: 'development',
  apiKey: 'your-api-key', // currently not required
});

2. Fetch Orders

You can fetch orders using the API client:

const { orders } = await lootex.apiClient.getOrders({
  chainId: 137,
  limit: 10,
  page: 1,
});

3. Create an Aggregator

To fulfill orders, create an aggregator instance:

import { createAggregator } from 'lootex/aggregator';

const aggregator = createAggregator({
  client: lootex,
});

4. Fulfill Orders

The fulfillment process typically involves multiple steps:

  1. Generate the execution plan:
const execution = await aggregator.fulfillOrders([orders[0]]);
  1. Handle token approval (if needed):
const approveTxData = await execution.actions[0].buildTransaction();
const approveTx = await yourWallet.sendTransaction(approveTxData);
// Wait for approval transaction to be confirmed
  1. Execute the exchange:
const exchangeTxData = await execution.actions[1].buildTransaction();
const exchangeTx = await yourWallet.sendTransaction(exchangeTxData);
// Wait for exchange transaction to be confirmed

Once all transactions are confirmed, the order fulfillment is complete!

0.2.5

4 months ago

0.2.4

4 months ago

0.2.3

4 months ago

0.2.2

4 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.1.62

5 months ago

0.1.61

5 months ago

0.1.60

5 months ago

0.1.59

5 months ago

0.1.58

5 months ago

0.1.57

5 months ago

0.1.56

5 months ago

0.1.55

5 months ago

0.1.54

5 months ago

0.1.53

5 months ago

0.1.52

6 months ago

0.1.51

6 months ago

0.1.50

6 months ago

0.1.49

6 months ago

0.1.48

6 months ago

0.1.47

6 months ago

0.1.46

6 months ago

0.1.45

6 months ago

0.1.44

6 months ago

0.1.43

6 months ago

0.1.42

6 months ago

0.1.41

6 months ago

0.1.40

7 months ago

0.1.39

7 months ago

0.1.38

7 months ago

0.1.37

7 months ago

0.1.36

7 months ago

0.1.35

7 months ago

0.1.34

7 months ago

0.1.33

7 months ago

0.1.32

7 months ago

0.1.31

7 months ago

0.1.30

7 months ago

0.1.29

7 months ago

0.1.28

7 months ago

0.1.27

7 months ago

0.1.26

7 months ago

0.1.25

7 months ago

0.1.24

7 months ago

0.1.23

7 months ago

0.1.22

7 months ago

0.1.21

7 months ago

0.1.20

7 months ago

0.1.19

8 months ago

0.1.18

8 months ago

0.1.17

8 months ago

0.1.16

8 months ago

0.1.15

8 months ago

0.1.14

8 months ago

0.1.13

8 months ago

0.1.12

8 months ago

0.1.11

8 months ago

0.1.10

8 months ago

0.1.9

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago