1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Merge pull request #1853 from oceanprotocol/fix-try-catch-nft-creation

Fix try catch nft creation
This commit is contained in:
Maria Carmina 2024-09-23 16:35:05 +03:00 committed by GitHub
commit eb6d84edce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 34 deletions

View File

@ -16,11 +16,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
@ -35,11 +35,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
@ -71,9 +71,9 @@ jobs:
ls -la "$HOME/.ocean/ocean-contracts/artifacts/"
- run: npm run build:metadata
- run: npm run test:unit:cover
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: coverage
name: coverage-unit
path: coverage/
test_integration:
@ -81,11 +81,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
@ -143,9 +143,9 @@ jobs:
run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_computetodata_1
if: ${{ failure() }}
- name: Upload coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: coverage
name: coverage-integration
path: coverage/
build:
@ -159,11 +159,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Cache node_modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
@ -180,10 +180,12 @@ jobs:
if: ${{ success() && github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: coverage
name: coverage-unit
- uses: actions/download-artifact@v4
with:
name: coverage-integration
- uses: paambaati/codeclimate-action@v2.7.5
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
@ -197,7 +199,7 @@ jobs:
needs: [test_unit, test_integration]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '20'

4
package-lock.json generated
View File

@ -2973,7 +2973,8 @@
"node_modules/@oceanprotocol/contracts": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.0.3.tgz",
"integrity": "sha512-D2YtlsgmhBuSmF/Ue8zMWPtXNiB4zgW09NjUQzvDFrloUo0a7yC8r8L84LrVniw+0Nmly/PhLcdm8i018yc34g=="
"integrity": "sha512-D2YtlsgmhBuSmF/Ue8zMWPtXNiB4zgW09NjUQzvDFrloUo0a7yC8r8L84LrVniw+0Nmly/PhLcdm8i018yc34g==",
"license": "Apache-2.0"
},
"node_modules/@octokit/auth-token": {
"version": "3.0.3",
@ -7953,6 +7954,7 @@
"url": "https://www.buymeacoffee.com/ricmoo"
}
],
"license": "MIT",
"dependencies": {
"@ethersproject/abi": "5.7.0",
"@ethersproject/abstract-provider": "5.7.0",

View File

@ -67,23 +67,27 @@ export class NftFactory extends SmartContractWithAddress {
)
if (estimateGas) return <G extends false ? string : BigNumber>estGas
// Invoke createToken function of the contract
const tx = await sendTx(
estGas,
this.signer,
this.config?.gasFeeMultiplier,
this.contract.deployERC721Contract,
nftData.name,
nftData.symbol,
nftData.templateIndex,
ZERO_ADDRESS,
ZERO_ADDRESS,
nftData.tokenURI,
nftData.transferable,
nftData.owner
)
const trxReceipt = await tx.wait()
const events = getEventFromTx(trxReceipt, 'NFTCreated')
return events.args[0]
try {
const tx = await sendTx(
estGas,
this.signer,
this.config?.gasFeeMultiplier,
this.contract.deployERC721Contract,
nftData.name,
nftData.symbol,
nftData.templateIndex,
ZERO_ADDRESS,
ZERO_ADDRESS,
nftData.tokenURI,
nftData.transferable,
nftData.owner
)
const trxReceipt = await tx.wait()
const events = getEventFromTx(trxReceipt, 'NFTCreated')
return events.args[0]
} catch (e) {
console.error(`Creation of AccessList failed: ${e}`)
}
}
/**