Connecting
Creating a Session
// Open the modal (shows a spinner, then the QR code and wallet list)
modal.open();
// Connect — resolves when the wallet approves
const session = await provider.connect({
namespaces: {
stellar: {
methods: [
"stellar_signXDR",
"stellar_signAndSubmitXDR",
"stellar_signMessage",
"stellar_signAuthEntry",
],
chains: ["stellar:pubnet"],
events: ["accountsChanged"],
},
},
});
if (!session) {
throw new Error("Connection failed");
}
modal.close();
console.log("Connected! Session topic:", session.topic);Handling Events
Disconnecting
Next steps
Last updated
Was this helpful?
