diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-09 01:28:54 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-09 01:28:54 +0800 |
commit | 43cf8d30bdab025cdcda888897d35b25ad455031 (patch) | |
tree | cb07da70da5076e06459209ede8e761fc4479ab7 /packages/website/ts/blockchain.ts | |
parent | ec198343b551020cfed321937d680af59c2ce127 (diff) | |
download | dexon-sol-tools-43cf8d30bdab025cdcda888897d35b25ad455031.tar.gz dexon-sol-tools-43cf8d30bdab025cdcda888897d35b25ad455031.tar.zst dexon-sol-tools-43cf8d30bdab025cdcda888897d35b25ad455031.zip |
Implement blockchain.portalOrderToZeroExOrder
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index ae79651d5..db3872a32 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -36,6 +36,7 @@ import { BlockchainErrs, ContractInstance, EtherscanLinkSuffixes, + Order as PortalOrder, ProviderType, Side, SideToAssetToken, @@ -288,6 +289,25 @@ export class Blockchain { }), ); } + public portalOrderToZeroExOrder(portalOrder: PortalOrder): SignedOrder { + const exchangeContractAddress = this.getExchangeContractAddressIfExists(); + const zeroExSignedOrder = { + exchangeContractAddress, + maker: portalOrder.signedOrder.maker, + taker: portalOrder.signedOrder.taker, + makerTokenAddress: portalOrder.signedOrder.makerTokenAddress, + takerTokenAddress: portalOrder.signedOrder.takerTokenAddress, + makerTokenAmount: new BigNumber(portalOrder.signedOrder.makerTokenAmount), + takerTokenAmount: new BigNumber(portalOrder.signedOrder.takerTokenAmount), + makerFee: new BigNumber(portalOrder.signedOrder.makerFee), + takerFee: new BigNumber(portalOrder.signedOrder.takerFee), + expirationUnixTimestampSec: new BigNumber(portalOrder.signedOrder.expirationUnixTimestampSec), + feeRecipient: portalOrder.signedOrder.feeRecipient, + ecSignature: portalOrder.signedOrder.ecSignature, + salt: new BigNumber(portalOrder.signedOrder.salt), + }; + return zeroExSignedOrder; + } public async fillOrderAsync(signedOrder: SignedOrder, fillTakerTokenAmount: BigNumber): Promise<BigNumber> { utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses); |