Skip to Content

pulsarSolanaAdapter()

pulsarSolanaAdapter<T>(config): TxAdapter<T>

Defined in: adapters/solanaAdapter.ts:68 

Creates the Solana adapter for createPulsarStore from @tuwaio/pulsar-core. Pass it alone or in the adapter array.

The adapter reads the connected wallet from the last connection saved by @tuwaio/orbit-core (Satellite Connect writes it, in localStorage, or in sessionStorage for a wallet the user did not ask to remember) and finds the matching Wallet Standard wallet with getConnectedSolanaConnector from @tuwaio/orbit-solana. It implements TxAdapter from @tuwaio/pulsar-core:

  • getConnectorInfo returns the saved address and the connector type, e.g. solana:phantom. It throws when no installed wallet holds the saved address.
  • checkChainForTx compares the cluster of desiredChainID with the saved chain of the connection (devnet, solana:devnet and the genesis-hash chain ID solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 are the same cluster), and throws SolanaChainMismatchError with both cluster monikers when they differ. It does not switch the wallet.
  • checkTransactionsTracker keeps the returned signature as txKey and uses TransactionTracker.Solana unless another tracker is requested.
  • checkAndInitializeTrackerInStore is checkAndInitializeTrackerInStore.
  • getExplorerUrl and getExplorerTxUrl build Solana Explorer links with getSolanaExplorerLink from @tuwaio/orbit-solana.
  • retryTxAction closes the modal and runs executeTxAction again with tx.actionFunction({ client, ...tx.payload }), where client is a cached RPC client for the URL of the cluster of desiredChainID in rpcUrls, or its public endpoint. It throws when no wallet is connected or executeTxAction is missing.

There is no cancelTxAction or speedUpTxAction for Solana.

Type Parameters

T

T extends Transaction

The application transaction type.

Parameters

config

SolanaAdapterConfig

The RPC URLs by cluster.

Returns

TxAdapter<T>

The Solana adapter.

Example

import { createPulsarStore } from '@tuwaio/pulsar-core'; import { pulsarSolanaAdapter } from '@tuwaio/pulsar-solana'; const pulsarStore = createPulsarStore({ name: 'transactions-tracking-storage', adapter: pulsarSolanaAdapter({ rpcUrls: { devnet: 'https://api.devnet.solana.com' } }), });
Last updated on