npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mantlexyz-oft-solana-sdk

v1.0.0

Published

SDK for Mantle OFT Solana program, providing sendWithdraw functionality

Downloads

14

Readme

mantlexyz-oft-solana-sdk

SDK for Mantle OFT Solana program, providing sendWithdraw functionality to handle pending message withdrawals.

Installation

npm install mantlexyz-oft-solana-sdk
# or
pnpm add mantlexyz-oft-solana-sdk

Usage

import { sendWithdraw, findPendingMessagePda, fetchPendingMessage } from "mantlexyz-oft-solana-sdk";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
import { createSignerFromKeypair, signerIdentity } from "@metaplex-foundation/umi";
import { fromWeb3JsKeypair } from "@metaplex-foundation/umi-web3js-adapters";
import { Keypair } from "@solana/web3.js";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { transactionBuilder, publicKey } from "@metaplex-foundation/umi";

const umi = createUmi("https://api.mainnet-beta.solana.com");

// Setup signer
const keypair = Keypair.fromSecretKey(/* your keypair */);
const umiKeypair = fromWeb3JsKeypair(keypair);
const signer = createSignerFromKeypair(umi, umiKeypair);
umi.use(signerIdentity(signer));

// Define program IDs
const oftProgramId = publicKey("YOUR_OFT_PROGRAM_ID");
const tokenProgramId = publicKey(TOKEN_PROGRAM_ID.toBase58());

// Define accounts
const oftStore = publicKey("YOUR_OFT_STORE_PDA");
const tokenMint = publicKey("YOUR_TOKEN_MINT");
const tokenEscrow = publicKey("YOUR_TOKEN_ESCROW");
const guid = new Uint8Array(32); // GUID from pending message

// Find pending message PDA
const [pendingMessagePda] = findPendingMessagePda(
  oftStore,
  guid,
  oftProgramId
);

// Fetch pending message to get creator
const pendingMessage = await fetchPendingMessage(
  umi,
  pendingMessagePda,
  oftProgramId
);

if (!pendingMessage) {
  throw new Error("Pending message not found");
}

// Build sendWithdraw instruction
const sendWithdrawIx = await sendWithdraw(
  umi.rpc,
  {
    payer: signer.publicKey,
    tokenMint,
    tokenEscrow,
    oftStore,
    pendingMessage: pendingMessagePda,
    creator: publicKey(pendingMessage.creator.toBase58()),
  },
  {
    guid,
    dstEid: 30110, // Destination EID
    to: new Uint8Array(32), // Recipient address (32 bytes)
    amountLd: 1000000n,
    minAmountLd: 950000n,
    options: new Uint8Array(),
    composeMsg: undefined,
    nativeFee: 1000000n,
    lzTokenFee: 0n,
  },
  {
    oft: oftProgramId,
    token: tokenProgramId,
  }
);

// Build and send transaction
const txBuilder = transactionBuilder()
  .add(sendWithdrawIx);

const result = await txBuilder.sendAndConfirm(umi, {
  confirm: { commitment: "confirmed" },
});

API

sendWithdraw

Builds a sendWithdraw instruction for the Mantle OFT program.

Parameters

  • rpc: RPC connection
  • accounts: Account information
    • payer: The payer/signer
    • tokenMint: Token mint address
    • tokenEscrow: Token escrow address
    • oftStore: OFT store PDA
    • pendingMessage: Pending message PDA
    • creator: Creator of the pending message (executor from lz_receive)
  • params: Send withdraw parameters
    • guid: The GUID of the pending message (32 bytes)
    • dstEid: Destination endpoint ID
    • to: Recipient address (32 bytes)
    • amountLd: Amount in local decimals
    • minAmountLd: Minimum amount to receive
    • options: LayerZero options
    • composeMsg: Optional compose message
    • nativeFee: Native fee
    • lzTokenFee: LZ token fee
  • programIds: Program IDs
    • oft: OFT program ID
    • token: Token program ID

Returns

A UMI instruction that can be added to a transaction builder.

findPendingMessagePda

Finds the PDA for a pending message account.

Parameters

  • oftStore: OFT store PDA
  • guid: GUID of the pending message (32 bytes)
  • programId: OFT program ID

Returns

[pda, bump] tuple

fetchPendingMessage

Fetches a pending message account from the blockchain.

Parameters

  • umi: UMI instance
  • pendingMessagePda: Pending message PDA
  • programId: OFT program ID

Returns

Pending message account data or null if not found

License

ISC