Socket
Book a DemoInstallSign in
Socket

@mmt-finance/ve-sdk

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mmt-finance/ve-sdk

A TypeScript SDK for interacting with the VeMMT protocol.

npmnpm
Version
0.0.1-beta.11
Version published
Weekly downloads
475
35.71%
Maintainers
5
Weekly downloads
 
Created
Source

VeMMT SDK

A TypeScript SDK for interacting with the VeMMT protocol.

QuickStart

View Functions (read-only operations)

import { getFullnodeUrl, SuiClient } from '@mysten/sui/client';
import { Transaction } from '@mysten/sui/transactions';
import { VeMMT } from '@mmt-finance/ve-sdk';

const client = new SuiClient({
  url: getFullnodeUrl('testnet'),
});

const ve = new VeMMT(client, 'testnet');

// View functions accept optional Transaction (null for new transaction)
const whitelistedIncentives = await ve.getAllWhitelistedIncentives(null);
console.log(JSON.stringify(whitelistedIncentives, null, 2));

Transaction Functions (mutate transactions in-place)

import { getFullnodeUrl, SuiClient } from '@mysten/sui/client';
import { Transaction } from '@mysten/sui/transactions';
import { VeMMT } from '@mmt-finance/ve-sdk';

const client = new SuiClient({
  url: getFullnodeUrl('testnet'),
});

const ve = new VeMMT(client, 'testnet');
const tx = new Transaction();

// Chain multiple operations on the same transaction
ve.createBond(tx, coinInput, unlockTime, recipient);
ve.addIncentive(tx, gaugeId, incentiveCoin, coinType);

// Execute the transaction
const result = await client.signAndExecuteTransaction({
  signer: keypair,
  transaction: tx,
});

Modules

Admin

  • createGauge(tx, pool, version, coinXType, coinYType): create a new gauge for a pool
  • setGaugePaused(tx, gaugeId, paused): pause/unpause a specific gauge
  • setGlobalPaused(tx, paused): pause/unpause the entire system globally
  • addIncentiveWhitelist(tx, coinType): add a coin type to the incentive whitelist
  • removeIncentiveWhitelist(tx, coinType): remove a coin type from the incentive whitelist
  • addWhitelistVoter(tx, voter): add a voter to the whitelist
  • setGaugeAdmin(tx, adminCap, newAdmin): set the gauge admin address
  • setGaugeOperator(tx, adminCap, newOperator): set the gauge operator address
  • setEpochPrologueMs(tx, prologueMs): set the epoch prologue duration
  • setEpochFinaleMs(tx, finaleMs): set the epoch finale duration
  • addClmmVeCap(tx, veCap): add VeCap
  • setVersion(tx, versionCap, major, minor): update the protocol version

Bond

  • createBond(tx, coin, unlockAt, recipient): create a new normal voting escrow bond
  • createMaxBond(tx, coin, recipient): create a new max bond voting escrow
  • createBondPreview(tx, bondAmount, unlockAt) [VIEW]: preview what a normal bond would contain without creating it
  • createMaxBondPreview(tx, bondAmount) [VIEW]: preview what a max bond would contain without creating it
  • addBalance(tx, veId, coin): add MMT balance to an existing voting escrow
  • extend(tx, veId, unlockAt): extend the unlock time of a normal bond
  • setMaxBond(tx, veId): convert a normal bond to max bond
  • setNormal(tx, veId): convert a max bond to normal bond
  • merge(tx, primaryVeId, mergedVeId): merge two voting escrow positions
  • unbond(tx, veId): unbond a voting escrow and retrieve MMT tokens

Claim

  • claimFeeForGauge(tx, veId, gaugeId, toEpoch, coinXType, coinYType, recipient): claim trading fees for a specific gauge
  • claimIncentiveForGauge(tx, veId, gaugeId, toEpoch, coinType, recipient): claim incentive rewards for a specific gauge

GaugeGlobals

  • getAllWhitelistedIncentives(tx) [VIEW]: get all whitelisted incentive token types from gauge globals
  • isWhitelistedIncentive(tx, incentiveType) [VIEW]: check if a specific incentive token type is whitelisted
  • isWhitelistedVoter(tx, voter) [VIEW]: check if a voter address is whitelisted
  • getGaugeGlobals(tx) [VIEW]: get gauge globals data
  • getGauge(tx, gaugeId) [VIEW]: get detailed information for a single gauge
  • getGauges(tx, offset, limit) [VIEW]: get gauge details with pagination
  • getGaugeGlobalsRewards(tx) [VIEW]: get global rewards data for all gauges

