Links
Comment on page

Signing a transaction

Easily use our EIP-1193 provider or custom built functions to make sending and signing transactions easier!
This product is currently in Beta and is under active development.

Signing

The Portal instance includes a number of helper functions to allow you to execute Provider requests without having to worry about encoding, request format, or what method to pass in your request. These helper functions allows you to easily sign and submit transactions, sign messages, and even sign typed data.
// eth_sign
const signature = await portal.ethSign('YOUR-MESSAGE')
// eth_signTransaction
const signature = await portal.ethSignTransaction(transaction)
// eth_sendTransaction
const transactionHash = await portal.ethSendTransaction(transaction)
// personal_sign
const signature = await portal.personalSign('YOUR-MESSAGE')

Raw Requests with the Provider

For more custom requests, you can use the portal.provider property directly to build a request. This includes requests directly to your Node as well as signing operations.
const result = await portal.provider.request({
method: 'YOUR-DESIRED-RPC-METHOD',
params: YOUR_DESIRED_REQUEST_PARAMS
})

Using the Portal Provider with Third Party Libraries

The Portal Web3 Provider can also be used with third-party libraries just like any other Web3 Provider. This will enable you to interact with these libraries like normal, while utilizing Portal's MPC technology under the hood.
// Example with `ethers`
const ethersProvider = new ethers.providers.Web3Provider(portal.provider);
And now you are signing transactions with Portal! 🙌 🚀 Next, we'll explore how to simulate a transaction so that you can create smoother experiences for your users.