Skip to main content

Function reference

Names below are the generated Kotlin names in the org.mintlayer.wallet.bindings package; the Swift names in the MintlayerWalletBindings module are identical except that optional parameters use labels (makeDefaultAccountPrivkey(mnemonic:network:passphrase:)). Byte parameters are ByteArray in Kotlin, Data in Swift.

Keys and addresses​

FunctionReturnsNotes
makePrivateKey()private-key blobrandom new key
makeDefaultAccountPrivkey(mnemonic, network, passphrase?)extended private-key blobBIP39 → m/44'/<coin type>/0' (coin type 1 testnet, 19788 mainnet)
extendedPrivateKeyDecode(blob)ExtendedPrivateKeyDatadecompose into path, chain code, public/private keys
extendedPrivateKeyEncode(parts)extended private-key blobcanonical form, roundtrip-safe
makeReceivingAddress(accountPrivkey, keyIndex: UInt32)private-key blobpath <account>/0/<index> — returns a key, not an address
makeChangeAddress(accountPrivkey, keyIndex)private-key blobpath <account>/1/<index> — same naming note
makeReceivingAddressPublicKey(accountPublicKey, keyIndex)public-key blobwatch-only derivation
makeChangeAddressPublicKey(accountPublicKey, keyIndex)public-key blobwatch-only derivation
publicKeyFromPrivateKey(privateKey)public-key blob
extendedPublicKeyFromExtendedPrivateKey(accountPrivkey)extended public-key blob
pubkeyToPubkeyhashAddress(publicKey, network)StringBech32 address (mtc1… / tmt1…)
encodeDestination(address, network)destination blobaddress → destination for outputs/witnesses

Key indices must not have the most significant bit set (InvalidKeyIndex otherwise), matching BIP32 hardened-key rules.

Transactions​

FunctionReturnsNotes
encodeTransaction(inputs, outputs, flags)transaction blobassemble from input/output blobs
encodeSignedTransaction(transaction, signatures)signed transaction blobwitness list appended
encodePartiallySignedTransaction(...)partially signed blobper-input optional witnesses, UTXOs, destinations, HTLC secrets
getTransactionId(transaction, strictByteSize)String (hex)strict = exactly one Transaction; lenient tolerates witness bytes
decodeTransactionToJson(transaction, network)String (JSON)empty witness list shape
decodeSignedTransactionToJson(transaction, network)String (JSON)
decodePartiallySignedTransactionToJson(transaction, network)String (JSON)
estimateTransactionSize(inputs, inputDestinations, outputs, network)UInt64encoded size in bytes
encodeOutpointSourceId(id, source)outpoint blobid = raw 32-byte tx/block-reward id, source = SourceId
extractHtlcSecret(signedTx, strictByteSize, htlcOutpointSourceId, htlcOutputIndex)secret bytesrevealed HTLC pre-image from a spend

Inputs​

Each returns one input blob: encodeInputForUtxo(outpointSourceId, outputIndex), encodeInputForWithdrawFromDelegation, encodeInputForMintTokens, encodeInputForUnmintTokens, encodeInputForLockTokenSupply, encodeInputForFreezeToken, encodeInputForUnfreezeToken, encodeInputForChangeTokenAuthority, encodeInputForChangeTokenMetadataUri, encodeInputForFillOrder, encodeInputForFreezeOrder, encodeInputForConcludeOrder.

Outputs​

FunctionParameters
encodeOutputTransferamount, address, network
encodeOutputTokenTransferamount, address, tokenId, network
encodeOutputLockThenTransferamount, address, lock (timelock blob), network
encodeOutputTokenLockThenTransferamount, address, tokenId, lock, network
encodeOutputCoinBurnamount
encodeOutputTokenBurnamount, tokenId, network
encodeOutputCreateDelegationpoolId, ownerAddress, network
encodeOutputDelegateStakingamount, delegationId, network
encodeOutputCreateStakePoolpoolId, poolData (blob from encodeStakePoolData), network
encodeOutputProduceBlockFromStakepoolId, staker, network
encodeOutputDataDepositdata (arbitrary bytes)
encodeOutputIssueFungibleTokenauthority, tokenTicker, metadataUri, numberOfDecimals, totalSupply (TotalSupply), supplyAmount?, isFreezable (FreezableToken), currentBlockHeight, network
encodeOutputIssueNfttokenId, authority, name, ticker, description, mediaHash, creator?, mediaUri?, iconUri?, additionalMetadataUri?, currentBlockHeight, network
encodeOutputHtlcamount, tokenId?, secretHash, spendAddress, refundAddress, refundTimelock (timelock blob), network
encodeCreateOrderOutputaskAmount, askTokenId?, giveAmount, giveTokenId?, concludeAddress, network

All amounts are decimal atom strings; token ids are bech32 strings.

Witnesses​

FunctionUse
encodeWitness(sighashType, privateKey, inputOwnerDestination, transaction, inputUtxos, inputIndex, additionalInfo, currentBlockHeight, network)standard single-signature witness
encodeWitnessNoSignature()witness for inputs that need no signature
encodeWitnessHtlcSpend(...)spend an HTLC by revealing the secret
encodeWitnessHtlcRefundSingleSig(...)refund an HTLC after the timelock (single signature)
encodeWitnessHtlcRefundMultisig(...)refund an HTLC after the timelock (multisig)

sighashType is a SignatureHashType; inputUtxos carries one optional UTXO blob per transaction input.

Messages and challenges​

