Locks a specified amount of tokens of a metagraph token or DAG.
Parameters
Name
Type
Description
Data
Object<TokenLock>
The token lock object.
TokenLock
type TokenLock = {
source: string; // Wallet address signing the transaction
amount: number; // The amount to lock
// Must be in DATUM
currencyId: string | null; // The currency metagraph identifier that the user wants to lock
// For DAG, this field must be null
fee?: number; // The fee in the currency of the currency metragraph, or DAG.
// If not provided, the default fee will be 0
// Must be in DATUM
unlockEpoch: number | null; // The global snapshot epoch progress to unlock the tokens
// If provided, must be greater than the currentEpoch
};
The currentEpoch value can be pulled from the latest global snapshot. You can use dag4.js to easily get it: