Initialize Push Chain Client
Overview
Initializing the SDK client gives you:
- Chain-agnostic
PushChainClient
for submitting on-chain calls - Automatic RPC & block-explorer resolution (with optional overrides)
- Built-in UEA (Universal Executor Account) and origin-account getters
- End-to-end gas abstraction, signature orchestration & debug traces
Just pass your universal signer and network, and you’re ready to write and transact on Push Chain from any wallet.
Initialize Push Chain Client
PushChain.initialize(signer, {options}): Promise<PushChainClient>
// Import @pushchain/core and ethers
// Ensure you have created Universal Signer.
// If not done, then check out Create Universal Signer.
// Initialize Push Chain Client
const pushChainClient = await PushChain.initialize(universalSigner, {
network: PushChain.CONSTANTS.PUSH_NETWORK.TESTNET,
});
TheseArguments
are mandatory
Arguments | Type | Default | Description |
---|---|---|---|
signer | UniversalSigner | - | Chain-agnostic signer responsible for signing transactions and messages. |
options.network | PushChain.CONSTANTS.PUSH_NETWORK | - | Push Chain network to conenct to. For example: PushChain.CONSTANTS.PUSH_NETWORK.TESTNET PushChain.CONSTANTS.PUSH_NETWORKPushChain.CONSTANTS.PUSH_NETWORK.TESTNET PushChain.CONSTANTS.PUSH_NETWORK.TESTNET_DONUT PushChain.CONSTANTS.PUSH_NETWORK.LOCALNET |
options.rpcUrls | Partial<Record<CHAIN, string>> | {} | Custom RPC URLs mapped by chain IDs. If not provided, the default RPC URLs for the network will be used. Example: rpcUrls: {[CHAIN.ETHEREUM_SEPOLIA]: 'https://sepolia.infura.io/v3/your-api-key', [CHAIN.SOLANA_DEVNET]: 'https://api.devnet.solana.com'} |
Advanced Arguments
Arguments | Type | Default | Description |
---|---|---|---|
options.blockExplorers | Partial<Record<CHAIN, string[]>> | {[CHAIN.PUSH_TESTNET_DONUT]: ['https://donut.push.network']} | Custom block explorer URLs mapped by chain IDs. If not provided, the default block explorer URLs for the network will be used. |
options.printTraces | boolean | false | When true, console logs the internal trace logs for debugging requests to nodes |
Returns `PushChainClient` <object>
// PushChainClient object
{
orchestrator: Orchestrator {
universalSigner: {
account: [Object],
signMessage: [Function: signMessage],
signAndSendTransaction: [Function: signAndSendTransaction],
signTypedData: [Function: signTypedData]
},
pushNetwork: 'TESTNET_DONUT',
rpcUrls: {},
printTraces: false,
progressHook: undefined,
pushClient: PushClient {
publicClient: [Object],
pushChainInfo: [Object],
ephemeralKey: '...'
}
},
universalSigner: {
account: {
address: '0xC8AE31cF444CAB447921277c4DcF65128d5B25a8',
chain: 'eip155:11155111'
},
signMessage: [Function: signMessage],
signAndSendTransaction: [Function: signAndSendTransaction],
signTypedData: [Function: signTypedData]
},
blockExplorers: { 'eip155:42101': [ 'https://donut.push.network' ] },
universal: {
origin: [Getter],
account: [Getter],
sendTransaction: [Function: bound execute],
signMessage: [Function: signMessage],
signTypedData: [Function: signTypedData]
},
explorer: {
getTransactionUrl: [Function: getTransactionUrl],
listUrls: [Function: listUrls]
}
}
Let's create your first Push Chain client! Try the code in live playground 👇.
- Ethers (v6)
- Viem
- Solana (Web3 JS)
- UI Kit (Frontend / Abstracted)
VIRTUAL NODE IDE
VIRTUAL NODE IDE
VIRTUAL NODE IDE
REACT PLAYGROUND
// Import necessary components from @pushchain/ui-kit import { PushUniversalWalletProvider, PushUniversalAccountButton, usePushWalletContext, usePushChainClient, PushUI, } from '@pushchain/ui-kit'; function App() { // Define Wallet Config const walletConfig = { network: PushUI.CONSTANTS.PUSH_NETWORK.TESTNET, }; function Component() { const { connectionStatus } = usePushWalletContext(); const { pushChainClient } = usePushChainClient(); return ( <div> <PushUniversalAccountButton /> {connectionStatus == PushUI.CONSTANTS.CONNECTION.STATUS.CONNECTED && <p>Push Chain Client Initialized: ${JSON.stringify(pushChainClient)}</p> } </div> ); } return ( <PushUniversalWalletProvider config={walletConfig}> <Component /> </PushUniversalWalletProvider> ); }
LIVE APP PREVIEW
Access Account Information
Once initialized, your PushChainClient
exposes:
Property | Description |
---|---|
pushChainClient.universal.account | Push Chain execution account: for native Push Chain wallets this is your EOA or smart account; for cross-chain wallets this is your UEA (Universal Executor Account) that holds gas and executes txns. |
pushChainClient.universal.origin | Origin account on the source chain (e.g. eip155:1 ), representing your wallet’s native address. |
// execution vs. origin accounts
const execAccount = pushChainClient.universal.account; // Account that writes on Push Chain
const originAccount = pushChainClient.universal.origin; // Source chain account that is mapped to the execution account
Next Steps
- Initialize your EVM client with Initialize EVM Client
- Send your first Universal Transaction with Send Universal Transaction
- Explore on-chain helper contracts in Contract Helpers
- Build wallet flows and abstract core SDK with the UI Kit