Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

createSignerClient

Factory that builds a client with every query action and every signing action.

Setup

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
 
const signer = PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!)
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer,
})

createSignerClient returns SignerClient = Client<Signer, PublicActions & SignerActions>. It is a strict superset of createPublicClient: every method on the public client is also on the signer client.

Configuration

chainChain. Chain config. Use local, devnet, testnet, or mainnet from @left-curve/sdk.

transportTransport. GraphQL transport from createTransport(url?, config?).

signerSigner. Implementation of the Signer interface. Use PrivateKeySigner for server-side keys or createSessionSigner for session-key flows.

namestring, optional, default: "Signer Client". Free-form label.

typestring, optional, default: "dango". Type marker.

Methods

A signer client exposes every method on createPublicClient plus the following mutations.

App mutations

MethodDescription
broadcastTxSyncBroadcast a signed tx via the indexer
signAndBroadcastTxSign messages with the client signer and broadcast
transferSend a record of Address -> Coins
executeExecute one or more contract messages
instantiateInstantiate a contract from a code hash
migrateMigrate a contract to a new code hash
storeCodeUpload a Wasm code blob
storeCodeAndInstantiateUpload and instantiate in one tx

Account Factory mutations

MethodDescription
registerUserCreate a new user and first account
registerAccountRegister an additional account
updateKeyInsert or delete a key on the account
updateUsernameChange the username
createSessionSign SigningSessionInfo and return session

DEX mutations

MethodDescription
batchUpdateOrdersCreate and/or cancel multiple limit orders
swapExactAmountInInstant swap with exact input
swapExactAmountOutInstant swap with exact output
provideLiquidityAdd liquidity to a pair
withdrawLiquidityWithdraw liquidity from a pair

Perps mutations

MethodDescription
depositMarginDeposit collateral into the perps account
withdrawMarginWithdraw collateral
submitPerpsOrderSubmit a market or limit perps order
cancelPerpsOrderCancel one or all perps orders
submitConditionalOrderSubmit one trigger-based conditional order
submitConditionalOrdersSubmit a batch of conditional orders
cancelConditionalOrderCancel conditional order(s)
setReferralSet a referrer/referee mapping
setFeeShareRatioSet the referrer fee share ratio
vaultAddLiquidityDeposit into the perps vault
vaultRemoveLiquidityBurn vault shares for a withdrawal

End-to-end example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const signer = PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!)
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer,
})
 
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
// Move funds
const receipt = await client.transfer({
  sender,
  transfer: {
    "0xabcdef1234567890abcdef1234567890abcdef12": { dango: "1000000" },
  },
})
 
// Place a limit order
await client.batchUpdateOrders({
  sender,
  creates: [
    {
      baseDenom: "dango",
      quoteDenom: "bridge/usdc",
      amount: { bid: { quote: "10000000" } },
      price: { limit: "0.5" },
      timeInForce: "GTC",
    },
  ],
})

Notes

  • The signer is held by reference. Mutating its key after client creation is undefined behavior — build a new client instead.
  • Mutations call simulate internally to estimate gas. To skip simulation, pass gasLimit explicitly.

See also