API

Constructor

Allows the SDK to be initiated with custom data.

How to use:

import { getFullnodeUrl } from '@mysten/sui/client';
import {
  MemezFunSDK,
  PACKAGES,
  SHARED_OBJECTS,
  Network,
} from '@interest-protocol/memez-fun-sdk';

const sdk = new MemezFunSDK({
  fullNodeUrl: getFullnodeUrl('mainnet'),
  network: Network.Mainnet,
  packages: PACKAGES[Network.Mainnet],
  sharedObjects: SHARED_OBJECTS[Network.Mainnet],
});

Arguments

newPumpPool

Creates a pool using the Pump invariant.

How to use:

const tx = new Transaction();

const creationSuiFee = tx.splitCoins(tx.gas, [tx.pure.u64(20)]);

const { tx: tx2, metadataCap } = memezTestnet.newPumpPool({
  tx,
  configurationKey,
  developer: recipient,
  metadata: {
    X: 'https://x.com/Aptos',
    Website: 'https://aptosfoundation.org/',
    GitHub: 'https://github.com/aptos-foundation',
  },
  creationSuiFee,
  memeCoinTreasuryCap: TREASURY_CAP,
  migrationWitness: MIGRATOR_WITNESSES.testnet.TEST,
  memeCoinType: MEME_COIN_TYPE,
  totalSupply: TOTAL_SUPPLY,
  useTokenStandard: false,
});

tx.transferObjects([metadataCap], tx.pure.address(recipient));

await executeTx(tx2);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • creationSuiFee {object} - The Sui fee to create a MemezPool.

  • memeCoinTreasuryCap {string} - The meme coin treasury cap.

  • totalSupply {string | number | bigint} - The total supply of the meme coin.

  • useTokenStandard {boolean} - Whether to use the token standard for the MemezPool.

  • firstPurchase {object} - Sui coin to do the first buy in the pool.

  • metadata {object} - A record of the social metadata of the meme coin.

  • developer {string} - The address that can claim the first purchased coins.

  • configurationKey {string} - The configuration key to use for the MemezPool.

  • migrationWitness {string} - The migration witness to use for the MemezPool.

  • memeCoinType {string} - The meme coin type to use for the MemezPool.

Return

pump

Swaps Sui for a meme coin in a pool.

How to use

const tx = new Transaction();

const suiCoin = tx.splitCoins(tx.gas, [tx.pure.u64(103n * POW_9)]);

const { memeCoin, tx: tx2 } = await memezTestnet.pump({
  pool: TEST_POOL_ID,
  suiCoin,
  tx,
});

tx2.transferObjects([memeCoin], keypair.toSuiAddress());

await executeTx(tx2);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • suiCoin {object} - The Sui coin to sell for the meme coin.

  • minAmountOut {string | number | bigint} - The minimum amount of meme coin expected to be received.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • memeCoin {object} - The meme coin bought.

dump

Swaps meme coin for Sui in a pool.

How to use

const tx = new Transaction();

const pool = await memezTestnet.getPumpPool(TEST_POOL_ID);

const memeCoin = await getCoinOfValue({
  tx,
  coinType: pool.memeCoinType,
  coinValue: 990500n * 10n,
});

const { suiCoin, tx: tx2 } = await memezTestnet.dump({
  pool: TEST_POOL_ID,
  memeCoin,
  tx,
});

tx2.transferObjects([suiCoin], keypair.toSuiAddress());

await executeTx(tx2);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • memeCoin {object} - The meme coin to sell for Sui coin.

  • minAmountOut {string | number | bigint} - The minimum amount of sui coin expected to be received.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • suiCoin {object} - The Sui coin bought.

pumpToken

Swaps Sui for the meme token using the Token Standard.

How to use

const tx = new Transaction();

const suiCoin = tx.splitCoins(tx.gas, [tx.pure.u64(105n * POW_9)]);

const { memeToken, tx: tx2 } = await memezTestnet.pumpToken({
  pool: TEST_POOL_ID,
  suiCoin,
  tx,
});

const { tx: tx3 } = await memezTestnet.keepToken({
  memeCoinType: MEME_COIN_TYPE,
  token: memeToken,
  tx: tx2,
});

await executeTx(tx3);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • suiCoin {object} - The Sui coin to sell for the meme coin.

  • minAmountOut {string | number | bigint} - The minimum amount meme coin expected to be received.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • memeToken {object} - The meme token bought.

dumpToken

Swaps the meme token for Sui.

How to use

const tx = new Transaction();

const { suiCoin, tx: tx2 } = await memezTestnet.dumpToken({
  pool: TEST_POOL_ID,
  memeToken:
      '0x0a256522091a350e3cc3ac86982608803bce754ede1199785227bfc822603b71',
  tx,
});

tx2.transferObjects([suiCoin], tx.pure.address(keypair.toSuiAddress()));

