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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@remarkabletools/mx-smartsend

v1.0.0

Published

⚡ MultiversX SmartSend TypeScript SDK: Library for interacting with Smart Send contracts on MultiversX blockchain

Downloads

2

Readme

Mx.NET.SDK.SmartSend

⚡ MultiversX SmartSend TypeScript SDK: Library for interacting with Smart Send contracts on MultiversX blockchain

How to install?

The content is delivered via npm package:

@remarkabletools/mx-smartsend

Main Features

  • Create EGLD/Token/MetaESDT/NFT/SFT transactions for Smart Send contracts

Quick start guide

Basic example

const provider = new ProxyNetworkProvider('https://devnet-gateway.multiversx.com')
const networkConfig = await provider.getNetworkConfig()

const myaddress = Address.fromBech32('MY_ADDRESS')
const accountOnNetwork = await provider.getAccount(myaddress)
const account = new Account(myaddress)
account.update(accountOnNetwork)

const smartSend = new SmartSend(account, networkConfig, 'MY_CONTRACT_BECH32_ADDRESS')

const inputTransactions = []
for (let i = 1; i < 10; i++) {
  inputTransactions.push(new TokenAmount('RECEIVER_ADDRESS', TokenTransfer.egldFromAmount('0.0' + i))) // TokenTransfer can also be fungibleFromAmount / metaEsdtFromAmount / nonFungible / semiFungible
}

try {
  const txs = smartSend.createEGLDTransactions(inputTransactions) // or createTokenTransactions / createMetaESDTTransactions / createNFTTransactions / createSFTTransactions
  // sign and send egldTxs
} catch (error) {
  console.log(error)
}

Advanced example

The following example is using a wallet signer that should not be used in production, only in private!

const provider = new ProxyNetworkProvider('https://devnet-gateway.multiversx.com')
const networkConfig = await provider.getNetworkConfig()

const myaddress = Address.fromBech32('MY_ADDRESS')
const accountOnNetwork = await provider.getAccount(myaddress)
const account = new Account(myaddress)
account.update(accountOnNetwork)

const pemText = await promises.readFile('/path/wallet.pem', { encoding: 'utf8' })
const signer = UserSigner.fromPem(pemText)

const smartSend = new SmartSend(account, networkConfig, 'MY_CONTRACT_BECH32_ADDRESS')

const inputTransactions = []
for (let i = 1; i < 10; i++) {
  inputTransactions.push(new TokenAmount('RECEIVER_ADDRESS', TokenTransfer.fungibleFromAmount('TOKEN-123456', i, 18))) // TokenTransfer can also be fungibleFromAmount / metaEsdtFromAmount / nonFungible / semiFungible
}

try {
  const tokenTxs = smartSend.createTokenTransactions(inputTransactions)
  for (const tx of tokenTxs) {
    const serializedTransaction = tx.serializeForSigning()
    const transactionSignature = await signer.sign(serializedTransaction)
    tx.applySignature(transactionSignature)
  }

  const response = await provider.sendTransactions(tokenTxs)
  console.log(response)
} catch (error) {
  console.log(error)
}