Skip to content

Porto.create

Creates a new Porto instance.

Imports

Named
import { Porto } from 'porto'

Examples

The simplest way to create a new Porto instance is to call the Porto.create() function. This will automatically inject Porto's provider into your Application via EIP-6963.

import { Porto } from 'porto'
 
Porto.create()

Accessing the Provider

You can access Porto's EIP-1193 Provider directly via the provider instance.

import { Porto } from 'porto'
 
const porto = Porto.create()
 
const accounts = await porto.provider.request({
  method: 'wallet_connect',
})

Parameters

announceProvider

  • Type: boolean
  • Default: true

Whether to announce the provider via EIP-6963.

chains

  • Type: readonly [Chains.Chain, ...Chains.Chain[]]
  • Default: [Chains.baseSepolia]

List of supported chains.

feeToken

  • Type: 'ETH' | 'EXP' | 'USDC'
  • Default: EXP (note: will change to USDC on Porto launch)

Token to use to pay for fees.

mode

  • Type: Mode.Mode
  • Default: Mode.dialog()

Mode to use.

Available:

  • Mode.contract(): Requests & signing is handled locally, and coordinated with the delegation contract.
  • Mode.dialog(): Requests & signing is handled via an iframe or popup dialog.
  • Mode.rpcServer(): Requests & signing is handled locally, and coordinated with the Porto RPC.

storage

  • Type: Storage.Storage
  • Default: Storage.idb()

Storage to use.

Available:

transports

  • Type: { [chainId: string]: Transport }
  • Default: {}

Transport to use for each chain.

Return Type

Porto

The Porto instance.