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

Multiple fixes (#1785)

* add sepolia logic

* update min gas fee value

* Release 3.1.5-next.0

* update graphqlAsset url

* update timeouts

* added logs

* update timeouts

* upgrade node version

* cleanups
This commit is contained in:
Bogdan Fazakas 2024-05-09 13:28:38 +03:00 committed by GitHub
parent be52ec26c2
commit 6a6f450780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 13 deletions

View File

@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '20'
- name: Cache node_modules - name: Cache node_modules
uses: actions/cache@v2 uses: actions/cache@v2
env: env:
@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '20'
- name: Cache node_modules - name: Cache node_modules
uses: actions/cache@v2 uses: actions/cache@v2
env: env:
@ -83,7 +83,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '20'
- name: Cache node_modules - name: Cache node_modules
uses: actions/cache@v2 uses: actions/cache@v2
env: env:
@ -155,7 +155,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
node: ['15', '16'] node: ['20', '18']
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -199,7 +199,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '20'
- name: checkout ocean.js repo - name: checkout ocean.js repo
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '20'
registry-url: https://registry.npmjs.org/ registry-url: https://registry.npmjs.org/
- run: npm ci - run: npm ci

2
.nvmrc
View File

@ -1 +1 @@
16 20

View File

@ -1,11 +1,13 @@
import { ethers, Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers' import { ethers, Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers'
import { Config } from '../config' 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_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 POLYGON_NETWORK_ID = 137
const MUMBAI_NETWORK_ID = 80001 const MUMBAI_NETWORK_ID = 80001
const SEPOLIA_NETWORK_ID = 11155111
export function setContractDefaults(contract: Contract, config: Config): Contract { export function setContractDefaults(contract: Contract, config: Config): Contract {
// TO DO - since ethers does not provide this // TO DO - since ethers does not provide this
@ -134,11 +136,18 @@ export async function sendTx(
(chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) && (chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) &&
Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_POLYGON Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_POLYGON
? MIN_GAS_FEE_POLYGON ? MIN_GAS_FEE_POLYGON
: chainId === SEPOLIA_NETWORK_ID &&
Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_SEPOLIA
? MIN_GAS_FEE_SEPOLIA
: Number(aggressiveFeePriorityFeePerGas), : Number(aggressiveFeePriorityFeePerGas),
maxFeePerGas: maxFeePerGas:
(chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) && (chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) &&
Number(aggressiveFeePerGas) < MIN_GAS_FEE_POLYGON Number(aggressiveFeePerGas) < MIN_GAS_FEE_POLYGON
? MIN_GAS_FEE_POLYGON ? MIN_GAS_FEE_POLYGON
: chainId === SEPOLIA_NETWORK_ID &&
Number(aggressiveFeePerGas) < MIN_GAS_FEE_SEPOLIA
? MIN_GAS_FEE_SEPOLIA
: Number(aggressiveFeePerGas) : Number(aggressiveFeePerGas)
} }
} else { } else {
@ -149,8 +158,10 @@ export async function sendTx(
overrides.gasLimit = estGas.add(20000) overrides.gasLimit = estGas.add(20000)
try { try {
const trxReceipt = await functionToSend(...args, overrides) const trxReceipt = await functionToSend(...args, overrides)
await trxReceipt.wait()
return trxReceipt return trxReceipt
} catch (e) { } catch (e) {
LoggerInstance.error('Send tx error: ', e)
return null return null
} }
} }

View File

@ -95,7 +95,7 @@ const grapqlFile: Files = {
files: [ files: [
{ {
type: 'graphql', 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: `"
query{ query{
nfts(orderBy: createdTimestamp,orderDirection:desc){ nfts(orderBy: createdTimestamp,orderDirection:desc){
@ -392,7 +392,7 @@ describe('Publish consume test', async () => {
providerUrl providerUrl
) )
assert(grapqlOrderTx, 'Ordering graphql dataset failed.') assert(grapqlOrderTx, 'Ordering graphql dataset failed.')
}) }).timeout(40000)
it('Should download the datasets files', async () => { it('Should download the datasets files', async () => {
const urlDownloadUrl = await ProviderInstance.getDownloadUrl( const urlDownloadUrl = await ProviderInstance.getDownloadUrl(

View File

@ -196,12 +196,12 @@ describe('Publish tests', async () => {
) )
}) })
delay(10000) delay(19000)
it('should resolve the fixed price dataset', async () => { it('should resolve the fixed price dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(fixedPricedDID) const resolvedDDO = await aquarius.waitForAqua(fixedPricedDID)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius') 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 () => { it('should publish a dataset with dispenser (create NFT + Datatoken + dispenser) with no defined MetadataProof', async () => {
const dispenserDdo: DDO = { ...genericAsset } const dispenserDdo: DDO = { ...genericAsset }
@ -289,7 +289,7 @@ describe('Publish tests', async () => {
) )
}) })
delay(10000) delay(19000)
it('should resolve the free dataset', async () => { it('should resolve the free dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(dispenserDID) const resolvedDDO = await aquarius.waitForAqua(dispenserDID)