mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Merge branch 'master' into feature/compute_service
This commit is contained in:
commit
2040498e6b
@ -4,11 +4,11 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [v2.0.0](https://github.com/oceanprotocol/squid-js/compare/2.0.0-beta.4...v2.0.0)
|
||||
#### [v2.0.0-beta.5](https://github.com/oceanprotocol/squid-js/compare/2.0.0-beta.4...v2.0.0-beta.5)
|
||||
|
||||
> 9 March 2020
|
||||
> 10 March 2020
|
||||
|
||||
- Release 2.0.0 [`5a5e00f`](https://github.com/oceanprotocol/squid-js/commit/5a5e00f6c671d68153ad94704535253027142ff3)
|
||||
- Update the compute condition name in ddo jason definition. [`#380`](https://github.com/oceanprotocol/squid-js/pull/380)
|
||||
|
||||
#### [2.0.0-beta.4](https://github.com/oceanprotocol/squid-js/compare/v2.0.0-beta.3...2.0.0-beta.4)
|
||||
|
||||
|
2568
package-lock.json
generated
2568
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@oceanprotocol/squid",
|
||||
"version": "2.0.0-beta.4",
|
||||
"version": "2.0.0-beta.5",
|
||||
"description": "JavaScript client library for Ocean Protocol",
|
||||
"main": "./dist/node/squid.js",
|
||||
"typings": "./dist/node/squid.d.ts",
|
||||
@ -58,43 +58,43 @@
|
||||
"deprecated-decorator": "^0.1.6",
|
||||
"node-fetch": "^2.6.0",
|
||||
"save-file": "^2.3.1",
|
||||
"uuid": "^3.4.0",
|
||||
"web3": "^1.2.5",
|
||||
"uuid": "^7.0.2",
|
||||
"web3": "^1.2.6",
|
||||
"whatwg-url": "^8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@release-it/bumper": "^1.0.5",
|
||||
"@truffle/hdwallet-provider": "^1.0.29",
|
||||
"@types/chai": "^4.2.8",
|
||||
"@release-it/bumper": "^1.1.0",
|
||||
"@truffle/hdwallet-provider": "^1.0.33",
|
||||
"@types/chai": "^4.2.11",
|
||||
"@types/chai-spies": "^1.0.1",
|
||||
"@types/mocha": "^7.0.1",
|
||||
"@types/node": "^13.5.1",
|
||||
"@types/node-fetch": "^2.5.4",
|
||||
"@types/sinon": "^7.5.1",
|
||||
"@typescript-eslint/eslint-plugin": "^2.18.0",
|
||||
"@typescript-eslint/parser": "^2.18.0",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^13.9.1",
|
||||
"@types/node-fetch": "^2.5.5",
|
||||
"@types/sinon": "^7.5.2",
|
||||
"@typescript-eslint/eslint-plugin": "^2.23.0",
|
||||
"@typescript-eslint/parser": "^2.23.0",
|
||||
"auto-changelog": "^1.16.2",
|
||||
"chai": "^4.2.0",
|
||||
"chai-spies": "^1.0.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-oceanprotocol": "^1.5.0",
|
||||
"eslint-config-prettier": "^6.10.0",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"lcov-result-merger": "^3.1.0",
|
||||
"mocha": "^7.0.1",
|
||||
"mocha": "^7.1.0",
|
||||
"mock-local-storage": "^1.1.11",
|
||||
"nyc": "^15.0.0",
|
||||
"ora": "^4.0.2",
|
||||
"prettier": "^1.19.1",
|
||||
"sinon": "^8.1.1",
|
||||
"sinon": "^9.0.1",
|
||||
"source-map-support": "^0.5.16",
|
||||
"ts-node": "^8.6.2",
|
||||
"typedoc": "^0.16.9",
|
||||
"typescript": "^3.7.5",
|
||||
"typedoc": "^0.16.11",
|
||||
"typescript": "^3.8.3",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-cli": "^3.3.10",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-merge": "^4.2.2"
|
||||
},
|
||||
"nyc": {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { File, MetaData } from '../ddo/MetaData'
|
||||
import { File, MetaDataAlgorithm } from '../ddo/MetaData'
|
||||
import Account from '../ocean/Account'
|
||||
import { noZeroX } from '../utils'
|
||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||
@ -115,7 +115,7 @@ export class Brizo extends Instantiable {
|
||||
serviceAgreementId: string,
|
||||
consumerAccount: Account,
|
||||
algorithmDid?: string,
|
||||
algorithmMeta?: MetaData,
|
||||
algorithmMeta?: MetaDataAlgorithm,
|
||||
jobId?: string,
|
||||
output?: Output
|
||||
): Promise<ComputeJob | ComputeJob[]> {
|
||||
@ -138,7 +138,7 @@ export class Brizo extends Instantiable {
|
||||
url += `&consumerAddress=${address}`
|
||||
url += `&serviceAgreementId=${noZeroX(serviceAgreementId)}`
|
||||
url += (algorithmDid && `&algorithmDid=${algorithmDid}`) || ''
|
||||
url += (algorithmMeta && `&algorithmMeta=${algorithmMeta}`) || ''
|
||||
url += (algorithmMeta && `&algorithmMeta=${JSON.stringify(algorithmMeta)}`) || ''
|
||||
url += (output && `&output=${JSON.stringify(output)}`) || ''
|
||||
url += (jobId && `&jobId=${jobId}`) || ''
|
||||
|
||||
|
@ -64,6 +64,8 @@ export interface File {
|
||||
}
|
||||
|
||||
export interface MetaDataAlgorithm {
|
||||
url?: string
|
||||
rawcode?: string
|
||||
language?: string
|
||||
format?: string
|
||||
version?: string
|
||||
|
@ -20,7 +20,7 @@ export const escrowComputeServiceAgreementTemplate: ServiceAgreementTemplate = {
|
||||
],
|
||||
conditionDependency: {
|
||||
lockReward: [],
|
||||
serviceExecution: [],
|
||||
computeExecution: [],
|
||||
escrowReward: ['lockReward', 'computeExecution']
|
||||
},
|
||||
conditions: [
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||
import { MetaData } from '../ddo/MetaData'
|
||||
import { MetaData, MetaDataAlgorithm } from '../ddo/MetaData'
|
||||
import Account from './Account'
|
||||
import { DDO } from '../ddo/DDO'
|
||||
import { SubscribablePromise } from '../utils'
|
||||
@ -133,7 +133,7 @@ export class OceanCompute extends Instantiable {
|
||||
consumerAccount: Account,
|
||||
agreementId: string,
|
||||
algorithmDid?: string,
|
||||
algorithmMeta?: MetaData,
|
||||
algorithmMeta?: MetaDataAlgorithm,
|
||||
output?: Output
|
||||
): Promise<ComputeJob> {
|
||||
output = this.checkOutput(consumerAccount, output)
|
||||
|
@ -94,9 +94,28 @@ describe('Compute', () => {
|
||||
} catch {}
|
||||
})
|
||||
|
||||
it('should start a compute job', async () => {
|
||||
it('should start a compute job with a published algo', async () => {
|
||||
const response = await ocean.compute.start(account, agreementId, algorithm.id)
|
||||
|
||||
assert.equal(response.status, ComputeJobStatus.Started)
|
||||
})
|
||||
|
||||
it('should start a compute job with a rawcode algo', async () => {
|
||||
const algoMeta: MetaDataAlgorithm = {
|
||||
rawcode: `console.log('Hello world!')`,
|
||||
container: {
|
||||
entrypoint: 'node $ALGO',
|
||||
image: 'node',
|
||||
tag: '10'
|
||||
}
|
||||
}
|
||||
const response = await ocean.compute.start(
|
||||
account,
|
||||
agreementId,
|
||||
undefined,
|
||||
algoMeta
|
||||
)
|
||||
|
||||
assert.equal(response.status, ComputeJobStatus.Started)
|
||||
})
|
||||
})
|
||||
|
@ -138,7 +138,7 @@
|
||||
"actorType": "consumer",
|
||||
"handler": {
|
||||
"moduleName": "accessSecretStore",
|
||||
"functionName": "fulfillEscrowRewardCondition",
|
||||
"functionName": "refundReward",
|
||||
"version": "0.1"
|
||||
}
|
||||
}
|
||||
@ -255,10 +255,10 @@
|
||||
"contractName": "EscrowComputeExecutionTemplate",
|
||||
"events": [
|
||||
{
|
||||
"name": "AgreementCreated",
|
||||
"actorType": "consumer",
|
||||
"name": "AgreementActorAdded",
|
||||
"actorType": "provider",
|
||||
"handler": {
|
||||
"moduleName": "serviceExecutionTemplate",
|
||||
"moduleName": "",
|
||||
"functionName": "fulfillLockRewardCondition",
|
||||
"version": "0.1"
|
||||
}
|
||||
@ -266,13 +266,13 @@
|
||||
],
|
||||
"fulfillmentOrder": [
|
||||
"lockReward.fulfill",
|
||||
"serviceExecution.fulfill",
|
||||
"computeExecution.fulfill",
|
||||
"escrowReward.fulfill"
|
||||
],
|
||||
"conditionDependency": {
|
||||
"lockReward": [],
|
||||
"serviceExecution": [],
|
||||
"releaseReward": ["lockReward", "serviceExecution"]
|
||||
"computeExecution": [],
|
||||
"releaseReward": ["lockReward", "computeExecution"]
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
@ -296,17 +296,17 @@
|
||||
"events": [
|
||||
{
|
||||
"name": "Fulfilled",
|
||||
"actorType": "publisher",
|
||||
"actorType": "provider",
|
||||
"handler": {
|
||||
"moduleName": "lockRewardCondition",
|
||||
"functionName": "fulfillServiceExecutionCondition",
|
||||
"moduleName": "lockRewardExecutionCondition",
|
||||
"functionName": "fulfillComputeExecutionCondition",
|
||||
"version": "0.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "serviceExecution",
|
||||
"name": "computeExecution",
|
||||
"timelock": 0,
|
||||
"timeout": 0,
|
||||
"contractName": "ComputeExecutionCondition",
|
||||
@ -326,10 +326,10 @@
|
||||
"events": [
|
||||
{
|
||||
"name": "Fulfilled",
|
||||
"actorType": "publisher",
|
||||
"actorType": "provider",
|
||||
"handler": {
|
||||
"moduleName": "serviceExecution",
|
||||
"functionName": "fulfillServiceExecutionCondition",
|
||||
"moduleName": "accessSecretStore",
|
||||
"functionName": "fulfillEscrowRewardCondition",
|
||||
"version": "0.1"
|
||||
}
|
||||
},
|
||||
@ -337,8 +337,8 @@
|
||||
"name": "TimedOut",
|
||||
"actorType": "consumer",
|
||||
"handler": {
|
||||
"moduleName": "serviceExec",
|
||||
"functionName": "fulfillServiceExecutionCondition",
|
||||
"moduleName": "accessSecretStore",
|
||||
"functionName": "refundReward",
|
||||
"version": "0.1"
|
||||
}
|
||||
}
|
||||
@ -380,7 +380,7 @@
|
||||
"events": [
|
||||
{
|
||||
"name": "Fulfilled",
|
||||
"actorType": "publisher",
|
||||
"actorType": "provider",
|
||||
"handler": {
|
||||
"moduleName": "escrowRewardCondition",
|
||||
"functionName": "verifyRewardTokens",
|
||||
|
@ -7,6 +7,13 @@ import config from '../config'
|
||||
interface ContractTest extends Contract {
|
||||
testContract?: boolean
|
||||
$initialized?: boolean
|
||||
options?: {
|
||||
address: string
|
||||
}
|
||||
methods?: {
|
||||
addMinter(address: string): any
|
||||
initialize(...args: any[]): any
|
||||
}
|
||||
}
|
||||
|
||||
export default class TestContractHandler extends ContractHandler {
|
||||
|
Loading…
Reference in New Issue
Block a user