Stop hardcoding contract addresses (#2461)
* stop hardcoding contract addresses * update changelog * export ContractAddresses for docs
This commit is contained in:
parent
400fb5a5bb
commit
919fc66b9d
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "4.0.2",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Allow contract addresses to be passed as optional constructor ags instead of hardcoding",
|
||||||
|
"pr": 2461
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
export { ContractAddresses } from '@0x/contract-addresses';
|
||||||
export { WSOpts } from '@0x/mesh-rpc-client';
|
export { WSOpts } from '@0x/mesh-rpc-client';
|
||||||
export {
|
export {
|
||||||
AcceptedRejectedOrders,
|
AcceptedRejectedOrders,
|
||||||
|
@ -42,7 +42,7 @@ export class SwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.chainId = chainId;
|
this.chainId = chainId;
|
||||||
this._contractAddresses = getContractAddressesForChainOrThrow(chainId);
|
this._contractAddresses = options.contractAddresses || getContractAddressesForChainOrThrow(chainId);
|
||||||
this._exchangeConsumer = new ExchangeSwapQuoteConsumer(supportedProvider, this._contractAddresses, options);
|
this._exchangeConsumer = new ExchangeSwapQuoteConsumer(supportedProvider, this._contractAddresses, options);
|
||||||
this._forwarderConsumer = new ForwarderSwapQuoteConsumer(supportedProvider, this._contractAddresses, options);
|
this._forwarderConsumer = new ForwarderSwapQuoteConsumer(supportedProvider, this._contractAddresses, options);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ export class SwapQuoter {
|
|||||||
this.orderbook = orderbook;
|
this.orderbook = orderbook;
|
||||||
this.expiryBufferMs = expiryBufferMs;
|
this.expiryBufferMs = expiryBufferMs;
|
||||||
this.permittedOrderFeeTypes = permittedOrderFeeTypes;
|
this.permittedOrderFeeTypes = permittedOrderFeeTypes;
|
||||||
this._contractAddresses = getContractAddressesForChainOrThrow(chainId);
|
this._contractAddresses = options.contractAddresses || getContractAddressesForChainOrThrow(chainId);
|
||||||
this._devUtilsContract = new DevUtilsContract(this._contractAddresses.devUtils, provider);
|
this._devUtilsContract = new DevUtilsContract(this._contractAddresses.devUtils, provider);
|
||||||
this._protocolFeeUtils = new ProtocolFeeUtils(constants.PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS);
|
this._protocolFeeUtils = new ProtocolFeeUtils(constants.PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS);
|
||||||
this._orderStateUtils = new OrderStateUtils(this._devUtilsContract);
|
this._orderStateUtils = new OrderStateUtils(this._devUtilsContract);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { ContractAddresses } from '@0x/migrations';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
|
|
||||||
@ -87,6 +88,7 @@ export interface SwapQuoteConsumerBase {
|
|||||||
*/
|
*/
|
||||||
export interface SwapQuoteConsumerOpts {
|
export interface SwapQuoteConsumerOpts {
|
||||||
chainId: number;
|
chainId: number;
|
||||||
|
contractAddresses?: ContractAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,6 +200,7 @@ export interface SwapQuoterOpts extends OrderPrunerOpts {
|
|||||||
chainId: number;
|
chainId: number;
|
||||||
orderRefreshIntervalMs: number;
|
orderRefreshIntervalMs: number;
|
||||||
expiryBufferMs: number;
|
expiryBufferMs: number;
|
||||||
|
contractAddresses?: ContractAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user