### Hierarchy

- Instance
  - SpawnerInstance

## Index

### Constructors

- constructor

### Properties

- contractID
- darcID
- data
- id
- rpc
- struct
- argumentCoinID
- argumentCoinName
- argumentCoinValue
- argumentCredID
- argumentCredential
- argumentDarc
- argumentDarcID
- contractID

### Accessors

- costs

### Methods

- spawnCalypsoWrite
- spawnCoin
- spawnCoinInstructions
- spawnCredential
- spawnCredentialInstruction
- spawnDarcInstructions
- spawnDarcs
- spawnPopParty
- spawnRoPaSci
- spawnValue
- spawnValueInstructions
- toBytes
- update
- calcInstID
- fromBytes
- fromByzcoin
- fromProof
- spawn

## Constructors

### constructor

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

- Overrides Instance.constructor

  - Defined in src/personhood/spawner-instance.ts:96

  Creates a new SpawnerInstance

  #### Parameters

  - ##### rpc: ByzCoinRPC

    The ByzCoinRPC instance

  - ##### inst: Instance

    A valid spawner instance

  #### Returns SpawnerInstance

## Properties

### 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/personhood/spawner-instance.ts:103

The ByzCoinRPC instance

### Private struct

struct: SpawnerStruct

- Defined in src/personhood/spawner-instance.ts:96

### Static argumentCoinID

argumentCoinID: "coinID" = "coinID"

- Defined in src/personhood/spawner-instance.ts:40

### Static argumentCoinName

argumentCoinName: "coinName" = "coinName"

- Defined in src/personhood/spawner-instance.ts:41

### Static argumentCoinValue

argumentCoinValue: "coinValue" = "coinValue"

- Defined in src/personhood/spawner-instance.ts:42

### Static argumentCredID

argumentCredID: "credID" = "credID"

- Defined in src/personhood/spawner-instance.ts:37

### Static argumentCredential

argumentCredential: "credential" = "credential"

- Defined in src/personhood/spawner-instance.ts:36

### Static argumentDarc

argumentDarc: "darc" = "darc"

- Defined in src/personhood/spawner-instance.ts:38

### Static argumentDarcID

argumentDarcID: "darcID" = "darcID"

- Defined in src/personhood/spawner-instance.ts:39

### Static contractID

contractID: "spawner" = "spawner"

- Defined in src/personhood/spawner-instance.ts:35

## Accessors

### costs

- get costs(): SpawnerStruct

- - Defined in src/personhood/spawner-instance.ts:31

  #### Returns SpawnerStruct

## Methods

### spawnCalypsoWrite

- spawnCalypsoWrite(coinInst: CoinInstance, signers: Signer[], lts: LongTermSecret, key: Buffer, ident: IIdentity[], data?: Buffer): Promise<CalypsoWriteInstance>

- - Defined in src/personhood/spawner-instance.ts:419

  Creates a new calypso write instance for a given key. The key will be encrypted under the aggregated public key. This method creates both the darc that will be protecting the calypsoWrite, as well as the calypsoWrite instance.

  #### Parameters

  - ##### coinInst: CoinInstance

    this coin instance will pay for spawning the calypso write

  - ##### signers: Signer[]

    allow the `invoke:coin.fetch` call on the coinInstance

  - ##### lts: LongTermSecret

    the id of the long-term-secret that will re-encrypt the key

  - ##### key: Buffer

    the symmetric key that will be stored encrypted on-chain - not more than 31 bytes.

  - ##### ident: IIdentity[]

    allowed to re-encrypt the symmetric key

  - ##### Optional data: Buffer

    additionl data that will be stored AS-IS on chain! So it must be either encrypted using the symmetric 'key', or meta data that is public.

  #### Returns Promise<CalypsoWriteInstance>

### spawnCoin

- spawnCoin(coin: CoinInstance, signers: Signer[], darcID: InstanceID, coinID: Buffer, balance?: Long): Promise<CoinInstance>

- - Defined in src/personhood/spawner-instance.ts:224

  Create a coin instance for a given darc

  #### Parameters

  - ##### coin: CoinInstance

    The coin instance to take the coins from

  - ##### signers: Signer[]

    The signers for the transaction

  - ##### darcID: InstanceID

    The darc responsible for this coin

  - ##### coinID: Buffer

    The instance-ID for the coin - will be calculated as sha256("coin" | coinID)

  - ##### Optional balance: Long

    The starting balance

  #### Returns Promise<CoinInstance>

  a promise that resolves with the new coin instance

### spawnCoinInstructions

- spawnCoinInstructions(coin: CoinInstance, darcID: InstanceID, coinID: Buffer, balance?: Long): Instruction[]

- - Defined in src/personhood/spawner-instance.ts:191

  Creates all the necessary instruction to create a new coin - either with a 0 balance, or with a given balance by the caller.

  #### Parameters

  - ##### coin: CoinInstance

    where to take the coins to create the instance

  - ##### darcID: InstanceID

    the responsible darc for the new coin

  - ##### coinID: Buffer

    the type of coin - must be the same as the `coin` in case of balance > 0

  - ##### Optional balance: Long

    how many coins to transfer to the new coin

  #### Returns Instruction[]

### spawnCredential

- spawnCredential(coin: CoinInstance, signers: ISigner[], darcID: Buffer, cred: CredentialStruct, credID?: Buffer): Promise<CredentialsInstance>

- - Defined in src/personhood/spawner-instance.ts:281

  Create a credential instance for the given darc

  #### Parameters

  - ##### coin: CoinInstance

    The coin instance to take coins from

  - ##### signers: ISigner[]

    The signers for the transaction

  - ##### darcID: Buffer

    The darc instance ID

  - ##### cred: CredentialStruct

    The starting credentials

  - ##### Default value credID: Buffer = null

    The instance-ID for this credential - will be calculated as sha256("credential" | credID)

  #### Returns Promise<CredentialsInstance>

  a promise that resolves with the new credential instance

