❗You are reviewing an outdated version of the Pontem Wallet documentation! We recommend switching to the most recent version from the newofficial website! ⚠️
API Reference
Extension Version
To get the installed extension version, use the following code.
For the initial connection to the wallet, use the connect method. It requests access to the site from the user and returns the current account address. If you already have access to the site, it will also return the current account address.
window.pontem.connect().then(address =>console.log(`Access for address ${address} allowed by user`)).catch(e =>console.log('Access denied by user', e))
Check Connection Status
To check if any wallet is connected to the page, use the isConnected method.
To disconnect the current account from the site, use the disconnect method.
Important: all methods that require permission from the user will stop working, but the entry in the "Connected Sites" list of the account will not disappear. Only the user can remove access completely through the UI.
If you call the disconnect() method and then connect(), the user will not be asked for permission again. This will only happen if the user manually removes access through the UI
To keep track of when a user changed their account, use the onChangeAccount method. When the account is changed, it calls the method you passed in the first argument. If the user at some point revokes the extension's access to the site, then this method will also be called.
window.pontem.onChangeAccount((address) => {if(address) {console.log('New selected account: ', address); } else {console.log('The user has selected an account that is not allowed to access'); }})
To keep track of when a user changed network, use the onChangeNetwork method. When the network is changed, it calls the method you passed in the first argument.
To get the address of the current account, use the account method.
window.pontem.account().then(address => {if(address) {console.log('Account address: ', address); } else {console.log('The user has selected an account that is not allowed to access'); } })
To get the public key of the current account , use the publicKey method.
To request a signature and send a transaction to the blockchain, use the signAndSubmit method.
payload - mandatory parameter containing the transaction body.
otherOptions - optional parameter that overrides transaction parameters.
Included in >=1.7.0.
You can also pass a UInt8Array as transaction arguments, or an array with a UInt8Array. This forms a vector, or a vector of vectors.
To request a signature of message, use the signMessage method.
window.pontem.signMessage({ address:true,// set true if you want include current address to message application:true,// // set true if you want include current application to message chainId:true,// set true if you want include current chain id to message message:'a message i trust',// message like string or Uint8Array nonce:'random nonce'// random nonce like string}).then(result => {console.log('Signed Message', result) }).catch(e =>console.log('Error', e))