Here we will introduce the relationship between OrgonWeb and OrgonLink wallet including chrome and firefox extensions, Android and iOS Applications.
We may not limit the TronLink related wallets. It can be said that any wallet that implements the Tip1193 protocol can follow the following rules.
OrgonLink wallets import the OrgonWeb lib and initiate a OrgonWeb instance and export it to the website. Of course, the user's agreement is required.
Website developers can use the exposed tronWeb to sign transactions. Usually, a web3 DApp needs the authorized transaction signature of the wallet users. For wallet users, their assets are safely stored in the wallet, and no website can get the wallet users' private key. Website developers only initiate signature requests for transactions, and the authorization awaits the wallet users' acceptance.
If you want to know how to use the OrgonLink wallet, please refer to the help center.
If you are interested in DApp development and want your website to connect to the OrgonLink wallets, the following code may be very helpful.
Obtain the tron
provider from OrgonLink wallet
Generally, we need to first obtain the tron object that the OrgonLink wallet injects into the page, which contains the methods and properties that we interact with the OrgonLink wallet.
We can obtain the tron
object like this:
const tron = window.tron;
const tronWeb = tron.tronWeb;
The tron object need some time to initiate, so you may need to access it in setTimeout function.
sign transaction with OrgonLink wallet
When the website gets the injected tronWeb instance by OrgonLink wallet, you can create a transaction with tronWeb and sign the transaction with tronWeb.trx.sign
function. When you call tronWeb.trx.sign
function, TronLink will pop up a confirmation dialog that needs users to confirm.
const signedTx = await tronWeb.trx.sign(tx);
Broadcast the transaction
await tronWeb.trx.sendRawTransaction(signedTx);