# Pump API

### <mark style="color:yellow;">Constructor</mark>

Allows the SDK to be initiated with custom data.

* [Example](https://github.com/interest-protocol/sdk-monorepo/blob/main/scripts/memez-fun/utils.script.ts#L37)
* [Pump SDK Implementation ](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L54)

#### How to use:

```typescript
import { getFullnodeUrl } from '@mysten/sui/client';
import {
  MemezPumpSDK,
  Network,
} from '@interest-protocol/memez-fun-sdk';

const payload = {
  network: Network.MAINNET,
  fullNodeUrl: getFullnodeUrl(Network.MAINNET),
};

const memezPump = new MemezPumpSDK(payload);
```

#### Arguments

* <mark style="color:yellow;">**fullNodeUrl {string} -**</mark> Url to initiate the Sui Client RPC.
* <mark style="color:yellow;">**network {Enum} -**</mark> [Enum denoting if its mainnet or testnet](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/memez/memez.types.ts#L18)

### <mark style="color:yellow;">newPumpPool</mark>

Creates a pool using the Pump invariant.&#x20;

* [Example](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/scripts/memez/pump/new.ts)
* [Implementation](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L83)

#### How to use:

```typescript
  const recipient = keypair.toSuiAddress();

  const tx = new Transaction();

  const [creationSuiFee, firstPurchase] = tx.splitCoins(tx.gas, [
    tx.pure.u64(30_000_000n),
    tx.pure.u64(1_000_000_000n),
  ]);

  const { metadataCap } = await memezPumpTestnet.newPool({
    tx,
    configurationKey,
    metadata: {
      X: 'https://x.com/Meme',
      Website: 'https://meme.xyz/',
      GitHub: 'https://github.com/meme',
      videoUrl: 'https://memez.gg',
    },
    creationSuiFee,
    memeCoinTreasuryCap: TREASURY_CAP,
    firstPurchase,
    developer: recipient,
    migrationWitness: MIGRATOR_WITNESSES.testnet.TEST,
    totalSupply: TOTAL_SUPPLY,
    quoteCoinType: SUI_TYPE_ARG,
  });
  tx.transferObjects([metadataCap], tx.pure.address(recipient));

  await executeTx(tx);
```

#### Arguments

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**creationSuiFee {object} -**</mark> The Sui fee to create a MemezPool.
* <mark style="color:yellow;">**memeCoinTreasuryCap {string} -**</mark> The meme coin treasury cap.
* <mark style="color:yellow;">**totalSupply {string | number | bigint} -**</mark> The total supply of the meme coin.
* <mark style="color:yellow;">**isProtected {boolean} -**</mark> Whether to use pool requires a server signature authorization for users to buy coins.
* <mark style="color:yellow;">**developer {string} -**</mark> The address that can claim the dev meme coin purchase and collect post bonding fees on Bluefin.&#x20;
* <mark style="color:yellow;">**firstPurchase {object} -**</mark> A Sui coin object to place the first meme coin purchase.
* <mark style="color:yellow;">**metadata {object} -**</mark> A record of the social metadata of the meme coin.
* <mark style="color:yellow;">**configurationKey {string} -**</mark> The configuration key to use for the MemezPool.
* <mark style="color:yellow;">**migrationWitness {string} -**</mark> The migration witness to use for the MemezPool.
* <mark style="color:yellow;">**stakeholders {string\[]} -**</mark> The addresses of the stakeholders. It can be empty or undefined.
* <mark style="color:yellow;">**quoteCoinType {string} -**</mark> The quote coin type to use for the MemezPool.
* <mark style="color:yellow;">**burnTax {number} -**</mark> The amount of meme coin that will be burnt during sales in basis points.
* <mark style="color:yellow;">**virtualLiquidity {string | number | bigint} -**</mark> The initial virtual liquidity in the pool.
* <mark style="color:yellow;">**targetQuoteLiquidity {string | number | bigint} -**</mark> The amount of Sui the pool needs to collect to migrate the coin.
* <mark style="color:yellow;">**liquidityProvision {number} -**</mark> The percentage of meme coin that will be added as liquidity after migration. It is expressed in basis points.

#### Return

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**metadataCap {object} -**</mark> The metadata object.
  * [Check out the IPX Treasury standard](/overview/sui/ipx-coin-standard.md)

### <mark style="color:yellow;">pump</mark>

Swaps quote coin for a meme coin in a pool.&#x20;

* [Example](https://github.com/interest-protocol/sdk-monorepo/blob/main/scripts/memez-fun/pump/pump.ts)
* [Implementation](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L535)

#### How to use

```typescript
import { coinWithBalance, Transaction } from '@mysten/sui/transactions';

import { getEnv } from '../utils.script';

(async () => {
  const tx = new Transaction();

  const { pumpSdk, executeTx, testnetPoolId, keypair } = await getEnv();

  const quoteCoin = coinWithBalance({
    balance: 100,
    type: '0x2::sui::SUI',
  });

  const { memeCoin, tx: tx2 } = await pumpSdk.pump({
    pool: testnetPoolId,
    quoteCoin,
    tx,
  });

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

  await executeTx(tx2);
})();
```

#### Arguments

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**pool {string | object} -**</mark> The objectId of the MemezPool or the full parsed pool.
* <mark style="color:yellow;">**quoteCoin {object} -**</mark> The quote coin to sell for the meme coin.
* <mark style="color:yellow;">**referrer {string | null} -**</mark> The address of the referrer.
* <mark style="color:yellow;">**signature {string | null} -**</mark> The server signature. It is required for protected pools.
* <mark style="color:yellow;">**minAmountOut {string | number | bigint} -**</mark> The minimum amount of meme coin expected to be received.

#### Return

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**memeCoin {object} -**</mark> The meme coin bought.

### <mark style="color:yellow;">dump</mark>

Swaps meme coin for quote coin in a pool.&#x20;

* [Example](https://github.com/interest-protocol/sdk-monorepo/blob/main/scripts/memez-fun/pump/dump.ts)
* [Implementation](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L603)

#### How to use

```typescript
import { coinWithBalance, Transaction } from '@mysten/sui/transactions';

import { getEnv } from '../utils.script';

(async () => {
  const tx = new Transaction();

  const { pumpSdk, executeTx, testnetPoolId, keypair } = await getEnv();

  const pool = await pumpSdk.getPumpPool(testnetPoolId);

  const memeCoin = coinWithBalance({
    balance: 100n,
    type: pool.memeCoinType,
  })(tx);

  const { quoteCoin, tx: tx2 } = await pumpSdk.dump({
    pool: testnetPoolId,
    memeCoin,
    tx,
    referrer:
      '0x894261575b948c035d002adc3ca4d73c683c01a1bfafac183870940bf9afef1a',
  });

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

  await executeTx(tx2);
})();
```

#### Arguments

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**pool {string | object} -**</mark> The objectId of the MemezPool or the full parsed pool.
* <mark style="color:yellow;">**memeCoin {object} -**</mark> The meme coin to sell for Sui coin.
* <mark style="color:yellow;">**referrer {string | null} -**</mark> The address of the referrer.
* <mark style="color:yellow;">**minAmountOut {string | number | bigint} -**</mark> The minimum amount of sui coin expected to be received.

#### Return

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**quoteCoin {object} -**</mark> The Quote coin bought.

### <mark style="color:yellow;">devClaim</mark>

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

* [Example](https://github.com/interest-protocol/sdk-monorepo/blob/main/scripts/memez-fun/pump/dev-claim.ts)
* [Implementation](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L661)

#### How to use

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

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

await executeTx(tx);
```

#### Arguments

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**pool {string | object} -**</mark> The objectId of the MemezPool or the full parsed pool.

#### Return

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**memeCoin {object} -**</mark> The meme coin bought by the developer during deployment.

### <mark style="color:yellow;">migrate</mark>

Migrates the pool to DEX based on the MigrationWitness.

* [Example](https://github.com/interest-protocol/sdk-monorepo/blob/main/scripts/memez-fun/xpump-migrator/migrate.ts)
* [Implementation](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L695)

{% hint style="warning" %}
The migrator is a hot potato that needs to be consumed. Please use the [Migrator SDK](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/memez/migrator.ts) to consume and migrate to a DEX.&#x20;
{% endhint %}

#### How to use

```typescript
const { tx, migrator } = await pumpSdk.migrate({
  pool: testnetPoolId,
});

const fee = tx.splitCoins(tx.gas, [0n]);

const { tx: tx2, suiCoin } = await xPumpMigratorSdk.migrate({
  tx,
  migrator,
  memeCoinType: pool.memeCoinType,
  feeCoinType: SUI_TYPE_ARG,
  feeCoin: fee,
  ipxMemeCoinTreasury: pool.ipxMemeCoinTreasury,
  quoteCoinType: pool.quoteCoinType,
});

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

await executeTx(tx2);
```

#### Arguments

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**pool {string | object} -**</mark> The objectId of the MemezPool or the full parsed pool.

#### Return

* <mark style="color:yellow;">**tx {object} -**</mark> Sui client Transaction class to chain move calls.
* <mark style="color:yellow;">**migrator {object} -**</mark> The hot potato migrator containing the balances.

### <mark style="color:yellow;">quotePump</mark>

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

* [Example](https://github.com/interest-protocol/sdk-monorepo/blob/main/scripts/memez-fun/pump/quote-pump.ts)
* [Implementation](https://github.com/interest-protocol/sdk-monorepo/blob/main/packages/memez-fun-sdk/src/pump.ts#L769)

#### How to use

```typescript
const { memeAmountOut, quoteFee, memeFee } = await memezPumpSdk.quotePump({
  pool: POOL_ID,
  amount: 15n * POW_9,
});
```

#### Arguments

* <mark style="color:yellow;">**pool {string | object} -**</mark> The objectId of the MemezPool or the full parsed pool.
* <mark style="color:yellow;">**amount {string | number | bigint} -**</mark> The amount of Sui being sold.

#### Return

* <mark style="color:yellow;">**memeAmountOut {bigint} -**</mark> The amount of meme coin that will be received.
* <mark style="color:yellow;">**quoteFee {bigint} -**</mark> The swap fee paid in the Quote coin.
* <mark style="color:yellow;">**memeFee {bigint} -**</mark> The swap fee paid in Meme coin.

### <mark style="color:yellow;">quoteDump</mark>

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

* [Example](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/scripts/memez/pump/quote-dump.ts)
* [Implementation](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/memez/pump.ts#L540)

#### How to use

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


const { amountOut, quoteFee, memeFee, burnFee } = await memezPumpTestnet.quoteDump({
  pool: TEST_POOL_ID,
  amount: 1_500_000n * POW_9,
});
```

#### Arguments

* <mark style="color:yellow;">**pool {string | object} -**</mark> The objectId of the MemezPool or the full parsed pool.
* <mark style="color:yellow;">**amount {string | number | bigint} -**</mark> The amount of Meme coin being sold.

#### Return

* <mark style="color:yellow;">**quoteAmountOut {bigint} -**</mark> The amount of quote coin that will be received.
* <mark style="color:yellow;">**quoteFee {bigint} -**</mark> The swap fee paid in the Quote coin.
* <mark style="color:yellow;">**memeFee {bigint} -**</mark> The swap fee paid in Meme coin.
* <mark style="color:yellow;">**burnFee {bigint} -**</mark> Burn fee in meme coin.

### <mark style="color:yellow;">getPumpData</mark>

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

* [Example](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/scripts/config/get-pump-data.ts)
* [Implementation](https://github.com/interest-protocol/memez.gg-sdk/blob/main/src/memez/pump.ts#L631)

#### How to use

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


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

#### Arguments

* <mark style="color:yellow;">**configurationKey {string} -**</mark> The struct tag of a configuration key. E.g. package::module::Key
* <mark style="color:yellow;">**totalSupply {string | bigint | number} -**</mark> The total supply of the meme coin. E.g. 1 Sui would be 1e9.
* <mark style="color:yellow;">**quoteCoin {string} -**</mark> The total supply of the meme coin. E.g. 1 Sui would be 1e9.

#### Return

* <mark style="color:yellow;">**burnTax -**</mark> The tax value of the burner in bps.
* <mark style="color:yellow;">**virtualLiquidity -**</mark> The starting virtual liquidity in the pool in Sui.
* <mark style="color:yellow;">**targetQuoteLiquidity -**</mark> The amount of quote required for the pool to migrate.
* <mark style="color:yellow;">**liquidityProvision -**</mark> The amount of Meme coin that will be supplied to a DEX after migration.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.interestprotocol.com/overview/sui/memez.gg/memez.fun/sdk/pump-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
