### Hierarchy

- Instance
  - DarcInstance

## Index

### Constructors

- constructor

### Properties

- _darc
- contractID
- darcID
- data
- id
- rpc
- argumentDarc
- commandEvolve
- commandEvolveUnrestricted
- contractID
- ruleEvolve
- ruleEvolveUnrestricted

### Accessors

- darc

### Methods

- evolveDarcAndWait
- getSignerDarcIDs
- getSignerIdentities
- ruleMatch
- spawnDarcAndWait
- spawnInstanceAndWait
- toBytes
- update
- calcInstID
- create
- fromBytes
- fromByzcoin
- fromProof
- spawn

## Constructors

### constructor

- new DarcInstance(rpc: ByzCoinRPC, inst: Instance): DarcInstance

- Overrides Instance.constructor

  - Defined in src/byzcoin/contracts/darc-instance.ts:72

  #### Parameters

  - ##### rpc: ByzCoinRPC

  - ##### inst: Instance

  #### Returns DarcInstance

## Properties

### Private _darc

_darc: Darc

- Defined in src/byzcoin/contracts/darc-instance.ts:65

### contractID

contractID: string

Inherited from Instance.contractID

- Defined in src/byzcoin/instance.ts:67

### darcID

darcID: InstanceID

Inherited from Instance.darcID

- Defined in src/byzcoin/instance.ts:68

### data

data: Buffer

Inherited from Instance.data

- Defined in src/byzcoin/instance.ts:69

### id

id: InstanceID

Inherited from Instance.id

- Defined in src/byzcoin/instance.ts:66

### Private rpc

rpc: ByzCoinRPC

- Defined in src/byzcoin/contracts/darc-instance.ts:74

### Static argumentDarc

argumentDarc: "darc" = "darc"

- Defined in src/byzcoin/contracts/darc-instance.ts:13

### Static commandEvolve

commandEvolve: "evolve" = "evolve"

- Defined in src/byzcoin/contracts/darc-instance.ts:11

### Static commandEvolveUnrestricted

commandEvolveUnrestricted: "evolve_unrestricted" = "evolve_unrestricted"

- Defined in src/byzcoin/contracts/darc-instance.ts:12

### Static contractID

contractID: "darc" = "darc"

- Defined in src/byzcoin/contracts/darc-instance.ts:10

### Static ruleEvolve

ruleEvolve: string = "invoke:" + DarcInstance.argumentDarc + "." + DarcInstance.commandEvolve

- Defined in src/byzcoin/contracts/darc-instance.ts:14

### Static ruleEvolveUnrestricted

ruleEvolveUnrestricted: string = "invoke:" + DarcInstance.argumentDarc + "." +DarcInstance.commandEvolveUnrestricted

- Defined in src/byzcoin/contracts/darc-instance.ts:15

## Accessors

### darc

- get darc(): Darc

- - Defined in src/byzcoin/contracts/darc-instance.ts:70

  Returns a copy of the darc.

  #### Returns Darc

## Methods

### evolveDarcAndWait

- evolveDarcAndWait(newDarc: Darc, signers: Signer[], wait: number, unrestricted?: boolean): Promise<DarcInstance>

- - Defined in src/byzcoin/contracts/darc-instance.ts:135

  Request to evolve the existing darc using the new darc and wait for the block inclusion

  #### Parameters

  - ##### newDarc: Darc

    The new darc

  - ##### signers: Signer[]

    Signers for the counters

  - ##### wait: number

    Number of blocks to wait for

  - ##### Default value unrestricted: boolean = false

  #### Returns Promise<DarcInstance>

  a promise that resolves with the new darc instance

### getSignerDarcIDs

- getSignerDarcIDs(): InstanceID[]

- - Defined in src/byzcoin/contracts/darc-instance.ts:113

  Returns all darcs that are stored in the signer expression. It leaves out any other element of the expression.

  #### Returns InstanceID[]

### getSignerIdentities

- getSignerIdentities(): string[]

- - Defined in src/byzcoin/contracts/darc-instance.ts:100

  Searches for the rule that corresponds to the Darc.ruleSign action. If that rule does not exist, it returns an error.

  #### Returns string[]

### ruleMatch

- ruleMatch(action: string, signers: IIdentity[]): Promise<boolean>

- - Defined in src/byzcoin/contracts/darc-instance.ts:212

  Checks whether the given rule can be matched by a multi-signature created by all signers. If the rule doesn't exist, this method silently returns 'false'. Currently only Rule.OR are supported. A Rule.AND or "(" will return an error. Currently only 1 signer is supported.

  #### Parameters

  - ##### action: string

    the action to match

  - ##### signers: IIdentity[]

    all supposed signers for this action.

  #### Returns Promise<boolean>

### spawnDarcAndWait

- spawnDarcAndWait(d: Darc, signers: Signer[], wait?: number): Promise<DarcInstance>

- - Defined in src/byzcoin/contracts/darc-instance.ts:169

  Request to spawn an instance and wait for the inclusion

  #### Parameters

  - ##### d: Darc

    The darc to spawn

  - ##### signers: Signer[]

    Signers for the counters

  - ##### Default value wait: number = 0

    Number of blocks to wait for

  #### Returns Promise<DarcInstance>

  a promise that resolves with the new darc instance

### spawnInstanceAndWait

- spawnInstanceAndWait(contractID: string, args: Argument[], signers: Signer[], wait?: number): Promise<InstanceID>

- - Defined in src/byzcoin/contracts/darc-instance.ts:190

  Request to spawn an instance of any contract and wait

  #### Parameters

  - ##### contractID: string

    Contract name of the new instance

  - ##### args: Argument[]

  - ##### signers: Signer[]

    Signers for the counters

  - ##### Default value wait: number = 0

    Number of blocks to wait for

  #### Returns Promise<InstanceID>

  a promise that resolves with the instanceID of the new instance, which is only valid if the contract.spawn uses DeriveID.

### toBytes

- toBytes(): Buffer

- Inherited from Instance.toBytes

  - Defined in src/byzcoin/instance.ts:81

  Returns a byte representation of the Instance.

  #### Returns Buffer

### update

- update(): Promise<DarcInstance>

- - Defined in src/byzcoin/contracts/darc-instance.ts:88

  Update the data of this instance

  #### Returns Promise<DarcInstance>

  a promise that resolves once the data is up-to-date

### Static calcInstID

- calcInstID(contractID: string, preID: Buffer): InstanceID

- Inherited from Instance.calcInstID

  - Defined in src/byzcoin/instance.ts:60

  Returns the instanceID given a contract and a preID

  #### Parameters

  - ##### contractID: string

  - ##### preID: Buffer

  #### Returns InstanceID

### Static create

- create(rpc: ByzCoinRPC, d: Darc): DarcInstance

- - Defined in src/byzcoin/contracts/darc-instance.ts:55

  create returns a DarcInstance, given a ByzCoin and a darc. The instance must already exist on ByzCoin. This method does not verify if it does or not.

  #### Parameters

  - ##### rpc: ByzCoinRPC

    a working ByzCoin instance

  - ##### d: Darc

    the darc

  #### Returns DarcInstance

### Static fromBytes

- fromBytes(buf: Buffer): Instance

- Inherited from Instance.fromBytes

  - Defined in src/byzcoin/instance.ts:45

  Returns an instance from a previously toBytes() call.

  #### Parameters

  - ##### buf: Buffer

  #### Returns Instance

### Static fromByzcoin

- fromByzcoin(bc: ByzCoinRPC, iid: InstanceID, waitMatch?: number, interval?: number): Promise<DarcInstance>

- Overrides Instance.fromByzcoin

  - Defined in src/byzcoin/contracts/darc-instance.ts:27

  Initializes using an existing coinInstance from ByzCoin

  #### Parameters

  - ##### bc: ByzCoinRPC

    a working ByzCoin instance

  - ##### iid: InstanceID

    the instance id of the darc-instance

  - ##### Default value waitMatch: number = 0

    how many times to wait for a match - useful if its called just after an addTransactionAndWait.

  - ##### Default value interval: number = 1000

    how long to wait between two attempts in waitMatch.

  #### Returns Promise<DarcInstance>

  a promise that resolves with the darc instance

### Static fromProof

- fromProof(id: InstanceID, p: Proof): Instance

- Inherited from Instance.fromProof

  - Defined in src/byzcoin/instance.ts:18

  Create an instance from a proof

  #### Parameters

  - ##### id: InstanceID

    the instance-id to extract

  - ##### p: Proof

    The proof

  #### Returns Instance

  the instance

### Static spawn

- spawn(rpc: ByzCoinRPC, darcID: InstanceID, signers: Signer[], newD: Darc): Promise<DarcInstance>

- - Defined in src/byzcoin/contracts/darc-instance.ts:40

  spawn creates a new darc, given a darcID.

  #### Parameters

  - ##### rpc: ByzCoinRPC

    a working ByzCoin instance

  - ##### darcID: InstanceID

    a darc that has the right to spawn new darcs

  - ##### signers: Signer[]

    fulfilling the `spawn:darc` rule of the darc pointed to by darcID

  - ##### newD: Darc

    the new darc to spawn

  #### Returns Promise<DarcInstance>

Generated using TypeDoc