Methods
getAddress
Get the public key of the current account.
Request
None
Response
{
"publicKey": "GADMH553BE53E65EPPFMQA2TE3ZZ2QL5ZXHANDZKQLUVFV6FTKV6CPN6"
}
Example
const { publicKey } = await window.stellar.getAddress();
console.log(publicKey);
// "GADMH553BE53E65EPPFMQA2TE3ZZ2QL5ZXHANDZKQLUVFV6FTKV6CPN6"
signTransaction
Sign a Stellar transaction provided as an XDR-encoded string.
Request
{
xdr: string,
opts?: {
networkPassphrase?: string;
address?: string;
path?: string;
submit?: boolean;
submitUrl?: string;
}
}
Response
{
signedTxXdr: string;
signerAddress?: string;
}
Example
const result = await window.stellar.signTransaction({
xdr: "AAAAAgAAAAA...",
opts: {
networkPassphrase: "Test SDF Network ; September 2015"
}
});
console.log(result.signedTxXdr);
console.log(result.signerAddress);
// "GADMH553BE53E65EPPFMQA2TE3ZZ2QL5ZXHANDZKQLUVFV6FTKV6CPN6"
signMessage
Sign an arbitrary message string.
Note: This method is not triggered by test dApps.
Request
{
message: string,
opts?: {
networkPassphrase?: string;
address?: string;
path?: string;
}
}
Response
{
signedMessage: string;
signerAddress?: string;
}
Example
const result = await window.stellar.signMessage({
message: "Hello Stellar"
});
console.log(result.signedMessage);
getNetwork
Get the current network information.
Note: Not supported by Rabet and Lobstr plugins. Not triggered by test dApps.
Request
None
Response
{
network: string;
networkPassphrase: string;
}
Example
const { network, networkPassphrase } = await window.stellar.getNetwork();
console.log(network);
console.log(networkPassphrase);
// "Test SDF Network ; September 2015"
signAuthEntry
Sign a Soroban authorization entry.
Note: Not supported by Rabet and Lobstr plugins. Not triggered by test dApps.
Request
{
authEntry: string,
opts?: {
networkPassphrase?: string;
address?: string;
path?: string;
}
}
Response
{
signedAuthEntry: string;
signerAddress?: string;
}
Example
const result = await window.stellar.signAuthEntry({
authEntry: "AAAAAgAAAAA...",
opts: {
networkPassphrase: "Test SDF Network ; September 2015"
}
});
console.log(result.signedAuthEntry);