From f14ca2b0a51d649d4be10118e537e080d9376ff7 Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 21 Nov 2018 15:26:46 +0100 Subject: [PATCH] pass tslint --- package-lock.json | 6 +++++ src/ocean/Ocean.ts | 64 +++++++++++++++++++++++----------------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index 87d6d67..b89c419 100644 --- a/package-lock.json +++ b/package-lock.json @@ -130,6 +130,12 @@ "integrity": "sha512-qQMIZNwEgL6W93e3ryUVELgRxDO1WzaN7Dj2Kvhjkk/miwXmZXRFyf2p3fh0UESKwHiFGK6re3YA55fO43Dvnw==", "requires": { "node-fetch": "^2.3.0" + }, + "dependencies": { + "node-fetch": { + "version": "2.3.0", + "bundled": true + } } }, "@types/bn.js": { diff --git a/src/ocean/Ocean.ts b/src/ocean/Ocean.ts index cf2780a..d02a52d 100644 --- a/src/ocean/Ocean.ts +++ b/src/ocean/Ocean.ts @@ -93,44 +93,44 @@ export default class Ocean { } as Event, ] - const mapParameterValueToName = (name) => { + const mapParameterValueToName = (name) => { - switch (name) { - case "price": - return metadata.base.price - case "assetId": - return "0x" + id - case "documentKeyId": - return "0x1234" + switch (name) { + case "price": + return metadata.base.price + case "assetId": + return "0x" + id + case "documentKeyId": + return "0x1234" + } + + return null } - return null - } + const parameters: Parameter[] = condition.methodReflection.inputs.map((input: InputType) => { + return { + name: input.name, + type: input.type, + value: mapParameterValueToName(input.name), + } as Parameter + }) + + // Logger.log(`${condition.methodReflection.contractName}.${condition.methodReflection.methodName}`, + // JSON.stringify(parameters, null, 2)) - const parameters: Parameter[] = condition.methodReflection.inputs.map((input: InputType) => { return { - name: input.name, - type: input.type, - value: mapParameterValueToName(input.name), - } as Parameter + contractName: condition.methodReflection.contractName, + methodName: condition.methodReflection.methodName, + timeout: condition.timeout, + index, + conditionKey: condition.condtionKey, + parameters, + events, + dependencies: condition.dependencies, + dependencyTimeoutFlags: condition.dependencyTimeoutFlags, + isTerminalCondition: condition.isTerminalCondition, + } as DDOCondition }) - - // Logger.log(`${condition.methodReflection.contractName}.${condition.methodReflection.methodName}`, - // JSON.stringify(parameters, null, 2)) - - return { - contractName: condition.methodReflection.contractName, - methodName: condition.methodReflection.methodName, - timeout: condition.timeout, - index, - conditionKey: condition.condtionKey, - parameters, - events, - dependencies: condition.dependencies, - dependencyTimeoutFlags: condition.dependencyTimeoutFlags, - isTerminalCondition: condition.isTerminalCondition, - } as DDOCondition - }) const serviceEndpoint = aquarius.getServiceEndpoint(did) // create ddo itself