Skip to content

Commit

Permalink
Merge pull request #622 from nevermined-io/fix/token-address
Browse files Browse the repository at this point in the history
fix: set token address to undefined when price is not set
  • Loading branch information
aaitor authored Jan 24, 2024
2 parents e4ad6ef + 81afb3e commit dcbd83e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nevermined-io/sdk",
"version": "2.1.0",
"version": "2.1.1",
"description": "Javascript SDK for connecting with Nevermined Data Platform ",
"main": "./dist/node/sdk.js",
"typings": "./dist/node/sdk.d.ts",
Expand Down
8 changes: 5 additions & 3 deletions src/keeper/contracts/templates/BaseTemplate.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ export abstract class BaseTemplate<Params, S extends Service>
priceData?: PricedMetadataInformation,
): S {
const assetPrice = serviceAttributes.price
let tokenAddress
if (assetPrice === undefined || !isAddress(assetPrice.getTokenAddress()))
let tokenAddress = undefined
if (assetPrice && isAddress(assetPrice.getTokenAddress()))
tokenAddress = assetPrice.getTokenAddress()
else if (this.nevermined.utils.token) {
tokenAddress = this.nevermined.utils.token.getAddress()
else tokenAddress = assetPrice.getTokenAddress()
}

const serviceAgreementTemplate = this.getServiceAgreementTemplate()
const _conds = getConditionsByParams(
Expand Down

0 comments on commit dcbd83e

Please sign in to comment.