0.2.5 • Published 3 months ago

lootex v0.2.5

Weekly downloads
-
License
-
Repository
-
Last release
3 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

3 months ago

0.2.4

3 months ago

0.2.3

3 months ago

0.2.2

3 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.1.62

4 months ago

0.1.61

4 months ago

0.1.60

4 months ago

0.1.59

4 months ago

0.1.58

4 months ago

0.1.57

4 months ago

0.1.56

4 months ago

0.1.55

4 months ago

0.1.54

5 months ago

0.1.53

5 months ago

0.1.52

5 months ago

0.1.51

5 months ago

0.1.50

5 months ago

0.1.49

5 months ago

0.1.48

5 months ago

0.1.47

5 months ago

0.1.46

5 months ago

0.1.45

5 months ago

0.1.44

5 months ago

0.1.43

5 months ago

0.1.42

5 months ago

0.1.41

6 months ago

0.1.40

6 months ago

0.1.39

6 months ago

0.1.38

6 months ago

0.1.37

6 months ago

0.1.36

6 months ago

0.1.35

6 months ago

0.1.34

6 months ago

0.1.33

6 months ago

0.1.32

6 months ago

0.1.31

6 months ago

0.1.30

6 months ago

0.1.29

6 months ago

0.1.28

6 months ago

0.1.27

6 months ago

0.1.26

6 months ago

0.1.25

6 months ago

0.1.24

6 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

7 months ago

0.1.18

7 months ago

0.1.17

7 months ago

0.1.16

7 months ago

0.1.15

7 months ago

0.1.14

7 months ago

0.1.13

7 months ago

0.1.12

7 months ago

0.1.11

7 months ago

0.1.10

7 months ago

0.1.9

7 months ago

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago