Skip to main content
The Monaco SDK requires a Viem wallet client and network configuration. This page covers installation, SDK initialization, configuration options, and best practices.

Installation

Basic Initialization

Monaco needs a Viem walletClient configured for Sei mainnet. You can create that client from an injected browser wallet, WalletConnect, a local private key, or any other Viem-supported wallet setup. See the Viem Wallet Client docs for the full set of options.

Configuration Options

WalletClient
required
Viem wallet client for signing transactions and messages. Must be configured with a valid account and chain.
string
required
Required (v0.4.0+): Sei blockchain RPC endpoint URL. Each application should configure their own RPC provider to avoid rate limits. The public Sei RPC is https://evm-rpc.sei-apis.com. For production traffic, use a dedicated RPC provider like Ankr, GetBlock, or AllThatNode.
Network
required
Set this to "mainnet". Selects the chain (Sei mainnet) and the default API and WebSocket URLs. Use "staging" for Testnet. The SDK type also supports internal presets, but public docs intentionally cover only public endpoints.
number
Optional. Poll interval, in milliseconds, for the SDK’s internal viem public client when it waits on transaction receipts. Defaults to 200ms, about half a Sei block (viem’s own default is 4000ms), so sdk.vault.deposit and sdk.waitForTransaction resolve within about half a block of mining. Must be a positive finite number, otherwise the SDK throws InvalidConfigError on construction. Set it to 750 to keep the previous SDK default.
RequestSigning
Optional. Which protocol signs authenticated REST requests: "legacy" (the default) sends the X-Monaco-* headers, "rfc9421" sends RFC 9421 HTTP message signatures. Both use the same session key, and WebSocket and gRPC authentication are unaffected either way. There is no automatic downgrade, so select "rfc9421" only against a gateway that verifies it. In RFC mode the SDK requires a string request body, disables redirect following on authenticated requests, and throws if the caller supplies a signature header itself. See HTTP message signatures.

Network Configurations

The SDK automatically configures API and WebSocket endpoints based on the network parameter:
  • Chain: Sei mainnet (pacific-1)
  • Chain ID: 1329
  • API: https://apimonaco.xyz
  • WebSocket: Auto-resolved from network

RPC Provider Options

seiRpcUrl points the SDK at Sei for on-chain reads and transaction confirmation. In production code, source seiRpcUrl from an environment variable rather than hardcoding it.

SDK Instance Properties

Once initialized, the SDK exposes these APIs:

SDK Utility Methods

() => boolean
Check if the SDK has a valid wallet connection
() => boolean
Check if the user has a valid authentication session
() => string
Get the current wallet address. Throws InvalidStateError if no account is connected.Error Handling:
Best Practice: Use isConnected() before calling:
() => Network
Get the current network name, for example 'mainnet'
() => number
Get the current blockchain chain ID (1329 for Sei mainnet)
(hash: string, confirmations?: number, timeout?: number) => Promise<TransactionReceipt>
Wait for a transaction to be confirmed on-chainParameters:
  • hash: Transaction hash to wait for
  • confirmations?: Number of confirmations required (optional)
  • timeout?: Timeout in milliseconds (optional)
Returns: Viem TransactionReceipt