The SSP Wallet injects a window.ssp
object into the website, enabling communication between web pages and the SSP Wallet Chrome extension.
This function takes two parameters:
method
: A string specifying the method to be called.parameters
: An object containing additional parameters specific to the method.
-
Method:
'pay'
-
Description: Requests SSP to perform payment actions (sending assets).
-
Parameters:
message
(string): A message to include in the transaction (e.g.,'Hello SSP'
).amount
(string): The amount to send in whole units (e.g.,'4.124'
).address
(string): The recipient's address (e.g.,'t1eabPBaLCqNgttQMnAoohPaQM6u2vFwTNJ'
).chain
(string): The chain ID identifier of SSP (e.g.,'flux'
).
-
Response:
status
(string): Indicates success or error.result?
(string): Explanation of error (if any).data?
(string): Explanation of success (if any).txid?
(string): Transaction ID in case of a successful payment.
window.ssp.request('pay', {
message: 'Hello SSP',
amount: '4.124',
address: 't1eabPBaLCqNgttQMnAoohPaQM6u2vFwTNJ',
chain: 'flux'
}).then(response => {
console.log(response);
});
-
Method:
'sspwid_sign_message'
-
Description: Requests SSP to sign a message using SSP Wallet Identity.
-
Parameters:
message
(string): The message to be signed by SSP Wallet Identity (e.g.,'Hello SSP, please sign this message'
).
-
Response:
status
(string): Indicates success or error.result?
(string): Explanation of error (if any).data?
(string): Explanation of success (if any).signature?
(string): Signature of the signed message.address?
(string): Address that signed the message.message?
(string): The message that was signed.
window.ssp.request('sspwid_sign_message', {
message: 'Hello SSP, please sign this message'
}).then(response => {
console.log(response);
});