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',
})

Implementations

TODO

Storage

TODO

Custom Chains

TODO

Parameters

announceProvider

  • Type: boolean
  • Default: true

Whether to announce the provider via EIP-6963.

chains

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

List of supported chains.

implementation

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

Implementation to use.

Available:

storage

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

Storage to use.

Available:

transports

  • Type: { [chainId: string]: Transport | { default: Transport; relay?: Transport | undefined } }
  • Default: {}

Transport to use for each chain.

Return Type

Porto

The Porto instance.