### spawnCredentialInstruction

- spawnCredentialInstruction(coin: CoinInstance, darcID: Buffer, cred: CredentialStruct, credID?: Buffer): Instruction[]

- - Defined in src/personhood/spawner-instance.ts:246

  Creates the instructions necessary to create a credential. This is separated from the spawnCredential method, so that a caller can get the instructions separated and then put all the instructions together in a big ClientTransaction.

  #### Parameters

  - ##### coin: CoinInstance

    coin-instance to pay for the credential

  - ##### darcID: Buffer

    responsible darc for the credential

  - ##### cred: CredentialStruct

    the credential structure

  - ##### Default value credID: Buffer = null

    if given, used to calculate the iid of the credential, else the darcID will be used

  #### Returns Instruction[]

### spawnDarcInstructions

- spawnDarcInstructions(coin: CoinInstance, ...darcs: Darc[]): Instruction[]

- - Defined in src/personhood/spawner-instance.ts:131

  Create the instructions necessary to spawn one or more darcs. This is separated from the spanDarcs method itself, so that a caller can create a bigger ClientTransaction with multiple sets of instructions inside.

  #### Parameters

  - ##### coin: CoinInstance

    where to take the coins from

  - ##### Rest ...darcs: Darc[]

    the darcs to create

  #### Returns Instruction[]

### spawnDarcs

- spawnDarcs(coin: CoinInstance, signers: Signer[], ...darcs: Darc[]): Promise<DarcInstance[]>

- - Defined in src/personhood/spawner-instance.ts:159

  Spawns one or more darc and returns an array of all the spawned darcs.

  #### Parameters

  - ##### coin: CoinInstance

    The coin instance to take coins from

  - ##### signers: Signer[]

    The signers for the transaction

  - ##### Rest ...darcs: Darc[]

  #### Returns Promise<DarcInstance[]>

  a promise that resolves with the new array of the instantiated darc instances

### spawnPopParty

- spawnPopParty(params: ICreatePopParty): Promise<PopPartyInstance>

- - Defined in src/personhood/spawner-instance.ts:305

  Create a PoP party

  #### Parameters

  - ##### params: ICreatePopParty

    structure of {coin, signers, orgs, desc, reward}

  #### Returns Promise<PopPartyInstance>

  a promise tha resolves with the new pop party instance

### spawnRoPaSci

- spawnRoPaSci(params: ICreateRoPaSci): Promise<RoPaSciInstance>

- - Defined in src/personhood/spawner-instance.ts:346

  Create a Rock-Paper-scissors game instance

  #### Parameters

  - ##### params: ICreateRoPaSci

    structure of {desc, coin, signers, stake, choice, fillup}

  #### Returns Promise<RoPaSciInstance>

  a promise that resolves with the new instance

### spawnValue

- spawnValue(coin: CoinInstance, signers: Signer[], darcID: InstanceID, value: Buffer): Promise<ValueInstance>

- - Defined in src/personhood/spawner-instance.ts:497

  Create a value instance for a given darc

  #### Parameters

  - ##### coin: CoinInstance

    The coin instance to take the coins from

  - ##### signers: Signer[]

    The signers for the transaction

  - ##### darcID: InstanceID

    The darc responsible for this coin

  - ##### value: Buffer

    The value to store in the instance

  #### Returns Promise<ValueInstance>

  a promise that resolves with the new coin instance

### spawnValueInstructions

- spawnValueInstructions(coin: CoinInstance, darcID: InstanceID, value: Buffer): Instruction[]

- - Defined in src/personhood/spawner-instance.ts:469

  Creates all the necessary instruction to create a new value - either with a 0 balance, or with a given balance by the caller.

  #### Parameters

  - ##### coin: CoinInstance

    where to take the coins to create the instance

  - ##### darcID: InstanceID

    the responsible darc for the new coin

  - ##### value: Buffer

    the value to store in the instance

  #### Returns Instruction[]

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

- - Defined in src/personhood/spawner-instance.ts:117

  Update the data of this instance

  #### Returns Promise<SpawnerInstance>

  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 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<SpawnerInstance>

- Overrides Instance.fromByzcoin

  - Defined in src/personhood/spawner-instance.ts:92

  Initializes using an existing coinInstance from ByzCoin

  #### Parameters

  - ##### bc: ByzCoinRPC

    an initialized byzcoin RPC instance

  - ##### iid: InstanceID

    the instance-ID of the spawn-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<SpawnerInstance>

### 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(params: ICreateSpawner | ByzCoinRPC, darcID?: InstanceID, signers?: Signer[], costs?: ICreateCost, beneficiary?: InstanceID, preID?: Buffer): Promise<SpawnerInstance>

- - Defined in src/personhood/spawner-instance.ts:55

  Spawn a spawner instance. It takes either an ICreateSpawner as single argument, or all the arguments separated.

  #### Parameters

  - ##### params: ICreateSpawner | ByzCoinRPC

    The ByzCoinRPC to use or an ICreateSpawner

  - ##### Optional darcID: InstanceID

    The darc instance ID

  - ##### Optional signers: Signer[]

    The list of signers

  - ##### Optional costs: ICreateCost

    The different cost for new instances

  - ##### Optional beneficiary: InstanceID

    The beneficiary of the costs

  - ##### Optional preID: Buffer

    Can be used to define the InstanceID of the credential

  #### Returns Promise<SpawnerInstance>

Generated using TypeDoc