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

@luffalab/luffa-endless-sdk

v1.1.9

Published

luffa endless ts sdk

Downloads

100

Readme

Luffa Wallet Endless SDK Usage Guide

This document is intended for integrating Luffa Wallet into web-based DApps or embedded WebView pages within mini-programs using @luffalab/luffa-endless-sdk and @endlesslab/endless-ts-sdk.


Installation

npm install @luffalab/luffa-endless-sdk
npm install @endlesslab/endless-ts-sdk

⚠️ For mini-programs: after installing @luffalab/luffa-endless-sdk, use the mini-program developer tool to compile the npm package.


Import Modules

import {
  Network,
  EntryFunctionABI,
  TypeTagAddress,
  TypeTagU128,
  AccountAddress,
  EndlessConfig,
  Endless,
  AccountAuthenticator,
  Hex,
  Deserializer,
} from '@endlesslab/endless-ts-sdk';

import {
  EndlessLuffaSdk,
  UserResponseStatus,
  EndlessSignAndSubmitTransactionInput,
  EndlessWalletTransactionType,
  EndLessSDKEvent,
} from '@luffalab/luffa-endless-sdk';

SDK Initialization

const jssdk = new EndlessLuffaSdk({
  network: 'testnet', // or 'mainnet'
});

Wallet Connection

Connect Wallet

const res = await jssdk.connect();
if (res.status === UserResponseStatus.APPROVED) {
  console.log('Account:', res.args.account);
}

Disconnect Wallet

jssdk.disconnect();
console.log('Disconnect success');

Get Current Account

const res = await jssdk.getAccount();
if (res.status === UserResponseStatus.APPROVED) {
  console.log('Current account:', res.args.account);
}

Signing Features

Sign Message

const res = await jssdk.signMessage({
  address: false,
  application: false,
  chainId: false,
  message: 'Welcome to dapp!',
  nonce: '1',
});
if (res.status === UserResponseStatus.APPROVED) {
  console.log(res.args);
}

Message format:

Endless::Message
message: Welcome to dapp!
nonce: 1

Return structure:

interface EndlessSignMessageOutput {
  address: string;
  application: string;
  chainId: number;
  fullMessage: string;
  message: string;
  nonce: string;
  prefix: string;
  signature: string;
}

Transaction Features

Sign and Submit Transaction

const abi: EntryFunctionABI = {
  typeParameters: [],
  parameters: [new TypeTagAddress(), new TypeTagU128()],
};

const txData: EndlessSignAndSubmitTransactionInput = {
  payload: {
    function: '0x1::endless_account::transfer',
    functionArguments: [
      AccountAddress.fromBs58String(toAccountAddress),
      BigInt(Number(transferAmount) * 1e8),
    ],
    abi,
  },
};

const res = await jssdk.signAndSubmitTransaction(txData);
if (res.status === UserResponseStatus.APPROVED) {
  console.log('Transaction submitted:', res);
}

Generic Transaction with typeArguments

const txData: EndlessSignAndSubmitTransactionInput = {
  payload: {
    function: '0x1::endless_account::transfer_coins',
    functionArguments: [
      AccountAddress.fromBs58String(toAccountAddress),
      BigInt(Number(transferAmount) * 1e8),
      coinAddress,
    ],
    typeArguments: ['0x1::fungible_asset::Metadata'],
  },
};

Mini-program Usage Notes

When using Luffa SDK inside a mini-program:

  • Do not use @endlesslab/endless-ts-sdk to construct transactions.
  • Do not use BigInt types — use string instead.
  • You must provide typeArguments explicitly.

Example:

const txData: EndlessSignAndSubmitTransactionInput = {
  payload: {
    function: '0x1::endless_account::transfer',
    functionArguments: [
      toAccountAddress, // string
      String(transferAmount * 1e8) // also string
    ],
    typeArguments: ['address', 'u128'],
  },
};

Sign Only (without Submit)

const config = new EndlessConfig({ network: Network.TESTNET });
const endless = new Endless(config);

const txn = await endless.transaction.build.simple({
  sender: accountAddress,
  data: txData.payload,
});
const hexTxn = txn.bcsToHex().toString();

const res = await jssdk.signTransaction(hexTxn, EndlessWalletTransactionType.SIMPLE);
if (res.status === UserResponseStatus.APPROVED) {
  const data = Hex.fromHexString(res.args.data).toUint8Array();
  const deserializer = new Deserializer(data);
  const auth = AccountAuthenticator.deserialize(deserializer);
  console.log('AccountAuthenticator:', auth);
}

Change Network

jssdk.changeNetwork({
  network: Network.MAINNET,
});

Event Listeners

jssdk.on(EndLessSDKEvent.CONNECT, (res) => {
  console.log('Wallet connected:', res);
});

jssdk.on(EndLessSDKEvent.DISCONNECT, () => {
  console.log('Wallet disconnected');
});

jssdk.on(EndLessSDKEvent.ACCOUNT_CHANGE, (res) => {
  console.log('Account changed:', res);
});

jssdk.on(EndLessSDKEvent.NETWORK_CHANGE, (networkInfo) => {
  console.log('Network changed:', networkInfo);
});

Notes

  • All amounts are in the smallest unit (e.g., 1 EDS = 1e8).
  • For generic ABI functions, make sure to manually provide typeArguments.
  • It is recommended to always use SDK methods for transactions instead of crafting them manually.

For additional features or technical support, please contact the Luffa team.