1.1.17 • Published 5 months ago

kane3-liquidity-widgets v1.1.17

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Kyber Liquidity Widgets

The @kyberswap/liquidity-widgets package is an npm package of React components used to provide subsets of the Zap Protocol functionality in a small and configurable user interface element. Demo: https://kyberswap.com/earn

Installation

Install the widgets library via npm or yarn.

yarn add @kyberswap/liquidity-widgets
npm i --save @kyberswap/liquidity-widgets

Usage

Example usage: https://github.com/KyberNetwork/kyberswap-widgets/blob/main/apps/liquidity-widgets-demo/src/App.tsx#L243

Params

PropertyDescriptionTypeDefault Value
poolAddressaddress of pool to zapstringRequired
positionIdOptional, 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”numberundefined
poolTypesupported protocolPoolTypeRequired
chainIdnetwork of selected poolnumberRequired
connectedAccountcurrent network that user connected. if not connect, address should be undefined{ address?: string, chainId: number }Required
onCloseaction when user close the widget() => voidRequired
onConnectWalletaction to trigger connect wallet() => voidRequired
onSwitchChainaction to trigger switch chain if network of the pool is different with network from connected account() => voidRequired
onSubmitTxtrigger submit transaction (approval or zap). Should return the tx hash(txData: {from: string, to: string, value: string, data: string, gasLimit: string}) => PromiseRequired
initDepositTokensinit tokens in to zap, list of address separate by ","string
initAmountsinit amounts of tokens in, list of amount separate by ","string
sourceTo identify the dapp that integrating with liquidity widgetstring

Migrate from version 0.0.16 to 1.x.x

Deprecated

PropertyDescriptionTypeDefault Value
providerWeb3Provider to interact with blockchainWeb3Providerundefined
onTxSubmitCallback function when tx was submitted(txHash: string) => void

New

PropertyDescriptionTypeDefault Value
connectedAccountInfo of current account that user connect to your website{ address?: string, chainId: number }
onTxSubmitFunction that trigger tx(txData: {from: string, to: string, value: string, data: string, gasLimit: string}) => Promise