pulsarEvmAdapter()
pulsarEvmAdapter<
T>(config,appChains):TxAdapter<T>
Defined in: adapters/evmAdapter.ts:53
Creates the EVM adapter for createPulsarStore from @tuwaio/pulsar-core. Pass it alone or in the adapter array.
The adapter implements TxAdapter from @tuwaio/pulsar-core:
getConnectorInforeturns the address of the active wagmi connection (or, without one, the last connected address saved inlocalStorageby@tuwaio/orbit-core, then the zero address) and the connector type, e.g.evm:metamask.checkChainForTxrunscheckAndSwitchChainfrom@tuwaio/orbit-evm: when the wallet is on another chain, it asks the wallet to switch and rejects if the user declines.checkTransactionsTrackerandcheckAndInitializeTrackerInStoreare checkTransactionsTracker and checkAndInitializeTrackerInStore.getExplorerUrl(path, chainId)appends a path to the default block explorer ofchainId(looked up inappChains), or of the chain the wallet is connected to whenchainIdis omitted. It returnsundefinedwhen that chain has no block explorer.getExplorerTxUrlis selectEvmTxExplorerLink withappChains.cancelTxActionandspeedUpTxActionare cancelTxAction and speedUpTxAction; both open a wallet prompt.retryTxActioncloses the modal and runsexecuteTxActionagain withtx.actionFunction({ config, ...tx.payload }); it logs an error and does nothing withoutexecuteTxAction.
Type Parameters
T
T extends Transaction
The application transaction type.
Parameters
config
Config
The wagmi config of the app.
appChains
readonly [Chain, Chain]
The viem chains of the app, used to build explorer links.
Returns
TxAdapter<T>
The EVM adapter.
Throws
Error when config is not provided.
Example
import { createPulsarStore } from '@tuwaio/pulsar-core';
import { pulsarEvmAdapter } from '@tuwaio/pulsar-evm';
import { mainnet, sepolia } from 'viem/chains';
const pulsarStore = createPulsarStore({
name: 'transactions-tracking-storage',
adapter: pulsarEvmAdapter(wagmiConfig, [mainnet, sepolia]),
});Last updated on