0.2.5 • Published 6 months ago

lootex v0.2.5

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

6 months ago

0.2.4

6 months ago

0.2.3

6 months ago

0.2.2

6 months ago

0.2.1

6 months ago

0.2.0

7 months ago

0.1.62

7 months ago

0.1.61

7 months ago

0.1.60

7 months ago

0.1.59

7 months ago

0.1.58

7 months ago

0.1.57

7 months ago

0.1.56

7 months ago

0.1.55

7 months ago

0.1.54

7 months ago

0.1.53

7 months ago

0.1.52

8 months ago

0.1.51

8 months ago

0.1.50

8 months ago

0.1.49

8 months ago

0.1.48

8 months ago

0.1.47

8 months ago

0.1.46

8 months ago

0.1.45

8 months ago

0.1.44

8 months ago

0.1.43

8 months ago

0.1.42

8 months ago

0.1.41

8 months ago

0.1.40

9 months ago

0.1.39

9 months ago

0.1.38

9 months ago

0.1.37

9 months ago

0.1.36

9 months ago

0.1.35

9 months ago

0.1.34

9 months ago

0.1.33

9 months ago

0.1.32

9 months ago

0.1.31

9 months ago

0.1.30

9 months ago

0.1.29

9 months ago

0.1.28

9 months ago

0.1.27

9 months ago

0.1.26

9 months ago

0.1.25

9 months ago

0.1.24

9 months ago

0.1.23

9 months ago

0.1.22

9 months ago

0.1.21

10 months ago

0.1.20

10 months ago

0.1.19

10 months ago

0.1.18

10 months ago

0.1.17

10 months ago

0.1.16

10 months ago

0.1.15

10 months ago

0.1.14

10 months ago

0.1.13

10 months ago

0.1.12

10 months ago

0.1.11

10 months ago

0.1.10

10 months ago

0.1.9

10 months ago

0.1.8

10 months ago

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago