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

stellar-token

v1.1.2

Published

Here is simple stellar based token operations, which helps deveopers to create and issue token (ico) simpaly.

Downloads

5

Readme

Stellar Token

Build Status

This is Simple Stellar Based Token module, which allow its developer to issue stellar based ICO, wallet, trade and many more.

New Features!

  • You can create ICO by just providing your Token name, supply and publish it from issuing account to distributor account.
  • you can permanently block your issuing account so you can make sure no one issue more token afterword, in order to overcome trust issue by creating more token than total supply.
  • you can create trust for your buyer, so he can trade your token
  • you can create wallet for your buyer
  • buyer can trade your token easily

Tech

links for information and overview about stellar project

Installation

Install the dependencies.

npm i stellar-token --save or yarn add stellar-token

How to create wallet and fund test Token (public key private key)

  • you can create wallet and get private and public key.
import {CreateWallet} from "stellar-token";

let issuingWallet = new Wallet();

console.log( issuingWallet.getPrivateKey(),issuingWallet.getPublicKey())

// in order to fundtest account use , but for mainNet you have to use real XLM

await issuingWallet.fundTestAmount()

How to create new token and transfer it to the distributor account.

  • first you need to create two account issuer account who will issue a token, and distributor account who is responsible in order to distribute your token. And use private key as given below example.
import {StellarToken} from "stellar-token";

// make sure this keys are very confidential so don\'t use it directly, instead you should use env or other key management mechanism

// feel free to use given keys, however this keys i used as testing so issuing keys are blocked already. so you can not create more token, it will throw exception. So i recommend you to create new token by using create token class and fund it buy using

fundTestAmount() for test net

let issuingKeys = "SDDXF3KY4NXXDOBIZNOH76ONXYE5GUNONJZR7N5B23GVKDOY2NQQO7O5";

let distributor = "SAZMHZM6NYVYRV53GV2LDWUKUL2TMG46HPUTE5CTZD2TAV3G375MJTPH";

let tokenName = "TESTT";
  • make sure you have funded your account with xlm for more info ping issuing asset. Unless your account will not appear on stellar database, and you are not able to use your private keys
  • now create instance of your class and provide following constructor argument 'StallerToken.StellarToken(tokenName,issungPublicKey,networkType)'.default networkType is test if you want to use mainNet then pass "main" in third argument. use folling example
import {StallerToken,CreateWallet} from "stellar-token";

let issuingKeys = "SDDXF3KY4NXXDOBIZNOH76ONXYE5GUNONJZR7N5B23GVKDOY2NQQO7O5";

let issuingPublicKey =
"GAZPNXHR26OE44VR7OITWXFI7KGKJCTV5JBB3VSAOWWDJ7X4HYQU6BMD";

let distributor = "SAZMHZM6NYVYRV53GV2LDWUKUL2TMG46HPUTE5CTZD2TAV3G375MJTPH";

let distributorPublicKey =
"GBMX77MCYNMSAKH5NULCSUNBZFAGAFTMYX2ZCYQ5G3ASZ54M2J3BEQUE";

let tokenName = "TESTT";

let totalSupply = "10000"

const st = new StellarToken(
tokenName,
issuingPublicKey,
"test", // use "main" for mainNet, we are currently using "test" net
);

(async () => {
try {
let createTrust = await newToken.createTrust(distributor); // create trust by distributor account

let issueToken = await newToken.issueToken(
issuingKeys,
totalSupply,
distributorPublicKey,
);

let limitSupply = await newToken.limitSupply(issuingKeys); // if you want to limit supply of your token then use limitSupply(issuingKeys) but it is not mandatory.
}
catch (e) {}

})();
warning: if you will use limitSupply your issuer private key's weight will be 0 so you won't be able to use this private key furthermore. Ping options for more information.

check balance of your new token by using distributor public key

  • you can check your balance by using static method of StallerToken class
import {StallerToken} from "stellar-token";

let distributorPublicKey =
"GBMX77MCYNMSAKH5NULCSUNBZFAGAFTMYX2ZCYQ5G3ASZ54M2J3BEQUE";

const {balances} = await StallerToken.getBalance(distributorPublicKey,"test") // second argument is for network use "main" for mai net

How to Trade and issue ICO with fixed price

sell your token
  • in order to sell your token to the public first you have to sell your token from your distributor account.
  • price will be in native token
import {TradeToken} from "stellar-token";
let distributor = "SAZMHZM6NYVYRV53GV2LDWUKUL2TMG46HPUTE5CTZD2TAV3G375MJTPH";

let issuingPublicKey =
"GAZPNXHR26OE44VR7OITWXFI7KGKJCTV5JBB3VSAOWWDJ7X4HYQU6BMD";

let sell = new TradeToken(
tokenName,
issuingPublicKey,
"test", // network testNet
distributor, // seller private key in our case all token is transfer to distributor account.
);

const res = await sell.sellToken({ amount: "50000", price: 10 })
// amount of your token and price will be in (XLM) native token. It means you are selling 50000 of your token with 10 xlm for each.
math 50000\*10 = 500000 worth of xml you are selling
tip: sell half of your total supply
buy token
  • now you have sold your token from distributor account now time to make interface that buyer can buy your token. Before buying make sure buyers have sufficient xlm in their account. In example make sure buyer Key have minimum 200*10 = 2000 xlm.
import {TradeToken} from "stellar-token";
let buyerKey = "SAZMHZM6NYVYRV53GV2LDWUKUL2TMG46HPUTE5CTZD2TAV3G375MJTPH";

let issuingPublicKey =
"GAZPNXHR26OE44VR7OITWXFI7KGKJCTV5JBB3VSAOWWDJ7X4HYQU6BMD";

let buyToken = new TradeToken(
tokenName,
issuingPublicKey,
"test", // network testNet
buyerKey, // buyer account can buy your token.
);

//you can check balance and has trusred or not before buying
let balance = await buyToken.getBalance();

// before buying token buyer have to create trust wi
th your token
let createTrust = await buyToken.createTrust();

const res = await buyToken.buyToken({ buyAmount: "200", price: 10 });
get offer details
  • you can also reftrive all of your offer details, by simply using getAccountOffers() method of CreateWallet's class.
  • you can provide filter by passing filter value on first parameter of getAccountOffers(). ex:- getAccountOffers({ limit: 2 }) here is interface for filters. cursor will skip order up to given order number.
interface orderDetailsOptions {
  limit?: number;
  cursor?: string;
  order?: "asc" | "desc";
}
  • second perameter should be callBack if you want to listen offer events, it will listen live offer details. ex:-getAccountOffers(undefined,(e)=>console.log(e))
import {CreateWallet} from "stellar-token";
let myKey = "SAZMHZM6NYVYRV53GV2LDWUKUL2TMG46HPUTE5CTZD2TAV3G375MJTPH";

let issuingPublicKey =
"GAZPNXHR26OE44VR7OITWXFI7KGKJCTV5JBB3VSAOWWDJ7X4HYQU6BMD";

let myToken = new TradeToken(
tokenName,
issuingPublicKey,
"test", // network testNet
myKey,
);
let orderDetails = await myToken.getAccountOffers({ limit: 2 });
let orderDetails = await myToken.getAccountOffers({ limit: 2,cursor:"orderid ex 1234" });
let orderDetails = await myToken.getAccountOffers({ limit: 2 },yourCallback);

Upcoming version

  • Transfer your token to receiver
  • retrieve your token's current price
  • cancel your order.

License

MIT

LinkedIn URL https://www.linkedin.com/in/manan-desai-765233110/

Contact [email protected]

Donate and support staller staller adress: GAHK7EEG2WWHVKDNT4CEQFZGKF2LGDSW2IVM4S5DP42RBW3K6BTODB4A

memo:1031799814

paypal

PayPal this