Catalog npm
Back to packageRELEASE DETAILS

4.2.3

npm

@0x-klaytn/asset-swapper

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

Published28 Feb 2020
Direct dependencies37
Transitive dependenciesNot calculated

README

Current package documentation

@0x-klaytn/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-klaytn/asset-swapper

Import

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

or

var SwapQuoter = require('@0x-klaytn/asset-swapper').SwapQuoter;
var SwapQuoteConsumer = require('@0x-klaytn/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-klaytn/asset-swapper yarn build

Or continuously rebuild on change:

PKG=@0x-klaytn/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
@0x-klaytn/contract-addresses
Environment
{
  "local_name": "@0x-klaytn/contract-addresses",
  "alias": false,
  "peer_metadata": null
}
^4.6.0runtime
@0x-klaytn/utils
Environment
{
  "local_name": "@0x-klaytn/utils",
  "alias": false,
  "peer_metadata": null
}
^5.4.0runtime
@0x-klaytn/web3-wrapper
Environment
{
  "local_name": "@0x-klaytn/web3-wrapper",
  "alias": false,
  "peer_metadata": null
}
^7.0.6runtime
@0x/assert
Environment
{
  "local_name": "@0x/assert",
  "alias": false,
  "peer_metadata": null
}
^3.0.6runtime
@0x-klaytn/contract-wrappers
Environment
{
  "local_name": "@0x-klaytn/contract-wrappers",
  "alias": false,
  "peer_metadata": null
}
^13.6.0runtime
@0x/json-schemas
Environment
{
  "local_name": "@0x/json-schemas",
  "alias": false,
  "peer_metadata": null
}
^5.0.6runtime
@0x-klaytn/order-utils
Environment
{
  "local_name": "@0x-klaytn/order-utils",
  "alias": false,
  "peer_metadata": null
}
^10.2.3runtime
@0x/orderbook
Environment
{
  "local_name": "@0x/orderbook",
  "alias": false,
  "peer_metadata": null
}
^2.2.1runtime
heartbeats
Environment
{
  "local_name": "heartbeats",
  "alias": false,
  "peer_metadata": null
}
^5.0.1runtime
lodash
Environment
{
  "local_name": "lodash",
  "alias": false,
  "peer_metadata": null
}
^4.17.11runtime
@0x-klaytn/subproviders
Environment
{
  "local_name": "@0x-klaytn/subproviders",
  "alias": false,
  "peer_metadata": null
}
^6.0.7development
@0x/base-contract
Environment
{
  "local_name": "@0x/base-contract",
  "alias": false,
  "peer_metadata": null
}
^6.2.0development
@0x/contracts-test-utils
Environment
{
  "local_name": "@0x/contracts-test-utils",
  "alias": false,
  "peer_metadata": null
}
^5.1.5development
@0x/dev-utils
Environment
{
  "local_name": "@0x/dev-utils",
  "alias": false,
  "peer_metadata": null
}
^3.2.0development
@0x/mesh-rpc-client
Environment
{
  "local_name": "@0x/mesh-rpc-client",
  "alias": false,
  "peer_metadata": null
}
^7.0.4-beta-0xv3development
@0x/migrations
Environment
{
  "local_name": "@0x/migrations",
  "alias": false,
  "peer_metadata": null
}
^6.2.0development
@0x/ts-doc-gen
Environment
{
  "local_name": "@0x/ts-doc-gen",
  "alias": false,
  "peer_metadata": null
}
^0.0.22development
@0x/tslint-config
Environment
{
  "local_name": "@0x/tslint-config",
  "alias": false,
  "peer_metadata": null
}
^4.0.0development
@0x/types
Environment
{
  "local_name": "@0x/types",
  "alias": false,
  "peer_metadata": null
}
^3.1.2development
@0x/typescript-typings
Environment
{
  "local_name": "@0x/typescript-typings",
  "alias": false,
  "peer_metadata": null
}
^5.0.2development
@types/lodash
Environment
{
  "local_name": "@types/lodash",
  "alias": false,
  "peer_metadata": null
}
4.14.104development
@types/mocha
Environment
{
  "local_name": "@types/mocha",
  "alias": false,
  "peer_metadata": null
}
^5.2.7development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
*development
chai
Environment
{
  "local_name": "chai",
  "alias": false,
  "peer_metadata": null
}
^4.0.1development
chai-as-promised
Environment
{
  "local_name": "chai-as-promised",
  "alias": false,
  "peer_metadata": null
}
^7.1.0development
chai-bignumber
Environment
{
  "local_name": "chai-bignumber",
  "alias": false,
  "peer_metadata": null
}
^3.0.0development
dirty-chai
Environment
{
  "local_name": "dirty-chai",
  "alias": false,
  "peer_metadata": null
}
^2.0.1development
ethereum-types
Environment
{
  "local_name": "ethereum-types",
  "alias": false,
  "peer_metadata": null
}
^3.1.0development
make-promises-safe
Environment
{
  "local_name": "make-promises-safe",
  "alias": false,
  "peer_metadata": null
}
^1.1.0development
mocha
Environment
{
  "local_name": "mocha",
  "alias": false,
  "peer_metadata": null
}
^6.2.0development
npm-run-all
Environment
{
  "local_name": "npm-run-all",
  "alias": false,
  "peer_metadata": null
}
^4.1.2development
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
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
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
3.0.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "541818a4d3f994baa33895b9d015c289c46a867e",
  "integrity": "sha512-BYrxtAEEQAq3PTKORGOhA25lkrJtsK2+a7z4HD77SI5H6cbs49XiEEajkAPmdva9fJPeLDy1h/lyUfuHr5/q1w==",
  "tarball": "https://registry.npmjs.org/@0x-klaytn/asset-swapper/-/asset-swapper-4.2.3.tgz",
  "fileCount": 114,
  "unpackedSize": 388932,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeWHGHCRA9TVsSAnZWagAAs/0P/3xI6G15w8ZjH2FrvoTK\ndqOulqN2cXyUkST+1jdJRtN4vUXKV2E3SdroWGwa3op01x8OjVwXFu9vQLxd\naPJvDhJJ6PXGN+/rzYL0qMrbFgtGn7imOOmufO8C/0NbwlwwPjug5Qz+VPHn\n4eOQ9O90s3AcfuUZ+izYNn6QbZr8771/s3PLtFKEzPezb8vFGxXkG4pg0zRF\ny4b6CBy+IyjmfzbokerfwBntwz6NKedV7CHBKSRBDyJz7Io6BWjEpSmw1wNi\nX01OKemTLPndaeuV3Sr2Ogk5OShKXSJijy+z3yDbk83yHYZEteaZ27F+c77y\nCE32cLwNArNqijLZib+6YJ8E8AvtwQb5O/5us44ViuUYsSHm1m48t8J0gvEh\nGBX5t1+PlSE5n1PoPyYSpOM2IT4e/waHSojbdJTFHln7sBlYL8GH/eiTBOX8\noVXNpXMWiifYTOuOwyK6IGcs1NOTj3/Rz1hYOk+1X6sMZfPoEB38U+SY+5R8\neaztdCmwp+memRMMg0uhuK7Js+lKqaxCxgk4PqJo5BjtzY6YQundYi0i60Tr\nSaYthSFxC2jBqBO6r8g+HTSHAboPGsyE7Claqqxa7jU7qgMltfh0RifN+Wwj\ntSZyRAK9IieE+ezUvpe6xImY2sChHn9UxETERdOCLXwQzqMoAMsYTy8Xi6Oi\nGCcp\r\n=SedQ\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIH2IMOY8PGL+GCyqmPXDghOJucB728315lAu3n29gAedAiBV29b2Tkfwfm5oKacz3tgBvQiKL96Y/u0jFwFVaUUTyw=="
    }
  ]
}

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:17 UTC

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

Record identity

package_version:ce8f77a79ac03dd56ef7949216dfe057c7835cc1b62e569dfcdbf53ec83bd19d

Other collected versions

4.2.51 Mar4.2.428 Feb4.2.225 Feb4.2.125 FebView all collected versions →