The main class for interacting with the Synthetix protocol. The class requires a provider RPC endpoint and a wallet address (or a private key which is used from .env.PRIVATE_KEY) const sdk = new SynthetixSdk({accountConfig, partnerConfig, pythConfig, rpcConfig}); await sdk.init();

The only required parameters for the SDK to initialize are the chainId and (address or env.PRIVATE_KEY). All other parameters are optional and are set to default values if uninitialized. const accountConfig = { address: '0x' } const rpcConfig = { chainId: 8453, rpcEndpoint: 'https://https://base-sepolia.g.alchemy.com/v2/ALCHEMY_KEY', preset: 'andromeda'} const sdk = new SynthetixSdk({accountConfig, rpcConfig }) const markets = await sdk.perps.getMarkets()

Constructors

Properties

account?: Account
accountAddress: `0x${string}` = ZERO_ADDRESS
accountConfig: AccountConfig
accountIds?: bigint[]
contracts: Contracts
core: Core
partnerConfig: PartnerConfig
perps: Perps
publicClient: {}
pyth: Pyth
pythConfig: PythConfig
referrer: string
rpcConfig: RpcConfig
spot: Spot
trackingCode: string
utils: Utils
walletClient?: {}

Methods

  • Executes a transaction from the user wallet. The private key for the wallet is used from the .env

    Parameters

    • tx: CallParameters

      Call parameters for the tx

    Returns Promise<string>

    txHash Transaction hash after tx execution