MCPcopy Create free account
hub / github.com/Project-DARC/DARC / constructor

Method constructor

darc-js/src/DARC/DARC.ts:43–56  ·  view source on GitHub ↗

* The constructor of the DARC class. * @param param: the init param including the address, version, wallet and/or provider.

(param: InitParam)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected