### Hierarchy

- Instance
  - CoinInstance

## Index

### Constructors

- constructor

### Properties

- _coin
- contractID
- darcID
- data
- id
- rpc
- argumentCoinID
- argumentCoins
- argumentDarcID
- argumentDestination
- argumentType
- commandFetch
- commandMint
- commandStore
- commandTransfer
- contractID

### Accessors

- name
- value

### Methods

- mint
- toBytes
- transfer
- update
- calcInstID
- coinIID
- create
- fromBytes
- fromByzcoin
- fromProof
- spawn

## Constructors

### constructor

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

- Overrides Instance.constructor

  - Defined in src/byzcoin/contracts/coin-instance.ts:118

  Constructs a new CoinInstance. If the instance is not of type CoinInstance, an error will be thrown.

  #### Parameters

  - ##### rpc: ByzCoinRPC

    a working RPC instance

  - ##### inst: Instance

    an instance representing a CoinInstance

  #### Returns CoinInstance

## Properties

### _coin

_coin: Coin

- Defined in src/byzcoin/contracts/coin-instance.ts:104

### 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/coin-instance.ts:127

a working RPC instance

### Static argumentCoinID

argumentCoinID: "coinID" = "coinID"

- Defined in src/byzcoin/contracts/coin-instance.ts:16

### Static argumentCoins

argumentCoins: "coins" = "coins"

- Defined in src/byzcoin/contracts/coin-instance.ts:19

### Static argumentDarcID

argumentDarcID: "darcID" = "darcID"

- Defined in src/byzcoin/contracts/coin-instance.ts:17

### Static argumentDestination

argumentDestination: "destination" = "destination"

- Defined in src/byzcoin/contracts/coin-instance.ts:20

### Static argumentType

argumentType: "type" = "type"

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

### Static commandFetch

commandFetch: "fetch" = "fetch"

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

### Static commandMint

commandMint: "mint" = "mint"

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

### Static commandStore

commandStore: "store" = "store"

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

### Static commandTransfer

commandTransfer: "transfer" = "transfer"

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

### Static contractID

contractID: "coin" = "coin"

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

## Accessors

### name

- get name(): Buffer

- - Defined in src/byzcoin/contracts/coin-instance.ts:116

  #### Returns Buffer

  the name of the coin, which is a 32-byte Buffer.

### value

- get value(): Long

- - Defined in src/byzcoin/contracts/coin-instance.ts:109

  #### Returns Long

  value of the coin.

## Methods

### mint

- mint(signers: Signer[], amount: Long, wait?: number): Promise<void>

- - Defined in src/byzcoin/contracts/coin-instance.ts:165

  Mine a given amount of coins

  #### Parameters

  - ##### signers: Signer[]

    The list of signers for the transaction

  - ##### amount: Long

    The amount to add to the coin instance

  - ##### Optional wait: number

    Number of blocks to wait for inclusion

  #### Returns Promise<void>

### toBytes

- toBytes(): Buffer

- Inherited from Instance.toBytes

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

  Returns a byte representation of the Instance.

  #### Returns Buffer

### transfer

- transfer(coins: Long, to: Buffer, signers: Signer[]): Promise<void>

- - Defined in src/byzcoin/contracts/coin-instance.ts:143

  Transfer a certain amount of coin to another account.

  #### Parameters

  - ##### coins: Long

    the amount

  - ##### to: Buffer

    the destination account (must be a coin contract instance id)

  - ##### signers: Signer[]

    the signers (of the giver account)

  #### Returns Promise<void>

### update

- update(): Promise<CoinInstance>

- - Defined in src/byzcoin/contracts/coin-instance.ts:185

  Update the data of this instance

  #### Returns Promise<CoinInstance>

  the updated instance

### 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 coinIID

- coinIID(buf: Buffer): InstanceID

- - Defined in src/byzcoin/contracts/coin-instance.ts:28

  Generate the coin instance ID for a given darc ID

  #### Parameters

  - ##### buf: Buffer

    Any buffer that is known to the caller

  #### Returns InstanceID

  the id as a buffer

### Static create

- create(bc: ByzCoinRPC, coinID: InstanceID, darcID: InstanceID, coin: Coin): CoinInstance

- - Defined in src/byzcoin/contracts/coin-instance.ts:77

  Create returns a CoinInstance from the given parameters.

  #### Parameters

  - ##### bc: ByzCoinRPC

  - ##### coinID: InstanceID

  - ##### darcID: InstanceID

  - ##### coin: Coin

  #### Returns CoinInstance

### 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<CoinInstance>

- Overrides Instance.fromByzcoin

  - Defined in src/byzcoin/contracts/coin-instance.ts:99

  Initializes using an existing coinInstance from ByzCoin

  #### Parameters

  - ##### bc: ByzCoinRPC

    The RPC to use

  - ##### iid: InstanceID

    The instance ID

  - ##### 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<CoinInstance>

  a promise that resolves with the coin 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(bc: ByzCoinRPC, darcID: InstanceID, signers: Signer[], type: Buffer, preID?: Buffer): Promise<CoinInstance>

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

  Spawn a coin instance from a darc id

  #### Parameters

  - ##### bc: ByzCoinRPC

    The RPC to use

  - ##### darcID: InstanceID

    The darc instance ID

  - ##### signers: Signer[]

    The list of signers for the transaction

  - ##### type: Buffer

    The coin instance type

  - ##### Optional preID: Buffer

    If given, the InstanceID of the coin will be sha256("coin" | preID)

  #### Returns Promise<CoinInstance>

  a promise that resolves with the new instance

Generated using TypeDoc