NetworkClientParam

A convenience type used by @stacks/transactions functions that accept both a network and an optional API client override. Combines NetworkParam with ClientParam.


Usage

import { NetworkClientParam } from '@stacks/network';

// Functions that use NetworkClientParam accept these options:
async function myApiCall(opts: { data: string } & NetworkClientParam) {
  // opts.network — optional, defaults to mainnet
  // opts.client  — optional, overrides the network's client
}

// Pass just a network string
await myApiCall({ data: 'hello', network: 'testnet' });

// Or override the client entirely
await myApiCall({
  data: 'hello',
  client: {
    baseUrl: 'https://my-custom-node.example.com',
  },
});

Notes

  • When both network and client are provided, the client values take precedence.

  • If neither is provided, mainnet defaults are used.

Reference Linkarrow-up-right


Definition

Last updated

Was this helpful?