mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
fix fire lazers
This commit is contained in:
parent
0981289745
commit
8d2b9c62f2
@ -3,18 +3,10 @@ import MetaData from "../ddo/MetaData"
|
||||
import MetaDataBase from "../ddo/MetaDataBase"
|
||||
import Service from "../ddo/Service"
|
||||
import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const publisher: Account = (await ocean.getAccounts())[0]
|
||||
const consumer: Account = (await ocean.getAccounts())[1]
|
||||
@ -55,6 +47,8 @@ import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
|
||||
|
||||
const accessService = ddo.findServiceByType("Access")
|
||||
|
||||
await consumer.requestTokens(metaData.base.price)
|
||||
|
||||
const serviceAgreementSignatureResult: any = await ocean.signServiceAgreement(ddo.id,
|
||||
accessService.serviceDefinitionId, consumer)
|
||||
Logger.log("ServiceAgreement Id:", serviceAgreementSignatureResult.serviceAgreementId)
|
||||
@ -71,8 +65,6 @@ import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
|
||||
publisher)
|
||||
Logger.log("ServiceAgreement Id:", serviceAgreement.getId())
|
||||
|
||||
await consumer.requestTokens(metaData.base.price)
|
||||
|
||||
const paid = await serviceAgreement.payAsset(assetId, metaData.base.price, consumer)
|
||||
Logger.log(`Asset paid: ${paid}`)
|
||||
})()
|
||||
|
@ -3,18 +3,10 @@ import MetaData from "../ddo/MetaData"
|
||||
import MetaDataBase from "../ddo/MetaDataBase"
|
||||
import Service from "../ddo/Service"
|
||||
import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const publisher: Account = (await ocean.getAccounts())[0]
|
||||
const consumer: Account = (await ocean.getAccounts())[1]
|
||||
|
10
src/examples/GetAccounts.ts
Normal file
10
src/examples/GetAccounts.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import {Logger, Ocean} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const accounts = await ocean.getAccounts()
|
||||
|
||||
Logger.log(JSON.stringify(accounts, null, 2))
|
||||
})()
|
10
src/examples/GetBalance.ts
Normal file
10
src/examples/GetBalance.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import {Logger, Ocean} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const accounts = await ocean.getAccounts()
|
||||
|
||||
Logger.log(await accounts[0].getBalance())
|
||||
})()
|
@ -3,18 +3,10 @@ import MetaData from "../ddo/MetaData"
|
||||
import MetaDataBase from "../ddo/MetaDataBase"
|
||||
import Service from "../ddo/Service"
|
||||
import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const publisher: Account = (await ocean.getAccounts())[0]
|
||||
const consumer: Account = (await ocean.getAccounts())[1]
|
||||
|
@ -3,18 +3,10 @@ import MetaData from "../ddo/MetaData"
|
||||
import MetaDataBase from "../ddo/MetaDataBase"
|
||||
import Service from "../ddo/Service"
|
||||
import {Account, Logger, Ocean} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const publisher: Account = (await ocean.getAccounts())[0]
|
||||
const consumer: Account = (await ocean.getAccounts())[1]
|
||||
|
@ -1,18 +1,10 @@
|
||||
import {Logger, Ocean} from "../squid"
|
||||
// tslint:disable-next-line
|
||||
import EventListener from "../keeper/EventListener"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
Ocean.getInstance(config)
|
||||
})()
|
||||
|
||||
const event = EventListener.subscribe("OceanToken", "Transfer", {})
|
||||
|
@ -2,18 +2,10 @@ import DDO from "../ddo/DDO"
|
||||
import MetaData from "../ddo/MetaData"
|
||||
import MetaDataBase from "../ddo/MetaDataBase"
|
||||
import {Account, Logger, Ocean} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const publisher: Account = (await ocean.getAccounts())[0]
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
import {Account, Logger, Ocean, ServiceAgreementTemplate, Templates} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const templateOwner: Account = (await ocean.getAccounts())[5]
|
||||
|
||||
|
@ -1,17 +1,9 @@
|
||||
import DDO from "../ddo/DDO"
|
||||
import {Logger, Ocean} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const result: DDO[] = await ocean.searchAssetsByText("Office Humidity")
|
||||
const names: string[] = result.map((ddo: DDO): string => {
|
||||
|
@ -5,18 +5,10 @@ import MetaData from "../ddo/MetaData"
|
||||
import MetaDataBase from "../ddo/MetaDataBase"
|
||||
import Service from "../ddo/Service"
|
||||
import {Account, Logger, Ocean} from "../squid"
|
||||
import * as config from "./config.json"
|
||||
|
||||
(async () => {
|
||||
const ocean: Ocean = await Ocean.getInstance({
|
||||
nodeUri: "http://localhost:8545",
|
||||
aquariusUri: "http://localhost:5000",
|
||||
brizoUri: "http://localhost:8030",
|
||||
parityUri: "http://localhost:9545",
|
||||
secretStoreUri: "http://localhost:12001",
|
||||
threshold: 0,
|
||||
password: "unittest",
|
||||
address: "0xed243adfb84a6626eba46178ccb567481c6e655d",
|
||||
})
|
||||
const ocean: Ocean = await Ocean.getInstance(config)
|
||||
|
||||
const publisher: Account = (await ocean.getAccounts())[0]
|
||||
const consumer: Account = (await ocean.getAccounts())[1]
|
||||
|
10
src/examples/config.json
Normal file
10
src/examples/config.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"nodeUri": "http://localhost:8545",
|
||||
"aquariusUri": "http://localhost:5000",
|
||||
"brizoUri": "http://localhost:8030",
|
||||
"parityUri": "http://localhost:8545",
|
||||
"secretStoreUri": "http://localhost:12001",
|
||||
"threshold": 0,
|
||||
"password": "secret",
|
||||
"address": "0xa99d43d86a0758d5632313b8fa3972b6088a21bb"
|
||||
}
|
@ -2,10 +2,13 @@
|
||||
|
||||
set -e
|
||||
|
||||
# this has to go first
|
||||
npm run run src/examples/RegisterServiceAgreementTemplates.ts
|
||||
|
||||
npm run run src/examples/BuyAsset.ts
|
||||
npm run run src/examples/ExecuteAgreement.ts
|
||||
npm run run src/examples/GetAccounts.ts
|
||||
npm run run src/examples/GetBalance.ts
|
||||
npm run run src/examples/GrantAccess.ts
|
||||
npm run run src/examples/RegisterAsset.ts
|
||||
npm run run src/examples/Search.ts
|
||||
npm run run src/examples/SignAgreement.ts
|
||||
npm run run src/examples/ExecuteAgreement.ts
|
||||
npm run run src/examples/BuyAsset.ts
|
||||
npm run run src/examples/GrantAccess.ts
|
||||
|
Loading…
Reference in New Issue
Block a user