Move generated contract wrappers and artifacts into contracts package
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json';
|
||||
import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json';
|
||||
import * as DummyERC721Receiver from '../../artifacts/DummyERC721Receiver.json';
|
||||
import * as DummyERC721Token from '../../artifacts/DummyERC721Token.json';
|
||||
import * as DummyMultipleReturnERC20Token from '../../artifacts/DummyMultipleReturnERC20Token.json';
|
||||
import * as DummyNoReturnERC20Token from '../../artifacts/DummyNoReturnERC20Token.json';
|
||||
import * as ERC20Proxy from '../../artifacts/ERC20Proxy.json';
|
||||
import * as ERC721Proxy from '../../artifacts/ERC721Proxy.json';
|
||||
import * as Exchange from '../../artifacts/Exchange.json';
|
||||
import * as ExchangeWrapper from '../../artifacts/ExchangeWrapper.json';
|
||||
import * as Forwarder from '../../artifacts/Forwarder.json';
|
||||
import * as IAssetProxy from '../../artifacts/IAssetProxy.json';
|
||||
import * as InvalidERC721Receiver from '../../artifacts/InvalidERC721Receiver.json';
|
||||
import * as MixinAuthorizable from '../../artifacts/MixinAuthorizable.json';
|
||||
import * as MultiSigWallet from '../../artifacts/MultiSigWallet.json';
|
||||
import * as MultiSigWalletWithTimeLock from '../../artifacts/MultiSigWalletWithTimeLock.json';
|
||||
import * as OrderValidator from '../../artifacts/OrderValidator.json';
|
||||
import * as ReentrantERC20Token from '../../artifacts/ReentrantERC20Token.json';
|
||||
import * as TestAssetProxyDispatcher from '../../artifacts/TestAssetProxyDispatcher.json';
|
||||
import * as TestAssetProxyOwner from '../../artifacts/TestAssetProxyOwner.json';
|
||||
import * as TestConstants from '../../artifacts/TestConstants.json';
|
||||
import * as TestExchangeInternals from '../../artifacts/TestExchangeInternals.json';
|
||||
import * as TestLibBytes from '../../artifacts/TestLibBytes.json';
|
||||
import * as TestLibs from '../../artifacts/TestLibs.json';
|
||||
import * as TestSignatureValidator from '../../artifacts/TestSignatureValidator.json';
|
||||
import * as TestStaticCallReceiver from '../../artifacts/TestStaticCallReceiver.json';
|
||||
import * as TokenRegistry from '../../artifacts/TokenRegistry.json';
|
||||
import * as Validator from '../../artifacts/Validator.json';
|
||||
import * as Wallet from '../../artifacts/Wallet.json';
|
||||
import * as EtherToken from '../../artifacts/WETH9.json';
|
||||
import * as Whitelist from '../../artifacts/Whitelist.json';
|
||||
import * as ZRX from '../../artifacts/ZRXToken.json';
|
||||
|
||||
export const artifacts = {
|
||||
AssetProxyOwner: (AssetProxyOwner as any) as ContractArtifact,
|
||||
DummyERC20Token: (DummyERC20Token as any) as ContractArtifact,
|
||||
DummyERC721Receiver: (DummyERC721Receiver as any) as ContractArtifact,
|
||||
DummyERC721Token: (DummyERC721Token as any) as ContractArtifact,
|
||||
DummyMultipleReturnERC20Token: (DummyMultipleReturnERC20Token as any) as ContractArtifact,
|
||||
DummyNoReturnERC20Token: (DummyNoReturnERC20Token as any) as ContractArtifact,
|
||||
ERC20Proxy: (ERC20Proxy as any) as ContractArtifact,
|
||||
ERC721Proxy: (ERC721Proxy as any) as ContractArtifact,
|
||||
Exchange: (Exchange as any) as ContractArtifact,
|
||||
ExchangeWrapper: (ExchangeWrapper as any) as ContractArtifact,
|
||||
EtherToken: (EtherToken as any) as ContractArtifact,
|
||||
Forwarder: (Forwarder as any) as ContractArtifact,
|
||||
IAssetProxy: (IAssetProxy as any) as ContractArtifact,
|
||||
InvalidERC721Receiver: (InvalidERC721Receiver as any) as ContractArtifact,
|
||||
MixinAuthorizable: (MixinAuthorizable as any) as ContractArtifact,
|
||||
MultiSigWallet: (MultiSigWallet as any) as ContractArtifact,
|
||||
MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact,
|
||||
OrderValidator: (OrderValidator as any) as ContractArtifact,
|
||||
ReentrantERC20Token: (ReentrantERC20Token as any) as ContractArtifact,
|
||||
TestAssetProxyOwner: (TestAssetProxyOwner as any) as ContractArtifact,
|
||||
TestAssetProxyDispatcher: (TestAssetProxyDispatcher as any) as ContractArtifact,
|
||||
TestConstants: (TestConstants as any) as ContractArtifact,
|
||||
TestLibBytes: (TestLibBytes as any) as ContractArtifact,
|
||||
TestLibs: (TestLibs as any) as ContractArtifact,
|
||||
TestExchangeInternals: (TestExchangeInternals as any) as ContractArtifact,
|
||||
TestSignatureValidator: (TestSignatureValidator as any) as ContractArtifact,
|
||||
TestStaticCallReceiver: (TestStaticCallReceiver as any) as ContractArtifact,
|
||||
Validator: (Validator as any) as ContractArtifact,
|
||||
Wallet: (Wallet as any) as ContractArtifact,
|
||||
TokenRegistry: (TokenRegistry as any) as ContractArtifact,
|
||||
Whitelist: (Whitelist as any) as ContractArtifact,
|
||||
ZRX: (ZRX as any) as ContractArtifact,
|
||||
};
|
@@ -4,10 +4,10 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
|
||||
import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
|
||||
import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
|
||||
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import { constants } from './constants';
|
||||
import { ERC20BalancesByOwner } from './types';
|
||||
import { txDefaults } from './web3_wrapper';
|
||||
|
@@ -4,10 +4,10 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
|
||||
import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
|
||||
import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
|
||||
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import { constants } from './constants';
|
||||
import { ERC721TokenIdsByOwner } from './types';
|
||||
import { txDefaults } from './web3_wrapper';
|
||||
|
@@ -3,7 +3,7 @@ import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
|
||||
import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
|
||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||
|
||||
import { formatters } from './formatters';
|
||||
import { LogDecoder } from './log_decoder';
|
||||
|
@@ -14,10 +14,10 @@ import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
import 'make-promises-safe';
|
||||
|
||||
import { ExchangeContract, ExchangeFillEventArgs } from '../../generated_contract_wrappers/exchange';
|
||||
import { TestLibsContract } from '../../generated_contract_wrappers/test_libs';
|
||||
import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
|
||||
import { TestLibsContract } from '../../generated-wrappers/test_libs';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import { expectTransactionFailedAsync } from './assertions';
|
||||
import { AssetWrapper } from './asset_wrapper';
|
||||
import { chaiSetup } from './chai_setup';
|
||||
|
@@ -4,7 +4,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ForwarderContract } from '../../generated_contract_wrappers/forwarder';
|
||||
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
||||
|
||||
import { constants } from './constants';
|
||||
import { formatters } from './formatters';
|
||||
|
@@ -11,7 +11,8 @@ import {
|
||||
} from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
import { constants } from './constants';
|
||||
|
||||
export class LogDecoder {
|
||||
|
@@ -3,8 +3,8 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { AssetProxyOwnerContract } from '../../generated_contract_wrappers/asset_proxy_owner';
|
||||
import { MultiSigWalletContract } from '../../generated_contract_wrappers/multi_sig_wallet';
|
||||
import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
|
||||
import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
|
||||
|
||||
import { LogDecoder } from './log_decoder';
|
||||
|
||||
|
@@ -2,7 +2,7 @@ import { assetDataUtils, generatePseudoRandomSalt } from '@0xproject/order-utils
|
||||
import { Order } from '@0xproject/types';
|
||||
import { BigNumber, errorUtils } from '@0xproject/utils';
|
||||
|
||||
import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
|
||||
import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
|
||||
|
||||
import { constants } from './constants';
|
||||
import {
|
||||
|
@@ -1,66 +0,0 @@
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
|
||||
import { TokenRegistryContract } from '../../generated_contract_wrappers/token_registry';
|
||||
|
||||
import { Token } from './types';
|
||||
|
||||
import { constants } from './constants';
|
||||
|
||||
export class TokenRegWrapper {
|
||||
private readonly _tokenReg: TokenRegistryContract;
|
||||
private readonly _web3Wrapper: Web3Wrapper;
|
||||
constructor(tokenRegContract: TokenRegistryContract, provider: Provider) {
|
||||
this._tokenReg = tokenRegContract;
|
||||
this._web3Wrapper = new Web3Wrapper(provider);
|
||||
}
|
||||
public async addTokenAsync(token: Token, from: string): Promise<string> {
|
||||
const txHash = await this._tokenReg.addToken.sendTransactionAsync(
|
||||
token.address as string,
|
||||
token.name,
|
||||
token.symbol,
|
||||
token.decimals,
|
||||
token.ipfsHash,
|
||||
token.swarmHash,
|
||||
{ from },
|
||||
);
|
||||
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||
return txHash;
|
||||
}
|
||||
public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> {
|
||||
const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress);
|
||||
const token: Token = {
|
||||
address: data[0],
|
||||
name: data[1],
|
||||
symbol: data[2],
|
||||
decimals: data[3],
|
||||
ipfsHash: data[4],
|
||||
swarmHash: data[5],
|
||||
};
|
||||
return token;
|
||||
}
|
||||
public async getTokenByNameAsync(tokenName: string): Promise<Token> {
|
||||
const data = await this._tokenReg.getTokenByName.callAsync(tokenName);
|
||||
const token: Token = {
|
||||
address: data[0],
|
||||
name: data[1],
|
||||
symbol: data[2],
|
||||
decimals: data[3],
|
||||
ipfsHash: data[4],
|
||||
swarmHash: data[5],
|
||||
};
|
||||
return token;
|
||||
}
|
||||
public async getTokenBySymbolAsync(tokenSymbol: string): Promise<Token> {
|
||||
const data = await this._tokenReg.getTokenBySymbol.callAsync(tokenSymbol);
|
||||
const token: Token = {
|
||||
address: data[0],
|
||||
name: data[1],
|
||||
symbol: data[2],
|
||||
decimals: data[3],
|
||||
ipfsHash: data[4],
|
||||
swarmHash: data[5],
|
||||
};
|
||||
return token;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user