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',
})
Modes
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.
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.relay()
: Requests & signing is handled locally, and coordinated with the Porto Relay.
storage
- Type:
Storage.Storage
- Default:
Storage.idb()
Storage to use.
Available:
Storage.idb()
: Uses IndexedDBStorage.memory()
: Uses In-memory storeStorage.localStorage()
: Useswindow.localStorage
Storage.cookie()
: Usesdocument.cookie
transports
- Type:
{ [chainId: string]: Transport | { default: Transport; relay?: Transport | undefined } }
- Default:
{}
Transport to use for each chain.
Return Type
Porto
The Porto instance.