1.2.2 • Published 2 years ago

@getsafle/1inch-controller v1.2.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

1inch-dex-controller

This SDK houses the functions to interact with the 1Inch Contracts.

Installation

To install this SDK,

npm install --save @getsafle/1inch-controller

Initialization

Initialize the constructor,

const OneInch = require('@getsafle/1inch-controller');

const controller = new OneInch(chain);

Get supported tokens

This function will give us the list of all tokens supported by 1inch.

await controller.getSupportedTokens()

Get supported chains

This function will give us the list of all the supported chains.

await controller.getSupportedChains()

Get Exchange Rate

This will give us the exchange rate of 2 tokens. Amount of fromContractAddress the user will receive for fromQuantity of toContractAddress.

await controller.getExchangeRate({ toContractAddress, fromContractAddress, fromQuantity })

Get Estimated gas

This will give us the estimated amount of gas needed to do the swap.

await controller.getEstimatedGas({ toContractAddress, fromContractAddress, fromQuantity })

Get Raw Transaction

This will give us the raw transaction to swap the tokens on 1inch.

await controller.getRawTransaction({ walletAddress, toContractAddress, fromContractAddress, toQuantity, fromQuantity, slippageTolerance })

Get Approval Transaction

This function will call the approval smart contract function to approve spending fromQuantity for the fromContractAddress from the walletAddress.

await controller.approvalRawTransaction({ walletAddress,  fromContractAddress, fromQuantity })
1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago