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

swapable

v1.0.2

Published

Swapable: Automated Liquidity Pools

Downloads

162

Readme

Swapable: Automated Liquidity Pools

npm version Build Status

The author of this package cannot be held responsible for any loss of money or any malintentioned usage forms of this package. Please use this package with caution.

This repository contains the source code for swapable, a peer-to-peer automated liquidity pool which enables smart digital markets.

Installation

npm install swapable

Usage

:warning: The following example usage for the swapable library is subject to change. :warning: This command execution creates at least one- or more than one - network-wide account restriction. Restrictions can potentially lock you out of your account, so please use this only with caution and only if you understand the risks.

import { AggregateTransaction, PublicAccount, SignedTransaction } from 'symbol-sdk'
import { MnemonicPassPhrase } from 'symbol-hd-wallets'
import { Swapable, NetworkConfig, TransactionParameters } from 'swapable'
import { TransactionURI } from 'symbol-uri-scheme'

// :warning: The following settings are network specific and may need changes
const transactionParams = new TransactionParameters(
  1573430400,
  Deadline.create(1573430400),
  750000, // maxFee
)

// :warning: You should create separate backups of
// providers and swapable assets pass phrases.
const assetKeys = MnemonicPassPhrase.createRandom() // backup the resulting 24-words safely!

// :warning: It is recommended to create provider
// keys offline and using a separate device.
const provider = new PublicAccount('PUBLIC_KEY_PROVIDER', 'ADDRESS_PROVIDER')

// initialize Swapable library
const reader = new Symbol.Reader(...)
const signer = new Symbol.Signer() 
const swapable = new Swapable.AutomatedPool(
  'SWP:XYM',
  reader,
  signer,
  assetKeys,
)

// offline creation of the `CreatePool` contract
const poolId = swapable.create(
  swapable.getTarget().publicAccount, // actor
  provider, // liquidity provider
  new AssetAmount(Symbol_Testnet_SWP, 10),
  new AssetAmount(Symbol_Testnet_XYM, 10),
  transactionParams,
)

// get the transaction URI for `CreatePool` execution
const resultURI: TransactionURI = swapable.result

// It is important to denote that given the **aggregate** nature of digital
// contracts, multiple parties MAY be involved in the transaction and
// it is therefor required to issue a HashLockTransaction before announcing
// the aggregate bonded transaction that represents the contract.

// :warning: It is recommended to sign the resulting transactions
// using a hardware wallet rather than any type of software generated
// wallets.

Donations / Pot de vin

Donations can also be made with cryptocurrencies and will be used for running the project!

NEM      (XEM):     NB72EM6TTSX72O47T3GQFL345AB5WYKIDODKPPYW
Symbol   (XYM):     NDQALDK4XWLOUYKPE7RDEWUI25YNRQ7VCGXMPCI
Ethereum (ETH):     0x7a846fd5Daa4b904caF7C59f866bb906153305D2
Bitcoin  (BTC):     3EVqgUqYFRYbf9RjhyjBgKXcEwAQxhaf6o

Sponsor us

| Platform | Sponsor Link | | --- | --- | | Paypal | https://paypal.me/usingblockchainltd | | Patreon | https://patreon.com/usingblockchainltd | | Github | https://github.com/sponsors/UsingBlockchain |

Credits

| Name | Contributions | | --- | --- | | Using Blockchain Ltd (@UsingBlockchain) [email protected] | Product Owner | | Grégory Saive (@eVias) | Lead Engineering |

License

Copyright 2020-2021 Using Blockchain Ltd, Reg No.: 12658136, United Kingdom, All rights reserved.

Licensed under the AGPL v3 License.