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).
|
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)
|
#### [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",
|
"name": "@oceanprotocol/squid",
|
||||||
"version": "2.0.0-beta.4",
|
"version": "2.0.0-beta.5",
|
||||||
"description": "JavaScript client library for Ocean Protocol",
|
"description": "JavaScript client library for Ocean Protocol",
|
||||||
"main": "./dist/node/squid.js",
|
"main": "./dist/node/squid.js",
|
||||||
"typings": "./dist/node/squid.d.ts",
|
"typings": "./dist/node/squid.d.ts",
|
||||||
@ -58,43 +58,43 @@
|
|||||||
"deprecated-decorator": "^0.1.6",
|
"deprecated-decorator": "^0.1.6",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "^2.6.0",
|
||||||
"save-file": "^2.3.1",
|
"save-file": "^2.3.1",
|
||||||
"uuid": "^3.4.0",
|
"uuid": "^7.0.2",
|
||||||
"web3": "^1.2.5",
|
"web3": "^1.2.6",
|
||||||
"whatwg-url": "^8.0.0"
|
"whatwg-url": "^8.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@release-it/bumper": "^1.0.5",
|
"@release-it/bumper": "^1.1.0",
|
||||||
"@truffle/hdwallet-provider": "^1.0.29",
|
"@truffle/hdwallet-provider": "^1.0.33",
|
||||||
"@types/chai": "^4.2.8",
|
"@types/chai": "^4.2.11",
|
||||||
"@types/chai-spies": "^1.0.1",
|
"@types/chai-spies": "^1.0.1",
|
||||||
"@types/mocha": "^7.0.1",
|
"@types/mocha": "^7.0.2",
|
||||||
"@types/node": "^13.5.1",
|
"@types/node": "^13.9.1",
|
||||||
"@types/node-fetch": "^2.5.4",
|
"@types/node-fetch": "^2.5.5",
|
||||||
"@types/sinon": "^7.5.1",
|
"@types/sinon": "^7.5.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.18.0",
|
"@typescript-eslint/eslint-plugin": "^2.23.0",
|
||||||
"@typescript-eslint/parser": "^2.18.0",
|
"@typescript-eslint/parser": "^2.23.0",
|
||||||
"auto-changelog": "^1.16.2",
|
"auto-changelog": "^1.16.2",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"chai-spies": "^1.0.0",
|
"chai-spies": "^1.0.0",
|
||||||
"cross-env": "^7.0.0",
|
"cross-env": "^7.0.2",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-oceanprotocol": "^1.5.0",
|
"eslint-config-oceanprotocol": "^1.5.0",
|
||||||
"eslint-config-prettier": "^6.10.0",
|
"eslint-config-prettier": "^6.10.0",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"lcov-result-merger": "^3.1.0",
|
"lcov-result-merger": "^3.1.0",
|
||||||
"mocha": "^7.0.1",
|
"mocha": "^7.1.0",
|
||||||
"mock-local-storage": "^1.1.11",
|
"mock-local-storage": "^1.1.11",
|
||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
"ora": "^4.0.2",
|
"ora": "^4.0.2",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"sinon": "^8.1.1",
|
"sinon": "^9.0.1",
|
||||||
"source-map-support": "^0.5.16",
|
"source-map-support": "^0.5.16",
|
||||||
"ts-node": "^8.6.2",
|
"ts-node": "^8.6.2",
|
||||||
"typedoc": "^0.16.9",
|
"typedoc": "^0.16.11",
|
||||||
"typescript": "^3.7.5",
|
"typescript": "^3.8.3",
|
||||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||||
"webpack": "^4.41.5",
|
"webpack": "^4.42.0",
|
||||||
"webpack-cli": "^3.3.10",
|
"webpack-cli": "^3.3.11",
|
||||||
"webpack-merge": "^4.2.2"
|
"webpack-merge": "^4.2.2"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { File, MetaData } from '../ddo/MetaData'
|
import { File, MetaDataAlgorithm } from '../ddo/MetaData'
|
||||||
import Account from '../ocean/Account'
|
import Account from '../ocean/Account'
|
||||||
import { noZeroX } from '../utils'
|
import { noZeroX } from '../utils'
|
||||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||||
@ -115,7 +115,7 @@ export class Brizo extends Instantiable {
|
|||||||
serviceAgreementId: string,
|
serviceAgreementId: string,
|
||||||
consumerAccount: Account,
|
consumerAccount: Account,
|
||||||
algorithmDid?: string,
|
algorithmDid?: string,
|
||||||
algorithmMeta?: MetaData,
|
algorithmMeta?: MetaDataAlgorithm,
|
||||||
jobId?: string,
|
jobId?: string,
|
||||||
output?: Output
|
output?: Output
|
||||||
): Promise<ComputeJob | ComputeJob[]> {
|
): Promise<ComputeJob | ComputeJob[]> {
|
||||||
@ -138,7 +138,7 @@ export class Brizo extends Instantiable {
|
|||||||
url += `&consumerAddress=${address}`
|
url += `&consumerAddress=${address}`
|
||||||
url += `&serviceAgreementId=${noZeroX(serviceAgreementId)}`
|
url += `&serviceAgreementId=${noZeroX(serviceAgreementId)}`
|
||||||
url += (algorithmDid && `&algorithmDid=${algorithmDid}`) || ''
|
url += (algorithmDid && `&algorithmDid=${algorithmDid}`) || ''
|
||||||
url += (algorithmMeta && `&algorithmMeta=${algorithmMeta}`) || ''
|
url += (algorithmMeta && `&algorithmMeta=${JSON.stringify(algorithmMeta)}`) || ''
|
||||||
url += (output && `&output=${JSON.stringify(output)}`) || ''
|
url += (output && `&output=${JSON.stringify(output)}`) || ''
|
||||||
url += (jobId && `&jobId=${jobId}`) || ''
|
url += (jobId && `&jobId=${jobId}`) || ''
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ export interface File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MetaDataAlgorithm {
|
export interface MetaDataAlgorithm {
|
||||||
|
url?: string
|
||||||
|
rawcode?: string
|
||||||
language?: string
|
language?: string
|
||||||
format?: string
|
format?: string
|
||||||
version?: string
|
version?: string
|
||||||
|
@ -20,7 +20,7 @@ export const escrowComputeServiceAgreementTemplate: ServiceAgreementTemplate = {
|
|||||||
],
|
],
|
||||||
conditionDependency: {
|
conditionDependency: {
|
||||||
lockReward: [],
|
lockReward: [],
|
||||||
serviceExecution: [],
|
computeExecution: [],
|
||||||
escrowReward: ['lockReward', 'computeExecution']
|
escrowReward: ['lockReward', 'computeExecution']
|
||||||
},
|
},
|
||||||
conditions: [
|
conditions: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||||
import { MetaData } from '../ddo/MetaData'
|
import { MetaData, MetaDataAlgorithm } from '../ddo/MetaData'
|
||||||
import Account from './Account'
|
import Account from './Account'
|
||||||
import { DDO } from '../ddo/DDO'
|
import { DDO } from '../ddo/DDO'
|
||||||
import { SubscribablePromise } from '../utils'
|
import { SubscribablePromise } from '../utils'
|
||||||
@ -133,7 +133,7 @@ export class OceanCompute extends Instantiable {
|
|||||||
consumerAccount: Account,
|
consumerAccount: Account,
|
||||||
agreementId: string,
|
agreementId: string,
|
||||||
algorithmDid?: string,
|
algorithmDid?: string,
|
||||||
algorithmMeta?: MetaData,
|
algorithmMeta?: MetaDataAlgorithm,
|
||||||
output?: Output
|
output?: Output
|
||||||
): Promise<ComputeJob> {
|
): Promise<ComputeJob> {
|
||||||
output = this.checkOutput(consumerAccount, output)
|
output = this.checkOutput(consumerAccount, output)
|
||||||
|
@ -94,9 +94,28 @@ describe('Compute', () => {
|
|||||||
} catch {}
|
} 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)
|
const response = await ocean.compute.start(account, agreementId, algorithm.id)
|
||||||
|
|
||||||
assert.equal(response.status, ComputeJobStatus.Started)
|
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",
|
"actorType": "consumer",
|
||||||
"handler": {
|
"handler": {
|
||||||
"moduleName": "accessSecretStore",
|
"moduleName": "accessSecretStore",
|
||||||
"functionName": "fulfillEscrowRewardCondition",
|
"functionName": "refundReward",
|
||||||
"version": "0.1"
|
"version": "0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,10 +255,10 @@
|
|||||||
"contractName": "EscrowComputeExecutionTemplate",
|
"contractName": "EscrowComputeExecutionTemplate",
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"name": "AgreementCreated",
|
"name": "AgreementActorAdded",
|
||||||
"actorType": "consumer",
|
"actorType": "provider",
|
||||||
"handler": {
|
"handler": {
|
||||||
"moduleName": "serviceExecutionTemplate",
|
"moduleName": "",
|
||||||
"functionName": "fulfillLockRewardCondition",
|
"functionName": "fulfillLockRewardCondition",
|
||||||
"version": "0.1"
|
"version": "0.1"
|
||||||
}
|
}
|
||||||
@ -266,13 +266,13 @@
|
|||||||
],
|
],
|
||||||
"fulfillmentOrder": [
|
"fulfillmentOrder": [
|
||||||
"lockReward.fulfill",
|
"lockReward.fulfill",
|
||||||
"serviceExecution.fulfill",
|
"computeExecution.fulfill",
|
||||||
"escrowReward.fulfill"
|
"escrowReward.fulfill"
|
||||||
],
|
],
|
||||||
"conditionDependency": {
|
"conditionDependency": {
|
||||||
"lockReward": [],
|
"lockReward": [],
|
||||||
"serviceExecution": [],
|
"computeExecution": [],
|
||||||
"releaseReward": ["lockReward", "serviceExecution"]
|
"releaseReward": ["lockReward", "computeExecution"]
|
||||||
},
|
},
|
||||||
"conditions": [
|
"conditions": [
|
||||||
{
|
{
|
||||||
@ -296,17 +296,17 @@
|
|||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"name": "Fulfilled",
|
"name": "Fulfilled",
|
||||||
"actorType": "publisher",
|
"actorType": "provider",
|
||||||
"handler": {
|
"handler": {
|
||||||
"moduleName": "lockRewardCondition",
|
"moduleName": "lockRewardExecutionCondition",
|
||||||
"functionName": "fulfillServiceExecutionCondition",
|
"functionName": "fulfillComputeExecutionCondition",
|
||||||
"version": "0.1"
|
"version": "0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "serviceExecution",
|
"name": "computeExecution",
|
||||||
"timelock": 0,
|
"timelock": 0,
|
||||||
"timeout": 0,
|
"timeout": 0,
|
||||||
"contractName": "ComputeExecutionCondition",
|
"contractName": "ComputeExecutionCondition",
|
||||||
@ -326,10 +326,10 @@
|
|||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"name": "Fulfilled",
|
"name": "Fulfilled",
|
||||||
"actorType": "publisher",
|
"actorType": "provider",
|
||||||
"handler": {
|
"handler": {
|
||||||
"moduleName": "serviceExecution",
|
"moduleName": "accessSecretStore",
|
||||||
"functionName": "fulfillServiceExecutionCondition",
|
"functionName": "fulfillEscrowRewardCondition",
|
||||||
"version": "0.1"
|
"version": "0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -337,8 +337,8 @@
|
|||||||
"name": "TimedOut",
|
"name": "TimedOut",
|
||||||
"actorType": "consumer",
|
"actorType": "consumer",
|
||||||
"handler": {
|
"handler": {
|
||||||
"moduleName": "serviceExec",
|
"moduleName": "accessSecretStore",
|
||||||
"functionName": "fulfillServiceExecutionCondition",
|
"functionName": "refundReward",
|
||||||
"version": "0.1"
|
"version": "0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@
|
|||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"name": "Fulfilled",
|
"name": "Fulfilled",
|
||||||
"actorType": "publisher",
|
"actorType": "provider",
|
||||||
"handler": {
|
"handler": {
|
||||||
"moduleName": "escrowRewardCondition",
|
"moduleName": "escrowRewardCondition",
|
||||||
"functionName": "verifyRewardTokens",
|
"functionName": "verifyRewardTokens",
|
||||||
|
@ -7,6 +7,13 @@ import config from '../config'
|
|||||||
interface ContractTest extends Contract {
|
interface ContractTest extends Contract {
|
||||||
testContract?: boolean
|
testContract?: boolean
|
||||||
$initialized?: boolean
|
$initialized?: boolean
|
||||||
|
options?: {
|
||||||
|
address: string
|
||||||
|
}
|
||||||
|
methods?: {
|
||||||
|
addMinter(address: string): any
|
||||||
|
initialize(...args: any[]): any
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TestContractHandler extends ContractHandler {
|
export default class TestContractHandler extends ContractHandler {
|
||||||
|
Loading…
Reference in New Issue
Block a user