FunctionNotes
signMessageForSpending(privateKey, message)spending-flavor signature over arbitrary bytes
verifySignatureForSpending(publicKey, signature, message)verified against a public key, returns Boolean
signChallenge(privateKey, message)challenge-flavor signature
verifyChallenge(...)verified against a bech32 address, returns Boolean

Transaction intents​

FunctionNotes
makeTransactionIntentMessageToSign(intent, transactionId)message bytes for an intent string + hex tx id
encodeSignedTransactionIntent(signedMessage, signatures)one challenge signature per input destination, in input order
verifyTransactionIntent(expectedSignedMessage, encodedSignedIntent, inputDestinations, network)returns Boolean

Fees​

All take (currentBlockHeight: UInt64, network) and return a decimal atom string: fungibleTokenIssuanceFee, nftIssuanceFee, tokenSupplyChangeFee, tokenFreezeFee, tokenChangeAuthorityFee, dataDepositFee.

Timelocks​

Each returns one timelock blob for the LockThenTransfer encoders: encodeLockForBlockCount(count), encodeLockForSeconds(seconds), encodeLockUntilTime(timestampSeconds), encodeLockUntilHeight(height).

Ids​

FunctionParametersReturns
getTokenIdissuance input blobs, currentBlockHeight, networkString (bech32)
getOrderIdorder creation input blobs, currentBlockHeightString
getDelegationIddelegation creation input blobs, currentBlockHeightString
getPoolIdpool creation input blobs, currentBlockHeightString

Staking​

FunctionNotes
encodeStakePoolData(value, staker, vrfPublicKey, decommissionKey, marginRatioPerThousand, costPerBlock, network)pool data blob for encodeOutputCreateStakePool
effectivePoolBalance(network, pledgeAmount, poolBalance)effective balance in atoms, accounting for the pledge
stakingPoolSpendMaturityBlockCount(network)blocks a stake spend must wait

Data formats​

  • Blobs (keys, inputs, outputs, witnesses, timelocks, transactions) cross the boundary as byte arrays in the runtime SCALE format — the same bytes the WASM wrappers produce and consume. Blobs are interchangeable with connect-sdk code.
  • Addresses and ids are bech32 strings: mtc1… (mainnet), tmt1… (testnet) for addresses; token, pool, delegation and order ids use their own prefixes (mdelg1…, etc.).
  • Amounts are decimal atom strings — 1 ML = 100,000,000,000 atoms. 128-bit atom counts do not fit in Kotlin Long or Swift Int, which is why strings are used. This is the main porting difference from JavaScript (see Migrating from WASM). Only ASCII digits are accepted; +, whitespace or scientific notation raise InvalidAmount.
  • Network is the Network enum: mainnet / testnet / regtest / signet (Network.TESTNET in Kotlin, .testnet in Swift).

Shared types​

TypeKindCases / fields
Networkenummainnet, testnet, regtest, signet
SourceIdenumTransaction, BlockReward
SignatureHashTypeenumAll, None, Single, AnyoneCanPay
TotalSupplyenumLockable, Unlimited, Fixed (requires supplyAmount)
FreezableTokenenumNo, Yes
TokenUnfreezableenumNo, Yes
SimpleCurrencyAmountenumCoins { atoms }, TokenAmount { tokenId, atoms }
ExtendedPrivateKeyDatarecordderivationPath: [UInt32], chainCode (32 bytes), publicKey, privateKey
TxAdditionalInforecordpoolInfo: [PoolAdditionalInfoEntry], orderInfo: [OrderAdditionalInfoEntry]
PoolAdditionalInfoEntryrecordid, stakerBalance (atoms)
OrderAdditionalInfoEntryrecordid, initiallyAsked, initiallyGiven, askBalance, giveBalance

TxAdditionalInfo is required by witness signing and partially signed transactions; it only needs entries for ProduceBlockFromStake, FillOrder or ConcludeOrder inputs (entries not referenced are harmless — an empty record is correct for ordinary transfers).

Errors​

Every fallible function throws BindingsException in Kotlin / BindingsError in Swift. Nothing panics across the FFI; there are no opaque strings. Variants (casing follows each language's conventions):

VariantMeaning
InvalidMnemonicthe BIP39 mnemonic could not be parsed
InvalidAmountamount is not a valid decimal digit string, or overflows
InvalidKeyIndexkey index has its most significant bit set
Decodinga runtime-format blob could not be decoded
AddressParsea bech32 address could not be parsed for the given network
InvalidTransactionIdmalformed transaction id
FixedTotalSupplyWithoutAmountfixed supply requested without a cap
InvalidTokenParameterstoken issuance parameters failed chain validation
InvalidNftCreatorPublicKeyNFT creator field is not a valid public key
InvalidMarginRatiopool margin ratio out of range
ZeroMultisigRequiredSignaturesmultisig requires at least one signature
InvalidHtlcSecretHash / UnexpectedHtlcSpendTypemalformed HTLC parameters
TransactionCreation / SignedTransactionCreation / PartiallySignedTransactionCreationtransaction assembly failed
InputSigning / Sighash / KeyDerivation / MessageSigning / SignatureVerificationsigning or verification failed
NoInputOutpointFound / InvalidWitnessCountwitness list does not match the transaction
SizeEstimation / EffectiveBalanceestimation overflowed
IntentVerification / IntentMessageNotUtf8intent message/verification failed
JsonJSON decoding failed

Pattern matching over the variants lets apps surface precise messages, e.g. distinguish a bad mnemonic from a wrong-network address at input time.