Xaman Developer Docs
Developer ConsoleAPI Endpoints
  • Build on Xaman
  • Concepts
    • Getting started
      • Terminology
      • Developer Education
    • 🔐Authorization & Credentials
    • Payloads (sign requests)
      • 🚨Secure Payment Verification
      • Workflow
      • Lifecycle
        • Sample POS lifecycle
      • Payload Delivery
        • Deep Linking
        • QR Scanning
        • Push
        • xApps
        • Mobile (iOS/Android)
        • Desktop browser
      • Status updates
        • Websocket
        • Webhooks
          • Signature verification
        • API Call (polling)
      • Networks
      • Payload Return URL
      • Tx Explorer(s)
    • Special Transaction Types
    • Limitations
      • Rate limits
      • Transaction types
      • Push permission
    • Implementation checklist
      • Protocol specific checks
  • Environments
    • 🌎Browser ("Web3")
      • CORS (Browser)
    • 📱xApps ("dApps")
      • Requirements
      • Develop & Test
      • CORS (xApp)
      • Xumm UI interaction
      • Your own backend (Auth)
      • Style guide
      • Development & Debugging
      • xAppBuilder 🏗️
        • Connecting localhost to xAppBuilder
        • xAppBuilder FAQ
    • 📂Backend (SDK / API)
      • User identification payloads
    • 🎛️Native Apps
    • 🙇Identity (OAuth2, OpenID)
      • Test Tools
  • JS/TS SDK
    • Xaman SDK (Intro)
    • Examples / User stories
      • Sign Requests (payloads)
        • Browser
        • xApp
        • Backend
      • Verify Payload signature
      • Simple Sign Request
    • 📦SDK (syntax)
      • Xumm.ping()
      • Xumm.on(event, fn)
      • Xumm.off(event, fn)
      • Xumm.helpers { … }
        • ping()
        • getRates( … )
        • getRails()
        • getHookHash( … )
        • getHookHashes()
        • getCuratedAssets()
        • getNftokenDetail( … )
        • getKycStatus( … )
        • verifyUserTokens([ … ])
        • getTransaction( … )
      • Xumm.user { … }
      • Xumm.environment { … }
      • Xumm.payload { … }
        • create( … )
        • createAndSubscribe( … )
        • cancel( … )
        • subscribe( … )
        • get( … )
      • Xumm.xapp { … }
        • ready()
        • openSignRequest({ … })
        • selectDestination({ … })
        • scanQr()
        • tx({ … })
        • close({ … })
        • share({ … })
        • navigate({ … })
        • openBrowser({ … })
        • on(xAppEvent, fn)
        • off(xAppEvent, fn)
      • Xumm.userstore { … }
        • list()
        • get( … )
        • delete( … )
        • set( … , { … } )
      • Xumm.backendstore { … }
        • get()
        • set({ … })
        • delete()
      • Xumm.push { … }
        • event( … )
        • notification( … )
      • Xumm.runtime { … }
      • Xumm.authorize()
      • Xumm.logout()
Powered by GitBook
On this page
  • Payload
  • QR
  • Destination
  • Network Switch

Was this helpful?

Edit on GitHub
Export as PDF
  1. JS/TS SDK
  2. SDK (syntax)
  3. Xumm.xapp { … }

on(xAppEvent, fn)

Certain events are sent to xApps. These events are usually an asynchronous callback containing data requested by calling one of the xApp UI actions.

To subscribe to one of the events emitted to xApps, use the on(...) method on the SDK's xapp object to register an event handler (callback function).

Payload

The payload event is emitted when a payload has been resolved (signed / declined)

// <script src="https://xumm.app/assets/cdn/xumm.min.js"></script>
var xumm = new Xumm('your-api-key')

xumm.xapp.on('payload', data => {
  console.log('Payload resolved', data)
})
{
  "reason": "SIGNED",
  "uuid": "the-payload-uuid"
}
{
  "reason": "DECLINED",
  "uuid": "the-payload-uuid"
}

QR

The qr event is emitted when the QR scanner dialog has been opened, and is now closed. If a QR was scanned the data is returned.

// <script src="https://xumm.app/assets/cdn/xumm.min.js"></script>
var xumm = new Xumm('your-api-key')

xumm.xapp.on('qr', data => {
  console.log('QR scanned (?)', data)
})
{
  "qrContents": "the://scanned-qr/contents?...",
  "reason": "SCANNED"
}
{
  "qrContents": null,
  "reason": "USER_CLOSE"
}
{
  "qrContents": null,
  "reason": "INVALID_QR"
}

Destination

The destination event is emitted when the destination picker dialog has been openend, and is now closed. If a destinationw as selected, the data is returned.

// <script src="https://xumm.app/assets/cdn/xumm.min.js"></script>
var xumm = new Xumm('your-api-key')

xumm.xapp.on('destination', data => {
  console.log('Destination account picked (?)', data)
})
{
  "method": "selectDestination",
  "destination": {
    "address": "r...",
    "tag": 123456,
    "name": "Wietse's Savings"
  },
  "info":{
   "blackHole":false,
   "disallowIncomingXRP":false,
   "exist":true,
   "possibleExchange":false,
   "requireDestinationTag":false,
   "risk":"UNKNOWN"
  },
  "reason": "SELECTED"
}
{
  "reason": "USER_CLOSE"
}

Network Switch

// <script src="https://xumm.app/assets/cdn/xumm.min.js"></script>
var xumm = new Xumm('your-api-key')

xumm.xapp.on("networkswitch", ({ network }) => {
  xumm.helpers.getRails().then(rails => {
      alert(JSON.stringify(rails?.[network]))
  })
})
PreviousopenBrowser({ … })Nextoff(xAppEvent, fn)

Last updated 1 year ago

Was this helpful?

The user switched the selected network in Xumm while present in the xApp, while your xApp settings (Xumm Developer Console) indicate the xApp shouldn't reload but receive an event. The event will contain a property network with a key referring to a network from the rails endpoint, through getRails()or

📦
https://xumm.app/api/v1/jwt/rails