Catalog npm
Back to packageRELEASE DETAILS

3.0.3

npm

@0x/asset-swapper

Convenience package for discovering and buying assets on-chain and off-chain.

Published6 Jan 2020
Direct dependencies37
Transitive dependenciesNot calculated

README

Current package documentation

@0x/asset-swapper

Convenience package for swapping assets represented on the Ethereum blockchain using 0x. The package helps to perform all the off-chain computations to execute a marketBuy or marketSell function execution with 0x exchange contracts, or 0x extension contracts. Given some liquidity (0x signed orders), it helps estimate the cost of buying or selling a certain asset (giving a range) and then provide varying consumable outputs to execute the buy or sell.

Asset-swapper integrates with the Standard Relayer API(in the future Mesh as well) and takes care of sourcing liquidity, order-pruning, and order-validation. The final result is a library that tells you what assets are available, provides a quote based on specified assets, and provide varying consumable metadata that can be used both on-chain in smart contracts or off-chain through web3 to swap a desired amount of ERC20 for another ERC20 asset.

Installation

yarn add @0x/asset-swapper

Import

import { SwapQuoter } from '@0x/asset-swapper';

or

var SwapQuoter = require('@0x/asset-swapper').SwapQuoter;
var SwapQuoteConsumer = require('@0x/asset-swapper').SwapQuoteConsumer;

If your project is in TypeScript, add the following to your tsconfig.json:

"compilerOptions": {
    "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}

Contributing

We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.

Please read our contribution guidelines before getting started.

Install dependencies

If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:

yarn config set workspaces-experimental true

Then install dependencies

yarn install

Build

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

PKG=@0x/asset-swapper yarn build

Or continuously rebuild on change:

PKG=@0x/asset-swapper yarn watch

Clean

yarn clean

Lint

yarn lint

Run Tests

yarn test

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 37

Native requirements
37 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
lodash
Environment
{
  "local_name": "lodash",
  "alias": false,
  "peer_metadata": null
}
^4.17.11runtime
@0x/utils
Environment
{
  "local_name": "@0x/utils",
  "alias": false,
  "peer_metadata": null
}
^5.1.2runtime
@0x/assert
Environment
{
  "local_name": "@0x/assert",
  "alias": false,
  "peer_metadata": null
}
^3.0.3runtime
heartbeats
Environment
{
  "local_name": "heartbeats",
  "alias": false,
  "peer_metadata": null
}
^5.0.1runtime
@0x/orderbook
Environment
{
  "local_name": "@0x/orderbook",
  "alias": false,
  "peer_metadata": null
}
^2.0.1runtime
@0x/order-utils
Environment
{
  "local_name": "@0x/order-utils",
  "alias": false,
  "peer_metadata": null
}
^10.1.0runtime
@0x/json-schemas
Environment
{
  "local_name": "@0x/json-schemas",
  "alias": false,
  "peer_metadata": null
}
^5.0.3runtime
@0x/web3-wrapper
Environment
{
  "local_name": "@0x/web3-wrapper",
  "alias": false,
  "peer_metadata": null
}
^7.0.3runtime
@0x/contract-wrappers
Environment
{
  "local_name": "@0x/contract-wrappers",
  "alias": false,
  "peer_metadata": null
}
^13.3.0runtime
@0x/contract-addresses
Environment
{
  "local_name": "@0x/contract-addresses",
  "alias": false,
  "peer_metadata": null
}
^4.2.0runtime
nyc
Environment
{
  "local_name": "nyc",
  "alias": false,
  "peer_metadata": null
}
^11.0.1development
shx
Environment
{
  "local_name": "shx",
  "alias": false,
  "peer_metadata": null
}
^0.2.2development
chai
Environment
{
  "local_name": "chai",
  "alias": false,
  "peer_metadata": null
}
^4.0.1development
mocha
Environment
{
  "local_name": "mocha",
  "alias": false,
  "peer_metadata": null
}
^6.2.0development
tslint
Environment
{
  "local_name": "tslint",
  "alias": false,
  "peer_metadata": null
}
5.11.0development
typedoc
Environment
{
  "local_name": "typedoc",
  "alias": false,
  "peer_metadata": null
}
^0.15.0development
typemoq
Environment
{
  "local_name": "typemoq",
  "alias": false,
  "peer_metadata": null
}
^2.1.0development
@0x/types
Environment
{
  "local_name": "@0x/types",
  "alias": false,
  "peer_metadata": null
}
^3.1.1development
dirty-chai
Environment
{
  "local_name": "dirty-chai",
  "alias": false,
  "peer_metadata": null
}
^2.0.1development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
3.0.1development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
*development
npm-run-all
Environment
{
  "local_name": "npm-run-all",
  "alias": false,
  "peer_metadata": null
}
^4.1.2development
@types/mocha
Environment
{
  "local_name": "@types/mocha",
  "alias": false,
  "peer_metadata": null
}
^5.2.7development
@0x/dev-utils
Environment
{
  "local_name": "@0x/dev-utils",
  "alias": false,
  "peer_metadata": null
}
^3.1.0development
@types/lodash
Environment
{
  "local_name": "@types/lodash",
  "alias": false,
  "peer_metadata": null
}
4.14.104development
@0x/migrations
Environment
{
  "local_name": "@0x/migrations",
  "alias": false,
  "peer_metadata": null
}
^5.1.0development
@0x/ts-doc-gen
Environment
{
  "local_name": "@0x/ts-doc-gen",
  "alias": false,
  "peer_metadata": null
}
^0.0.22development
chai-bignumber
Environment
{
  "local_name": "chai-bignumber",
  "alias": false,
  "peer_metadata": null
}
^3.0.0development
ethereum-types
Environment
{
  "local_name": "ethereum-types",
  "alias": false,
  "peer_metadata": null
}
^3.0.0development
@0x/subproviders
Environment
{
  "local_name": "@0x/subproviders",
  "alias": false,
  "peer_metadata": null
}
^6.0.3development
chai-as-promised
Environment
{
  "local_name": "chai-as-promised",
  "alias": false,
  "peer_metadata": null
}
^7.1.0development
@0x/base-contract
Environment
{
  "local_name": "@0x/base-contract",
  "alias": false,
  "peer_metadata": null
}
^6.0.3development
@0x/tslint-config
Environment
{
  "local_name": "@0x/tslint-config",
  "alias": false,
  "peer_metadata": null
}
^4.0.0development
make-promises-safe
Environment
{
  "local_name": "make-promises-safe",
  "alias": false,
  "peer_metadata": null
}
^1.1.0development
@0x/mesh-rpc-client
Environment
{
  "local_name": "@0x/mesh-rpc-client",
  "alias": false,
  "peer_metadata": null
}
^7.0.4-beta-0xv3development
@0x/typescript-typings
Environment
{
  "local_name": "@0x/typescript-typings",
  "alias": false,
  "peer_metadata": null
}
^5.0.1development
@0x/contracts-test-utils
Environment
{
  "local_name": "@0x/contracts-test-utils",
  "alias": false,
  "peer_metadata": null
}
^5.1.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "824ba002eacfaa297da9679c5d9e274543882edb",
  "tarball": "https://registry.npmjs.org/@0x/asset-swapper/-/asset-swapper-3.0.3.tgz",
  "fileCount": 109,
  "integrity": "sha512-GzmVhcmm/0eKNna1sGqBUIWfwr6eA6Xja3hvo0cbqlJ6CwhPqE95xyVMFVf9AP236jyjLbVTEFBXkQfsJSD2IA==",
  "signatures": [
    {
      "sig": "MEYCIQDSToPI7B5WkBy/6Ma7J88eI1CYgAgccPTDErOHT8U+7AIhAODWfi01dnpyJf2wrhySRvzlBAc+0EGs9YcNjJfNQhNk",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 342663,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeEolGCRA9TVsSAnZWagAASYcQAJtCQe8Vqrqtchb27bw8\ndQTGQGzTr95+OcX8MJneTqEZnH0gnIVa+xqggyi9YC+Z1qPjS8l3UHv/hrJA\n1yLZYrAyXEPOLKv1VRpB6eGfxhlUvL/kk7uxgsIS+H9UobfOhVFoCEVZubM/\nRuPxE23zpqxxDyLlXaim9x3fOrvU1jPrupoBQYUDiHthMMszZLAnbAMekGrc\nF0Nvr7rUrmlDFxVdCFGelNKYSNw7rnIHL7rx5XQEjrrWFog0V3Duey/4059p\nqcUerUKve4k9VlA2RvDAVyEeHRUQpYTFIrn8XqrItvuCqtC1lWog5ZRliW8P\ny4fYg8MXUs2IKdKZkcZ9YRrUWmjU1hQaJH4XldDcviBq5x3w3kvqKgNa911C\nNwQqeiEa9gTTpd5FvxZQeHvstJw8jo6YzW7Y8paRRN+1FKVHboSOnHMTQyLB\nw9o0Rm0Ag8vtCji+MK+GDAhL6J+y0r0cNPp/DwyJrPRCQ8u9H0Y69OIykaB9\ncsJZsSM07KLEKrwjJLZykFe+cyKxVC2A+XWjQxyydbc3jlb9+qqs+2Iphdke\nlHDukjoRavHkXaqF00reZrcKTYAJ4cSlz5lUyfNISsICofmtBsSScRaex9pk\nVLg8I4x82sMpVZUJKjkJoDbkx4dE1H1kyggYgITrHX+rRlWbYcnFvyBfSCwa\nfDOQ\r\n=jkfH\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
0xproject/protocol

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
0xproject/0x-monorepo

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:21 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:5262be9fa798eb2018cdc701e211dbae1198eb39d1e089bb00a331ac5494fa2a

Other collected versions

16.66.422 Aug16.66.310 Aug16.66.29 Aug16.66.18 Aug16.66.06 Aug16.65.01 AugView all collected versions →