diff options
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); |