JavaScript SDK
This page explains how to use App2App JavaScript SDK to use Klip with your BApp.
Last updated
This page explains how to use App2App JavaScript SDK to use Klip with your BApp.
Last updated
(When using npm) node 10 or higher
Klip JavaScript SDK doesn't require a separate registration process and works in any environments where HTTP communication is possible. But since user's consent is received using the mobile app Klip, you need to have Klip installed to make the requests.
Install using the npm install klip-sdk-global
or yarn add klip-sdk-global
command. It should be imported as an ES module as shown below:
Download Klip JavaScript SDK in the tab. Place the file in the repository and insert a script tag in the HTML file as shown below:
Access each method using the klipSDKGlobal variable declared in the global namespace.
App2App API requests are made in the order: prepare
, request
, and getResult
.
prepare
is the step in which requests (from of a total of five) are defined
request
is the step in which the function is called and the signing takes place on Klip
getResult
is the step in which the result is returned from the function call
Prepares a App2App API request and obtains a request key.
Obtains user information.
Parameters
bappName
string
The name of the BApp displayed to users
successLink
string
(optional) The return link after obtaining user consent
failLink
string
(optional) The return link in case of a problem while obtaining user consent
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
A request to send a user's KLAY to a certain address.
Parameters
bappName
string
The name of the BApp displayed to users
to
string
The address of the recipient
amount
string
The amount of KLAY to send (Unit: KLAY, up to the 6th decimal place)
from
string
(optional) To check if the Klip account address matches with the from
address
successLink
string
(optional) The return link after obtaining user consent
failLink
string
(optional) The return link in case of a problem while obtaining user consent
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
A request to send a user's tokens to a certain address.
Parameters
bappName
string
The name of the BApp displayed to users
to
string
The address of the recipient
amount
string
The amount of tokens to send (Unit: The default unit of the token, up to the 6th decimal place)
contract
string
The address of the token contract
from
string
(optional) To check if the Klip account address matches with the from
address
successLink
string
(optional) The return link after obtaining user consent
failLink
string
(optional) The return link in case of a problem while obtaining user consent
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
A request to send a user's NFT to a certain address.
Parameters
bappName
string
The name of the BApp displayed to users
to
string
The address of the recipient
id
string
ID of the NFT
contract
string
The address of the NFT contract
from
string
(optional) To check if the Klip account address matches with the from
address
successLink
string
(optional) The return link after obtaining user consent
failLink
string
(optional) The return link in case of a problem while obtaining user consent
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
A request for the user to execute the functino of a certain contract.
Parameters
bappName
string
The name of the BApp displayed to users
to
string
The address of the contract
value
string
Amount of KLAY to be sent during contract execution (unit: peb)
abi
string
ABI of the function to execute
params
string
List of parameters of the function to execute
from
string
(optional) To check if the Klip account address matches with the from
address
successLink
string
(optional) The return link after obtaining user consent
failLink
string
(optional) The return link in case of a problem while obtaining user consent
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Parameters
requestKey
String
Request number
onUnsupportedEnvironment
Function
(optional) The callback function to execute in a non-mobile environment
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Returns the response of an App2App API request.
Parameters
requestKey
String
Request number
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Returns a list of a user's Cards (NFTs). You have to know the contract address of the NFTs that you want to return. It must be a contract supported on Klip.
Parameters
contract
String
The contract address of the Cards to retrieve
eoa
String
Address of the user to retrieve
cursor
String
(optional) The pointer after which the next request will retrieve the next 100 items if the number of Cards exceeds 100
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
-
-
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
In addition, getCardList
is a function for the convenience of BApp developers that returns a list of NFTs of Klip users.
If you need help with this document or Klip in general, please visit our .
Request authentification or signature using deep link. If the device doesn't have Klip installed, it redirects automatically to the download page on Google Play. You need to pass the request key obtained during the prepare step as a parameter. To implement the request step using QR code, please refer to .
Same as