await executeTx(tx2);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • memeToken {object} - The meme token to sell for Sui coin.

  • minAmountOut {string | number | bigint} - The minimum amount sui coin expected to be received.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • suiCoin {object} - The Sui coin bought.

devClaim

Allows the developer to claim the first purchased coins. It can only be done after the pool migrates.

How to use

const { memeCoin, tx } = await memezTestnet.devClaim({
  pool: TEST_POOL_ID,
});

tx.transferObjects([memeCoin], keypair.toSuiAddress());

await executeTx(tx);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • memeCoin {object} - The meme coin bought by the developer during deployment.

keepToken

Utility function to return the Token to the sender.

How to use

const { tx: tx3 } = await memezTestnet.keepToken({
  memeCoinType: MEME_COIN_TYPE,
  token: memeToken,
  tx: tx2,
});

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • memeCoin {object} - The meme coin bought by the developer during deployment.

toCoin

Converts a meme token to a meme coin. This is for pools that use the Token Standard. It can only be done after the pool migrates.

How to use

const { memeCoin, tx } = await memezTestnet.toCoin({
  pool: TEST_POOL_ID,
  memeToken: TOKEN_ID,
});

tx.transferObjects([memeCoin], tx.pure.address(keypair.toSuiAddress()));

await executeTx(tx);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • memeToken {object} - The meme token to convert to a meme coin.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • memeCoin {object} - The meme coin converted from token.

migrate

Migrates the pool to DEX based on the MigrationWitness.

The migrator is a hot potato that needs to be consumed. Please use the Migrator SDK to consume and migrate to a DEX. At the moment, we only have a test migrator as Memez is deployed on testnet.

How to use

const { tx, migrator } = await memezTestnet.migrate({
  pool: TEST_POOL_ID,
});

const migratorSDK = new MigratorSDK();

const { tx: tx2 } = migratorSDK.migrate({
  tx,
  migrator,
  memeCoinType: MEME_COIN_TYPE,
});

await executeTx(tx2);

Arguments

  • tx {object} - Sui client Transaction class to chain move calls.

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

Return

  • tx {object} - Sui client Transaction class to chain move calls.

  • migrator {object} - The hot potato migrator containing the balances.

quotePump

Quotes the amount of meme coin received after selling Sui.

How to use

import { memezTestnet, POW_9, TEST_POOL_ID } from '../utils.script';

const { amountOut, swapFeeIn } = await memezTestnet.quotePump({
  pool: TEST_POOL_ID,
  amount: 15n * POW_9,
});
  
console.log({ amountOut, swapInFee });

Arguments

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • amount {string | number | bigint} - The amount of Sui being sold.

Return

  • amountOut {bigint} - The amount of meme coin that will be received.

  • swapFeeIn {bigint} - The swap fee paid in Sui.

quoteDump

Quotes the amount of Sui received after selling the meme coin.

How to use

import { memezTestnet, POW_9, TEST_POOL_ID } from '../utils.script';


const { amountOut, swapFeeIn, burnFee } = await memezTestnet.quoteDump({
  pool: TEST_POOL_ID,
  amount: 1_500_000n * POW_9,
});

console.log({ amountOut, swapFeeIn, burnFee });

Arguments

  • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

  • amount {string | number | bigint} - The amount of Mem coin being sold.

Return

  • amountOut {bigint} - The amount of Sui that will be received.

  • swapFeeIn {bigint} - The swap fee paid in Meme coin.

  • burnFee {bigint} - Burn fee in meme coin.

getFees

Returns the fee configuration for an integrator based on a configuration key.

How to use

import { CONFIG_KEYS } from '../../memez';
import { log, memezTestnet } from '../utils.script';


const fees = await memezTestnet.getFees({
    configurationKey: CONFIG_KEYS.testnet.DEFAULT,
});

log(fees);

Arguments

  • configurationKey {string} - The struct tag of a configuration key. E.g. package::module::Key

Return

  • MemezFee - Check the return type here.

getPumpData

Returns the Pump configuration for a specific integrator using a configuration key.

How to use

import { CONFIG_KEYS } from '../../memez';
import { log, memezTestnet } from '../utils.script';


const pumpData = await memezTestnet.getPumpData({
    configurationKey: CONFIG_KEYS.testnet.DEFAULT,
    totalSupply: 1e9 * 1e9,
 });

log(pumpData);

Arguments

  • configurationKey {string} - The struct tag of a configuration key. E.g. package::module::Key

  • totalSupply {string | bigint | number} - The total supply of the meme coin. E.g. 1 Sui would be 1e9.

Return

  • burnTax - The tax value of the burner in bps.

  • virtualLiquidity - The starting virtual liquidity in the pool in Sui.

  • targetSuiLiquidity - The amount of Sui required for the pool to migrate.

  • liquidityProvision - The amount of Meme coin that will be supplied to a DEX after migration.

Last updated

Was this helpful?