Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple fixes #1785

Merged
merged 11 commits into from
May 9, 2024
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['15', '16']
node: ['20', '18']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'

- name: checkout ocean.js repo
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
registry-url: https://registry.npmjs.org/
- run: npm ci

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
13 changes: 12 additions & 1 deletion src/utils/ContractUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ethers, Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers'

import { Config } from '../config'
import { minAbi } from '.'
import { LoggerInstance, minAbi } from '.'

const MIN_GAS_FEE_POLYGON = 30000000000 // minimum recommended 30 gwei polygon main and mumbai fees
const MIN_GAS_FEE_SEPOLIA = 4000000000 // minimum 4 gwei for eth sepolia testnet
const POLYGON_NETWORK_ID = 137
const MUMBAI_NETWORK_ID = 80001
const SEPOLIA_NETWORK_ID = 11155111

export function setContractDefaults(contract: Contract, config: Config): Contract {
// TO DO - since ethers does not provide this
Expand Down Expand Up @@ -134,11 +136,18 @@ export async function sendTx(
(chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) &&
Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_POLYGON
? MIN_GAS_FEE_POLYGON
: chainId === SEPOLIA_NETWORK_ID &&
Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_SEPOLIA
? MIN_GAS_FEE_SEPOLIA
: Number(aggressiveFeePriorityFeePerGas),

maxFeePerGas:
(chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) &&
Number(aggressiveFeePerGas) < MIN_GAS_FEE_POLYGON
? MIN_GAS_FEE_POLYGON
: chainId === SEPOLIA_NETWORK_ID &&
Number(aggressiveFeePerGas) < MIN_GAS_FEE_SEPOLIA
? MIN_GAS_FEE_SEPOLIA
: Number(aggressiveFeePerGas)
}
} else {
Expand All @@ -149,8 +158,10 @@ export async function sendTx(
overrides.gasLimit = estGas.add(20000)
try {
const trxReceipt = await functionToSend(...args, overrides)
await trxReceipt.wait()
return trxReceipt
} catch (e) {
LoggerInstance.error('Send tx error: ', e)
return null
}
}
4 changes: 2 additions & 2 deletions test/integration/PublishEditConsume.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const grapqlFile: Files = {
files: [
{
type: 'graphql',
url: 'https://v4.subgraph.goerli.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
url: 'https://v4.subgraph.sepolia.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
query: `"
query{
nfts(orderBy: createdTimestamp,orderDirection:desc){
Expand Down Expand Up @@ -392,7 +392,7 @@ describe('Publish consume test', async () => {
providerUrl
)
assert(grapqlOrderTx, 'Ordering graphql dataset failed.')
})
}).timeout(40000)

it('Should download the datasets files', async () => {
const urlDownloadUrl = await ProviderInstance.getDownloadUrl(
Expand Down
6 changes: 3 additions & 3 deletions test/integration/PublishFlows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ describe('Publish tests', async () => {
)
})

delay(10000)
delay(19000)

it('should resolve the fixed price dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(fixedPricedDID)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
})
}).timeout(40000)

it('should publish a dataset with dispenser (create NFT + Datatoken + dispenser) with no defined MetadataProof', async () => {
const dispenserDdo: DDO = { ...genericAsset }
Expand Down Expand Up @@ -289,7 +289,7 @@ describe('Publish tests', async () => {
)
})

delay(10000)
delay(19000)

it('should resolve the free dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(dispenserDID)
Expand Down
Loading