Leveraging Particle’s AA SDK within iOS applications.
ParticleAA
within your Podfile, as shown below:
Before initializing the SDK, there are a few points to keep in mind, specifically regarding the utilization of Paymasters (to sponsor gas fees, pay for gas in ERC-20 tokens, etc.)
- All Testnets automatically have the Verifying Particle Network Omnichain Verifying Paymaster enabled. Transactions requesting it will automatically be sponsored and thus gasless.
- On the occasion that you’d like to use the Particle Network Omnichain Verifying Paymaster for Mainnets, you’ll need to deposit USDT on either Ethereum or BNB Chain within the Particle dashboard. This USDT will then automatically be converted as needed into the native token of the network you’re requesting (and qualifying for) sponsorship on.
- The Particle Network AA SDK automatically uses Biconomy’s Token Paymaster; transactions that request it will be able to leverage it without additional configuration.
setAAService
within ParticleNetwork
will fail or raise issues down the line.
You can initialize the SDK through AAService.initialize
, which requires the following parameters:
name
, the name of the smart account implementation to be used, the choices here are:
.biconomyV1
, a Biconomy smart account..biconomyV2
, a Biconomy smart account..cyberConnect
, a CyberConnect smart account..simpleV1
, a SimpleAccount implementation..simpleV2
, a SimpleAccount implementation..light
, a Light Account.AAService.initialize
has been called, you’ll need to use ParticleNetwork.setAAService
, passing in an instance of AAService
. This will tell Particle Auth to use your smart account rather than your EOA. Either before or after doing this, you’ll also need to call aaService.enableAAMode
.
enableAAMode
), then you’ll need to call aaService.disableAAMode
, with aaService
being an instance of AAService
.
However, if you aren’t sure whether AA mode is enabled or not, you can call aaService.isAAModeEnable
, which returns a Boolean representing this status.
E.g.:
getSmartAccount
method on aaService
(which can be defined by ParticleNetwork.getAAService
if needed), in which you can pass by
(your Signer/owner address, which should be an EOA), and chainInfo
, which should be a ChainInfo
object representing the chain on which you’re querying account information. E.g.:
Field | Type | Description |
---|---|---|
publicAddress | String | EOA address. |
chainInfo | ChainInfo? | (Optional) default is current chainInfo. |
auth.evm.sendTransaction
method, defined in ParticleAuthCore
, is used to send a single transaction to the network.
The adapter.signAndSendTransaction
method, defined in ConnectAdapter
, is used to send a single transaction to the network.
The aaService.quickSendTransactions
method, defined in ParticleAA
, is used to send batched transactions within a single UserOperation.
auth.evm.sendTransaction
takes the following parameters:
transaction
, a stringified standard transaction object.feeMode
, the mechanism to be used for paying gas fees, can be:
.gasless
, for sponsored transactions; this will happen automatically for Testnets, and will pull from your previously defined (or configured) Paymaster for Mainnets..native
, paying for gas fees in a native token (such as ETH)..token
, paying for gas fees in an ERC-20 token (such as USDC), and thus takes one parameter:
feeQuote
, to be used when leveraging a Token Paymaster.chainInfo
: a ChainInfo
object representing the chain on which this transaction will be executed.adapter.signAndSendTransaction
takes the following parameters:
publicAddress
, the connected public address, if adapter.WalletType
is .authCore
, you can pass an empty string, for other walletTypes, you need pass a connected public address.transaction
, a stringified standard transaction object.feeMode
, the mechanism to be used for paying gas fees, can be:
.gasless
, for sponsored transactions; this will happen automatically for Testnets, and will pull from your previously defined (or configured) Paymaster for Mainnets..native
, paying for gas fees in a native token (such as ETH)..token
, paying for gas fees in an ERC-20 token (such as USDC), and thus takes one parameter:
feeQuote
, to be used when leveraging a Token Paymaster.chainInfo
: a ChainInfo
object representing the chain on which this transaction will be executed.aaService.quickSendTransactions
, the parameters will be the same with the following exceptions:
transactions
being an array of transactions.feeMode
is same with upon.messageSigner
, which is the Signer/owner authenticating the transaction.wholeFeeQuote
, which for each feeMode
should be passed with a complete fee quote object.chainInfo
is same with upon.aaService.deployWalletContract
, which will create, request signature for, and send a deployment transaction. This method requires messageSigner
(the Signer of the transaction), and the feeMode
of the deployment transaction.
The status of deployment can be retrieved with smartAccount.isDeploy
, which takes an owner/Signer eoaAddress
.
E.g.: