Responding To Sign Transactions Requests
Responding to a sign transactions request
Once our provider object has been initialized, we can simply listen to events and respond:
- Javascript
- TypeScript
const providerId = '02657eaf-be17-4efc-b0a4-19d654b2448e';
// initialized provider
provider.onSignTransactions(({ params }) => {
// ... using the `params.txns` parameter, the provider signs the transactions and returns the base64 encoded signed transactions
return {
providerId,
stxns: [
'gqNzaWfEQ...',
],
};
});
import type { IAVMWebProviderCallbackOptions } from '@agoralabs-sh/avm-web-provider';
const providerId = '02657eaf-be17-4efc-b0a4-19d654b2448e';
// initialized provider
provider.onSignTransactions(({ params }: IAVMWebProviderCallbackOptions) => {
// ... using the `params.txns` parameter, the provider signs the transactions and returns the base64 encoded signed transactions
return {
providerId,
stxns: [
'gqNzaWfEQ...',
],
};
});
caution
If this method is not supported, then a MethodNotSupportedError
should be thrown.
caution
If there is a group of atomic transactions, but the computed group ID doesn't match the assigned ID, then a InvalidGroupIdError
should be thrown.
caution
If any of the transactions are malformed, then a InvalidInputError
should be thrown.