Functions
1. Connect to Endless Wallet
Call the connect method in SKD to obtain the current address of the wallet.
import { UserResponseStatus } from '@endlesslab/endless-web3-sdk';
const connectRes = await jssdk.connect();
if (connectRes.status === UserResponseStatus.APPROVED) {
// connected, you can get the wallet address
// The wallet address is Base58 string
console.log('wallet address: ', connectRes.args.account);
}else{
// connect failed
}2. GetAccount method
The getAccount method needs to be called after the wallet initialization is completed.
Call the getAccount method to obtain the current user wallet address of the endless wallet.
import { EndLessSDKEvent } from '@endlesslab/endless-web3-sdk';
jssdk.on(EndLessSDKEvent.INIT, async () => {
const getAccountRes = await jssdk.getAccount();
if (getAccountRes.status === UserResponseStatus.APPROVED) {
// The wallet address is Base58 string
console.log('wallet address: ', connectRes.args.account);
}else{
// The user is not connected to the dapp or the current wallet has not been created.
}
});3. Disconnect method
Call the disconnect method in SKD to disconnect the dapp from the wallet.
4. Signature message method
Call the signMessage method in SKD to sign the message and return the signed result.
5. Sending a Transaction method
Call the signMessage method in SKD, Sign the message and send it to the Endless blockchain. After success, return the transaction hash.
The following code example demonstrates how to use the API to sign transactions and send them to the endless blockchain.
6. Signature transaction method
The following code example demonstrates how to use the API to sign transactions.
7. Open view method
The following code example demonstrates how to use the API to open the Endless Wallet window.
8. Add event listening method
This method is used to add an endless wallet event listening method.
9. Uninstall event listening method
This method is used to uninstall the Endless Wallet event listening method.
10. Transaction of sending EDS coins with script payload
Last updated