NodeJS + Browser
address.verify(message, signature) ⇒ boolean
boolean
Kind: instance method of Address
message
Uint8Array
signature
Signature
Address.from_private_key(private_key) ⇒ Address
Address
Kind: static method of Address
private_key
PrivateKey
Address.from_view_key(view_key) ⇒ Address
Address
Kind: static method of Address
view_key
ViewKey
Address.from_string(address) ⇒ Address
Address
Kind: static method of Address
address
string
ExecutionResponse
Webassembly Representation of an Beo function execution response
This object is returned by the execution of an Beo function off-chain. It provides methods for retrieving the outputs of the function execution.
Kind: global class
executionResponse.getOutputs() ⇒ Array.<any>
Array.<any>
Get the outputs of the executed function
Kind: instance method of ExecutionResponse
KeyPair
Kind: global class
KeyPair
new KeyPair(proving_key, verifying_key)
.provingKey() ⇒
ProvingKey
.verifyingKey() ⇒
VerifyingKey
new KeyPair(proving_key, verifying_key)
Create new key pair from proving and verifying keys
proving_key
ProvingKey
verifying_key
VerifyingKey
keyPair.provingKey() ⇒ ProvingKey
ProvingKey
Get the proving key
Kind: instance method of KeyPair
keyPair.verifyingKey() ⇒ VerifyingKey
VerifyingKey
Get the verifying key
Kind: instance method of KeyPair
PrivateKey
Kind: global class
PrivateKey
new PrivateKey()
instance
.to_string() ⇒
string
.to_view_key() ⇒
ViewKey
.to_address() ⇒
Address
.sign(message) ⇒
Signature
.toCiphertext(secret) ⇒
PrivateKeyCiphertext
static
.from_seed_unchecked(seed) ⇒
PrivateKey
.from_string(private_key) ⇒
PrivateKey
.newEncrypted(secret) ⇒
PrivateKeyCiphertext
.fromPrivateKeyCiphertext(ciphertext, secret) ⇒
PrivateKey
new PrivateKey()
Generate a new private key
privateKey.to_string() ⇒ string
string
Get a string representation of the private key
This function should be used very carefully as it exposes the private key plaintext
Kind: instance method of PrivateKey
privateKey.to_view_key() ⇒ ViewKey
ViewKey
Get the view key corresponding to the private key
Kind: instance method of PrivateKey
privateKey.to_address() ⇒ Address
Address
Get the address corresponding to the private key
Kind: instance method of PrivateKey
privateKey.sign(message) ⇒ Signature
Signature
Sign a message with the private key
Kind: instance method of PrivateKey
message
Uint8Array
privateKey.toCiphertext(secret) ⇒ PrivateKeyCiphertext
PrivateKeyCiphertext
Encrypt the private key with a secret.
The secret is sensitive and will be needed to decrypt the private key later, so it should be stored securely
Kind: instance method of PrivateKey
secret
string
PrivateKey.from_seed_unchecked(seed) ⇒ PrivateKey
PrivateKey
Get a private key from a series of unchecked bytes
Kind: static method of PrivateKey
seed
Uint8Array
PrivateKey.from_string(private_key) ⇒ PrivateKey
PrivateKey
Create a private key from a string representation
This function will fail if the text is not a valid private key
Kind: static method of PrivateKey
private_key
string
PrivateKey.newEncrypted(secret) ⇒ PrivateKeyCiphertext
PrivateKeyCiphertext
Get a private key ciphertext using a secret.
The secret is sensitive and will be needed to decrypt the private key later, so it should be stored securely
Kind: static method of PrivateKey
secret
string
PrivateKey.fromPrivateKeyCiphertext(ciphertext, secret) ⇒ PrivateKey
PrivateKey
Get private key from a private key ciphertext using a secret.
Kind: static method of PrivateKey
ciphertext
PrivateKeyCiphertext
secret
string
PrivateKeyCiphertext
Private Key in ciphertext form
Kind: global class
PrivateKeyCiphertext
instance
.decryptToPrivateKey(secret) ⇒
PrivateKey
.toString() ⇒
string
static
.encryptPrivateKey(private_key, secret) ⇒
PrivateKeyCiphertext
.fromString(ciphertext) ⇒
PrivateKeyCiphertext
privateKeyCiphertext.decryptToPrivateKey(secret) ⇒ PrivateKey
PrivateKey
Decrypts a private ciphertext using a secret string.
This must be the same secret used to encrypt the private key
Kind: instance method of PrivateKeyCiphertext
secret
string
privateKeyCiphertext.toString() ⇒ string
string
Returns the ciphertext string
Kind: instance method of PrivateKeyCiphertext
PrivateKeyCiphertext.encryptPrivateKey(private_key, secret) ⇒ PrivateKeyCiphertext
PrivateKeyCiphertext
Encrypt a private key using a secret string.
The secret is sensitive and will be needed to decrypt the private key later, so it should be stored securely.
Kind: static method of PrivateKeyCiphertext
private_key
PrivateKey
secret
string
PrivateKeyCiphertext.fromString(ciphertext) ⇒ PrivateKeyCiphertext
PrivateKeyCiphertext
Creates a PrivateKeyCiphertext from a string
Kind: static method of PrivateKeyCiphertext
ciphertext
string
Program
Webassembly Representation of an Beo program
This object is required to create an Execution or Deployment transaction. It includes several convenience methods for enumerating available functions and each functions' inputs in a javascript object for usage in creation of web forms for input capture.
Kind: global class
Program
instance
.toString() ⇒
string
.getFunctions() ⇒
Array.<any>
.getFunctionInputs(function_name) ⇒
Array.<any>
.getMappings() ⇒
Array
|Array.<any>
.getRecordMembers(record_name) ⇒
object
.getStructMembers(struct_name) ⇒
Array.<any>
.id() ⇒
string
.isEqual(other) ⇒
boolean
.getImports() ⇒
Array.<any>
static
.fromString(program) ⇒
Program
.getCreditsProgram() ⇒
Program
program.toString() ⇒ string
string
Get a string representation of the program
Kind: instance method of Program
program.getFunctions() ⇒ Array.<any>
Array.<any>
Get javascript array of functions names in the program
Kind: instance method of Program
program.getFunctionInputs(function_name) ⇒ Array.<any>
Array.<any>
Get a javascript object representation of the function inputs and types. This can be used to generate a webform to capture user inputs for an execution of a function.
Kind: instance method of Program
function_name
string
Get a list of a program's mappings and the names/types of their keys and values.
Kind: instance method of Program
Returns: Array
- - An array of objects representing the mappings in the programArray.<any>
Example
const expected_mappings = [
{
name: "account",
key_name: "owner",
key_type: "address",
value_name: "microcredits",
value_type: "u64"
}
]
const credits_program = Beo_wasm.Program.getCreditsProgram();
const credits_mappings = credits_program.getMappings();
console.log(credits_mappings === expected_mappings); // Output should be "true"
program.getRecordMembers(record_name) ⇒ object
object
Get a javascript object representation of a program record and its types
Kind: instance method of Program
record_name
string
program.getStructMembers(struct_name) ⇒ Array.<any>
Array.<any>
Get a javascript object representation of a program struct and its types
Kind: instance method of Program
struct_name
string
program.id() ⇒ string
string
Get the id of the program
Kind: instance method of Program
program.isEqual(other) ⇒ boolean
boolean
Determine equality with another program
Kind: instance method of Program
other
Program
program.getImports() ⇒ Array.<any>
Array.<any>
Get program_imports
Kind: instance method of Program
Program.fromString(program) ⇒ Program
Program
Create a program from a program string
Kind: static method of Program
program
string
Program.getCreditsProgram() ⇒ Program
Program
Get the credits.Beo program
Kind: static method of Program
ProvingKey
Kind: global class
ProvingKey
instance
.toBytes() ⇒
Uint8Array
static
.fromBytes(bytes) ⇒
ProvingKey
provingKey.toBytes() ⇒ Uint8Array
Uint8Array
Create a byte array from a proving key
Kind: instance method of ProvingKey
ProvingKey.fromBytes(bytes) ⇒ ProvingKey
ProvingKey
Construct a new proving key from a byte array
Kind: static method of ProvingKey
bytes
Uint8Array
RecordCiphertext
Encrypted Beo record
Kind: global class
RecordCiphertext
instance
.toString() ⇒
string
.decrypt(view_key) ⇒
RecordPlaintext
.isOwner(view_key) ⇒
boolean
static
.fromString(record) ⇒
RecordCiphertext
recordCiphertext.toString() ⇒ string
string
Return the record ciphertext string.
Kind: instance method of RecordCiphertext
recordCiphertext.decrypt(view_key) ⇒ RecordPlaintext
RecordPlaintext
Decrypt the record ciphertext into plaintext using the view key.
Kind: instance method of RecordCiphertext
view_key
ViewKey
recordCiphertext.isOwner(view_key) ⇒ boolean
boolean
Returns true
if the view key can decrypt the record ciphertext.
Kind: instance method of RecordCiphertext
view_key
ViewKey
RecordCiphertext.fromString(record) ⇒ RecordCiphertext
RecordCiphertext
Return a record ciphertext from a string.
Kind: static method of RecordCiphertext
record
string
RecordPlaintext
Beo record plaintext
Kind: global class
RecordPlaintext
instance
.toString() ⇒
string
.microcredits() ⇒
bigint
.serialNumberString(private_key, program_id, record_name) ⇒
string
static
.fromString(record) ⇒
RecordPlaintext
recordPlaintext.toString() ⇒ string
string
Returns the record plaintext string
Kind: instance method of RecordPlaintext
recordPlaintext.microcredits() ⇒ bigint
bigint
Returns the amount of microcredits in the record
Kind: instance method of RecordPlaintext
recordPlaintext.serialNumberString(private_key, program_id, record_name) ⇒ string
string
Attempt to get the serial number of a record to determine whether or not it has been spent
Kind: instance method of RecordPlaintext
private_key
PrivateKey
program_id
string
record_name
string
RecordPlaintext.fromString(record) ⇒ RecordPlaintext
RecordPlaintext
Return a record plaintext from a string.
Kind: static method of RecordPlaintext
record
string
Signature
Kind: global class
Signature
instance
.verify(address, message) ⇒
boolean
.to_string() ⇒
string
static
.sign(private_key, message) ⇒
Signature
.from_string(signature) ⇒
Signature
signature.verify(address, message) ⇒ boolean
boolean
Kind: instance method of Signature
address
Address
message
Uint8Array
signature.to_string() ⇒ string
string
Kind: instance method of Signature
Signature.sign(private_key, message) ⇒ Signature
Signature
Kind: static method of Signature
private_key
PrivateKey
message
Uint8Array
Signature.from_string(signature) ⇒ Signature
Signature
Kind: static method of Signature
signature
string
Transaction
Webassembly Representation of an Beo transaction
This object is created when generating an on-chain function deployment or execution and is the object that should be submitted to the Beo Network in order to deploy or execute a function.
Kind: global class
Transaction
instance
.toString() ⇒
string
.transactionId() ⇒
string
.transactionType() ⇒
string
static
.fromString(transaction) ⇒
Transaction
transaction.toString() ⇒ string
string
Get the transaction as a string. If you want to submit this transaction to the Beo Network this function will create the string that should be submitted in the POST
data.
Kind: instance method of Transaction
transaction.transactionId() ⇒ string
string
Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
This value can be used to query the status of the transaction on the Beo Network to see if it was successful. If successful, the transaction will be included in a block and this value can be used to lookup the transaction data on-chain.
Kind: instance method of Transaction
transaction.transactionType() ⇒ string
string
Get the type of the transaction (will return "deploy" or "execute")
Kind: instance method of Transaction
Transaction.fromString(transaction) ⇒ Transaction
Transaction
Create a transaction from a string
Kind: static method of Transaction
transaction
string
VerifyingKey
Kind: global class
VerifyingKey
instance
.toBytes() ⇒
Uint8Array
static
.fromBytes(bytes) ⇒
VerifyingKey
verifyingKey.toBytes() ⇒ Uint8Array
Uint8Array
Create a byte array from a verifying key
Kind: instance method of VerifyingKey
VerifyingKey.fromBytes(bytes) ⇒ VerifyingKey
VerifyingKey
Construct a new verifying key from a byte array
Kind: static method of VerifyingKey
bytes
Uint8Array
ViewKey
Kind: global class
ViewKey
instance
.to_string() ⇒
string
.to_address() ⇒
Address
.decrypt(ciphertext) ⇒
string
static
.from_private_key(private_key) ⇒
ViewKey
.from_string(view_key) ⇒
ViewKey
viewKey.to_string() ⇒ string
string
Kind: instance method of ViewKey
viewKey.to_address() ⇒ Address
Address
Kind: instance method of ViewKey
viewKey.decrypt(ciphertext) ⇒ string
string
Kind: instance method of ViewKey
ciphertext
string
ViewKey.from_private_key(private_key) ⇒ ViewKey
ViewKey
Kind: static method of ViewKey
private_key
PrivateKey
ViewKey.from_string(view_key) ⇒ ViewKey
ViewKey
Kind: static method of ViewKey
view_key
string
Last updated