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/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
@ -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:
@ -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:
@ -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
@ -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

View File

@ -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

2
.nvmrc
View File

@ -1 +1 @@
16
20

View File

@ -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
@ -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 {
@ -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
}
}

View File

@ -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){
@ -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(

View File

@ -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 }
@ -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)