Activate an account
Object containing the injected operation hash
tezos.activate(pkh, secret)
.then((activateOperation) => console.log(activateOperation));
The public key hash of the account
The secret to activate the account
Check for the inclusion of an operation in new blocks
The hash of the block in which the operation was included
tezos.awaitOperation('ooYf5iK6EdTx3XfBusgDqS6znACTq5469D1zQSDFNrs5KdTuUGi')
.then((hash) => console.log(hash));
The operation hash to check
Optional
interval: number = 5The interval to check new blocks (in seconds)
Optional
timeout: number = 180The time before the operation times out (in seconds)
Given operation objects, return the operations with their estimated limits
The operations with populated limits
The operation object or list of objects
Optional
source: stringThe source of the operation
Get the baker information for an address
The information of the delegate address
tezos.getBaker('tz1fXdNLZ4jrkjtgJWMcfeNpFDK9mbCBsaV4')
.then(({
balance,
frozen_balance,
frozen_balance_by_cycle,
staking_balance,
delegated_contracts,
delegated_balance,
deactivated,
grace_period,
}) => console.log(
balance,
frozen_balance,
frozen_balance_by_cycle,
staking_balance,
delegated_contracts,
delegated_balance,
deactivated,
grace_period,
));
The contract for which to retrieve the baker information
Optional
block: string | number = 'head'The block to query against
Get the balance for a contract
The balance of the contract
tezos.getBalance('tz1fXdNLZ4jrkjtgJWMcfeNpFDK9mbCBsaV4')
.then(balance => console.log(balance));
The contract for which to retrieve the balance
Optional
block: string | number = 'head'The block to query against
Ballots casted so far during a voting period
Ballots casted so far during a voting period
tezos.getBallotList().then(ballotList => console.log(ballotList));
Optional
block: string | number = 'head'The block to query against
Sum of ballots casted so far during a voting period
Sum of ballots casted so far during a voting period
tezos.getBallots().then(({ yay, nay, pass }) => console.log(yay, nay, pass));
Optional
block: string | number = 'head'The block to query against
Get the current head block hash of the chain
The block's hash, its unique identifier
tezos.getHeadHash().then(headHash => console.log(headHash))
Optional
block: string | number = 'head'The block to retrieve the hash from
Get the header of the current head
The whole block header
tezos.getHeader().then(header => console.log(header));
Optional
block: string | number = 'head'The block to retrieve the header from
Get the metadata of the current head
The head block metadata
tezos.getBlockMetadata().then(metadata => console.log(metadata));
Optional
block: string | number = 'head'The block to retrieve the block metadata from
Get the counter for an contract
The counter of a contract, if any
tezos.getCounter('tz1fXdNLZ4jrkjtgJWMcfeNpFDK9mbCBsaV4')
.then(counter => console.log(counter));
The contract for which to retrieve the counter
Optional
block: string | number = 'head'The block to query against
Get the delegate for a contract
The delegate of a contract, if any
tezos.getDelegate('tz1fXdNLZ4jrkjtgJWMcfeNpFDK9mbCBsaV4')
.then(delegate => console.log(delegate));
The contract for which to retrieve the delegate
Optional
block: string | number = 'head'The block to query against
List of delegates with their voting weight, in number of rolls
The ballots of the current voting period
tezos.getListings().then(listings => console.log(listings));
Optional
block: string | number = 'head'The block to query against
Get the manager for a contract
The manager of a contract
tezos.getManager('tz1fXdNLZ4jrkjtgJWMcfeNpFDK9mbCBsaV4')
.then(({ manager, key }) => console.log(manager, key));
The contract for which to retrieve the manager
Optional
block: string = 'head'The block to query against
Current proposal under evaluation
Current proposal under evaluation
tezos.getProposal().then(currentProposal => console.log(currentProposal));
Optional
block: string | number = 'head'The block to query against
Current period kind
Current period kind
tezos.getProposalPeriod().then(proposalPeriod => console.log(proposalPeriod));
Optional
block: string | number = 'head'The block to query against
List of proposals with number of supporters
List of proposals with number of supporters
tezos.getProposals().then(proposals => {
console.log(proposals[0][0], proposals[0][1])
console.log(proposals[1][0], proposals[1][1])
);
Optional
block: string | number = 'head'The block to query against
Import a secret key
await tezos.importKey('edskRv6ZnkLQMVustbYHFPNsABu1Js6pEEWyMUFJQTqEZjVCU2WHh8ckcc7YA4uBzPiJjZCsv3pC1NDdV99AnyLzPjSip4uC3y')
The secret key
Optional
passphrase: stringThe passphrase of the encrypted key
Optional
email: stringThe email associated with the fundraiser account
Import a ledger public key
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
await tezos.importLedger(TransportNodeHid, "44'/1729'/0'/0'");
The ledger transport (https://github.com/LedgerHQ/ledgerjs)
Optional
path: string = "44'/1729'/0'/0'"The ledger path
Optional
curve: string = 'tz1'The curve parameter
Inject an operation
Object containing the injected operation hash
The operation object
The signed operation bytes
Looks up a contract and returns an initialized contract
An initialized contract class
// Load contract
const contract = await tezos.loadContract('KT1MKm4ynxPSzRjw26jPSJbaMFTqTc4dVPdK');
// List defined contract methods
const { methods } = contract;
// Retrieve contract storage
const storage = await contract.storage();
// Get big map keys
await storage.ledger.get('tz1P1n8LvweoarK3DTPSnAHtiGVRujhvR2vk');
// Determine method schema
await contract.methods.transfer('tz1P1n8LvweoarK3DTPSnAHtiGVRujhvR2vk', 100).schema();
// Send contract operation
await contract.methods.transfer('tz1P1n8LvweoarK3DTPSnAHtiGVRujhvR2vk', 100).send({
fee: '100000',
gasLimit: '800000',
storageLimit: '60000',
});
The contract address
Originate a new contract
Object containing the injected operation hash
The parameters for the operation
Serializes a piece of data to a binary representation
Serialized data
The data
The data type
Prepares an operation
Object containing the prepared operation
tezos.prepareOperation({
operation: {
kind: 'transaction',
fee: 1420,
gas_limit: 10600,
storage_limit: 300,
amount: 1000,
destination: 'tz1RvhdZ5pcjD19vCCK9PgZpnmErTba3dsBs',
}
}).then(({ opbytes, opOb, counter }) => console.log(opbytes, opOb, counter));
The parameters for the operation
Queries a node given a path and payload
The response of the query
sotez.query(/chains/main/blocks/head
)
.then(head => console.log(head));
The RPC path to query
Optional
payload: anyThe payload of the query
Optional
method: stringThe request method. Either 'GET' or 'POST'
Register an account as a delegate
Object containing the injected operation hash
The parameters for the operation
Optional
fee?: numberThe fee to set for the transaction
Optional
gasThe gas limit to set for the transaction
Optional
storageThe storage limit to set for the transaction
Runs or traces code against an input and storage
Run results
Code to run
Amount in tez to send
Input to run though code
State of storage
Optional
trace: boolean = falseWhether to trace
Send an operation
Object containing the injected operation hash
const operation = {
kind: 'transaction',
fee: 1420,
gas_limit: 10600,
storage_limit: 300,
amount: 1000,
destination: 'tz1RvhdZ5pcjD19vCCK9PgZpnmErTba3dsBs',
};
tezos.sendOperation({ operation }).then(result => console.log(result));
tezos.sendOperation({ operation: [operation, operation] }).then(result => console.log(result));
The parameters for the operation
Set a delegate for an account
Object containing the injected operation hash
The parameters for the operation
The delegate for the new account
Optional
fee?: numberThe fee to set for the transaction
Optional
gasThe gas limit to set for the transaction
Optional
source?: stringThe source address of the operation
Optional
storageThe storage limit to set for the transaction
Simulate an operation
The simulated operation result
tezos.simulateOperation({
operation: {
kind: 'transaction',
fee: 1420,
gas_limit: 10600,
storage_limit: 300,
amount: 1000,
destination: 'tz1RvhdZ5pcjD19vCCK9PgZpnmErTba3dsBs',
},
}).then(result => console.log(result));
The parameters for the operation
Transfer operation
Object containing the injected operation hash
tezos.transfer({
to: 'tz1RvhdZ5pcjD19vCCK9PgZpnmErTba3dsBs',
amount: 1000000,
fee: 1420,
}).then(result => console.log(result));
The parameters for the operation
Typechecks the provided code
Typecheck result
The code to typecheck
The the gas limit
Typechecks data against a type
Typecheck result
The data
The data type
Generated using TypeDoc
Main Sotez Library
Example