API Reference

Extension Version

To get the installed extension version, use the following code.
const extensionVersion = window.pontem.version;
console.log(`Pontem Wallet v${extensionVersion}`); // 1.5.0

Connect

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.
window.pontem.isConnected()
.then(result => {
console.log('isConnected', result) // true or false
})
.catch(e => console.log('Error', e))

Disconnecting

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
window.pontem.disconnect()
.catch(e => console.log('Error', e))

Change Active Account Event

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');
}
})

Change Active Network Event

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.
window.pontem.onChangeNetwork((network) => {
console.log(network);
// { api: 'https://fullnode.devnet.aptoslabs.com/v1/', chainId: '31', name: 'Aptos devnet' }
})

Get Current Network

To get the current connected network, use the network method.
window.pontem.network()
.then(network => {
console.log(network);
// { api: 'https://fullnode.devnet.aptoslabs.com/v1/', chainId: '31', name: 'Aptos devnet' }
})

Get Current ChainId

To get the current chainId, use the chainId method.
window.pontem.chainId()
.then(chainId => {
console.log(chainId); // 31
})

Get Current Account

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');
}
})

Get Public Key of the Current Account

To get the public key of the current account , use the publicKey method.
window.pontem.publicKey()
.then(key => {
console.log('Public key: ', key);
})

Sign and Submit Transaction

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.
const payload = {
function: "0x1::coin::transfer",
type_arguments: ["0x1::aptos_coin::AptosCoin"],
arguments: ["0xeb442855143ce3e26babc6152ad98e9da7db7f0820f08be3d006535b663a6292", "1000"]
};
const otherOptions = {
max_gas_amount: '1000',
gas_unit_price: '1',
expiration_timestamp_secs: '1646793600',
sequence_number: '10'
}
window.pontem.signAndSubmit(payload, otherOptions)
.then(tx => {
console.log('Transaction', tx)
})
.catch(e => console.log('Error', e))

Sign Transaction

To request a signature of transaction, use the signTransaction method.
payload - mandatory parameter containing the transaction body. otherOptions - optional parameter that overrides transaction parameters.
const payload = {
function: "0x1::coin::transfer",
type_arguments: ["0x1::aptos_coin::AptosCoin"],
arguments: ["0xeb442855143ce3e26babc6152ad98e9da7db7f0820f08be3d006535b663a6292", "1000"]
};
const otherOptions = {
max_gas_amount: '1000',
gas_unit_price: '1',
expiration_timestamp_secs: '1646793600',
sequence_number: '10'
}
window.pontem.signTransaction(payload, otherOptions)
.then(tx => {
console.log('Transaction', tx)
})
.catch(e => console.log('Error', e))

Sign Message

To request a signature of message, use the signMessage method.
window.pontem.signMessage('My super secret message for sign')
.then(result => {
console.log('Signed Message', result)
})
.catch(e => console.log('Error', e))
Copy link
On this page
Extension Version
Connect
Check Connection Status
Disconnecting
Change Active Account Event
Change Active Network Event
Get Current Network
Get Current ChainId
Get Current Account
Get Public Key of the Current Account
Sign and Submit Transaction
Sign Transaction
Sign Message