You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@oasisdex/automation

Package Overview
Dependencies
Maintainers
7
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oasisdex/automation - npm Package Compare versions

Comparing version

to
1.1.2

1

lib/src/index.d.ts
export { decodeTriggerData, decodeTriggerDataByType, encodeTriggerData, encodeTriggerDataByType, } from './abi-coding';
export { getCommandAddresses } from './mapping';
export { CommandContractType, TriggerType } from './types';
//# sourceMappingURL=index.d.ts.map

4

lib/src/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TriggerType = exports.CommandContractType = exports.encodeTriggerDataByType = exports.encodeTriggerData = exports.decodeTriggerDataByType = exports.decodeTriggerData = void 0;
exports.TriggerType = exports.CommandContractType = exports.getCommandAddresses = exports.encodeTriggerDataByType = exports.encodeTriggerData = exports.decodeTriggerDataByType = exports.decodeTriggerData = void 0;
var abi_coding_1 = require("./abi-coding");

@@ -9,2 +9,4 @@ Object.defineProperty(exports, "decodeTriggerData", { enumerable: true, get: function () { return abi_coding_1.decodeTriggerData; } });

Object.defineProperty(exports, "encodeTriggerDataByType", { enumerable: true, get: function () { return abi_coding_1.encodeTriggerDataByType; } });
var mapping_1 = require("./mapping");
Object.defineProperty(exports, "getCommandAddresses", { enumerable: true, get: function () { return mapping_1.getCommandAddresses; } });
var types_1 = require("./types");

@@ -11,0 +13,0 @@ Object.defineProperty(exports, "CommandContractType", { enumerable: true, get: function () { return types_1.CommandContractType; } });

@@ -8,2 +8,3 @@ import { CommandContractInfo, CommandContractType, ParamDefinition } from './types';

};
export declare function getCommandAddresses(network: number): Record<CommandContractType, string[]>;
export declare function getDefinitionForCommandType(type: CommandContractType): ParamDefinition;

@@ -10,0 +11,0 @@ export declare function getDefinitionForCommandAddress(address: string, network: number): ParamDefinition;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCommandContractInfo = exports.getDefinitionForCommandAddress = exports.getDefinitionForCommandType = exports.defaultCommandTypeMapping = exports.commandAddressMapping = void 0;
exports.getCommandContractInfo = exports.getDefinitionForCommandAddress = exports.getDefinitionForCommandType = exports.getCommandAddresses = exports.defaultCommandTypeMapping = exports.commandAddressMapping = void 0;
const types_1 = require("./types");

@@ -10,5 +10,11 @@ // The addresses must be in lowercase!

'0x31285a87fb70a62b5aaa43199e53221c197e1e3f': { type: types_1.CommandContractType.CloseCommand },
'0x7c86781a95b7e55e6c2f7297ae6773e1dbceab13': { type: types_1.CommandContractType.BasicBuyCommand },
'0x7c86781a95b7e55e6c2f7297ae6773e1dbceab13': {
type: types_1.CommandContractType.BasicBuyCommand,
overwrite: ['uint256', 'uint16', 'uint256', 'uint256', 'uint256', 'bool', 'uint64'],
},
'0xe3ae7218d8e4a482e212ef1cbf2fcd0fb9882cc7': { type: types_1.CommandContractType.BasicBuyCommand },
'0xd4f94e013c7f47b989ea79c6527e065c027794c7': { type: types_1.CommandContractType.BasicSellCommand },
'0xd4f94e013c7f47b989ea79c6527e065c027794c7': {
type: types_1.CommandContractType.BasicSellCommand,
overwrite: ['uint256', 'uint16', 'uint256', 'uint256', 'uint256', 'bool', 'uint64'],
},
'0x6f878d8eb84e48da49900a6392b8f9ed262a50d7': { type: types_1.CommandContractType.BasicSellCommand },

