Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0xproject/types

Package Overview
Dependencies
Maintainers
5
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xproject/types - npm Package Compare versions

Comparing version 0.8.2 to 1.0.0-rc.1

24

CHANGELOG.json
[
{
"version": "1.0.0-rc.1",
"changes": [
{
"notes": "Updated types for V2 of 0x protocol"
},
{
"note": "Add `ECSignatureBuffer`"
},
{
"note": "Add Forwarder contract revert reasons"
}
]
},
{
"timestamp": 1531149657,

@@ -24,6 +38,6 @@ "version": "0.8.2",

{
"note": "Incorrect publish that was unpublished"
"note": "Change the order type to v2 format",
"pr": 618
}
],
"timestamp": 1527810075
]
},

@@ -34,2 +48,6 @@ {

{
"note": "Make OpCode type an enum",
"pr": 589
},
{
"note":

@@ -36,0 +54,0 @@ "Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js",

360

lib/index.d.ts

@@ -0,232 +1,35 @@

/// <reference types="node" />
import { BigNumber } from 'bignumber.js';
export declare type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void;
/**
* Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
* Read more about Providers in the 0x wiki.
*/
export interface Provider {
sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void;
}
export declare type ContractAbi = AbiDefinition[];
export declare type AbiDefinition = FunctionAbi | EventAbi;
export declare type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi;
export declare type ConstructorStateMutability = 'nonpayable' | 'payable';
export declare type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
export interface MethodAbi {
type: AbiType.Function;
name: string;
inputs: DataItem[];
outputs: DataItem[];
constant: boolean;
stateMutability: StateMutability;
payable: boolean;
}
export interface ConstructorAbi {
type: AbiType.Constructor;
inputs: DataItem[];
payable: boolean;
stateMutability: ConstructorStateMutability;
}
export interface FallbackAbi {
type: AbiType.Fallback;
payable: boolean;
}
export interface EventParameter extends DataItem {
indexed: boolean;
}
export interface EventAbi {
type: AbiType.Event;
name: string;
inputs: EventParameter[];
anonymous: boolean;
}
export interface DataItem {
name: string;
type: string;
components?: DataItem[];
}
export declare type OpCode = string;
export interface StructLog {
depth: number;
error: string;
gas: number;
gasCost: number;
memory: string[];
op: OpCode;
pc: number;
stack: string[];
storage: {
[location: string]: string;
};
}
export interface TransactionTrace {
gas: number;
returnValue: any;
structLogs: StructLog[];
}
export declare type Unit = 'kwei' | 'ada' | 'mwei' | 'babbage' | 'gwei' | 'shannon' | 'szabo' | 'finney' | 'ether' | 'kether' | 'grand' | 'einstein' | 'mether' | 'gether' | 'tether';
export interface JSONRPCRequestPayload {
params: any[];
method: string;
id: number;
jsonrpc: string;
}
export interface JSONRPCResponsePayload {
result: any;
id: number;
jsonrpc: string;
}
export interface AbstractBlock {
number: number | null;
hash: string | null;
parentHash: string;
nonce: string | null;
sha3Uncles: string;
logsBloom: string | null;
transactionsRoot: string;
stateRoot: string;
miner: string;
difficulty: BigNumber;
totalDifficulty: BigNumber;
extraData: string;
size: number;
gasLimit: number;
gasUsed: number;
timestamp: number;
uncles: string[];
}
export interface BlockWithoutTransactionData extends AbstractBlock {
transactions: string[];
}
export interface BlockWithTransactionData extends AbstractBlock {
transactions: Transaction[];
}
export interface Transaction {
hash: string;
nonce: number;
blockHash: string | null;
blockNumber: number | null;
transactionIndex: number | null;
from: string;
to: string | null;
value: BigNumber;
gasPrice: BigNumber;
gas: number;
input: string;
}
export interface CallTxDataBase {
to?: string;
value?: number | string | BigNumber;
gas?: number | string | BigNumber;
gasPrice?: number | string | BigNumber;
data?: string;
nonce?: number;
}
export interface TxData extends CallTxDataBase {
from: string;
}
export interface CallData extends CallTxDataBase {
from?: string;
}
export interface FilterObject {
fromBlock?: number | string;
toBlock?: number | string;
address?: string;
topics?: LogTopic[];
}
export declare type LogTopic = null | string | string[];
export interface DecodedLogEntry<A> extends LogEntry {
event: string;
args: A;
}
export interface DecodedLogEntryEvent<A> extends DecodedLogEntry<A> {
removed: boolean;
}
export interface LogEntryEvent extends LogEntry {
removed: boolean;
}
export interface LogEntry {
logIndex: number | null;
transactionIndex: number | null;
transactionHash: string;
blockHash: string | null;
blockNumber: number | null;
address: string;
data: string;
topics: string[];
}
export interface TxDataPayable extends TxData {
value?: BigNumber;
}
export interface TransactionReceipt {
blockHash: string;
blockNumber: number;
transactionHash: string;
transactionIndex: number;
from: string;
to: string;
status: null | string | 0 | 1;
cumulativeGasUsed: number;
gasUsed: number;
contractAddress: string | null;
logs: LogEntry[];
}
export declare enum AbiType {
Function = "function",
Constructor = "constructor",
Event = "event",
Fallback = "fallback",
}
export declare type ContractEventArg = string | BigNumber | number;
export interface DecodedLogArgs {
[argName: string]: ContractEventArg;
}
export interface LogWithDecodedArgs<ArgsType> extends DecodedLogEntry<ArgsType> {
}
export declare type RawLog = LogEntry;
export declare enum SolidityTypes {
Address = "address",
Uint256 = "uint256",
Uint8 = "uint8",
Uint = "uint",
}
/**
* Contains the logs returned by a TransactionReceipt. We attempt to decode the
* logs using AbiDecoder. If we have the logs corresponding ABI, we decode it,
* otherwise we don't.
*/
export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt {
logs: Array<LogWithDecodedArgs<DecodedLogArgs> | LogEntry>;
}
export declare enum BlockParamLiteral {
Latest = "latest",
Pending = "pending",
}
export declare type BlockParam = BlockParamLiteral | number;
export interface RawLogEntry {
logIndex: string | null;
transactionIndex: string | null;
transactionHash: string;
blockHash: string | null;
blockNumber: string | null;
address: string;
data: string;
topics: string[];
}
import { ContractAbi } from 'ethereum-types';
export interface Order {
maker: string;
taker: string;
senderAddress: string;
makerAddress: string;
takerAddress: string;
makerFee: BigNumber;
takerFee: BigNumber;
makerTokenAmount: BigNumber;
takerTokenAmount: BigNumber;
makerTokenAddress: string;
takerTokenAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerAssetData: string;
takerAssetData: string;
salt: BigNumber;
exchangeContractAddress: string;
feeRecipient: string;
expirationUnixTimestampSec: BigNumber;
exchangeAddress: string;
feeRecipientAddress: string;
expirationTimeSeconds: BigNumber;
}
export interface OrderWithoutExchangeAddress {
senderAddress: string;
makerAddress: string;
takerAddress: string;
makerFee: BigNumber;
takerFee: BigNumber;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerAssetData: string;
takerAssetData: string;
salt: BigNumber;
feeRecipientAddress: string;
expirationTimeSeconds: BigNumber;
}
export interface SignedOrder extends Order {
ecSignature: ECSignature;
signature: string;
}

@@ -241,3 +44,15 @@ /**

}
export interface ECSignatureBuffer {
v: number;
r: Buffer;
s: Buffer;
}
/**
* Validator signature components
*/
export interface ValidatorSignature {
validatorAddress: string;
signature: string;
}
/**
* Errors originating from the 0x exchange contract

@@ -279,4 +94,2 @@ */

}
export declare type OrderAddresses = [string, string, string, string, string];
export declare type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber];
export declare type DoneCallback = (err?: Error) => void;

