Cypher On-Boarding SDK
Cypher On-Boarding SDK was created to solve the Cold Start Problem in dApp User Onboarding where users have to rely on 3rd party sources for on-ramp, bridging and go through a steep learning curve.
Immediately after the user connects the wallet, Cypher On-Boarding SDK with just a line of code intelligently understands the context of the user on multiple-chains and suggests different options in which they can bridge or on-ramp the necessary token before using the dApp.
<script src="https://public.cypherd.io/sdk/cypher-sdk.js"></script>
// For Testnet
window.Cypher({
address: '0xdEc1bc71bf91431D60eF2742f412DCd1c5A204B8',
targetChainIdHex: '0x5', // Eth - Goerli
requiredTokenBalance: 65,
isTestnet: true,
theme:'light',
callBack: () => { console.log('callBack called'); }
});
// For Mainnet
window.Cypher({
appId: '<<app id for your account>>'
address: '0xdEc1bc71bf91431D60eF2742f412DCd1c5A204B8',
targetChainIdHex: '0x1', // Ethereum
requiredTokenBalance: 0.1,
callBack: () => { console.log('callBack called'); }
});
Args | Value | Description |
---|---|---|
appId | STRING : UUID | Optional (but required for production development) to unlock partner benefits.
Reachout to us on support(at)cypherwallet(dot)io get the key |
*address | STRING | User wallet address |
*targetChainIdHex | STRING | Chain ID in hex |
*requiredTokenBalance | Number | Token value |
requiredTokenContractAddress | STRING: Optional | Native Currency by default or ERC-20 contract address |
isTestnet | Boolean: Optional | Default: False, When enabled only testnets will be included. |
callBack (boolean) | Function: Optional | Callback function will be triggered at the end of the onboarding workflow with boolean value |
theme | Enum : 'light' | 'dark' | UI theme. Dark mode by default |
connector | walletconnect's connector instance | applicable only for walletconnect |
provider | walletconnect's provider instance | applicable only for walletconnect |
showInfoScreen | Boolean | Defaults to false.
To show users an intro page to set context on this operation. |
Add the above snippet of <script> tag to import the necessary SDK into your dApp's <head> tag. Then as soon as the user Connects wallet and the dApp has access to the user's wallet address listen to the necessary event and trigger the window.Cypher() with the user's wallet address and the necessary token required to use the dApp. The On-Boarding SDK then automatically pops-up only if the user does not have the required token to use the dApp.
If the user does not have the necessary token to use the dApp, it will pop-up a modal like the image shown below to show the list of tokens that the user has on other chains and gives different options to convert that token to the necessary token in the target chain that the dApp Supports. The SDK also automatically detects the window.etherum object for injected web3 and generates a transaction and routes it to the connected wallet.
The routing is currently being powered by Cypher's proprietary bridge technology that sources liquidity through DEXs on different chains. Will add more options in the future. Cypher's bridge technology has been powering the Cypher Wallet Users for the last 1 year to seamlessly bridge across multiple EVM and Cosmos chains (coming soon). Support for other bridges, DEX, Exchanges and On-Ramp Providers coming soon. https://cypherwallet.io
- 0x1 - Ethereum
- 0x89 - Polygon
- 0x38 - Binance Smart Chain
- 0xa86a - Avalanche C-Chain
- 0xfa - Fantom
- 0x2329 - EVMOS
- 0xa4b1 - Arbitrum
- 0xa - Optimism
- 0x5 - Ethereum Goerli (Testnet)
- 0x13881 - Polygon Mumbai (Testnet)
Last modified 28d ago