Integrating The KyberSwap Liquidity Widget
Zap into a Liquidity Protocol With Minimal Code
Installing the Liquidity Widget
To get started, install the widgets library using npm or Yarn.
npm:
Yarn:
Adding the Liquidity widget to your app
Embed the React component in your application with this piece of code:
Liquidity Widget Props
Property | Description | Type | Default Value |
---|---|---|---|
theme | Customize theme for Liquidity Widget | Theme | |
provider | Web3Provider to interact with blockchain | Web3Provider | undefined | undefined |
chainId | Required. A unique identifier that represents a blockchain network. | number | -- |
poolAddress | Required. SmartContract address of pool | Address | -- |
poolType | Required. Type of Pool | enum |
|
positionId | Optional, in case “Increasing Liquidity into an existing position”, pass the position id. The position should belong to the poolAddress. Otherwise, it considers as “Adding Liquidity into a new position” | String | undefined | undefined |
source | Required. To identify the dapp that integrating with liquidity widget | string | -- |
feeAddress | Optional, Wallet Address if you want to charge zap fee | Address | -- |
feePcm | fee percentage in per cent mille (0.001% or 1 in 100,000). Ignored if feeAddress is empty. From 0 to 100,000 inclusively. Example: 1 for 0.001%. | number | -- |
includedSources | List of liquidty sources you want to includes from your zap, separate by comma | -- | |
excludedSources | List of liquidity sources that you want to exclude from your zap, separate by comma | -- | |
onDismiss | Callback function when click cancel or close widget | () => void | -- |
onTxSubmit | Callback function when tx was submited | (txHash: string) => void | -- |
Last updated