From f3550ec82996a171d1d6258ca2f8eca0c7fb31dc Mon Sep 17 00:00:00 2001 From: Rodolphe Marques Date: Wed, 13 Sep 2023 11:24:09 +0200 Subject: [PATCH 1/8] fix: test arbitrum fees --- integration/config.ts | 10 ++++----- integration/nevermined/Assets.test.ts | 4 ++-- integration/nevermined/ConsumeAsset.test.ts | 21 +++++++++---------- scripts/download-artifacts.sh | 2 +- src/keeper/ContractHandler.ts | 1 + src/keeper/Keeper.ts | 16 ++++++-------- test/bookmarks/Bookmarks.test.ts | 2 +- test/config.ts | 2 +- .../conditions/AaveBorrowCondition.test.ts | 8 ++----- .../AaveCollateralDepositCondition.test.ts | 7 ++----- .../AaveCollateralWithdrawCondition.test.ts | 7 ++----- .../conditions/AaveRepayCondition.test.ts | 7 ++----- 12 files changed, 35 insertions(+), 52 deletions(-) diff --git a/integration/config.ts b/integration/config.ts index 5afc4ca70..7fcfb00c9 100644 --- a/integration/config.ts +++ b/integration/config.ts @@ -35,12 +35,12 @@ if (process.env.NETWORK_NAME === 'testing') { } as NeverminedOptions) } -if (process.env.NETWORK_NAME === 'goerli') { +if (process.env.NETWORK_NAME === 'arbitrum-goerli') { Object.assign(configBase, { - marketplaceUri: 'https://metadata.goerli.nevermined.network', - neverminedNodeUri: 'https://node.goerli.nevermined.network', - web3ProviderUri: `https://goerli.infura.io/v3/${infuraToken}`, - neverminedNodeAddress: '0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0', + marketplaceUri: 'https://marketplace-api.goerli.nevermined.one', + neverminedNodeUri: 'https://node.goerli.nevermined.one', + web3ProviderUri: `https://arbitrum-goerli.infura.io/v3/${infuraToken}`, + neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc', } as NeverminedOptions) } diff --git a/integration/nevermined/Assets.test.ts b/integration/nevermined/Assets.test.ts index 0dd65b812..19661a317 100644 --- a/integration/nevermined/Assets.test.ts +++ b/integration/nevermined/Assets.test.ts @@ -172,7 +172,7 @@ describe('Assets', () => { it('should be able to download the updated files', async () => { const folder = '/tmp/sdk-js/updated-files' - if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true}) + if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true }) const path = (await nevermined.assets.download(ddo.id, publisher, folder, -1)) as string assert.include(path, folder, 'The storage path is not correct.') @@ -229,7 +229,7 @@ describe('Assets', () => { }) it('new rating must be between 0 and 1', async () => { - // Trying to add a vote with a rating out of range + // Trying to add a vote with a rating out of range await assert.isRejected(nevermined.assets.addRating(ddo.shortId(), 2, 1, publisher)) }) }) diff --git a/integration/nevermined/ConsumeAsset.test.ts b/integration/nevermined/ConsumeAsset.test.ts index f6147ebd7..3c9d975e0 100644 --- a/integration/nevermined/ConsumeAsset.test.ts +++ b/integration/nevermined/ConsumeAsset.test.ts @@ -61,7 +61,7 @@ describe('Consume Asset', () => { assert.isDefined(ddo.findServiceByType('access'), "DDO access service doesn't exist") }) - it('should be able to request tokens for consumer', async () => { + it.skip('should be able to request tokens for consumer', async () => { const initialBalance = (await consumer.getBalance()).nevermined const claimedTokens = BigNumber.from(100) @@ -75,7 +75,7 @@ describe('Consume Asset', () => { assert.isTrue(balanceAfter.gt(initialBalance)) }) - it('should sign the service agreement', async () => { + it.skip('should sign the service agreement', async () => { serviceAgreementSignatureResult = await nevermined.agreements.prepareSignature( ddo.id, 'access', @@ -87,7 +87,7 @@ describe('Consume Asset', () => { assert.match(signature, /^0x[a-f0-9]{130}$/, 'Service agreement signature seems not valid') }) - it('should execute the service agreement', async () => { + it.skip('should execute the service agreement', async () => { agreementId = await nevermined.agreements.create( ddo.id, serviceAgreementSignatureResult.agreementIdSeed, @@ -100,7 +100,7 @@ describe('Consume Asset', () => { assert.isDefined(agreementId) }) - it('should get the agreement conditions status not fulfilled', async () => { + it.skip('should get the agreement conditions status not fulfilled', async () => { // todo change this, a test should never dependent on the previous test because the order might change during runtime await sleep(3000) const status = await repeat(3, nevermined.agreements.status(agreementId)) @@ -112,7 +112,7 @@ describe('Consume Asset', () => { }) }) - it('should lock the payment by the consumer', async () => { + it.skip('should lock the payment by the consumer', async () => { const paid = await nevermined.agreements.conditions.lockPayment( agreementId, ddo.id, @@ -124,8 +124,7 @@ describe('Consume Asset', () => { assert.isTrue(paid, 'The asset has not been paid correctly') }) - // The test will fail because Nevermined Node grants the access faster - it('should grant the access by the publisher', async () => { + it.skip('should grant the access by the publisher', async () => { try { const granted = await nevermined.agreements.conditions.grantAccess( agreementId, @@ -147,7 +146,7 @@ describe('Consume Asset', () => { } }) - it('should return true on access granted', async () => { + it.skip('should return true on access granted', async () => { const accessGranted = await nevermined.agreements.isAccessGranted( agreementId, ddo.id, @@ -158,7 +157,7 @@ describe('Consume Asset', () => { assert.deepEqual(accessGranted, true) }) - it('should get the agreement conditions status fulfilled', async () => { + it.skip('should get the agreement conditions status fulfilled', async () => { // todo change this, a test should never dependent on the previous test because the order might change during runtime await sleep(2000) const status = await nevermined.agreements.status(agreementId) @@ -170,7 +169,7 @@ describe('Consume Asset', () => { }) }) - it('should consume and store the assets', async () => { + it.skip('should consume and store the assets', async () => { const folder = '/tmp/nevermined/sdk-js-1' const path = (await nevermined.assets.access(agreementId, ddo.id, consumer, folder)) as string @@ -185,7 +184,7 @@ describe('Consume Asset', () => { assert.deepEqual(files, ['README.md', 'ddo-example.json'], 'Stored files are not correct.') }) - it('should consume and store one asset', async () => { + it.skip('should consume and store one asset', async () => { const folder = '/tmp/nevermined/sdk-js-2' const path = (await nevermined.assets.access( agreementId, diff --git a/scripts/download-artifacts.sh b/scripts/download-artifacts.sh index 7b2977252..79b34b59a 100755 --- a/scripts/download-artifacts.sh +++ b/scripts/download-artifacts.sh @@ -20,7 +20,7 @@ fi REPO_URL=https://artifacts.nevermined.network declare -A NETWORKS_MAP -NETWORKS_MAP=( ["mainnet"]="1" ["rinkeby"]="4" ["kovan"]="42" ["matic"]="137" ["mumbai"]="80001" ["celo-alfajores"]="44787" ["celo"]="42220" ["aurora"]="1313161554" ["aurora-testnet"]="1313161555" ) +NETWORKS_MAP=( ["mainnet"]="1" ["rinkeby"]="4" ["kovan"]="42" ["matic"]="137" ["mumbai"]="80001" ["celo-alfajores"]="44787" ["celo"]="42220" ["aurora"]="1313161554" ["aurora-testnet"]="1313161555" ["arbitrum-one"]="42161" ["arbitrum-goerli"]="421613" ) SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) UNPACK_DIR="$SCRIPT_DIR/../artifacts" diff --git a/src/keeper/ContractHandler.ts b/src/keeper/ContractHandler.ts index fd384b0c2..fb5713539 100644 --- a/src/keeper/ContractHandler.ts +++ b/src/keeper/ContractHandler.ts @@ -262,6 +262,7 @@ export class ContractHandler extends Instantiable { } const feeData = await this.web3.getFeeData() + console.log('feeData', feeData) // EIP-1559 fee parameters if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) { diff --git a/src/keeper/Keeper.ts b/src/keeper/Keeper.ts index 3182d19b3..7793e0800 100644 --- a/src/keeper/Keeper.ts +++ b/src/keeper/Keeper.ts @@ -72,7 +72,7 @@ export class Keeper extends Instantiable { // Main contracts dispenser: undefined, // Optional token: undefined, // Optional - curveRoyalties: undefined, // Optional + curveRoyalties: undefined, // Optional nvmConfig: NeverminedConfig.getInstance(this.instanceConfig), didRegistry: DIDRegistry.getInstance(this.instanceConfig), // Managers @@ -101,8 +101,6 @@ export class Keeper extends Instantiable { aaveRepayCondition: undefined, aaveCreditTemplate: undefined, - - nft721LockCondition: NFT721LockCondition.getInstance(this.instanceConfig), distributeNftCollateralCondition: DistributeNFTCollateralCondition.getInstance( this.instanceConfig, @@ -207,7 +205,7 @@ export class Keeper extends Instantiable { nft721AccessTemplate: this.instances.nft721AccessTemplate, nftSalesTemplate: this.instances.nftSalesTemplate, nft721SalesTemplate: this.instances.nft721SalesTemplate, - aaveCreditTemplate: undefined + aaveCreditTemplate: undefined, } this.templateList = [ this.instances.accessTemplate, @@ -409,12 +407,10 @@ export class Keeper extends Instantiable { this.logger.debug('Loading Aave contracts') this.instances.aaveBorrowCondition = await AaveBorrowCondition.getInstance(this.instanceConfig) - this.instances.aaveCollateralDepositCondition = await AaveCollateralDepositCondition.getInstance( - this.instanceConfig, - ) - this.instances.aaveCollateralWithdrawCondition = await AaveCollateralWithdrawCondition.getInstance( - this.instanceConfig, - ) + this.instances.aaveCollateralDepositCondition = + await AaveCollateralDepositCondition.getInstance(this.instanceConfig) + this.instances.aaveCollateralWithdrawCondition = + await AaveCollateralWithdrawCondition.getInstance(this.instanceConfig) this.instances.aaveRepayCondition = await AaveRepayCondition.getInstance(this.instanceConfig) this.conditions.aaveBorrowCondition = this.instances.aaveBorrowCondition diff --git a/test/bookmarks/Bookmarks.test.ts b/test/bookmarks/Bookmarks.test.ts index 3b1cf150b..b2741215a 100644 --- a/test/bookmarks/Bookmarks.test.ts +++ b/test/bookmarks/Bookmarks.test.ts @@ -26,7 +26,7 @@ describe('Bookmarks', () => { nevermined = await Nevermined.getInstance(config) }) - beforeEach(async () => { + beforeEach(async () => { bookmarks = nevermined.services.bookmarks // eslint-disable-line prefer-destructuring newBookmark = { diff --git a/test/config.ts b/test/config.ts index 1cc6afc54..ce1a67b79 100644 --- a/test/config.ts +++ b/test/config.ts @@ -3,7 +3,7 @@ import { LoggerInstance } from '../src/utils' LoggerInstance.setLevel(LogLevel.Error) -export default { +export default { marketplaceUri: 'http://localhost:3100', neverminedNodeUri: 'http://localhost:8030', neverminedNodeAddress: '0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0', diff --git a/test/keeper/conditions/AaveBorrowCondition.test.ts b/test/keeper/conditions/AaveBorrowCondition.test.ts index 3d096053e..81792a14f 100644 --- a/test/keeper/conditions/AaveBorrowCondition.test.ts +++ b/test/keeper/conditions/AaveBorrowCondition.test.ts @@ -27,12 +27,8 @@ describe('AaveBorrowCondition', () => { nevermined = await Nevermined.getInstance(config) ;[user] = await nevermined.accounts.list() ;({ didRegistry } = nevermined.keeper) - condition = - (await ( - await Nevermined.getInstance(config)) - .keeper.loadAaveInstances()) - .conditions.aaveBorrowCondition - + condition = (await (await Nevermined.getInstance(config)).keeper.loadAaveInstances()).conditions + .aaveBorrowCondition }) beforeEach(async () => { diff --git a/test/keeper/conditions/AaveCollateralDepositCondition.test.ts b/test/keeper/conditions/AaveCollateralDepositCondition.test.ts index b882b53cc..f8c433af9 100644 --- a/test/keeper/conditions/AaveCollateralDepositCondition.test.ts +++ b/test/keeper/conditions/AaveCollateralDepositCondition.test.ts @@ -29,11 +29,8 @@ describe('AaveCollateralDepositCondition', () => { nevermined = await Nevermined.getInstance(config) ;[user] = await nevermined.accounts.list() ;({ didRegistry } = nevermined.keeper) - condition = - (await ( - await Nevermined.getInstance(config)) - .keeper.loadAaveInstances()) - .conditions.aaveCollateralDepositCondition + condition = (await (await Nevermined.getInstance(config)).keeper.loadAaveInstances()).conditions + .aaveCollateralDepositCondition }) beforeEach(async () => { diff --git a/test/keeper/conditions/AaveCollateralWithdrawCondition.test.ts b/test/keeper/conditions/AaveCollateralWithdrawCondition.test.ts index 828b454c2..5c85f3bc2 100644 --- a/test/keeper/conditions/AaveCollateralWithdrawCondition.test.ts +++ b/test/keeper/conditions/AaveCollateralWithdrawCondition.test.ts @@ -24,11 +24,8 @@ describe('AaveCollateralWithdrawCondition', () => { nevermined = await Nevermined.getInstance(config) ;[user] = await nevermined.accounts.list() ;({ didRegistry } = nevermined.keeper) - condition = - (await ( - await Nevermined.getInstance(config)) - .keeper.loadAaveInstances()) - .conditions.aaveCollateralWithdrawCondition + condition = (await (await Nevermined.getInstance(config)).keeper.loadAaveInstances()).conditions + .aaveCollateralWithdrawCondition }) beforeEach(async () => { diff --git a/test/keeper/conditions/AaveRepayCondition.test.ts b/test/keeper/conditions/AaveRepayCondition.test.ts index 6926ff270..9cb36f36f 100644 --- a/test/keeper/conditions/AaveRepayCondition.test.ts +++ b/test/keeper/conditions/AaveRepayCondition.test.ts @@ -27,11 +27,8 @@ describe('AaveRepayCondition', () => { nevermined = await Nevermined.getInstance(config) ;[user] = await nevermined.accounts.list() ;({ didRegistry } = nevermined.keeper) - condition = - (await ( - await Nevermined.getInstance(config)) - .keeper.loadAaveInstances()) - .conditions.aaveRepayCondition + condition = (await (await Nevermined.getInstance(config)).keeper.loadAaveInstances()).conditions + .aaveRepayCondition }) beforeEach(async () => { From f44d731719c05bc7288bbcb55c604975fc3c2fb1 Mon Sep 17 00:00:00 2001 From: Rodolphe Marques Date: Wed, 13 Sep 2023 13:10:47 +0200 Subject: [PATCH 2/8] fix: revert back to non EIP-1559 transactions in arbitrum --- integration/config.ts | 17 ++++---------- integration/nevermined/ConsumeAsset.test.ts | 20 ++++++++--------- package.json | 2 +- src/keeper/ContractHandler.ts | 25 +++++++++++++++++++-- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/integration/config.ts b/integration/config.ts index 7fcfb00c9..c2dda42f7 100644 --- a/integration/config.ts +++ b/integration/config.ts @@ -35,15 +35,6 @@ if (process.env.NETWORK_NAME === 'testing') { } as NeverminedOptions) } -if (process.env.NETWORK_NAME === 'arbitrum-goerli') { - Object.assign(configBase, { - marketplaceUri: 'https://marketplace-api.goerli.nevermined.one', - neverminedNodeUri: 'https://node.goerli.nevermined.one', - web3ProviderUri: `https://arbitrum-goerli.infura.io/v3/${infuraToken}`, - neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc', - } as NeverminedOptions) -} - if (process.env.NETWORK_NAME === 'mumbai') { Object.assign(configBase, { marketplaceUri: 'https://marketplace-api.mumbai.nevermined.app', @@ -74,11 +65,11 @@ if (process.env.NETWORK_NAME === 'gnosis') { } as NeverminedOptions) } -if (process.env.NETWORK_NAME === 'nvm-one') { +if (process.env.NETWORK_NAME === 'one-staging') { Object.assign(configBase, { - marketplaceUri: 'https://marketplace-api.mumbai.nevermined.one', - neverminedNodeUri: 'https://node.mumbai.nevermined.one', - web3ProviderUri: `https://polygon-mumbai.infura.io/v3/${infuraToken}`, + marketplaceUri: 'https://marketplace-api.goerli.nevermined.one', + neverminedNodeUri: 'https://node.goerli.nevermined.one', + web3ProviderUri: `https://arbitrum-goerli.infura.io/v3/${infuraToken}`, neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc', graphHttpUri: 'https://api.thegraph.com/subgraphs/name/nevermined-io/public', } as NeverminedOptions) diff --git a/integration/nevermined/ConsumeAsset.test.ts b/integration/nevermined/ConsumeAsset.test.ts index 3c9d975e0..e7c6e81e0 100644 --- a/integration/nevermined/ConsumeAsset.test.ts +++ b/integration/nevermined/ConsumeAsset.test.ts @@ -61,7 +61,7 @@ describe('Consume Asset', () => { assert.isDefined(ddo.findServiceByType('access'), "DDO access service doesn't exist") }) - it.skip('should be able to request tokens for consumer', async () => { + it('should be able to request tokens for consumer', async () => { const initialBalance = (await consumer.getBalance()).nevermined const claimedTokens = BigNumber.from(100) @@ -75,7 +75,7 @@ describe('Consume Asset', () => { assert.isTrue(balanceAfter.gt(initialBalance)) }) - it.skip('should sign the service agreement', async () => { + it('should sign the service agreement', async () => { serviceAgreementSignatureResult = await nevermined.agreements.prepareSignature( ddo.id, 'access', @@ -87,7 +87,7 @@ describe('Consume Asset', () => { assert.match(signature, /^0x[a-f0-9]{130}$/, 'Service agreement signature seems not valid') }) - it.skip('should execute the service agreement', async () => { + it('should execute the service agreement', async () => { agreementId = await nevermined.agreements.create( ddo.id, serviceAgreementSignatureResult.agreementIdSeed, @@ -100,7 +100,7 @@ describe('Consume Asset', () => { assert.isDefined(agreementId) }) - it.skip('should get the agreement conditions status not fulfilled', async () => { + it('should get the agreement conditions status not fulfilled', async () => { // todo change this, a test should never dependent on the previous test because the order might change during runtime await sleep(3000) const status = await repeat(3, nevermined.agreements.status(agreementId)) @@ -112,7 +112,7 @@ describe('Consume Asset', () => { }) }) - it.skip('should lock the payment by the consumer', async () => { + it('should lock the payment by the consumer', async () => { const paid = await nevermined.agreements.conditions.lockPayment( agreementId, ddo.id, @@ -124,7 +124,7 @@ describe('Consume Asset', () => { assert.isTrue(paid, 'The asset has not been paid correctly') }) - it.skip('should grant the access by the publisher', async () => { + it('should grant the access by the publisher', async () => { try { const granted = await nevermined.agreements.conditions.grantAccess( agreementId, @@ -146,7 +146,7 @@ describe('Consume Asset', () => { } }) - it.skip('should return true on access granted', async () => { + it('should return true on access granted', async () => { const accessGranted = await nevermined.agreements.isAccessGranted( agreementId, ddo.id, @@ -157,7 +157,7 @@ describe('Consume Asset', () => { assert.deepEqual(accessGranted, true) }) - it.skip('should get the agreement conditions status fulfilled', async () => { + it('should get the agreement conditions status fulfilled', async () => { // todo change this, a test should never dependent on the previous test because the order might change during runtime await sleep(2000) const status = await nevermined.agreements.status(agreementId) @@ -169,7 +169,7 @@ describe('Consume Asset', () => { }) }) - it.skip('should consume and store the assets', async () => { + it('should consume and store the assets', async () => { const folder = '/tmp/nevermined/sdk-js-1' const path = (await nevermined.assets.access(agreementId, ddo.id, consumer, folder)) as string @@ -184,7 +184,7 @@ describe('Consume Asset', () => { assert.deepEqual(files, ['README.md', 'ddo-example.json'], 'Stored files are not correct.') }) - it.skip('should consume and store one asset', async () => { + it('should consume and store one asset', async () => { const folder = '/tmp/nevermined/sdk-js-2' const path = (await nevermined.assets.access( agreementId, diff --git a/package.json b/package.json index ffc02aaf8..25cdba2f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/sdk", - "version": "1.6.1", + "version": "1.6.2", "description": "Javascript SDK for connecting with Nevermined Data Platform ", "main": "./dist/node/sdk.js", "typings": "./dist/node/sdk.d.ts", diff --git a/src/keeper/ContractHandler.ts b/src/keeper/ContractHandler.ts index fb5713539..ea4b8513a 100644 --- a/src/keeper/ContractHandler.ts +++ b/src/keeper/ContractHandler.ts @@ -255,14 +255,20 @@ export class ContractHandler extends Instantiable { maxFeePerGas?: BigNumber, maxPriorityFeePerGas?: BigNumber, ) { - // Custom gas fee for polygon networks + // Custom gas fee calculation for different networks const networkId = await this.nevermined.keeper.getNetworkId() + + // polygon if (networkId === 137 || networkId === 80001) { return this.getFeeDataPolygon(networkId) } + // arbitrum + if (networkId === 42161 || networkId === 421613) { + return this.getFeeDataArbitrum() + } + const feeData = await this.web3.getFeeData() - console.log('feeData', feeData) // EIP-1559 fee parameters if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) { @@ -316,4 +322,19 @@ export class ContractHandler extends Instantiable { type: 2, } } + + private async getFeeDataArbitrum() { + /** + * See https://docs.arbitrum.io/arbos/gas + * + * The sequencer prioritizes transactions on a first-come first-served basis. + * Because tips do not make sense in this model, they are ignored. + * Arbitrum users always just pay the basefee regardless of the tip they choose. + */ + const feeData = await this.web3.getFeeData() + + return { + gasPrice: feeData.gasPrice, + } + } } From 05661bfd79cc8959d78b363827f2c196c7ad15af Mon Sep 17 00:00:00 2001 From: Rodolphe Marques Date: Wed, 13 Sep 2023 16:05:32 +0200 Subject: [PATCH 3/8] fix: test with v0.6.5 of the marketplace-api --- .github/workflows/testing-node.yml | 1 + .github/workflows/testing.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/testing-node.yml b/.github/workflows/testing-node.yml index 1012a0c98..e2d7bc5d0 100644 --- a/.github/workflows/testing-node.yml +++ b/.github/workflows/testing-node.yml @@ -28,6 +28,7 @@ jobs: estuary: 'true' contracts-version: 'v3.2.1' node: 'false' + marketplace-version: 'v0.6.5' - name: Install sponge run: sudo apt-get install -y moreutils diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index edc0361fe..33813d64c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -17,6 +17,7 @@ jobs: opengsn: 'true' estuary: 'true' contracts-version: 'v3.2.1' + marketplace-version: 'v0.6.5' - name: Install dependencies run: | From 2d670b07e18d63c735abc99c6d43936eb409b361 Mon Sep 17 00:00:00 2001 From: Rodolphe Marques Date: Wed, 13 Sep 2023 16:52:49 +0200 Subject: [PATCH 4/8] fix: try to reclaim some space in the CI --- .github/workflows/testing-node.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/testing-node.yml b/.github/workflows/testing-node.yml index e2d7bc5d0..dadc5320e 100644 --- a/.github/workflows/testing-node.yml +++ b/.github/workflows/testing-node.yml @@ -7,6 +7,14 @@ jobs: runs-on: ubuntu-latest steps: + - name: Reclaim some disk space + run: | + df -h + docker images + docker system df + docker system prune --all --volumes -f + docker system df + df -h - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: From d4fa9b566ae976caeb2df53cbdd656ee23cb8dfd Mon Sep 17 00:00:00 2001 From: Rodolphe Marques Date: Wed, 13 Sep 2023 18:03:56 +0200 Subject: [PATCH 5/8] fix: test against latest marketplace-api --- .github/workflows/testing-node.yml | 9 +-------- .github/workflows/testing.yml | 3 ++- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testing-node.yml b/.github/workflows/testing-node.yml index dadc5320e..b32a90b1e 100644 --- a/.github/workflows/testing-node.yml +++ b/.github/workflows/testing-node.yml @@ -8,13 +8,7 @@ jobs: steps: - name: Reclaim some disk space - run: | - df -h - docker images - docker system df - docker system prune --all --volumes -f - docker system df - df -h + run: docker system prune --all --volumes -f - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: @@ -36,7 +30,6 @@ jobs: estuary: 'true' contracts-version: 'v3.2.1' node: 'false' - marketplace-version: 'v0.6.5' - name: Install sponge run: sudo apt-get install -y moreutils diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 33813d64c..9381265b5 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -7,6 +7,8 @@ jobs: runs-on: ubuntu-latest steps: + - name: Reclaim some disk space + run: docker system prune --all --volumes -f - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: @@ -17,7 +19,6 @@ jobs: opengsn: 'true' estuary: 'true' contracts-version: 'v3.2.1' - marketplace-version: 'v0.6.5' - name: Install dependencies run: | From 24c5cbd7369995cca7a43cd2ac9def07a39f36d3 Mon Sep 17 00:00:00 2001 From: r-marques Date: Thu, 14 Sep 2023 08:01:16 +0000 Subject: [PATCH 6/8] Automated CHANGELOG.md update Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28822fda2..7114c61de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,10 +105,19 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - feat: remove getAddress method from ContractBase [`ac14d46`](https://github.com/nevermined-io/sdk-js/commit/ac14d4641e96a8d875ceaecc9a02236877529785) - feat: replace BigNumber class with ES2020 BigInt [`4ed4b51`](https://github.com/nevermined-io/sdk-js/commit/4ed4b51fad163e189e52b97b965e6ab878017b01) -#### [v1.13.16](https://github.com/nevermined-io/sdk-js/compare/v1.6.1...v1.13.16) +#### [v1.13.16](https://github.com/nevermined-io/sdk-js/compare/v1.6.2...v1.13.16) > 29 May 2023 +#### [v1.6.2](https://github.com/nevermined-io/sdk-js/compare/v1.6.1...v1.6.2) + +> 14 September 2023 + +- Fix/arbitrum fees [`#577`](https://github.com/nevermined-io/sdk-js/pull/577) +- chore: adding v1.6.1 Changelog updates [`a3b206c`](https://github.com/nevermined-io/sdk-js/commit/a3b206c6bef91bfdab6016f59c7e719e1a0d6072) +- fix: test arbitrum fees [`f3550ec`](https://github.com/nevermined-io/sdk-js/commit/f3550ec82996a171d1d6258ca2f8eca0c7fb31dc) +- fix: revert back to non EIP-1559 transactions in arbitrum [`f44d731`](https://github.com/nevermined-io/sdk-js/commit/f44d731719c05bc7288bbcb55c604975fc3c2fb1) + #### [v1.6.1](https://github.com/nevermined-io/sdk-js/compare/v1.6.0...v1.6.1) > 31 August 2023 @@ -429,7 +438,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - ci: testing with https services [`bb96077`](https://github.com/nevermined-io/sdk-js/commit/bb96077c9403ea7ae26195a51d8a92e144cea384) - linting [`d2547ed`](https://github.com/nevermined-io/sdk-js/commit/d2547edfbfebb49b488c97c4ce9e6d6f2ee849e4) -#### [v1.0.0](https://github.com/nevermined-io/sdk-js/compare/v1.0.0-rc9...v1.0.0) +### [v1.0.0](https://github.com/nevermined-io/sdk-js/compare/v1.0.0-rc9...v1.0.0) > 14 February 2023 @@ -1168,7 +1177,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 2 May 2022 -- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) +- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) - Adding v0.19.21 Changelog updates [`c93cdc5`](https://github.com/nevermined-io/sdk-js/commit/c93cdc55f139a43db4130ccb0f80924d2645a931) #### [v0.19.21](https://github.com/nevermined-io/sdk-js/compare/v0.19.20...v0.19.21) @@ -1431,7 +1440,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 18 January 2022 -- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) +- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) - [wip] Create agreement+pay in one transaction [`#183`](https://github.com/nevermined-io/sdk-js/pull/183) - Adapting to contracts `v1.3.3` [`#177`](https://github.com/nevermined-io/sdk-js/pull/177) - Adding v0.17.2 Changelog updates [`5eddda4`](https://github.com/nevermined-io/sdk-js/commit/5eddda43954e013e6e6f7344c9a877d801aacb5c) @@ -1937,7 +1946,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Feature/sync develop [`#268`](https://github.com/nevermined-io/sdk-js/pull/268) - Quick fix for non-eip1559 networks [`#266`](https://github.com/nevermined-io/sdk-js/pull/266) - integrate Permissions and refactor search query [`#264`](https://github.com/nevermined-io/sdk-js/pull/264) -- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) +- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) - Get the keeper version from the artifacts instead of package version [`#244`](https://github.com/nevermined-io/sdk-js/pull/244) - replace `metadata-api` url by `marketplace-api` and sort type [`#243`](https://github.com/nevermined-io/sdk-js/pull/243) - fixing issues with BigNumbers [`#246`](https://github.com/nevermined-io/sdk-js/pull/246) @@ -1976,7 +1985,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Feature/190 add did to sec markets [`#191`](https://github.com/nevermined-io/sdk-js/pull/191) - Adding utility methods for getting nft token uri [`#189`](https://github.com/nevermined-io/sdk-js/pull/189) - Lint ... [`#187`](https://github.com/nevermined-io/sdk-js/pull/187) -- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) +- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) - [wip] Create agreement+pay in one transaction [`#183`](https://github.com/nevermined-io/sdk-js/pull/183) - Adapting to contracts `v1.3.3` [`#177`](https://github.com/nevermined-io/sdk-js/pull/177) - Correct typo in route [`#184`](https://github.com/nevermined-io/sdk-js/pull/184) From b977291276aaafcc9086d7324a30859fb9e15b7d Mon Sep 17 00:00:00 2001 From: Aitor <1726644+aaitor@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:01:48 +0200 Subject: [PATCH 7/8] fix: getting url from DDO when claiming NFT --- .../nevermined/Subscriptions.e2e.test.ts | 1 + package.json | 2 +- .../templates/BaseTemplate.abstract.ts | 2 +- .../contracts/templates/NFT721SalesTemplate.ts | 4 ++-- .../contracts/templates/NFTSalesTemplate.ts | 4 ++++ src/services/node/NeverminedNode.ts | 18 ++++++++++++++++-- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/integration/nevermined/Subscriptions.e2e.test.ts b/integration/nevermined/Subscriptions.e2e.test.ts index dd77cb1c9..be4971a70 100644 --- a/integration/nevermined/Subscriptions.e2e.test.ts +++ b/integration/nevermined/Subscriptions.e2e.test.ts @@ -27,6 +27,7 @@ describe('Subscriptions using NFT ERC-721 End-to-End', () => { let reseller: Account let nevermined: Nevermined + let token: Token let escrowPaymentCondition: EscrowPaymentCondition let transferNft721Condition: TransferNFT721Condition diff --git a/package.json b/package.json index 25cdba2f6..db4fd8297 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/sdk", - "version": "1.6.2", + "version": "1.6.3", "description": "Javascript SDK for connecting with Nevermined Data Platform ", "main": "./dist/node/sdk.js", "typings": "./dist/node/sdk.d.ts", diff --git a/src/keeper/contracts/templates/BaseTemplate.abstract.ts b/src/keeper/contracts/templates/BaseTemplate.abstract.ts index 889823a7d..c36882470 100644 --- a/src/keeper/contracts/templates/BaseTemplate.abstract.ts +++ b/src/keeper/contracts/templates/BaseTemplate.abstract.ts @@ -27,7 +27,7 @@ export abstract class BaseTemplate public abstract description(): string public abstract conditions(): Condition[] - public serviceEndpoint(): ServiceType { + public serviceEndpoint(): ServiceType | string { return this.service() } diff --git a/src/keeper/contracts/templates/NFT721SalesTemplate.ts b/src/keeper/contracts/templates/NFT721SalesTemplate.ts index 446f23e8d..6926bfa45 100644 --- a/src/keeper/contracts/templates/NFT721SalesTemplate.ts +++ b/src/keeper/contracts/templates/NFT721SalesTemplate.ts @@ -28,8 +28,8 @@ export class NFT721SalesTemplate extends BaseTemplate { + let claimNFTEndpoint = this.getClaimNftEndpoint() try { + if (did) { + // Getting Node endpoint from DDO + const ddo = await this.nevermined.assets.resolve(did) + const salesService = ddo.findServiceByType('nft-sales') + const endpointURL = new URL(salesService.serviceEndpoint) + claimNFTEndpoint = `${endpointURL.protocol}//${endpointURL.host}${apiPath}/nft-transfer` + } + } catch (e) { + this.logger.log(`Unable to get endpoint from DDO: ${did}`) + } + + try { + this.logger.log(`Claiming NFT using endpoint: ${claimNFTEndpoint}`) const response = await this.nevermined.utils.fetch.post( - this.getClaimNftEndpoint(), + claimNFTEndpoint, JSON.stringify({ agreementId, did, From a187c5751dcd078669d4c04f1e276ba5dfd860ca Mon Sep 17 00:00:00 2001 From: Aitor <1726644+aaitor@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:42:27 +0200 Subject: [PATCH 8/8] chore: adding v1.6.3 Changelog updates --- CHANGELOG.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7114c61de..1ce473d52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,10 +105,18 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - feat: remove getAddress method from ContractBase [`ac14d46`](https://github.com/nevermined-io/sdk-js/commit/ac14d4641e96a8d875ceaecc9a02236877529785) - feat: replace BigNumber class with ES2020 BigInt [`4ed4b51`](https://github.com/nevermined-io/sdk-js/commit/4ed4b51fad163e189e52b97b965e6ab878017b01) -#### [v1.13.16](https://github.com/nevermined-io/sdk-js/compare/v1.6.2...v1.13.16) +#### [v1.13.16](https://github.com/nevermined-io/sdk-js/compare/v1.6.3...v1.13.16) > 29 May 2023 +#### [v1.6.3](https://github.com/nevermined-io/sdk-js/compare/v1.6.2...v1.6.3) + +> 22 September 2023 + +- Getting url from DDO when claiming NFT [`#582`](https://github.com/nevermined-io/sdk-js/pull/582) +- fix: getting url from DDO when claiming NFT [`b977291`](https://github.com/nevermined-io/sdk-js/commit/b977291276aaafcc9086d7324a30859fb9e15b7d) +- Automated CHANGELOG.md update [`24c5cbd`](https://github.com/nevermined-io/sdk-js/commit/24c5cbd7369995cca7a43cd2ac9def07a39f36d3) + #### [v1.6.2](https://github.com/nevermined-io/sdk-js/compare/v1.6.1...v1.6.2) > 14 September 2023 @@ -438,7 +446,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - ci: testing with https services [`bb96077`](https://github.com/nevermined-io/sdk-js/commit/bb96077c9403ea7ae26195a51d8a92e144cea384) - linting [`d2547ed`](https://github.com/nevermined-io/sdk-js/commit/d2547edfbfebb49b488c97c4ce9e6d6f2ee849e4) -### [v1.0.0](https://github.com/nevermined-io/sdk-js/compare/v1.0.0-rc9...v1.0.0) +#### [v1.0.0](https://github.com/nevermined-io/sdk-js/compare/v1.0.0-rc9...v1.0.0) > 14 February 2023 @@ -1177,7 +1185,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 2 May 2022 -- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) +- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) - Adding v0.19.21 Changelog updates [`c93cdc5`](https://github.com/nevermined-io/sdk-js/commit/c93cdc55f139a43db4130ccb0f80924d2645a931) #### [v0.19.21](https://github.com/nevermined-io/sdk-js/compare/v0.19.20...v0.19.21) @@ -1440,7 +1448,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 18 January 2022 -- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) +- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) - [wip] Create agreement+pay in one transaction [`#183`](https://github.com/nevermined-io/sdk-js/pull/183) - Adapting to contracts `v1.3.3` [`#177`](https://github.com/nevermined-io/sdk-js/pull/177) - Adding v0.17.2 Changelog updates [`5eddda4`](https://github.com/nevermined-io/sdk-js/commit/5eddda43954e013e6e6f7344c9a877d801aacb5c) @@ -1946,7 +1954,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Feature/sync develop [`#268`](https://github.com/nevermined-io/sdk-js/pull/268) - Quick fix for non-eip1559 networks [`#266`](https://github.com/nevermined-io/sdk-js/pull/266) - integrate Permissions and refactor search query [`#264`](https://github.com/nevermined-io/sdk-js/pull/264) -- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) +- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) - Get the keeper version from the artifacts instead of package version [`#244`](https://github.com/nevermined-io/sdk-js/pull/244) - replace `metadata-api` url by `marketplace-api` and sort type [`#243`](https://github.com/nevermined-io/sdk-js/pull/243) - fixing issues with BigNumbers [`#246`](https://github.com/nevermined-io/sdk-js/pull/246) @@ -1985,7 +1993,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Feature/190 add did to sec markets [`#191`](https://github.com/nevermined-io/sdk-js/pull/191) - Adding utility methods for getting nft token uri [`#189`](https://github.com/nevermined-io/sdk-js/pull/189) - Lint ... [`#187`](https://github.com/nevermined-io/sdk-js/pull/187) -- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) +- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) - [wip] Create agreement+pay in one transaction [`#183`](https://github.com/nevermined-io/sdk-js/pull/183) - Adapting to contracts `v1.3.3` [`#177`](https://github.com/nevermined-io/sdk-js/pull/177) - Correct typo in route [`#184`](https://github.com/nevermined-io/sdk-js/pull/184)