Web3 Provider Integration (Solana)

Getting Encrypted User IDs From your Web App

Blocto injects a global API into websites at window.bloctoProvider and window.solana at the same time.
Please contact Blocto team to get your app ID.

Register Push Notification

1
if (window.solana && window.solana.isBlocto) {
2
try {
3
let encryptedUserId = await window.solana.request({
4
method: 'registerPushNotification',
5
params: {
6
appId: '{appId}'
7
}
8
})
9
// send encryptedUserId to your backend
10
} catch(e) {
11
// error handling
12
// e.mesage: see the below
13
}
14
}
Copied!
Error Handling
  • blocked: user clicked the block button.
  • cancelled: user clicked the cancel button.
  • noNetworkConnection: no network connection.
  • appIdNotExist: your app id doesn't exist.
  • internal: wallet app internal error. Please contact us.