Packages API
The Dapp relies on 3 packages:
@completium/archetype-ts-types
provides TypeScript types used by contract binding@completium/dapp-ts
provides generic functions used by contract binding@completium/event-listener
provides a client-side event indexer
@completium/archetype-ts-types
The @completium/archetype-ts-types
package is presented here.
@completium/dapp-ts
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
Returns
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)
Returns
DeployResult
Various data about deployment transaction.
exec_batch(cps, p)
Asynchronous function to execute calls to entry points in batch mode. See here for more information.
Parameters
Returns
exec_getter(c, e, a, p)
TODO
Parameter
a
:
string
Contract address
Returns
any
TODO
Fails with
does not fail
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
n
:
string
View's name
Returns
ViewResult
View's returned value
get_balance()
get_big_map_value(id, key, kv, kt)
Parameters
id
:
number
Big map identifier
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
Returns
CallParameter
Transaction parameter
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.
originate(c, s, p)
Originates a contract with code
c
and initial storage s
Parameters
Fails with
does not fail
set_binder_tezos_toolkit(tk)
Sets the Taquito Toolkit. It is used by the binding object to make calls to the blockchain.
Parameter
@completium/event-listener
register_event(p)
Low-level function to register an event listener. It is used by contract binding's register event methods.
Parameter
p
:
RegisterParam
Parameter object:
- source as
string
: emiting contract's address - filter as
EventFilter
: filter function to discriminate the event to listen to - process as
EventProcessor
: callback function to trigger when an event is emitted
run_listener(o)
Starts event listener "worker" (potentially-indefinite loop with timer)
Parameter
o
:
EventListenerOptions
Event listener optional options:
- delay: number of milliseconds between two lookups of the event well contract
- horizon: number of blocks to look back (the higher, the higher the probability to read the main branch)
- endpoint: endpoint used by the event listener
- bottom: block hash to start crawling from (defaulted to
head~2
) - verbose: flag to turn crank's verbose mode on/off
stop_listener()
Stops event listener.