mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fix transferable NFTs (#1309)
- send along `transferable` param when creating NFT - new optional `transferable` param in our `generateNftCreateData()` helper, default to `true`. So we don't need to bother adding this to the publish tx fee component - capture new key in form data, `metadata.transferable`, set to `true` by default. This prepares this to be added as a UI option later on
This commit is contained in:
parent
3dd21bd20d
commit
fc2681231b
@ -5,7 +5,8 @@ import {
|
|||||||
Nft,
|
Nft,
|
||||||
ProviderInstance,
|
ProviderInstance,
|
||||||
DDO,
|
DDO,
|
||||||
MetadataAndTokenURI
|
MetadataAndTokenURI,
|
||||||
|
NftCreateData
|
||||||
} from '@oceanprotocol/lib'
|
} from '@oceanprotocol/lib'
|
||||||
import { SvgWaves } from './SvgWaves'
|
import { SvgWaves } from './SvgWaves'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
@ -64,13 +65,15 @@ const tokenUriPrefix = 'data:application/json;base64,'
|
|||||||
|
|
||||||
export function generateNftCreateData(
|
export function generateNftCreateData(
|
||||||
nftMetadata: NftMetadata,
|
nftMetadata: NftMetadata,
|
||||||
accountId: string
|
accountId: string,
|
||||||
|
transferable = true
|
||||||
): any {
|
): any {
|
||||||
const nftCreateData = {
|
const nftCreateData: NftCreateData = {
|
||||||
name: nftMetadata.name,
|
name: nftMetadata.name,
|
||||||
symbol: nftMetadata.symbol,
|
symbol: nftMetadata.symbol,
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
tokenURI: '',
|
tokenURI: '',
|
||||||
|
transferable,
|
||||||
owner: accountId
|
owner: accountId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ export const initialValues: FormPublishData = {
|
|||||||
},
|
},
|
||||||
metadata: {
|
metadata: {
|
||||||
nft: { name: '', symbol: '', description: '', image_data: '' },
|
nft: { name: '', symbol: '', description: '', image_data: '' },
|
||||||
|
transferable: true,
|
||||||
type: 'dataset',
|
type: 'dataset',
|
||||||
name: '',
|
name: '',
|
||||||
author: '',
|
author: '',
|
||||||
|
@ -29,6 +29,7 @@ export interface FormPublishData {
|
|||||||
}
|
}
|
||||||
metadata: {
|
metadata: {
|
||||||
nft: NftMetadata
|
nft: NftMetadata
|
||||||
|
transferable: boolean
|
||||||
type: 'dataset' | 'algorithm'
|
type: 'dataset' | 'algorithm'
|
||||||
name: string
|
name: string
|
||||||
description: string
|
description: string
|
||||||
|
@ -181,8 +181,7 @@ export async function transformPublishFormToDdo(
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
nft: {
|
nft: {
|
||||||
...generateNftCreateData(values?.metadata.nft, accountId),
|
...generateNftCreateData(values?.metadata.nft, accountId)
|
||||||
owner: accountId
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -199,7 +198,8 @@ export async function createTokensAndPricing(
|
|||||||
) {
|
) {
|
||||||
const nftCreateData: NftCreateData = generateNftCreateData(
|
const nftCreateData: NftCreateData = generateNftCreateData(
|
||||||
values.metadata.nft,
|
values.metadata.nft,
|
||||||
accountId
|
accountId,
|
||||||
|
values.metadata.transferable
|
||||||
)
|
)
|
||||||
const { appConfig } = getSiteMetadata()
|
const { appConfig } = getSiteMetadata()
|
||||||
LoggerInstance.log('[publish] Creating NFT with metadata', nftCreateData)
|
LoggerInstance.log('[publish] Creating NFT with metadata', nftCreateData)
|
||||||
|
Loading…
Reference in New Issue
Block a user