Contract Legos

Contract legos provide Tx Builder the information needed to successfully initiate a transaction with an external contract.

Github (opens in a new tab)

Usage

import { ContractLego } from '@daohaus/utils';
 
import someAbi from 'someAbi.json';
 
const customLego = {
  type: 'static',
  contractName: 'SomeName',
  abi: someAbi,
  targetAddress: '0x0someContractAddress',
};
Properties
contractNameArbitrary identifier for ease in development
typestatic, local, remote (see below)
abiimported abi json in your project
targetAddressaddress, keychain, or search string (see below)
ABI
staticjson file imported into the .ts file
localObject added as a the localAbis (opens in a new tab) prop on txBuilder when adding that component to the app. These are referenced as an object and the key for the ABI must match the name for the contract lego.
remoteIf set to remote, txBuilder will try to fetch this ABI from the block explorer
targetAddress
addressContract address string
keychainObject with chain ids as the keys and the contract address as the values
search stringUses our own search notation to find application state within the txBuilder state. String leading with '.' and with a '.' between object for deep searching ie. .daoAddress or .dao.sharesAddress