Update contract-wrappers everywhere (#2068)
* add validateAndSendTransactionAsync to all wrappers * remove contract-wrappers from @0x/contracts-extensions * replace error types in contract-wrappers * upgrade asset-buyer and asset-swapper to contract-wrappers v11 * update website and 0x.js * remove calldataOptimizationUtils
This commit is contained in:
parent
29d5db16c2
commit
38d2b70ba6
@ -48,7 +48,6 @@
|
|||||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^4.1.0",
|
"@0x/abi-gen": "^4.1.0",
|
||||||
"@0x/contract-wrappers": "9.1.7",
|
|
||||||
"@0x/contracts-gen": "^1.0.13",
|
"@0x/contracts-gen": "^1.0.13",
|
||||||
"@0x/contracts-test-utils": "^3.1.13",
|
"@0x/contracts-test-utils": "^3.1.13",
|
||||||
"@0x/dev-utils": "^2.3.0",
|
"@0x/dev-utils": "^2.3.0",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { DutchAuctionWrapper } from '@0x/contract-wrappers';
|
|
||||||
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
|
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
|
||||||
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||||
@ -151,7 +150,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
feeRecipientAddress,
|
feeRecipientAddress,
|
||||||
// taker address or sender address should be set to the ducth auction contract
|
// taker address or sender address should be set to the ducth auction contract
|
||||||
takerAddress: dutchAuctionContract.address,
|
takerAddress: dutchAuctionContract.address,
|
||||||
makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
makerAssetData: assetDataUtils.encodeDutchAuctionAssetData(
|
||||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||||
auctionBeginTimeSeconds,
|
auctionBeginTimeSeconds,
|
||||||
auctionBeginAmount,
|
auctionBeginAmount,
|
||||||
@ -193,7 +192,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
describe('matchOrders', () => {
|
describe('matchOrders', () => {
|
||||||
it('should be worth the begin price at the begining of the auction', async () => {
|
it('should be worth the begin price at the begining of the auction', async () => {
|
||||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
|
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
|
||||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData(
|
||||||
defaultERC20MakerAssetData,
|
defaultERC20MakerAssetData,
|
||||||
auctionBeginTimeSeconds,
|
auctionBeginTimeSeconds,
|
||||||
auctionBeginAmount,
|
auctionBeginAmount,
|
||||||
@ -207,7 +206,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
it('should be be worth the end price at the end of the auction', async () => {
|
it('should be be worth the end price at the end of the auction', async () => {
|
||||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
||||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
||||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData(
|
||||||
defaultERC20MakerAssetData,
|
defaultERC20MakerAssetData,
|
||||||
auctionBeginTimeSeconds,
|
auctionBeginTimeSeconds,
|
||||||
auctionBeginAmount,
|
auctionBeginAmount,
|
||||||
@ -273,7 +272,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
it('should revert when auction expires', async () => {
|
it('should revert when auction expires', async () => {
|
||||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
||||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
||||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData(
|
||||||
defaultERC20MakerAssetData,
|
defaultERC20MakerAssetData,
|
||||||
auctionBeginTimeSeconds,
|
auctionBeginTimeSeconds,
|
||||||
auctionBeginAmount,
|
auctionBeginAmount,
|
||||||
@ -307,7 +306,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
});
|
});
|
||||||
it('begin time is less than end time', async () => {
|
it('begin time is less than end time', async () => {
|
||||||
auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
|
auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
|
||||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData(
|
||||||
defaultERC20MakerAssetData,
|
defaultERC20MakerAssetData,
|
||||||
auctionBeginTimeSeconds,
|
auctionBeginTimeSeconds,
|
||||||
auctionBeginAmount,
|
auctionBeginAmount,
|
||||||
@ -335,7 +334,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
it('should match orders when ERC721', async () => {
|
it('should match orders when ERC721', async () => {
|
||||||
const makerAssetId = erc721MakerAssetIds[0];
|
const makerAssetId = erc721MakerAssetIds[0];
|
||||||
const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId);
|
const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId);
|
||||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData(
|
||||||
erc721MakerAssetData,
|
erc721MakerAssetData,
|
||||||
auctionBeginTimeSeconds,
|
auctionBeginTimeSeconds,
|
||||||
auctionBeginAmount,
|
auctionBeginAmount,
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Removed @0x/order-watcher"
|
"note": "Removed @0x/order-watcher"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Update to latest @0x/contract-wrappers v11",
|
||||||
|
"pr": 2068
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen-wrappers": "^5.2.0",
|
|
||||||
"@0x/contract-addresses": "^3.0.3",
|
"@0x/contract-addresses": "^3.0.3",
|
||||||
"@0x/dev-utils": "^2.3.0",
|
"@0x/dev-utils": "^2.3.0",
|
||||||
"@0x/migrations": "^4.2.0",
|
"@0x/migrations": "^4.2.0",
|
||||||
@ -76,7 +75,7 @@
|
|||||||
"@0x/assert": "^2.1.3",
|
"@0x/assert": "^2.1.3",
|
||||||
"@0x/asset-swapper": "^1.0.1",
|
"@0x/asset-swapper": "^1.0.1",
|
||||||
"@0x/base-contract": "^5.3.1",
|
"@0x/base-contract": "^5.3.1",
|
||||||
"@0x/contract-wrappers": "9.1.7",
|
"@0x/contract-wrappers": "^11.0.0",
|
||||||
"@0x/order-utils": "^8.2.5",
|
"@0x/order-utils": "^8.2.5",
|
||||||
"@0x/subproviders": "^5.0.1",
|
"@0x/subproviders": "^5.0.1",
|
||||||
"@0x/types": "^2.4.1",
|
"@0x/types": "^2.4.1",
|
||||||
|
@ -13,36 +13,19 @@ export {
|
|||||||
CoordinatorWrapper,
|
CoordinatorWrapper,
|
||||||
CoordinatorServerCancellationResponse,
|
CoordinatorServerCancellationResponse,
|
||||||
CoordinatorServerError,
|
CoordinatorServerError,
|
||||||
DutchAuctionWrapper,
|
|
||||||
ERC20TokenWrapper,
|
|
||||||
ERC721TokenWrapper,
|
|
||||||
EtherTokenWrapper,
|
|
||||||
ExchangeWrapper,
|
|
||||||
ERC20ProxyWrapper,
|
|
||||||
ERC721ProxyWrapper,
|
|
||||||
ForwarderWrapper,
|
|
||||||
OrderValidatorWrapper,
|
|
||||||
IndexedFilterValues,
|
IndexedFilterValues,
|
||||||
BlockRange,
|
|
||||||
ContractWrappersConfig,
|
ContractWrappersConfig,
|
||||||
MethodOpts,
|
|
||||||
OrderTransactionOpts,
|
OrderTransactionOpts,
|
||||||
TransactionOpts,
|
TransactionOpts,
|
||||||
OrderStatus,
|
|
||||||
OrderInfo,
|
OrderInfo,
|
||||||
EventCallback,
|
EventCallback,
|
||||||
DecodedLogEvent,
|
DecodedLogEvent,
|
||||||
TransactionEncoder,
|
OrderStatus,
|
||||||
BalanceAndAllowance,
|
|
||||||
OrderAndTraderInfo,
|
|
||||||
TraderInfo,
|
|
||||||
ValidateOrderFillableOpts,
|
|
||||||
} from '@0x/contract-wrappers';
|
|
||||||
|
|
||||||
export {
|
|
||||||
DutchAuctionContract,
|
DutchAuctionContract,
|
||||||
ERC20ProxyContract,
|
ERC20ProxyContract,
|
||||||
|
ERC20TokenContract,
|
||||||
ERC721ProxyContract,
|
ERC721ProxyContract,
|
||||||
|
ERC721TokenContract,
|
||||||
ExchangeContract,
|
ExchangeContract,
|
||||||
ForwarderContract,
|
ForwarderContract,
|
||||||
OrderValidatorContract,
|
OrderValidatorContract,
|
||||||
@ -69,7 +52,7 @@ export {
|
|||||||
ExchangeCancelEventArgs,
|
ExchangeCancelEventArgs,
|
||||||
ExchangeEventArgs,
|
ExchangeEventArgs,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
} from '@0x/abi-gen-wrappers';
|
} from '@0x/contract-wrappers';
|
||||||
|
|
||||||
export import Web3ProviderEngine = require('web3-provider-engine');
|
export import Web3ProviderEngine = require('web3-provider-engine');
|
||||||
|
|
||||||
|
@ -100,4 +100,22 @@ public {{languageSpecificName}} = {
|
|||||||
return gas;
|
return gas;
|
||||||
},
|
},
|
||||||
{{> callAsync}}
|
{{> callAsync}}
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
{{> typed_params inputs=inputs}}
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).{{languageSpecificName}}.callAsync(
|
||||||
|
{{#each inputs~}}
|
||||||
|
{{name}},
|
||||||
|
{{/each~}}
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
const txHash = await (this as any).{{languageSpecificName}}.sendTransactionAsync(
|
||||||
|
{{#each inputs~}}
|
||||||
|
{{name}},
|
||||||
|
{{/each~}}
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -396,6 +396,11 @@ export class AbiGenDummyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).withdraw.callAsync(wad, txData);
|
||||||
|
const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Tests decoding when the input and output are complex and have more than one argument.
|
* Tests decoding when the input and output are complex and have more than one argument.
|
||||||
@ -1353,6 +1358,11 @@ export class AbiGenDummyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).nonPureMethod.callAsync(txData);
|
||||||
|
const txHash = await (this as any).nonPureMethod.sendTransactionAsync(txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Tests decoding when the input and output are complex.
|
* Tests decoding when the input and output are complex.
|
||||||
@ -1716,6 +1726,11 @@ export class AbiGenDummyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).nonPureMethodThatReturnsNothing.callAsync(txData);
|
||||||
|
const txHash = await (this as any).nonPureMethodThatReturnsNothing.sendTransactionAsync(txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public simplePureFunction = {
|
public simplePureFunction = {
|
||||||
/**
|
/**
|
||||||
|
@ -125,6 +125,14 @@ describe('AbiGenDummy Contract', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('validate and send transaction', () => {
|
||||||
|
it('should call validateAndSendTransactionAsync', async () => {
|
||||||
|
const txHash = await abiGenDummy.nonPureMethod.validateAndSendTransactionAsync();
|
||||||
|
const hexRegex = /^0x[a-fA-F0-9]+$/;
|
||||||
|
expect(txHash.match(hexRegex)).to.deep.equal([txHash]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('event subscription', () => {
|
describe('event subscription', () => {
|
||||||
const indexFilterValues = {};
|
const indexFilterValues = {};
|
||||||
const emptyCallback = () => {}; // tslint:disable-line:no-empty
|
const emptyCallback = () => {}; // tslint:disable-line:no-empty
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^2.1.3",
|
"@0x/assert": "^2.1.3",
|
||||||
"@0x/connect": "^5.0.16",
|
"@0x/connect": "^5.0.16",
|
||||||
"@0x/contract-wrappers": "9.1.7",
|
"@0x/contract-wrappers": "^11.0.0",
|
||||||
"@0x/json-schemas": "^3.1.13",
|
"@0x/json-schemas": "^3.1.13",
|
||||||
"@0x/order-utils": "^8.2.5",
|
"@0x/order-utils": "^8.2.5",
|
||||||
"@0x/subproviders": "^5.0.1",
|
"@0x/subproviders": "^5.0.1",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers';
|
import { ContractError, ContractWrappers, ForwarderError } from '@0x/contract-wrappers';
|
||||||
import { schemas } from '@0x/json-schemas';
|
import { schemas } from '@0x/json-schemas';
|
||||||
import { SignedOrder } from '@0x/order-utils';
|
import { assetDataUtils, SignedOrder } from '@0x/order-utils';
|
||||||
import { ObjectMap } from '@0x/types';
|
import { ObjectMap } from '@0x/types';
|
||||||
import { BigNumber, providerUtils } from '@0x/utils';
|
import { BigNumber, providerUtils } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -21,11 +21,10 @@ import {
|
|||||||
OrderProvider,
|
OrderProvider,
|
||||||
OrdersAndFillableAmounts,
|
OrdersAndFillableAmounts,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
import { assert } from './utils/assert';
|
import { assert } from './utils/assert';
|
||||||
import { assetDataUtils } from './utils/asset_data_utils';
|
|
||||||
import { buyQuoteCalculator } from './utils/buy_quote_calculator';
|
import { buyQuoteCalculator } from './utils/buy_quote_calculator';
|
||||||
import { calculateLiquidity } from './utils/calculate_liquidity';
|
import { calculateLiquidity } from './utils/calculate_liquidity';
|
||||||
|
import { numberPercentageToEtherTokenAmountPercentage } from './utils/number_percentage_to_ethertoken_amount_percentage';
|
||||||
import { orderProviderResponseProcessor } from './utils/order_provider_response_processor';
|
import { orderProviderResponseProcessor } from './utils/order_provider_response_processor';
|
||||||
|
|
||||||
interface OrdersEntry {
|
interface OrdersEntry {
|
||||||
@ -263,26 +262,32 @@ export class AssetBuyer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
// format fee percentage
|
||||||
|
const formattedFeePercentage = numberPercentageToEtherTokenAmountPercentage(feePercentage || 0);
|
||||||
// if no ethAmount is provided, default to the worst ethAmount from buyQuote
|
// if no ethAmount is provided, default to the worst ethAmount from buyQuote
|
||||||
const txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
|
const value = ethAmount || worstCaseQuoteInfo.totalEthAmount;
|
||||||
|
|
||||||
|
const txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEth.validateAndSendTransactionAsync(
|
||||||
orders,
|
orders,
|
||||||
assetBuyAmount,
|
assetBuyAmount,
|
||||||
finalTakerAddress,
|
orders.map(o => o.signature),
|
||||||
ethAmount || worstCaseQuoteInfo.totalEthAmount,
|
|
||||||
feeOrders,
|
feeOrders,
|
||||||
feePercentage,
|
feeOrders.map(o => o.signature),
|
||||||
|
formattedFeePercentage,
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
{
|
{
|
||||||
gasLimit,
|
value,
|
||||||
|
from: finalTakerAddress.toLowerCase(),
|
||||||
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
shouldValidate: true,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return txHash;
|
return txHash;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (_.includes(err.message, ContractWrappersError.SignatureRequestDenied)) {
|
if (_.includes(err.message, ContractError.SignatureRequestDenied)) {
|
||||||
throw new Error(AssetBuyerError.SignatureRequestDenied);
|
throw new Error(AssetBuyerError.SignatureRequestDenied);
|
||||||
} else if (_.includes(err.message, ForwarderWrapperError.CompleteFillFailed)) {
|
} else if (_.includes(err.message, ForwarderError.CompleteFillFailed)) {
|
||||||
throw new Error(AssetBuyerError.TransactionValueTooLow);
|
throw new Error(AssetBuyerError.TransactionValueTooLow);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
@ -357,13 +362,13 @@ export class AssetBuyer {
|
|||||||
* Will throw if WETH does not exist for the current network.
|
* Will throw if WETH does not exist for the current network.
|
||||||
*/
|
*/
|
||||||
private _getEtherTokenAssetDataOrThrow(): string {
|
private _getEtherTokenAssetDataOrThrow(): string {
|
||||||
return assetDataUtils.getEtherTokenAssetData(this._contractWrappers);
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.etherToken);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the assetData that represents the ZRX token.
|
* Get the assetData that represents the ZRX token.
|
||||||
* Will throw if ZRX does not exist for the current network.
|
* Will throw if ZRX does not exist for the current network.
|
||||||
*/
|
*/
|
||||||
private _getZrxTokenAssetDataOrThrow(): string {
|
private _getZrxTokenAssetDataOrThrow(): string {
|
||||||
return this._contractWrappers.exchange.getZRXAssetData();
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.zrxToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
|
||||||
import { assetDataUtils as sharedAssetDataUtils } from '@0x/order-utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
export const assetDataUtils = {
|
|
||||||
...sharedAssetDataUtils,
|
|
||||||
getEtherTokenAssetData(contractWrappers: ContractWrappers): string {
|
|
||||||
const etherTokenAddress = contractWrappers.forwarder.etherTokenAddress;
|
|
||||||
const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddress);
|
|
||||||
return etherTokenAssetData;
|
|
||||||
},
|
|
||||||
};
|
|
@ -0,0 +1,9 @@
|
|||||||
|
import { BigNumber } from '@0x/utils';
|
||||||
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
|
|
||||||
|
// HACK (xianny): copied from asset-swapper, which will replace this package
|
||||||
|
const ONE_AMOUNT = new BigNumber(1);
|
||||||
|
const ETHER_TOKEN_DECIMALS = 18;
|
||||||
|
export const numberPercentageToEtherTokenAmountPercentage = (percentage: number): BigNumber => {
|
||||||
|
return Web3Wrapper.toBaseUnitAmount(ONE_AMOUNT, ETHER_TOKEN_DECIMALS).multipliedBy(percentage);
|
||||||
|
};
|
@ -1,4 +1,4 @@
|
|||||||
import { OrderAndTraderInfo, OrderStatus, OrderValidatorWrapper } from '@0x/contract-wrappers';
|
import { OrderAndTraderInfo, OrderStatus, OrderValidatorContract } from '@0x/contract-wrappers';
|
||||||
import { orderCalculationUtils, sortingUtils } from '@0x/order-utils';
|
import { orderCalculationUtils, sortingUtils } from '@0x/order-utils';
|
||||||
import { RemainingFillableCalculator } from '@0x/order-utils/lib/src/remaining_fillable_calculator';
|
import { RemainingFillableCalculator } from '@0x/order-utils/lib/src/remaining_fillable_calculator';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
@ -34,7 +34,7 @@ export const orderProviderResponseProcessor = {
|
|||||||
orderProviderResponse: OrderProviderResponse,
|
orderProviderResponse: OrderProviderResponse,
|
||||||
isMakerAssetZrxToken: boolean,
|
isMakerAssetZrxToken: boolean,
|
||||||
expiryBufferSeconds: number,
|
expiryBufferSeconds: number,
|
||||||
orderValidator?: OrderValidatorWrapper,
|
orderValidator?: OrderValidatorContract,
|
||||||
): Promise<OrdersAndFillableAmounts> {
|
): Promise<OrdersAndFillableAmounts> {
|
||||||
// drop orders that are expired or not open
|
// drop orders that are expired or not open
|
||||||
const filteredOrders = filterOutExpiredAndNonOpenOrders(orderProviderResponse.orders, expiryBufferSeconds);
|
const filteredOrders = filterOutExpiredAndNonOpenOrders(orderProviderResponse.orders, expiryBufferSeconds);
|
||||||
@ -44,10 +44,16 @@ export const orderProviderResponseProcessor = {
|
|||||||
if (orderValidator !== undefined) {
|
if (orderValidator !== undefined) {
|
||||||
const takerAddresses = _.map(filteredOrders, () => constants.NULL_ADDRESS);
|
const takerAddresses = _.map(filteredOrders, () => constants.NULL_ADDRESS);
|
||||||
try {
|
try {
|
||||||
const ordersAndTradersInfo = await orderValidator.getOrdersAndTradersInfoAsync(
|
const [ordersInfo, tradersInfo] = await orderValidator.getOrdersAndTradersInfo.callAsync(
|
||||||
filteredOrders,
|
filteredOrders,
|
||||||
takerAddresses,
|
takerAddresses,
|
||||||
);
|
);
|
||||||
|
const ordersAndTradersInfo = ordersInfo.map((orderInfo, index) => {
|
||||||
|
return {
|
||||||
|
orderInfo,
|
||||||
|
traderInfo: tradersInfo[index],
|
||||||
|
};
|
||||||
|
});
|
||||||
// take orders + on chain information and find the valid orders and remaining fillable maker asset amounts
|
// take orders + on chain information and find the valid orders and remaining fillable maker asset amounts
|
||||||
unsortedOrders = getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
|
unsortedOrders = getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
|
||||||
filteredOrders,
|
filteredOrders,
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
"@0x/assert": "^2.1.3",
|
"@0x/assert": "^2.1.3",
|
||||||
"@0x/connect": "^5.0.16",
|
"@0x/connect": "^5.0.16",
|
||||||
"@0x/contract-addresses": "^3.0.3",
|
"@0x/contract-addresses": "^3.0.3",
|
||||||
"@0x/contract-wrappers": "9.1.7",
|
"@0x/contract-wrappers": "^11.0.0",
|
||||||
"@0x/dev-utils": "^2.3.0",
|
"@0x/dev-utils": "^2.3.0",
|
||||||
"@0x/fill-scenarios": "^3.0.16",
|
"@0x/fill-scenarios": "^3.0.16",
|
||||||
"@0x/json-schemas": "^3.1.13",
|
"@0x/json-schemas": "^3.1.13",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers';
|
import { ContractError, ContractWrappers, ForwarderError } from '@0x/contract-wrappers';
|
||||||
import { MarketOperation } from '@0x/types';
|
import { MarketOperation } from '@0x/types';
|
||||||
import { AbiEncoder, providerUtils } from '@0x/utils';
|
import { AbiEncoder, providerUtils } from '@0x/utils';
|
||||||
import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper';
|
import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper';
|
||||||
@ -144,34 +144,34 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<Exchange
|
|||||||
let txHash: string;
|
let txHash: string;
|
||||||
if (quote.type === MarketOperation.Buy) {
|
if (quote.type === MarketOperation.Buy) {
|
||||||
const { makerAssetFillAmount } = quote;
|
const { makerAssetFillAmount } = quote;
|
||||||
txHash = await this._contractWrappers.exchange.marketBuyOrdersNoThrowAsync(
|
txHash = await this._contractWrappers.exchange.marketBuyOrdersNoThrow.validateAndSendTransactionAsync(
|
||||||
orders,
|
orders,
|
||||||
makerAssetFillAmount,
|
makerAssetFillAmount,
|
||||||
finalTakerAddress,
|
orders.map(o => o.signature),
|
||||||
{
|
{
|
||||||
gasLimit,
|
from: finalTakerAddress,
|
||||||
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
shouldValidate: true,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const { takerAssetFillAmount } = quote;
|
const { takerAssetFillAmount } = quote;
|
||||||
txHash = await this._contractWrappers.exchange.marketSellOrdersNoThrowAsync(
|
txHash = await this._contractWrappers.exchange.marketSellOrdersNoThrow.validateAndSendTransactionAsync(
|
||||||
orders,
|
orders,
|
||||||
takerAssetFillAmount,
|
takerAssetFillAmount,
|
||||||
finalTakerAddress,
|
orders.map(o => o.signature),
|
||||||
{
|
{
|
||||||
gasLimit,
|
from: finalTakerAddress,
|
||||||
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
shouldValidate: true,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return txHash;
|
return txHash;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (_.includes(err.message, ContractWrappersError.SignatureRequestDenied)) {
|
if (_.includes(err.message, ContractError.SignatureRequestDenied)) {
|
||||||
throw new Error(SwapQuoteConsumerError.SignatureRequestDenied);
|
throw new Error(SwapQuoteConsumerError.SignatureRequestDenied);
|
||||||
} else if (_.includes(err.message, ForwarderWrapperError.CompleteFillFailed)) {
|
} else if (_.includes(err.message, ForwarderError.CompleteFillFailed)) {
|
||||||
throw new Error(SwapQuoteConsumerError.TransactionValueTooLow);
|
throw new Error(SwapQuoteConsumerError.TransactionValueTooLow);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers';
|
import { ContractError, ContractWrappers, ForwarderError } from '@0x/contract-wrappers';
|
||||||
import { calldataOptimizationUtils } from '@0x/contract-wrappers/lib/src/utils/calldata_optimization_utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { MarketOperation } from '@0x/types';
|
import { MarketOperation } from '@0x/types';
|
||||||
import { AbiEncoder, providerUtils } from '@0x/utils';
|
import { AbiEncoder, providerUtils } from '@0x/utils';
|
||||||
import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper';
|
import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper';
|
||||||
@ -20,7 +20,6 @@ import {
|
|||||||
} from '../types';
|
} from '../types';
|
||||||
import { affiliateFeeUtils } from '../utils/affiliate_fee_utils';
|
import { affiliateFeeUtils } from '../utils/affiliate_fee_utils';
|
||||||
import { assert } from '../utils/assert';
|
import { assert } from '../utils/assert';
|
||||||
import { assetDataUtils } from '../utils/asset_data_utils';
|
|
||||||
import { swapQuoteConsumerUtils } from '../utils/swap_quote_consumer_utils';
|
import { swapQuoteConsumerUtils } from '../utils/swap_quote_consumer_utils';
|
||||||
import { utils } from '../utils/utils';
|
import { utils } from '../utils/utils';
|
||||||
|
|
||||||
@ -103,9 +102,6 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
|
|
||||||
// lowercase input addresses
|
// lowercase input addresses
|
||||||
const normalizedFeeRecipientAddress = feeRecipient.toLowerCase();
|
const normalizedFeeRecipientAddress = feeRecipient.toLowerCase();
|
||||||
// optimize orders
|
|
||||||
const optimizedOrders = calldataOptimizationUtils.optimizeForwarderOrders(orders);
|
|
||||||
const optimizedFeeOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(feeOrders);
|
|
||||||
|
|
||||||
const signatures = _.map(orders, o => o.signature);
|
const signatures = _.map(orders, o => o.signature);
|
||||||
const feeSignatures = _.map(feeOrders, o => o.signature);
|
const feeSignatures = _.map(feeOrders, o => o.signature);
|
||||||
@ -119,10 +115,10 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
const { makerAssetFillAmount } = quoteWithAffiliateFee;
|
const { makerAssetFillAmount } = quoteWithAffiliateFee;
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
orders: optimizedOrders,
|
orders,
|
||||||
makerAssetFillAmount,
|
makerAssetFillAmount,
|
||||||
signatures,
|
signatures,
|
||||||
feeOrders: optimizedFeeOrders,
|
feeOrders,
|
||||||
feeSignatures,
|
feeSignatures,
|
||||||
feePercentage,
|
feePercentage,
|
||||||
feeRecipient: normalizedFeeRecipientAddress,
|
feeRecipient: normalizedFeeRecipientAddress,
|
||||||
@ -132,9 +128,9 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
methodName = 'marketBuyOrdersWithEth';
|
methodName = 'marketBuyOrdersWithEth';
|
||||||
} else {
|
} else {
|
||||||
params = {
|
params = {
|
||||||
orders: optimizedOrders,
|
orders,
|
||||||
signatures,
|
signatures,
|
||||||
feeOrders: optimizedFeeOrders,
|
feeOrders,
|
||||||
feeSignatures,
|
feeSignatures,
|
||||||
feePercentage,
|
feePercentage,
|
||||||
feeRecipient: normalizedFeeRecipientAddress,
|
feeRecipient: normalizedFeeRecipientAddress,
|
||||||
@ -191,46 +187,52 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
|
|
||||||
const { orders, feeOrders, worstCaseQuoteInfo } = quoteWithAffiliateFee;
|
const { orders, feeOrders, worstCaseQuoteInfo } = quoteWithAffiliateFee;
|
||||||
|
|
||||||
|
// get taker address
|
||||||
const finalTakerAddress = await swapQuoteConsumerUtils.getTakerAddressOrThrowAsync(this.provider, opts);
|
const finalTakerAddress = await swapQuoteConsumerUtils.getTakerAddressOrThrowAsync(this.provider, opts);
|
||||||
|
// if no ethAmount is provided, default to the worst totalTakerTokenAmount
|
||||||
|
const value = ethAmount || worstCaseQuoteInfo.totalTakerTokenAmount;
|
||||||
|
// format fee percentage
|
||||||
|
const formattedFeePercentage = utils.numberPercentageToEtherTokenAmountPercentage(feePercentage);
|
||||||
try {
|
try {
|
||||||
let txHash: string;
|
let txHash: string;
|
||||||
if (quoteWithAffiliateFee.type === MarketOperation.Buy) {
|
if (quoteWithAffiliateFee.type === MarketOperation.Buy) {
|
||||||
const { makerAssetFillAmount } = quoteWithAffiliateFee;
|
const { makerAssetFillAmount } = quoteWithAffiliateFee;
|
||||||
txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
|
txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEth.validateAndSendTransactionAsync(
|
||||||
orders,
|
orders,
|
||||||
makerAssetFillAmount,
|
makerAssetFillAmount,
|
||||||
finalTakerAddress,
|
orders.map(o => o.signature),
|
||||||
ethAmount || worstCaseQuoteInfo.totalTakerTokenAmount,
|
|
||||||
feeOrders,
|
feeOrders,
|
||||||
feePercentage,
|
feeOrders.map(o => o.signature),
|
||||||
|
formattedFeePercentage,
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
{
|
{
|
||||||
gasLimit,
|
value,
|
||||||
|
from: finalTakerAddress.toLowerCase(),
|
||||||
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
shouldValidate: true,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
txHash = await this._contractWrappers.forwarder.marketSellOrdersWithEthAsync(
|
txHash = await this._contractWrappers.forwarder.marketSellOrdersWithEth.validateAndSendTransactionAsync(
|
||||||
orders,
|
orders,
|
||||||
finalTakerAddress,
|
orders.map(o => o.signature),
|
||||||
ethAmount || worstCaseQuoteInfo.totalTakerTokenAmount,
|
|
||||||
feeOrders,
|
feeOrders,
|
||||||
feePercentage,
|
feeOrders.map(o => o.signature),
|
||||||
|
formattedFeePercentage,
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
{
|
{
|
||||||
gasLimit,
|
value,
|
||||||
|
from: finalTakerAddress.toLowerCase(),
|
||||||
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
shouldValidate: true,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return txHash;
|
return txHash;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (_.includes(err.message, ContractWrappersError.SignatureRequestDenied)) {
|
if (_.includes(err.message, ContractError.SignatureRequestDenied)) {
|
||||||
throw new Error(SwapQuoteConsumerError.SignatureRequestDenied);
|
throw new Error(SwapQuoteConsumerError.SignatureRequestDenied);
|
||||||
} else if (_.includes(err.message, ForwarderWrapperError.CompleteFillFailed)) {
|
} else if (_.includes(err.message, ForwarderError.CompleteFillFailed)) {
|
||||||
throw new Error(SwapQuoteConsumerError.TransactionValueTooLow);
|
throw new Error(SwapQuoteConsumerError.TransactionValueTooLow);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
@ -239,6 +241,6 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _getEtherTokenAssetDataOrThrow(): string {
|
private _getEtherTokenAssetDataOrThrow(): string {
|
||||||
return assetDataUtils.getEtherTokenAssetData(this._contractWrappers);
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.etherToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
import { ContractWrappers } from '@0x/contract-wrappers';
|
||||||
import { schemas } from '@0x/json-schemas';
|
import { schemas } from '@0x/json-schemas';
|
||||||
import { SignedOrder } from '@0x/order-utils';
|
import { assetDataUtils, SignedOrder } from '@0x/order-utils';
|
||||||
import { MarketOperation, ObjectMap } from '@0x/types';
|
import { MarketOperation, ObjectMap } from '@0x/types';
|
||||||
import { BigNumber, providerUtils } from '@0x/utils';
|
import { BigNumber, providerUtils } from '@0x/utils';
|
||||||
import { SupportedProvider, ZeroExProvider } from 'ethereum-types';
|
import { SupportedProvider, ZeroExProvider } from 'ethereum-types';
|
||||||
@ -23,7 +23,6 @@ import {
|
|||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
import { assert } from './utils/assert';
|
import { assert } from './utils/assert';
|
||||||
import { assetDataUtils } from './utils/asset_data_utils';
|
|
||||||
import { calculateLiquidity } from './utils/calculate_liquidity';
|
import { calculateLiquidity } from './utils/calculate_liquidity';
|
||||||
import { orderProviderResponseProcessor } from './utils/order_provider_response_processor';
|
import { orderProviderResponseProcessor } from './utils/order_provider_response_processor';
|
||||||
import { swapQuoteCalculator } from './utils/swap_quote_calculator';
|
import { swapQuoteCalculator } from './utils/swap_quote_calculator';
|
||||||
@ -382,14 +381,15 @@ export class SwapQuoter {
|
|||||||
swapQuote: SwapQuote,
|
swapQuote: SwapQuote,
|
||||||
takerAddress: string,
|
takerAddress: string,
|
||||||
): Promise<[boolean, boolean]> {
|
): Promise<[boolean, boolean]> {
|
||||||
const orderValidatorWrapper = this._contractWrappers.orderValidator;
|
const orderValidator = this._contractWrappers.orderValidator;
|
||||||
const balanceAndAllowance = await orderValidatorWrapper.getBalanceAndAllowanceAsync(
|
const balanceAndAllowance = await orderValidator.getBalanceAndAllowance.callAsync(
|
||||||
takerAddress,
|
takerAddress,
|
||||||
swapQuote.takerAssetData,
|
swapQuote.takerAssetData,
|
||||||
);
|
);
|
||||||
|
const allowance = balanceAndAllowance[1];
|
||||||
return [
|
return [
|
||||||
balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.bestCaseQuoteInfo.totalTakerTokenAmount),
|
allowance.isGreaterThanOrEqualTo(swapQuote.bestCaseQuoteInfo.totalTakerTokenAmount),
|
||||||
balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.worstCaseQuoteInfo.totalTakerTokenAmount),
|
allowance.isGreaterThanOrEqualTo(swapQuote.worstCaseQuoteInfo.totalTakerTokenAmount),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ export class SwapQuoter {
|
|||||||
* Will throw if ZRX does not exist for the current network.
|
* Will throw if ZRX does not exist for the current network.
|
||||||
*/
|
*/
|
||||||
private _getZrxTokenAssetDataOrThrow(): string {
|
private _getZrxTokenAssetDataOrThrow(): string {
|
||||||
return this._contractWrappers.exchange.getZRXAssetData();
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.zrxToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
|
||||||
import { assetDataUtils as sharedAssetDataUtils } from '@0x/order-utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
export const assetDataUtils = {
|
|
||||||
...sharedAssetDataUtils,
|
|
||||||
getEtherTokenAssetData(contractWrappers: ContractWrappers): string {
|
|
||||||
const etherTokenAddress = contractWrappers.forwarder.etherTokenAddress;
|
|
||||||
const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddress);
|
|
||||||
return etherTokenAssetData;
|
|
||||||
},
|
|
||||||
};
|
|
@ -1,4 +1,4 @@
|
|||||||
import { OrderAndTraderInfo, OrderStatus, OrderValidatorWrapper } from '@0x/contract-wrappers';
|
import { OrderAndTraderInfo, OrderStatus, OrderValidatorContract } from '@0x/contract-wrappers';
|
||||||
import { orderCalculationUtils, sortingUtils } from '@0x/order-utils';
|
import { orderCalculationUtils, sortingUtils } from '@0x/order-utils';
|
||||||
import { RemainingFillableCalculator } from '@0x/order-utils/lib/src/remaining_fillable_calculator';
|
import { RemainingFillableCalculator } from '@0x/order-utils/lib/src/remaining_fillable_calculator';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
@ -34,7 +34,7 @@ export const orderProviderResponseProcessor = {
|
|||||||
orderProviderResponse: OrderProviderResponse,
|
orderProviderResponse: OrderProviderResponse,
|
||||||
isMakerAssetZrxToken: boolean,
|
isMakerAssetZrxToken: boolean,
|
||||||
expiryBufferMs: number,
|
expiryBufferMs: number,
|
||||||
orderValidator?: OrderValidatorWrapper,
|
orderValidator?: OrderValidatorContract,
|
||||||
): Promise<OrdersAndFillableAmounts> {
|
): Promise<OrdersAndFillableAmounts> {
|
||||||
// drop orders that are expired or not open
|
// drop orders that are expired or not open
|
||||||
const filteredOrders = filterOutExpiredAndNonOpenOrders(
|
const filteredOrders = filterOutExpiredAndNonOpenOrders(
|
||||||
@ -47,10 +47,17 @@ export const orderProviderResponseProcessor = {
|
|||||||
if (orderValidator !== undefined) {
|
if (orderValidator !== undefined) {
|
||||||
const takerAddresses = _.map(filteredOrders, () => constants.NULL_ADDRESS);
|
const takerAddresses = _.map(filteredOrders, () => constants.NULL_ADDRESS);
|
||||||
try {
|
try {
|
||||||
const ordersAndTradersInfo = await orderValidator.getOrdersAndTradersInfoAsync(
|
const [ordersInfo, tradersInfo] = await orderValidator.getOrdersAndTradersInfo.callAsync(
|
||||||
filteredOrders,
|
filteredOrders,
|
||||||
takerAddresses,
|
takerAddresses,
|
||||||
);
|
);
|
||||||
|
const ordersAndTradersInfo: OrderAndTraderInfo[] = ordersInfo.map((orderInfo, index) => {
|
||||||
|
const singleOrderAndTraderInfo: OrderAndTraderInfo = {
|
||||||
|
orderInfo,
|
||||||
|
traderInfo: tradersInfo[index],
|
||||||
|
};
|
||||||
|
return singleOrderAndTraderInfo;
|
||||||
|
});
|
||||||
// take orders + on chain information and find the valid orders and remaining fillable maker asset amounts
|
// take orders + on chain information and find the valid orders and remaining fillable maker asset amounts
|
||||||
unsortedOrders = getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
|
unsortedOrders = getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
|
||||||
filteredOrders,
|
filteredOrders,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
import { ContractWrappers } from '@0x/contract-wrappers';
|
||||||
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { MarketOperation, SignedOrder } from '@0x/types';
|
import { MarketOperation, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper';
|
import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -15,7 +16,6 @@ import {
|
|||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
import { assert } from './assert';
|
import { assert } from './assert';
|
||||||
import { assetDataUtils } from './asset_data_utils';
|
|
||||||
|
|
||||||
export const swapQuoteConsumerUtils = {
|
export const swapQuoteConsumerUtils = {
|
||||||
async getTakerAddressOrThrowAsync(
|
async getTakerAddressOrThrowAsync(
|
||||||
@ -52,9 +52,8 @@ export const swapQuoteConsumerUtils = {
|
|||||||
takerAddress: string,
|
takerAddress: string,
|
||||||
): Promise<[BigNumber, BigNumber]> {
|
): Promise<[BigNumber, BigNumber]> {
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const wethAddress = contractWrappers.forwarder.etherTokenAddress;
|
|
||||||
const ethBalance = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
|
const ethBalance = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
|
||||||
const wethBalance = await contractWrappers.erc20Token.getBalanceAsync(wethAddress, takerAddress);
|
const wethBalance = await contractWrappers.weth9.balanceOf.callAsync(takerAddress);
|
||||||
return [ethBalance, wethBalance];
|
return [ethBalance, wethBalance];
|
||||||
},
|
},
|
||||||
isValidForwarderSwapQuote(swapQuote: SwapQuote, wethAssetData: string): boolean {
|
isValidForwarderSwapQuote(swapQuote: SwapQuote, wethAssetData: string): boolean {
|
||||||
@ -86,7 +85,7 @@ export const swapQuoteConsumerUtils = {
|
|||||||
provider: Provider,
|
provider: Provider,
|
||||||
opts: Partial<SwapQuoteGetOutputOpts>,
|
opts: Partial<SwapQuoteGetOutputOpts>,
|
||||||
): Promise<ConsumerType> {
|
): Promise<ConsumerType> {
|
||||||
const wethAssetData = assetDataUtils.getEtherTokenAssetData(contractWrappers);
|
const wethAssetData = assetDataUtils.encodeERC20AssetData(contractWrappers.contractAddresses.etherToken);
|
||||||
if (swapQuoteConsumerUtils.isValidForwarderSwapQuote(quote, wethAssetData)) {
|
if (swapQuoteConsumerUtils.isValidForwarderSwapQuote(quote, wethAssetData)) {
|
||||||
if (opts.takerAddress !== undefined) {
|
if (opts.takerAddress !== undefined) {
|
||||||
assert.isETHAddressHex('takerAddress', opts.takerAddress);
|
assert.isETHAddressHex('takerAddress', opts.takerAddress);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ContractAddresses, ContractWrappers } from '@0x/contract-wrappers';
|
import { ContractAddresses, ContractWrappers, ERC20TokenContract } from '@0x/contract-wrappers';
|
||||||
import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils';
|
import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils';
|
||||||
import { FillScenarios } from '@0x/fill-scenarios';
|
import { FillScenarios } from '@0x/fill-scenarios';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
@ -35,6 +35,7 @@ const FILLABLE_AMOUNTS = [new BigNumber(3), new BigNumber(2), new BigNumber(5)].
|
|||||||
describe('ExchangeSwapQuoteConsumer', () => {
|
describe('ExchangeSwapQuoteConsumer', () => {
|
||||||
let contractWrappers: ContractWrappers;
|
let contractWrappers: ContractWrappers;
|
||||||
let userAddresses: string[];
|
let userAddresses: string[];
|
||||||
|
let erc20TokenContract: ERC20TokenContract;
|
||||||
let coinbaseAddress: string;
|
let coinbaseAddress: string;
|
||||||
let makerAddress: string;
|
let makerAddress: string;
|
||||||
let takerAddress: string;
|
let takerAddress: string;
|
||||||
@ -78,6 +79,7 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
||||||
assetDataUtils.encodeERC20AssetData(contractAddresses.etherToken),
|
assetDataUtils.encodeERC20AssetData(contractAddresses.etherToken),
|
||||||
];
|
];
|
||||||
|
erc20TokenContract = new ERC20TokenContract(makerTokenAddress, provider);
|
||||||
});
|
});
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await blockchainLifecycle.revertAsync();
|
await blockchainLifecycle.revertAsync();
|
||||||
@ -123,24 +125,24 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
* Does not test the validity of the state change performed by the forwarder smart contract
|
* Does not test the validity of the state change performed by the forwarder smart contract
|
||||||
*/
|
*/
|
||||||
it('should perform a marketSell execution when provided a MarketSell type swapQuote', async () => {
|
it('should perform a marketSell execution when provided a MarketSell type swapQuote', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketSellSwapQuote, { takerAddress });
|
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketSellSwapQuote, { takerAddress });
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
});
|
});
|
||||||
it('should perform a marketBuy execution when provided a MarketBuy type swapQuote', async () => {
|
it('should perform a marketBuy execution when provided a MarketBuy type swapQuote', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketBuySwapQuote, { takerAddress });
|
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketBuySwapQuote, { takerAddress });
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
});
|
});
|
||||||
@ -183,8 +185,8 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
describe('getCalldataOrThrow', () => {
|
describe('getCalldataOrThrow', () => {
|
||||||
describe('valid swap quote', async () => {
|
describe('valid swap quote', async () => {
|
||||||
it('provide correct and optimized calldata options with default options for a marketSell SwapQuote (no affiliate fees)', async () => {
|
it('provide correct and optimized calldata options with default options for a marketSell SwapQuote (no affiliate fees)', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
||||||
@ -198,14 +200,14 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
data: calldataHexString,
|
data: calldataHexString,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
});
|
});
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
});
|
});
|
||||||
it('provide correct and optimized calldata options with default options for a marketBuy SwapQuote (no affiliate fees)', async () => {
|
it('provide correct and optimized calldata options with default options for a marketBuy SwapQuote (no affiliate fees)', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
||||||
@ -219,8 +221,8 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
data: calldataHexString,
|
data: calldataHexString,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
});
|
});
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20TokenContract.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20TokenContract.balanceOf.callAsync(takerAddress);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ContractAddresses, ContractWrappers } from '@0x/contract-wrappers';
|
import { ContractAddresses, ContractWrappers, ERC20TokenContract } from '@0x/contract-wrappers';
|
||||||
import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils';
|
import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { MarketOperation, SignedOrder } from '@0x/types';
|
import { MarketOperation, SignedOrder } from '@0x/types';
|
||||||
@ -30,9 +30,11 @@ const MARKET_OPERATION = MarketOperation.Sell;
|
|||||||
const FILLABLE_AMOUNTS = [new BigNumber(2), new BigNumber(3), new BigNumber(5)].map(value =>
|
const FILLABLE_AMOUNTS = [new BigNumber(2), new BigNumber(3), new BigNumber(5)].map(value =>
|
||||||
value.multipliedBy(ONE_ETH_IN_WEI),
|
value.multipliedBy(ONE_ETH_IN_WEI),
|
||||||
);
|
);
|
||||||
|
const UNLIMITED_ALLOWANCE_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1); // tslint:disable-line:custom-no-magic-numbers
|
||||||
|
|
||||||
describe('ForwarderSwapQuoteConsumer', () => {
|
describe('ForwarderSwapQuoteConsumer', () => {
|
||||||
let contractWrappers: ContractWrappers;
|
let contractWrappers: ContractWrappers;
|
||||||
|
let erc20Token: ERC20TokenContract;
|
||||||
let userAddresses: string[];
|
let userAddresses: string[];
|
||||||
let coinbaseAddress: string;
|
let coinbaseAddress: string;
|
||||||
let makerAddress: string;
|
let makerAddress: string;
|
||||||
@ -63,6 +65,7 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
contractWrappers = new ContractWrappers(provider, config);
|
contractWrappers = new ContractWrappers(provider, config);
|
||||||
[coinbaseAddress, takerAddress, makerAddress, feeRecipient] = userAddresses;
|
[coinbaseAddress, takerAddress, makerAddress, feeRecipient] = userAddresses;
|
||||||
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
|
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
|
||||||
|
erc20Token = new ERC20TokenContract(makerTokenAddress, provider);
|
||||||
[makerAssetData, takerAssetData, wethAssetData] = [
|
[makerAssetData, takerAssetData, wethAssetData] = [
|
||||||
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
|
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
|
||||||
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
||||||
@ -74,7 +77,7 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
});
|
});
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
const UNLIMITED_ALLOWANCE = contractWrappers.erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
const UNLIMITED_ALLOWANCE = UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||||
erc20ProxyAddress = contractWrappers.erc20Proxy.address;
|
erc20ProxyAddress = contractWrappers.erc20Proxy.address;
|
||||||
|
|
||||||
const totalFillableAmount = FILLABLE_AMOUNTS.reduce(
|
const totalFillableAmount = FILLABLE_AMOUNTS.reduce(
|
||||||
@ -82,19 +85,13 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
new BigNumber(0),
|
new BigNumber(0),
|
||||||
);
|
);
|
||||||
|
|
||||||
await contractWrappers.erc20Token.transferAsync(
|
await erc20Token.transfer.sendTransactionAsync(makerAddress, totalFillableAmount, {
|
||||||
makerTokenAddress,
|
from: coinbaseAddress,
|
||||||
coinbaseAddress,
|
});
|
||||||
makerAddress,
|
|
||||||
totalFillableAmount,
|
|
||||||
);
|
|
||||||
|
|
||||||
await contractWrappers.erc20Token.setAllowanceAsync(
|
await erc20Token.approve.sendTransactionAsync(erc20ProxyAddress, UNLIMITED_ALLOWANCE, {
|
||||||
makerTokenAddress,
|
from: makerAddress,
|
||||||
makerAddress,
|
});
|
||||||
erc20ProxyAddress,
|
|
||||||
UNLIMITED_ALLOWANCE,
|
|
||||||
);
|
|
||||||
orders = await getSignedOrdersWithNoFeesAsync(
|
orders = await getSignedOrdersWithNoFeesAsync(
|
||||||
provider,
|
provider,
|
||||||
makerAssetData,
|
makerAssetData,
|
||||||
@ -158,32 +155,32 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
* Does not test the validity of the state change performed by the forwarder smart contract
|
* Does not test the validity of the state change performed by the forwarder smart contract
|
||||||
*/
|
*/
|
||||||
it('should perform a marketSell execution when provided a MarketSell type swapQuote', async () => {
|
it('should perform a marketSell execution when provided a MarketSell type swapQuote', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketSellSwapQuote, { takerAddress });
|
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketSellSwapQuote, { takerAddress });
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(0.5).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(0.5).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(9.5).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(9.5).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should perform a marketBuy execution when provided a MarketBuy type swapQuote', async () => {
|
it('should perform a marketBuy execution when provided a MarketBuy type swapQuote', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketBuySwapQuote, { takerAddress });
|
await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketBuySwapQuote, { takerAddress });
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should perform a marketBuy execution with affiliate fees', async () => {
|
it('should perform a marketBuy execution with affiliate fees', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
@ -192,8 +189,8 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
feePercentage: 0.05,
|
feePercentage: 0.05,
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
});
|
});
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
@ -204,15 +201,15 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
|
|
||||||
// TODO(david) Finish marketSell affiliate fee excution testing
|
// TODO(david) Finish marketSell affiliate fee excution testing
|
||||||
// it('should perform a marketSell execution with affiliate fees', async () => {
|
// it('should perform a marketSell execution with affiliate fees', async () => {
|
||||||
// let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
// let makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
// let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
// let takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
// const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
// const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
||||||
// expect(makerBalance).to.bignumber.equal((new BigNumber(10)).multipliedBy(ONE_ETH_IN_WEI));
|
// expect(makerBalance).to.bignumber.equal((new BigNumber(10)).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
// expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
// expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
// console.log(makerBalance, takerBalance, feeRecipientEthBalanceBefore);
|
// console.log(makerBalance, takerBalance, feeRecipientEthBalanceBefore);
|
||||||
// await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketSellSwapQuote, { takerAddress, feePercentage: 0.05, feeRecipient });
|
// await swapQuoteConsumer.executeSwapQuoteOrThrowAsync(marketSellSwapQuote, { takerAddress, feePercentage: 0.05, feeRecipient });
|
||||||
// makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
// makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
// takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
// takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
// const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
// const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipient);
|
||||||
// console.log(makerBalance, takerBalance, feeRecipientEthBalanceAfter);
|
// console.log(makerBalance, takerBalance, feeRecipientEthBalanceAfter);
|
||||||
// expect(makerBalance).to.bignumber.equal((new BigNumber(0.5)).multipliedBy(ONE_ETH_IN_WEI));
|
// expect(makerBalance).to.bignumber.equal((new BigNumber(0.5)).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
@ -368,8 +365,8 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
|
|
||||||
describe('valid swap quote', async () => {
|
describe('valid swap quote', async () => {
|
||||||
it('provide correct and optimized calldata options with default options for a marketSell SwapQuote (no affiliate fees)', async () => {
|
it('provide correct and optimized calldata options with default options for a marketSell SwapQuote (no affiliate fees)', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
||||||
@ -384,14 +381,14 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
value: marketSellSwapQuote.worstCaseQuoteInfo.totalTakerTokenAmount,
|
value: marketSellSwapQuote.worstCaseQuoteInfo.totalTakerTokenAmount,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
});
|
});
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(0.5).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(0.5).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(9.5).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(9.5).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
});
|
});
|
||||||
it('provide correct and optimized calldata options with default options for a marketBuy SwapQuote (no affiliate fees)', async () => {
|
it('provide correct and optimized calldata options with default options for a marketBuy SwapQuote (no affiliate fees)', async () => {
|
||||||
let makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
let makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
let takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
let takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(makerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(takerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
const { calldataHexString, toAddress } = await swapQuoteConsumer.getCalldataOrThrowAsync(
|
||||||
@ -406,8 +403,8 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
value: marketBuySwapQuote.worstCaseQuoteInfo.totalTakerTokenAmount,
|
value: marketBuySwapQuote.worstCaseQuoteInfo.totalTakerTokenAmount,
|
||||||
gas: 4000000,
|
gas: 4000000,
|
||||||
});
|
});
|
||||||
makerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, makerAddress);
|
makerBalance = await erc20Token.balanceOf.callAsync(makerAddress);
|
||||||
takerBalance = await contractWrappers.erc20Token.getBalanceAsync(makerTokenAddress, takerAddress);
|
takerBalance = await erc20Token.balanceOf.callAsync(takerAddress);
|
||||||
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
expect(takerBalance).to.bignumber.equal(new BigNumber(10).multipliedBy(ONE_ETH_IN_WEI));
|
||||||
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
expect(makerBalance).to.bignumber.equal(constants.ZERO_AMOUNT);
|
||||||
});
|
});
|
||||||
|
@ -146,7 +146,7 @@ describe('swapQuoteConsumerUtils', () => {
|
|||||||
});
|
});
|
||||||
it('should return exchange consumer if takerAsset is wEth and taker has enough weth', async () => {
|
it('should return exchange consumer if takerAsset is wEth and taker has enough weth', async () => {
|
||||||
const etherInWei = new BigNumber(20).multipliedBy(ONE_ETH_IN_WEI);
|
const etherInWei = new BigNumber(20).multipliedBy(ONE_ETH_IN_WEI);
|
||||||
await contractWrappers.etherToken.depositAsync(contractAddresses.etherToken, etherInWei, takerAddress);
|
await contractWrappers.weth9.deposit.sendTransactionAsync({ value: etherInWei, from: takerAddress });
|
||||||
const consumerType = await swapQuoteConsumerUtils.getConsumerTypeForSwapQuoteAsync(
|
const consumerType = await swapQuoteConsumerUtils.getConsumerTypeForSwapQuoteAsync(
|
||||||
forwarderSwapQuote,
|
forwarderSwapQuote,
|
||||||
contractWrappers,
|
contractWrappers,
|
||||||
@ -157,7 +157,7 @@ describe('swapQuoteConsumerUtils', () => {
|
|||||||
});
|
});
|
||||||
it('should return forwarder consumer if takerAsset is wEth and takerAddress has no available balance in either weth or eth (defaulting behavior)', async () => {
|
it('should return forwarder consumer if takerAsset is wEth and takerAddress has no available balance in either weth or eth (defaulting behavior)', async () => {
|
||||||
const etherInWei = new BigNumber(50).multipliedBy(ONE_ETH_IN_WEI);
|
const etherInWei = new BigNumber(50).multipliedBy(ONE_ETH_IN_WEI);
|
||||||
await contractWrappers.etherToken.depositAsync(contractAddresses.etherToken, etherInWei, takerAddress);
|
await contractWrappers.weth9.deposit.sendTransactionAsync({ value: etherInWei, from: takerAddress });
|
||||||
const consumerType = await swapQuoteConsumerUtils.getConsumerTypeForSwapQuoteAsync(
|
const consumerType = await swapQuoteConsumerUtils.getConsumerTypeForSwapQuoteAsync(
|
||||||
largeForwarderSwapQuote,
|
largeForwarderSwapQuote,
|
||||||
contractWrappers,
|
contractWrappers,
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "11.1.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add `contractAddresses` to `ContractWrappers` class. Add `validateAndSendTransactionAsync` to all methods. Add interfaces ForwarderError, ContractError, TraderInfo, OrderAndTraderInfo.",
|
||||||
|
"pr": 2068
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "11.0.0",
|
"version": "11.0.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -51,11 +51,7 @@
|
|||||||
"@0x/assert": "^2.1.3",
|
"@0x/assert": "^2.1.3",
|
||||||
"@0x/contracts-test-utils": "^3.1.12",
|
"@0x/contracts-test-utils": "^3.1.12",
|
||||||
"@0x/coordinator-server": "^0.1.3",
|
"@0x/coordinator-server": "^0.1.3",
|
||||||
"@0x/dev-utils": "^2.2.6",
|
|
||||||
"@0x/fill-scenarios": "^3.0.15",
|
|
||||||
"@0x/json-schemas": "^3.1.13",
|
"@0x/json-schemas": "^3.1.13",
|
||||||
"@0x/migrations": "^4.1.11",
|
|
||||||
"@0x/subproviders": "^5.0.0",
|
|
||||||
"@0x/tslint-config": "^3.0.1",
|
"@0x/tslint-config": "^3.0.1",
|
||||||
"@0x/types": "^2.4.1",
|
"@0x/types": "^2.4.1",
|
||||||
"@0x/utils": "^4.5.0",
|
"@0x/utils": "^4.5.0",
|
||||||
@ -73,12 +69,9 @@
|
|||||||
"shx": "^0.2.2"
|
"shx": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/abi-gen-wrappers": "^5.2.0",
|
|
||||||
"@0x/base-contract": "^5.3.1",
|
"@0x/base-contract": "^5.3.1",
|
||||||
"@0x/contract-addresses": "^3.0.3",
|
"@0x/contract-addresses": "^3.0.3",
|
||||||
"@0x/contract-artifacts": "^2.0.4",
|
"@0x/contract-artifacts": "^2.0.4",
|
||||||
"@0x/contracts-test-utils": "^3.1.13",
|
|
||||||
"@0x/coordinator-server": "^0.1.3",
|
|
||||||
"@0x/dev-utils": "^2.3.0",
|
"@0x/dev-utils": "^2.3.0",
|
||||||
"@0x/fill-scenarios": "^3.0.16",
|
"@0x/fill-scenarios": "^3.0.16",
|
||||||
"@0x/migrations": "^4.2.0",
|
"@0x/migrations": "^4.2.0",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { ContractAddresses } from '@0x/contract-addresses';
|
||||||
import {
|
import {
|
||||||
Coordinator,
|
Coordinator,
|
||||||
DutchAuction,
|
DutchAuction,
|
||||||
@ -22,7 +23,6 @@ import { ERC721ProxyContract } from './generated-wrappers/erc721_proxy';
|
|||||||
import { ExchangeContract } from './generated-wrappers/exchange';
|
import { ExchangeContract } from './generated-wrappers/exchange';
|
||||||
import { ForwarderContract } from './generated-wrappers/forwarder';
|
import { ForwarderContract } from './generated-wrappers/forwarder';
|
||||||
import { OrderValidatorContract } from './generated-wrappers/order_validator';
|
import { OrderValidatorContract } from './generated-wrappers/order_validator';
|
||||||
|
|
||||||
import { WETH9Contract } from './generated-wrappers/weth9';
|
import { WETH9Contract } from './generated-wrappers/weth9';
|
||||||
import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema';
|
import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema';
|
||||||
import { ContractWrappersConfig } from './types';
|
import { ContractWrappersConfig } from './types';
|
||||||
@ -33,6 +33,10 @@ import { _getDefaultContractAddresses } from './utils/contract_addresses';
|
|||||||
* The ContractWrappers class contains smart contract wrappers helpful when building on 0x protocol.
|
* The ContractWrappers class contains smart contract wrappers helpful when building on 0x protocol.
|
||||||
*/
|
*/
|
||||||
export class ContractWrappers {
|
export class ContractWrappers {
|
||||||
|
/**
|
||||||
|
* An index of the default contract addresses for this network.
|
||||||
|
*/
|
||||||
|
public contractAddresses: ContractAddresses;
|
||||||
/**
|
/**
|
||||||
* An instance of the ExchangeContract class containing methods for interacting with the 0x Exchange smart contract.
|
* An instance of the ExchangeContract class containing methods for interacting with the 0x Exchange smart contract.
|
||||||
*/
|
*/
|
||||||
@ -116,6 +120,7 @@ export class ContractWrappers {
|
|||||||
contractAddresses.exchange,
|
contractAddresses.exchange,
|
||||||
contractAddresses.coordinatorRegistry,
|
contractAddresses.coordinatorRegistry,
|
||||||
);
|
);
|
||||||
|
this.contractAddresses = contractAddresses;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Unsubscribes from all subscriptions for all contracts.
|
* Unsubscribes from all subscriptions for all contracts.
|
||||||
|
@ -336,6 +336,11 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(owner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).removeOwner.callAsync(owner, txData);
|
||||||
|
const txHash = await (this as any).removeOwner.sendTransactionAsync(owner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Allows an owner to revoke a confirmation for a transaction.
|
* Allows an owner to revoke a confirmation for a transaction.
|
||||||
@ -492,6 +497,14 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
transactionId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).revokeConfirmation.callAsync(transactionId, txData);
|
||||||
|
const txHash = await (this as any).revokeConfirmation.sendTransactionAsync(transactionId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public isOwner = {
|
public isOwner = {
|
||||||
/**
|
/**
|
||||||
@ -803,6 +816,17 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
transactionId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).executeRemoveAuthorizedAddressAtIndex.callAsync(transactionId, txData);
|
||||||
|
const txHash = await (this as any).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||||
|
transactionId,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public secondsTimeLocked = {
|
public secondsTimeLocked = {
|
||||||
/**
|
/**
|
||||||
@ -1138,6 +1162,19 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
assetProxyContract: string,
|
||||||
|
isRegistered: boolean,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).registerAssetProxy.callAsync(assetProxyContract, isRegistered, txData);
|
||||||
|
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(
|
||||||
|
assetProxyContract,
|
||||||
|
isRegistered,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Allows to add a new owner. Transaction has to be sent by wallet.
|
* Allows to add a new owner. Transaction has to be sent by wallet.
|
||||||
@ -1288,6 +1325,11 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(owner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).addOwner.callAsync(owner, txData);
|
||||||
|
const txHash = await (this as any).addOwner.sendTransactionAsync(owner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Returns the confirmation status of a transaction.
|
* Returns the confirmation status of a transaction.
|
||||||
@ -1526,6 +1568,14 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_secondsTimeLocked: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).changeTimeLock.callAsync(_secondsTimeLocked, txData);
|
||||||
|
const txHash = await (this as any).changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public isAssetProxyRegistered = {
|
public isAssetProxyRegistered = {
|
||||||
/**
|
/**
|
||||||
@ -2195,6 +2245,14 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_required: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).changeRequirement.callAsync(_required, txData);
|
||||||
|
const txHash = await (this as any).changeRequirement.sendTransactionAsync(_required, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Allows an owner to confirm a transaction.
|
* Allows an owner to confirm a transaction.
|
||||||
@ -2351,6 +2409,14 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
transactionId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).confirmTransaction.callAsync(transactionId, txData);
|
||||||
|
const txHash = await (this as any).confirmTransaction.sendTransactionAsync(transactionId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Allows an owner to submit and confirm a transaction.
|
* Allows an owner to submit and confirm a transaction.
|
||||||
@ -2561,6 +2627,16 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
destination: string,
|
||||||
|
value: BigNumber,
|
||||||
|
data: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).submitTransaction.callAsync(destination, value, data, txData);
|
||||||
|
const txHash = await (this as any).submitTransaction.sendTransactionAsync(destination, value, data, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public confirmationTimes = {
|
public confirmationTimes = {
|
||||||
/**
|
/**
|
||||||
@ -2939,6 +3015,15 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
owner: string,
|
||||||
|
newOwner: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).replaceOwner.callAsync(owner, newOwner, txData);
|
||||||
|
const txHash = await (this as any).replaceOwner.sendTransactionAsync(owner, newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Allows anyone to execute a confirmed transaction.
|
* Allows anyone to execute a confirmed transaction.
|
||||||
@ -3095,6 +3180,14 @@ export class AssetProxyOwnerContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
transactionId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).executeTransaction.callAsync(transactionId, txData);
|
||||||
|
const txHash = await (this as any).executeTransaction.sendTransactionAsync(transactionId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
private readonly _subscriptionManager: SubscriptionManager<AssetProxyOwnerEventArgs, AssetProxyOwnerEvents>;
|
private readonly _subscriptionManager: SubscriptionManager<AssetProxyOwnerEventArgs, AssetProxyOwnerEvents>;
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
|
@ -567,6 +567,32 @@ export class CoordinatorContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
transaction: { salt: BigNumber; signerAddress: string; data: string },
|
||||||
|
txOrigin: string,
|
||||||
|
transactionSignature: string,
|
||||||
|
approvalExpirationTimeSeconds: BigNumber[],
|
||||||
|
approvalSignatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).executeTransaction.callAsync(
|
||||||
|
transaction,
|
||||||
|
txOrigin,
|
||||||
|
transactionSignature,
|
||||||
|
approvalExpirationTimeSeconds,
|
||||||
|
approvalSignatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
const txHash = await (this as any).executeTransaction.sendTransactionAsync(
|
||||||
|
transaction,
|
||||||
|
txOrigin,
|
||||||
|
transactionSignature,
|
||||||
|
approvalExpirationTimeSeconds,
|
||||||
|
approvalSignatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public EIP712_EXCHANGE_DOMAIN_HASH = {
|
public EIP712_EXCHANGE_DOMAIN_HASH = {
|
||||||
/**
|
/**
|
||||||
|
@ -201,6 +201,14 @@ export class CoordinatorRegistryContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
coordinatorEndpoint: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).setCoordinatorEndpoint.callAsync(coordinatorEndpoint, txData);
|
||||||
|
const txHash = await (this as any).setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets the endpoint for a Coordinator.
|
* Gets the endpoint for a Coordinator.
|
||||||
|
@ -302,6 +302,15 @@ export class DummyERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_spender: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).approve.callAsync(_spender, _value, txData);
|
||||||
|
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Query total supply of token
|
* Query total supply of token
|
||||||
@ -578,6 +587,16 @@ export class DummyERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public decimals = {
|
public decimals = {
|
||||||
/**
|
/**
|
||||||
@ -988,6 +1007,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).mint.callAsync(_value, txData);
|
||||||
|
const txHash = await (this as any).mint.sendTransactionAsync(_value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* send `value` token to `to` from `msg.sender`
|
* send `value` token to `to` from `msg.sender`
|
||||||
@ -1162,6 +1189,15 @@ export class DummyERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_to: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transfer.callAsync(_to, _value, txData);
|
||||||
|
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public allowance = {
|
public allowance = {
|
||||||
/**
|
/**
|
||||||
@ -1430,6 +1466,15 @@ export class DummyERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_target: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).setBalance.callAsync(_target, _value, txData);
|
||||||
|
const txHash = await (this as any).setBalance.sendTransactionAsync(_target, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public transferOwnership = {
|
public transferOwnership = {
|
||||||
/**
|
/**
|
||||||
@ -1574,6 +1619,11 @@ export class DummyERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public MAX_MINT_AMOUNT = {
|
public MAX_MINT_AMOUNT = {
|
||||||
/**
|
/**
|
||||||
|
@ -387,6 +387,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_approved: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).approve.callAsync(_approved, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Throws unless `msg.sender` is the current owner, an authorized
|
* Throws unless `msg.sender` is the current owner, an authorized
|
||||||
@ -599,6 +608,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Function to mint a new token
|
* Function to mint a new token
|
||||||
@ -777,6 +796,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).mint.callAsync(_to, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).mint.sendTransactionAsync(_to, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* This works identically to the other function with an extra data parameter,
|
* This works identically to the other function with an extra data parameter,
|
||||||
@ -987,6 +1015,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* NFTs assigned to zero address are considered invalid, and queries
|
* NFTs assigned to zero address are considered invalid, and queries
|
||||||
@ -1439,6 +1477,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_owner: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).burn.callAsync(_owner, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).burn.sendTransactionAsync(_owner, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Emits the ApprovalForAll event. The contract MUST allow
|
* Emits the ApprovalForAll event. The contract MUST allow
|
||||||
@ -1630,6 +1677,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_operator: string,
|
||||||
|
_approved: boolean,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData);
|
||||||
|
const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Throws unless `msg.sender` is the current owner, an authorized
|
* Throws unless `msg.sender` is the current owner, an authorized
|
||||||
@ -1868,6 +1924,23 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
_data: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData);
|
||||||
|
const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync(
|
||||||
|
_from,
|
||||||
|
_to,
|
||||||
|
_tokenId,
|
||||||
|
_data,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public isApprovedForAll = {
|
public isApprovedForAll = {
|
||||||
/**
|
/**
|
||||||
@ -2094,6 +2167,11 @@ export class DummyERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
private readonly _subscriptionManager: SubscriptionManager<DummyERC721TokenEventArgs, DummyERC721TokenEvents>;
|
private readonly _subscriptionManager: SubscriptionManager<DummyERC721TokenEventArgs, DummyERC721TokenEvents>;
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
|
@ -311,6 +311,27 @@ export class DutchAuctionContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
order: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).getAuctionDetails.callAsync(order, txData);
|
||||||
|
const txHash = await (this as any).getAuctionDetails.sendTransactionAsync(order, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
|
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
|
||||||
@ -775,6 +796,49 @@ export class DutchAuctionContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
buyOrder: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
sellOrder: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
buySignature: string,
|
||||||
|
sellSignature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).matchOrders.callAsync(buyOrder, sellOrder, buySignature, sellSignature, txData);
|
||||||
|
const txHash = await (this as any).matchOrders.sendTransactionAsync(
|
||||||
|
buyOrder,
|
||||||
|
sellOrder,
|
||||||
|
buySignature,
|
||||||
|
sellSignature,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
artifact: ContractArtifact | SimpleContractArtifact,
|
artifact: ContractArtifact | SimpleContractArtifact,
|
||||||
|
@ -205,6 +205,11 @@ export class ERC20ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).addAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public authorities = {
|
public authorities = {
|
||||||
/**
|
/**
|
||||||
@ -425,6 +430,11 @@ export class ERC20ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public owner = {
|
public owner = {
|
||||||
/**
|
/**
|
||||||
@ -677,6 +687,19 @@ export class ERC20ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
target: string,
|
||||||
|
index: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||||
|
target,
|
||||||
|
index,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets the proxy id associated with the proxy address.
|
* Gets the proxy id associated with the proxy address.
|
||||||
@ -1023,6 +1046,11 @@ export class ERC20ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
private readonly _subscriptionManager: SubscriptionManager<ERC20ProxyEventArgs, ERC20ProxyEvents>;
|
private readonly _subscriptionManager: SubscriptionManager<ERC20ProxyEventArgs, ERC20ProxyEvents>;
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
|
@ -240,6 +240,15 @@ export class ERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_spender: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).approve.callAsync(_spender, _value, txData);
|
||||||
|
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Query total supply of token
|
* Query total supply of token
|
||||||
@ -516,6 +525,16 @@ export class ERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Query the balance of owner
|
* Query the balance of owner
|
||||||
@ -764,6 +783,15 @@ export class ERC20TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_to: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transfer.callAsync(_to, _value, txData);
|
||||||
|
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public allowance = {
|
public allowance = {
|
||||||
/**
|
/**
|
||||||
|
@ -205,6 +205,11 @@ export class ERC721ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).addAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public authorities = {
|
public authorities = {
|
||||||
/**
|
/**
|
||||||
@ -425,6 +430,11 @@ export class ERC721ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public owner = {
|
public owner = {
|
||||||
/**
|
/**
|
||||||
@ -677,6 +687,19 @@ export class ERC721ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
target: string,
|
||||||
|
index: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||||
|
target,
|
||||||
|
index,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets the proxy id associated with the proxy address.
|
* Gets the proxy id associated with the proxy address.
|
||||||
@ -1023,6 +1046,11 @@ export class ERC721ProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
private readonly _subscriptionManager: SubscriptionManager<ERC721ProxyEventArgs, ERC721ProxyEvents>;
|
private readonly _subscriptionManager: SubscriptionManager<ERC721ProxyEventArgs, ERC721ProxyEvents>;
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
|
@ -325,6 +325,15 @@ export class ERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_approved: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).approve.callAsync(_approved, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Throws unless `msg.sender` is the current owner, an authorized
|
* Throws unless `msg.sender` is the current owner, an authorized
|
||||||
@ -537,6 +546,16 @@ export class ERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* This works identically to the other function with an extra data parameter,
|
* This works identically to the other function with an extra data parameter,
|
||||||
@ -747,6 +766,16 @@ export class ERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData);
|
||||||
|
const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* NFTs assigned to zero address are considered invalid, and queries
|
* NFTs assigned to zero address are considered invalid, and queries
|
||||||
@ -1088,6 +1117,15 @@ export class ERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_operator: string,
|
||||||
|
_approved: boolean,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData);
|
||||||
|
const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Throws unless `msg.sender` is the current owner, an authorized
|
* Throws unless `msg.sender` is the current owner, an authorized
|
||||||
@ -1326,6 +1364,23 @@ export class ERC721TokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_tokenId: BigNumber,
|
||||||
|
_data: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData);
|
||||||
|
const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync(
|
||||||
|
_from,
|
||||||
|
_to,
|
||||||
|
_tokenId,
|
||||||
|
_data,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public isApprovedForAll = {
|
public isApprovedForAll = {
|
||||||
/**
|
/**
|
||||||
|
@ -477,6 +477,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
takerAssetFillAmounts: BigNumber[],
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).batchFillOrders.callAsync(orders, takerAssetFillAmounts, signatures, txData);
|
||||||
|
const txHash = await (this as any).batchFillOrders.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
takerAssetFillAmounts,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public cancelled = {
|
public cancelled = {
|
||||||
/**
|
/**
|
||||||
@ -750,6 +778,16 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
hash: string,
|
||||||
|
signerAddress: string,
|
||||||
|
signature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).preSign.callAsync(hash, signerAddress, signature, txData);
|
||||||
|
const txHash = await (this as any).preSign.sendTransactionAsync(hash, signerAddress, signature, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Match two complementary orders that have a profitable spread.
|
* Match two complementary orders that have a profitable spread.
|
||||||
@ -1193,6 +1231,49 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
leftOrder: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
rightOrder: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
leftSignature: string,
|
||||||
|
rightSignature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).matchOrders.callAsync(leftOrder, rightOrder, leftSignature, rightSignature, txData);
|
||||||
|
const txHash = await (this as any).matchOrders.sendTransactionAsync(
|
||||||
|
leftOrder,
|
||||||
|
rightOrder,
|
||||||
|
leftSignature,
|
||||||
|
rightSignature,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Fills the input order.
|
* Fills the input order.
|
||||||
@ -1504,6 +1585,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
order: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
takerAssetFillAmount: BigNumber,
|
||||||
|
signature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).fillOrderNoThrow.callAsync(order, takerAssetFillAmount, signature, txData);
|
||||||
|
const txHash = await (this as any).fillOrderNoThrow.sendTransactionAsync(
|
||||||
|
order,
|
||||||
|
takerAssetFillAmount,
|
||||||
|
signature,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public assetProxies = {
|
public assetProxies = {
|
||||||
/**
|
/**
|
||||||
@ -1813,6 +1922,27 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).batchCancelOrders.callAsync(orders, txData);
|
||||||
|
const txHash = await (this as any).batchCancelOrders.sendTransactionAsync(orders, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Synchronously executes multiple calls of fillOrKill.
|
* Synchronously executes multiple calls of fillOrKill.
|
||||||
@ -2133,6 +2263,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
takerAssetFillAmounts: BigNumber[],
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).batchFillOrKillOrders.callAsync(orders, takerAssetFillAmounts, signatures, txData);
|
||||||
|
const txHash = await (this as any).batchFillOrKillOrders.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
takerAssetFillAmounts,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
|
* Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
|
||||||
@ -2295,6 +2453,14 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
targetOrderEpoch: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).cancelOrdersUpTo.callAsync(targetOrderEpoch, txData);
|
||||||
|
const txHash = await (this as any).cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Fills an order with specified parameters and ECDSA signature.
|
* Fills an order with specified parameters and ECDSA signature.
|
||||||
@ -2616,6 +2782,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
takerAssetFillAmounts: BigNumber[],
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).batchFillOrdersNoThrow.callAsync(orders, takerAssetFillAmounts, signatures, txData);
|
||||||
|
const txHash = await (this as any).batchFillOrdersNoThrow.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
takerAssetFillAmounts,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets an asset proxy.
|
* Gets an asset proxy.
|
||||||
@ -3067,6 +3261,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
order: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
takerAssetFillAmount: BigNumber,
|
||||||
|
signature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).fillOrKillOrder.callAsync(order, takerAssetFillAmount, signature, txData);
|
||||||
|
const txHash = await (this as any).fillOrKillOrder.sendTransactionAsync(
|
||||||
|
order,
|
||||||
|
takerAssetFillAmount,
|
||||||
|
signature,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Approves/unnapproves a Validator contract to verify signatures on signer's behalf.
|
* Approves/unnapproves a Validator contract to verify signatures on signer's behalf.
|
||||||
@ -3261,6 +3483,19 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
validatorAddress: string,
|
||||||
|
approval: boolean,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).setSignatureValidatorApproval.callAsync(validatorAddress, approval, txData);
|
||||||
|
const txHash = await (this as any).setSignatureValidatorApproval.sendTransactionAsync(
|
||||||
|
validatorAddress,
|
||||||
|
approval,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public allowedValidators = {
|
public allowedValidators = {
|
||||||
/**
|
/**
|
||||||
@ -3653,6 +3888,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
takerAssetFillAmount: BigNumber,
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).marketSellOrders.callAsync(orders, takerAssetFillAmount, signatures, txData);
|
||||||
|
const txHash = await (this as any).marketSellOrders.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
takerAssetFillAmount,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Fetches information for all passed in orders.
|
* Fetches information for all passed in orders.
|
||||||
@ -4324,6 +4587,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
makerAssetFillAmount: BigNumber,
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).marketBuyOrdersNoThrow.callAsync(orders, makerAssetFillAmount, signatures, txData);
|
||||||
|
const txHash = await (this as any).marketBuyOrdersNoThrow.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
makerAssetFillAmount,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Fills the input order.
|
* Fills the input order.
|
||||||
@ -4629,6 +4920,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
order: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
takerAssetFillAmount: BigNumber,
|
||||||
|
signature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).fillOrder.callAsync(order, takerAssetFillAmount, signature, txData);
|
||||||
|
const txHash = await (this as any).fillOrder.sendTransactionAsync(
|
||||||
|
order,
|
||||||
|
takerAssetFillAmount,
|
||||||
|
signature,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Executes an exchange method call in the context of signer.
|
* Executes an exchange method call in the context of signer.
|
||||||
@ -4855,6 +5174,23 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
salt: BigNumber,
|
||||||
|
signerAddress: string,
|
||||||
|
data: string,
|
||||||
|
signature: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).executeTransaction.callAsync(salt, signerAddress, data, signature, txData);
|
||||||
|
const txHash = await (this as any).executeTransaction.sendTransactionAsync(
|
||||||
|
salt,
|
||||||
|
signerAddress,
|
||||||
|
data,
|
||||||
|
signature,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Registers an asset proxy to its asset proxy id.
|
* Registers an asset proxy to its asset proxy id.
|
||||||
@ -5012,6 +5348,14 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
assetProxy: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).registerAssetProxy.callAsync(assetProxy, txData);
|
||||||
|
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(assetProxy, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets information about an order: status, hash, and amount filled.
|
* Gets information about an order: status, hash, and amount filled.
|
||||||
@ -5377,6 +5721,27 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
order: {
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
},
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).cancelOrder.callAsync(order, txData);
|
||||||
|
const txHash = await (this as any).cancelOrder.sendTransactionAsync(order, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public orderEpoch = {
|
public orderEpoch = {
|
||||||
/**
|
/**
|
||||||
@ -5832,6 +6197,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
takerAssetFillAmount: BigNumber,
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).marketSellOrdersNoThrow.callAsync(orders, takerAssetFillAmount, signatures, txData);
|
||||||
|
const txHash = await (this as any).marketSellOrdersNoThrow.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
takerAssetFillAmount,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public EIP712_DOMAIN_HASH = {
|
public EIP712_DOMAIN_HASH = {
|
||||||
/**
|
/**
|
||||||
@ -6209,6 +6602,34 @@ export class ExchangeContract extends BaseContract {
|
|||||||
}>(returnData);
|
}>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
makerAssetFillAmount: BigNumber,
|
||||||
|
signatures: string[],
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).marketBuyOrders.callAsync(orders, makerAssetFillAmount, signatures, txData);
|
||||||
|
const txHash = await (this as any).marketBuyOrders.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
makerAssetFillAmount,
|
||||||
|
signatures,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public currentContextAddress = {
|
public currentContextAddress = {
|
||||||
/**
|
/**
|
||||||
@ -6415,6 +6836,11 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public VERSION = {
|
public VERSION = {
|
||||||
/**
|
/**
|
||||||
|
@ -584,6 +584,64 @@ export class ForwarderContract extends BaseContract {
|
|||||||
>(returnData);
|
>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
makerAssetFillAmount: BigNumber,
|
||||||
|
signatures: string[],
|
||||||
|
feeOrders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
feeSignatures: string[],
|
||||||
|
feePercentage: BigNumber,
|
||||||
|
feeRecipient: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).marketBuyOrdersWithEth.callAsync(
|
||||||
|
orders,
|
||||||
|
makerAssetFillAmount,
|
||||||
|
signatures,
|
||||||
|
feeOrders,
|
||||||
|
feeSignatures,
|
||||||
|
feePercentage,
|
||||||
|
feeRecipient,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
const txHash = await (this as any).marketBuyOrdersWithEth.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
makerAssetFillAmount,
|
||||||
|
signatures,
|
||||||
|
feeOrders,
|
||||||
|
feeSignatures,
|
||||||
|
feePercentage,
|
||||||
|
feeRecipient,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Withdraws assets from this contract. The contract requires a ZRX balance in order to
|
* Withdraws assets from this contract. The contract requires a ZRX balance in order to
|
||||||
@ -763,6 +821,15 @@ export class ForwarderContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
assetData: string,
|
||||||
|
amount: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).withdrawAsset.callAsync(assetData, amount, txData);
|
||||||
|
const txHash = await (this as any).withdrawAsset.sendTransactionAsync(assetData, amount, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public owner = {
|
public owner = {
|
||||||
/**
|
/**
|
||||||
@ -1335,6 +1402,61 @@ export class ForwarderContract extends BaseContract {
|
|||||||
>(returnData);
|
>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
orders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
signatures: string[],
|
||||||
|
feeOrders: Array<{
|
||||||
|
makerAddress: string;
|
||||||
|
takerAddress: string;
|
||||||
|
feeRecipientAddress: string;
|
||||||
|
senderAddress: string;
|
||||||
|
makerAssetAmount: BigNumber;
|
||||||
|
takerAssetAmount: BigNumber;
|
||||||
|
makerFee: BigNumber;
|
||||||
|
takerFee: BigNumber;
|
||||||
|
expirationTimeSeconds: BigNumber;
|
||||||
|
salt: BigNumber;
|
||||||
|
makerAssetData: string;
|
||||||
|
takerAssetData: string;
|
||||||
|
}>,
|
||||||
|
feeSignatures: string[],
|
||||||
|
feePercentage: BigNumber,
|
||||||
|
feeRecipient: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).marketSellOrdersWithEth.callAsync(
|
||||||
|
orders,
|
||||||
|
signatures,
|
||||||
|
feeOrders,
|
||||||
|
feeSignatures,
|
||||||
|
feePercentage,
|
||||||
|
feeRecipient,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
const txHash = await (this as any).marketSellOrdersWithEth.sendTransactionAsync(
|
||||||
|
orders,
|
||||||
|
signatures,
|
||||||
|
feeOrders,
|
||||||
|
feeSignatures,
|
||||||
|
feePercentage,
|
||||||
|
feeRecipient,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public transferOwnership = {
|
public transferOwnership = {
|
||||||
/**
|
/**
|
||||||
@ -1479,6 +1601,11 @@ export class ForwarderContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
artifact: ContractArtifact | SimpleContractArtifact,
|
artifact: ContractArtifact | SimpleContractArtifact,
|
||||||
|
@ -178,6 +178,11 @@ export class IAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).addAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Removes authorizion of an address.
|
* Removes authorizion of an address.
|
||||||
@ -330,6 +335,11 @@ export class IAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Removes authorizion of an address.
|
* Removes authorizion of an address.
|
||||||
@ -520,6 +530,19 @@ export class IAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
target: string,
|
||||||
|
index: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||||
|
target,
|
||||||
|
index,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Transfers assets. Either succeeds or throws.
|
* Transfers assets. Either succeeds or throws.
|
||||||
@ -746,6 +769,17 @@ export class IAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
assetData: string,
|
||||||
|
from: string,
|
||||||
|
to: string,
|
||||||
|
amount: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets the proxy id associated with the proxy address.
|
* Gets the proxy id associated with the proxy address.
|
||||||
@ -1022,6 +1056,11 @@ export class IAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
artifact: ContractArtifact | SimpleContractArtifact,
|
artifact: ContractArtifact | SimpleContractArtifact,
|
||||||
|
@ -276,6 +276,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).addAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public authorities = {
|
public authorities = {
|
||||||
/**
|
/**
|
||||||
@ -570,6 +575,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public owner = {
|
public owner = {
|
||||||
/**
|
/**
|
||||||
@ -822,6 +832,19 @@ export class MultiAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
target: string,
|
||||||
|
index: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
|
||||||
|
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||||
|
target,
|
||||||
|
index,
|
||||||
|
txData,
|
||||||
|
);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets the proxy id associated with the proxy address.
|
* Gets the proxy id associated with the proxy address.
|
||||||
@ -1115,6 +1138,14 @@ export class MultiAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
assetProxy: string,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).registerAssetProxy.callAsync(assetProxy, txData);
|
||||||
|
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(assetProxy, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Gets all authorized addresses.
|
* Gets all authorized addresses.
|
||||||
@ -1325,6 +1356,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).transferOwnership.callAsync(newOwner, txData);
|
||||||
|
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
private readonly _subscriptionManager: SubscriptionManager<MultiAssetProxyEventArgs, MultiAssetProxyEvents>;
|
private readonly _subscriptionManager: SubscriptionManager<MultiAssetProxyEventArgs, MultiAssetProxyEvents>;
|
||||||
public static async deployFrom0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
|
@ -287,6 +287,15 @@ export class WETH9Contract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
guy: string,
|
||||||
|
wad: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).approve.callAsync(guy, wad, txData);
|
||||||
|
const txHash = await (this as any).approve.sendTransactionAsync(guy, wad, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public totalSupply = {
|
public totalSupply = {
|
||||||
/**
|
/**
|
||||||
@ -540,6 +549,16 @@ export class WETH9Contract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
src: string,
|
||||||
|
dst: string,
|
||||||
|
wad: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(src, dst, wad, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(src, dst, wad, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public withdraw = {
|
public withdraw = {
|
||||||
/**
|
/**
|
||||||
@ -682,6 +701,11 @@ export class WETH9Contract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).withdraw.callAsync(wad, txData);
|
||||||
|
const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public decimals = {
|
public decimals = {
|
||||||
/**
|
/**
|
||||||
@ -1032,6 +1056,15 @@ export class WETH9Contract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
dst: string,
|
||||||
|
wad: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transfer.callAsync(dst, wad, txData);
|
||||||
|
const txHash = await (this as any).transfer.sendTransactionAsync(dst, wad, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public deposit = {
|
public deposit = {
|
||||||
/**
|
/**
|
||||||
@ -1168,6 +1201,11 @@ export class WETH9Contract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
|
||||||
|
await (this as any).deposit.callAsync(txData);
|
||||||
|
const txHash = await (this as any).deposit.sendTransactionAsync(txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public allowance = {
|
public allowance = {
|
||||||
/**
|
/**
|
||||||
|
@ -288,6 +288,15 @@ export class ZRXTokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_spender: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).approve.callAsync(_spender, _value, txData);
|
||||||
|
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public totalSupply = {
|
public totalSupply = {
|
||||||
/**
|
/**
|
||||||
@ -560,6 +569,16 @@ export class ZRXTokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_from: string,
|
||||||
|
_to: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
|
||||||
|
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public decimals = {
|
public decimals = {
|
||||||
/**
|
/**
|
||||||
@ -912,6 +931,15 @@ export class ZRXTokenContract extends BaseContract {
|
|||||||
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
|
||||||
return abiDecodedReturnData;
|
return abiDecodedReturnData;
|
||||||
},
|
},
|
||||||
|
async validateAndSendTransactionAsync(
|
||||||
|
_to: string,
|
||||||
|
_value: BigNumber,
|
||||||
|
txData?: Partial<TxData> | undefined,
|
||||||
|
): Promise<string> {
|
||||||
|
await (this as any).transfer.callAsync(_to, _value, txData);
|
||||||
|
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
|
||||||
|
return txHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
public allowance = {
|
public allowance = {
|
||||||
/**
|
/**
|
||||||
|
@ -24,4 +24,21 @@ export * from '@0x/contract-addresses';
|
|||||||
|
|
||||||
export { ContractWrappers } from './contract_wrappers';
|
export { ContractWrappers } from './contract_wrappers';
|
||||||
export { CoordinatorWrapper } from './coordinator_wrapper';
|
export { CoordinatorWrapper } from './coordinator_wrapper';
|
||||||
export { OrderStatus } from './types';
|
|
||||||
|
export { BlockRange } from '@0x/base-contract';
|
||||||
|
export {
|
||||||
|
OrderStatus,
|
||||||
|
ContractError,
|
||||||
|
ForwarderError,
|
||||||
|
OrderAndTraderInfo,
|
||||||
|
CoordinatorServerCancellationResponse,
|
||||||
|
CoordinatorServerError,
|
||||||
|
IndexedFilterValues,
|
||||||
|
ContractWrappersConfig,
|
||||||
|
OrderTransactionOpts,
|
||||||
|
TransactionOpts,
|
||||||
|
OrderInfo,
|
||||||
|
EventCallback,
|
||||||
|
DecodedLogEvent,
|
||||||
|
TraderInfo,
|
||||||
|
} from './types';
|
||||||
|
@ -24,6 +24,25 @@ export interface IndexedFilterValues {
|
|||||||
[index: string]: ContractEventArg;
|
[index: string]: ContractEventArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ForwarderError {
|
||||||
|
CompleteFillFailed = 'COMPLETE_FILL_FAILED',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ContractError {
|
||||||
|
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
|
||||||
|
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
||||||
|
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
||||||
|
InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
|
||||||
|
InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL',
|
||||||
|
InvalidJump = 'INVALID_JUMP',
|
||||||
|
OutOfGas = 'OUT_OF_GAS',
|
||||||
|
SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
|
||||||
|
SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT',
|
||||||
|
ERC721OwnerNotFound = 'ERC_721_OWNER_NOT_FOUND',
|
||||||
|
ERC721NoApproval = 'ERC_721_NO_APPROVAL',
|
||||||
|
SignatureRequestDenied = 'SIGNATURE_REQUEST_DENIED',
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc)
|
* networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc)
|
||||||
* gasPrice: Gas price to use with every transaction
|
* gasPrice: Gas price to use with every transaction
|
||||||
@ -72,6 +91,22 @@ export enum OrderStatus {
|
|||||||
Cancelled,
|
Cancelled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TraderInfo {
|
||||||
|
makerBalance: BigNumber;
|
||||||
|
makerAllowance: BigNumber;
|
||||||
|
takerBalance: BigNumber;
|
||||||
|
takerAllowance: BigNumber;
|
||||||
|
makerZrxBalance: BigNumber;
|
||||||
|
makerZrxAllowance: BigNumber;
|
||||||
|
takerZrxBalance: BigNumber;
|
||||||
|
takerZrxAllowance: BigNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OrderAndTraderInfo {
|
||||||
|
orderInfo: OrderInfo;
|
||||||
|
traderInfo: TraderInfo;
|
||||||
|
}
|
||||||
|
|
||||||
export { CoordinatorServerCancellationResponse, CoordinatorServerError } from './utils/coordinator_server_types';
|
export { CoordinatorServerCancellationResponse, CoordinatorServerError } from './utils/coordinator_server_types';
|
||||||
|
|
||||||
export interface CoordinatorTransaction {
|
export interface CoordinatorTransaction {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
export enum ContractWrappersError {
|
export enum ContractError {
|
||||||
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
|
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
|
||||||
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
||||||
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
||||||
@ -31,10 +31,10 @@ type ErrorTransformer = (err: Error) => Error;
|
|||||||
|
|
||||||
const contractCallErrorTransformer = (error: Error) => {
|
const contractCallErrorTransformer = (error: Error) => {
|
||||||
if (_.includes(error.message, constants.INVALID_JUMP_PATTERN)) {
|
if (_.includes(error.message, constants.INVALID_JUMP_PATTERN)) {
|
||||||
return new Error(ContractWrappersError.InvalidJump);
|
return new Error(ContractError.InvalidJump);
|
||||||
}
|
}
|
||||||
if (_.includes(error.message, constants.OUT_OF_GAS_PATTERN)) {
|
if (_.includes(error.message, constants.OUT_OF_GAS_PATTERN)) {
|
||||||
return new Error(ContractWrappersError.OutOfGas);
|
return new Error(ContractError.OutOfGas);
|
||||||
}
|
}
|
||||||
if (_.includes(error.message, constants.REVERT)) {
|
if (_.includes(error.message, constants.REVERT)) {
|
||||||
const revertReason = error.message.split(constants.REVERT)[1].trim();
|
const revertReason = error.message.split(constants.REVERT)[1].trim();
|
||||||
@ -57,7 +57,7 @@ const signatureRequestErrorTransformer = (error: Error) => {
|
|||||||
_.includes(error.message, constants.METAMASK_USER_DENIED_SIGNATURE_PATTERN) ||
|
_.includes(error.message, constants.METAMASK_USER_DENIED_SIGNATURE_PATTERN) ||
|
||||||
_.includes(error.message, constants.TRUST_WALLET_USER_DENIED_SIGNATURE_PATTERN)
|
_.includes(error.message, constants.TRUST_WALLET_USER_DENIED_SIGNATURE_PATTERN)
|
||||||
) {
|
) {
|
||||||
const errMsg = ContractWrappersError.SignatureRequestDenied;
|
const errMsg = ContractError.SignatureRequestDenied;
|
||||||
return new Error(errMsg);
|
return new Error(errMsg);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { CoordinatorRegistryContract } from '@0x/abi-gen-wrappers';
|
|
||||||
import { constants } from '@0x/contracts-test-utils';
|
import { constants } from '@0x/contracts-test-utils';
|
||||||
import { defaultOrmConfig, getAppAsync } from '@0x/coordinator-server';
|
import { defaultOrmConfig, getAppAsync } from '@0x/coordinator-server';
|
||||||
import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils';
|
import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils';
|
||||||
@ -12,6 +11,7 @@ import 'mocha';
|
|||||||
import * as nock from 'nock';
|
import * as nock from 'nock';
|
||||||
|
|
||||||
import { ContractWrappers } from '../src';
|
import { ContractWrappers } from '../src';
|
||||||
|
import { CoordinatorRegistryContract } from '../src/index';
|
||||||
import { CoordinatorServerErrorMsg } from '../src/utils/coordinator_server_types';
|
import { CoordinatorServerErrorMsg } from '../src/utils/coordinator_server_types';
|
||||||
|
|
||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { DummyERC721TokenContract } from '@0x/abi-gen-wrappers';
|
|
||||||
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
|
|
||||||
|
import { DummyERC721TokenContract } from '../../src/index';
|
||||||
|
|
||||||
import { provider, txDefaults, web3Wrapper } from './web3_wrapper';
|
import { provider, txDefaults, web3Wrapper } from './web3_wrapper';
|
||||||
|
|
||||||
// Those addresses come from migrations. They're deterministic so it's relatively safe to hard-code them here.
|
// Those addresses come from migrations. They're deterministic so it's relatively safe to hard-code them here.
|
||||||
|
@ -60,12 +60,12 @@ export const docGenConfigs: DocGenConfigs = {
|
|||||||
'NonceSubproviderErrors',
|
'NonceSubproviderErrors',
|
||||||
'Web3WrapperErrors',
|
'Web3WrapperErrors',
|
||||||
'AssetBuyerError',
|
'AssetBuyerError',
|
||||||
'ContractWrappersError',
|
'ContractError',
|
||||||
'TypedDataError',
|
'TypedDataError',
|
||||||
'SwapQuoterError',
|
'SwapQuoterError',
|
||||||
'SwapQuoteGetOutputOpts',
|
'SwapQuoteGetOutputOpts',
|
||||||
'SwapQuoteExecutionOpts',
|
'SwapQuoteExecutionOpts',
|
||||||
'ForwarderWrapperError',
|
'ForwarderError',
|
||||||
'CoordinatorServerError',
|
'CoordinatorServerError',
|
||||||
'CoordinatorServerCancellationResponse',
|
'CoordinatorServerCancellationResponse',
|
||||||
'EventCallback',
|
'EventCallback',
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^6.0.15",
|
"0x.js": "^6.0.15",
|
||||||
|
"@0x/contract-wrappers": "^11.0.0",
|
||||||
"@0x/subproviders": "^5.0.1",
|
"@0x/subproviders": "^5.0.1",
|
||||||
"@0x/typescript-typings": "^4.2.4",
|
"@0x/typescript-typings": "^4.2.4",
|
||||||
"@0x/utils": "^4.5.0",
|
"@0x/utils": "^4.5.0",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ERC20TokenWrapper } from '0x.js';
|
import { ERC20TokenContract, SupportedProvider } from '0x.js';
|
||||||
import { BigNumber, logUtils } from '@0x/utils';
|
import { BigNumber, logUtils } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -37,7 +37,7 @@ export const dispenseAssetTasks = {
|
|||||||
recipientAddress: string,
|
recipientAddress: string,
|
||||||
tokenSymbol: string,
|
tokenSymbol: string,
|
||||||
networkId: number,
|
networkId: number,
|
||||||
erc20TokenWrapper: ERC20TokenWrapper,
|
provider: SupportedProvider,
|
||||||
): AsyncTask {
|
): AsyncTask {
|
||||||
return async () => {
|
return async () => {
|
||||||
logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);
|
logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);
|
||||||
@ -47,10 +47,8 @@ export const dispenseAssetTasks = {
|
|||||||
throw new Error(`Unsupported asset type: ${tokenSymbol}`);
|
throw new Error(`Unsupported asset type: ${tokenSymbol}`);
|
||||||
}
|
}
|
||||||
const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amountToDispense, tokenIfExists.decimals);
|
const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amountToDispense, tokenIfExists.decimals);
|
||||||
const userBalanceBaseUnits = await erc20TokenWrapper.getBalanceAsync(
|
const erc20Token = new ERC20TokenContract(tokenIfExists.address, provider);
|
||||||
tokenIfExists.address,
|
const userBalanceBaseUnits = await erc20Token.balanceOf.callAsync(recipientAddress);
|
||||||
recipientAddress,
|
|
||||||
);
|
|
||||||
const maxAmountBaseUnits = Web3Wrapper.toBaseUnitAmount(
|
const maxAmountBaseUnits = Web3Wrapper.toBaseUnitAmount(
|
||||||
new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),
|
new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),
|
||||||
tokenIfExists.decimals,
|
tokenIfExists.decimals,
|
||||||
@ -61,12 +59,9 @@ export const dispenseAssetTasks = {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const txHash = await erc20TokenWrapper.transferAsync(
|
const txHash = await erc20Token.transfer.sendTransactionAsync(recipientAddress, baseUnitAmount, {
|
||||||
tokenIfExists.address,
|
from: configs.DISPENSER_ADDRESS,
|
||||||
configs.DISPENSER_ADDRESS,
|
});
|
||||||
recipientAddress,
|
|
||||||
baseUnitAmount,
|
|
||||||
);
|
|
||||||
logUtils.log(`Sent ${amountToDispense} ${tokenSymbol} to ${recipientAddress} tx: ${txHash}`);
|
logUtils.log(`Sent ${amountToDispense} ${tokenSymbol} to ${recipientAddress} tx: ${txHash}`);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -124,7 +124,7 @@ export class Handler {
|
|||||||
recipient,
|
recipient,
|
||||||
requestedAssetType,
|
requestedAssetType,
|
||||||
networkConfig.networkId,
|
networkConfig.networkId,
|
||||||
networkConfig.contractWrappers.erc20Token,
|
networkConfig.contractWrappers.getProvider(),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/asset-buyer": "^6.1.11",
|
"@0x/asset-buyer": "^6.1.11",
|
||||||
"@0x/contract-addresses": "^3.0.3",
|
"@0x/contract-addresses": "^3.0.3",
|
||||||
"@0x/contract-wrappers": "^9.1.7",
|
"@0x/contract-wrappers": "^11.0.0",
|
||||||
"@0x/json-schemas": "^3.1.13",
|
"@0x/json-schemas": "^3.1.13",
|
||||||
"@0x/order-utils": "^8.2.5",
|
"@0x/order-utils": "^8.2.5",
|
||||||
"@0x/subproviders": "^5.0.1",
|
"@0x/subproviders": "^5.0.1",
|
||||||
|
@ -2,11 +2,13 @@ import {
|
|||||||
BlockRange,
|
BlockRange,
|
||||||
ContractWrappers,
|
ContractWrappers,
|
||||||
DecodedLogEvent,
|
DecodedLogEvent,
|
||||||
|
ERC20TokenContract,
|
||||||
ExchangeCancelEventArgs,
|
ExchangeCancelEventArgs,
|
||||||
ExchangeEventArgs,
|
ExchangeEventArgs,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
ExchangeFillEventArgs,
|
ExchangeFillEventArgs,
|
||||||
IndexedFilterValues,
|
IndexedFilterValues,
|
||||||
|
WETH9Contract,
|
||||||
} from '@0x/contract-wrappers';
|
} from '@0x/contract-wrappers';
|
||||||
import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
|
||||||
import {
|
import {
|
||||||
@ -237,11 +239,12 @@ export class Blockchain {
|
|||||||
utils.assert(this._contractWrappers !== undefined, 'Contract Wrappers must be instantiated.');
|
utils.assert(this._contractWrappers !== undefined, 'Contract Wrappers must be instantiated.');
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._contractWrappers.erc20Token.setProxyAllowanceAsync(
|
const erc20Token = new ERC20TokenContract(token.address, this._contractWrappers.getProvider());
|
||||||
token.address,
|
const txHash = await erc20Token.approve.sendTransactionAsync(
|
||||||
this._userAddressIfExists,
|
this._contractWrappers.contractAddresses.erc20Proxy,
|
||||||
amountInBaseUnits,
|
amountInBaseUnits,
|
||||||
{
|
{
|
||||||
|
from: this._userAddressIfExists,
|
||||||
gasPrice: this._defaultGasPrice,
|
gasPrice: this._defaultGasPrice,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -274,15 +277,11 @@ export class Blockchain {
|
|||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._contractWrappers.erc20Token.transferAsync(
|
const erc20Token = new ERC20TokenContract(token.address, this._contractWrappers.getProvider());
|
||||||
token.address,
|
const txHash = await erc20Token.transfer.validateAndSendTransactionAsync(toAddress, amountInBaseUnits, {
|
||||||
this._userAddressIfExists,
|
from: this._userAddressIfExists,
|
||||||
toAddress,
|
gasPrice: this._defaultGasPrice,
|
||||||
amountInBaseUnits,
|
});
|
||||||
{
|
|
||||||
gasPrice: this._defaultGasPrice,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
const etherScanLinkIfExists = utils.getEtherScanLinkIfExists(txHash, this.networkId, EtherscanLinkSuffixes.Tx);
|
const etherScanLinkIfExists = utils.getEtherScanLinkIfExists(txHash, this.networkId, EtherscanLinkSuffixes.Tx);
|
||||||
this._dispatcher.showFlashMessage(
|
this._dispatcher.showFlashMessage(
|
||||||
@ -299,11 +298,12 @@ export class Blockchain {
|
|||||||
utils.assert(this._contractWrappers !== undefined, 'ContractWrappers must be instantiated.');
|
utils.assert(this._contractWrappers !== undefined, 'ContractWrappers must be instantiated.');
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._contractWrappers.exchange.fillOrderAsync(
|
const txHash = await this._contractWrappers.exchange.fillOrder.validateAndSendTransactionAsync(
|
||||||
signedOrder,
|
signedOrder,
|
||||||
fillTakerTokenAmount,
|
fillTakerTokenAmount,
|
||||||
this._userAddressIfExists,
|
signedOrder.signature,
|
||||||
{
|
{
|
||||||
|
from: this._userAddressIfExists,
|
||||||
gasPrice: this._defaultGasPrice,
|
gasPrice: this._defaultGasPrice,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -316,7 +316,8 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
public async cancelOrderAsync(signedOrder: SignedOrder): Promise<string> {
|
public async cancelOrderAsync(signedOrder: SignedOrder): Promise<string> {
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._contractWrappers.exchange.cancelOrderAsync(signedOrder, {
|
const txHash = await this._contractWrappers.exchange.cancelOrder.validateAndSendTransactionAsync(signedOrder, {
|
||||||
|
from: signedOrder.makerAddress,
|
||||||
gasPrice: this._defaultGasPrice,
|
gasPrice: this._defaultGasPrice,
|
||||||
});
|
});
|
||||||
const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
@ -329,7 +330,7 @@ export class Blockchain {
|
|||||||
public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber> {
|
public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber> {
|
||||||
utils.assert(orderHashUtils.isValidOrderHash(orderHash), 'Must be valid orderHash');
|
utils.assert(orderHashUtils.isValidOrderHash(orderHash), 'Must be valid orderHash');
|
||||||
utils.assert(this._contractWrappers !== undefined, 'ContractWrappers must be instantiated.');
|
utils.assert(this._contractWrappers !== undefined, 'ContractWrappers must be instantiated.');
|
||||||
const unavailableTakerAmount = await this._contractWrappers.exchange.getFilledTakerAssetAmountAsync(orderHash);
|
const unavailableTakerAmount = await this._contractWrappers.exchange.filled.callAsync(orderHash);
|
||||||
return unavailableTakerAmount;
|
return unavailableTakerAmount;
|
||||||
}
|
}
|
||||||
public getExchangeContractAddressIfExists(): string | undefined {
|
public getExchangeContractAddressIfExists(): string | undefined {
|
||||||
@ -340,10 +341,13 @@ export class Blockchain {
|
|||||||
fillTakerTokenAmount: BigNumber,
|
fillTakerTokenAmount: BigNumber,
|
||||||
takerAddress: string,
|
takerAddress: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this._contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync(
|
await this._contractWrappers.exchange.fillOrder.callAsync(
|
||||||
signedOrder,
|
signedOrder,
|
||||||
fillTakerTokenAmount,
|
fillTakerTokenAmount,
|
||||||
takerAddress,
|
signedOrder.signature,
|
||||||
|
{
|
||||||
|
from: takerAddress,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public isValidAddress(address: string): boolean {
|
public isValidAddress(address: string): boolean {
|
||||||
@ -420,14 +424,12 @@ export class Blockchain {
|
|||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._contractWrappers.etherToken.depositAsync(
|
const etherToken = new WETH9Contract(etherTokenAddress, this._contractWrappers.getProvider());
|
||||||
etherTokenAddress,
|
const txHash = await etherToken.deposit.validateAndSendTransactionAsync({
|
||||||
amount,
|
value: amount,
|
||||||
this._userAddressIfExists,
|
from: this._userAddressIfExists,
|
||||||
{
|
gasPrice: this._defaultGasPrice,
|
||||||
gasPrice: this._defaultGasPrice,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
}
|
}
|
||||||
public async convertWrappedEthTokensToEthAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> {
|
public async convertWrappedEthTokensToEthAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> {
|
||||||
@ -435,14 +437,11 @@ export class Blockchain {
|
|||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._contractWrappers.etherToken.withdrawAsync(
|
const etherToken = new WETH9Contract(etherTokenAddress, this._contractWrappers.getProvider());
|
||||||
etherTokenAddress,
|
const txHash = await etherToken.withdraw.validateAndSendTransactionAsync(amount, {
|
||||||
amount,
|
from: this._userAddressIfExists,
|
||||||
this._userAddressIfExists,
|
gasPrice: this._defaultGasPrice,
|
||||||
{
|
});
|
||||||
gasPrice: this._defaultGasPrice,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
}
|
}
|
||||||
public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
|
public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
|
||||||
@ -471,9 +470,13 @@ export class Blockchain {
|
|||||||
let balance = new BigNumber(0);
|
let balance = new BigNumber(0);
|
||||||
let allowance = new BigNumber(0);
|
let allowance = new BigNumber(0);
|
||||||
if (this._doesUserAddressExist()) {
|
if (this._doesUserAddressExist()) {
|
||||||
|
const erc20Token = new ERC20TokenContract(tokenAddress, this._contractWrappers.getProvider());
|
||||||
[balance, allowance] = await Promise.all([
|
[balance, allowance] = await Promise.all([
|
||||||
this._contractWrappers.erc20Token.getBalanceAsync(tokenAddress, ownerAddressIfExists),
|
erc20Token.balanceOf.callAsync(ownerAddressIfExists),
|
||||||
this._contractWrappers.erc20Token.getProxyAllowanceAsync(tokenAddress, ownerAddressIfExists),
|
erc20Token.allowance.callAsync(
|
||||||
|
ownerAddressIfExists,
|
||||||
|
this._contractWrappers.contractAddresses.erc20Proxy,
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return [balance, allowance];
|
return [balance, allowance];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
||||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
import { ContractWrappers, ERC20TokenContract } from '@0x/contract-wrappers';
|
||||||
import {
|
import {
|
||||||
ledgerEthereumBrowserClientFactoryAsync,
|
ledgerEthereumBrowserClientFactoryAsync,
|
||||||
LedgerSubprovider,
|
LedgerSubprovider,
|
||||||
@ -221,8 +221,9 @@ export class ConnectForm extends React.Component<Props, State> {
|
|||||||
utils.assert(this._contractWrappers !== undefined, 'ContractWrappers must be instantiated.');
|
utils.assert(this._contractWrappers !== undefined, 'ContractWrappers must be instantiated.');
|
||||||
const contractAddresses = getContractAddressesForNetworkOrThrow(this.networkId);
|
const contractAddresses = getContractAddressesForNetworkOrThrow(this.networkId);
|
||||||
const tokenAddress: string = contractAddresses.zrxToken;
|
const tokenAddress: string = contractAddresses.zrxToken;
|
||||||
|
const erc20Token = new ERC20TokenContract(tokenAddress, this._contractWrappers.getProvider());
|
||||||
try {
|
try {
|
||||||
const amount = await this._contractWrappers.erc20Token.getBalanceAsync(tokenAddress, owner);
|
const amount = await erc20Token.balanceOf.callAsync(owner);
|
||||||
return amount;
|
return amount;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ContractWrappersError } from '@0x/contract-wrappers';
|
import { ContractError } from '@0x/contract-wrappers';
|
||||||
import { assetDataUtils, TypedDataError } from '@0x/order-utils';
|
import { assetDataUtils, TypedDataError } from '@0x/order-utils';
|
||||||
import { ExchangeContractErrs } from '@0x/types';
|
import { ExchangeContractErrs } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -233,13 +233,13 @@ export const utils = {
|
|||||||
const isUniqueSymbol = tokenWithSameSymbolIfExists === undefined;
|
const isUniqueSymbol = tokenWithSameSymbolIfExists === undefined;
|
||||||
return isUniqueName && isUniqueSymbol;
|
return isUniqueName && isUniqueSymbol;
|
||||||
},
|
},
|
||||||
zeroExErrToHumanReadableErrMsg(error: ContractWrappersError | ExchangeContractErrs, takerAddress: string): string {
|
zeroExErrToHumanReadableErrMsg(error: ContractError | ExchangeContractErrs, takerAddress: string): string {
|
||||||
const ContractWrappersErrorToHumanReadableError: { [error: string]: string } = {
|
const ContractErrorToHumanReadableError: { [error: string]: string } = {
|
||||||
[BlockchainCallErrs.UserHasNoAssociatedAddresses]: 'User has no addresses available',
|
[BlockchainCallErrs.UserHasNoAssociatedAddresses]: 'User has no addresses available',
|
||||||
[TypedDataError.InvalidSignature]: 'Order signature is not valid',
|
[TypedDataError.InvalidSignature]: 'Order signature is not valid',
|
||||||
[ContractWrappersError.ContractNotDeployedOnNetwork]: 'Contract is not deployed on the detected network',
|
[ContractError.ContractNotDeployedOnNetwork]: 'Contract is not deployed on the detected network',
|
||||||
[ContractWrappersError.InvalidJump]: 'Invalid jump occured while executing the transaction',
|
[ContractError.InvalidJump]: 'Invalid jump occured while executing the transaction',
|
||||||
[ContractWrappersError.OutOfGas]: 'Transaction ran out of gas',
|
[ContractError.OutOfGas]: 'Transaction ran out of gas',
|
||||||
};
|
};
|
||||||
const exchangeContractErrorToHumanReadableError: {
|
const exchangeContractErrorToHumanReadableError: {
|
||||||
[error: string]: string;
|
[error: string]: string;
|
||||||
@ -269,7 +269,7 @@ export const utils = {
|
|||||||
[ExchangeContractErrs.InsufficientRemainingFillAmount]: 'Insufficient remaining fill amount',
|
[ExchangeContractErrs.InsufficientRemainingFillAmount]: 'Insufficient remaining fill amount',
|
||||||
};
|
};
|
||||||
const humanReadableErrorMsg =
|
const humanReadableErrorMsg =
|
||||||
exchangeContractErrorToHumanReadableError[error] || ContractWrappersErrorToHumanReadableError[error];
|
exchangeContractErrorToHumanReadableError[error] || ContractErrorToHumanReadableError[error];
|
||||||
return humanReadableErrorMsg;
|
return humanReadableErrorMsg;
|
||||||
},
|
},
|
||||||
isParityNode(nodeVersion: string): boolean {
|
isParityNode(nodeVersion: string): boolean {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user