BEvm client

### Hierarchy

- Instance
  - BEvmInstance

## Index

### Constructors

- constructor

### Properties

- bevmRPC
- byzcoinRPC
- contractID
- darcID
- data
- id
- argumentAddress
- argumentAmount
- argumentTx
- commandCredit
- commandTransaction
- contractID

### Methods

- call
- creditAccount
- deploy
- invoke
- toBytes
- transaction
- calcInstID
- fromBytes
- fromByzcoin
- fromProof
- spawn

## Constructors

### constructor

- new BEvmInstance(byzcoinRPC: ByzCoinRPC, inst: Instance): BEvmInstance

- Overrides Instance.constructor

  - Defined in src/bevm/bevm-instance.ts:283

  #### Parameters

  - ##### byzcoinRPC: ByzCoinRPC

  - ##### inst: Instance

  #### Returns BEvmInstance

## Properties

### Private bevmRPC

bevmRPC: BEvmRPC

- Defined in src/bevm/bevm-instance.ts:283

### Private byzcoinRPC

byzcoinRPC: ByzCoinRPC

- Defined in src/bevm/bevm-instance.ts:285

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

### Static argumentAddress

argumentAddress: "address" = "address"

- Defined in src/bevm/bevm-instance.ts:239

### Static argumentAmount

argumentAmount: "amount" = "amount"

- Defined in src/bevm/bevm-instance.ts:240

### Static argumentTx

argumentTx: "txRlp" = "txRlp"

- Defined in src/bevm/bevm-instance.ts:236

### Static commandCredit

commandCredit: "credit" = "credit"

- Defined in src/bevm/bevm-instance.ts:238

### Static commandTransaction

commandTransaction: "transaction" = "transaction"

- Defined in src/bevm/bevm-instance.ts:235

### Static contractID

contractID: "bevm" = "bevm"

- Defined in src/bevm/bevm-instance.ts:233

## Methods

### call

- call(account: EvmAccount, contract: EvmContract, instanceIndex: number, method: string, args?: any[]): Promise<Result>

- - Defined in src/bevm/bevm-instance.ts:418

  Execute a view method on a deployed smart contract (read-only method)

  A view method is executed on a conode on behalf of the client. This conode does not necessarily belong to the ByzCoin cothority. Therefore, the actual cothority configuration, the BEvm ID as well as the ByzCoin ID that contains it must be provided.

  #### Parameters

  - ##### account: EvmAccount

    EVM account

  - ##### contract: EvmContract

    EVM contract

  - ##### instanceIndex: number

    Index of the deployed smart contract instance

  - ##### method: string

    Name of the view method to execute

  - ##### Default value args: any[] = []

    Arguments for the smart contract method

  #### Returns Promise<Result>

  Result of the view method execution, as an array of values. The types of the values will match the return values in the view method ABI. In particular, values for large number types (e.g. uint256) will be BNs.

  See `deploy()` for a description of `args`.

### creditAccount

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

- - Defined in src/bevm/bevm-instance.ts:449

  Credit an EVM account by the specified amount

  #### Parameters

  - ##### signers: Signer[]

    ByzCoin identities signing the ByzCoin transaction

  - ##### account: EvmAccount

    EVM account

  - ##### amount: Long

    Amount to credit on the account

  - ##### Optional wait: number

    Number of blocks to wait for the ByzCoin transaction to be included

  #### Returns Promise<void>

### deploy

- deploy(signers: Signer[], gasLimit: number, gasPrice: number, amount: number, account: EvmAccount, contract: EvmContract, args?: any[], wait?: number): Promise<void>

- - Defined in src/bevm/bevm-instance.ts:316

  Deploy an EVM smart contract

  #### Parameters

  - ##### signers: Signer[]

    ByzCoin identities signing the ByzCoin transaction

  - ##### gasLimit: number

    Gas limit for the transaction

  - ##### gasPrice: number

    Gas price for the transaction

  - ##### amount: number

    Amount transferred during the transaction

  - ##### account: EvmAccount

    EVM account

  - ##### contract: EvmContract

    EVM contract to deploy

  - ##### Default value args: any[] = []

    Arguments for the smart contract constructor

  - ##### Optional wait: number

    Number of blocks to wait for the ByzCoin transaction to be included

    The `args` are passed as an array of values, one per argument. The types of the arguments must match the types in the constructor ABI. In particular, for large number types (e.g. uint256), the argument can be passed as a number, string or BN value.

  #### Returns Promise<void>

### Private invoke

- invoke(command: string, args: Argument[], signers: Signer[], wait?: number): Promise<void>

- - Defined in src/bevm/bevm-instance.ts:467

  #### Parameters

  - ##### command: string

  - ##### args: Argument[]

  - ##### signers: Signer[]

  - ##### Optional wait: number

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

### transaction

- transaction(signers: Signer[], gasLimit: number, gasPrice: number, amount: number, account: EvmAccount, contract: EvmContract, instanceIndex: number, method: string, args?: any[], wait?: number): Promise<void>

- - Defined in src/bevm/bevm-instance.ts:362

  Execute an EVM transaction on a deployed smart contract (R/W method)

  #### Parameters

  - ##### signers: Signer[]

    ByzCoin identities signing the ByzCoin transaction

  - ##### gasLimit: number

    Gas limit for the transaction

  - ##### gasPrice: number

    Gas price for the transaction

  - ##### amount: number

    Amount transferred during the transaction

  - ##### account: EvmAccount

    EVM account

  - ##### contract: EvmContract

    EVM contract

  - ##### instanceIndex: number

    Index of the deployed smart contract instance

  - ##### method: string

    Name of the method to execute

  - ##### Default value args: any[] = []

    Arguments for the smart contract method

  - ##### Optional wait: number

    Number of blocks to wait for the ByzCoin transaction to be included

    See `deploy()` for a description of `args`.

  #### Returns Promise<void>

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

- Overrides Instance.fromByzcoin

  - Defined in src/bevm/bevm-instance.ts:275

  Retrieve an existing BEvm instance

  #### Parameters

  - ##### bc: ByzCoinRPC

    ByzCoin RPC to use

  - ##### iid: InstanceID

    BEvm instance ID

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

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

  #### Returns Promise<BEvmInstance>

  BEvm 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[]): Promise<BEvmInstance>

- - Defined in src/bevm/bevm-instance.ts:251

  Spawn a new BEvm instance

  #### Parameters

  - ##### bc: ByzCoinRPC

    ByzCoin RPC to use

  - ##### darcID: InstanceID

    DARC instance ID

  - ##### signers: Signer[]

    List of signers for the ByzCoin transaction

  #### Returns Promise<BEvmInstance>

  New BEvm instance

Generated using TypeDoc