Skip to content

Useful JavaScript modules for Web3 and AirSwap network developers.

License

Notifications You must be signed in to change notification settings

carboclan/AirSwap.js

 
 

Repository files navigation

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 parties for both ERC20 and ERC721 (NFT) tokens. The new Swap contract lives on Rinkeby at 0x4E25e972AF14942d119275453CD2DB93B320607c and Kovan at 0x909Af82a14e78d1e8a187D88E6BBA8874f657ef5. Learn more about the Swap Protocol and Swap Contract.

import { swapSimple } from 'airswap.js/src/swap'
const result = swapSimple({ id, makerWallet, makerParam, makerToken,
  takerWallet, takerParam, 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.

About

Useful JavaScript modules for Web3 and AirSwap network developers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.9%
  • TypeScript 6.1%