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

chore/minimark out utils #11245

Merged
merged 17 commits into from
Dec 16, 2024
Merged

chore/minimark out utils #11245

merged 17 commits into from
Dec 16, 2024

Conversation

vikiival
Copy link
Member

@vikiival vikiival commented Dec 12, 2024

Thank you for your contribution to the Koda - Generative Art Marketplace.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Bugfix
  • Feature
  • Refactoring
  • Chore

Context

Removing create metadata imports from minimark with hyperdata

function createMetadata from minimark

import { Attribute, Metadata } from '../common/types'
import { unSanitizeIpfsUrl } from './ipfs'

export const createMetadata = (
  name: string,
  description: string,
  imageHash: string,
  animationUrl = '',
  attributes: Attribute[] = [],
  externalUrl = '',
  type = ''
): Metadata => {
  return {
    name,
    description,
    image: unSanitizeIpfsUrl(imageHash),
    animation_url: unSanitizeIpfsUrl(animationUrl),
    attributes,
    external_url: externalUrl || 'https://kodadot.xyz',
    type
  }
}


// vs createOpenseaMetadata

export function createOpenSeaMetadata(
  name: string,
  description: string,
  imageHash: string,
  animationUrl: string | undefined,
  attributes: OpenSeaAttribute[] = [],
  externalUrl: string | undefined,
  type?: string,
  extra?: Record<string, any>
): OpenSeaMetadata & Indexable {
  return {
    name,
    description,
    image: protocolize(imageHash),
    animation_url: protocolize(animationUrl),
    attributes,
    external_url: externalUrl || "https://kodadot.xyz",
    type: MIME_TYPE.test(type || '') ? type : '',
    kind: 'mixed',
    ...extra
  };
}

protocolize function does same as unsanitize except the fact that it can accept https:// and handles empty state better, but core stays the same

export const unSanitizeIpfsUrl = (url: string): string => {
  return justHash(url) ? addPrefix(url) : url
}

// note there is more :)
export const protocolize = (uri: string): string => {
  return withProtocol(withoutLeadingSlash(uri), IPFS_PREFIX)
}

Before submitting pull request, please make sure:

  • My contribution builds clean without any errors or warnings
  • I've merged recent default branch -- main and I've no conflicts
  • I've tried to respect high code quality standards
  • I've didn't break any original functionality

Optional

  • I've tested it at </ahp/collection>
  • I've tested PR on mobile
  • I've written unit tests 🧪
  • I've found edge cases

Did your issue had any of the "$" label on it?

  • Fill up your DOT address: Payout

Community participation

Screenshot 📸

  • My fix has changed something on UI; a screenshot is best to understand changes for others.

@vikiival vikiival requested a review from a team as a code owner December 12, 2024 10:19
@vikiival vikiival requested review from Jarsen136 and hassnian and removed request for a team December 12, 2024 10:19
Copy link

netlify bot commented Dec 12, 2024

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 636c150
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/67601052358ef90008599ee9
😎 Deploy Preview https://deploy-preview-11245--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

socket-security bot commented Dec 12, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@kodadot1/hyperdata@0.0.2-rc.1 None +1 49.6 kB vikiival

🚮 Removed packages: npm/@kodadot1/hyperdata@0.0.1-rc.6, npm/@types/jest@27.5.2, npm/@types/lodash@4.17.7, npm/@types/markdown-it@13.0.9, npm/@types/node@20.16.5, npm/@types/prismjs@1.26.4

View full report↗︎

Copy link

cloudflare-workers-and-pages bot commented Dec 12, 2024

Deploying koda-art-prod with  Cloudflare Pages  Cloudflare Pages

Latest commit: 636c150
Status:⚡️  Build in progress...

View logs

@vikiival
Copy link
Member Author

c @hassnian

@vikiival vikiival added this pull request to the merge queue Dec 16, 2024
Merged via the queue into main with commit ff567e3 Dec 16, 2024
18 of 20 checks passed
@vikiival vikiival deleted the chore/minimark-out-utils branch December 16, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants