0.2.0 • Published 4 years ago

bswap.js v0.2.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
4 years ago

AirSwap Logo

Total alerts Language grade: JavaScript NPM version Discord Chat

AirSwap.js

Useful JavaScript modules for Web3 and AirSwap network developers.

Quick Start

yarn add airswap.js

Examples

For more complete examples and a demo web app, see the AirSwap.js-examples repository.

DexIndex Prices

DexIndex is a price aggregator for decentralized trading venues.

import { fetchDexIndexPrices } from 'airswap.js/src/dexIndex'
const prices = await fetchDexIndexPrices({ side, amount, symbol })

Token Metadata

ERC20 token metadata like images and descriptions.

import { fetchTokens } from 'airswap.js/src/tokens'
const tokens = await fetchTokens()

Token Balances

Fetch many balances or allowances for many addresses in a single call.

import { getManyBalancesManyAddresses } from 'airswap.js/src/deltaBalances'

Atomic Swaps

Perform a token swap between two parties for ERC20, ERC721 (NFT), and EIP1155 tokens. For more information on how this works and how to use it, read the whitepaper and check out the repository. For latest available contracts, see deployments.

import { swapSimple } from 'airswap.js/src/swap'
const result = swapSimple({ id, makerWallet, makerAmount, makerToken,
  takerWallet, takerAmount, takerToken,
  expiry, v, r, s })

Using Ethers

Ethereum wallet interactions often take a "signer" as a parameter. Learn more about Ethers and signers.

Module Structure

The top-level index.js includes the majority of the application code. It should be isomorphic to be used easily in both NodeJS and browser based applications. The redux folder includes the actions, reducers, and middleware in use by the module.

[submodule-name]
├── index.js
├── redux
│   ├── actions.js
│   ├── index.js
│   ├── middleware.js
└── └── reducers.js

License (Apache-2.0)

Copyright 2019 Swap Holdings Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.