Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Minimise API diffs between contract wrappers and TS generated wrappers #1911

Closed
4 tasks done
xianny opened this issue Jun 29, 2019 · 0 comments
Closed
4 tasks done

Minimise API diffs between contract wrappers and TS generated wrappers #1911

xianny opened this issue Jun 29, 2019 · 0 comments

Comments

@xianny
Copy link
Contributor

xianny commented Jun 29, 2019

We have been working on improving our generated wrappers with the goal of eventually deprecating '@0x/contract-wrappers'.

To minimise the disruptiveness of this change, we should minimise interface differences between the generated wrappers and existing wrappers in `@0x/contract-wrappers.

This issue will be used to track all diffs as we address them.

To-Do

All other difference will be ignored - won't support them after deprecating contract-wrappers.


coordinator_wrapper

current method generated method notes
abi abi -----
address address -----
exchangeAddress ---- doesn't exist
networkId ---- doesn't exist
registryAddress ---- doesn't exist
assertValidCoordinatorApprovalsOrThrowAsync assertValidCoordinatorApprovals ----
batchFillOrKillOrdersAsync ---- doesn't exist
batchFillOrdersAsync ---- doesn't exist
batchFillOrdersNoThrowAsync ---- doesn't exist
batchHardCancelOrdersAsync ---- doesn't exist
batchSoftCancelOrdersAsync ---- doesn't exist
fillOrKillOrderAsync ---- doesn't exist
fillOrderAsync ---- doesn't exist
fillOrderNoThrowAsync ---- doesn't exist
getSignerAddressAsync getSignerAddress ----
hardCancelOrderAsync ---- doesn't exist
hardCancelOrdersUpToAsync ---- doesn't exist
marketBuyOrdersAsync ---- doesn't exist
marketBuyOrdersNoThrowAsync ---- doesn't exist
marketSellOrdersAsync ---- doesn't exist
marketSellOrdersNoThrowAsync ---- doesn't exist
softCancelOrderAsync ---- doesn't exist

dutch_auction_wrapper

current method generated method notes
abi abi -----
address address -----
decodeDutchAuctionData ----- * doesn't exist
* depends on ethereumjs-util
* depends on { assetDataUtils } from '@0x/order-utils'
encodeDutchAuctionAssetData ----- * doesn't exist
* depends on ethereumjs-util
getAuctionDetailsAsync getAuctionDetails ----
matchOrdersAsync matchOrders doesn't enforce matching assetData

erc20_proxy_wrapper | erc721_proxy_wrapper

current method generated method notes
abi abi -----
address address -----
getAuthorizedAddressesAsync getAuthorizedAddresses ---
getProxyIdAsync: () => Promise<AssetProxyId> getProxyId: () => Promise<string> ---
isAuthorizedAsync: (string) => Promise<boolean> authorized: (string) => Promise<boolean> * does not normalize exchangeContractAddress to lowercase.
* Renames input param from exchangeContractAddress to input_0

erc20_token_wrapper

current method generated method notes
UNLIMITED_ALLOWANCE_IN_BASE_UNITS ---- const, doesn't exist, available in contract-wrappers/utils/constants
abi abi -----
getAllowanceAsync allowance does not take tokenAddress as argument anymore
getBalanceAsync balanceOf * does not take tokenAddress as argument anymore
* does not normalize ownerAddress to lower case
setAllowanceAsync approve ownerAddress is set as part of TxData instead of an arg
getProxyAllowanceAsync ------- doesn't exist, convenience method for getAllowanceAsync
setProxyAllowanceAsync ------- doesn't exist, convenience method for setAllowanceAsync
setUnlimitedAllowanceAsync ------- doesn't exist, convenience method for setAllowanceAsync
setUnlimitedProxyAllowanceAsync ------- doesn't exist, convenience method for setAllowanceAsync
transferAsync transfer doesn't check for insufficient balance
transferFromAsync transferFrom doesn't check for insufficient balance
getLogsAsync ------- doesn't exist
subscribe ------- doesn't exist
unsubscribe ------- doesn't exist
unsubscribeAll ------- doesn't exist

erc721_token_wrapper

current method generated method notes
abi abi -----
getApprovedIfExistsAsync getApproved returns the null address instead of undefined
getOwnerOfAsync ownerOf ----
getTokenCountAsync balanceOf doesn't normalize ownerAddress to lowercase
isApprovedForAllAsync isApprovedForAll doesn't normalize owner and operator addresses to lower case
setApprovalAsync approve doesn't normalize approvedAddress to lowercase
setApprovalForAllAsync setApprovalForAll doesn't normalize operatorAddress to lowercase
isProxyApprovedAsync ---- doesn't exist, convenience method for getApprovedIfExistsAsync
isProxyApprovedForAllAsync ---- doesn't exist, convenience method for isApprovedForAllAsync
setProxyApprovalAsync ---- doesn't exist, convenience method for setApprovalAsync
setProxyApprovalForAllAsync ---- doesn't exist, convenience method for setApprovalForAllAsync
transferFromAsync transferFrom * doesn't check approvals
* doesn't normalize addresses to lowercase
getLogsAsync ------- doesn't exist
subscribe ------- doesn't exist
unsubscribe ------- doesn't exist
unsubscribeAll ------- doesn't exist

ether_token_wrapper

current method generated method notes
abi abi -----
depositAsync deposit * doesn't normalize addresses to lowercase
* doesn't enforce sufficient balance
withdrawAsync withdraw * doesn't normalize addresses to lowercase
* doesn't enforce sufficient balance
getLogsAsync ------- doesn't exist
subscribe ------- doesn't exist
unsubscribe ------- doesn't exist
unsubscribeAll ------- doesn't exist

exchange_wrapper

Conditional is not generated: shouldValidate ? callAsync : sendTransactionAsync

current method generated method notes
abi abi -----
address address -----
zrxTokenAddress ------- doesn't exist
batchCancelOrdersAsync batchCancelOrders
batchFillOrKillOrdersAsync batchFillOrKillOrders ----
batchFillOrdersAsync batchFillOrders ----
batchFillOrdersNoThrowAsync batchFillOrdersNoThrow ----
cancelOrderAsync cancelOrder ----
cancelOrdersUpToAsync cancelOrdersUpTo ----
executeTransactionAsync executeTransaction ----
fillOrKillOrderAsync fillOrKillOrder ----
fillOrderAsync fillOrder ----
fillOrderNoThrowAsync fillOrderNoThrow ----
getAssetProxyBySignatureAsync getAssetProxy ----
getFilledTakerAssetAmountAsync filled ----
getOrderEpochAsync orderEpoch * input args renamed
* makerAddress => index_0
* senderAddress => index_1
getOrderInfoAsync getOrderInfo ----
getOrdersInfoAsync getOrdersInfo ----
getVersionAsync VERSION ----
getZRXAssetData ---- * doesn't exist
* relies on assetDataUtils
isAllowedValidatorAsync allowedValidators ----
isCancelledAsync cancelled ----
isPreSignedAsync preSigned ----
isTransactionExecutedAsync transactions ----
isValidSignatureAsync isValidSignature ----
marketBuyOrdersAsync marketBuyOrders ----
marketBuyOrdersNoThrowAsync marketBuyOrdersNoThrow ----
marketSellOrdersAsync marketSellOrders ----
marketSellOrdersNoThrowAsync marketSellOrdersNoThrow ----
matchOrdersAsync matchOrders ----
preSignAsync preSign ----
setSignatureValidatorApprovalAsync setSignatureValidatorApproval ----
transactionEncoderAsync ---- doesn't exist
validateFillOrderThrowIfInvalidAsync ---- doesn't exist, utility method
validateMakerTransferThrowIfInvalidAsync NEEDS REPLACEMENT doesn't exist, utility method
validateOrderFillableOrThrowAsync ---- doesn't exist, utility method
getLogsAsync ------- doesn't exist
subscribe ------- doesn't exist
unsubscribe ------- doesn't exist
unsubscribeAll ------- doesn't exist

forwarder_wrapper

current method generated method notes
abi abi -----
address address -----
etherTokenAddress ------- doesn't exist
zrxTokenAddress ------- doesn't exist
marketBuyOrdersWithEthAsync marketBuyOrdersWithEth does not optimize orders
marketSellOrdersWithEthAsync marketSellOrdersWithEth does not optimize orders

Missing type assertions

  • assert.isHexString => assert.isString
  • assert.doesConformToSchema('orders', orders, schemas.ordersSchema); => assert.isArray
@xianny xianny self-assigned this Jun 29, 2019
@xianny xianny changed the title Minimise API diffs between contract wrappers and generated wrappers Minimise API diffs between contract wrappers and TS generated wrappers Jun 29, 2019
@xianny xianny closed this as completed Jul 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants