massa
library
Enums
AddressType
Address type - which are either user address or smart contract address
User address starts with AU and Smart contract address starts with AS
NetworkType
OperationType
Operation types
Functions
address (PublicKey publicKey )
→ String
Generate massa address from a given public key publicKey
asHexString (List <int > bytes )
→ String
Converts list of bytes as hex string
base58Decode (String data )
→ Uint8List
decodes given data
using base58 check decode
base58Encode (Uint8List data )
→ String
base58Encode encodes the input string into base58 check encode
bigIntToBytes (BigInt bigInt )
→ Uint8List
Convert a bigint to a byte array
bigIntToHex (BigInt ? bigInt )
→ String
Convert a bigint to a byte array
bin2hex (Uint8List bytes , {required String separator , int ? wrap })
→ String
Represent bytes in hexadecimal
If a separator
is provided, it is placed the hexadecimal characters
representing each byte. Otherwise, all the hexadecimal characters are
simply concatenated together.
binaryToHex (String binary )
→ String
Converts a binary string into a hex string
blake3 (List <int > input , [int outputLength = 32 ])
→ List <int >
brake3 function hashes the data using brake 3
blake3Hash (Uint8List bytes )
→ Uint8List
Generates blake3 hash of a given data bytes
blake3Hex (List <int > input , [int outputLength = 32 ])
→ String
Hashes the supplied bytes into blake3 hashes and returns the result as hex string
buyRoles (Account account , int rollCount , double fee , int expirePeriod )
→ Future <Uint8List >
buy rolls
bytesToUtf8String (Uint8List bytes )
→ String
Convert byte array to string utf-8
byteToHex (Uint8List bytes )
→ String
Converts a Uint8List to a hex string
callSC (Account account , String targetAddress , String targetFunction , Uint8List functionParameters , double fee , double maximumGas , double maximumCoins , int expirePeriod )
→ Future <Uint8List >
Call contract
concat (List <Uint8List > bytes )
→ Uint8List
Concatenates one or more byte arrays
@param {List
decodePrivateKey (String privateKeyString )
→ PrivateKey
Decodes private key string privateKeyString
into PrivateKey
decodePublicKey (String publicKeyString )
→ PublicKey
Decodes public key string publicKeyString
into PublicKey
doubleToMassaInt (num value )
→ int
Converts double to massa integer
encodePrivateKey (PrivateKey privateKey )
→ String
Encodes private key privateKey
into base 58 format
encodePublicKey (PublicKey publicKey )
→ String
Encodes public key publicKey
into base 58 format
executeSC (Account account , Uint8List data , double fee , double maximumGas , double maximumCoins , int expirePeriod , {Map <Uint8List , Uint8List > ? dataStore })
→ Future <Uint8List >
Execute smart contract
generateKeyPair ()
→ Future <KeyPair >
Generates ed25519 key pair
generateSecureRandom ()
→ SecureRandom
Generates a secure FortunaRandom
generateSecureRandomBytes (int length )
→ Uint8List
generate a secure random bytes of a specific length
getBytesPublicKey (String publicKeyString )
→ Uint8List
Retrieves the byte representation of a given public key.
getBytesPublicKeyVersioned (String publicKeyString )
→ Uint8List
Retrieves the byte representation of a given public key.
getTimestamp ()
→ int
Get current time stamp
hex2bin (String hexStr )
→ Uint8List
Decode a hexadecimal string hexStr
into a sequence of bytes.
hexToBinary (String hex )
→ String
Converts a hex string to a binary string
hexToBytes (String hex )
→ Uint8List
Converts a hex string to a Uint8List
joinUint8Lists (Uint8List p1 , Uint8List p2 )
→ Uint8List
Joins two lists into one
keyPairFromSecret (String privateKeyString )
→ Future <KeyPair >
Generate ed25519 key pair from the privateKeyString
parseAddress (String address )
→ Uint8List
Parses address address
into bytes
public (PrivateKey privateKey )
→ Future <PublicKey >
Returns PublicKey from a given private key privateKey
ripemd160Digest (Uint8List bytes )
→ Uint8List
Calculates the RIPEMD-160 hash of the given bytes
.
ripmed160sha256 (Uint8List hash )
→ Uint8List
sellRoles (Account account , int rollCount , double fee , int expirePeriod )
→ Future <Uint8List >
sendTransaction (Account account , String recipientAddress , double amount , double fee , int expirePeriod )
→ Future <Uint8List >
Send transaction from one address to another
serialiseAddress (String address )
→ Uint8List
Parses address address
into bytes address type (1 byte)|version (1 byte) | address (22 bytes)
sha256Digest (Uint8List bytes )
→ Uint8List
Get a SHA256 hash bytes for the given bytes
.
sha256DigestString (Uint8List bytes )
→ String
Get a SHA256 hash string for the given bytes
.
stringToBytesUtf8 (String str )
→ Uint8List
Convert string to byte array
toSigned (Uint8List bytes )
→ List <int >
Converts Uint8List to List