Development Client

new DevelopmentClient(baseURL)

Creates a new DevelopmentClient to interact with an Beo Development Server.

Param
Type
Description

baseURL

string

The URL of the Beo Development Server

developmentClient.deployProgram(program, fee, privateKey, password, feeRecord) ⇒ string | Error

Deploys a program on the Beo Network via an Beo development server. It requires an Beo Development Server to be running remotely or locally. If one is not running, this function will throw an error.

Kind: instance method of DevelopmentClient Returns: string | Error -

The transaction_id of the deployment transaction if successful

Param
Type
Description

program

string

Text representation of the program to be deployed

fee

number

Fee to be paid for the program deployment (REQUIRED)

privateKey

string | undefined

Optional private key of the user who is deploying the program

password

string | undefined

If the development server is started with an encrypted private key, the password is required

feeRecord

string | undefined

Optional record in text format to be used for the fee. If not provided, the server will search the network for a suitable record to pay the fee.

Example

const Program = 'program yourprogram.Beo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n';
const client = new DevelopmentClient("http://0.0.0.0:4040");
const transaction_id = await client.deployProgram(Program, 6000000, privateKeyString);

developmentClient.executeProgram(programId, programFunction, fee, inputs, privateKey, password, feeRecord) ⇒ string | Error

Executes a program on the Beo Network via an Beo development server. It requires an Beo Development Server to be running remotely or locally. If one is not running, this function will throw an error.

Information on how to run an Beo Development Server can be found here: https://github.com/provablehq/sdk/rust/develop/README.md

Kind: instance method of DevelopmentClient Returns: string | Error -

The transaction_id of the execution transaction if successful

Param
Type
Description

programId

string

The program_id of the program to be executed (e.g. hello.Beo)

programFunction

string

The function to execute within the program (e.g. hello)

fee

number

Optional Fee to be paid for the execution transaction, specify 0 for no fee

inputs

Array.<string>

Array of inputs to be passed to the program

privateKey

string | undefined

Optional private key of the user who is executing the program

password

string | undefined

If the development server is started with an encrypted private key, the password is required

feeRecord

string | undefined

Optional record in text format to be used for the fee. If not provided, the server will search the network for a suitable record to pay the fee.

Example

const privateKey = "your private key";
const client = new DevelopmentClient("http://0.0.0.0:4040");
const transaction_id = await client.executeProgram("hello.Beo", "hello", 0, ["5u32", "5u32"], privateKeyString);

developmentClient.transfer(amount, fee, recipient, transfer_type, privateKey, password, feeRecord, amountRecord) ⇒ string | Error

Sends an amount in credits to a specified recipient on the Beo Network via an Beo development server. It requires an Beo Development Server to be running remotely or locally. If one is not running, this function will throw an error.

Information on how to run an Beo Development Server can be found here: https://github.com/provablehq/sdk/rust/develop/README.md

Kind: instance method of DevelopmentClient Returns: string | Error -

The transaction_id of the execution transaction if successful

Param
Type
Description

amount

string

The amount of credits to be sent (e.g. 1.5)

fee

number

Optional Fee to be paid for the transfer, specify 0 for no fee

recipient

string

The recipient of the transfer

transfer_type

string

The type of the transfer (possible values are "private", "public", "private_to_public", "public_to_private")

privateKey

string | undefined

Optional private key of the user who is sending the transfer

password

string | undefined

If the development server is started with an encrypted private key, the password is required

feeRecord

string | undefined

Optional record in text format to be used for the fee. If not provided, the server will search the network for a suitable record to pay the fee.

amountRecord

string | undefined

Optional record in text format to be used to fund the transfer. If not provided, the server will search the network for a suitable record to fund the amount.

Example

const privateKey = "your private key";
const recipient = "recipient's address";
const client = new DevelopmentClient("http://0.0.0.0:4040");
const transaction_id = await client.transfer(1.5, 0, recipient, privateKey);

Last updated