{"id":13792164,"url":"https://github.com/merklejerk/flex-contract","last_synced_at":"2025-04-22T22:23:11.130Z","repository":{"id":32700107,"uuid":"140461393","full_name":"merklejerk/flex-contract","owner":"merklejerk","description":"A modern, flexible Ethereum smart contract abstraction.","archived":false,"fork":false,"pushed_at":"2023-01-23T23:24:30.000Z","size":1125,"stargazers_count":26,"open_issues_count":9,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-14T20:16:53.430Z","etag":null,"topics":["abstraction","async-await","contract","easy","erc20","es2017","ethereum","javascript","library","nodejs","self-signed","simple","smart-contracts","web3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merklejerk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-10T16:41:15.000Z","updated_at":"2024-04-04T23:17:33.000Z","dependencies_parsed_at":"2023-02-13T04:40:40.821Z","dependency_job_id":null,"html_url":"https://github.com/merklejerk/flex-contract","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merklejerk%2Fflex-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merklejerk%2Fflex-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merklejerk%2Fflex-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merklejerk%2Fflex-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merklejerk","download_url":"https://codeload.github.com/merklejerk/flex-contract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249922660,"owners_count":21345907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstraction","async-await","contract","easy","erc20","es2017","ethereum","javascript","library","nodejs","self-signed","simple","smart-contracts","web3"],"created_at":"2024-08-03T22:01:08.948Z","updated_at":"2025-04-22T22:23:11.106Z","avatar_url":"https://github.com/merklejerk.png","language":"JavaScript","funding_links":[],"categories":["Roadmap"],"sub_categories":[],"readme":"[![build status](https://travis-ci.org/merklejerk/flex-contract.svg?branch=master)](https://travis-ci.org/merklejerk/flex-contract)\n[![npm package](https://badge.fury.io/js/flex-contract.svg)](https://www.npmjs.com/package/flex-contract)\n\n# flex-contract\nA modern, flexible Ethereum smart contract abstraction that:\n\n- Requires minimal configuration to get going on all networks (no provider necessary).\n- Can sign and send transactions from arbitrary wallets (private keys).\n- Can decode internal events (transaction events raised in other contracts).\n- Facilitates easy event filtering and monitoring.\n- Provides separate promises for transaction hashes, receipts, and confirmations.\n- Automatically calculates gas and gas price for transactions in a configurable manner.\n- Automatically resolves ENS addresses across all inputs.\n- Experimental ABIEncoderV2 support.\n\n#### Flex-Ether\nIf you want a simple library for working with more general (ether) transactions,\ncheck out the [flex-ether package](https://github.com/merklejerk/flex-ether),\nupon which this library is based.\n\n## Installation\n```bash\nnpm install flex-contract\n# or\nyarn install flex-contract\n```\n\n## Preview\n\n```js\nconst FlexContract = require('flex-contract');\n// May be a plain ABI or a truffle artifact.\nconst ABI = require('./MyContract.ABI.json');\n// Should be the hex-encoded binary output of solc/truffle.\nconst BYTECODE = require('./MyContract.bytecode.bin');\n// Previously deployed contract address. Can also be an ENS address.\nconst DEPLOYED_AT = '0xf6fb5b73987d6d9a139e23bab97be6fc89e0dcd1';\n// A self-signing wallet key for transactions.\nconst PRIVATE_KEY = '0xb3734ec890893585330c71ece72afb05058192b6be47bee2b99714e6bb5696ab';\n\n// Define a contract interface on the mainnet.\nlet contract = new FlexContract(ABI);\n// Deploy it, signed by an private key.\nconst tx = contract.new({key: PRIVATE_KEY, bytecode: BYTECODE}).send();\n// Wait for the transaction hash.\nawait tx.txId;\n// Wait for the receipt, you can also just wait on the `tx` object itself.\nawait tx.receipt;\n// Wait for the receipt after 3 confirmations.\nawait tx.confirmed(3);\n// Call a constant function and wait for the result(s).\nawait contract.myConstantFn().call();\n// Make a transaction call to the contract, signed by an\n// private key, and wait for the receipt.\nlet receipt = await contract.myTransactionFn('1234').send({ key: PRIVATE_KEY });\n// Find some transaction events in the receipt.\nlet events = receipt.findEvents('MyEvent');\n// Find all contract events named 'MyEvent' from the last 16 blocks.\nevents = await contract.MyEvent().since({ fromBlock: -16 });\n// Track events as they happen.\nconst watcher = contract.MyEvent().watch();\nwatcher.on('data', event =\u003e {\n // Handle event.\n});\n```\n\n## User Guide\n- [Creating a flex contract](#creating-a-flex-contract)\n- [Calling contract functions](#calling-contract-functions)\n- [Estimating gas](#estimating-gas)\n- [Making read-only calls](#making-read-only-calls)\n- [Making transactions](#making-transactions)\n- [Deploying a new contract instance](#deploying-a-new-contract-instance)\n- [Getting encoded call data](#getting-encoded-call-data)\n- [Receipt events](#receipt-events)\n- [Past events](#past-events)\n- [Live events](#live-events)\n- [Encoding/Decoding Rules](#encodingdecoding-rules)\n- [ENS addresses](#ens-addresses)\n- [Cloning](#cloning)\n- [Instance Properties](#instance-properties)\n\n### Creating a flex contract\nThe only requirement for creating an instance is the ABI, which can be a plain\nABI outputted by [solc](https://github.com/ethereum/solidity), or a\nTruffle artifact produced by the [truffle suite](https://truffleframework.com/).\n\nBy default, the instance will create an [Infura](https://infura.io) provider to\ntalk to the main network. You can modify this behavior with the options\n`network`, `infuraKey`, `web3`, `eth`, `provider`, or `providerURI`.\n\nSome options can be overridden in method calls.\n\n```js\ncontract = new FlexContract(\n   // Contract ABI object. May also be a truffle artifact.\n   ABI: object | Array,\n   // Deployed address of contract. May be an ENS address (e.g., 'ethereum.eth').\n   // May omitted.\n   address: string,\n   // Options object. May be omitted.\n   {\n      // Network to use with Infura provider.\n      // May be 'main', 'ropsten', 'rinkeby', or 'kovan'.\n      // Defaults to 'main'\n      network: string,\n      // Your Infura project ID, if not passing a custom provider.\n      infuraKey: string,\n      // Whether to use a websocket connection instead of an HTTPS connection\n      // when using Infura.\n      ws: boolean,\n      // Connect to an existing provider at a URI\n      // (e.g., http://localhost:8545 or https://mainnet.infura.io/v3/PROJECT_ID).\n      // The 'net' option is required is using an IPC path.\n      providerURI: string,\n      // net instance, from require('net'), if using IPC path in providerURI\n      net: object,\n      // Use a custom provider instance (e.g., web3.currentProvider for metamask).\n      // Overrides all provider options.\n      provider: object,\n      // Use a custom web3 instance (that will be wrapped in a FlexEther).\n      // Overrides all provider options.\n      web3: object,\n      // Use a custom FlexEther (web3 wrapper) instance.\n      // Overrides all provider options.\n      // See https://github.com/merklejerk/flex-ether\n      eth: FlexEther,\n      // Hex-encoded string output of solc --bin.\n      // If the ABI passed as the first argument is a truffle artifact,\n      // the bytecode will already be defined.\n      bytecode: string,\n      // Fractional bonus to apply to gas price when making transactions.\n      // 0.01 = +1%. May be negative to under-price.\n      // Defaults to -0.005.\n      // Can be overridden in method calls.\n      gasPriceBonus: string,\n      // Fractional bonus to apply to gas limit estimates when making transactions.\n      // 0.01 = +1%. May be negative, but probably not a good idea.\n      // Defaults to 0.66\n      // Can be overridden in method calls.\n      gasBonus: string\n   });\n```\n\n### Calling contract functions\nThe contract instance is automatically populated with the contract functions. Arguments can be passed in positionally or by name through a single dictionary object:\n\n```js\nconst contract = new FlexContract(ABI, DEPLOYED_ADDRESS);\n// Create a call object to `myContractFn(uint256 a, bytes32 b)`\n// on the contract with positional arguments.\nconst call1 = contract.myContractFn(\n    1337,\n    '0xebca483a47b9ef4817ecf0b6d326833020a1e21ba067a25bf089e47ba634f87c',\n);\n// Create a call object to `myContractFn(uint256 a, bytes32 b)`\n// on the contract with named arguments.\nconst call2 = contract.myContractFn({\n    a: 1337,\n    b: `0xebca483a47b9ef4817ecf0b6d326833020a1e21ba067a25bf089e47ba634f87c`\n});\n```\n\nCalling the function will return a bound function call object, which allows you to do 3 things:\n\n- `gas()`: Estimate the gas cost of the function call.\n- `call()`: Simulate a call to the function, *without* modifying the blockchain state. This is the only way to get the return value of a contract function.\n- `send()`: Send the call as a transaction, which modifies the blockchain state.\n\nSee [Encoding/Decoding Rules](#encodingdecoding-rules) for information on how function arguments and return values are encoded and decoded.\n\n### Estimating gas\nCalling `gas()` on a bound function call will simulate the call and estimate the gas used.\n\n##### Example\n```js\n// Estimate the gas used by calling `myContractFn()`. This resolves to a single\n// `number`.\nconst gasUsed = await contract.myContractFn(...args).gas(/* opts */);\n```\n\n##### Options\n`gas()` accepts a single options object with the following optional fields:\n```js\n{\n  // Address of caller. May be an ENS address.\n  // Defaults to the provider's default account.\n  from: string,\n  // Hex-encoded private key.\n  // Makes the call from the address derived from this private key.\n  // Overrides the `from` option.\n  key: string,\n  // Address of contract to call. May be an ENS address.\n  // Defaults to contract.address.\n  address: string,\n  // Amount of ether (in wei) to send with the call.\n  // Can be a hex or base-10 string.\n  value: string,\n  // Make the call against the blockchain's state at a specific block number.\n  // Can be a previously mined block number, a negative number, or the string\n  // 'latest'.\n  // If the number is negative, it represents a backwards offset from the\n  // last block mined, where -1 is the last block mined, -2 is the second to\n  // last, etc.\n  // Defaults to -1.\n  block: string,\n  // Override the generated (hex) call data to be sent.\n  data: string,\n}\n```\n\n### Making read-only calls\nCalling `call()` on a bound function call will simulate the function call without modifying the blockchain state. This is the only way to get the return value from a contract function, as transactions resolve to receipts, not return values.\n\n##### Example\n```js\n// Simulate a call to `myContractFn()`, which resolves to its return value(s).\nconst result = await contract.myContractFn(...args).call(/* opts */);\n```\n\n##### Options\n`call()` can accept a single options object with the following optional fields:\n```js\n{\n  // Address of caller. May be an ENS address.\n  // Defaults to the provider's default account.\n  from: string,\n  // Hex-encoded private key.\n  // Makes the call from the address derived from this private key.\n  // Overrides the `from` option.\n  key: string,\n  // Address of contract to call. May be an ENS address.\n  // Defaults to contract.address.\n  address: string,\n  // Amount of ether (in wei) to send with the call.\n  // Can be a hex or base-10 string.\n  value: string,\n  // Make the call against the blockchain's state at a specific block number.\n  // Can be a previously mined block number, a negative number, or the string\n  // 'latest'.\n  // If the number is negative, it represents a backwards offset from the\n  // last block mined, where -1 is the last block mined, -2 is the second to\n  // last, etc.\n  // Defaults to -1.\n  block: string,\n  // The gas limit of the call.\n  gas: number,\n  // Override the generated (hex) call data to be sent.\n  data: string,\n  // geth `eth_call` state overrides object.\n  // See https://geth.ethereum.org/docs/rpc/ns-eth\n  overrides: object,\n}\n```\n\n#### Working with raw (encoded) results\nFor some advanced applications you may find yourself handling ABI-encoded, hex result data. Bound functions also have a `decodeCallResult()` method which can decode these results into more conventional values. For this use, the parameters passed into the bound function do not matter. You can either re-use an existing instance of the bound function or create a new one with dummy values.\n\n```js\nconst MY_CONSTANT_FN_HEX_RESULT = '0x...';\n// Just use dummy values to create a bound function that matches its function signature: myConstantFn(uint256,string).\nconst reuslt = contract.myConstantFn(1337, 'foo').decodeCallResult(MY_CONSTANT_FN_HEX_RESULT);\n```\n\n### Making transactions\nTo actually modify the blockchain, you can execute a contract function call as a transaction by calling `send()` on a bound function object. This resolves to a [receipt](https://web3js.readthedocs.io/en/1.0/web3-eth.html#eth-gettransactionreceipt-return) object once the transaction is successfully mined.\n\n`send()` returns an augmented `Promise` object with the following fields:\n- `txId`: A `Promise` that resolves once the transaction hash of the call is available.\n- `receipt`: A `Promise` that resolves to a receipt once the transaction is mined. Same as waiting on the container `Promise` object.\n- `confirmed(count)`: A `Promise ` that rsolves to a receipt once the transaction is mind and has been confirmed by `count` blocks.\n\n##### Examples\n```js\n// Execute a call to `myContractFn()`, which resolves to a receipt when\n// successfully mined.\nconst receipt = await contract.myContractFn(...args).send(/* opts */);\n// This also resolves to a transaction receipt.\nconst receipt = await contract.myContractFn(...args).send(/* opts */).receipt;\n// This resolves to the transaction hash once it's available.\nconst txHash = await contract.myContractFn(...args).send(/* opts */).txId;\n// This resolves to the receipt after 4 confirmations.\nconst receipt = await contract.myContractFn(...args).send(/* opts */).confirmed(4);\n```\n\n##### Options\n`send()` can accept a single options object with the following optional fields:\n```js\n{\n  // Address of caller. May be an ENS address.\n  // Defaults to the provider's default account.\n  from: string,\n  // Hex-encoded private key.\n  // Makes the call from the address derived from this private key.\n  // Overrides the `from` option.\n  key: string,\n  // Address of contract to call. May be an ENS address.\n  // Defaults to contract.address.\n  address: string,\n  // Amount of ether (in wei) to send with the call.\n  // Can be a hex or base-10 string.\n  value: string,\n  // The gas limit of the call.\n  gas: number,\n  // Gas price to use, as a hex or base-10 string, in wei.\n  // If not specified, it will be calculated from network gas price with bonus.\n  gasPrice: string,\n  // Bonus to apply to gas price calculations.\n  // Should be a positive or negative string, where 0.01 = +1%.\n  // If omitted, `contract.gasPriceBonus` will be used.\n  gasPriceBonus: string,\n  // Bonus to apply to gas limit calculations.\n  // Should be a positive or negative string, where 0.01 = +1%.\n  // If omitted, `contract.gasBonus` will be used.\n  gasBonus: string,\n  // Override the generated (hex) call data to be sent.\n  data: string,\n```\n\n### Deploying a new contract instance\nA contract can be deployed via `new()` which, like normal function calls, returns a bound function object with `gas()`, `call()`, and `send()` functions.\n\n##### Example\n```js\nconst FlexContract = require('flex-contract');\nconst ABI = require('./MyContract.ABI.json');\n// Should be the hex-encoded binary output of solc/truffle.\nconst BYTECODE = require('./MyContract.bytecode.bin');\n\n// Create a contract with bytecode data.\nconst contract = FlexContract(ABI, {bytecode: BYTECODE});\n\n// Deploy a new instance of the contract, passing two positional arguments\n// to the constructor, signed by default provider account and wait for the receipt.\nconst receipt = await contract.new(arg1, arg2).send();\n// contract.address is now set to the deployed address.\ncontract.address; // '0x059AFFF592bCF0CD2dDaAF83CeC2dbeEDA6f71D5'\n// receipt also has deployed contract address.\nreceipt.address; // '0x059AFFF592bCF0CD2dDaAF83CeC2dbeEDA6f71D5'\n```\n\n### Getting encoded call data\nCalling `encode()` on a bound function call will return the encoded call data.\n\n##### Example\n```js\n// Return the encoded call data to `myContractFn()`.\nconst encoded = await contract.myContractFn(...args).encode(/* opts */);\n```\n\n### Receipt Events\nReceipts resolved from transaction calls follow the format of web3\n[transaction receipts](https://web3js.readthedocs.io/en/1.0/web3-eth.html#eth-gettransactionreceipt-return),\naugmented with a few extra fields:\n\n- `events`: array of parsed event objects.\n- `findEvent(name, args)`: method to find the first event matching a provided arguments object.\n- `findEvents(name, args)`: method to find all events matching a provided arguments object.\n\n##### The Event object\nEvent objects follow the format:\n```javascript\n{\n   // Transaction hash of the transaction that triggered it.\n   transactionHash: '0x1234...',\n   // Block number of the block it occured in.\n   blockNumber: 1234,\n   // Index against all other logs raised in the transaction.\n   logIndex: 1234,\n   // Address of the contract where the event was raised.\n   address: '0x1234...',\n   // Name of the event.\n   name: 'MyEventName',\n   // Arguments of the event.\n   // Keys are for both the positional index of the argument and its name.\n   args: {\n      '0': FIRST_VALUE,\n      'FIRST_VALUE_NAME': FIRST_VALUE,\n      '1': SECOND_VALUE,\n      'SECOND_VALUE_NAME': SECOND_VALUE,\n      ...\n   }\n}\n```\n\n##### Searching events\n```javascript\nconst receipt = await contract.someTransactionFn(...args).send();\n// List events.\nreceipt.events; // [{name:..., args:...}, ... etc.]\n// Find an event named 'MyEvent' matching certain argument values.\n// Returns one event.\nreceipt.findEvent('MyEvent', {argName0: argValue0, ...});\n// Find all events named 'MyEvent' matching certain argument values.\n// Returns a list of events.\nreceipt.findEvents('MyEvent', {argName0: argValue0, ...});\n\n```\n\n##### Decoding internal events\nInternal events are events that are raised in other contracts during a transaction. The library will attempt to decode these events only if a flex-contract had been previously instantiated to that address, from construction, deployment, or by explicitly setting a contract's address field.\n\n### Past Events\nPast events can be retrieved by calling a method on the contract instance sharing the same name as the event, then calling `since()` on the returned object. Arguments passed into the method will filter results to only those whose arguments match. You may pass `null` for arguments that should match any value. Event objects follow the format defined in\n[receipt objects](#the-event-object).\n\nThe range of blocks to search for events can be set through the `fromBlock` and `toBlock` options. Possible values are all mined block numbers. Negative numbers can also be used to specify a backwards offset from the last block, where `-1` is the last block, `-2` is the second to last block, and so on.\n\n##### Examples\n```js\n// Get all events named 'MyEvent', which takes two arguments, that occurred in\n// the last block. `events` is an array of event objects.\nlet events = await contract.MyEvent(null, null).since();\n// Get all events named 'MyEvent' with the first argument matching `1234` that\n// occurred in the last 10 blocks.\nevents = await contract.MyEvent(1234, null).since({\n  fromBlock: -10,\n  toBlock: -1,\n});\n// Get events named 'MyEvent' matching the named arguments passed that occurred\n// in the last block.\nevents = await contract.MyEvent({\n  arg1Name: 1234,\n  arg2Name: null,\n});\n\n```\n\n##### Options\n`since()` can take the an options object with the following optional fields:\n```js\n{\n  // Block number to start the search.\n  // Negative values are backwards offsets from the last block.\n  // Defaults to -1.\n  fromBlock: string,\n  // Block number to start the search.\n  // Negative values are backwards offsets from the last block.\n  // Defaults to -1.\n  toBlock: string,\n  // Address of contract. May be an ENS address.\n  // Defaults to contract.address.\n  address: string,\n}\n```\n\n### Live Events\nEvents can be monitored as they happen by calling a method with the same name as the event then calling `watch()` on returned object. This will create an [EventEmitter](https://nodejs.org/api/events.html) object. Filters are defined as in [past events](#past-events),\nbut you cannot specify a block range, since watches always scan the current block.\n\nInternally, watches are implemented as polled versions of [past events](#past-events) and you can configure the poll rate via the `pollRate` option. When you no longer need a watcher, you should call its `close()` method to avoid memory leaks and network\ncongestion.\n\n###### Examples\n```js\n// Watch for all events named 'MyEvent' that matches `1234` as the first\n// argument and any second argument.\nlet watcher = contract.MyEvent(1234, null).watch();\n// a 'data' event is raised whenever a new matching event is seen.\nwatcher.on('data', function(event) =\u003e {\n  // Handle the event.\n  // ...\n  // Done with watcher.\n  this.close();\n});\n// Watch for events named 'MyEvent' matching some arguments by name, and poll\n// every 15 seconds.\nwatcher = contract.MyEvent({arg1Name: 1234, arg2Name: null})\n  .watch({ pollRate: 15000 });\n// Stop polling.\nwatcher.close();\n```\n\n##### Full options\n`watch()` can take the following options:\n```js\n{\n  // How often to scan new blocks, in milliseconds.\n  // defaults to 15000 (15 seconds).\n  pollRate: string,\n  // Address of contract. May be an ENS address.\n  // Defaults to contract.address.\n  address: string,\n  // Named arguments values to filter events by.\n  // e.g., {ARG_NAME_0: ARG_VALUE_0, ARG_NAME_1: ARG_VALUE_1, ... }\n  // Do not pass positional arguments if used.\n  args: object\n}\n```\n\n### Encoding/Decoding rules\nThere are a few rules to follow when passing values into contract methods and\nevent filters, and how to expect them.\n\n##### Integer Types\n- Should be passed in as a native `number` type or\nconverted to base-10 or base-16 string (.e.g, `'1234'` or `'0x04d2'`).\n- Decoded as a base-10 string. (.e.g., `'1234'`).\n\n##### Bytes and Address Types\n- Bytes be passed in as a hex string (e.g., `'0x1337b33f...'`).\n- Addresses can be either a hex string or an ENS address (e.g., `'ethereum.eth'`).\n- If they are not the correct size, they will be left-padded to fit, *which\ncan have unintended consequences*, so you should normalize the input yourself.\n- Bytes types are decoded as a lowercase hex string (e.g., `'0x1337b33f...'`).\n- Address types are decoded as a *checksum* address, which is a mixed case hex\nstring.\n\n##### Tuples (multiple return values)\n- Decoded as an object with keys for both each value's position and name\n(if available). For example:\n```javascript\n// Solidity definition:\nfunction myConstantFn() pure returns (uint256 a, address b, bytes32 c) {\n   return (1024,\n    0x0420DC92A955e3e139b52142f32Bd54C6D46c023,\n    0x3dffba3b7f99285cc73642eac5ac7110ec7da4b4618d99f3dc9f9954a3dacf27);\n}\n// flex-contract call\nawait contract.myConstantFn();\n// Output:\n// {\n//    '0': '1024',\n//    '1': '0x0420DC92A955e3e139b52142f32Bd54C6D46c023',\n//    '2': '0x3dffba3b7f99285cc73642eac5ac7110ec7da4b4618d99f3dc9f9954a3dacf27A',\n//    'a': '1024',\n//    'b': '0x0420DC92A955e3e139b52142f32Bd54C6D46c023',\n//    'c': '0x3dffba3b7f99285cc73642eac5ac7110ec7da4b4618d99f3dc9f9954a3dacf27A'\n// }\n```\n\n### ENS addresses\nAnywhere you can pass an address, you can instead pass an\n[ENS address](http://docs.ens.domains/en/latest/introduction.html), such as\n`'thisismyensaddress.eth'`. If an ENS address cannot be resolved, an\nexception will be raised. For event watchers, it will be emitted\nin an `'error'` event.  \n\nENS is only available on the main, ropsten, and rinkeby networks.\nThe ENS address will also have to be set up with the ENS contract on the\nrespective network to properly resolve.\n\n##### The ENS cache\nOnce an address is resolved, the address will be cached for future calls.\nEach address has a TTL, or time-to-live, defined, which specifies how long\nthe cache should be retained. However, many ENS registrations unintentionally\nleave the TTL at the default of `0`, which would imply no caching.\nSo, by default, cache TTLs are clamped to be at least one hour. You can\nconfigure this behavior yourself by setting the\n`FlexContract.ens.minTTL` property to the minimum number of *milliseconds* to\nkeep a cache entry.\n\n### Cloning\nYou can clone an existing flex-contract instance with the `clone()` method.\nThis method accepts an options object that overrides certain properties of the\noriginal instance.\n\n##### Full options\n```js\ncloned = conract.clone(\n   // Optional overrides.\n   {\n      // Set the deployed address.\n      address: string,\n      // Set the contract's bytecode, used in `new()`.\n      bytecode: string,\n      // Set the gas price bonus.\n      // Should be a number, where 0.01 = +1%.\n      gasPriceBonus: string,\n      // Set the gas limit bonus.\n      // Should be a number, where 0.01 = +1%.\n      gasBonus: string,\n      // Provide a web3 instance.\n      web3: object,\n      // Provide a provider instance.\n      provider: object,\n      // Connect to a different providerURI (.e.g, 'http://localhost:8545').\n      providerURI: string,\n      // Connect to a different network ('main', 'rinkeby', 'ropsten', 'kovan').\n      network: string,\n      // Your Infura project ID. You should provide the `network` option as well\n      // if you pass this, or else the network will default to `main`.\n      infuraKey: string\n   });\n```\n\n### Instance Properties\nA contract instance exposes a few properties, most of which you are free to\nchange. Many of these can also be overridden in individual call options.\n\n- `address (string)` Address the contract is deployed to (may be ENS).\n- `gasBonus (string)` Gas limit estimate bonus for transactions, where `0.01 = +1%`. May be negative.\n- `gasPriceBonus (string)` Gas price bonus for transactions, where `0.01 = +1%`. May be negative.\n- `bytecode` Bytecode of the contract (if available), used for deployment with `new()`.\n- `web3 (Web3)` The wrapped Web3 instance used.\n- `eth (FlexEther)` The [flex-ether](https://github.com/merklejerk/flex-ether) instance used.\n- `abi` (Read-only) The ABI defining the contract.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerklejerk%2Fflex-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerklejerk%2Fflex-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerklejerk%2Fflex-contract/lists"}