@@ -288,6 +101,5 @@ export interface OrderRelevantState {

makerFeeProxyAllowance: BigNumber;
filledTakerTokenAmount: BigNumber;
cancelledTakerTokenAmount: BigNumber;
remainingFillableMakerTokenAmount: BigNumber;
remainingFillableTakerTokenAmount: BigNumber;
filledTakerAssetAmount: BigNumber;
remainingFillableMakerAssetAmount: BigNumber;
remainingFillableTakerAssetAmount: BigNumber;
}

@@ -311,1 +123,89 @@ export interface OrderStateValid {

}
export declare enum SignatureType {
Illegal = 0,
Invalid = 1,
EIP712 = 2,
EthSign = 3,
Caller = 4,
Wallet = 5,
Validator = 6,
PreSigned = 7,
Trezor = 8,
NSignatureTypes = 9,
}
/**
* Elliptic Curve signature
*/
export interface ECSignature {
v: number;
r: string;
s: string;
}
export declare enum AssetProxyId {
ERC20 = "0xf47261b0",
ERC721 = "0x08e937fa",
}
export interface ERC20AssetData {
assetProxyId: string;
tokenAddress: string;
}
export interface ERC721AssetData {
assetProxyId: string;
tokenAddress: string;
tokenId: BigNumber;
receiverData: string;
}
export declare enum RevertReason {
OrderUnfillable = "ORDER_UNFILLABLE",
InvalidMaker = "INVALID_MAKER",
InvalidTaker = "INVALID_TAKER",
InvalidSender = "INVALID_SENDER",
InvalidOrderSignature = "INVALID_ORDER_SIGNATURE",
InvalidTakerAmount = "INVALID_TAKER_AMOUNT",
RoundingError = "ROUNDING_ERROR",
InvalidSignature = "INVALID_SIGNATURE",
SignatureIllegal = "SIGNATURE_ILLEGAL",
SignatureUnsupported = "SIGNATURE_UNSUPPORTED",
InvalidNewOrderEpoch = "INVALID_NEW_ORDER_EPOCH",
CompleteFillFailed = "COMPLETE_FILL_FAILED",
NegativeSpreadRequired = "NEGATIVE_SPREAD_REQUIRED",
ReentrancyIllegal = "REENTRANCY_ILLEGAL",
InvalidTxHash = "INVALID_TX_HASH",
InvalidTxSignature = "INVALID_TX_SIGNATURE",
FailedExecution = "FAILED_EXECUTION",
AssetProxyAlreadyExists = "ASSET_PROXY_ALREADY_EXISTS",
LengthGreaterThan0Required = "LENGTH_GREATER_THAN_0_REQUIRED",
LengthGreaterThan131Required = "LENGTH_GREATER_THAN_131_REQUIRED",
Length0Required = "LENGTH_0_REQUIRED",
Length65Required = "LENGTH_65_REQUIRED",
InvalidAmount = "INVALID_AMOUNT",
TransferFailed = "TRANSFER_FAILED",
SenderNotAuthorized = "SENDER_NOT_AUTHORIZED",
TargetNotAuthorized = "TARGET_NOT_AUTHORIZED",
TargetAlreadyAuthorized = "TARGET_ALREADY_AUTHORIZED",
IndexOutOfBounds = "INDEX_OUT_OF_BOUNDS",
AuthorizedAddressMismatch = "AUTHORIZED_ADDRESS_MISMATCH",
OnlyContractOwner = "ONLY_CONTRACT_OWNER",
MakerNotWhitelisted = "MAKER_NOT_WHITELISTED",
TakerNotWhitelisted = "TAKER_NOT_WHITELISTED",
AssetProxyDoesNotExist = "ASSET_PROXY_DOES_NOT_EXIST",
LibBytesGreaterThanZeroLengthRequired = "GREATER_THAN_ZERO_LENGTH_REQUIRED",
LibBytesGreaterOrEqualTo4LengthRequired = "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED",
LibBytesGreaterOrEqualTo20LengthRequired = "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED",
LibBytesGreaterOrEqualTo32LengthRequired = "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED",
LibBytesGreaterOrEqualToNestedBytesLengthRequired = "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED",
LibBytesGreaterOrEqualToSourceBytesLengthRequired = "GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED",
Erc20InsufficientBalance = "ERC20_INSUFFICIENT_BALANCE",
Erc20InsufficientAllowance = "ERC20_INSUFFICIENT_ALLOWANCE",
UnacceptableThreshold = "UNACCEPTABLE_THRESHOLD",
FeeProportionTooLarge = "FEE_PROPORTION_TOO_LARGE",
ValueGreaterThanZero = "VALUE_GREATER_THAN_ZERO",
InvalidMsgValue = "INVALID_MSG_VALUE",
}
export declare enum StatusCodes {
Success = 200,
NotFound = 404,
InternalError = 500,
MethodNotAllowed = 405,
GatewayTimeout = 504,
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbiType;
(function (AbiType) {
AbiType["Function"] = "function";
AbiType["Constructor"] = "constructor";
AbiType["Event"] = "event";
AbiType["Fallback"] = "fallback";
})(AbiType = exports.AbiType || (exports.AbiType = {}));
var SolidityTypes;
(function (SolidityTypes) {
SolidityTypes["Address"] = "address";
SolidityTypes["Uint256"] = "uint256";
SolidityTypes["Uint8"] = "uint8";
SolidityTypes["Uint"] = "uint";
})(SolidityTypes = exports.SolidityTypes || (exports.SolidityTypes = {}));
// Earliest is omitted by design. It is simply an alias for the `0` constant and
// is thus not very helpful. Moreover, this type is used in places that only accept
// `latest` or `pending`.
var BlockParamLiteral;
(function (BlockParamLiteral) {
BlockParamLiteral["Latest"] = "latest";
BlockParamLiteral["Pending"] = "pending";
})(BlockParamLiteral = exports.BlockParamLiteral || (exports.BlockParamLiteral = {}));
/**

@@ -53,2 +31,76 @@ * Errors originating from the 0x exchange contract

})(ExchangeContractErrs = exports.ExchangeContractErrs || (exports.ExchangeContractErrs = {}));
var SignatureType;
(function (SignatureType) {
SignatureType[SignatureType["Illegal"] = 0] = "Illegal";
SignatureType[SignatureType["Invalid"] = 1] = "Invalid";
SignatureType[SignatureType["EIP712"] = 2] = "EIP712";
SignatureType[SignatureType["EthSign"] = 3] = "EthSign";
SignatureType[SignatureType["Caller"] = 4] = "Caller";
SignatureType[SignatureType["Wallet"] = 5] = "Wallet";
SignatureType[SignatureType["Validator"] = 6] = "Validator";
SignatureType[SignatureType["PreSigned"] = 7] = "PreSigned";
SignatureType[SignatureType["Trezor"] = 8] = "Trezor";
SignatureType[SignatureType["NSignatureTypes"] = 9] = "NSignatureTypes";
})(SignatureType = exports.SignatureType || (exports.SignatureType = {}));
var AssetProxyId;
(function (AssetProxyId) {
AssetProxyId["ERC20"] = "0xf47261b0";
AssetProxyId["ERC721"] = "0x08e937fa";
})(AssetProxyId = exports.AssetProxyId || (exports.AssetProxyId = {}));
var RevertReason;
(function (RevertReason) {
RevertReason["OrderUnfillable"] = "ORDER_UNFILLABLE";
RevertReason["InvalidMaker"] = "INVALID_MAKER";
RevertReason["InvalidTaker"] = "INVALID_TAKER";
RevertReason["InvalidSender"] = "INVALID_SENDER";
RevertReason["InvalidOrderSignature"] = "INVALID_ORDER_SIGNATURE";
RevertReason["InvalidTakerAmount"] = "INVALID_TAKER_AMOUNT";
RevertReason["RoundingError"] = "ROUNDING_ERROR";
RevertReason["InvalidSignature"] = "INVALID_SIGNATURE";
RevertReason["SignatureIllegal"] = "SIGNATURE_ILLEGAL";
RevertReason["SignatureUnsupported"] = "SIGNATURE_UNSUPPORTED";
RevertReason["InvalidNewOrderEpoch"] = "INVALID_NEW_ORDER_EPOCH";
RevertReason["CompleteFillFailed"] = "COMPLETE_FILL_FAILED";
RevertReason["NegativeSpreadRequired"] = "NEGATIVE_SPREAD_REQUIRED";
RevertReason["ReentrancyIllegal"] = "REENTRANCY_ILLEGAL";
RevertReason["InvalidTxHash"] = "INVALID_TX_HASH";
RevertReason["InvalidTxSignature"] = "INVALID_TX_SIGNATURE";
RevertReason["FailedExecution"] = "FAILED_EXECUTION";
RevertReason["AssetProxyAlreadyExists"] = "ASSET_PROXY_ALREADY_EXISTS";
RevertReason["LengthGreaterThan0Required"] = "LENGTH_GREATER_THAN_0_REQUIRED";
RevertReason["LengthGreaterThan131Required"] = "LENGTH_GREATER_THAN_131_REQUIRED";
RevertReason["Length0Required"] = "LENGTH_0_REQUIRED";
RevertReason["Length65Required"] = "LENGTH_65_REQUIRED";
RevertReason["InvalidAmount"] = "INVALID_AMOUNT";
RevertReason["TransferFailed"] = "TRANSFER_FAILED";
RevertReason["SenderNotAuthorized"] = "SENDER_NOT_AUTHORIZED";
RevertReason["TargetNotAuthorized"] = "TARGET_NOT_AUTHORIZED";
RevertReason["TargetAlreadyAuthorized"] = "TARGET_ALREADY_AUTHORIZED";
RevertReason["IndexOutOfBounds"] = "INDEX_OUT_OF_BOUNDS";
RevertReason["AuthorizedAddressMismatch"] = "AUTHORIZED_ADDRESS_MISMATCH";
RevertReason["OnlyContractOwner"] = "ONLY_CONTRACT_OWNER";
RevertReason["MakerNotWhitelisted"] = "MAKER_NOT_WHITELISTED";
RevertReason["TakerNotWhitelisted"] = "TAKER_NOT_WHITELISTED";
RevertReason["AssetProxyDoesNotExist"] = "ASSET_PROXY_DOES_NOT_EXIST";
RevertReason["LibBytesGreaterThanZeroLengthRequired"] = "GREATER_THAN_ZERO_LENGTH_REQUIRED";
RevertReason["LibBytesGreaterOrEqualTo4LengthRequired"] = "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED";
RevertReason["LibBytesGreaterOrEqualTo20LengthRequired"] = "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED";
RevertReason["LibBytesGreaterOrEqualTo32LengthRequired"] = "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED";
RevertReason["LibBytesGreaterOrEqualToNestedBytesLengthRequired"] = "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED";
RevertReason["LibBytesGreaterOrEqualToSourceBytesLengthRequired"] = "GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED";
RevertReason["Erc20InsufficientBalance"] = "ERC20_INSUFFICIENT_BALANCE";
RevertReason["Erc20InsufficientAllowance"] = "ERC20_INSUFFICIENT_ALLOWANCE";
RevertReason["UnacceptableThreshold"] = "UNACCEPTABLE_THRESHOLD";
RevertReason["FeeProportionTooLarge"] = "FEE_PROPORTION_TOO_LARGE";
RevertReason["ValueGreaterThanZero"] = "VALUE_GREATER_THAN_ZERO";
RevertReason["InvalidMsgValue"] = "INVALID_MSG_VALUE";
})(RevertReason = exports.RevertReason || (exports.RevertReason = {}));
var StatusCodes;
(function (StatusCodes) {
StatusCodes[StatusCodes["Success"] = 200] = "Success";
StatusCodes[StatusCodes["NotFound"] = 404] = "NotFound";
StatusCodes[StatusCodes["InternalError"] = 500] = "InternalError";
StatusCodes[StatusCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
StatusCodes[StatusCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
})(StatusCodes = exports.StatusCodes || (exports.StatusCodes = {}));
//# sourceMappingURL=index.js.map
{
"name": "@0xproject/types",
"version": "0.8.2",
"version": "1.0.0-rc.1",
"engines": {

@@ -11,3 +11,3 @@ "node": ">=6.12"

"scripts": {
"watch": "tsc -w",
"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",

@@ -28,13 +28,14 @@ "clean": "shx rm -rf lib scripts",

"devDependencies": {
"@0xproject/monorepo-scripts": "^0.2.2",
"@0xproject/tslint-config": "^0.4.21",
"copyfiles": "1.2.0",
"make-promises-safe": "1.1.0",
"shx": "0.2.2",
"tslint": "5.8.0",
"@0xproject/monorepo-script": "^1.0.0",
"@0xproject/tslint-config": "^1.0.0",
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
"@types/node": "9.6.0",
"bignumber.js": "~4.1.0"
"@types/node": "^8.0.53",
"bignumber.js": "~4.1.0",
"ethereum-types": "^1.0.0"
},

@@ -41,0 +42,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc