1-Click Transactions
1-click transactions
Tonomy ID allows users to sign and execute blockchain transactions directly from your app without needing to open Tonomy ID.
These transactions have lower security guarantees than wallet-signed transactions and are good for low-value actions such as creation proposals, updating settings or game actions.
1. Modify your Smart Contract
If you have deployed the smart contract to the same account as your Registered App, then you can get the permission name with get_self()
.
token::transfer(const name &from,
const name &to,
const asset &quantity,
const string &memo)
{
require_auth({from, get_self()});
// Rest of your code below...
}
2. Sign the Transaction in Your App
const trx = await user.signTransaction('eosio.token', 'transfer', {
from: "me",
to: "you",
quantity: '1 SYS',
memo: 'test memo',
});
This will directly sign the transaction and send it to the blockchain in the user's browser, without them needing to open Tonomy ID. You may want to show a confirmation before, or after (such as with a Toast UI component).
This will prompt the user to sign the transaction in their Tonomy ID mobile app.
Last updated