From ccf2ce332529cebc755d2e66714f1be02f9930db Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Tue, 8 Oct 2019 11:07:43 -0700 Subject: [PATCH 1/6] add methods for v2 api --- package.json | 1 - src/DealerClient.ts | 42 ++++++++++++++++++++++++++++++++---------- src/types.ts | 17 +++++++++++++++++ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 099f62d..4a6a32d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "start:snapshot": "docker run -d --rm -p 8545:8545 --name zrx ${npm_package_config_image}", "stop:snapshot": "docker kill zrx", "dev": "webpack-dev-server", - "prepublishOnly": "webpack", "docs": "typedoc ./src", "docs:dev": "vuepress dev docs", "docs:build": "yarn docs && vuepress build docs" diff --git a/src/DealerClient.ts b/src/DealerClient.ts index c82d2e2..01a83e1 100644 --- a/src/DealerClient.ts +++ b/src/DealerClient.ts @@ -17,6 +17,7 @@ import { QuoteResponse, SwapResponse, } from "."; +import { DealerOptions } from "./types"; /** * A simple client for the Zaidan dealer server. @@ -93,7 +94,8 @@ export class DealerClient { * @param web3Uri optional Ethereum JSONRPC url for server-side usage * @param txPriority optionally set the gas price (via etherchain) as "fast", "average", or "safeLow" */ - constructor(dealerUri: string, web3Uri?: string, txPriority: GasPriority = "fast") { + constructor(dealerUri: string, options: DealerOptions) { + const { takerAddress, providerUrl, txPriority = "fast" } = options; this.initialized = false; this.web3 = null; @@ -101,16 +103,16 @@ export class DealerClient { this.provider = null; this.networkId = null; - this.coinbase = null; + this.coinbase = takerAddress || null; this.txPriority = txPriority; this.contractWrappers = null; this.dealerUrl = new URL(dealerUri); - this.apiBase = `${this.dealerUrl.href}api/v1.0`; + this.apiBase = `${this.dealerUrl.href}api/v2.0`; - if (web3Uri) { - this.web3Url = new URL(web3Uri); + if (providerUrl) { + this.web3Url = new URL(providerUrl); } } @@ -142,15 +144,28 @@ export class DealerClient { }, ); - this.erc20Token = new ERC20Token(this.contractWrappers.getProvider()); - this.coinbase = await this.web3.eth.getCoinbase(); + // set coinbase if not already set as configuration option + this.coinbase = this.coinbase || await this.web3.eth.getCoinbase(); + this.erc20Token = new ERC20Token(this.contractWrappers.getProvider()); this.GAS_PRICE = await getGasPrice(this.txPriority); this.pairs = await this._loadMarkets(); this.tokens = await this._loadAssets(); this.initialized = true; } + /** + * Check if a taker's address will be allowed to trade with the dealer based + * on the dealer's configured whitelist/blacklist. + * + * @param takerAddress specify the taker address to check status for. + * @returns `true` if the specified taker will be allowed to trade with the dealer. + */ + public async isAllowed(takerAddress: string = this.coinbase): Promise { + const { allowed } = await this._call("allowed", "GET", { takerAddress }); + return allowed; + } + /** * Request a price quote a signed order from the dealer server. The response * includes price and fee information, as well as signed 0x order message for @@ -163,6 +178,7 @@ export class DealerClient { * @param size the amount of tokens the user is selling/buying (in units of base asset) * @param symbol the token pair the swap is for (ex: "WETH/DAI") * @param side either 'bid' or 'ask' depending on desired quote side + * @param takerAddress optionally override the default (must be able to sign) * @returns a price quote and signed maker order from the dealer server * * @example @@ -180,13 +196,18 @@ export class DealerClient { * } * ``` */ - public async getQuote(size: number, symbol: string, side: string): Promise { + public async getQuote( + size: number, + symbol: string, + side: string, + takerAddress: string = this.coinbase, + ): Promise { assert(this.initialized, "not initialized (call .init() first)"); assert(side === "bid" || side === "ask", 'side must be "bid" or "ask"'); assert(this.pairs.includes(symbol), "unsupported token pair (see .pairs)"); assert(typeof size === "number", "size must be a number"); - const response = await this._call("quote", "GET", { size, symbol, side }); + const response = await this._call("quote", "GET", { size, symbol, side, takerAddress }); return response; } @@ -222,6 +243,7 @@ export class DealerClient { size: number, clientAsset: string, dealerAsset: string, + takerAddress: string = this.coinbase, ): Promise { assert(this.initialized, "not initialized (call .init() first)"); assert(typeof size === "number", "size must be a number"); @@ -232,7 +254,7 @@ export class DealerClient { "configured dealer unable to server requested market", ); - const response = await this._call("swap", "GET", { size, dealerAsset, clientAsset }); + const response = await this._call("swap", "GET", { size, dealerAsset, clientAsset, takerAddress }); return response; } diff --git a/src/types.ts b/src/types.ts index f9631fc..f1edf2a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,9 +1,26 @@ import { SignedOrder } from "@0x/types"; +/** + * Configuration options for the dealer client. + */ +export interface DealerOptions { + /** Address to use to sign and fill orders. */ + takerAddress?: string; + + /** Ethereum JSONRPC provider url (server-side only) */ + providerUrl?: string; + + /** Optional gas price selector (fast, safeLow, etc.) */ + txPriority?: GasPriority; +} + /** * The base dealer response, fields present for all quotes (swap/bid/ask). */ export interface DealerResponse { + /** The taker address which must fill the order (no other taker will be accepted). */ + takerAddress: string; + /** The UNIX timestamp at which this offer expires. */ expiration: number; From f905d695b04919bad5b19f418ced672164b42420 Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Tue, 8 Oct 2019 16:42:26 -0700 Subject: [PATCH 2/6] allowed => authorized --- src/DealerClient.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DealerClient.ts b/src/DealerClient.ts index 01a83e1..1f3a54a 100644 --- a/src/DealerClient.ts +++ b/src/DealerClient.ts @@ -161,9 +161,9 @@ export class DealerClient { * @param takerAddress specify the taker address to check status for. * @returns `true` if the specified taker will be allowed to trade with the dealer. */ - public async isAllowed(takerAddress: string = this.coinbase): Promise { - const { allowed } = await this._call("allowed", "GET", { takerAddress }); - return allowed; + public async isAuthorized(takerAddress: string = this.coinbase): Promise { + const { authorized } = await this._call("authorized", "GET", { takerAddress }); + return authorized; } /** From c382e032dc0bb398ebef15560d20754b5f24c659 Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Tue, 8 Oct 2019 16:50:01 -0700 Subject: [PATCH 3/6] update query parameter name --- src/DealerClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DealerClient.ts b/src/DealerClient.ts index 1f3a54a..df2835b 100644 --- a/src/DealerClient.ts +++ b/src/DealerClient.ts @@ -162,7 +162,7 @@ export class DealerClient { * @returns `true` if the specified taker will be allowed to trade with the dealer. */ public async isAuthorized(takerAddress: string = this.coinbase): Promise { - const { authorized } = await this._call("authorized", "GET", { takerAddress }); + const { authorized } = await this._call("authorized", "GET", { address: takerAddress }); return authorized; } From e821c5ab383fa4b11032b77dd4b6f36d998b40d2 Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Tue, 8 Oct 2019 16:50:16 -0700 Subject: [PATCH 4/6] add version static property --- src/DealerClient.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DealerClient.ts b/src/DealerClient.ts index df2835b..009135b 100644 --- a/src/DealerClient.ts +++ b/src/DealerClient.ts @@ -26,6 +26,9 @@ export class DealerClient { /** 2^256 - 1 represents an effectively "unlimited" allowance */ public static MAX_ALLOWANCE = new BigNumber(2).exponentiatedBy(256).minus(1); + /** The dealer API version this client is compatible with. */ + public static COMPATIBLE_VERSION = "2.0"; + /** Dealer server RPC server URL. */ private readonly dealerUrl: URL; @@ -109,7 +112,7 @@ export class DealerClient { this.contractWrappers = null; this.dealerUrl = new URL(dealerUri); - this.apiBase = `${this.dealerUrl.href}api/v2.0`; + this.apiBase = `${this.dealerUrl.href}api/v${DealerClient.COMPATIBLE_VERSION}`; if (providerUrl) { this.web3Url = new URL(providerUrl); From 5dcfd78124ef86e70adf200e6622e1041399e443 Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Tue, 8 Oct 2019 16:55:38 -0700 Subject: [PATCH 5/6] update tests --- test/helpers/mockDealer.ts | 8 +++++--- test/spec_test.ts | 6 ++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/helpers/mockDealer.ts b/test/helpers/mockDealer.ts index 0f267f1..82b4954 100644 --- a/test/helpers/mockDealer.ts +++ b/test/helpers/mockDealer.ts @@ -51,7 +51,7 @@ class MockDealer { this.initialized = true; } - public async mock(size: number, side: "bid" | "ask"): Promise { + public async mock(size: number, side: "bid" | "ask", takerAddress: string): Promise { await this.initializing; const takerAmount = (size * 0.2).toString(); @@ -69,6 +69,7 @@ class MockDealer { fee: 0, price: 0.2, order: await this.generateOrder(sizeStr, takerAmount, this.tokenA, this.tokenB, expiration), + takerAddress, }; return mock; } @@ -130,9 +131,10 @@ router.get("/quote", async (req, res, next) => { const { side, size, + takerAddress, } = req.query; - const quote = await dealer.mock(parseInt(size), side); + const quote = await dealer.mock(parseInt(size), side, takerAddress); res.status(200).send(quote); }); @@ -163,4 +165,4 @@ router.get("/markets", async (req, res, next) => { }); app.use(bodyParser.json()); -app.use("/api/v1.0", router); +app.use("/api/v2.0", router); diff --git a/test/spec_test.ts b/test/spec_test.ts index 07154b6..fc42391 100644 --- a/test/spec_test.ts +++ b/test/spec_test.ts @@ -3,6 +3,7 @@ import { ContractWrappers } from "@0x/contract-wrappers"; import { BigNumber } from "@0x/utils"; import assert from "assert"; import { Server } from "http"; +import Redis from "ioredis"; import Web3 from "web3"; import { DealerClient } from "../src/DealerClient"; @@ -81,11 +82,8 @@ describe("Zaidan client unit tests", function (): void { clientAddress = accounts[parseInt(CLIENT_ACCOUNT_INDEX)]; dealerAddress = accounts[parseInt(DEALER_ACCOUNT_INDEX)]; - client = new DealerClient(DEALER_URL, WEB3_URL); + client = new DealerClient(DEALER_URL, { providerUrl: WEB3_URL, takerAddress: clientAddress }); await client.init(); - - // override client coinbase to avoid conflicting coinbase addresses - client.coinbase = clientAddress; }); this.beforeAll("setup dummy tokens and server allowances", async function (): Promise { From 1c646b80b6ebd65f49b833bbfbba4f20c270d56c Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Tue, 8 Oct 2019 16:55:55 -0700 Subject: [PATCH 6/6] regenerate docs --- docs/README.md | 3 +- docs/classes/dealerclient.md | 127 ++++++++++++++--------- docs/globals.md | 12 +-- docs/interfaces/dealerfilltransaction.md | 15 ++- docs/interfaces/dealeroptions.md | 47 +++++++++ docs/interfaces/dealerresponse.md | 28 +++-- docs/interfaces/quoteresponse.md | 32 ++++-- docs/interfaces/swapresponse.md | 34 ++++-- 8 files changed, 205 insertions(+), 93 deletions(-) create mode 100644 docs/interfaces/dealeroptions.md diff --git a/docs/README.md b/docs/README.md index 796b9cb..d679832 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,7 +2,6 @@ # Zaidan dealer client - _This repository is a mirror for the public client package from the Zaidan monorepo._ # Zaidan dealer client @@ -135,4 +134,4 @@ Generate the vuepress site (output to `docs/.vuepress/dist`): ``` yarn docs:build -``` \ No newline at end of file +``` diff --git a/docs/classes/dealerclient.md b/docs/classes/dealerclient.md index a165b2d..cc131c7 100644 --- a/docs/classes/dealerclient.md +++ b/docs/classes/dealerclient.md @@ -2,7 +2,6 @@ # Class: DealerClient - A simple client for the Zaidan dealer server. ## Hierarchy @@ -29,6 +28,7 @@ A simple client for the Zaidan dealer server. * [txPriority](dealerclient.md#txpriority) * [web3](dealerclient.md#web3) * [web3Wrapper](dealerclient.md#web3wrapper) +* [COMPATIBLE_VERSION](dealerclient.md#static-compatible_version) * [MAX_ALLOWANCE](dealerclient.md#static-max_allowance) ### Methods @@ -41,6 +41,7 @@ A simple client for the Zaidan dealer server. * [handleTrade](dealerclient.md#handletrade) * [hasAllowance](dealerclient.md#hasallowance) * [init](dealerclient.md#init) +* [isAuthorized](dealerclient.md#isauthorized) * [makeBigNumber](dealerclient.md#makebignumber) * [setAllowance](dealerclient.md#setallowance) * [supportedTickers](dealerclient.md#supportedtickers) @@ -51,9 +52,9 @@ A simple client for the Zaidan dealer server. ### constructor -\+ **new DealerClient**(`dealerUri`: string, `web3Uri?`: string, `txPriority`: [GasPriority](../globals.md#gaspriority)): *[DealerClient](dealerclient.md)* +\+ **new DealerClient**(`dealerUri`: string, `options`: [DealerOptions](../interfaces/dealeroptions.md)): *[DealerClient](dealerclient.md)* -*Defined in [DealerClient.ts:81](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L81)* +*Defined in [DealerClient.ts:85](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L85)* Instantiate a new DealerClient. Prior to use, `client.init()` should be called, which triggers a prompt for the user to allow MetaMask to @@ -65,11 +66,10 @@ setting of attempting to load a web3 provider through the browser. **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`dealerUri` | string | - | the base RPC API path for the dealer server | -`web3Uri?` | string | - | optional Ethereum JSONRPC url for server-side usage | -`txPriority` | [GasPriority](../globals.md#gaspriority) | "fast" | optionally set the gas price (via etherchain) as "fast", "average", or "safeLow" | +Name | Type | Description | +------ | ------ | ------ | +`dealerUri` | string | the base RPC API path for the dealer server | +`options` | [DealerOptions](../interfaces/dealeroptions.md) | - | **Returns:** *[DealerClient](dealerclient.md)* @@ -79,7 +79,7 @@ Name | Type | Default | Description | • **GAS_PRICE**: *BigNumber* -*Defined in [DealerClient.ts:75](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L75)* +*Defined in [DealerClient.ts:79](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L79)* Default gas price to use for allowance transactions (in wei). @@ -89,7 +89,7 @@ ___ • **coinbase**: *string* -*Defined in [DealerClient.ts:63](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L63)* +*Defined in [DealerClient.ts:67](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L67)* Stores the current user's coinbase address. @@ -99,7 +99,7 @@ ___ • **contractWrappers**: *ContractWrappers* -*Defined in [DealerClient.ts:66](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L66)* +*Defined in [DealerClient.ts:70](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L70)* Initialized contract wrappers for interacting with the 0x system. @@ -109,7 +109,7 @@ ___ • **initialized**: *boolean* -*Defined in [DealerClient.ts:69](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L69)* +*Defined in [DealerClient.ts:73](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L73)* Set to 'true' after a successful .init(), must be called before use. @@ -119,7 +119,7 @@ ___ • **isBrowser**: *boolean* -*Defined in [DealerClient.ts:72](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L72)* +*Defined in [DealerClient.ts:76](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L76)* Set to 'true' if browser environment is detected. @@ -129,7 +129,7 @@ ___ • **networkId**: *number* -*Defined in [DealerClient.ts:60](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L60)* +*Defined in [DealerClient.ts:64](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L64)* Stores the configured Ethereum network ID. @@ -139,7 +139,7 @@ ___ • **pairs**: *string[]* -*Defined in [DealerClient.ts:43](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L43)* +*Defined in [DealerClient.ts:47](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L47)* An array of the currently supported pairs (as expected by `getQuote`). @@ -149,7 +149,7 @@ ___ • **provider**: *Provider | SupportedProvider | MetamaskSubprovider* -*Defined in [DealerClient.ts:57](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L57)* +*Defined in [DealerClient.ts:61](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L61)* Provider instance used to interact with Ethereum. @@ -159,7 +159,7 @@ ___ • **tokens**: *object* -*Defined in [DealerClient.ts:48](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L48)* +*Defined in [DealerClient.ts:52](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L52)* Maps tokenTicker => address for looking up common tokens. @@ -173,7 +173,7 @@ ___ • **txPriority**: *[GasPriority](../globals.md#gaspriority)* -*Defined in [DealerClient.ts:81](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L81)* +*Defined in [DealerClient.ts:85](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L85)* Transaction priority (according to ethgasstation.info API), defaults to fast. @@ -184,7 +184,7 @@ ___ • **web3**: *Web3* -*Defined in [DealerClient.ts:51](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L51)* +*Defined in [DealerClient.ts:55](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L55)* Main Web3 instance for interacting with Ethereum. @@ -194,17 +194,27 @@ ___ • **web3Wrapper**: *Web3Wrapper* -*Defined in [DealerClient.ts:54](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L54)* +*Defined in [DealerClient.ts:58](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L58)* Provides additional convenience methods for interacting with web3. ___ +### `Static` COMPATIBLE_VERSION + +▪ **COMPATIBLE_VERSION**: *string* = "2.0" + +*Defined in [DealerClient.ts:30](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L30)* + +The dealer API version this client is compatible with. + +___ + ### `Static` MAX_ALLOWANCE ▪ **MAX_ALLOWANCE**: *BigNumber* = new BigNumber(2).exponentiatedBy(256).minus(1) -*Defined in [DealerClient.ts:26](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L26)* +*Defined in [DealerClient.ts:27](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L27)* 2^256 - 1 represents an effectively "unlimited" allowance @@ -214,7 +224,7 @@ ___ ▸ **fromWei**(`weiAmount`: string): *string* -*Defined in [DealerClient.ts:420](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L420)* +*Defined in [DealerClient.ts:445](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L445)* Convert a number of tokens, denominated in the smallest unit - "wei" - to "full" units, called "ether". One ether = 1*10^18 wei. @@ -244,7 +254,7 @@ ___ ▸ **getBalance**(`tokenTicker`: string): *Promise‹string›* -*Defined in [DealerClient.ts:370](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L370)* +*Defined in [DealerClient.ts:395](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L395)* Return the user's balance (in wei) of a specified supported token. Only supported tickers will work (see `client.tokens`). @@ -274,7 +284,7 @@ ___ ▸ **getEtherscanLink**(`txId`: string): *string* -*Defined in [DealerClient.ts:454](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L454)* +*Defined in [DealerClient.ts:479](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L479)* Returns the URL of the Etherscan status page for the specified TX ID. @@ -294,9 +304,9 @@ ___ ### getQuote -▸ **getQuote**(`size`: number, `symbol`: string, `side`: string): *Promise‹[QuoteResponse](../interfaces/quoteresponse.md)›* +▸ **getQuote**(`size`: number, `symbol`: string, `side`: string, `takerAddress`: string): *Promise‹[QuoteResponse](../interfaces/quoteresponse.md)›* -*Defined in [DealerClient.ts:183](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L183)* +*Defined in [DealerClient.ts:202](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L202)* Request a price quote a signed order from the dealer server. The response includes price and fee information, as well as signed 0x order message for @@ -323,11 +333,12 @@ response = { **Parameters:** -Name | Type | Description | ------- | ------ | ------ | -`size` | number | the amount of tokens the user is selling/buying (in units of base asset) | -`symbol` | string | the token pair the swap is for (ex: "WETH/DAI") | -`side` | string | either 'bid' or 'ask' depending on desired quote side | +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`size` | number | - | the amount of tokens the user is selling/buying (in units of base asset) | +`symbol` | string | - | the token pair the swap is for (ex: "WETH/DAI") | +`side` | string | - | either 'bid' or 'ask' depending on desired quote side | +`takerAddress` | string | this.coinbase | optionally override the default (must be able to sign) | **Returns:** *Promise‹[QuoteResponse](../interfaces/quoteresponse.md)›* @@ -337,9 +348,9 @@ ___ ### getSwapQuote -▸ **getSwapQuote**(`size`: number, `clientAsset`: string, `dealerAsset`: string): *Promise‹[SwapResponse](../interfaces/swapresponse.md)›* +▸ **getSwapQuote**(`size`: number, `clientAsset`: string, `dealerAsset`: string, `takerAddress`: string): *Promise‹[SwapResponse](../interfaces/swapresponse.md)›* -*Defined in [DealerClient.ts:221](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L221)* +*Defined in [DealerClient.ts:245](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L245)* An alternative interface for fetching a price quote using the concept of an asset "swap" as opposed to a conventional base/quote bid/ask interface. @@ -365,11 +376,12 @@ const txId = await dealer.handleTrade(order, id); **Parameters:** -Name | Type | Description | ------- | ------ | ------ | -`size` | number | the amount of takerAsset to swap for | -`clientAsset` | string | the ticker of the asset being sold (swapping for dealerAsset) | -`dealerAsset` | string | the ticker of the asset being bought that a price is quoted for | +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`size` | number | - | the amount of takerAsset to swap for | +`clientAsset` | string | - | the ticker of the asset being sold (swapping for dealerAsset) | +`dealerAsset` | string | - | the ticker of the asset being bought that a price is quoted for | +`takerAddress` | string | this.coinbase | - | **Returns:** *Promise‹[SwapResponse](../interfaces/swapresponse.md)›* @@ -381,7 +393,7 @@ ___ ▸ **handleTrade**(`order`: SignedOrder, `quoteId`: string, `takerAddress`: string): *Promise‹string›* -*Defined in [DealerClient.ts:267](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L267)* +*Defined in [DealerClient.ts:292](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L292)* Sign a 0x `fillOrder` transaction message, and submit it back to the server for settlement. Signs a fill transaction for the entire specified @@ -424,7 +436,7 @@ ___ ▸ **hasAllowance**(`tokenTicker`: string): *Promise‹boolean›* -*Defined in [DealerClient.ts:312](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L312)* +*Defined in [DealerClient.ts:337](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L337)* Check if the user has set an allowance for the specified token. If the method returns `false`, allowance can be set with `client.setAllowance`. @@ -457,7 +469,7 @@ ___ ▸ **init**(): *Promise‹void›* -*Defined in [DealerClient.ts:125](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L125)* +*Defined in [DealerClient.ts:130](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L130)* Initialize a DealerClient instance. A call to `client.init()` will trigger a MetaMask pop-up prompting the user to sign in, or allow the site access. @@ -470,11 +482,32 @@ A promise that resolves when initialization is complete. ___ +### isAuthorized + +▸ **isAuthorized**(`takerAddress`: string): *Promise‹boolean›* + +*Defined in [DealerClient.ts:167](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L167)* + +Check if a taker's address will be allowed to trade with the dealer based +on the dealer's configured whitelist/blacklist. + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`takerAddress` | string | this.coinbase | specify the taker address to check status for. | + +**Returns:** *Promise‹boolean›* + +`true` if the specified taker will be allowed to trade with the dealer. + +___ + ### makeBigNumber ▸ **makeBigNumber**(`n`: number | string): *BigNumber* -*Defined in [DealerClient.ts:399](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L399)* +*Defined in [DealerClient.ts:424](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L424)* Turn a `string` or primitive `number` into a `BigNumber` for math reasons. @@ -500,7 +533,7 @@ ___ ▸ **setAllowance**(`tokenTicker`: string): *Promise‹TransactionReceiptWithDecodedLogs›* -*Defined in [DealerClient.ts:346](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L346)* +*Defined in [DealerClient.ts:371](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L371)* Set an unlimited proxy allowance for the 0x ERC20 Proxy contract for the specified token ticker. @@ -535,7 +568,7 @@ ___ ▸ **supportedTickers**(): *string[]* -*Defined in [DealerClient.ts:477](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L477)* +*Defined in [DealerClient.ts:502](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L502)* Return an array containing the list of supported token tickers. @@ -554,7 +587,7 @@ ___ ▸ **toWei**(`etherAmount`: string): *string* -*Defined in [DealerClient.ts:441](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L441)* +*Defined in [DealerClient.ts:466](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L466)* Convert a number of tokens (full units, called "ether") to "wei", the smallest denomination of most ERC-20 tokens with 18 decimals. @@ -584,7 +617,7 @@ ___ ▸ **waitForTransactionSuccessOrThrow**(`txId`: string): *Promise‹void›* -*Defined in [DealerClient.ts:382](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/DealerClient.ts#L382)* +*Defined in [DealerClient.ts:407](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/DealerClient.ts#L407)* Wait for a specific Ethereum transaction to be successfully mined. @@ -596,4 +629,4 @@ Name | Type | Description | **Returns:** *Promise‹void›* -Resolves when mined successfully, rejects if the TX failed. \ No newline at end of file +Resolves when mined successfully, rejects if the TX failed. diff --git a/docs/globals.md b/docs/globals.md index 391ad85..3c57970 100644 --- a/docs/globals.md +++ b/docs/globals.md @@ -2,7 +2,6 @@ # Zaidan dealer client - ## Index ### Classes @@ -12,6 +11,7 @@ ### Interfaces * [DealerFillTransaction](interfaces/dealerfilltransaction.md) +* [DealerOptions](interfaces/dealeroptions.md) * [DealerResponse](interfaces/dealerresponse.md) * [QuoteResponse](interfaces/quoteresponse.md) * [SwapResponse](interfaces/swapresponse.md) @@ -32,7 +32,7 @@ Ƭ **GasPriority**: *"safeLow" | "standard" | "fast" | "fastest"* -*Defined in [types.ts:74](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L74)* +*Defined in [types.ts:91](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L91)* Gas price priority (as used in ETH Gas Station API). @@ -42,7 +42,7 @@ Gas price priority (as used in ETH Gas Station API). ▸ **convertZeroExTransactionToDealerFill**(`fillTx`: SignedZeroExTransaction, `quoteId`: string): *[DealerFillTransaction](interfaces/dealerfilltransaction.md)* -*Defined in [utils.ts:55](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/utils.ts#L55)* +*Defined in [utils.ts:55](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/utils.ts#L55)* Create a dealer POST /order request body from a signed 0x fill transaction and the quote ID corresponding to the signed transaction data. @@ -64,7 +64,7 @@ ___ ▸ **createAndSignZeroExTransaction**(`provider`: SupportedProvider, `signerAddress`: string, `verifyingContractAddress`: string, `order`: SignedOrder, `takerAmount`: BigNumber): *Promise‹SignedZeroExTransaction›* -*Defined in [utils.ts:27](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/utils.ts#L27)* +*Defined in [utils.ts:27](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/utils.ts#L27)* Given a signed 0x order, signer address, and taker asset amount, prepare and sign a 0x fill transaction to be submitted to the verifying exchange contract @@ -93,7 +93,7 @@ ___ ▸ **getGasPrice**(`priority`: [GasPriority](globals.md#gaspriority)): *Promise‹BigNumber›* -*Defined in [utils.ts:67](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/utils.ts#L67)* +*Defined in [utils.ts:67](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/utils.ts#L67)* Fetch a gas price from Etherchain.org for a given priority (tx conf speed). @@ -103,4 +103,4 @@ Name | Type | Description | ------ | ------ | ------ | `priority` | [GasPriority](globals.md#gaspriority) | Get gas price for provided priority (see [GasPricePriority]). | -**Returns:** *Promise‹BigNumber›* \ No newline at end of file +**Returns:** *Promise‹BigNumber›* diff --git a/docs/interfaces/dealerfilltransaction.md b/docs/interfaces/dealerfilltransaction.md index 283a59d..5b0ddce 100644 --- a/docs/interfaces/dealerfilltransaction.md +++ b/docs/interfaces/dealerfilltransaction.md @@ -2,7 +2,6 @@ # Interface: DealerFillTransaction - Request body for dealer POST /order (submit fill) endpoint. ## Hierarchy @@ -26,7 +25,7 @@ Request body for dealer POST /order (submit fill) endpoint. • **address**: *string* -*Defined in [types.ts:65](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L65)* +*Defined in [types.ts:82](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L82)* The taker address (and signer). @@ -36,7 +35,7 @@ ___ • **data**: *string* -*Defined in [types.ts:56](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L56)* +*Defined in [types.ts:73](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L73)* Raw hex-encoded fill transaction data. @@ -46,7 +45,7 @@ ___ • **hash**: *string* -*Defined in [types.ts:59](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L59)* +*Defined in [types.ts:76](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L76)* 0x transaction hash (hash of data, etc.). @@ -56,7 +55,7 @@ ___ • **quoteId**: *string* -*Defined in [types.ts:68](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L68)* +*Defined in [types.ts:85](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L85)* Required UUID from initial quote (must match signed order). @@ -66,7 +65,7 @@ ___ • **salt**: *string* -*Defined in [types.ts:53](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L53)* +*Defined in [types.ts:70](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L70)* Salt used in signature generation. @@ -76,6 +75,6 @@ ___ • **sig**: *string* -*Defined in [types.ts:62](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L62)* +*Defined in [types.ts:79](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L79)* -Signature generated by signer (`address`) from signing fill transaction. \ No newline at end of file +Signature generated by signer (`address`) from signing fill transaction. diff --git a/docs/interfaces/dealeroptions.md b/docs/interfaces/dealeroptions.md new file mode 100644 index 0000000..d8a214d --- /dev/null +++ b/docs/interfaces/dealeroptions.md @@ -0,0 +1,47 @@ +[Zaidan dealer client](../README.md) › [Globals](../globals.md) › [DealerOptions](dealeroptions.md) + +# Interface: DealerOptions + +Configuration options for the dealer client. + +## Hierarchy + +* **DealerOptions** + +## Index + +### Properties + +* [providerUrl](dealeroptions.md#optional-providerurl) +* [takerAddress](dealeroptions.md#optional-takeraddress) +* [txPriority](dealeroptions.md#optional-txpriority) + +## Properties + +### `Optional` providerUrl + +• **providerUrl**? : *string* + +*Defined in [types.ts:11](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L11)* + +Ethereum JSONRPC provider url (server-side only) + +___ + +### `Optional` takerAddress + +• **takerAddress**? : *string* + +*Defined in [types.ts:8](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L8)* + +Address to use to sign and fill orders. + +___ + +### `Optional` txPriority + +• **txPriority**? : *[GasPriority](../globals.md#gaspriority)* + +*Defined in [types.ts:14](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L14)* + +Optional gas price selector (fast, safeLow, etc.) diff --git a/docs/interfaces/dealerresponse.md b/docs/interfaces/dealerresponse.md index 0f71b38..ebb88ac 100644 --- a/docs/interfaces/dealerresponse.md +++ b/docs/interfaces/dealerresponse.md @@ -2,7 +2,6 @@ # Interface: DealerResponse - The base dealer response, fields present for all quotes (swap/bid/ask). ## Hierarchy @@ -24,6 +23,7 @@ The base dealer response, fields present for all quotes (swap/bid/ask). * [pair](dealerresponse.md#pair) * [price](dealerresponse.md#price) * [size](dealerresponse.md#size) +* [takerAddress](dealerresponse.md#takeraddress) ## Properties @@ -31,7 +31,7 @@ The base dealer response, fields present for all quotes (swap/bid/ask). • **expiration**: *number* -*Defined in [types.ts:8](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L8)* +*Defined in [types.ts:25](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L25)* The UNIX timestamp at which this offer expires. @@ -41,7 +41,7 @@ ___ • **fee**: *number* -*Defined in [types.ts:23](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L23)* +*Defined in [types.ts:40](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L40)* The required fee from the dealer server. @@ -51,7 +51,7 @@ ___ • **id**: *string* -*Defined in [types.ts:14](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L14)* +*Defined in [types.ts:31](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L31)* The unique request ID that refers to this offer. @@ -61,7 +61,7 @@ ___ • **order**: *SignedOrder* -*Defined in [types.ts:26](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L26)* +*Defined in [types.ts:43](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L43)* The signed maker order from the dealer server. @@ -71,7 +71,7 @@ ___ • **pair**: *string* -*Defined in [types.ts:11](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L11)* +*Defined in [types.ts:28](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L28)* The market symbol the quote is for @@ -81,7 +81,7 @@ ___ • **price**: *number* -*Defined in [types.ts:17](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L17)* +*Defined in [types.ts:34](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L34)* The price and order data for the quote. @@ -91,6 +91,16 @@ ___ • **size**: *number* -*Defined in [types.ts:20](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L20)* +*Defined in [types.ts:37](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L37)* + +The taker size, specified in the initial request. + +___ + +### takerAddress + +• **takerAddress**: *string* + +*Defined in [types.ts:22](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L22)* -The taker size, specified in the initial request. \ No newline at end of file +The taker address which must fill the order (no other taker will be accepted). diff --git a/docs/interfaces/quoteresponse.md b/docs/interfaces/quoteresponse.md index f0f6869..32a592c 100644 --- a/docs/interfaces/quoteresponse.md +++ b/docs/interfaces/quoteresponse.md @@ -2,7 +2,6 @@ # Interface: QuoteResponse - The dealer's response for a currency pair quote (bid/ask on X/Y pair). ## Hierarchy @@ -23,6 +22,7 @@ The dealer's response for a currency pair quote (bid/ask on X/Y pair). * [price](quoteresponse.md#price) * [side](quoteresponse.md#side) * [size](quoteresponse.md#size) +* [takerAddress](quoteresponse.md#takeraddress) ## Properties @@ -32,7 +32,7 @@ The dealer's response for a currency pair quote (bid/ask on X/Y pair). *Inherited from [DealerResponse](dealerresponse.md).[expiration](dealerresponse.md#expiration)* -*Defined in [types.ts:8](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L8)* +*Defined in [types.ts:25](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L25)* The UNIX timestamp at which this offer expires. @@ -44,7 +44,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[fee](dealerresponse.md#fee)* -*Defined in [types.ts:23](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L23)* +*Defined in [types.ts:40](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L40)* The required fee from the dealer server. @@ -56,7 +56,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[id](dealerresponse.md#id)* -*Defined in [types.ts:14](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L14)* +*Defined in [types.ts:31](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L31)* The unique request ID that refers to this offer. @@ -68,7 +68,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[order](dealerresponse.md#order)* -*Defined in [types.ts:26](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L26)* +*Defined in [types.ts:43](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L43)* The signed maker order from the dealer server. @@ -80,7 +80,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[pair](dealerresponse.md#pair)* -*Defined in [types.ts:11](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L11)* +*Defined in [types.ts:28](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L28)* The market symbol the quote is for @@ -92,7 +92,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[price](dealerresponse.md#price)* -*Defined in [types.ts:17](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L17)* +*Defined in [types.ts:34](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L34)* The price and order data for the quote. @@ -102,7 +102,7 @@ ___ • **side**: *string* -*Defined in [types.ts:45](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L45)* +*Defined in [types.ts:62](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L62)* The side of the quote (bid or ask). @@ -114,6 +114,18 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[size](dealerresponse.md#size)* -*Defined in [types.ts:20](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L20)* +*Defined in [types.ts:37](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L37)* + +The taker size, specified in the initial request. + +___ + +### takerAddress + +• **takerAddress**: *string* + +*Inherited from [DealerResponse](dealerresponse.md).[takerAddress](dealerresponse.md#takeraddress)* + +*Defined in [types.ts:22](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L22)* -The taker size, specified in the initial request. \ No newline at end of file +The taker address which must fill the order (no other taker will be accepted). diff --git a/docs/interfaces/swapresponse.md b/docs/interfaces/swapresponse.md index 2634ca5..138c8fb 100644 --- a/docs/interfaces/swapresponse.md +++ b/docs/interfaces/swapresponse.md @@ -2,7 +2,6 @@ # Interface: SwapResponse - The dealer's response for a swap quote (swap `n` of `Y` for equivalent amount of `Z`). ## Hierarchy @@ -24,6 +23,7 @@ The dealer's response for a swap quote (swap `n` of `Y` for equivalent amount of * [pair](swapresponse.md#pair) * [price](swapresponse.md#price) * [size](swapresponse.md#size) +* [takerAddress](swapresponse.md#takeraddress) ## Properties @@ -31,7 +31,7 @@ The dealer's response for a swap quote (swap `n` of `Y` for equivalent amount of • **clientAsset**: *string* -*Defined in [types.ts:37](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L37)* +*Defined in [types.ts:54](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L54)* The asset (ticker) the client will send to the dealer. @@ -41,7 +41,7 @@ ___ • **dealerAsset**: *string* -*Defined in [types.ts:34](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L34)* +*Defined in [types.ts:51](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L51)* The asset (ticker) the dealer will send to the client. @@ -53,7 +53,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[expiration](dealerresponse.md#expiration)* -*Defined in [types.ts:8](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L8)* +*Defined in [types.ts:25](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L25)* The UNIX timestamp at which this offer expires. @@ -65,7 +65,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[fee](dealerresponse.md#fee)* -*Defined in [types.ts:23](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L23)* +*Defined in [types.ts:40](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L40)* The required fee from the dealer server. @@ -77,7 +77,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[id](dealerresponse.md#id)* -*Defined in [types.ts:14](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L14)* +*Defined in [types.ts:31](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L31)* The unique request ID that refers to this offer. @@ -89,7 +89,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[order](dealerresponse.md#order)* -*Defined in [types.ts:26](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L26)* +*Defined in [types.ts:43](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L43)* The signed maker order from the dealer server. @@ -101,7 +101,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[pair](dealerresponse.md#pair)* -*Defined in [types.ts:11](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L11)* +*Defined in [types.ts:28](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L28)* The market symbol the quote is for @@ -113,7 +113,7 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[price](dealerresponse.md#price)* -*Defined in [types.ts:17](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L17)* +*Defined in [types.ts:34](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L34)* The price and order data for the quote. @@ -125,6 +125,18 @@ ___ *Inherited from [DealerResponse](dealerresponse.md).[size](dealerresponse.md#size)* -*Defined in [types.ts:20](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/df02572/src/types.ts#L20)* +*Defined in [types.ts:37](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L37)* + +The taker size, specified in the initial request. + +___ + +### takerAddress + +• **takerAddress**: *string* + +*Inherited from [DealerResponse](dealerresponse.md).[takerAddress](dealerresponse.md#takeraddress)* + +*Defined in [types.ts:22](https://github.com/ParadigmFoundation/zaidan-dealer-client/blob/5dcfd78/src/types.ts#L22)* -The taker size, specified in the initial request. \ No newline at end of file +The taker address which must fill the order (no other taker will be accepted).