Gauge

  • getGaugeId(tx, gaugeId) [VIEW]: get gauge ID from gauge object
  • getPoolId(tx, gaugeId) [VIEW]: get pool ID associated with the gauge
  • getCoinXy(tx, gaugeId) [VIEW]: get coin X and coin Y types for the gauge
  • getCurrentEpochId(tx, gaugeId) [VIEW]: get current epoch ID of the gauge
  • getTotalVotePower(tx, gaugeId) [VIEW]: get total vote power of the gauge
  • getIncentiveTypes(tx, gaugeId) [VIEW]: get all incentive types for the gauge
  • getEpochHistoryIds(tx, gaugeId) [VIEW]: get epoch history IDs for the gauge
  • getPaused(tx, gaugeId) [VIEW]: check if gauge is paused
  • getBalance(tx, gaugeId, coinType) [VIEW]: get balance of specific coin type in gauge
  • getIncentiveEpochStart(tx, gaugeId, coinType) [VIEW]: get incentive epoch start for specific coin type
  • getCurrentFeeX(tx, gaugeId) [VIEW]: get current fee X amount
  • getCurrentFeeY(tx, gaugeId) [VIEW]: get current fee Y amount
  • getFeeLastClaimedMs(tx, gaugeId) [VIEW]: get last fee claimed timestamp
  • getCurrentIncentiveAmount(tx, gaugeId, coinType) [VIEW]: get current incentive amount for specific coin type

GaugeIncentive

  • addIncentive(tx, gaugeId, coin, coinType): add incentive tokens to a gauge

PoolReward

  • initializeEpochReward(tx, pool, coin, startTime, additionalSeconds, version): initialize epoch rewards for a pool
  • updateEpochReward(tx, pool, coin, additionalSeconds, version): update epoch rewards for a pool

Sync

  • syncGauge(tx, gaugeId, pool, version, coinXType, coinYType): synchronize a gauge with its corresponding pool

Vote

  • changeVotesBatch(tx, veId, votes): change existing votes across multiple gauges

VotingEscrow

  • getUserVotes(tx, veId) [VIEW]: get all user votes for gauges
  • getId(tx, veId) [VIEW]: get the voting escrow object ID
  • checkVoteClaimed(tx, veId, gaugeId, targetEpochId) [VIEW]: verify that rewards have been claimed for a gauge
  • getVotingEscrow(tx, veId) [VIEW]: get detailed voting escrow info for a single Voting Escrow
  • getVotingEscrows(owner, cursor, limit) [VIEW]: get voting escrow details with cursor-based pagination (same fields as getVotingEscrow)
  • queryAllVotingEscrows(owner) [QUERY]: get all voting escrow data with summary

VotePower

  • getMaxBondEpochs(tx) [VIEW]: get maximum number of epochs allowed for bond locks
  • getMaxBondMs(tx) [VIEW]: get maximum bond duration in milliseconds
  • getMaxBondBonus(tx) [VIEW]: get max-bond bonus multiplier
  • getVotePowerForRange(tx, amount, calculateAt, unlockAt) [VIEW]: calculate voting power for a time range
  • getVotePowerForEpochId(tx, amount, epochId, unlockAt) [VIEW]: calculate voting power starting from an epoch id
  • getVotePowerForMaxBond(tx, amount) [VIEW]: calculate voting power for max bond
  • getEffectiveVotePower(tx, votingPower, weight) [VIEW]: apply weight to voting power
  • getEffectiveAmount(tx, amount, weight) [VIEW]: apply weight to amount

Epoch

  • getEpochIntervalMs(tx) [VIEW]: get epoch interval in milliseconds
  • getEpochPrologueMs(tx) [VIEW]: get epoch prologue in milliseconds
  • getEpochFinaleMs(tx) [VIEW]: get epoch finale in milliseconds
  • getEpochId(tx, timestampMs) [VIEW]: get epoch id for a timestamp
  • isEpochStart(tx, timestampMs) [VIEW]: check if timestamp is an epoch start
  • getEpochStart(tx, epochId) [VIEW]: get epoch start timestamp
  • getEpochEnd(tx, epochId) [VIEW]: get epoch end timestamp
  • getEpochMainStart(tx, epochId) [VIEW]: get main phase start timestamp
  • getEpochFinaleStart(tx, epochId) [VIEW]: get finale phase start timestamp
  • convertToEpochStart(tx, timestampMs) [VIEW]: normalize timestamp to epoch start
  • convertToEpochEnd(tx, timestampMs) [VIEW]: normalize timestamp to epoch end
  • getEpochIdsForRange(tx, timestampMs1, timestampMs2) [VIEW]: get [epochId1, epochId2] for range
  • getCurrentEpochInfo(tx) [VIEW]: get current epoch information

FAQs

Package last updated on 06 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts