web3dart library

Classes

AbiType<T>
A type that can be encoded and decoded as specified in the solidity ABI, available at https://solidity.readthedocs.io/en/develop/abi-spec.html
AddressType
Solidity address type
BaseArrayType<T>
Base class for (non-byte) arrays in solidity.
BlockNum
For operations that are reading data from the blockchain without making a transaction that would modify it, the Ethereum client can read that data from previous states of the blockchain as well. This class specifies which state to use.
BoolType
Solidity bool type
CompositeFunctionParameter
A function parameter that includes other named parameter instead of just wrapping single types.
ContractAbi
Defines the abi of a deployed Ethereum contract. The abi contains information about the functions defined in that contract.
ContractEvent
An event that can be emitted by a smart contract during a transaction.
ContractFunction
A function defined in the ABI of an compiled contract.
Credentials
Anything that can sign payloads with a private key.
CredentialsWithKnownAddress
Credentials where the address is known synchronously.
CustomTransactionSender
Interface for Credentials that don't sign transactions locally, for instance because the private key is not known to this library.
DecodingResult<T>
Decoding Result.
DeployedContract
Helper class that defines a contract with a known ABI that has been deployed on a Ethereum blockchain.
DynamicBytes
The solidity bytes type, which decodes byte arrays of arbitrary length.
DynamicLengthArray<T>
The solidity T[] type for arrays with an dynamic length.
EncodingLengthInfo
Information about whether the length of an encoding depends on the data (dynamic) or is fixed (static). If it's static, also contains information about the length of the encoding.
EthPrivateKey
Credentials that can sign payloads with an Ethereum private key.
EthrDID
EventComponent<T>
A FunctionParameter that is a component of an event. Contains additional information about whether the parameter is indexed.
FilterEvent
A log event emitted in a transaction.
FilterOptions
Options for event filters created with Web3Client.events.
FixedBytes
The bytes<M> solidity type, which stores up to 32 bytes.
FixedLengthArray<T>
The solidity T[k] type for arrays whose length is known.
FunctionParameter<T>
The parameter of a function with its name and the expected type.
FunctionType
Function Type
GeneratedContract
Base classes for generated contracts.
IntType
The solidity int<M> types that encodes twos-complement integers.
LengthTrackingByteSink
MsgSignature
Signatures used to sign Ethereum transactions and messages.
RandomBridge
Utility to use dart:math's Random class to generate numbers used by pointycastle.
StringType
The solidity string type, which utf-8 encodes strings
Transaction
TransactionInformation
TransactionReceipt
TupleType
Tuple Type
UintType
The solidity uint<M> type that encodes unsigned integers.
Wallet
Represents a wallet file. Wallets are used to securely store credentials like a private key belonging to an Ethereum address. The private key in a wallet is encrypted with a secret password that needs to be known in order to obtain the private key.
Web3Client
Class for sending requests over an HTTP JSON-RPC API endpoint to Ethereum clients. This library won't use the accounts feature of clients to use them to create transactions, you will instead have to obtain private keys of accounts yourself.

Enums

ContractFunctionType
Contract Function Type
StateMutability
The state mutability of a contract function defines how that function interacts with the blockchain.

Constants

sizeUnitBytes → const int
The length of the encoding of a solidity type is always a multiplicative of this unit size.

Properties

array RegExp
Array RegExp.
final
keccakDigest → KeccakDigest
final
params → ECDomainParameters
final

Functions

bytesToHex(List<int> bytes, {bool include0x = false, int? forcePadLength, bool padToEvenLength = false}) String
Converts the bytes given as a list of integers into a hexadecimal representation.
bytesToInt(List<int> bytes) BigInt
Converts the bytes from that list (big endian) to a (potentially signed) BigInt.
bytesToUnsignedInt(Uint8List bytes) BigInt
calculatePadLength(int bodyLength, {bool allowEmpty = false}) int
Calculates the amount of padding bytes needed so that the length of the padding plus the bodyLength is a multiplicative of sizeUnitBytes. If allowEmpty (defaults to false) is true, an empty length is allowed. Otherwise an empty bodyLength will be given a full sizeUnitBytes padding.
compressPublicKey(Uint8List compressedPubKey) Uint8List
Given a byte array computes its compressed version and returns it as a byte array, including the leading 02 or 03
decompressPublicKey(Uint8List compressedPubKey) Uint8List
Given a byte array computes its expanded version and returns it as a byte array, including the leading 04
ecRecover(Uint8List messageHash, MsgSignature signatureData) Uint8List
Given an arbitrary message hash and an Ethereum message signature encoded in bytes, returns the public key that was used to sign it. https://github.com/web3j/web3j/blob/c0b7b9c2769a466215d416696021aa75127c2ff1/crypto/src/main/java/org/web3j/crypto/Sign.java#L241
encode(dynamic value) List<int>
encodeList(List list, LengthTrackingByteSink builder) → void
generateNewPrivateKey(Random random) BigInt
Generates a new private key using the random instance provided. Please make sure you're using a cryptographically secure generator.
hexToBytes(String hexStr) Uint8List
Converts the hexadecimal string, which can be prefixed with 0x, to a byte sequence.
hexToDartInt(String hex) int
Converts the hexadecimal input and creates an int.
hexToInt(String hex) BigInt
Takes the hexadecimal input and creates a BigInt.
intToBytes(BigInt number) Uint8List
isValidSignature(Uint8List messageHash, MsgSignature signatureData, Uint8List publicKey) bool
Given an arbitrary message hash, an Ethereum message signature encoded in bytes and a public key encoded in bytes, confirms whether that public key was used to sign the message or not.
keccak256(Uint8List input) Uint8List
keccakAscii(String input) Uint8List
keccakUtf8(String input) Uint8List
padUint8ListTo32(Uint8List data) Uint8List
parseAbiType(String name) AbiType
Parses an ABI type from its AbiType.name.
prependTransactionType(int type, Uint8List transaction) Uint8List
privateKeyBytesToPublic(Uint8List privateKey) Uint8List
Generates a public key for the given private key using the ecdsa curve which Ethereum uses.
privateKeyToPublic(BigInt privateKey) Uint8List
Generates a public key for the given private key using the ecdsa curve which Ethereum uses.
publicKeyToAddress(Uint8List publicKey) Uint8List
Constructs the Ethereum address associated with the given public key by taking the lower 160 bits of the key's sha3 hash.
sign(Uint8List messageHash, Uint8List privateKey) MsgSignature
Signs the hashed data in messageHash using the given private key.
signTransactionRaw(Transaction transaction, Credentials c, {int? chainId = 1}) Uint8List
strip0x(String hex) String
If present, removes the 0x from the start of a hex-string.
uint8ListFromList(List<int> data) Uint8List
unsignedIntToBytes(BigInt number) Uint8List

Typedefs

SocketConnector = StreamChannel<String> Function()
Signature for a function that opens a socket on which json-rpc operations can be performed.