On this page
Signing
Detect the provider and request an address before signing. Use the network passphrase returned by the selected wallet network and complete XDR payloads built by the Stellar SDK.
Examples for signing with window.$onekey.stellar.
Sign Transaction (XDR)
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()
const { signedTxXdr, signerAddress } = await stellar.signTransaction(unsignedXdr, {
networkPassphrase,
address,
// submit: false,
// submitUrl: 'https://horizon.stellar.org/transactions',
})
console.log({ signedTxXdr, signerAddress })Sign Auth Entry (Soroban / Authorization Entry)
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()
const { signedAuthEntry, signerAddress } = await stellar.signAuthEntry(authEntryXdr, {
networkPassphrase,
address,
})
console.log({ signedAuthEntry, signerAddress })Sign Message
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()
const { signedMessage, signerAddress } = await stellar.signMessage('hello stellar', {
networkPassphrase,
address,
})
console.log({ signedMessage, signerAddress })Last updated on