Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ 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).

#### [v3.0.6](https://github.com/nevermined-io/node/compare/v3.0.5...v3.0.6)

> 6 June 2024

- feat: sdk v3.0.11 [`#340`](https://github.com/nevermined-io/node/pull/340)
- fix: better events management [`24a2675`](https://github.com/nevermined-io/node/commit/24a267527491407cfa82b186fc76e46bdb8343a9)
- chore: adding v3.0.5 Changelog updates [`efa19c5`](https://github.com/nevermined-io/node/commit/efa19c5c3192935435324d1eea7ea33e415ae29c)

#### [v3.0.5](https://github.com/nevermined-io/node/compare/v3.0.4...v3.0.5)

> 5 June 2024
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-ts",
"version": "3.0.5",
"version": "3.0.6",
"description": "Nevermined Node",
"main": "main.ts",
"scripts": {
Expand Down Expand Up @@ -28,6 +28,7 @@
"artifacts:arbitrum-sepolia": "sh ./scripts/download-artifacts.sh v3.5.6 arbitrum-sepolia"
},
"dependencies": {
"@nevermined-io/sdk": "3.0.12",
"@nestjs/axios": "^3.0.2",
"@nestjs/common": "^10.3.8",
"@nestjs/core": "^10.3.8",
Expand All @@ -38,7 +39,6 @@
"@nestjs/typeorm": "^10.0.2",
"@nevermined-io/argo-workflows-api": "^0.1.3",
"@nevermined-io/passport-nevermined": "^0.3.0",
"@nevermined-io/sdk": "3.0.11",
"@sideway/address": "^5.0.0",
"@sideway/formula": "^3.0.1",
"@sideway/pinpoint": "^2.0.0",
Expand Down
45 changes: 10 additions & 35 deletions src/access/access.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ import {
ApiResponse,
ApiTags,
} from '@nestjs/swagger'
import {
AgreementData,
DID,
ServiceType,
ValidationParams,
ZeroAddress,
generateId,
} from '@nevermined-io/sdk'
import { DID, ServiceType, ValidationParams, ZeroAddress, generateId } from '@nevermined-io/sdk'
import crypto from 'crypto'
import { aes_encryption_256 } from '../common/helpers/encryption.helper'
import { Public } from '../common/decorators/auth.decorator'
Expand Down Expand Up @@ -148,9 +141,10 @@ export class AccessController {
Logger.debug(`Transferring NFT with agreement ${transferData.agreementId}`)
const nevermined = this.nvmService.getNevermined()

// Check the agreement exists on-chain
// Check the agreement exists
let agreementData
try {
const agreementData = await nevermined.keeper.agreementStoreManager.getAgreement(
agreementData = await nevermined.keeper.agreementStoreManager.getAgreement(
transferData.agreementId,
)
if (agreementData.templateId.toLowerCase() === ZeroAddress) {
Expand All @@ -162,36 +156,17 @@ export class AccessController {
throw new NotFoundException(`Agreement ${transferData.agreementId} not found`)
}

let subscriptionDDO
let did
try {
// If we get DID from the request, we use it
if (transferData.did) {
did = DID.parse(transferData.did)
}
did = DID.parse(agreementData.did)
subscriptionDDO = await this.nvmService.nevermined.assets.resolve(did.getDid())
} catch (e) {
Logger.debug(`Unable to parse DID from the HTTP parameter: ${transferData.did}`)
}

if (!did) {
// If we don't have a DID, we get it from the events
let agreement: AgreementData
try {
agreement = await nevermined.keeper.agreementStoreManager.getAgreement(
transferData.agreementId,
)
did = DID.parse(agreement.did)
} catch (e) {
Logger.error(`Error resolving agreement ${transferData.agreementId}`)
Logger.error((e as Error).toString())
throw new NotFoundException(`Agreement ${transferData.agreementId} not found`)
}
if (!agreement) {
Logger.error(`Agreement ${transferData.agreementId} not found`)
throw new NotFoundException(`Agreement ${transferData.agreementId} not found`)
}
Logger.error(`Error resolving DID: ${did.getDid()}`)
Logger.error((e as Error).toString())
throw new NotFoundException(`Error resolving DID: ${did.getDid()}`)
}

const subscriptionDDO = await this.nvmService.nevermined.assets.resolve(did.getDid())
const serviceReference =
transferData.serviceIndex && transferData.serviceIndex >= 0
? transferData.serviceIndex
Expand Down
39 changes: 7 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1435,10 +1435,10 @@
jose "^4.11.2"
passport-strategy "^1.0.0"

"@nevermined-io/sdk@3.0.6":
version "3.0.6"
resolved "https://registry.yarnpkg.com/@nevermined-io/sdk/-/sdk-3.0.6.tgz#6c92c0445d5e759fa71d56b0227d3a6e37b22fe5"
integrity sha512-G6FBOAaYbCjQukNcoQ/H/7Bb1NnmKgoRCj4PfB1KpIKNZ1whH0XHYPZbo1MVHwU+ikjnr1swWEMf4IKK+Zwd1g==
"@nevermined-io/sdk@3.0.12":
version "3.0.12"
resolved "https://registry.yarnpkg.com/@nevermined-io/sdk/-/sdk-3.0.12.tgz#0bde2ac266f6c2e3d5784ca224606aa7354dbfbe"
integrity sha512-R3OwesQUwMY+HxNwuCT9WO6WjILzrTtb9lCyLlk3EFJk3gBOkMlDon1Y3xPkb3p7nOpidByFneIPtBdFp/DS6w==
dependencies:
"@alchemy/aa-core" "3.12.1"
"@apollo/client" "^3.7.16"
Expand Down Expand Up @@ -8533,16 +8533,7 @@ string-to-arraybuffer@^1.0.0:
atob-lite "^2.0.0"
is-base64 "^0.1.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -8636,7 +8627,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -8650,13 +8641,6 @@ strip-ansi@^3.0.0:
dependencies:
ansi-regex "^2.0.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1, strip-ansi@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -9571,7 +9555,7 @@ word-wrap@^1.2.5:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -9589,15 +9573,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down