1.11.4 • Published 1 month ago

@swapr/sdk v1.11.4

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
1 month ago

Swapr SDK

Getting Started

First clone the repository:

git clone https://github.com/levelkdev/swapr-sdk.git

Move into the dxswap-sdk working directory

cd swapr-sdk

Install dependencies

yarn install

Generate GraphQL

yarn codegen

Build

yarn build

Connect package an app to sdk locally

yarn link

And on the app repo

yarn link "../swapr-sdk/" #e.g. path to sdk

Running tests

To run the tests, follow these steps. You must have at least node v16 installed.

Run tests

yarn test

Eco Router Trades

Swapr uses multiple trades to find best protocol and route for traders. Currently supported DEXs are

ProtocolEthereumArbitrum OneGnosis ChainPolygonBNB ChainOptimismZkSync Era
0x
1Inch
Baoswap
BiSwap
CoW Protocol
Curve
DFYN
Honeyswap
Levinswap
Pancakeswap
Quickswap
SushiSwap
Swapr
Uniswap v2
Velodrome

The Trade class is extendable. New DEXs can be added to the SDK by extending the Trade and adding required methods.

How To Add Routable Platforms

For UniV2 Forks

First, open the file UniswapV2RoutablePlatform.ts. Here, you'll find several examples of already integrated DEXs.

Next, you need to search for the following information about the platform you want to integrate:

  • Supported chains by the DEX.
  • Factory Address: You can find it in the protocol docs.
  • Router Address: You can find it in the protocol docs.
  • Init Code Hash: Looking at the Factory Address in a blockchain explorer, you can go to the Contract tab > Read Contract > INIT_CODE_HASH.
  • Default Swap Fee: You may find it in the protocol official docs or in the Factory Address code.
  • Subgraph Endpoint (optional).

Once you have this information, you can create an instance of UniswapV2RoutablePlatform for the DEX you're trying to integrate and then consume it from the file entities/pair.ts so you can add it to the PAIR_ADDRESS_CACHE.

1.11.4

1 month ago

1.11.3

1 month ago

1.11.2

1 month ago

1.11.1

2 months ago

1.11.0

3 months ago

1.10.5

3 months ago

1.10.4

3 months ago

1.10.3

4 months ago

1.10.2

4 months ago

1.10.1

4 months ago

1.9.4

6 months ago

1.9.3

7 months ago

1.9.2

7 months ago

1.9.1

10 months ago

1.9.0

11 months ago

1.8.2

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.8.0-rc.1

1 year ago

1.8.0-rc.2

1 year ago

1.8.0-rc.3

1 year ago

1.8.0-rc.4

1 year ago

1.8.0-rc.0

1 year ago

1.7.0-beta.0

2 years ago

1.6.1

2 years ago

1.6.0-rc.4

2 years ago

1.4.4

2 years ago

1.6.0

2 years ago

1.6.0-rc.3

2 years ago

1.6.0-rc.2

2 years ago

1.6.0-rc.1

2 years ago

1.6.0-rc.0

2 years ago

1.4.3-beta.0

2 years ago

1.4.2-beta.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.2.0-beta.0

2 years ago

1.3.0-beta.1

2 years ago

1.3.0-beta.2

2 years ago

1.3.0-beta.3

2 years ago

1.3.0-beta.0

2 years ago

1.4.0-beta.2

2 years ago

1.4.1-beta.0

2 years ago

1.4.0-beta.1

2 years ago

1.4.0-beta.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-beta.3

2 years ago

1.0.0-beta.4

2 years ago

1.0.0-beta.5

2 years ago

1.0.0-beta.6

2 years ago

1.0.0-beta.7

2 years ago

1.0.0-beta.8

2 years ago

1.0.0-beta.9

2 years ago

1.0.0-beta.2

2 years ago

1.0.0-beta.0

2 years ago

1.0.0-beta.1

2 years ago

0.11.1

2 years ago

0.10.9

2 years ago

0.11.0

2 years ago

0.10.10

2 years ago

0.10.11

2 years ago

0.10.8

3 years ago

0.10.7

3 years ago

0.10.6

3 years ago

0.10.6-rc.8

3 years ago

0.10.6-rc.7

3 years ago

0.10.6-rc.5

3 years ago

0.10.6-rc.6

3 years ago

0.10.6-rc.4

3 years ago

0.10.6-rc.3

3 years ago

0.10.6-rc.1

3 years ago

0.10.6-rc.2

3 years ago

0.10.5

3 years ago

0.10.4

3 years ago