### Hierarchy

- Instance
  - RoPaSciInstance

## Index

### Constructors

- constructor

### Properties

- contractID
- darcID
- data
- fillUp
- firstMove
- id
- rpc
- struct
- contractID

### Accessors

- adversaryChoice
- adversaryID
- playerChoice
- stake

### Methods

- confirm
- getChoice
- isCalypso
- isDone
- ourGame
- second
- setChoice
- toBytes
- toObject
- update
- calcInstID
- fromBytes
- fromByzcoin
- fromObject
- fromProof

## Constructors

### constructor

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

- Overrides Instance.constructor

  - Defined in src/personhood/ro-pa-sci-instance.ts:67

  #### Parameters

  - ##### rpc: ByzCoinRPC

  - ##### inst: Instance

  #### Returns RoPaSciInstance

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

### Private fillUp

fillUp: Buffer | undefined

- Defined in src/personhood/ro-pa-sci-instance.ts:66

### Private firstMove

firstMove: number | undefined

- Defined in src/personhood/ro-pa-sci-instance.ts:67

### id

id: InstanceID

Inherited from Instance.id

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

### Private rpc

rpc: ByzCoinRPC

- Defined in src/personhood/ro-pa-sci-instance.ts:69

### struct

struct: RoPaSciStruct

- Defined in src/personhood/ro-pa-sci-instance.ts:65

### Static contractID

contractID: "ropasci" = "ropasci"

- Defined in src/personhood/ro-pa-sci-instance.ts:41

## Accessors

### adversaryChoice

- get adversaryChoice(): number

- - Defined in src/personhood/ro-pa-sci-instance.ts:37

  Getter for the second player choice

  #### Returns number

  the choice as a number

### adversaryID

- get adversaryID(): Buffer

- - Defined in src/personhood/ro-pa-sci-instance.ts:29

  Getter for the second player ID

  #### Returns Buffer

  id as a buffer

### playerChoice

- get playerChoice(): number

- - Defined in src/personhood/ro-pa-sci-instance.ts:21

  #### Returns number

### stake

- get stake(): Coin

- - Defined in src/personhood/ro-pa-sci-instance.ts:17

  #### Returns Coin

## Methods

### confirm

- confirm(coin: CoinInstance): Promise<void>

- - Defined in src/personhood/ro-pa-sci-instance.ts:195

  Reveal the move of the first player

  #### Parameters

  - ##### coin: CoinInstance

    The CoinInstance of the first player

  #### Returns Promise<void>

  a promise that resolves on success, or rejects with the error

### getChoice

- getChoice(): [number, Buffer | undefined]

- - Defined in src/personhood/ro-pa-sci-instance.ts:92

  Returns the firstMove and the fillUp values.

  #### Returns [number, Buffer | undefined]

### isCalypso

- isCalypso(): boolean

- - Defined in src/personhood/ro-pa-sci-instance.ts:108

  returns true if there is a CalypsoWrite instance stored.

  #### Returns boolean

### isDone

- isDone(): boolean

- - Defined in src/personhood/ro-pa-sci-instance.ts:101

  Check if both players have played their moves

  #### Returns boolean

  true when both have played, false otherwise

### ourGame

- ourGame(coinID: InstanceID): boolean

- - Defined in src/personhood/ro-pa-sci-instance.ts:116

  ourGame returns if this game belongs to the given coin.

  #### Parameters

  - ##### coinID: InstanceID

  #### Returns boolean

### second

- second(coin: CoinInstance, signer: Signer, choice: number, lts?: LongTermSecret): Promise<void>

- - Defined in src/personhood/ro-pa-sci-instance.ts:132

  Play the adversary move

  #### Parameters

  - ##### coin: CoinInstance

    The CoinInstance of the second player

  - ##### signer: Signer

    Signer for the transaction

  - ##### choice: number

    The choice of the second player

  - ##### Optional lts: LongTermSecret

  #### Returns Promise<void>

  a promise that resolves on success, or rejects with the error

### setChoice

- setChoice(choice: number, fillup: Buffer): void

- - Defined in src/personhood/ro-pa-sci-instance.ts:84

  Update the instance data

  #### Parameters

  - ##### choice: number

    The choice of the first player

  - ##### fillup: Buffer

    The fillup of the first player

  #### Returns void

### toBytes

- toBytes(): Buffer

- Inherited from Instance.toBytes

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

  Returns a byte representation of the Instance.

  #### Returns Buffer

### toObject

- toObject(): any

- - Defined in src/personhood/ro-pa-sci-instance.ts:234

  #### Returns any

### update

- update(): Promise<RoPaSciInstance>

- - Defined in src/personhood/ro-pa-sci-instance.ts:222

  Update the state of the instance

  #### Returns Promise<RoPaSciInstance>

  a promise that resolves with the updated instance, or rejects with the error

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

- Overrides Instance.fromByzcoin

  - Defined in src/personhood/ro-pa-sci-instance.ts:61

  Fetch the proof for the given instance and create a RoPaSciInstance from it

  #### Parameters

  - ##### bc: ByzCoinRPC

    The ByzCoinRPC 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<RoPaSciInstance>

  the new instance

### Static fromObject

- fromObject(rpc: ByzCoinRPC, obj: any): RoPaSciInstance

- - Defined in src/personhood/ro-pa-sci-instance.ts:43

  #### Parameters

  - ##### rpc: ByzCoinRPC

  - ##### obj: any

  #### Returns RoPaSciInstance

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

Generated using TypeDoc