Sentre Legacy
  • 🥳Welcome
  • Getting Started
  • DApp Manifest
  • Folder Structure
  • Available Scripts
  • Development
    • View
    • Model & Controllers
    • Providers
      • UI Provider
      • Wallet Provider
      • Account Provider
      • Mint Provider
    • Static
    • Global variables
    • Configs
  • Advanced Usage
    • ☀️Theme
    • 👘Customizing Styles
    • 🪝Hooks
  • 🤩Submitting DApps
  • References
  • Best Practices
  • Troubleshoots
  • 🎨Design Pricinples
    • Button
    • Card
    • Checkbox
    • Color
    • Corner radius
    • Drawer
    • Dropdown
    • Grid
    • Icons
    • Input
    • List
    • Menu
    • Modal
    • Radio
    • Select
    • Shadow
    • Spacing
    • Switch
    • Tabs
    • Tooltip
    • Table
    • Typography
  • 📄Litepaper
    • Introduction
    • Industry Problems
    • Sentre: An All-in-one Solution
      • The Open Protocol
      • Liquidity Efficiency
    • SEN as the Heart of the Ecosystem
      • Asymmetric Deposit
      • Adaptive Fee Model
      • The Triad Pool
      • Simulated Mesh Trading
      • Token Use Cases
    • Conclusion
Powered by GitBook
On this page
  • Global sentre
  • Global notification
  1. Development

Global variables

The global variables are all available in the window instances on browsers.

interface Window {
  // Sentre
  sentre: {
    wallet?: import('@senswap/sen-js').WalletInterface
    lamports: import('@senswap/sen-js').Lamports
    splt: import('@senswap/sen-js').SPLT
    swap: import('@senswap/sen-js').Swap
  }
  // Utility
  notify: ({ type, description, onClick }: SentreNotification) => void
  message: ({ type, description, onClick }: SentreMessage) => void
}

Global sentre

window.sentre = {
  wallet?: import('@senswap/sen-js').WalletInterface
  lamports: import('@senswap/sen-js').Lamports
  splt: import('@senswap/sen-js').SPLT
  swap: import('@senswap/sen-js').Swap
}
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.

window.notify = ({ type, description, onClick }: SentreNotification) => void

type SentreNotification = {
  type: 'error' | 'warning' | 'success' | 'info'
  description: string
  onClick?: () => void
}

window.message = ({ type, description, onClick }: SentreMessage) => void

type SentreMessage = {
  type: 'error' | 'warning' | 'success' | 'info' | 'loading'
  description: string
  onClick?: () => void
}

API

Property
Type
Description

type

error | warning | success | info | loading

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

// To pop an error message on Coin98 connection failure
window.message({
  type: 'error',
  description: 'Coin98 Wallet is not connected.',
})

// To pop an warning notification on Phantom installation and direct to Phantom homepage
window.notify({
  type: 'warning',
  description: 'Phantom Wallet is not installed.',
  onClick: () => window.open('https://phantom.app/', '_blank'),
})
PreviousStaticNextConfigs

Last updated 2 years ago

The following instances are from sen-js. See for details.

sen-js APIs