5.7.1 Java  Script
5.7.1.1 Types
5.7.1.2 loader.mjs
5.7.1.3 Accounts
5.7.1.4 Contracts
5.7.1.5 Network Utilities
5.7.1.6 Utilities
5.7.1.7 ask.mjs
On this page:
deploy
get  Info
attach
5.7.1.4 Contracts

These functions create and interact with contract representations.

acc.deploy(bin) => ctc 

Returns a Reach contract abstraction after starting the deployment of a Reach DApp contract based on the bin argument provided. This bin argument is the "input.mjs" module produced by the JavaScript backend. This function does not block on the completion of deployment. To wait for deployment, see ctc.getInfo.

ctc.getInfo() => Promise<ctcInfo> 

Returns a Promise for an object that may be given to attach to construct a Reach contract abstraction representing this contract. This object may be stringified with JSON.stringify for printing and parsed again with JSON.parse without any loss of information. The Promise will only be resolved after the contract is actually deployed on the network. If you are using {deployMode: 'firstMsg'}, avoid blocking on this Promise with await until after the first publish has occurred. Awaiting getInfo too early may cause your program to enter a state of deadlock.

acc.attach(bin, ctcInfoP) => ctc 

Returns a Reach contract abstraction based on a deployed Reach DApp contract provided in the ctcInfo argument (or a Promise for ctcInfo) and the bin argument. This bin argument is the "input.mjs" module produced by the JavaScript backend.