Interface ContractOptions

interface ContractOptions {
    account?: `0x${string}` | Account;
    chain?: "testnet" | Chain | "mainnet";
    contractAddresses?: Partial<AddressOptions>;
    gCsbAsGas?: boolean | "asDefault";
    gasPrice?: bigint | "estimate";
    rpcUrl?: string;
}

Properties

account?: `0x${string}` | Account

The wallet account.

By default:

  • If the providerOrPrivateKey is a private key, the account is the private key account.
  • If the providerOrPrivateKey is a provider, the account is the first account in the provider. The change of this option will only affect in this case.
chain?: "testnet" | Chain | "mainnet"

The chain to connect to.

Options:

  • 'mainnet': Connect to the Crossbell mainnet.
  • 'testnet': Connect to the Crossbell testnet.
  • Custom chain: Connect to a custom Crossbell chain.

Default

'mainnet'
contractAddresses?: Partial<AddressOptions>

The contract addresses.

Normally you don't need to set this option as all the contract addresses are the same across all Crossbell chains (mainnet or testnet).

Default

{
* entry: '0xa6f969045641Cf486a747A2688F3a5A6d43cd0D8',
* periphery: '0x96e96b7af62d628ce7eb2016d2c1d2786614ea73',
* newbieVilla: '0xD0c83f0BB2c61D55B3d33950b70C59ba2f131caA',
* cbt: '0x3D1b588a6Bcd728Bb61570ced6656eA4C05e404f',
* tips: '0x0058be0845952D887D1668B5545de995E12e8783',
* tipsWithFee: '0xf3158018f932981d0005701dDC22Ce51477E436d',
* mira: '0xAfB95CC0BD320648B3E8Df6223d9CDD05EbeDC64',
* linklist: '0xFc8C75bD5c26F50798758f387B698f207a016b6A',
* gcsb: '0x4200000000000000000000000000000000000301',
*}
gCsbAsGas?: boolean | "asDefault"

Whether to use $gCSB as gas.

When $gCSB is used as gas for a transaction via the gCsbAsGas option, the gas price will be automatically set to 0 for that transaction. This is true vice versa - when the gasPrice option is set to 0, $gCSB will be used as gas for that transaction.

Options:

  • 'asDefault': Use $gCSB as gas if the $gCSB owned by the wallet is enough, otherwise use the native token as gas from the wallet. (Recommended)
  • true: Always use $gCSB as gas.
  • false: Always use the native token as gas from the wallet.

Default

'asDefault'
gasPrice?: bigint | "estimate"

Gas price for transaction costs.

Options:

  • 'estimate': Dynamically estimate the gas price from the network.
  • bigint: Use a fixed gas price.

Note that when $gCSB is used as gas for a transaction via the gCsbAsGas option, the gas price will be automatically set to 0 for that transaction. This is true vice versa - when the gasPrice option is set to 0, $gCSB will be used as gas for that transaction.

Default

10n ** 9n
rpcUrl?: string

The RPC URL to connect to.

This will override the rpcUrl field in the chain option.

Default

chain.rpcUrls.default.http[0]

Generated using TypeDoc