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

fix: use gas station on polygon networks #528

Merged
merged 6 commits into from
May 31, 2023
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
17 changes: 10 additions & 7 deletions integration/nevermined/ClaimPaymentAbortedAgreement.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { assert } from 'chai'
import { decodeJwt, JWTPayload } from 'jose'
import { Account, DDO, Nevermined, NFTAttributes, AssetPrice } from '../../src'
import { TransferNFT721Condition, Token, Nft721Contract, ConditionState } from '../../src/keeper'
import {
TransferNFT721Condition,
Token,
Nft721Contract,
ConditionState,
ContractHandler,
} from '../../src/keeper'
import { config } from '../config'
import { getMetadata } from '../utils'
import TestContractHandler from '../../test/keeper/TestContractHandler'
import { ethers } from 'ethers'
import { BigNumber, generateId } from '../../src/utils'
import '../globals'
Expand Down Expand Up @@ -45,22 +50,20 @@ describe('Claim aborted agreements End-to-End', () => {
nevermined = await Nevermined.getInstance(config)
;[, publisher, collector1, , other] = await nevermined.accounts.list()

TestContractHandler.setConfig(config)

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc721ABI = await TestContractHandler.getABI(
const erc721ABI = await ContractHandler.getABI(
'NFT721Upgradeable',
config.artifactsFolder,
networkName,
)

nft = await TestContractHandler.deployArtifact(erc721ABI, publisher.getId(), [
nft = await nevermined.utils.contractHandler.deployAbi(erc721ABI, publisher, [
publisher.getId(),
nevermined.keeper.didRegistry.address,
'NFT721',
'NVM',
'',
0,
'0',
])

nftContract = await Nft721Contract.getInstance(
Expand Down
16 changes: 11 additions & 5 deletions integration/nevermined/NFT1155.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import chai, { assert } from 'chai'
import { decodeJwt, JWTPayload } from 'jose'
import chaiAsPromised from 'chai-as-promised'
import { Account, DDO, Nevermined, AssetPrice, AssetAttributes, NFTAttributes } from '../../src'
import {
Account,
DDO,
Nevermined,
AssetPrice,
AssetAttributes,
NFTAttributes,
ContractHandler,
} from '../../src'
import { config } from '../config'
import { getMetadata } from '../utils'
import { getRoyaltyAttributes, RoyaltyKind } from '../../src/nevermined'
import { ethers } from 'ethers'
import { BigNumber } from '../../src/utils'
import '../globals'
import TestContractHandler from '../../test/keeper/TestContractHandler'

chai.use(chaiAsPromised)

Expand Down Expand Up @@ -62,15 +69,14 @@ describe('NFT1155 End-to-End', () => {

describe('As user I can deploy Nevermined ERC-1155 NFT contract instances', () => {
it('Using the ABI', async () => {
TestContractHandler.setConfig(config)
const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc1155ABI = await TestContractHandler.getABI(
const erc1155ABI = await ContractHandler.getABI(
'NFT1155Upgradeable',
config.artifactsFolder,
networkName,
)

nftContract = await TestContractHandler.deployArtifact(erc1155ABI, deployer.getId(), [
nftContract = await nevermined.utils.contractHandler.deployAbi(erc1155ABI, deployer, [
deployer.getId(),
nevermined.keeper.didRegistry.getAddress(),
'NFT1155',
Expand Down
14 changes: 5 additions & 9 deletions integration/nevermined/NFT1155Api.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TransferNFTCondition,
Token,
Nft1155Contract,
ContractHandler,
} from '../../src/keeper'
import { config } from '../config'
import { getMetadata } from '../utils'
Expand All @@ -21,7 +22,6 @@ import { AssetAttributes } from '../../src/models/AssetAttributes'
import { NFTAttributes } from '../../src/models/NFTAttributes'
import { DIDResolvePolicy } from '../../src/nevermined/api/RegistryBaseApi'
import { BigNumber } from '../../src/utils'
import TestContractHandler from '../../test/keeper/TestContractHandler'
import { sleep } from '../utils/utils'

chai.use(chaiAsPromised)
Expand Down Expand Up @@ -85,16 +85,14 @@ function makeTest(isCustom) {
)

if (isCustom) {
TestContractHandler.setConfig(config)

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc1155ABI = await TestContractHandler.getABI(
const erc1155ABI = await ContractHandler.getABI(
'NFT1155Upgradeable',
config.artifactsFolder,
networkName,
)

const nft = await TestContractHandler.deployArtifact(erc1155ABI, artist.getId(), [
const nft = await nevermined.utils.contractHandler.deployAbi(erc1155ABI, artist, [
artist.getId(),
nevermined.keeper.didRegistry.address,
'NFT1155',
Expand Down Expand Up @@ -455,16 +453,14 @@ function makeTest(isCustom) {

describe('Node should not be able to transfer the nft without the operator role', () => {
it('should create the subscription NFT without granting Nevermined the operator role', async () => {
TestContractHandler.setConfig(config)

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc1155ABI = await TestContractHandler.getABI(
const erc1155ABI = await ContractHandler.getABI(
'NFT1155Upgradeable',
config.artifactsFolder,
networkName,
)

const nft = await TestContractHandler.deployArtifact(erc1155ABI, artist.getId(), [
const nft = await nevermined.utils.contractHandler.deployAbi(erc1155ABI, artist, [
artist.getId(),
nevermined.keeper.didRegistry.address,
'NFT1155',
Expand Down
11 changes: 4 additions & 7 deletions integration/nevermined/NFT721.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { decodeJwt, JWTPayload } from 'jose'
import { config } from '../config'
import { getMetadata } from '../utils'
import { Nevermined, Account, DDO, NFTAttributes, AssetPrice } from '../../src'
import TestContractHandler from '../../test/keeper/TestContractHandler'
import { generateId, ZeroAddress, zeroX } from '../../src/utils'
import { TokenUtils } from '../../src/nevermined'
import { ethers } from 'ethers'
import { Nft721Contract, TransferNFT721Condition } from '../../src/keeper'
import { ContractHandler, Nft721Contract, TransferNFT721Condition } from '../../src/keeper'
import { BigNumber } from '../../src/utils'

describe('Nfts721 operations', async () => {
Expand All @@ -31,23 +30,21 @@ describe('Nfts721 operations', async () => {
// Accounts
;[deployer, artist, collector] = await nevermined.accounts.list()

TestContractHandler.setConfig(config)

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc721ABI = await TestContractHandler.getABI(
const erc721ABI = await ContractHandler.getABI(
'NFT721Upgradeable',
config.artifactsFolder,
networkName,
)

// deploy a nft contract we can use
nft = await TestContractHandler.deployArtifact(erc721ABI, deployer.getId(), [
nft = await nevermined.utils.contractHandler.deployAbi(erc721ABI, deployer, [
artist.getId(),
nevermined.keeper.didRegistry.address,
'NFT721',
'NVM',
'',
0,
'0',
])
nftContract = await Nft721Contract.getInstance(
(nevermined.keeper as any).instanceConfig,
Expand Down
10 changes: 4 additions & 6 deletions integration/nevermined/NFT721Api.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
TransferNFT721Condition,
Token,
Nft721Contract,
ContractHandler,
} from '../../src/keeper'
import { config } from '../config'
import { getMetadata } from '../utils'
import TestContractHandler from '../../test/keeper/TestContractHandler'
import { ethers } from 'ethers'
import { BigNumber } from '../../src/utils'
import '../globals'
Expand Down Expand Up @@ -48,22 +48,20 @@ describe('NFTs721 Api End-to-End', () => {
nevermined = await Nevermined.getInstance(config)
;[, artist, collector1, , gallery] = await nevermined.accounts.list()

TestContractHandler.setConfig(config)

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc721ABI = await TestContractHandler.getABI(
const erc721ABI = await ContractHandler.getABI(
'NFT721Upgradeable',
config.artifactsFolder,
networkName,
)

nft = await TestContractHandler.deployArtifact(erc721ABI, artist.getId(), [
nft = await nevermined.utils.contractHandler.deployAbi(erc721ABI, artist, [
artist.getId(),
nevermined.keeper.didRegistry.address,
'NFT721',
'NVM',
'',
0,
'0',
])

nftContract = await Nft721Contract.getInstance(
Expand Down
16 changes: 7 additions & 9 deletions integration/nevermined/NFT721Templates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import {
Token,
NFT721AccessTemplate,
NFT721SalesTemplate,
ContractHandler,
} from '../../src/keeper'
import { config } from '../config'
import TestContractHandler from '../../test/keeper/TestContractHandler'
import { NFT721Api } from '../../src'
import { getMetadata } from '../utils'
import { setNFTRewardsFromDDOByService } from '../../src/utils'
Expand Down Expand Up @@ -88,25 +88,23 @@ describe('NFT721Templates E2E', () => {

before(async () => {
nevermined = await Nevermined.getInstance(config)

TestContractHandler.setConfig(config)
;[owner, artist, collector1, collector2, gallery] = await nevermined.accounts.list()

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc721ABI = await TestContractHandler.getABI(
const erc721ABI = await ContractHandler.getABI(
'NFT721Upgradeable',
config.artifactsFolder,
networkName,
)

// deploy a nft contract we can use
const nftContract = await TestContractHandler.deployArtifact(erc721ABI, artist.getId(), [
const nftContract = await nevermined.utils.contractHandler.deployAbi(erc721ABI, artist, [
artist.getId(),
nevermined.keeper.didRegistry.address,
'NFT721',
'NVM',
'',
0,
'0',
])

const clientAssertion = await nevermined.utils.jwt.generateClientAssertion(artist)
Expand Down Expand Up @@ -612,19 +610,19 @@ describe('NFT721Templates E2E', () => {
)

const networkName = (await nevermined.keeper.getNetworkName()).toLowerCase()
const erc721ABI = await TestContractHandler.getABI(
const erc721ABI = await ContractHandler.getABI(
'NFT721Upgradeable',
config.artifactsFolder,
networkName,
)

const nftContract = await TestContractHandler.deployArtifact(erc721ABI, artist.getId(), [
const nftContract = await nevermined.utils.contractHandler.deployAbi(erc721ABI, artist, [
artist.getId(),
nevermined.keeper.didRegistry.address,
'NFT721',
'NVM',
'',
0,
'0',
])
nft = await nevermined.contracts.loadNft721(nftContract.address)

Expand Down
4 changes: 2 additions & 2 deletions integration/nevermined/Poap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ describe('POAPs with Assets', () => {

it('should deploy the contract', async () => {
TestContractHandler.setConfig(config)
poapContract = await TestContractHandler.deployArtifact(POAPUpgradeable, editor.getId(), [
poapContract = await nevermined.utils.contractHandler.deployAbi(POAPUpgradeable, editor, [
editor.getId(),
nevermined.keeper.didRegistry.address,
'NFT721',
'NVM',
'',
0,
'0',
])
assert.isDefined(poapContract)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nevermined-io/sdk",
"version": "1.3.16",
"version": "1.4.0",
"description": "Javascript SDK for connecting with Nevermined Data Platform ",
"main": "./dist/node/sdk.js",
"typings": "./dist/node/sdk.d.ts",
Expand Down
Loading