@@ -43,2 +49,10 @@ },

};
function getCommandAddresses(network) {
if (!(network in exports.commandAddressMapping)) {
throw new Error(`Command addresses for network ${network} not found. Supported networks: ${Object.keys(exports.commandAddressMapping).join(', ')}.`);
}
const mappingForNetwork = exports.commandAddressMapping[network];
return Object.entries(mappingForNetwork).reduce((agg, [address, { type }]) => (Object.assign(Object.assign({}, agg), { [type]: (agg[type] || []).concat([address]) })), {});
}
exports.getCommandAddresses = getCommandAddresses;
function getDefinitionForCommandType(type) {

@@ -59,6 +73,6 @@ if (!(type in exports.defaultCommandTypeMapping)) {

if (!(network in exports.commandAddressMapping)) {
throw new Error(`Command addresses for network ${network} not found. Supported networks: ${Object.keys(exports.commandAddressMapping).join('; ')}.`);
throw new Error(`Command addresses for network ${network} not found. Supported networks: ${Object.keys(exports.commandAddressMapping).join(', ')}.`);
}
const mappingForNetwork = exports.commandAddressMapping[network];
const lowercaseAddress = address.toLowerCase();
const mappingForNetwork = exports.commandAddressMapping[network];
if (!(lowercaseAddress in mappingForNetwork)) {

@@ -65,0 +79,0 @@ throw new Error(`Command address ${lowercaseAddress} for network ${network} not found. Supported Addresses: ${JSON.stringify(mappingForNetwork)}`);

{
"name": "@oasisdex/automation",
"version": "1.1.1",
"version": "1.1.2",
"description": "The set of utilities for Oasis automation",

@@ -27,3 +27,3 @@ "homepage": "https://github.com/OasisDEX/common#readme",

},
"gitHead": "b59d12307bcef3b1bb9629d1dd72f6f325a9f669"
"gitHead": "1d58fbed25af34c6ba562cf6a139eb29daf9589a"
}

@@ -7,3 +7,4 @@ export {

} from './abi-coding';
export { getCommandAddresses } from './mapping';
export { CommandContractType, TriggerType } from './types';

@@ -13,5 +13,11 @@ import {

'0x31285a87fb70a62b5aaa43199e53221c197e1e3f': { type: CommandContractType.CloseCommand },
'0x7c86781a95b7e55e6c2f7297ae6773e1dbceab13': { type: CommandContractType.BasicBuyCommand },
'0x7c86781a95b7e55e6c2f7297ae6773e1dbceab13': {
type: CommandContractType.BasicBuyCommand,
overwrite: ['uint256', 'uint16', 'uint256', 'uint256', 'uint256', 'bool', 'uint64'],
},
'0xe3ae7218d8e4a482e212ef1cbf2fcd0fb9882cc7': { type: CommandContractType.BasicBuyCommand },
'0xd4f94e013c7f47b989ea79c6527e065c027794c7': { type: CommandContractType.BasicSellCommand },
'0xd4f94e013c7f47b989ea79c6527e065c027794c7': {
type: CommandContractType.BasicSellCommand,
overwrite: ['uint256', 'uint16', 'uint256', 'uint256', 'uint256', 'bool', 'uint64'],
},
'0x6f878d8eb84e48da49900a6392b8f9ed262a50d7': { type: CommandContractType.BasicSellCommand },

@@ -48,2 +54,18 @@ },

export function getCommandAddresses(network: number): Record<CommandContractType, string[]> {
if (!(network in commandAddressMapping)) {
throw new Error(
`Command addresses for network ${network} not found. Supported networks: ${Object.keys(
commandAddressMapping,
).join(', ')}.`,
);
}
const mappingForNetwork = commandAddressMapping[network as EthereumNetwork];
return Object.entries(mappingForNetwork).reduce(
(agg, [address, { type }]) => ({ ...agg, [type]: (agg[type] || []).concat([address]) }),
{} as Record<CommandContractType, string[]>,
);
}
export function getDefinitionForCommandType(type: CommandContractType): ParamDefinition {

@@ -71,8 +93,8 @@ if (!(type in defaultCommandTypeMapping)) {

commandAddressMapping,
).join('; ')}.`,
).join(', ')}.`,
);
}
const mappingForNetwork = commandAddressMapping[network as EthereumNetwork];
const lowercaseAddress = address.toLowerCase();
const mappingForNetwork = commandAddressMapping[network as EthereumNetwork];
if (!(lowercaseAddress in mappingForNetwork)) {

@@ -79,0 +101,0 @@ throw new Error(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet