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 | |
---|---|
contractName | Arbitrary identifier for ease in development |
type | static, local, remote (see below) |
abi | imported abi json in your project |
targetAddress | address, keychain, or search string (see below) |
ABI | |
---|---|
static | json file imported into the .ts file |
local | Object 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. |
remote | If set to remote , txBuilder will try to fetch this ABI from the block explorer |
targetAddress | |
---|---|
address | Contract address string |
keychain | Object with chain ids as the keys and the contract address as the values |
search string | Uses 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 |