* The constructor of the DARC class. * @param param: the init param including the address, version, wallet and/or provider.
(param: InitParam)
| 41 | * @param param: the init param including the address, version, wallet and/or provider. |
| 42 | */ |
| 43 | constructor(param: InitParam) { |
| 44 | const { address, version, wallet, provider } = param; |
| 45 | this.darcAddress = address; |
| 46 | this.darcVersion = version; |
| 47 | this.wallet = wallet; |
| 48 | this.provider = provider; |
| 49 | if (wallet !== undefined) { |
| 50 | this.darcContract = new ethers.Contract(address, darcBinary.darcBinary(version).abi, wallet); |
| 51 | } else if (provider !== undefined) { |
| 52 | this.darcContract = new ethers.Contract(address, darcBinary.darcBinary(version).abi, provider); |
| 53 | } else { |
| 54 | throw new Error("Either wallet or provider should be provided."); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Run the program on the DARC contract. |
nothing calls this directly
no outgoing calls
no test coverage detected