mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
added new file metadata structure and reorganize tokens and types
This commit is contained in:
parent
cb7e4dc948
commit
1bdef71d54
@ -97,7 +97,7 @@ export interface AssetLastEvent {
|
||||
datetime: string
|
||||
}
|
||||
|
||||
export class Asset extends DDO {
|
||||
export interface Asset extends DDO {
|
||||
/**
|
||||
* Contains information about the ERC721 NFT contract which represents the intellectual property of the publisher.
|
||||
* @type {string}
|
@ -6,49 +6,49 @@ import { Credentials } from './Credentials'
|
||||
* DID Descriptor Object.
|
||||
* Contains metadata about the asset, and define access in at least one service.
|
||||
*/
|
||||
export class DDO {
|
||||
export interface DDO {
|
||||
/**
|
||||
* Contexts used for validation.
|
||||
* @type {string[]}
|
||||
*/
|
||||
public '@context': string[]
|
||||
'@context': string[]
|
||||
|
||||
/**
|
||||
* DID, descentralized ID.
|
||||
* Computed as sha256(address of ERC721 contract + chainId)
|
||||
* @type {string}
|
||||
*/
|
||||
public id: string
|
||||
id: string
|
||||
|
||||
/**
|
||||
* Version information in SemVer notation
|
||||
* referring to the DDO spec version
|
||||
* @type {string}
|
||||
*/
|
||||
public version: string
|
||||
version: string
|
||||
|
||||
/**
|
||||
* ChainId of the network the DDO was published to.
|
||||
* @type {number}
|
||||
*/
|
||||
public chainId: number
|
||||
chainId: number
|
||||
|
||||
/**
|
||||
* Stores an object describing the asset.
|
||||
* @type {Metadata}
|
||||
*/
|
||||
public metadata: Metadata
|
||||
metadata: Metadata
|
||||
|
||||
/**
|
||||
* Stores an array of services defining access to the asset.
|
||||
* @type {Service[]}
|
||||
*/
|
||||
public services: Service[]
|
||||
services: Service[]
|
||||
|
||||
/**
|
||||
* Describes the credentials needed to access a dataset
|
||||
* in addition to the services definition.
|
||||
* @type {Credentials}
|
||||
*/
|
||||
public credentials?: Credentials
|
||||
credentials?: Credentials
|
||||
}
|
@ -1,10 +1,16 @@
|
||||
export interface FileMetadata {
|
||||
/**
|
||||
* File URL.
|
||||
* @type {string}
|
||||
*/
|
||||
type: string
|
||||
|
||||
/**
|
||||
* File format, if applicable.
|
||||
* @type {string}
|
||||
* @example "text/csv"
|
||||
*/
|
||||
contentType: string
|
||||
contentType?: string
|
||||
|
||||
/**
|
||||
* File content length.
|
||||
@ -23,4 +29,10 @@ export interface FileMetadata {
|
||||
* @type {string}
|
||||
*/
|
||||
url?: string
|
||||
|
||||
/**
|
||||
* HTTP method used
|
||||
* @type {string}
|
||||
*/
|
||||
method?: string
|
||||
}
|
@ -3,3 +3,4 @@ export * from './Asset'
|
||||
export * from './Service'
|
||||
export * from './Credentials'
|
||||
export * from './Metadata'
|
||||
export * from './FileMetadata'
|
@ -1,2 +0,0 @@
|
||||
export * from './Datatoken'
|
||||
export * from './NFTDatatoken'
|
@ -1,5 +1,5 @@
|
||||
export * from './pools'
|
||||
export * from './datatokens'
|
||||
export * from './tokens'
|
||||
export * from './factories'
|
||||
export * from './models'
|
||||
export * from './utils'
|
||||
|
@ -5,7 +5,7 @@ import { TransactionReceipt } from 'web3-eth'
|
||||
import Decimal from 'decimal.js'
|
||||
import defaultDispenserABI from '@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json'
|
||||
import { LoggerInstance as logger, getFairGasPrice } from '../../utils/'
|
||||
import { Datatoken } from '.../../../src/datatokens/'
|
||||
import { Datatoken } from '../../tokens'
|
||||
|
||||
export interface DispenserToken {
|
||||
active: boolean
|
||||
|
@ -1,8 +1,7 @@
|
||||
import Web3 from 'web3'
|
||||
import { Config } from '../models'
|
||||
import { LoggerInstance } from '../utils'
|
||||
import { Asset } from '../ddo/Asset'
|
||||
import { FileMetadata } from '../interfaces/FileMetadata'
|
||||
import { Asset, FileMetadata } from '../@types/'
|
||||
import { noZeroX } from '../utils/ConversionTypeHelper'
|
||||
import { signText } from '../utils/SignatureUtils'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Web3 from 'web3'
|
||||
import { AbiItem } from 'web3-utils'
|
||||
import { TransactionReceipt } from 'web3-eth'
|
||||
import defaultNFTDatatokenABI from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC721Template.sol/ERC721Template.json'
|
||||
import defaultNFTABI from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC721Template.sol/ERC721Template.json'
|
||||
import { LoggerInstance, getFairGasPrice, generateDtName } from '../utils'
|
||||
import { Contract } from 'web3-eth-contract'
|
||||
|
||||
@ -15,16 +15,16 @@ interface Roles {
|
||||
store: boolean
|
||||
}
|
||||
|
||||
export class NFTDatatoken {
|
||||
export class NFT {
|
||||
public GASLIMIT_DEFAULT = 1000000
|
||||
public factory721Address: string
|
||||
public factory721ABI: AbiItem | AbiItem[]
|
||||
public nftDatatokenABI: AbiItem | AbiItem[]
|
||||
public nftABI: AbiItem | AbiItem[]
|
||||
public web3: Web3
|
||||
public startBlock: number
|
||||
|
||||
constructor(web3: Web3, nftDatatokenABI?: AbiItem | AbiItem[], startBlock?: number) {
|
||||
this.nftDatatokenABI = nftDatatokenABI || (defaultNFTDatatokenABI.abi as AbiItem[])
|
||||
constructor(web3: Web3, nftABI?: AbiItem | AbiItem[], startBlock?: number) {
|
||||
this.nftABI = nftABI || (defaultNFTABI.abi as AbiItem[])
|
||||
this.web3 = web3
|
||||
this.startBlock = startBlock || 0
|
||||
}
|
||||
@ -60,7 +60,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
try {
|
||||
@ -115,7 +115,7 @@ export class NFTDatatoken {
|
||||
}
|
||||
|
||||
// Create 721contract object
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const estGas = await this.estGasCreateERC20(
|
||||
nftAddress,
|
||||
@ -171,7 +171,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
) {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -193,7 +193,7 @@ export class NFTDatatoken {
|
||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||
*/
|
||||
public async addManager(nftAddress: string, address: string, manager: string) {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
if ((await this.getNFTOwner(nftAddress)) !== address) {
|
||||
throw new Error(`Caller is not NFT Owner`)
|
||||
@ -226,7 +226,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
) {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
try {
|
||||
@ -247,7 +247,7 @@ export class NFTDatatoken {
|
||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||
*/
|
||||
public async removeManager(nftAddress: string, address: string, manager: string) {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
if ((await this.getNFTOwner(nftAddress)) !== address) {
|
||||
throw new Error(`Caller is not NFT Owner`)
|
||||
@ -285,7 +285,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
try {
|
||||
@ -311,7 +311,7 @@ export class NFTDatatoken {
|
||||
address: string,
|
||||
erc20Deployer: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
|
||||
// throw new Error(`Caller is not Manager`)
|
||||
@ -352,7 +352,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -379,7 +379,7 @@ export class NFTDatatoken {
|
||||
address: string,
|
||||
erc20Deployer: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
|
||||
// throw new Error(`Caller is not Manager`)
|
||||
@ -419,7 +419,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -445,7 +445,7 @@ export class NFTDatatoken {
|
||||
address: string,
|
||||
metadataUpdater: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
|
||||
// throw new Error(`Caller is not Manager`)
|
||||
@ -483,7 +483,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -510,7 +510,7 @@ export class NFTDatatoken {
|
||||
address: string,
|
||||
metadataUpdater: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
|
||||
// throw new Error(`Caller is not Manager`)
|
||||
@ -550,7 +550,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -576,7 +576,7 @@ export class NFTDatatoken {
|
||||
address: string,
|
||||
storeUpdater: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
|
||||
// throw new Error(`Caller is not Manager`)
|
||||
@ -614,7 +614,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -640,7 +640,7 @@ export class NFTDatatoken {
|
||||
address: string,
|
||||
storeUpdater: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
|
||||
// throw new Error(`Caller is not Manager`)
|
||||
@ -678,7 +678,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -706,7 +706,7 @@ export class NFTDatatoken {
|
||||
nftAddress: string,
|
||||
address: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
if ((await this.getNFTOwner(nftAddress)) !== address) {
|
||||
throw new Error(`Caller is not NFT Owner`)
|
||||
@ -741,7 +741,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -773,7 +773,7 @@ export class NFTDatatoken {
|
||||
nftReceiver: string,
|
||||
tokenId?: number
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
if ((await this.getNFTOwner(nftAddress)) !== nftOwner) {
|
||||
throw new Error(`Caller is not NFT Owner`)
|
||||
@ -818,7 +818,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -850,7 +850,7 @@ export class NFTDatatoken {
|
||||
nftReceiver: string,
|
||||
tokenId?: number
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
if ((await this.getNFTOwner(nftAddress)) !== nftOwner) {
|
||||
throw new Error(`Caller is not NFT Owner`)
|
||||
@ -899,7 +899,7 @@ export class NFTDatatoken {
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract =
|
||||
contractInstance || new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
contractInstance || new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||
let estGas
|
||||
@ -942,7 +942,7 @@ export class NFTDatatoken {
|
||||
data: string,
|
||||
metadataHash: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
|
||||
// if (!(await this.getNFTPermissions(nftAddress, address)).updateMetadata) {
|
||||
// throw new Error(`Caller is not NFT Owner`)
|
||||
@ -984,7 +984,7 @@ export class NFTDatatoken {
|
||||
* @return {Promise<string>} string
|
||||
*/
|
||||
public async getNFTOwner(nftAddress: string): Promise<string> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const trxReceipt = await nftContract.methods.ownerOf(1).call()
|
||||
return trxReceipt
|
||||
}
|
||||
@ -995,7 +995,7 @@ export class NFTDatatoken {
|
||||
* @return {Promise<Roles>}
|
||||
*/
|
||||
public async getNFTPermissions(nftAddress: string, address: string): Promise<Roles> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const roles = await nftContract.methods.getPermissions(address).call()
|
||||
return roles
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ export class NFTDatatoken {
|
||||
* @return {Promise<Roles>}
|
||||
*/
|
||||
public async isErc20Deployer(nftAddress: string, address: string): Promise<boolean> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const isERC20Deployer = await nftContract.methods.isERC20Deployer(address).call()
|
||||
return isERC20Deployer
|
||||
}
|
||||
@ -1017,7 +1017,7 @@ export class NFTDatatoken {
|
||||
* @return {Promise<string>} The data stored at the key
|
||||
*/
|
||||
public async getData(nftAddress: string, key: string): Promise<string> {
|
||||
const nftContract = new this.web3.eth.Contract(this.nftDatatokenABI, nftAddress)
|
||||
const nftContract = new this.web3.eth.Contract(this.nftABI, nftAddress)
|
||||
const data = await nftContract.methods.getData(key).call()
|
||||
return data
|
||||
}
|
2
src/tokens/index.ts
Normal file
2
src/tokens/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './Datatoken'
|
||||
export * from './NFT'
|
@ -12,7 +12,7 @@ import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/M
|
||||
import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json'
|
||||
import OPFCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json'
|
||||
import { NFTFactory, NFTCreateData } from '../../../../src/factories/'
|
||||
import { Datatoken, DispenserParams } from '../../../../src/datatokens/'
|
||||
import { Datatoken, DispenserParams } from '../../../../src/tokens/'
|
||||
import { Dispenser } from '../../../../src/pools/dispenser/'
|
||||
import { TestContractHandler } from '../../../TestContractHandler'
|
||||
import { Erc20CreateParams } from '../../../../src/interfaces'
|
||||
|
@ -14,12 +14,7 @@ import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/M
|
||||
|
||||
import { TestContractHandler } from '../../TestContractHandler'
|
||||
import { NFTFactory, NFTCreateData } from '../../../src/factories/NFTFactory'
|
||||
import {
|
||||
Datatoken,
|
||||
NFTDatatoken,
|
||||
OrderParams,
|
||||
DispenserParams
|
||||
} from '../../../src/datatokens'
|
||||
import { Datatoken, NFT, OrderParams, DispenserParams } from '../../../src/tokens'
|
||||
import { AbiItem } from 'web3-utils'
|
||||
import { LoggerInstance } from '../../../src/utils'
|
||||
import { FreCreationParams, FreOrderParams } from '../../../src/interfaces'
|
||||
@ -32,7 +27,7 @@ describe('Datatoken', () => {
|
||||
let user2: string
|
||||
let user3: string
|
||||
let contractHandler: TestContractHandler
|
||||
let nftDatatoken: NFTDatatoken
|
||||
let nftDatatoken: NFT
|
||||
let datatoken: Datatoken
|
||||
let nftFactory: NFTFactory
|
||||
let nftAddress: string
|
||||
@ -96,7 +91,7 @@ describe('Datatoken', () => {
|
||||
}
|
||||
|
||||
nftAddress = await nftFactory.createNFT(nftOwner, nftData)
|
||||
nftDatatoken = new NFTDatatoken(web3, ERC721Template.abi as AbiItem[])
|
||||
nftDatatoken = new NFT(web3, ERC721Template.abi as AbiItem[])
|
||||
})
|
||||
|
||||
it('#createERC20 - should create a new ERC20 DT from NFT contract', async () => {
|
@ -10,23 +10,20 @@ import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/template
|
||||
import Dispenser from '@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json'
|
||||
import FixedRate from '@oceanprotocol/contracts/artifacts/contracts/pools/fixedRate/FixedRateExchange.sol/FixedRateExchange.json'
|
||||
import OPFCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json'
|
||||
import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/MockERC20Decimals.sol/MockERC20Decimals.json'
|
||||
|
||||
import { TestContractHandler } from '../../TestContractHandler'
|
||||
import { NFTFactory, NFTCreateData } from '../../../src/factories/NFTFactory'
|
||||
import { NFTDatatoken } from '../../../src/datatokens/NFTDatatoken'
|
||||
import { NFT } from '../../../src/tokens/NFT'
|
||||
import { AbiItem } from 'web3-utils'
|
||||
import { LoggerInstance } from '../../../src/utils'
|
||||
|
||||
const web3 = new Web3('http://127.0.0.1:8545')
|
||||
|
||||
describe('NFTDatatoken', () => {
|
||||
describe('NFT', () => {
|
||||
let nftOwner: string
|
||||
let user1: string
|
||||
let user2: string
|
||||
let user3: string
|
||||
let contractHandler: TestContractHandler
|
||||
let nftDatatoken: NFTDatatoken
|
||||
let nftDatatoken: NFT
|
||||
let nftFactory: NFTFactory
|
||||
let nftAddress: string
|
||||
|
||||
@ -80,7 +77,7 @@ describe('NFTDatatoken', () => {
|
||||
}
|
||||
|
||||
nftAddress = await nftFactory.createNFT(nftOwner, nftData)
|
||||
nftDatatoken = new NFTDatatoken(web3, ERC721Template.abi as AbiItem[])
|
||||
nftDatatoken = new NFT(web3, ERC721Template.abi as AbiItem[])
|
||||
})
|
||||
|
||||
it('#createERC20 - should create a new ERC20 DT from NFT contract', async () => {
|
Loading…
x
Reference in New Issue
Block a user