From 70d8f4e340fd390ceb342975604642a03377d31f Mon Sep 17 00:00:00 2001 From: Abrom8 <38963270+Abrom8@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:09:04 +0200 Subject: [PATCH 01/10] deps: update @oceanprotocol/lib (ocean.js) --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 668eb8d..770deed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.3.0-alpha10", "license": "Apache-2.0", "dependencies": { - "@oceanprotocol/lib": "^3.0.4", + "@oceanprotocol/lib": "^3.1.0", "@urql/exchange-refocus": "^1.0.0", "axios": "^1.3.4", "decimal.js": "^10.4.3", @@ -3088,9 +3088,9 @@ "integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw==" }, "node_modules/@oceanprotocol/lib": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.0.4.tgz", - "integrity": "sha512-HG187KtiT6LV8N5RbupcdKMR+6qsYLEmf43H5gnrIjDflachSayc1R629M7FPC29M8RMgqhfCwKLJJN64U+pmw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.0.tgz", + "integrity": "sha512-BibntT9JOOeXDVwxLE2fj2ktB/n4BJ7bIf3S/hQYsVb/f1NQvSE+VT6h5rShHrQzq0zrLZkm1l4GrC46+2gthA==", "dependencies": { "@oceanprotocol/contracts": "^1.1.14", "cross-fetch": "^3.1.5", @@ -21732,9 +21732,9 @@ "integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw==" }, "@oceanprotocol/lib": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.0.4.tgz", - "integrity": "sha512-HG187KtiT6LV8N5RbupcdKMR+6qsYLEmf43H5gnrIjDflachSayc1R629M7FPC29M8RMgqhfCwKLJJN64U+pmw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.0.tgz", + "integrity": "sha512-BibntT9JOOeXDVwxLE2fj2ktB/n4BJ7bIf3S/hQYsVb/f1NQvSE+VT6h5rShHrQzq0zrLZkm1l4GrC46+2gthA==", "requires": { "@oceanprotocol/contracts": "^1.1.14", "cross-fetch": "^3.1.5", diff --git a/package.json b/package.json index 66d749d..23dcb45 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "homepage": "https://github.com/deltaDAO/nautilus#readme", "dependencies": { - "@oceanprotocol/lib": "^3.0.4", + "@oceanprotocol/lib": "^3.1.0", "@urql/exchange-refocus": "^1.0.0", "axios": "^1.3.4", "decimal.js": "^10.4.3", From e056191dbba3b277360bcfb4dab494592b47e6ef Mon Sep 17 00:00:00 2001 From: Abrom8 <38963270+Abrom8@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:10:58 +0200 Subject: [PATCH 02/10] Release 0.3.0-alpha11 --- CHANGELOG.md | 23 +++++++++++++++++++---- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fefdf29..7c5668e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,12 @@ 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). -#### [v0.3.0-alpha10](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha10) +#### [v0.3.0-alpha11](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha11) +- Feat/ethers [`#53`](https://github.com/deltaDAO/nautilus/pull/53) - test: remove unused files [`bc30177`](https://github.com/deltaDAO/nautilus/commit/bc30177919e500c4ae165656a30f4242a687ef5c) - refactor: move ProviderInstance call to provider.ts utils file [`6e31ff5`](https://github.com/deltaDAO/nautilus/commit/6e31ff5a4a538594de85caa2a85048f1c555ab56) -- docs: combine ethers setup section in README [`9c98261`](https://github.com/deltaDAO/nautilus/commit/9c98261aed9e9efa745e80f54360c29429ecb330) +- deps: update @oceanprotocol/lib (ocean.js) [`70d8f4e`](https://github.com/deltaDAO/nautilus/commit/70d8f4e340fd390ceb342975604642a03377d31f) #### [v0.3.0-alpha9](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha8...v0.3.0-alpha9) @@ -65,10 +66,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - refactor: use object as argument for getDDO [`50128d4`](https://github.com/deltaDAO/nautilus/commit/50128d407e710f21919db4ab577fbf21e551c42b) - refactor: use early return [`e866001`](https://github.com/deltaDAO/nautilus/commit/e8660017a65fc49f6439edcbfadb335e602e00d2) -#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha1...v0.3.0-alpha2) +#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha10...v0.3.0-alpha2) > 14 August 2023 +#### [v0.3.0-alpha10](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha1...v0.3.0-alpha10) + +> 24 August 2023 + +- fix: consumer parameter handling in service [`#51`](https://github.com/deltaDAO/nautilus/pull/51) +- Feat/publish rework [`#46`](https://github.com/deltaDAO/nautilus/pull/46) - docs: update web3 version hint [`#45`](https://github.com/deltaDAO/nautilus/pull/45) - Fix/exports and deps [`#42`](https://github.com/deltaDAO/nautilus/pull/42) - Update README.md [`#38`](https://github.com/deltaDAO/nautilus/pull/38) @@ -80,7 +87,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - docs: create typedoc api documentation for version 0.2.2 [`74cf76e`](https://github.com/deltaDAO/nautilus/commit/74cf76ef7344029c0fb78ae4e384c8af944fa2fc) - docs: create typedoc api documentation for version 0.1.2 [`a59e034`](https://github.com/deltaDAO/nautilus/commit/a59e034cac1adb327eca315c49c105d5e237b039) -#### [v0.3.0-alpha1](https://github.com/deltaDAO/nautilus/compare/v0.2.2...v0.3.0-alpha1) +#### [v0.3.0-alpha1](https://github.com/deltaDAO/nautilus/compare/v0.2.3...v0.3.0-alpha1) > 11 August 2023 @@ -88,6 +95,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - feat!: major publishing rework. move datatoken to services, use multi tx setup (WIP) [`fb055f3`](https://github.com/deltaDAO/nautilus/commit/fb055f31f2a3030a5831171c60ffbeeef6977f24) - deps: add chai and sinon [`91355db`](https://github.com/deltaDAO/nautilus/commit/91355db6ce65bab0172229ab07c2fe6f2afa559c) +#### [v0.2.3](https://github.com/deltaDAO/nautilus/compare/v0.2.2...v0.2.3) + +> 29 August 2023 + +- docs: create typedoc api documentation for version 0.2.3 [`ab2270b`](https://github.com/deltaDAO/nautilus/commit/ab2270b05ac1a56ca14efaeb00c7e7de3826203a) +- Release 0.2.3 [`ae02f08`](https://github.com/deltaDAO/nautilus/commit/ae02f082940a0f423fd38443eb91cd067885a5ac) +- fix: consumerParameter type [`3e3a03e`](https://github.com/deltaDAO/nautilus/commit/3e3a03e9e9047116f61a176d6d3285465dc9ac4f) + #### [v0.2.2](https://github.com/deltaDAO/nautilus/compare/v0.2.1...v0.2.2) > 25 July 2023 diff --git a/package-lock.json b/package-lock.json index 770deed..cb80eda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha10", + "version": "0.3.0-alpha11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha10", + "version": "0.3.0-alpha11", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/lib": "^3.1.0", diff --git a/package.json b/package.json index 23dcb45..d8665ac 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@deltadao/nautilus", "source": "./src/index.ts", - "version": "0.3.0-alpha10", + "version": "0.3.0-alpha11", "description": "A typescript library enabling automated publish & consume in Ocean Protocol ecosystems", "main": "./dist/lib.js", "umd:main": "./dist/lib.umd.js", From d6e02352ddcb6f59247155cf91a8d99c34a6de31 Mon Sep 17 00:00:00 2001 From: Abrom8 <38963270+Abrom8@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:37:40 +0200 Subject: [PATCH 03/10] deps: update @oceanprotocol/lib to 3.1.1 (ocean.js) --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index cb80eda..a6b0006 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.3.0-alpha11", "license": "Apache-2.0", "dependencies": { - "@oceanprotocol/lib": "^3.1.0", + "@oceanprotocol/lib": "^3.1.1", "@urql/exchange-refocus": "^1.0.0", "axios": "^1.3.4", "decimal.js": "^10.4.3", @@ -3088,9 +3088,9 @@ "integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw==" }, "node_modules/@oceanprotocol/lib": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.0.tgz", - "integrity": "sha512-BibntT9JOOeXDVwxLE2fj2ktB/n4BJ7bIf3S/hQYsVb/f1NQvSE+VT6h5rShHrQzq0zrLZkm1l4GrC46+2gthA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.1.tgz", + "integrity": "sha512-OCinF20Bj4xPXbZZXdq4oXlmgzGS4NuIdVVCawb/ouKF0JEt8LLOB+/a/DWiqzL5UQO060/T3zizOxrJyh19Qw==", "dependencies": { "@oceanprotocol/contracts": "^1.1.14", "cross-fetch": "^3.1.5", @@ -21732,9 +21732,9 @@ "integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw==" }, "@oceanprotocol/lib": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.0.tgz", - "integrity": "sha512-BibntT9JOOeXDVwxLE2fj2ktB/n4BJ7bIf3S/hQYsVb/f1NQvSE+VT6h5rShHrQzq0zrLZkm1l4GrC46+2gthA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.1.tgz", + "integrity": "sha512-OCinF20Bj4xPXbZZXdq4oXlmgzGS4NuIdVVCawb/ouKF0JEt8LLOB+/a/DWiqzL5UQO060/T3zizOxrJyh19Qw==", "requires": { "@oceanprotocol/contracts": "^1.1.14", "cross-fetch": "^3.1.5", diff --git a/package.json b/package.json index d8665ac..4f27700 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "homepage": "https://github.com/deltaDAO/nautilus#readme", "dependencies": { - "@oceanprotocol/lib": "^3.1.0", + "@oceanprotocol/lib": "^3.1.1", "@urql/exchange-refocus": "^1.0.0", "axios": "^1.3.4", "decimal.js": "^10.4.3", From b4df016a3c5d64ea22c67d85f2d2e8b1ba41709a Mon Sep 17 00:00:00 2001 From: Abrom8 <38963270+Abrom8@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:42:16 +0200 Subject: [PATCH 04/10] Release 0.3.0-alpha12 --- CHANGELOG.md | 15 ++++++++++++--- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c5668e..a0e6bea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,12 @@ 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). -#### [v0.3.0-alpha11](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha11) +#### [v0.3.0-alpha12](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha12) - Feat/ethers [`#53`](https://github.com/deltaDAO/nautilus/pull/53) - test: remove unused files [`bc30177`](https://github.com/deltaDAO/nautilus/commit/bc30177919e500c4ae165656a30f4242a687ef5c) - refactor: move ProviderInstance call to provider.ts utils file [`6e31ff5`](https://github.com/deltaDAO/nautilus/commit/6e31ff5a4a538594de85caa2a85048f1c555ab56) -- deps: update @oceanprotocol/lib (ocean.js) [`70d8f4e`](https://github.com/deltaDAO/nautilus/commit/70d8f4e340fd390ceb342975604642a03377d31f) +- Release 0.3.0-alpha11 [`e056191`](https://github.com/deltaDAO/nautilus/commit/e056191dbba3b277360bcfb4dab494592b47e6ef) #### [v0.3.0-alpha9](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha8...v0.3.0-alpha9) @@ -66,10 +66,19 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - refactor: use object as argument for getDDO [`50128d4`](https://github.com/deltaDAO/nautilus/commit/50128d407e710f21919db4ab577fbf21e551c42b) - refactor: use early return [`e866001`](https://github.com/deltaDAO/nautilus/commit/e8660017a65fc49f6439edcbfadb335e602e00d2) -#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha10...v0.3.0-alpha2) +#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha11...v0.3.0-alpha2) > 14 August 2023 +#### [v0.3.0-alpha11](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha10...v0.3.0-alpha11) + +> 4 September 2023 + +- Feat/ethers [`#53`](https://github.com/deltaDAO/nautilus/pull/53) +- Release 0.3.0-alpha11 [`e056191`](https://github.com/deltaDAO/nautilus/commit/e056191dbba3b277360bcfb4dab494592b47e6ef) +- deps: update @oceanprotocol/lib (ocean.js) [`70d8f4e`](https://github.com/deltaDAO/nautilus/commit/70d8f4e340fd390ceb342975604642a03377d31f) +- fix: remove misleading comment [`df9ad79`](https://github.com/deltaDAO/nautilus/commit/df9ad79d76737f66900545fc2e56b166ad78b706) + #### [v0.3.0-alpha10](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha1...v0.3.0-alpha10) > 24 August 2023 diff --git a/package-lock.json b/package-lock.json index a6b0006..862e339 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha11", + "version": "0.3.0-alpha12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha11", + "version": "0.3.0-alpha12", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/lib": "^3.1.1", diff --git a/package.json b/package.json index 4f27700..ae96543 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@deltadao/nautilus", "source": "./src/index.ts", - "version": "0.3.0-alpha11", + "version": "0.3.0-alpha12", "description": "A typescript library enabling automated publish & consume in Ocean Protocol ecosystems", "main": "./dist/lib.js", "umd:main": "./dist/lib.umd.js", From 8a62cfb70d458b37c4ef060e429ec305ec82b7f0 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 4 Sep 2023 13:39:29 +0200 Subject: [PATCH 05/10] fix: cast templateId to Number --- src/utils/order.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/utils/order.ts b/src/utils/order.ts index 103fc85..3b23fbe 100644 --- a/src/utils/order.ts +++ b/src/utils/order.ts @@ -108,6 +108,9 @@ export async function order({ LoggerInstance.debug('[order] order type', asset.accessDetails?.type) + const templateId = Number(asset.accessDetails?.templateId) + LoggerInstance.debug('[order] order templateId', templateId) + switch (asset.accessDetails?.type) { case 'fixed': { const freParams = { @@ -120,7 +123,7 @@ export async function order({ marketFeeAddress: ZERO_ADDRESS } as FreOrderParams - if (asset.accessDetails.templateId === 1) { + if (templateId === 1) { // buy datatoken const txApprove = await approve( signer, @@ -137,6 +140,7 @@ export async function order({ false ) if (!txApprove) { + LoggerInstance.error('Unable to approve datatoken tx') return } const fre = new FixedRateExchange( @@ -160,7 +164,7 @@ export async function order({ ) } - if (asset.accessDetails.templateId === 2) { + if (templateId === 2) { const txApprove = await approve( signer, config, @@ -175,9 +179,12 @@ export async function order({ ), false ) + if (!txApprove) { + LoggerInstance.debug('Unable to approve datatoken tx') return } + return await datatoken.buyFromFreAndOrder( asset.accessDetails.datatoken.address, orderParams, @@ -189,10 +196,10 @@ export async function order({ case 'free': { LoggerInstance.debug( '[order] order with type "free" for templateId:', - asset.accessDetails.templateId + templateId ) - if (asset.accessDetails.templateId === 1) { + if (templateId === 1) { const dispenser = new Dispenser(config.dispenserAddress, signer) LoggerInstance.debug('[order] free order: dispenser', dispenser.address) const dispenserTx = await dispenser.dispense( @@ -213,7 +220,7 @@ export async function order({ orderParams._consumeMarketFee ) } - if (asset.accessDetails.templateId === 2) { + if (templateId === 2) { LoggerInstance.debug('[order] buying from datatoken', { datatoken: asset.services[0].datatokenAddress, accountId, From 617a298b736ce0dec6e2c0093f645fa4c795f546 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 4 Sep 2023 13:40:22 +0200 Subject: [PATCH 06/10] Release 0.3.0-alpha13 --- CHANGELOG.md | 11 +++++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e6bea..963a261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ 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). -#### [v0.3.0-alpha12](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha12) +#### [v0.3.0-alpha13](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha13) - Feat/ethers [`#53`](https://github.com/deltaDAO/nautilus/pull/53) - test: remove unused files [`bc30177`](https://github.com/deltaDAO/nautilus/commit/bc30177919e500c4ae165656a30f4242a687ef5c) @@ -66,10 +66,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - refactor: use object as argument for getDDO [`50128d4`](https://github.com/deltaDAO/nautilus/commit/50128d407e710f21919db4ab577fbf21e551c42b) - refactor: use early return [`e866001`](https://github.com/deltaDAO/nautilus/commit/e8660017a65fc49f6439edcbfadb335e602e00d2) -#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha11...v0.3.0-alpha2) +#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha12...v0.3.0-alpha2) > 14 August 2023 +#### [v0.3.0-alpha12](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha11...v0.3.0-alpha12) + +> 4 September 2023 + +- Release 0.3.0-alpha12 [`b4df016`](https://github.com/deltaDAO/nautilus/commit/b4df016a3c5d64ea22c67d85f2d2e8b1ba41709a) +- deps: update @oceanprotocol/lib to 3.1.1 (ocean.js) [`d6e0235`](https://github.com/deltaDAO/nautilus/commit/d6e02352ddcb6f59247155cf91a8d99c34a6de31) + #### [v0.3.0-alpha11](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha10...v0.3.0-alpha11) > 4 September 2023 diff --git a/package-lock.json b/package-lock.json index 862e339..4c269e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha12", + "version": "0.3.0-alpha13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha12", + "version": "0.3.0-alpha13", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/lib": "^3.1.1", diff --git a/package.json b/package.json index ae96543..add7ae3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@deltadao/nautilus", "source": "./src/index.ts", - "version": "0.3.0-alpha12", + "version": "0.3.0-alpha13", "description": "A typescript library enabling automated publish & consume in Ocean Protocol ecosystems", "main": "./dist/lib.js", "umd:main": "./dist/lib.umd.js", From a56cec8b41b4d5f8f879b7807c56d6c95dbe3cf4 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 4 Sep 2023 14:13:38 +0200 Subject: [PATCH 07/10] fix: wait for order txs to be included in chain --- src/access/index.ts | 4 +++- src/compute/index.ts | 10 ++++++---- src/utils/order.ts | 14 +++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/access/index.ts b/src/access/index.ts index 58d4717..fac16fa 100644 --- a/src/access/index.ts +++ b/src/access/index.ts @@ -97,7 +97,9 @@ export async function access(accessConfig: AccessConfig) { providerFees: initializeData?.providerFee }) - assetWithAccessDetails.accessDetails.validOrderTx = orderTx.hash + const tx = await orderTx.wait() + + assetWithAccessDetails.accessDetails.validOrderTx = tx?.transactionHash return await getAssetDownloadUrl( assetWithPrice, signer, diff --git a/src/compute/index.ts b/src/compute/index.ts index 48c9daf..c035824 100644 --- a/src/compute/index.ts +++ b/src/compute/index.ts @@ -381,8 +381,9 @@ export async function handleComputeOrder( providerFees: initializeData.providerFee }) if (!txReuseOrder) throw new Error('Failed to reuse order!') - LoggerInstance.debug('[compute] Reused order:', txReuseOrder) - return txReuseOrder?.hash + const tx = await txReuseOrder.wait() + LoggerInstance.debug('[compute] Reused order:', tx) + return tx?.transactionHash } LoggerInstance.debug('[compute] Calling order ...', initializeData) @@ -395,8 +396,9 @@ export async function handleComputeOrder( providerFees: initializeData?.providerFee, computeConsumerAddress }) - LoggerInstance.debug('[compute] Order succeeded', txStartOrder) - return txStartOrder?.hash + const tx = await txStartOrder.wait() + LoggerInstance.debug('[compute] Order succeeded', tx) + return tx?.transactionHash } catch (error) { LoggerInstance.error(`[compute] ${error.message}`) } diff --git a/src/utils/order.ts b/src/utils/order.ts index 3b23fbe..228e4c2 100644 --- a/src/utils/order.ts +++ b/src/utils/order.ts @@ -125,7 +125,7 @@ export async function order({ if (templateId === 1) { // buy datatoken - const txApprove = await approve( + const tx = await approve( signer, config, accountId, @@ -139,6 +139,9 @@ export async function order({ ), false ) + + const txApprove = typeof tx !== 'number' ? await tx.wait() : tx + if (!txApprove) { LoggerInstance.error('Unable to approve datatoken tx') return @@ -154,6 +157,7 @@ export async function order({ ZERO_ADDRESS, '0' ) + await freTx.wait() return await datatoken.startOrder( asset.accessDetails.datatoken.address, @@ -165,7 +169,7 @@ export async function order({ } if (templateId === 2) { - const txApprove = await approve( + const tx = await approve( signer, config, accountId, @@ -180,8 +184,10 @@ export async function order({ false ) + const txApprove = typeof tx !== 'number' ? await tx.wait() : tx + if (!txApprove) { - LoggerInstance.debug('Unable to approve datatoken tx') + LoggerInstance.error('Unable to approve datatoken tx') return } @@ -207,6 +213,8 @@ export async function order({ '1', accountId ) + await dispenserTx.wait() + LoggerInstance.debug( '[order] free order: dispenser tx', dispenserTx.hash From 7add1a12644ce8948231e31fc91e22ee86158803 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 4 Sep 2023 14:14:23 +0200 Subject: [PATCH 08/10] Release 0.3.0-alpha14 --- CHANGELOG.md | 11 +++++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 963a261..e2ed639 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ 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). -#### [v0.3.0-alpha13](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha13) +#### [v0.3.0-alpha14](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha14) - Feat/ethers [`#53`](https://github.com/deltaDAO/nautilus/pull/53) - test: remove unused files [`bc30177`](https://github.com/deltaDAO/nautilus/commit/bc30177919e500c4ae165656a30f4242a687ef5c) @@ -66,10 +66,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - refactor: use object as argument for getDDO [`50128d4`](https://github.com/deltaDAO/nautilus/commit/50128d407e710f21919db4ab577fbf21e551c42b) - refactor: use early return [`e866001`](https://github.com/deltaDAO/nautilus/commit/e8660017a65fc49f6439edcbfadb335e602e00d2) -#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha12...v0.3.0-alpha2) +#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha13...v0.3.0-alpha2) > 14 August 2023 +#### [v0.3.0-alpha13](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha12...v0.3.0-alpha13) + +> 4 September 2023 + +- Release 0.3.0-alpha13 [`617a298`](https://github.com/deltaDAO/nautilus/commit/617a298b736ce0dec6e2c0093f645fa4c795f546) +- fix: cast templateId to Number [`8a62cfb`](https://github.com/deltaDAO/nautilus/commit/8a62cfb70d458b37c4ef060e429ec305ec82b7f0) + #### [v0.3.0-alpha12](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha11...v0.3.0-alpha12) > 4 September 2023 diff --git a/package-lock.json b/package-lock.json index 4c269e0..40d57f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha13", + "version": "0.3.0-alpha14", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha13", + "version": "0.3.0-alpha14", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/lib": "^3.1.1", diff --git a/package.json b/package.json index add7ae3..b93bcd6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@deltadao/nautilus", "source": "./src/index.ts", - "version": "0.3.0-alpha13", + "version": "0.3.0-alpha14", "description": "A typescript library enabling automated publish & consume in Ocean Protocol ecosystems", "main": "./dist/lib.js", "umd:main": "./dist/lib.umd.js", From 203964c4112b04d55f7af066fc5c8549cb11f391 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 4 Sep 2023 15:25:17 +0200 Subject: [PATCH 09/10] fix: wait for chain during publish --- src/@types/Publish.ts | 4 ++-- src/Nautilus/Nautilus.ts | 35 +++++++++++++++++------------------ src/publish/index.ts | 10 +++++++--- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/@types/Publish.ts b/src/@types/Publish.ts index 4479497..6ccbf05 100644 --- a/src/@types/Publish.ts +++ b/src/@types/Publish.ts @@ -100,8 +100,8 @@ export interface PublishResponse { services: { service: NautilusService datatokenAddress: string - pricingTransactionReceipt: providers.TransactionResponse + tx: providers.TransactionReceipt }[] ddo: DDO - setMetadataTxReceipt: providers.TransactionResponse + setMetadataTxReceipt: providers.TransactionReceipt } diff --git a/src/Nautilus/Nautilus.ts b/src/Nautilus/Nautilus.ts index a032d6d..b728604 100644 --- a/src/Nautilus/Nautilus.ts +++ b/src/Nautilus/Nautilus.ts @@ -139,28 +139,27 @@ export class Nautilus { const services = await getAllPromisesOnArray( asset.ddo.services, async (service) => { - const { datatokenAddress, pricingTransactionReceipt } = - await createDatatokenAndPricing({ - signer, - chainConfig, - nftAddress, - pricing: { - ...service.pricing, - freCreationParams: { - ...service.pricing.freCreationParams, - owner: asset.owner - } - }, - datatokenParams: { - ...service.datatokenCreateParams, - minter: asset.owner, - paymentCollector: asset.owner + const { datatokenAddress, tx } = await createDatatokenAndPricing({ + signer, + chainConfig, + nftAddress, + pricing: { + ...service.pricing, + freCreationParams: { + ...service.pricing.freCreationParams, + owner: asset.owner } - }) + }, + datatokenParams: { + ...service.datatokenCreateParams, + minter: asset.owner, + paymentCollector: asset.owner + } + }) service.datatokenAddress = datatokenAddress - return { service, datatokenAddress, pricingTransactionReceipt } + return { service, datatokenAddress, tx } } ) diff --git a/src/publish/index.ts b/src/publish/index.ts index 58c19a5..66b24d3 100644 --- a/src/publish/index.ts +++ b/src/publish/index.ts @@ -116,7 +116,9 @@ export async function createDatatokenAndPricing(config: CreateDatatokenConfig) { pricingTransactionReceipt ) - return { datatokenAddress, pricingTransactionReceipt } + const tx = await pricingTransactionReceipt.wait() + + return { datatokenAddress, tx } } export async function publishDDO(config: PublishDDOConfig) { @@ -167,12 +169,14 @@ export async function publishDDO(config: PublishDDOConfig) { validateResult.hash ) + const tx = await transactionReceipt.wait() + LoggerInstance.debug(`[publish] Published metadata on NFT.`, { ddo, - transactionReceipt + tx: tx.transactionHash }) - return transactionReceipt + return tx } // TODO evaluate if we need these (1 transaction for multiple actions) From 6001129e1761cf31f38e96c03f98e8066fa2aa98 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 4 Sep 2023 15:25:51 +0200 Subject: [PATCH 10/10] Release 0.3.0-alpha15 --- CHANGELOG.md | 13 ++++++++++--- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ed639..a157c7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,12 @@ 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). -#### [v0.3.0-alpha14](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha14) +#### [v0.3.0-alpha15](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha9...v0.3.0-alpha15) - Feat/ethers [`#53`](https://github.com/deltaDAO/nautilus/pull/53) - test: remove unused files [`bc30177`](https://github.com/deltaDAO/nautilus/commit/bc30177919e500c4ae165656a30f4242a687ef5c) +- fix: wait for chain during publish [`203964c`](https://github.com/deltaDAO/nautilus/commit/203964c4112b04d55f7af066fc5c8549cb11f391) - refactor: move ProviderInstance call to provider.ts utils file [`6e31ff5`](https://github.com/deltaDAO/nautilus/commit/6e31ff5a4a538594de85caa2a85048f1c555ab56) -- Release 0.3.0-alpha11 [`e056191`](https://github.com/deltaDAO/nautilus/commit/e056191dbba3b277360bcfb4dab494592b47e6ef) #### [v0.3.0-alpha9](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha8...v0.3.0-alpha9) @@ -66,10 +66,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - refactor: use object as argument for getDDO [`50128d4`](https://github.com/deltaDAO/nautilus/commit/50128d407e710f21919db4ab577fbf21e551c42b) - refactor: use early return [`e866001`](https://github.com/deltaDAO/nautilus/commit/e8660017a65fc49f6439edcbfadb335e602e00d2) -#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha13...v0.3.0-alpha2) +#### [v0.3.0-alpha2](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha14...v0.3.0-alpha2) > 14 August 2023 +#### [v0.3.0-alpha14](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha13...v0.3.0-alpha14) + +> 4 September 2023 + +- fix: wait for order txs to be included in chain [`a56cec8`](https://github.com/deltaDAO/nautilus/commit/a56cec8b41b4d5f8f879b7807c56d6c95dbe3cf4) +- Release 0.3.0-alpha14 [`7add1a1`](https://github.com/deltaDAO/nautilus/commit/7add1a12644ce8948231e31fc91e22ee86158803) + #### [v0.3.0-alpha13](https://github.com/deltaDAO/nautilus/compare/v0.3.0-alpha12...v0.3.0-alpha13) > 4 September 2023 diff --git a/package-lock.json b/package-lock.json index 40d57f2..4746923 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha14", + "version": "0.3.0-alpha15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@deltadao/nautilus", - "version": "0.3.0-alpha14", + "version": "0.3.0-alpha15", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/lib": "^3.1.1", diff --git a/package.json b/package.json index b93bcd6..9cc4690 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@deltadao/nautilus", "source": "./src/index.ts", - "version": "0.3.0-alpha14", + "version": "0.3.0-alpha15", "description": "A typescript library enabling automated publish & consume in Ocean Protocol ecosystems", "main": "./dist/lib.js", "umd:main": "./dist/lib.umd.js",