本页目录
签名
签名前先检测 provider 并请求地址。使用所选钱包网络返回的 network passphrase,以及由 Stellar SDK 构造的完整 XDR 数据。
window.$onekey.stellar 的签名示例。
签名交易(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 })签名 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 })签名消息
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()
const { signedMessage, signerAddress } = await stellar.signMessage('hello stellar', {
networkPassphrase,
address,
})
console.log({ signedMessage, signerAddress })最后更新于