Comment on page
Create Account
The Permissive Account is the essential part of the Permissive service let’s see how to create one and deploy.
import {Account} from '@permissivelabs/client';
const account = new Account({
operator: operatorSigner,
owner: ownerSigner,
chainId: 1,
});
await account.getAccount();
The chain Id is straightforward, but operator and owner might be a bit more confusing.
operatorSigner
and ownerSigner
change depending on your usage of the account. If you have the signer of the owner of the account (e.g Metamask) you set it to the owner
and you set the operator
as a VoidSigner
with the address. And the opposite if you have the signer of the operator.A VoidSigner has the same interface as a signer but can’t sign functions. So you can create one with an address.
import {VoidSigner, JsonRpcProvider} from 'ethers';
// public provider, can also be the metamask provider
const provider = new JsonRpcProvider('<https://eth.llamarpc.com>');
const operatorSigner = new VoidSigner(
operatorAddress,
provider
)
Wherever if the account is already deployed or not you can already get it’s address with:
await account.getAddress()
Once your account instance is created and account gathered with
account.getAccount()
you can deploy it or check if it is already deployed.The account deployment process will go through 4 steps:
await account.deploy();
await account.isDeployed()
Last modified 6mo ago