mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
using new Ocean API on buy asset test
This commit is contained in:
parent
e1b9197746
commit
575b45b68a
@ -21,9 +21,9 @@ describe("Buy Asset", () => {
|
|||||||
ocean = await Ocean.getInstance(config)
|
ocean = await Ocean.getInstance(config)
|
||||||
|
|
||||||
// Accounts
|
// Accounts
|
||||||
publisher = (await ocean.getAccounts())[0]
|
publisher = (await ocean.accounts.list())[0]
|
||||||
publisher.setPassword(process.env.ACCOUNT_PASSWORD)
|
publisher.setPassword(process.env.ACCOUNT_PASSWORD)
|
||||||
consumer = (await ocean.getAccounts())[1]
|
consumer = (await ocean.accounts.list())[1]
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
metadata = {
|
metadata = {
|
||||||
@ -64,7 +64,7 @@ describe("Buy Asset", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should regiester a asset", async () => {
|
it("should regiester a asset", async () => {
|
||||||
ddo = await ocean.registerAsset(metadata as any, publisher)
|
ddo = await ocean.assets.create(metadata as any, publisher)
|
||||||
did = DID.parse(ddo.id)
|
did = DID.parse(ddo.id)
|
||||||
|
|
||||||
assert.isDefined(ddo, "Register has not returned a DDO")
|
assert.isDefined(ddo, "Register has not returned a DDO")
|
||||||
@ -83,7 +83,7 @@ describe("Buy Asset", () => {
|
|||||||
it("should sign the service agreement", async () => {
|
it("should sign the service agreement", async () => {
|
||||||
const accessService = ddo.findServiceByType("Access")
|
const accessService = ddo.findServiceByType("Access")
|
||||||
|
|
||||||
serviceAgreementSignatureResult = await ocean.signServiceAgreement(ddo.id, accessService.serviceDefinitionId, consumer)
|
serviceAgreementSignatureResult = await ocean.assets.order(ddo.id, accessService.serviceDefinitionId, consumer)
|
||||||
|
|
||||||
const {serviceAgreementId, serviceAgreementSignature} = serviceAgreementSignatureResult
|
const {serviceAgreementId, serviceAgreementSignature} = serviceAgreementSignatureResult
|
||||||
assert.match(serviceAgreementId, /^[a-f0-9]{64}$/, "Service agreement ID seems not valid")
|
assert.match(serviceAgreementId, /^[a-f0-9]{64}$/, "Service agreement ID seems not valid")
|
||||||
@ -93,7 +93,7 @@ describe("Buy Asset", () => {
|
|||||||
it("should execute the service agreement", async () => {
|
it("should execute the service agreement", async () => {
|
||||||
const accessService = ddo.findServiceByType("Access")
|
const accessService = ddo.findServiceByType("Access")
|
||||||
|
|
||||||
serviceAgreement = await ocean.executeServiceAgreement(
|
serviceAgreement = await ocean.agreements.create(
|
||||||
ddo.id,
|
ddo.id,
|
||||||
accessService.serviceDefinitionId,
|
accessService.serviceDefinitionId,
|
||||||
serviceAgreementSignatureResult.serviceAgreementId,
|
serviceAgreementSignatureResult.serviceAgreementId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user