Minimize unnecessary type assertions
This commit is contained in:
parent
a91bc415ed
commit
24564b986d
@ -1,6 +1,4 @@
|
|||||||
// tslint:disable:no-unnecessary-type-assertion
|
|
||||||
import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0x/order-utils';
|
import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId, ERC20AssetData, ERC721AssetData, MultiAssetData } from '@0x/types';
|
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { BlockParamLiteral } from 'ethereum-types';
|
import { BlockParamLiteral } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -20,99 +18,73 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
|
|||||||
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
|
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
let balance: BigNumber | undefined;
|
let balance: BigNumber | undefined;
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
balance = await this._erc20Token.getBalanceAsync(decodedAssetData.tokenAddress, userAddress, {
|
||||||
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
|
defaultBlock: this._stateLayer,
|
||||||
balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, {
|
});
|
||||||
|
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
|
const tokenOwner = await this._erc721Token.getOwnerOfAsync(
|
||||||
|
decodedAssetData.tokenAddress,
|
||||||
|
decodedAssetData.tokenId,
|
||||||
|
{
|
||||||
defaultBlock: this._stateLayer,
|
defaultBlock: this._stateLayer,
|
||||||
});
|
},
|
||||||
break;
|
);
|
||||||
case AssetProxyId.ERC721:
|
balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
|
||||||
const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
const tokenOwner = await this._erc721Token.getOwnerOfAsync(
|
// The `balance` for MultiAssetData is the total units of the entire `assetData` that are held by the `userAddress`.
|
||||||
decodedERC721AssetData.tokenAddress,
|
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
|
||||||
decodedERC721AssetData.tokenId,
|
const nestedAmountElement = decodedAssetData.amounts[index];
|
||||||
{
|
const nestedAssetBalance = (await this.getBalanceAsync(
|
||||||
defaultBlock: this._stateLayer,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
|
|
||||||
break;
|
|
||||||
case AssetProxyId.MultiAsset:
|
|
||||||
// The `balance` for MultiAssetData is the total units of the entire `assetData` that are held by the `userAddress`.
|
|
||||||
for (const [
|
|
||||||
index,
|
|
||||||
nestedAssetDataElement,
|
nestedAssetDataElement,
|
||||||
] of (decodedAssetData as MultiAssetData).nestedAssetData.entries()) {
|
userAddress,
|
||||||
const nestedAmountElement = (decodedAssetData as MultiAssetData).amounts[index];
|
)).dividedToIntegerBy(nestedAmountElement);
|
||||||
const nestedAssetBalance = (await this.getBalanceAsync(
|
if (_.isUndefined(balance) || nestedAssetBalance.lessThan(balance)) {
|
||||||
nestedAssetDataElement,
|
balance = nestedAssetBalance;
|
||||||
userAddress,
|
|
||||||
)).dividedToIntegerBy(nestedAmountElement);
|
|
||||||
if (_.isUndefined(balance) || nestedAssetBalance.lessThan(balance)) {
|
|
||||||
balance = nestedAssetBalance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
throw new Error(`Proxy with id ${decodedAssetData.assetProxyId} not supported`);
|
|
||||||
}
|
}
|
||||||
return balance as BigNumber;
|
return balance as BigNumber;
|
||||||
}
|
}
|
||||||
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
|
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
let proxyAllowance: BigNumber | undefined;
|
let proxyAllowance: BigNumber | undefined;
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(decodedAssetData.tokenAddress, userAddress, {
|
||||||
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
|
defaultBlock: this._stateLayer,
|
||||||
proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(
|
});
|
||||||
decodedERC20AssetData.tokenAddress,
|
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
userAddress,
|
const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync(
|
||||||
|
decodedAssetData.tokenAddress,
|
||||||
|
userAddress,
|
||||||
|
{
|
||||||
|
defaultBlock: this._stateLayer,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (isApprovedForAll) {
|
||||||
|
return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
|
||||||
|
} else {
|
||||||
|
const isApproved = await this._erc721Token.isProxyApprovedAsync(
|
||||||
|
decodedAssetData.tokenAddress,
|
||||||
|
decodedAssetData.tokenId,
|
||||||
{
|
{
|
||||||
defaultBlock: this._stateLayer,
|
defaultBlock: this._stateLayer,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
break;
|
proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
|
||||||
case AssetProxyId.ERC721:
|
}
|
||||||
const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync(
|
// The `proxyAllowance` for MultiAssetData is the total units of the entire `assetData` that the proxies have been approved to spend by the `userAddress`.
|
||||||
decodedERC721AssetData.tokenAddress,
|
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
|
||||||
userAddress,
|
const nestedAmountElement = decodedAssetData.amounts[index];
|
||||||
{
|
const nestedAssetAllowance = (await this.getProxyAllowanceAsync(
|
||||||
defaultBlock: this._stateLayer,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (isApprovedForAll) {
|
|
||||||
return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
|
|
||||||
} else {
|
|
||||||
const isApproved = await this._erc721Token.isProxyApprovedAsync(
|
|
||||||
decodedERC721AssetData.tokenAddress,
|
|
||||||
decodedERC721AssetData.tokenId,
|
|
||||||
{
|
|
||||||
defaultBlock: this._stateLayer,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AssetProxyId.MultiAsset:
|
|
||||||
// The `proxyAllowance` for MultiAssetData is the total units of the entire `assetData` that the proxies have been approved to spend by the `userAddress`.
|
|
||||||
for (const [
|
|
||||||
index,
|
|
||||||
nestedAssetDataElement,
|
nestedAssetDataElement,
|
||||||
] of (decodedAssetData as MultiAssetData).nestedAssetData.entries()) {
|
userAddress,
|
||||||
const nestedAmountElement = (decodedAssetData as MultiAssetData).amounts[index];
|
)).dividedToIntegerBy(nestedAmountElement);
|
||||||
const nestedAssetAllowance = (await this.getProxyAllowanceAsync(
|
if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.lessThan(proxyAllowance)) {
|
||||||
nestedAssetDataElement,
|
proxyAllowance = nestedAssetAllowance;
|
||||||
userAddress,
|
|
||||||
)).dividedToIntegerBy(nestedAmountElement);
|
|
||||||
if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.lessThan(proxyAllowance)) {
|
|
||||||
proxyAllowance = nestedAssetAllowance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
throw new Error(`Proxy with id ${decodedAssetData.assetProxyId} not supported`);
|
|
||||||
}
|
}
|
||||||
return proxyAllowance as BigNumber;
|
return proxyAllowance as BigNumber;
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,7 @@ import { DummyERC20TokenContract, DummyERC721TokenContract, ExchangeContract } f
|
|||||||
import * as artifacts from '@0x/contract-artifacts';
|
import * as artifacts from '@0x/contract-artifacts';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
|
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
|
||||||
import {
|
import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
|
||||||
AssetProxyId,
|
|
||||||
ERC20AssetData,
|
|
||||||
ERC721AssetData,
|
|
||||||
MultiAssetData,
|
|
||||||
OrderWithoutExchangeAddress,
|
|
||||||
SignedOrder,
|
|
||||||
} from '@0x/types';
|
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
import { Provider } from 'ethereum-types';
|
import { Provider } from 'ethereum-types';
|
||||||
@ -280,42 +273,24 @@ export class FillScenarios {
|
|||||||
amount: BigNumber,
|
amount: BigNumber,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
await this._increaseERC20BalanceAndAllowanceAsync(decodedAssetData.tokenAddress, userAddress, amount);
|
||||||
await this._increaseERC20BalanceAndAllowanceAsync(
|
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
await this._increaseERC721BalanceAndAllowanceAsync(
|
||||||
(decodedAssetData as ERC20AssetData).tokenAddress,
|
decodedAssetData.tokenAddress,
|
||||||
userAddress,
|
userAddress,
|
||||||
amount,
|
decodedAssetData.tokenId,
|
||||||
);
|
);
|
||||||
break;
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC721:
|
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
|
||||||
await this._increaseERC721BalanceAndAllowanceAsync(
|
const amountsElement = decodedAssetData.amounts[index];
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
const totalAmount = amount.times(amountsElement);
|
||||||
(decodedAssetData as ERC721AssetData).tokenAddress,
|
await this._increaseBalanceAndAllowanceWithAssetDataAsync(
|
||||||
userAddress,
|
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
|
||||||
(decodedAssetData as ERC721AssetData).tokenId,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case AssetProxyId.MultiAsset:
|
|
||||||
for (const [
|
|
||||||
index,
|
|
||||||
nestedAssetDataElement,
|
nestedAssetDataElement,
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
userAddress,
|
||||||
] of (decodedAssetData as MultiAssetData).nestedAssetData.entries()) {
|
totalAmount,
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
);
|
||||||
const amountsElement = (decodedAssetData as MultiAssetData).amounts[index];
|
}
|
||||||
const totalAmount = amount.times(amountsElement);
|
|
||||||
await this._increaseBalanceAndAllowanceWithAssetDataAsync(
|
|
||||||
nestedAssetDataElement,
|
|
||||||
userAddress,
|
|
||||||
totalAmount,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error(`Proxy with id ${decodedAssetData.assetProxyId} not supported`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
SingleAssetData,
|
SingleAssetData,
|
||||||
} from '@0x/types';
|
} from '@0x/types';
|
||||||
import { AbiEncoder, BigNumber } from '@0x/utils';
|
import { AbiEncoder, BigNumber } from '@0x/utils';
|
||||||
import { MethodAbi } from 'ethereum-types';
|
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { constants } from './constants';
|
import { constants } from './constants';
|
||||||
@ -23,7 +22,7 @@ export const assetDataUtils = {
|
|||||||
* @return The hex encoded assetData string
|
* @return The hex encoded assetData string
|
||||||
*/
|
*/
|
||||||
encodeERC20AssetData(tokenAddress: string): string {
|
encodeERC20AssetData(tokenAddress: string): string {
|
||||||
const abiEncoder = new AbiEncoder.Method(constants.ERC20_METHOD_ABI as MethodAbi);
|
const abiEncoder = new AbiEncoder.Method(constants.ERC20_METHOD_ABI);
|
||||||
const args = [tokenAddress];
|
const args = [tokenAddress];
|
||||||
const assetData = abiEncoder.encode(args, encodingRules);
|
const assetData = abiEncoder.encode(args, encodingRules);
|
||||||
return assetData;
|
return assetData;
|
||||||
@ -36,7 +35,7 @@ export const assetDataUtils = {
|
|||||||
decodeERC20AssetData(assetData: string): ERC20AssetData {
|
decodeERC20AssetData(assetData: string): ERC20AssetData {
|
||||||
assetDataUtils.assertIsERC20AssetData(assetData);
|
assetDataUtils.assertIsERC20AssetData(assetData);
|
||||||
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
|
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
|
||||||
const abiEncoder = new AbiEncoder.Method(constants.ERC20_METHOD_ABI as MethodAbi);
|
const abiEncoder = new AbiEncoder.Method(constants.ERC20_METHOD_ABI);
|
||||||
const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
|
const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
|
||||||
return {
|
return {
|
||||||
assetProxyId,
|
assetProxyId,
|
||||||
@ -52,7 +51,7 @@ export const assetDataUtils = {
|
|||||||
* @return The hex encoded assetData string
|
* @return The hex encoded assetData string
|
||||||
*/
|
*/
|
||||||
encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string {
|
encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string {
|
||||||
const abiEncoder = new AbiEncoder.Method(constants.ERC721_METHOD_ABI as MethodAbi);
|
const abiEncoder = new AbiEncoder.Method(constants.ERC721_METHOD_ABI);
|
||||||
const args = [tokenAddress, tokenId];
|
const args = [tokenAddress, tokenId];
|
||||||
const assetData = abiEncoder.encode(args, encodingRules);
|
const assetData = abiEncoder.encode(args, encodingRules);
|
||||||
return assetData;
|
return assetData;
|
||||||
@ -65,7 +64,7 @@ export const assetDataUtils = {
|
|||||||
decodeERC721AssetData(assetData: string): ERC721AssetData {
|
decodeERC721AssetData(assetData: string): ERC721AssetData {
|
||||||
assetDataUtils.assertIsERC721AssetData(assetData);
|
assetDataUtils.assertIsERC721AssetData(assetData);
|
||||||
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
|
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
|
||||||
const abiEncoder = new AbiEncoder.Method(constants.ERC721_METHOD_ABI as MethodAbi);
|
const abiEncoder = new AbiEncoder.Method(constants.ERC721_METHOD_ABI);
|
||||||
const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
|
const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
|
||||||
return {
|
return {
|
||||||
assetProxyId,
|
assetProxyId,
|
||||||
@ -90,7 +89,7 @@ export const assetDataUtils = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
_.forEach(nestedAssetData, assetDataElement => assetDataUtils.validateAssetDataOrThrow(assetDataElement));
|
_.forEach(nestedAssetData, assetDataElement => assetDataUtils.validateAssetDataOrThrow(assetDataElement));
|
||||||
const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI as MethodAbi);
|
const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI);
|
||||||
const args = [amounts, nestedAssetData];
|
const args = [amounts, nestedAssetData];
|
||||||
const assetData = abiEncoder.encode(args, encodingRules);
|
const assetData = abiEncoder.encode(args, encodingRules);
|
||||||
return assetData;
|
return assetData;
|
||||||
@ -103,7 +102,7 @@ export const assetDataUtils = {
|
|||||||
decodeMultiAssetData(assetData: string): MultiAssetData {
|
decodeMultiAssetData(assetData: string): MultiAssetData {
|
||||||
assetDataUtils.assertIsMultiAssetData(assetData);
|
assetDataUtils.assertIsMultiAssetData(assetData);
|
||||||
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
|
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
|
||||||
const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI as MethodAbi);
|
const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI);
|
||||||
const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
|
const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
|
||||||
// TODO(abandeali1): fix return types for `AbiEncoder.Method.decode` so that we can remove type assertion
|
// TODO(abandeali1): fix return types for `AbiEncoder.Method.decode` so that we can remove type assertion
|
||||||
const amounts = (decodedAssetData as any).amounts;
|
const amounts = (decodedAssetData as any).amounts;
|
||||||
@ -138,7 +137,7 @@ export const assetDataUtils = {
|
|||||||
nestedAssetDataElement,
|
nestedAssetDataElement,
|
||||||
);
|
);
|
||||||
amounts.push(
|
amounts.push(
|
||||||
_.map(recursivelyDecodedAssetData.amounts as BigNumber[], amountElement =>
|
_.map(recursivelyDecodedAssetData.amounts, amountElement =>
|
||||||
amountElement.times(decodedAssetData.amounts[index]),
|
amountElement.times(decodedAssetData.amounts[index]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -181,6 +180,27 @@ export const assetDataUtils = {
|
|||||||
}
|
}
|
||||||
return assetProxyId;
|
return assetProxyId;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Checks if the decoded asset data is valid ERC20 data
|
||||||
|
* @param decodedAssetData The decoded asset data to check
|
||||||
|
*/
|
||||||
|
isERC20AssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is ERC20AssetData {
|
||||||
|
return decodedAssetData.assetProxyId === AssetProxyId.ERC20;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Checks if the decoded asset data is valid ERC721 data
|
||||||
|
* @param decodedAssetData The decoded asset data to check
|
||||||
|
*/
|
||||||
|
isERC721AssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is ERC721AssetData {
|
||||||
|
return decodedAssetData.assetProxyId === AssetProxyId.ERC721;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Checks if the decoded asset data is valid MultiAsset data
|
||||||
|
* @param decodedAssetData The decoded asset data to check
|
||||||
|
*/
|
||||||
|
isMultiAssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is MultiAssetData {
|
||||||
|
return decodedAssetData.assetProxyId === AssetProxyId.MultiAsset;
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Throws if the length or assetProxyId are invalid for the ERC20Proxy.
|
* Throws if the length or assetProxyId are invalid for the ERC20Proxy.
|
||||||
* @param assetData Hex encoded assetData string
|
* @param assetData Hex encoded assetData string
|
||||||
|
@ -1,4 +1,58 @@
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
|
import { MethodAbi } from 'ethereum-types';
|
||||||
|
|
||||||
|
const ERC20_METHOD_ABI: MethodAbi = {
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
name: 'tokenContract',
|
||||||
|
type: 'address',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
name: 'ERC20Token',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function',
|
||||||
|
};
|
||||||
|
|
||||||
|
const ERC721_METHOD_ABI: MethodAbi = {
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
name: 'tokenContract',
|
||||||
|
type: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'tokenId',
|
||||||
|
type: 'uint256',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
name: 'ERC721Token',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function',
|
||||||
|
};
|
||||||
|
|
||||||
|
const MULTI_ASSET_METHOD_ABI: MethodAbi = {
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
name: 'amounts',
|
||||||
|
type: 'uint256[]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'nestedAssetData',
|
||||||
|
type: 'bytes[]',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
name: 'MultiAsset',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function',
|
||||||
|
};
|
||||||
|
|
||||||
export const constants = {
|
export const constants = {
|
||||||
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||||
@ -49,54 +103,7 @@ export const constants = {
|
|||||||
{ name: 'data', type: 'bytes' },
|
{ name: 'data', type: 'bytes' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
ERC20_METHOD_ABI: {
|
ERC20_METHOD_ABI,
|
||||||
constant: false,
|
ERC721_METHOD_ABI,
|
||||||
inputs: [
|
MULTI_ASSET_METHOD_ABI,
|
||||||
{
|
|
||||||
name: 'tokenContract',
|
|
||||||
type: 'address',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
name: 'ERC20Token',
|
|
||||||
outputs: [],
|
|
||||||
payable: false,
|
|
||||||
stateMutability: 'nonpayable',
|
|
||||||
type: 'function',
|
|
||||||
},
|
|
||||||
ERC721_METHOD_ABI: {
|
|
||||||
constant: false,
|
|
||||||
inputs: [
|
|
||||||
{
|
|
||||||
name: 'tokenContract',
|
|
||||||
type: 'address',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'tokenId',
|
|
||||||
type: 'uint256',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
name: 'ERC721Token',
|
|
||||||
outputs: [],
|
|
||||||
payable: false,
|
|
||||||
stateMutability: 'nonpayable',
|
|
||||||
type: 'function',
|
|
||||||
},
|
|
||||||
MULTI_ASSET_METHOD_ABI: {
|
|
||||||
constant: false,
|
|
||||||
inputs: [
|
|
||||||
{
|
|
||||||
name: 'amounts',
|
|
||||||
type: 'uint256[]',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'nestedAssetData',
|
|
||||||
type: 'bytes[]',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
name: 'MultiAsset',
|
|
||||||
outputs: [],
|
|
||||||
payable: false,
|
|
||||||
stateMutability: 'nonpayable',
|
|
||||||
type: 'function',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
@ -108,7 +108,7 @@ export class ExchangeTransferSimulator {
|
|||||||
const amountsElement = decodedAssetData.amounts[index];
|
const amountsElement = decodedAssetData.amounts[index];
|
||||||
const totalAmount = amountInBaseUnits.times(amountsElement);
|
const totalAmount = amountInBaseUnits.times(amountsElement);
|
||||||
await this.transferFromAsync(
|
await this.transferFromAsync(
|
||||||
nestedAssetDataElement as string,
|
nestedAssetDataElement,
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
totalAmount,
|
totalAmount,
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
AssetProxyId,
|
|
||||||
ExchangeContractErrs,
|
ExchangeContractErrs,
|
||||||
MultiAssetData,
|
|
||||||
ObjectMap,
|
ObjectMap,
|
||||||
OrderRelevantState,
|
OrderRelevantState,
|
||||||
OrderState,
|
OrderState,
|
||||||
OrderStateInvalid,
|
OrderStateInvalid,
|
||||||
OrderStateValid,
|
OrderStateValid,
|
||||||
SignedOrder,
|
SignedOrder,
|
||||||
SingleAssetData,
|
|
||||||
} from '@0x/types';
|
} from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -310,22 +307,16 @@ export class OrderStateUtils {
|
|||||||
): Promise<ObjectMap<BigNumber>> {
|
): Promise<ObjectMap<BigNumber>> {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
let balances: ObjectMap<BigNumber> = { ...initialBalances };
|
let balances: ObjectMap<BigNumber> = { ...initialBalances };
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData) || assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
const balance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(assetData, traderAddress);
|
||||||
case AssetProxyId.ERC721:
|
const tokenAddress = decodedAssetData.tokenAddress;
|
||||||
const balance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(assetData, traderAddress);
|
balances[tokenAddress] = _.isUndefined(initialBalances[tokenAddress])
|
||||||
const tokenAddress = (decodedAssetData as SingleAssetData).tokenAddress;
|
? balance
|
||||||
balances[tokenAddress] = _.isUndefined(initialBalances[tokenAddress])
|
: balances[tokenAddress].add(balance);
|
||||||
? balance
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
: balances[tokenAddress].add(balance);
|
for (const assetDataElement of decodedAssetData.nestedAssetData) {
|
||||||
break;
|
balances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, balances);
|
||||||
case AssetProxyId.MultiAsset:
|
}
|
||||||
for (const assetDataElement of (decodedAssetData as MultiAssetData).nestedAssetData) {
|
|
||||||
balances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, balances);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error(`Proxy with id ${decodedAssetData.assetProxyId} not supported`);
|
|
||||||
}
|
}
|
||||||
return balances;
|
return balances;
|
||||||
}
|
}
|
||||||
@ -336,25 +327,19 @@ export class OrderStateUtils {
|
|||||||
): Promise<ObjectMap<BigNumber>> {
|
): Promise<ObjectMap<BigNumber>> {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
let allowances: ObjectMap<BigNumber> = { ...initialAllowances };
|
let allowances: ObjectMap<BigNumber> = { ...initialAllowances };
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData) || assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
const allowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync(
|
||||||
case AssetProxyId.ERC721:
|
assetData,
|
||||||
const allowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync(
|
traderAddress,
|
||||||
assetData,
|
);
|
||||||
traderAddress,
|
const tokenAddress = decodedAssetData.tokenAddress;
|
||||||
);
|
allowances[tokenAddress] = _.isUndefined(initialAllowances[tokenAddress])
|
||||||
const tokenAddress = (decodedAssetData as SingleAssetData).tokenAddress;
|
? allowance
|
||||||
allowances[tokenAddress] = _.isUndefined(initialAllowances[tokenAddress])
|
: allowances[tokenAddress].add(allowance);
|
||||||
? allowance
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
: allowances[tokenAddress].add(allowance);
|
for (const assetDataElement of decodedAssetData.nestedAssetData) {
|
||||||
break;
|
allowances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, allowances);
|
||||||
case AssetProxyId.MultiAsset:
|
}
|
||||||
for (const assetDataElement of (decodedAssetData as MultiAssetData).nestedAssetData) {
|
|
||||||
allowances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, allowances);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error(`Proxy with id ${decodedAssetData.assetProxyId} not supported`);
|
|
||||||
}
|
}
|
||||||
return allowances;
|
return allowances;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ const KNOWN_MULTI_ASSET_ENCODING = {
|
|||||||
'0x94cfcdd7000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000024f47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000',
|
'0x94cfcdd7000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000024f47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000',
|
||||||
};
|
};
|
||||||
|
|
||||||
// tslint:disable:no-unnecessary-type-assertion
|
|
||||||
describe('assetDataUtils', () => {
|
describe('assetDataUtils', () => {
|
||||||
it('should encode ERC20', () => {
|
it('should encode ERC20', () => {
|
||||||
const assetData = assetDataUtils.encodeERC20AssetData(KNOWN_ERC20_ENCODING.address);
|
const assetData = assetDataUtils.encodeERC20AssetData(KNOWN_ERC20_ENCODING.address);
|
||||||
@ -69,6 +68,7 @@ describe('assetDataUtils', () => {
|
|||||||
expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.MultiAsset);
|
expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.MultiAsset);
|
||||||
expect(decodedAssetData.amounts).to.deep.equal(KNOWN_MULTI_ASSET_ENCODING.amounts);
|
expect(decodedAssetData.amounts).to.deep.equal(KNOWN_MULTI_ASSET_ENCODING.amounts);
|
||||||
const decodedErc20AssetData = decodedAssetData.nestedAssetData[0];
|
const decodedErc20AssetData = decodedAssetData.nestedAssetData[0];
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
const decodedErc721AssetData = decodedAssetData.nestedAssetData[1] as ERC721AssetData;
|
const decodedErc721AssetData = decodedAssetData.nestedAssetData[1] as ERC721AssetData;
|
||||||
expect(decodedErc20AssetData.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
|
expect(decodedErc20AssetData.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
|
||||||
expect(decodedErc20AssetData.assetProxyId).to.equal(AssetProxyId.ERC20);
|
expect(decodedErc20AssetData.assetProxyId).to.equal(AssetProxyId.ERC20);
|
||||||
@ -91,8 +91,10 @@ describe('assetDataUtils', () => {
|
|||||||
const expectedLength = 4;
|
const expectedLength = 4;
|
||||||
expect(decodedAssetData.nestedAssetData.length).to.be.equal(expectedLength);
|
expect(decodedAssetData.nestedAssetData.length).to.be.equal(expectedLength);
|
||||||
const decodedErc20AssetData1 = decodedAssetData.nestedAssetData[0];
|
const decodedErc20AssetData1 = decodedAssetData.nestedAssetData[0];
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
const decodedErc721AssetData1 = decodedAssetData.nestedAssetData[1] as ERC721AssetData;
|
const decodedErc721AssetData1 = decodedAssetData.nestedAssetData[1] as ERC721AssetData;
|
||||||
const decodedErc20AssetData2 = decodedAssetData.nestedAssetData[2];
|
const decodedErc20AssetData2 = decodedAssetData.nestedAssetData[2];
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
const decodedErc721AssetData2 = decodedAssetData.nestedAssetData[3] as ERC721AssetData;
|
const decodedErc721AssetData2 = decodedAssetData.nestedAssetData[3] as ERC721AssetData;
|
||||||
expect(decodedErc20AssetData1.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
|
expect(decodedErc20AssetData1.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
|
||||||
expect(decodedErc20AssetData1.assetProxyId).to.equal(AssetProxyId.ERC20);
|
expect(decodedErc20AssetData1.assetProxyId).to.equal(AssetProxyId.ERC20);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// tslint:disable:no-unnecessary-type-assertion
|
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId, ERC20AssetData, ERC721AssetData, MultiAssetData, SignedOrder } from '@0x/types';
|
import { AssetProxyId, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
@ -70,7 +69,10 @@ export class DependentOrderHashesTracker {
|
|||||||
this._removeAssetDataFromDependentOrderHashes(signedOrder, signedOrder.makerAssetData);
|
this._removeAssetDataFromDependentOrderHashes(signedOrder, signedOrder.makerAssetData);
|
||||||
// If makerToken === ZRX then we already removed it and we don't need to remove it again.
|
// If makerToken === ZRX then we already removed it and we don't need to remove it again.
|
||||||
const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
|
const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
|
||||||
if ((decodedMakerAssetData as ERC20AssetData).tokenAddress !== this._zrxTokenAddress) {
|
if (
|
||||||
|
assetDataUtils.isERC20AssetData(decodedMakerAssetData) &&
|
||||||
|
decodedMakerAssetData.tokenAddress !== this._zrxTokenAddress
|
||||||
|
) {
|
||||||
this._removeFromERC20DependentOrderhashes(signedOrder, this._zrxTokenAddress);
|
this._removeFromERC20DependentOrderhashes(signedOrder, this._zrxTokenAddress);
|
||||||
}
|
}
|
||||||
this._removeFromMakerDependentOrderhashes(signedOrder);
|
this._removeFromMakerDependentOrderhashes(signedOrder);
|
||||||
@ -149,24 +151,14 @@ export class DependentOrderHashesTracker {
|
|||||||
}
|
}
|
||||||
private _addAssetDataToDependentOrderHashes(signedOrder: SignedOrder, assetData: string): void {
|
private _addAssetDataToDependentOrderHashes(signedOrder: SignedOrder, assetData: string): void {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
this._addToERC20DependentOrderHashes(signedOrder, decodedAssetData.tokenAddress);
|
||||||
this._addToERC20DependentOrderHashes(signedOrder, (decodedAssetData as ERC20AssetData).tokenAddress);
|
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
break;
|
this._addToERC721DependentOrderHashes(signedOrder, decodedAssetData.tokenAddress, decodedAssetData.tokenId);
|
||||||
case AssetProxyId.ERC721:
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
this._addToERC721DependentOrderHashes(
|
_.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
|
||||||
signedOrder,
|
this._addAssetDataToDependentOrderHashes(signedOrder, nestedAssetDataElement),
|
||||||
(decodedAssetData as ERC721AssetData).tokenAddress,
|
);
|
||||||
(decodedAssetData as ERC721AssetData).tokenId,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case AssetProxyId.MultiAsset:
|
|
||||||
_.each((decodedAssetData as MultiAssetData).nestedAssetData, nestedAssetDataElement =>
|
|
||||||
this._addAssetDataToDependentOrderHashes(signedOrder, nestedAssetDataElement),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private _addToMakerDependentOrderHashes(signedOrder: SignedOrder): void {
|
private _addToMakerDependentOrderHashes(signedOrder: SignedOrder): void {
|
||||||
@ -234,27 +226,18 @@ export class DependentOrderHashesTracker {
|
|||||||
}
|
}
|
||||||
private _removeAssetDataFromDependentOrderHashes(signedOrder: SignedOrder, assetData: string): void {
|
private _removeAssetDataFromDependentOrderHashes(signedOrder: SignedOrder, assetData: string): void {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
this._removeFromERC20DependentOrderhashes(signedOrder, decodedAssetData.tokenAddress);
|
||||||
this._removeFromERC20DependentOrderhashes(
|
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
signedOrder,
|
this._removeFromERC721DependentOrderhashes(
|
||||||
(decodedAssetData as ERC20AssetData).tokenAddress,
|
signedOrder,
|
||||||
);
|
decodedAssetData.tokenAddress,
|
||||||
break;
|
decodedAssetData.tokenId,
|
||||||
case AssetProxyId.ERC721:
|
);
|
||||||
this._removeFromERC721DependentOrderhashes(
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
signedOrder,
|
_.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
|
||||||
(decodedAssetData as ERC721AssetData).tokenAddress,
|
this._removeAssetDataFromDependentOrderHashes(signedOrder, nestedAssetDataElement),
|
||||||
(decodedAssetData as ERC721AssetData).tokenId,
|
);
|
||||||
);
|
|
||||||
break;
|
|
||||||
case AssetProxyId.MultiAsset:
|
|
||||||
_.each((decodedAssetData as MultiAssetData).nestedAssetData, nestedAssetDataElement =>
|
|
||||||
this._removeAssetDataFromDependentOrderHashes(signedOrder, nestedAssetDataElement),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,7 @@ import {
|
|||||||
orderHashUtils,
|
orderHashUtils,
|
||||||
OrderStateUtils,
|
OrderStateUtils,
|
||||||
} from '@0x/order-utils';
|
} from '@0x/order-utils';
|
||||||
import {
|
import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0x/types';
|
||||||
AssetProxyId,
|
|
||||||
ERC20AssetData,
|
|
||||||
ERC721AssetData,
|
|
||||||
ExchangeContractErrs,
|
|
||||||
MultiAssetData,
|
|
||||||
OrderState,
|
|
||||||
SignedOrder,
|
|
||||||
Stats,
|
|
||||||
} from '@0x/types';
|
|
||||||
import { errorUtils, intervalUtils } from '@0x/utils';
|
import { errorUtils, intervalUtils } from '@0x/utils';
|
||||||
import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, Provider } from 'ethereum-types';
|
import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, Provider } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -240,20 +231,14 @@ export class OrderWatcher {
|
|||||||
}
|
}
|
||||||
private _addAssetDataToAbiDecoder(assetData: string): void {
|
private _addAssetDataToAbiDecoder(assetData: string): void {
|
||||||
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||||
switch (decodedAssetData.assetProxyId) {
|
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
|
||||||
case AssetProxyId.ERC20:
|
this._collisionResistantAbiDecoder.addERC20Token(decodedAssetData.tokenAddress);
|
||||||
this._collisionResistantAbiDecoder.addERC20Token((decodedAssetData as ERC20AssetData).tokenAddress);
|
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
|
||||||
break;
|
this._collisionResistantAbiDecoder.addERC721Token(decodedAssetData.tokenAddress);
|
||||||
case AssetProxyId.ERC721:
|
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
|
||||||
this._collisionResistantAbiDecoder.addERC721Token((decodedAssetData as ERC721AssetData).tokenAddress);
|
_.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
|
||||||
break;
|
this._addAssetDataToAbiDecoder(nestedAssetDataElement),
|
||||||
case AssetProxyId.MultiAsset:
|
);
|
||||||
_.each((decodedAssetData as MultiAssetData).nestedAssetData, nestedAssetDataElement =>
|
|
||||||
this._addAssetDataToAbiDecoder(nestedAssetDataElement),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private _deleteLazyStoreBalance(assetData: string, userAddress: string): void {
|
private _deleteLazyStoreBalance(assetData: string, userAddress: string): void {
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { ExchangeCancelEventArgs, ExchangeCancelUpToEventArgs, ExchangeFillEventArgs } from '@0x/contract-wrappers';
|
import { ExchangeCancelEventArgs, ExchangeCancelUpToEventArgs, ExchangeFillEventArgs } from '@0x/contract-wrappers';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId, ERC721AssetData, SingleAssetData } from '@0x/types';
|
import { AssetProxyId, ERC721AssetData } from '@0x/types';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
|
||||||
import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeFillEvent } from '../../entities';
|
import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeFillEvent } from '../../entities';
|
||||||
import { bigNumbertoStringOrNull, convertAssetProxyIdToType } from '../../utils';
|
import { bigNumbertoStringOrNull, convertAssetProxyIdToType } from '../../utils';
|
||||||
|
|
||||||
// tslint:disable:no-unnecessary-type-assertion
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses raw event logs for a fill event and returns an array of
|
* Parses raw event logs for a fill event and returns an array of
|
||||||
* ExchangeFillEvent entities.
|
* ExchangeFillEvent entities.
|
||||||
@ -59,26 +57,24 @@ export function _convertToExchangeFillEvent(eventLog: LogWithDecodedArgs<Exchang
|
|||||||
exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid;
|
exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid;
|
||||||
exchangeFillEvent.orderHash = eventLog.args.orderHash;
|
exchangeFillEvent.orderHash = eventLog.args.orderHash;
|
||||||
exchangeFillEvent.rawMakerAssetData = eventLog.args.makerAssetData;
|
exchangeFillEvent.rawMakerAssetData = eventLog.args.makerAssetData;
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeFillEvent.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
|
exchangeFillEvent.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
|
||||||
exchangeFillEvent.makerAssetProxyId = makerAssetData.assetProxyId;
|
exchangeFillEvent.makerAssetProxyId = makerAssetData.assetProxyId;
|
||||||
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store a null byte array when decoding assetData from the MultiAssetProxy
|
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
|
||||||
exchangeFillEvent.makerTokenAddress =
|
exchangeFillEvent.makerTokenAddress = assetDataUtils.isMultiAssetData(makerAssetData)
|
||||||
makerAssetData.assetProxyId === AssetProxyId.MultiAsset
|
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.makerAssetData).nestedAssetData[0].tokenAddress
|
||||||
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.makerAssetData).nestedAssetData[0]
|
: makerAssetData.tokenAddress;
|
||||||
.tokenAddress
|
|
||||||
: (makerAssetData as SingleAssetData).tokenAddress;
|
|
||||||
// tslint has a false positive here. Type assertion is required.
|
// tslint has a false positive here. Type assertion is required.
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeFillEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
|
exchangeFillEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
|
||||||
exchangeFillEvent.rawTakerAssetData = eventLog.args.takerAssetData;
|
exchangeFillEvent.rawTakerAssetData = eventLog.args.takerAssetData;
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeFillEvent.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
|
exchangeFillEvent.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
|
||||||
exchangeFillEvent.takerAssetProxyId = takerAssetData.assetProxyId;
|
exchangeFillEvent.takerAssetProxyId = takerAssetData.assetProxyId;
|
||||||
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store a null byte array when decoding assetData from the MultiAssetProxy
|
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
|
||||||
exchangeFillEvent.takerTokenAddress =
|
exchangeFillEvent.takerTokenAddress = assetDataUtils.isMultiAssetData(takerAssetData)
|
||||||
takerAssetData.assetProxyId === AssetProxyId.MultiAsset
|
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.takerAssetData).nestedAssetData[0].tokenAddress
|
||||||
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.takerAssetData).nestedAssetData[0]
|
: takerAssetData.tokenAddress;
|
||||||
.tokenAddress
|
|
||||||
: (takerAssetData as SingleAssetData).tokenAddress;
|
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeFillEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
|
exchangeFillEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
|
||||||
return exchangeFillEvent;
|
return exchangeFillEvent;
|
||||||
@ -106,25 +102,23 @@ export function _convertToExchangeCancelEvent(
|
|||||||
exchangeCancelEvent.senderAddress = eventLog.args.senderAddress;
|
exchangeCancelEvent.senderAddress = eventLog.args.senderAddress;
|
||||||
exchangeCancelEvent.orderHash = eventLog.args.orderHash;
|
exchangeCancelEvent.orderHash = eventLog.args.orderHash;
|
||||||
exchangeCancelEvent.rawMakerAssetData = eventLog.args.makerAssetData;
|
exchangeCancelEvent.rawMakerAssetData = eventLog.args.makerAssetData;
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeCancelEvent.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
|
exchangeCancelEvent.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
|
||||||
exchangeCancelEvent.makerAssetProxyId = makerAssetData.assetProxyId;
|
exchangeCancelEvent.makerAssetProxyId = makerAssetData.assetProxyId;
|
||||||
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store a null byte array when decoding assetData from the MultiAssetProxy
|
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
|
||||||
exchangeCancelEvent.makerTokenAddress =
|
exchangeCancelEvent.makerTokenAddress = assetDataUtils.isMultiAssetData(makerAssetData)
|
||||||
makerAssetData.assetProxyId === AssetProxyId.MultiAsset
|
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.makerAssetData).nestedAssetData[0].tokenAddress
|
||||||
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.makerAssetData).nestedAssetData[0]
|
: makerAssetData.tokenAddress;
|
||||||
.tokenAddress
|
|
||||||
: (makerAssetData as SingleAssetData).tokenAddress;
|
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeCancelEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
|
exchangeCancelEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
|
||||||
exchangeCancelEvent.rawTakerAssetData = eventLog.args.takerAssetData;
|
exchangeCancelEvent.rawTakerAssetData = eventLog.args.takerAssetData;
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeCancelEvent.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
|
exchangeCancelEvent.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
|
||||||
exchangeCancelEvent.takerAssetProxyId = takerAssetData.assetProxyId;
|
exchangeCancelEvent.takerAssetProxyId = takerAssetData.assetProxyId;
|
||||||
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store a null byte array when decoding assetData from the MultiAssetProxy
|
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
|
||||||
exchangeCancelEvent.takerTokenAddress =
|
exchangeCancelEvent.takerTokenAddress = assetDataUtils.isMultiAssetData(takerAssetData)
|
||||||
takerAssetData.assetProxyId === AssetProxyId.MultiAsset
|
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.takerAssetData).nestedAssetData[0].tokenAddress
|
||||||
? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.takerAssetData).nestedAssetData[0]
|
: takerAssetData.tokenAddress;
|
||||||
.tokenAddress
|
|
||||||
: (takerAssetData as SingleAssetData).tokenAddress;
|
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
exchangeCancelEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
|
exchangeCancelEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
|
||||||
return exchangeCancelEvent;
|
return exchangeCancelEvent;
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import { APIOrder, OrdersResponse } from '@0x/connect';
|
import { APIOrder, OrdersResponse } from '@0x/connect';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId, ERC721AssetData, SingleAssetData } from '@0x/types';
|
import { AssetProxyId, ERC721AssetData } from '@0x/types';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
|
||||||
import { SraOrder } from '../../entities';
|
import { SraOrder } from '../../entities';
|
||||||
import { bigNumbertoStringOrNull, convertAssetProxyIdToType } from '../../utils';
|
import { bigNumbertoStringOrNull, convertAssetProxyIdToType } from '../../utils';
|
||||||
|
|
||||||
// tslint:disable:no-unnecessary-type-assertion
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a raw order response from an SRA endpoint and returns an array of
|
* Parses a raw order response from an SRA endpoint and returns an array of
|
||||||
* SraOrder entities.
|
* SraOrder entities.
|
||||||
@ -43,26 +41,24 @@ export function _convertToEntity(apiOrder: APIOrder): SraOrder {
|
|||||||
sraOrder.signature = apiOrder.order.signature;
|
sraOrder.signature = apiOrder.order.signature;
|
||||||
|
|
||||||
sraOrder.rawMakerAssetData = apiOrder.order.makerAssetData;
|
sraOrder.rawMakerAssetData = apiOrder.order.makerAssetData;
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
sraOrder.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
|
sraOrder.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
|
||||||
sraOrder.makerAssetProxyId = makerAssetData.assetProxyId;
|
sraOrder.makerAssetProxyId = makerAssetData.assetProxyId;
|
||||||
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store a null byte array when decoding assetData from the MultiAssetProxy
|
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
|
||||||
sraOrder.makerTokenAddress =
|
sraOrder.makerTokenAddress = assetDataUtils.isMultiAssetData(makerAssetData)
|
||||||
makerAssetData.assetProxyId === AssetProxyId.MultiAsset
|
? assetDataUtils.decodeMultiAssetDataRecursively(apiOrder.order.makerAssetData).nestedAssetData[0].tokenAddress
|
||||||
? assetDataUtils.decodeMultiAssetDataRecursively(apiOrder.order.makerAssetData).nestedAssetData[0]
|
: makerAssetData.tokenAddress;
|
||||||
.tokenAddress
|
|
||||||
: (makerAssetData as SingleAssetData).tokenAddress;
|
|
||||||
// tslint has a false positive here. Type assertion is required.
|
// tslint has a false positive here. Type assertion is required.
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
sraOrder.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
|
sraOrder.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
|
||||||
sraOrder.rawTakerAssetData = apiOrder.order.takerAssetData;
|
sraOrder.rawTakerAssetData = apiOrder.order.takerAssetData;
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
sraOrder.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
|
sraOrder.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
|
||||||
sraOrder.takerAssetProxyId = takerAssetData.assetProxyId;
|
sraOrder.takerAssetProxyId = takerAssetData.assetProxyId;
|
||||||
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store a null byte array when decoding assetData from the MultiAssetProxy
|
// HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
|
||||||
sraOrder.takerTokenAddress =
|
sraOrder.takerTokenAddress = assetDataUtils.isMultiAssetData(takerAssetData)
|
||||||
takerAssetData.assetProxyId === AssetProxyId.MultiAsset
|
? assetDataUtils.decodeMultiAssetDataRecursively(apiOrder.order.takerAssetData).nestedAssetData[0].tokenAddress
|
||||||
? assetDataUtils.decodeMultiAssetDataRecursively(apiOrder.order.takerAssetData).nestedAssetData[0]
|
: takerAssetData.tokenAddress;
|
||||||
.tokenAddress
|
|
||||||
: (takerAssetData as SingleAssetData).tokenAddress;
|
|
||||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
sraOrder.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
|
sraOrder.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
|
||||||
|
|
||||||
|
39
yarn.lock
39
yarn.lock
@ -2100,10 +2100,6 @@ aes-js@^0.2.3:
|
|||||||
version "0.2.4"
|
version "0.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d"
|
resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d"
|
||||||
|
|
||||||
aes-js@^3.1.1:
|
|
||||||
version "3.1.2"
|
|
||||||
resolved "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a"
|
|
||||||
|
|
||||||
agent-base@4, agent-base@^4.1.0, agent-base@~4.2.0:
|
agent-base@4, agent-base@^4.1.0, agent-base@~4.2.0:
|
||||||
version "4.2.1"
|
version "4.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
||||||
@ -3669,7 +3665,7 @@ bs-logger@0.x:
|
|||||||
dependencies:
|
dependencies:
|
||||||
fast-json-stable-stringify "^2.0.0"
|
fast-json-stable-stringify "^2.0.0"
|
||||||
|
|
||||||
bs58@=4.0.1, bs58@^4.0.0:
|
bs58@=4.0.1:
|
||||||
version "4.0.1"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
|
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3692,14 +3688,6 @@ bs58check@^1.0.8:
|
|||||||
bs58 "^3.1.0"
|
bs58 "^3.1.0"
|
||||||
create-hash "^1.1.0"
|
create-hash "^1.1.0"
|
||||||
|
|
||||||
bs58check@^2.1.2:
|
|
||||||
version "2.1.2"
|
|
||||||
resolved "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc"
|
|
||||||
dependencies:
|
|
||||||
bs58 "^4.0.0"
|
|
||||||
create-hash "^1.1.0"
|
|
||||||
safe-buffer "^5.1.2"
|
|
||||||
|
|
||||||
bser@^2.0.0:
|
bser@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719"
|
resolved "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719"
|
||||||
@ -6410,19 +6398,6 @@ ethereumjs-wallet@0.6.0:
|
|||||||
utf8 "^2.1.1"
|
utf8 "^2.1.1"
|
||||||
uuid "^2.0.1"
|
uuid "^2.0.1"
|
||||||
|
|
||||||
ethereumjs-wallet@~0.6.0:
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda"
|
|
||||||
dependencies:
|
|
||||||
aes-js "^3.1.1"
|
|
||||||
bs58check "^2.1.2"
|
|
||||||
ethereumjs-util "^5.2.0"
|
|
||||||
hdkey "^1.0.0"
|
|
||||||
safe-buffer "^5.1.2"
|
|
||||||
scrypt.js "^0.2.0"
|
|
||||||
utf8 "^3.0.0"
|
|
||||||
uuid "^3.3.2"
|
|
||||||
|
|
||||||
ethers@~4.0.4:
|
ethers@~4.0.4:
|
||||||
version "4.0.4"
|
version "4.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.4.tgz#d3f85e8b27f4b59537e06526439b0fb15b44dc65"
|
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.4.tgz#d3f85e8b27f4b59537e06526439b0fb15b44dc65"
|
||||||
@ -8077,14 +8052,6 @@ hdkey@^0.7.0, hdkey@^0.7.1:
|
|||||||
coinstring "^2.0.0"
|
coinstring "^2.0.0"
|
||||||
secp256k1 "^3.0.1"
|
secp256k1 "^3.0.1"
|
||||||
|
|
||||||
hdkey@^1.0.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.npmjs.org/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29"
|
|
||||||
dependencies:
|
|
||||||
coinstring "^2.0.0"
|
|
||||||
safe-buffer "^5.1.1"
|
|
||||||
secp256k1 "^3.0.1"
|
|
||||||
|
|
||||||
he@1.1.1:
|
he@1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
|
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
|
||||||
@ -16679,10 +16646,6 @@ utf8@^2.1.1:
|
|||||||
version "2.1.2"
|
version "2.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96"
|
resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96"
|
||||||
|
|
||||||
utf8@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1"
|
|
||||||
|
|
||||||
util-deprecate@~1.0.1:
|
util-deprecate@~1.0.1:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user