Sentre
Search…
Global variables
The global variables are all available in the window instances on browsers.
1
interface Window {
2
// Sentre
3
sentre: {
4
wallet?: import('@senswap/sen-js').WalletInterface
5
lamports: import('@senswap/sen-js').Lamports
6
splt: import('@senswap/sen-js').SPLT
7
swap: import('@senswap/sen-js').Swap
8
}
9
// Utility
10
notify: ({ type, description, onClick }: SentreNotification) => void
11
}
Copied!

Global sentre

1
window.sentre = {
2
wallet?: import('@senswap/sen-js').WalletInterface
3
lamports: import('@senswap/sen-js').Lamports
4
splt: import('@senswap/sen-js').SPLT
5
swap: import('@senswap/sen-js').Swap
6
}
Copied!
These following instances are from sen-js. See sen-js APIs for details.
Property
Type
Description
wallet
WalletInterface | undefined
Wallet instance.
lamports
Lamports
Lamports instance.
splt
SPLT
SPLT instance.
swap
Swap
Swap instance.

Global notification

To create top-right notifications.
1
window.notify = ({ type, description, onClick }: SentreNotification) => void
2
3
type SentreNotification = {
4
type: 'error' | 'warning' | 'success' | 'info'
5
description: string
6
onClick?: () => void
7
}
Copied!

API

Property
Type
Description
type
error | warning | success | info
The notification type.
description
string
The notification message.
onClick
function | undefined
The action that is activated when users click to the notification pop-up.

Examples

1
// To pop an error on Coin98 connection failure
2
window.notify({
3
type: 'error',
4
description: 'Coin98 Wallet is not connected.',
5
})
6
7
// To pop an warning on Phantom installation and direct to Phantom homepage
8
window.notify({
9
type: 'warning',
10
description: 'Phantom Wallet is not installed.',
11
onClick: () => window.open('https://phantom.app/', '_blank'),
12
})
Copied!
Last modified 6mo ago