cardano_wallet_sdk
library
Classes
-
AdaDateTime
-
Convert Cardano block time (secondsSinceEpoch in UTC) to DateTime and back.
-
AdaDateTimeDecoder
-
-
AdaDateTimeEncoder
-
-
AdaFormattter
-
ADA-specific currency formatter that expects all curreny to be in lovelace and
converts it to ADA (1 ADA = 1,000,000 lovelace). Compact formatters replace groups of
zeros with quantity abbreviation suffixes (i.e. K=thousond, M=million, B=billion & T=trillion).
The simple formatters group zeros into threes.
Decimal digits defaults to 6 places.
The currency factory method allows complete customization.
-
AssetRequest
-
an single asset name and value under a MultiAsset policyId
-
Bip32KeyPair
-
Private/signing and public/varification key pair.
-
Block
-
Block record
-
BlockchainAdapter
-
High-level abstraction to blockchain tailored towards balences and transactions.
-
BlockchainAdapterFactory
-
Provides a properly configured BlockchainAdapter for the requirested network.
Instances are cached and should be reused because they often cache
invariant blockchain data allowing for faster updates.
-
BlockchainCache
-
The cache holds invariant block chain data.
-
BlockfrostApiKeyAuthInterceptor
-
-
BlockfrostBlockchainAdapter
-
Loads BlockFrost data into this wallet model
-
CardanoBlockchainExplorer
-
Cardano Blockchain Explorer url generator for common blockchain web pages.
Supports both mainnet and testnet networks and i18n language translations.
-
CardanoScanBlockchainExplorer
-
Cardano Scan Blockchain Explorer url generator for common blockchain web pages.
Supports both mainnet and testnet networks.
-
CBORMetadata
-
Allow arbitrary metadata via raw CBOR type. Use MapBuilder and ListBuilder instances to compose complex nested structures.
-
CoinGeckoApiFix
-
Coin Gecko service to get real-time exchange trading values.
-
CoingeckoPriceService
-
-
CoinSelection
-
-
CoinSelectionError
-
-
CurrencyAsset
-
-
CurrencyAssetMetadata
-
-
HdWallet
-
This class implements a hierarchical deterministic wallet that generates cryptographic keys and
addresses given a root signing key. It also supports the creation/restoration of the root signing
key from a set of nmemonic BIP-39 words.
Cardano Shelley addresses are supported by default, but the code is general enough to support any
wallet based on the BIP32-ED25519 standard.
-
LinearFee
-
Used in calculating Cardano transaction fees.
-
MultiAssetBuilder
-
Special builder for creating ShelleyValue objects containing multi-asset transactions.
-
MultiAssetRequest
-
Native Token multi-asset container.
-
MultiAssetRequestBuilder
-
Special builder for creating ShelleyValue objects containing multi-asset transactions.
-
Price
-
Used for tracking currency trading pair prices (i.e. ADA to USD).
-
PriceService
-
not being used at the moment. see price_polling_service
-
RawTransaction
-
Raw transactions mirror the data on the blockchain.
Amounts in lovelace.
-
RawTransactionImpl
-
-
ReadOnlyWallet
-
Cardano read-only wallet that holds transactions, staking rewards and their associated
addresses. A public, read-ony wallet can be built given a stakingAddress and a networkId.
All blockchain data retrieval is delegated to the BlockchainAdapter.
-
ReadOnlyWalletImpl
-
Given a stakingAddress, generate a read-only wallet with balances of all native assets,
transaction history, staking and reward history.
-
ShelleyAddress
-
-
ShelleyAddressKit
-
Everything you need to add a spend (or change) address to a UTxO transaction.
-
ShelleyAsset
-
an single asset name and value under a MultiAsset policyId
-
ShelleyMultiAsset
-
Native Token multi-asset container.
-
ShelleyNativeScript
-
TODO ShelleyNativeScript is just a place-holder for these concrete classes:
ScriptPubkey, ScriptAll, ScriptAny, ScriptAtLeast, RequireTimeAfter, RequireTimeBefore
-
ShelleyTransaction
-
outer wrapper of a Cardano blockchain transaction.
-
ShelleyTransactionBody
-
Core of the Shelley transaction that is signed.
-
ShelleyTransactionInput
-
Points to an UTXO unspent change entry using a transactionId and index.
-
ShelleyTransactionOutput
-
Address to send to and amount to send.
-
ShelleyTransactionWitnessSet
-
this can be transaction signatures or a full blown smart contract
-
ShelleyValue
-
Can be a simple ADA amount using coin or a combination of ADA and Native Tokens and their amounts.
-
ShelleyVkeyWitness
-
A witness is a public key and a signature (a signed hash of the body) used for on-chain validation.
-
StakeAccount
-
-
StakePool
-
-
StakePoolMetadata
-
-
StakeReward
-
-
TransactionAmount
-
Amount and type for a specific native token.
-
TransactionBuilder
-
This builder manages the details of assembling a balanced transaction, including
fee calculation, change callculation, time-to-live constraints (ttl) and signing.
-
TransactionInput
-
Inputs or outputs for a given transaction.
-
TransactionOutput
-
-
Wallet
-
Extend ReadOnlyWallet with signing and transactional capabilities. Signing (private),
key, verify (public) key and address generation is handled by the HdWallet instance.
-
WalletBuilder
-
This builder creates both read-only and transactional wallets from provided
properties. Generated from a staking addresses, read-only wallets can show
a balance and recieve funds, but can't sign or send payment transactions.
Transactional wallets require a cryptographic private/signing key and can
sign and send payment transactions. Alternatively, private keys can be
generated from a 24-word mnemonic phrase. A BlockchainAdapter is used to
communicate with the blockchain, it defaults to BlockfrostBlockchainAdapter
for which an authorization adapter key must be provided for the target
network. Each wallet type has a sync-varient build method that will load
it's transactions and calculate the current balance before returning.
Finally, all wallets must choose to run on either the mainnet or testnet.
-
WalletCache<T>
-
Wallet cache interface.
-
WalletCacheMemory<T>
-
Implements an in-memory version of WalletCache.
-
WalletImpl
-
Build transactional wallet by combining features of HdWallet, TransactionBuilder and
ReadOnlyWallet.
-
WalletTransaction
-
Transaction from owning wallet perspective (i.e. filters raw transaction deposits
and withdrawals specific to owned addresses).
-
WalletTransactionImpl
-
-
WalletUpdate
-
Pass-back object used to update existing or new wallets.
-
WalletValue<T>
-
Functions
-
alwaysUnused(dynamic _)
→ bool
-
UnusedAddressFunction that will always return true (i.e. You'll always get the base spend/change address).
-
b2s(List<int> bytes, {String prefix = 'bytes'})
→ String
-
Dump byte array. Example: bytes
20
: 244,155,227,187,150,186,199,61,202,241,76,208,46,192,219,56,241,103,253,67
-
bech32ShelleyAddressFromBytes(Uint8Buffer bytes)
→ String
-
Convert bytes to bech32 Shelley address.
TODO move to shelley_address.dart
-
blake2bHash(List<int> stringBytes, {required int digestSize})
→ List<int>
-
Base blake2b hash function can produce hashes of arbirary size.
-
blake2bHash160(List<int> stringBytes)
→ List<int>
-
-
blake2bHash224(List<int> stringBytes)
→ List<int>
-
-
blake2bHash256(List<int> stringBytes)
→ List<int>
-
-
calculateFingerprint({required String policyId, required String assetNameHex, String hrp = 'asset'})
→ String
-
given a asset policyId and an assetName in hex, generate a bech32 asset fingerprint
-
convertBits(List<int> data, int fromWidth, int toWidth, bool pad)
→ List<int>
-
-
dioCall<T extends Object>({required NetworkRquest request, OneArgFunction? onSuccess, ResponseFunction? onError, String? errorSubject})
→ Future<Result<T, String>>
-
DIO network request wrapper that handles checking response and packaging result or
error message. Returns an oxidizer Result.
-
epochToDateTime({int epoch = 0})
→ DateTime
-
convert epoch to UTC timestamp
-
epochToMilliseconds({int epoch = 0})
→ int
-
convert epoch to unix time in milliseconds
-
harden(int index)
→ int
-
Hardens index, meaning it won't have a public key
-
hexFromShelleyAddress(String bech32, {bool uppercase = false})
→ String
-
Convert bech32 address payload to hex string. Optionaly uppercase hex string.
TODO move to shelley_address.dart
-
hexFromUnit8Buffer(Uint8Buffer bytes)
→ String
-
-
isHardened(int index)
→ bool
-
Returns true if index is hardened.
-
largestFirst({required List<WalletTransaction> unspentInputsAvailable, required List<MultiAssetRequest> outputsRequested, required Set<ShelleyAddress> ownedAddresses, int coinSelectionLimit = defaultCoinSelectionLimit, bool logSelection = false})
→ Future<Result<CoinSelection, CoinSelectionError>>
-
-
signEd25519({required Uint8List message, required Uint8List privateKey})
→ Uint8List
-
Cryptographic signature methods.
-
signEd25519Extended({required Uint8List message, required Uint8List privateKey, required Uint8List publicKey})
→ Uint8List
-
Sign a message with a ed25519 expanded private key and return signature
-
simpleMinFee({required ShelleyTransaction transaction, LinearFee linearFee = defaultLinearFee})
→ Coin
-
calculate transaction fee based on transaction lnegth and minimum constant
-
slotToDateTime({int slot = 0})
→ DateTime
-
convert slot to UTC timestamp
-
slotToMilliseconds({int slot = 0})
→ int
-
convert slot to unix time in milliseconds
-
translateErrorMessage({required DioError dioError, String? subject})
→ String
-
blockfrost error codes to user readable messages
-
uint8BufferFromHex(String hex, {bool utf8EncodeOnHexFailure = false})
→ Uint8Buffer
-
convert hex string to Uint8Buffer. Strips off 0x prefix if present.
-
uint8ListFromBytes(List<int> bytes)
→ Uint8List
-
Convert List
-
unit8BufferFromBytes(List<int> bytes)
→ Uint8Buffer
-
Convert List
-
unit8BufferFromShelleyAddress(String bech32)
→ Uint8Buffer
-
Convert bech32 address payload to hex adding network prefix.
TODO move to shelley_address.dart
-
validAda({required String ada, int decimalPrecision = 6, bool allowNegative = false, bool zeroAllowed = false})
→ Result<String, String>
-
If ADA string is all digits, not negative and the correct decimal precision, then the normalized
correct form is returned.
If it's not legal, then an explanation is returned in the error message.
-
validBech32({required String bech32, required List<String> hrpPrefixes, int? dataPartRequiredLength})
→ Result<String, String>
-
if bech32 string has the correct prefix, '1' seperator, legal data characters and optionaly correct length,
the normalized correct form is returned. If it's not legal, then an explanation is returned in the error message.
-
validMnemonic({required String phrase, int requiredNumberOfWords = 24})
→ Result<String, String>
-
If the mnemonic or recovery phrase has all legal characters and the
requiredNumberOfWords, then the normalized correct form is returned.
If it's not legal, then an explanation is returned in the error message.
-
validMnemonicWord(String word)
→ bool
-
Return true if a valid mnemonic word
-
validMnemonicWords(List<String> words)
→ Result<bool, String>
-
Return true if a all the provided mnemonic words are valid.
-
verifyEd25519({required Uint8List signature, required Uint8List message, required Uint8List publicKey})
→ bool
-