Skip to main content

Experiment

This section presents types and functions exported by the @completium/experiment-ts package and used by contracts' bindings interface (storage, entry points, views).

A B

Account

Object returned by the get_account function. An account is created with Completium CLI with the following command:

completium-cli generate account as <ACCOUNT_ALIAS> [--force]

See here for more creation options.

Methods


get_address

Returns the account's Address

get_public_key

Returns account's public Key

get_secret_key

Returns account's secret key as a string

get_name

Returns account's name (aka alias)

get_balance

Returns account's balance as a Tez value

sign

Signs a Bytes value and returns a Signature

blake2b(b)

Hashes bytes value with blake2b algorithm.

Parameter


b :

Bytes to hash

Returns


Hashed bytes


Related

C D

call(c, e, a, p)

Low-level asynchronous call to contract's entry points used by contract binding.

Parameters


c :

string

Contract address


e :

string

entry point name


entry point argument


p :

Parameters

Call parameter (caller and transferred)

Returns


Various data about transaction.

Fails with

Error

An error is thrown if the transaction fails.


Related

CallResult

Object returned by calls to entry points via the contract binding object. These calls use the low-level call function. It is also returned by the exec_batch function.

It contains various information about entry point transaction, including the events field that is the array of events emitted during transaction execution.

delay_mockup_now_by_day(v)

delay_mockup_now_by_minute(v)

delay_mockup_now_by_hour(v)

delay_mockup_now_by_second(v)

delay_mockup_now_by_week(v)

deploy(path, params, p)

Low-level asynchronous function to deploy an Archetype contract, called by the deploy method of the contract's binding.

Parameters


path :

string

Path to contract (relative to command's execution folder)


params :

Contract intital storage values


p :

Parameters

Call parameter (caller and transferred)

Returns


DeployResult

Various data about deployment transaction.

deploy_from_json(name, code, storage, p)

Low-level asynchronous function to deploy a contract from its code in Micheline code. It is used by deploy_callback function.

Parameters


name :

string

Contract name (aka alias)


code :

Contract code


storage :

Contract storage


Parameters

Returns


DeployResult

Deployment transaction data, including contract address

deploy_callback(name, code, mt, p)

Low-level asynchronous function to deploy a contract that calls the getter entry point of another contract. It is used by the contract binding when calling a getter entry point to deploy a caller contract.

Parameters


name :

string

Getter contract name


Micheline type of the getter's return value


Parameters

Returns


DeployResult

Deployment transaction data, including contract address

E F

exec_batch(cps, p)

Asynchronous function to execute calls to entry points in batch mode. See here for more information.

Parameters


cps :

Array<CallParameter>

Array of CallParameter values


p :

Parameters

Call parameter (caller and transferred)

Returns


Transaction information.

Fails with

Error

An error is thrown if one the transactions fails.


Related

exec_view(c, e, a, p)

Low-level asynchronous function to call on on-chain contract's view. It is used by the contract binding to call a view.

Parameters


Contract address


n :

string

View's name


View argument


Parameters

Returns


ViewResult

View's returned value

expect_to_fail(f, e)

Asynchronous function that succeeds (ie. does not fail) if contract's error e is thrown by f.

Parameters


f :

async () => void

Asynchronous function that executes calls to contract.


Contract error (may be found in binding's errors field)


Related

expr_micheline_to_json(i)

Function that parses and converts the input string i to a Micheline value.

Parameter


i :

string

String value to parse and convert

Returns


Micheline value

G H

get_account(a)

Returns account from alias.

Parameter


n :

string

Account name

Returns


Account associated to name n, or undefined if not found

get_balance()

Asynchronous function to retrieve contract's balance

Parameter


Contract address

Returns


Contract balance

get_big_map_value(id, key, kv, kt)

Returns the value associated to key in big_map with id id. It is used by the generated big map getter of the contract's binding.

Parameters


id :

number

Big map identifier


key :

Key value


Key type


Value type

Returns


Promise<any>

Micheline value associated to key, null if not found.

get_call_param(c, e, a, p)

Low-level asynchronous function to get the transaction parameters to call an entry point. It is used by the contract's binding to get entry point transaction parameters for batch execution of entry points.

Parameters


c :

string

Contract address


e :

string

Entry point name


Entry point argument


Parameters

Returns


CallParameter

Transaction parameter

get_chain_id()

Asynchronous function that returns the chain id

Returns


Chain id

get_endpoint()

Function that returns current endpoint setting.

Returns


string

Currently used endpoint

get_mockup_now()

Function that returns now value in mockup mode only.

Returns


Date

Now value used by mockup mode.

get_raw_storage(a)

Low-level asynchronous function that returns a contract storage in JSON Micheline format. It is used by the contract binding.

Parameter


a :

string

Contract address

Returns


Contract storage

get_storage(a)

Asynchronous function that returns the Taquito storage of a contract.

Parameter


a :

string

Contract address

Returns


any

Taquito's formatted contract storage.

I J

is_mockup()

Checks whether current endpoint is mockup.

Returns


boolean

true if and only if current endpoint is mockup

json_micheline_to_expr(i)

Serializes a Micheline value to a string representation.

Parameter


Micheline input

Returns


string

Serialized Micheline

O P

originate(path, storage, p)

Low-level asynchronous function to deploy an Michelson contract, called by the deploy method of the contract's binding.

Parameters


path :

string

Path to contract (relative to command's execution folder)


params :

Contract intital storage values


p :

Parameters

Call parameter (caller and transferred)

Returns


DeployResult

Various data about deployment transaction.

pack(o, t)

Serializes any packable Micheline value to a Bytes representation.

Parameters


Micheline value to pack


Optional o's MichelineType value

Returns


Serialized value

Q R

register_global_constant(input, p)

Registers a global constant from input micheline value.

Parameters


input :

Value to register


p :

Parameters

Call parameter (caller and transferred)

Returns


RegisterGlobalConstantResult

Provides global content's hash value when register is successful.

S T

set_endpoint(e)

Sets Completium's endpoint value.

Parameter


e :

string

Endpoint value

set_mockup()

Set Completium's endpoint to mockup.

set_mockup_chain_id(c)

Set mockup mode's chain id value.

Parameter


c :

string

Chain id value

set_mockup_now(d)

Set mockup mode's now value.

Parameter


d :

Date

Now date. Note that blockchain timestamp precision is second-wise; hence Date's milliseconds are ignored.

set_quiet(b)

Set quiet mode on or off. When off, tezos client's output are displayed (mockup mode).

Parameter


b :

boolean

Quiet setting.

sign(a, b)

Signs bytes b with account a

Parameters


b :

Bytes to sign


a :

Account

Account to sign

Returns


Promise<Signature>

Signed bytes.

transfer(f, a, t)

Asynchronous function to transfer Tez from one account to another.

Parameters


From account


to :

Account | string

To account


a :

bigint

Transferred amount in mutez

Returns


Transfer Result

Transaction information.