@medialane/ui 0.403.0 → 0.406.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/account-page.cjs +3 -1
- package/dist/components/account-page.cjs.map +1 -1
- package/dist/components/account-page.d.cts +2 -2
- package/dist/components/account-page.d.ts +2 -2
- package/dist/components/account-page.js +3 -1
- package/dist/components/account-page.js.map +1 -1
- package/dist/components/asset-page.cjs +5 -9
- package/dist/components/asset-page.cjs.map +1 -1
- package/dist/components/asset-page.d.cts +3 -4
- package/dist/components/asset-page.d.ts +3 -4
- package/dist/components/asset-page.js +3 -7
- package/dist/components/asset-page.js.map +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/claim/claim-collection-panel.cjs +210 -0
- package/dist/components/claim/claim-collection-panel.cjs.map +1 -0
- package/dist/components/claim/claim-collection-panel.d.cts +8 -0
- package/dist/components/claim/claim-collection-panel.d.ts +8 -0
- package/dist/components/claim/claim-collection-panel.js +176 -0
- package/dist/components/claim/claim-collection-panel.js.map +1 -0
- package/dist/components/collection-page.cjs +5 -2
- package/dist/components/collection-page.cjs.map +1 -1
- package/dist/components/collection-page.d.cts +2 -2
- package/dist/components/collection-page.d.ts +2 -2
- package/dist/components/collection-page.js +5 -2
- package/dist/components/collection-page.js.map +1 -1
- package/dist/components/collection-showcase.cjs +3 -3
- package/dist/components/collection-showcase.cjs.map +1 -1
- package/dist/components/collection-showcase.js +4 -4
- package/dist/components/collection-showcase.js.map +1 -1
- package/dist/components/collections-page.cjs +1 -1
- package/dist/components/collections-page.cjs.map +1 -1
- package/dist/components/collections-page.js +1 -1
- package/dist/components/collections-page.js.map +1 -1
- package/dist/components/creator-page.cjs +3 -1
- package/dist/components/creator-page.cjs.map +1 -1
- package/dist/components/creator-page.d.cts +2 -2
- package/dist/components/creator-page.d.ts +2 -2
- package/dist/components/creator-page.js +3 -1
- package/dist/components/creator-page.js.map +1 -1
- package/dist/components/discover-page.cjs +2 -1
- package/dist/components/discover-page.cjs.map +1 -1
- package/dist/components/discover-page.d.cts +1 -1
- package/dist/components/discover-page.d.ts +1 -1
- package/dist/components/discover-page.js +2 -1
- package/dist/components/discover-page.js.map +1 -1
- package/dist/components/external-link-field.cjs.map +1 -1
- package/dist/components/external-link-field.d.cts +1 -2
- package/dist/components/external-link-field.d.ts +1 -2
- package/dist/components/external-link-field.js.map +1 -1
- package/dist/components/floating-comments-button.cjs +2 -2
- package/dist/components/floating-comments-button.cjs.map +1 -1
- package/dist/components/floating-comments-button.js +3 -3
- package/dist/components/floating-comments-button.js.map +1 -1
- package/dist/components/home-page.cjs +2 -1
- package/dist/components/home-page.cjs.map +1 -1
- package/dist/components/home-page.d.cts +1 -1
- package/dist/components/home-page.d.ts +1 -1
- package/dist/components/home-page.js +2 -1
- package/dist/components/home-page.js.map +1 -1
- package/dist/components/ip-type-page.cjs +2 -1
- package/dist/components/ip-type-page.cjs.map +1 -1
- package/dist/components/ip-type-page.d.cts +1 -1
- package/dist/components/ip-type-page.d.ts +1 -1
- package/dist/components/ip-type-page.js +2 -1
- package/dist/components/ip-type-page.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.cjs +1 -1
- package/dist/components/launchpad/edition-mint-schema.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +31 -35
- package/dist/components/launchpad/edition-mint-schema.d.ts +31 -35
- package/dist/components/launchpad/edition-mint-schema.js +1 -1
- package/dist/components/launchpad/edition-mint-schema.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +3 -3
- package/dist/components/launchpad/pop-create-fields.d.ts +3 -3
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create-schema.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-schema.d.cts +6 -32
- package/dist/components/launchpad/pop-create-schema.d.ts +6 -32
- package/dist/components/launchpad/pop-create-schema.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/single-edition-mint.cjs +1 -1
- package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/single-edition-mint.js +1 -1
- package/dist/components/launchpad/single-edition-mint.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +1 -1
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/launchpad-services.cjs +2 -2
- package/dist/components/launchpad-services.cjs.map +1 -1
- package/dist/components/launchpad-services.js +3 -3
- package/dist/components/launchpad-services.js.map +1 -1
- package/dist/components/lazy-panel.cjs +60 -0
- package/dist/components/lazy-panel.cjs.map +1 -0
- package/dist/components/lazy-panel.d.cts +14 -0
- package/dist/components/lazy-panel.d.ts +14 -0
- package/dist/components/lazy-panel.js +26 -0
- package/dist/components/lazy-panel.js.map +1 -0
- package/dist/components/listings-grid.cjs +9 -1
- package/dist/components/listings-grid.cjs.map +1 -1
- package/dist/components/listings-grid.d.cts +3 -2
- package/dist/components/listings-grid.d.ts +3 -2
- package/dist/components/listings-grid.js +9 -1
- package/dist/components/listings-grid.js.map +1 -1
- package/dist/components/markdown-renderer.cjs +49 -0
- package/dist/components/markdown-renderer.cjs.map +1 -0
- package/dist/components/markdown-renderer.d.cts +7 -0
- package/dist/components/markdown-renderer.d.ts +7 -0
- package/dist/components/markdown-renderer.js +19 -0
- package/dist/components/markdown-renderer.js.map +1 -0
- package/dist/components/markdown-text.cjs +3 -11
- package/dist/components/markdown-text.cjs.map +1 -1
- package/dist/components/markdown-text.js +3 -11
- package/dist/components/markdown-text.js.map +1 -1
- package/dist/components/marketplace/accept-offer-dialog.cjs +180 -0
- package/dist/components/marketplace/accept-offer-dialog.cjs.map +1 -0
- package/dist/components/marketplace/accept-offer-dialog.d.cts +17 -0
- package/dist/components/marketplace/accept-offer-dialog.d.ts +17 -0
- package/dist/components/marketplace/accept-offer-dialog.js +156 -0
- package/dist/components/marketplace/accept-offer-dialog.js.map +1 -0
- package/dist/components/marketplace/approve-mint-flow.cjs +85 -0
- package/dist/components/marketplace/approve-mint-flow.cjs.map +1 -0
- package/dist/components/marketplace/approve-mint-flow.d.cts +12 -0
- package/dist/components/marketplace/approve-mint-flow.d.ts +12 -0
- package/dist/components/marketplace/approve-mint-flow.js +61 -0
- package/dist/components/marketplace/approve-mint-flow.js.map +1 -0
- package/dist/components/marketplace/asset-market-actions.cjs +175 -0
- package/dist/components/marketplace/asset-market-actions.cjs.map +1 -0
- package/dist/components/marketplace/asset-market-actions.d.cts +9 -0
- package/dist/components/marketplace/asset-market-actions.d.ts +9 -0
- package/dist/components/marketplace/asset-market-actions.js +151 -0
- package/dist/components/marketplace/asset-market-actions.js.map +1 -0
- package/dist/components/marketplace/cancel-order-dialog.cjs +82 -0
- package/dist/components/marketplace/cancel-order-dialog.cjs.map +1 -0
- package/dist/components/marketplace/cancel-order-dialog.d.cts +17 -0
- package/dist/components/marketplace/cancel-order-dialog.d.ts +17 -0
- package/dist/components/marketplace/cancel-order-dialog.js +58 -0
- package/dist/components/marketplace/cancel-order-dialog.js.map +1 -0
- package/dist/components/marketplace/counter-offer-dialog.cjs +236 -0
- package/dist/components/marketplace/counter-offer-dialog.cjs.map +1 -0
- package/dist/components/marketplace/counter-offer-dialog.d.cts +16 -0
- package/dist/components/marketplace/counter-offer-dialog.d.ts +16 -0
- package/dist/components/marketplace/counter-offer-dialog.js +212 -0
- package/dist/components/marketplace/counter-offer-dialog.js.map +1 -0
- package/dist/components/marketplace/dialog-frame.cjs +65 -0
- package/dist/components/marketplace/dialog-frame.cjs.map +1 -0
- package/dist/components/marketplace/dialog-frame.d.cts +22 -0
- package/dist/components/marketplace/dialog-frame.d.ts +22 -0
- package/dist/components/marketplace/dialog-frame.js +38 -0
- package/dist/components/marketplace/dialog-frame.js.map +1 -0
- package/dist/components/marketplace/lazy-dialogs.cjs +66 -0
- package/dist/components/marketplace/lazy-dialogs.cjs.map +1 -0
- package/dist/components/marketplace/lazy-dialogs.d.cts +25 -0
- package/dist/components/marketplace/lazy-dialogs.d.ts +25 -0
- package/dist/components/marketplace/lazy-dialogs.js +26 -0
- package/dist/components/marketplace/lazy-dialogs.js.map +1 -0
- package/dist/components/marketplace/listing-dialog.cjs +183 -0
- package/dist/components/marketplace/listing-dialog.cjs.map +1 -0
- package/dist/components/marketplace/listing-dialog.d.cts +16 -0
- package/dist/components/marketplace/listing-dialog.d.ts +16 -0
- package/dist/components/marketplace/listing-dialog.js +159 -0
- package/dist/components/marketplace/listing-dialog.js.map +1 -0
- package/dist/components/marketplace/market-actions.cjs +59 -0
- package/dist/components/marketplace/market-actions.cjs.map +1 -0
- package/dist/components/marketplace/market-actions.d.cts +9 -0
- package/dist/components/marketplace/market-actions.d.ts +9 -0
- package/dist/components/marketplace/market-actions.js +35 -0
- package/dist/components/marketplace/market-actions.js.map +1 -0
- package/dist/components/marketplace/offer-dialog.cjs +194 -0
- package/dist/components/marketplace/offer-dialog.cjs.map +1 -0
- package/dist/components/marketplace/offer-dialog.d.cts +14 -0
- package/dist/components/marketplace/offer-dialog.d.ts +14 -0
- package/dist/components/marketplace/offer-dialog.js +170 -0
- package/dist/components/marketplace/offer-dialog.js.map +1 -0
- package/dist/components/marketplace/portfolio-actions.cjs +287 -0
- package/dist/components/marketplace/portfolio-actions.cjs.map +1 -0
- package/dist/components/marketplace/portfolio-actions.d.cts +16 -0
- package/dist/components/marketplace/portfolio-actions.d.ts +16 -0
- package/dist/components/marketplace/portfolio-actions.js +249 -0
- package/dist/components/marketplace/portfolio-actions.js.map +1 -0
- package/dist/components/marketplace/purchase-dialog.cjs +174 -0
- package/dist/components/marketplace/purchase-dialog.cjs.map +1 -0
- package/dist/components/marketplace/purchase-dialog.d.cts +12 -0
- package/dist/components/marketplace/purchase-dialog.d.ts +12 -0
- package/dist/components/marketplace/purchase-dialog.js +150 -0
- package/dist/components/marketplace/purchase-dialog.js.map +1 -0
- package/dist/components/marketplace/transfer-asset-dialog.cjs +74 -0
- package/dist/components/marketplace/transfer-asset-dialog.cjs.map +1 -0
- package/dist/components/marketplace/transfer-asset-dialog.d.cts +16 -0
- package/dist/components/marketplace/transfer-asset-dialog.d.ts +16 -0
- package/dist/components/marketplace/transfer-asset-dialog.js +50 -0
- package/dist/components/marketplace/transfer-asset-dialog.js.map +1 -0
- package/dist/components/marketplace-dialog-primitives.cjs +2 -2
- package/dist/components/marketplace-dialog-primitives.cjs.map +1 -1
- package/dist/components/marketplace-dialog-primitives.d.cts +9 -4
- package/dist/components/marketplace-dialog-primitives.d.ts +9 -4
- package/dist/components/marketplace-dialog-primitives.js +2 -2
- package/dist/components/marketplace-dialog-primitives.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-overlay.cjs +3 -64
- package/dist/components/media-wallet/media-wallet-overlay.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-overlay.js +4 -65
- package/dist/components/media-wallet/media-wallet-overlay.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-panel.cjs +102 -0
- package/dist/components/media-wallet/media-wallet-panel.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-panel.d.cts +14 -0
- package/dist/components/media-wallet/media-wallet-panel.d.ts +14 -0
- package/dist/components/media-wallet/media-wallet-panel.js +72 -0
- package/dist/components/media-wallet/media-wallet-panel.js.map +1 -0
- package/dist/components/media-wallet/success-dialog.cjs +1 -1
- package/dist/components/media-wallet/success-dialog.cjs.map +1 -1
- package/dist/components/media-wallet/success-dialog.js +1 -1
- package/dist/components/media-wallet/success-dialog.js.map +1 -1
- package/dist/components/medialane-app.cjs +24 -1
- package/dist/components/medialane-app.cjs.map +1 -1
- package/dist/components/medialane-app.d.cts +7 -1
- package/dist/components/medialane-app.d.ts +7 -1
- package/dist/components/medialane-app.js +13 -1
- package/dist/components/medialane-app.js.map +1 -1
- package/dist/components/motion-features.cjs +26 -0
- package/dist/components/motion-features.cjs.map +1 -0
- package/dist/components/motion-features.d.cts +2 -0
- package/dist/components/motion-features.d.ts +2 -0
- package/dist/components/motion-features.js +6 -0
- package/dist/components/motion-features.js.map +1 -0
- package/dist/components/motion-primitives.cjs +6 -6
- package/dist/components/motion-primitives.cjs.map +1 -1
- package/dist/components/motion-primitives.js +7 -7
- package/dist/components/motion-primitives.js.map +1 -1
- package/dist/components/nav-account-panel.cjs +75 -0
- package/dist/components/nav-account-panel.cjs.map +1 -0
- package/dist/components/nav-account-panel.d.cts +11 -0
- package/dist/components/nav-account-panel.d.ts +11 -0
- package/dist/components/nav-account-panel.js +55 -0
- package/dist/components/nav-account-panel.js.map +1 -0
- package/dist/components/nav-command-dialog.cjs +325 -0
- package/dist/components/nav-command-dialog.cjs.map +1 -0
- package/dist/components/nav-command-dialog.d.cts +11 -0
- package/dist/components/nav-command-dialog.d.ts +11 -0
- package/dist/components/nav-command-dialog.js +295 -0
- package/dist/components/nav-command-dialog.js.map +1 -0
- package/dist/components/nav-command-match.cjs +46 -0
- package/dist/components/nav-command-match.cjs.map +1 -0
- package/dist/components/nav-command-match.d.cts +9 -0
- package/dist/components/nav-command-match.d.ts +9 -0
- package/dist/components/nav-command-match.js +20 -0
- package/dist/components/nav-command-match.js.map +1 -0
- package/dist/components/nav-command-menu.cjs +5 -302
- package/dist/components/nav-command-menu.cjs.map +1 -1
- package/dist/components/nav-command-menu.d.cts +2 -4
- package/dist/components/nav-command-menu.d.ts +2 -4
- package/dist/components/nav-command-menu.js +5 -300
- package/dist/components/nav-command-menu.js.map +1 -1
- package/dist/components/nav-shell.cjs +3 -46
- package/dist/components/nav-shell.cjs.map +1 -1
- package/dist/components/nav-shell.js +4 -47
- package/dist/components/nav-shell.js.map +1 -1
- package/dist/components/portfolio-assets.cjs +2 -1
- package/dist/components/portfolio-assets.cjs.map +1 -1
- package/dist/components/portfolio-assets.d.cts +1 -1
- package/dist/components/portfolio-assets.d.ts +1 -1
- package/dist/components/portfolio-assets.js +2 -1
- package/dist/components/portfolio-assets.js.map +1 -1
- package/dist/components/portfolio-licensing-page.cjs +166 -0
- package/dist/components/portfolio-licensing-page.cjs.map +1 -0
- package/dist/components/portfolio-licensing-page.d.cts +5 -0
- package/dist/components/portfolio-licensing-page.d.ts +5 -0
- package/dist/components/portfolio-licensing-page.js +132 -0
- package/dist/components/portfolio-licensing-page.js.map +1 -0
- package/dist/components/portfolio-orders.cjs +8 -1
- package/dist/components/portfolio-orders.cjs.map +1 -1
- package/dist/components/portfolio-orders.d.cts +1 -1
- package/dist/components/portfolio-orders.d.ts +1 -1
- package/dist/components/portfolio-orders.js +8 -1
- package/dist/components/portfolio-orders.js.map +1 -1
- package/dist/components/token-card.cjs +5 -1
- package/dist/components/token-card.cjs.map +1 -1
- package/dist/components/token-card.js +5 -1
- package/dist/components/token-card.js.map +1 -1
- package/dist/i18n/catalog/pt.cjs +89 -1
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +89 -1
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/index.cjs +121 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +82 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/app-client.cjs +60 -0
- package/dist/utils/app-client.cjs.map +1 -0
- package/dist/utils/app-client.d.cts +19 -0
- package/dist/utils/app-client.d.ts +19 -0
- package/dist/utils/app-client.js +38 -0
- package/dist/utils/app-client.js.map +1 -0
- package/dist/utils/duration-options.cjs +46 -0
- package/dist/utils/duration-options.cjs.map +1 -0
- package/dist/utils/duration-options.d.cts +40 -0
- package/dist/utils/duration-options.d.ts +40 -0
- package/dist/utils/duration-options.js +21 -0
- package/dist/utils/duration-options.js.map +1 -0
- package/dist/utils/launchpad-rules.d.cts +1 -1
- package/dist/utils/launchpad-rules.d.ts +1 -1
- package/dist/utils/marketplace/intents.cjs +178 -0
- package/dist/utils/marketplace/intents.cjs.map +1 -0
- package/dist/utils/marketplace/intents.d.cts +74 -0
- package/dist/utils/marketplace/intents.d.ts +74 -0
- package/dist/utils/marketplace/intents.js +148 -0
- package/dist/utils/marketplace/intents.js.map +1 -0
- package/dist/utils/marketplace/remix-approval.cjs +93 -0
- package/dist/utils/marketplace/remix-approval.cjs.map +1 -0
- package/dist/utils/marketplace/remix-approval.d.cts +26 -0
- package/dist/utils/marketplace/remix-approval.d.ts +26 -0
- package/dist/utils/marketplace/remix-approval.js +69 -0
- package/dist/utils/marketplace/remix-approval.js.map +1 -0
- package/dist/utils/marketplace/swap-intent.cjs +46 -0
- package/dist/utils/marketplace/swap-intent.cjs.map +1 -0
- package/dist/utils/marketplace/swap-intent.d.cts +18 -0
- package/dist/utils/marketplace/swap-intent.d.ts +18 -0
- package/dist/utils/marketplace/swap-intent.js +22 -0
- package/dist/utils/marketplace/swap-intent.js.map +1 -0
- package/dist/utils/marketplace/token-standard.cjs +46 -0
- package/dist/utils/marketplace/token-standard.cjs.map +1 -0
- package/dist/utils/marketplace/token-standard.d.cts +13 -0
- package/dist/utils/marketplace/token-standard.d.ts +13 -0
- package/dist/utils/marketplace/token-standard.js +20 -0
- package/dist/utils/marketplace/token-standard.js.map +1 -0
- package/dist/utils/marketplace/use-accept-offer.cjs +103 -0
- package/dist/utils/marketplace/use-accept-offer.cjs.map +1 -0
- package/dist/utils/marketplace/use-accept-offer.d.cts +132 -0
- package/dist/utils/marketplace/use-accept-offer.d.ts +132 -0
- package/dist/utils/marketplace/use-accept-offer.js +79 -0
- package/dist/utils/marketplace/use-accept-offer.js.map +1 -0
- package/dist/utils/marketplace/use-cancel-order.cjs +67 -0
- package/dist/utils/marketplace/use-cancel-order.cjs.map +1 -0
- package/dist/utils/marketplace/use-cancel-order.d.cts +74 -0
- package/dist/utils/marketplace/use-cancel-order.d.ts +74 -0
- package/dist/utils/marketplace/use-cancel-order.js +43 -0
- package/dist/utils/marketplace/use-cancel-order.js.map +1 -0
- package/dist/utils/marketplace/use-marketplace-transaction.cjs +80 -0
- package/dist/utils/marketplace/use-marketplace-transaction.cjs.map +1 -0
- package/dist/utils/marketplace/use-marketplace-transaction.d.cts +21 -0
- package/dist/utils/marketplace/use-marketplace-transaction.d.ts +21 -0
- package/dist/utils/marketplace/use-marketplace-transaction.js +55 -0
- package/dist/utils/marketplace/use-marketplace-transaction.js.map +1 -0
- package/dist/utils/marketplace/use-resolved-token-standard.cjs +40 -0
- package/dist/utils/marketplace/use-resolved-token-standard.cjs.map +1 -0
- package/dist/utils/marketplace/use-resolved-token-standard.d.cts +9 -0
- package/dist/utils/marketplace/use-resolved-token-standard.d.ts +9 -0
- package/dist/utils/marketplace/use-resolved-token-standard.js +16 -0
- package/dist/utils/marketplace/use-resolved-token-standard.js.map +1 -0
- package/dist/utils/media-wallet/confetti.cjs +6 -6
- package/dist/utils/media-wallet/confetti.cjs.map +1 -1
- package/dist/utils/media-wallet/confetti.d.cts +1 -1
- package/dist/utils/media-wallet/confetti.d.ts +1 -1
- package/dist/utils/media-wallet/confetti.js +2 -2
- package/dist/utils/media-wallet/confetti.js.map +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.cjs +0 -1
- package/dist/utils/media-wallet/use-erc20-balance.cjs.map +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.js +0 -1
- package/dist/utils/media-wallet/use-erc20-balance.js.map +1 -1
- package/dist/utils/order-form.d.cts +5 -23
- package/dist/utils/order-form.d.ts +5 -23
- package/dist/utils/security-headers.cjs +58 -0
- package/dist/utils/security-headers.cjs.map +1 -0
- package/dist/utils/security-headers.d.cts +16 -0
- package/dist/utils/security-headers.d.ts +16 -0
- package/dist/utils/security-headers.js +34 -0
- package/dist/utils/security-headers.js.map +1 -0
- package/dist/utils/seo.cjs +100 -0
- package/dist/utils/seo.cjs.map +1 -0
- package/dist/utils/seo.d.cts +55 -0
- package/dist/utils/seo.d.ts +55 -0
- package/dist/utils/seo.js +75 -0
- package/dist/utils/seo.js.map +1 -0
- package/dist/utils/server-reads.d.cts +1 -0
- package/dist/utils/server-reads.d.ts +1 -0
- package/dist/utils/token-kind.cjs +45 -0
- package/dist/utils/token-kind.cjs.map +1 -0
- package/dist/utils/token-kind.d.cts +8 -0
- package/dist/utils/token-kind.d.ts +8 -0
- package/dist/utils/token-kind.js +19 -0
- package/dist/utils/token-kind.js.map +1 -0
- package/dist/utils/use-accounts.cjs +1 -1
- package/dist/utils/use-accounts.cjs.map +1 -1
- package/dist/utils/use-accounts.js +1 -1
- package/dist/utils/use-accounts.js.map +1 -1
- package/dist/utils/use-activities.cjs +2 -4
- package/dist/utils/use-activities.cjs.map +1 -1
- package/dist/utils/use-activities.js +2 -4
- package/dist/utils/use-activities.js.map +1 -1
- package/dist/utils/use-coin-guarantees.cjs +1 -1
- package/dist/utils/use-coin-guarantees.cjs.map +1 -1
- package/dist/utils/use-coin-guarantees.js +1 -1
- package/dist/utils/use-coin-guarantees.js.map +1 -1
- package/dist/utils/use-coin-price.cjs +1 -1
- package/dist/utils/use-coin-price.cjs.map +1 -1
- package/dist/utils/use-coin-price.js +1 -1
- package/dist/utils/use-coin-price.js.map +1 -1
- package/dist/utils/use-coin-supply.cjs +1 -1
- package/dist/utils/use-coin-supply.cjs.map +1 -1
- package/dist/utils/use-coin-supply.js +1 -1
- package/dist/utils/use-coin-supply.js.map +1 -1
- package/dist/utils/use-collections.cjs +3 -6
- package/dist/utils/use-collections.cjs.map +1 -1
- package/dist/utils/use-collections.d.cts +3 -0
- package/dist/utils/use-collections.d.ts +3 -0
- package/dist/utils/use-collections.js +3 -6
- package/dist/utils/use-collections.js.map +1 -1
- package/dist/utils/use-comments.cjs +1 -1
- package/dist/utils/use-comments.cjs.map +1 -1
- package/dist/utils/use-comments.js +1 -1
- package/dist/utils/use-comments.js.map +1 -1
- package/dist/utils/use-confetti.cjs +1 -1
- package/dist/utils/use-confetti.cjs.map +1 -1
- package/dist/utils/use-confetti.js +1 -1
- package/dist/utils/use-confetti.js.map +1 -1
- package/dist/utils/use-drops.cjs +2 -2
- package/dist/utils/use-drops.cjs.map +1 -1
- package/dist/utils/use-drops.js +2 -2
- package/dist/utils/use-drops.js.map +1 -1
- package/dist/utils/use-full-token-data.cjs +1 -1
- package/dist/utils/use-full-token-data.cjs.map +1 -1
- package/dist/utils/use-full-token-data.js +1 -1
- package/dist/utils/use-full-token-data.js.map +1 -1
- package/dist/utils/use-gated-content.cjs +56 -0
- package/dist/utils/use-gated-content.cjs.map +1 -0
- package/dist/utils/use-gated-content.d.cts +7 -0
- package/dist/utils/use-gated-content.d.ts +7 -0
- package/dist/utils/use-gated-content.js +22 -0
- package/dist/utils/use-gated-content.js.map +1 -0
- package/dist/utils/use-my-remix-offers.cjs +0 -1
- package/dist/utils/use-my-remix-offers.cjs.map +1 -1
- package/dist/utils/use-my-remix-offers.js +0 -1
- package/dist/utils/use-my-remix-offers.js.map +1 -1
- package/dist/utils/use-my-username-claim.cjs +52 -0
- package/dist/utils/use-my-username-claim.cjs.map +1 -0
- package/dist/utils/use-my-username-claim.d.cts +15 -0
- package/dist/utils/use-my-username-claim.d.ts +15 -0
- package/dist/utils/use-my-username-claim.js +18 -0
- package/dist/utils/use-my-username-claim.js.map +1 -0
- package/dist/utils/use-orders.cjs +7 -9
- package/dist/utils/use-orders.cjs.map +1 -1
- package/dist/utils/use-orders.js +7 -9
- package/dist/utils/use-orders.js.map +1 -1
- package/dist/utils/use-platform-stats.cjs +1 -1
- package/dist/utils/use-platform-stats.cjs.map +1 -1
- package/dist/utils/use-platform-stats.js +1 -1
- package/dist/utils/use-platform-stats.js.map +1 -1
- package/dist/utils/use-pop.cjs +3 -5
- package/dist/utils/use-pop.cjs.map +1 -1
- package/dist/utils/use-pop.js +3 -5
- package/dist/utils/use-pop.js.map +1 -1
- package/dist/utils/use-profiles.cjs +3 -4
- package/dist/utils/use-profiles.cjs.map +1 -1
- package/dist/utils/use-profiles.js +3 -4
- package/dist/utils/use-profiles.js.map +1 -1
- package/dist/utils/use-remix-offers.cjs +1 -2
- package/dist/utils/use-remix-offers.cjs.map +1 -1
- package/dist/utils/use-remix-offers.js +1 -2
- package/dist/utils/use-remix-offers.js.map +1 -1
- package/dist/utils/use-rewards.cjs +5 -5
- package/dist/utils/use-rewards.cjs.map +1 -1
- package/dist/utils/use-rewards.js +5 -5
- package/dist/utils/use-rewards.js.map +1 -1
- package/dist/utils/use-search.cjs +1 -1
- package/dist/utils/use-search.cjs.map +1 -1
- package/dist/utils/use-search.js +1 -1
- package/dist/utils/use-search.js.map +1 -1
- package/dist/utils/use-sponsorship.cjs +6 -12
- package/dist/utils/use-sponsorship.cjs.map +1 -1
- package/dist/utils/use-sponsorship.js +6 -12
- package/dist/utils/use-sponsorship.js.map +1 -1
- package/dist/utils/use-swap-quote.cjs +0 -1
- package/dist/utils/use-swap-quote.cjs.map +1 -1
- package/dist/utils/use-swap-quote.js +0 -1
- package/dist/utils/use-swap-quote.js.map +1 -1
- package/dist/utils/use-tiers.cjs +6 -7
- package/dist/utils/use-tiers.cjs.map +1 -1
- package/dist/utils/use-tiers.js +6 -7
- package/dist/utils/use-tiers.js.map +1 -1
- package/dist/utils/use-tokens-by-ip-type.cjs +1 -2
- package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -1
- package/dist/utils/use-tokens-by-ip-type.d.cts +2 -0
- package/dist/utils/use-tokens-by-ip-type.d.ts +2 -0
- package/dist/utils/use-tokens-by-ip-type.js +1 -2
- package/dist/utils/use-tokens-by-ip-type.js.map +1 -1
- package/dist/utils/use-tokens.cjs +4 -7
- package/dist/utils/use-tokens.cjs.map +1 -1
- package/dist/utils/use-tokens.d.cts +6 -0
- package/dist/utils/use-tokens.d.ts +6 -0
- package/dist/utils/use-tokens.js +4 -7
- package/dist/utils/use-tokens.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { UserFacingError } from "../describe-error.js";
|
|
2
|
+
import { SponsoredCallRejectedError, populateSignedCalls } from "@medialane/sdk/starknet";
|
|
3
|
+
import { SUPPORTED_TOKENS } from "@medialane/sdk";
|
|
4
|
+
import { isErc1155Standard } from "./token-standard.js";
|
|
5
|
+
const MAX_POLL_ATTEMPTS = 10;
|
|
6
|
+
const POLL_INTERVAL_MS = 3e3;
|
|
7
|
+
const SYMBOL_TO_ADDRESS = Object.fromEntries(
|
|
8
|
+
SUPPORTED_TOKENS.map((t) => [t.symbol, t.address])
|
|
9
|
+
);
|
|
10
|
+
function resolveCurrencyAddress(symbolOrAddress) {
|
|
11
|
+
if (symbolOrAddress.startsWith("0x")) return symbolOrAddress;
|
|
12
|
+
const address = SYMBOL_TO_ADDRESS[symbolOrAddress.toUpperCase()];
|
|
13
|
+
if (!address) throw new Error(`Unsupported currency: ${symbolOrAddress}`);
|
|
14
|
+
return address;
|
|
15
|
+
}
|
|
16
|
+
function toApiStandard(standard) {
|
|
17
|
+
return standard === "ERC1155" || standard === "ERC721" ? standard : void 0;
|
|
18
|
+
}
|
|
19
|
+
function sanitizeTypedData(value) {
|
|
20
|
+
if (typeof value === "string") return SYMBOL_TO_ADDRESS[value.toUpperCase()] ?? value;
|
|
21
|
+
if (Array.isArray(value)) return value.map(sanitizeTypedData);
|
|
22
|
+
if (value !== null && typeof value === "object") {
|
|
23
|
+
return Object.fromEntries(
|
|
24
|
+
Object.entries(value).map(([k, v]) => [k, sanitizeTypedData(v)])
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
async function pollUntilTerminal(client, id, intervalMs) {
|
|
30
|
+
for (let i = 0; i < MAX_POLL_ATTEMPTS; i++) {
|
|
31
|
+
if (i > 0) await new Promise((r) => setTimeout(r, intervalMs));
|
|
32
|
+
const intent = await client.api.intents.get(id);
|
|
33
|
+
if (intent.status === "CONFIRMED" || intent.status === "FAILED") return intent;
|
|
34
|
+
}
|
|
35
|
+
throw new Error("Verification timed out. Check your account for the transaction status.");
|
|
36
|
+
}
|
|
37
|
+
async function runMarketplaceIntent({ client, signer }, create, { before, pollIntervalMs = POLL_INTERVAL_MS } = {}) {
|
|
38
|
+
const intent = await create();
|
|
39
|
+
if (!intent?.id) throw new Error("Intent creation failed: no data returned");
|
|
40
|
+
let calls;
|
|
41
|
+
if (intent.requiresSignature) {
|
|
42
|
+
const typedData = intent.local ? intent.typedData : sanitizeTypedData(intent.typedData);
|
|
43
|
+
const sig = await signer.signTypedData(typedData);
|
|
44
|
+
const signed = await client.api.intents.submitSignature(intent.id, sig);
|
|
45
|
+
calls = intent.local ? populateSignedCalls(intent.local.kind, intent.local.built, signed.signature) : signed.calls;
|
|
46
|
+
} else {
|
|
47
|
+
calls = intent.calls;
|
|
48
|
+
}
|
|
49
|
+
if (!calls?.length) throw new Error("No calls returned from intent");
|
|
50
|
+
const intentIds = before ? [before.id, intent.id] : [intent.id];
|
|
51
|
+
if (before) calls = [...before.calls, ...calls];
|
|
52
|
+
const { txHash } = await signer.execute(calls, { intentIds });
|
|
53
|
+
await client.api.intents.confirm(intent.id, "0x" + txHash.replace(/^0x/, "").padStart(64, "0"));
|
|
54
|
+
const settled = await pollUntilTerminal(client, intent.id, pollIntervalMs);
|
|
55
|
+
if (settled.status === "FAILED") {
|
|
56
|
+
throw new UserFacingError(
|
|
57
|
+
"Transaction was submitted but the marketplace order could not be confirmed onchain. The order may have already been filled or expired \u2014 please refresh and try again."
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return { txHash, orderHash: settled.orderHash ?? null };
|
|
61
|
+
}
|
|
62
|
+
const endTimeAfter = (durationSeconds) => Math.floor(Date.now() / 1e3) + durationSeconds;
|
|
63
|
+
const LISTING_PROBLEM = "The listing did not complete.";
|
|
64
|
+
async function createListing(ctx, input, opts) {
|
|
65
|
+
try {
|
|
66
|
+
return await runMarketplaceIntent(ctx, () => ctx.client.createIntent("listing", {
|
|
67
|
+
offerer: ctx.signer.address,
|
|
68
|
+
nftContract: input.assetContract,
|
|
69
|
+
tokenId: input.tokenId,
|
|
70
|
+
currency: resolveCurrencyAddress(input.currencySymbol),
|
|
71
|
+
price: input.price,
|
|
72
|
+
endTime: endTimeAfter(input.durationSeconds),
|
|
73
|
+
...isErc1155Standard(input.tokenStandard) ? { amount: input.amount || "1" } : {}
|
|
74
|
+
}), opts);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
if (err instanceof SponsoredCallRejectedError && err.code === "calls_mismatch") {
|
|
77
|
+
throw new SponsoredCallRejectedError(LISTING_PROBLEM, err);
|
|
78
|
+
}
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function makeOffer(ctx, input, opts) {
|
|
83
|
+
return runMarketplaceIntent(ctx, () => ctx.client.createIntent("offer", {
|
|
84
|
+
offerer: ctx.signer.address,
|
|
85
|
+
nftContract: input.assetContract,
|
|
86
|
+
tokenId: input.tokenId,
|
|
87
|
+
currency: resolveCurrencyAddress(input.currencySymbol),
|
|
88
|
+
price: input.price,
|
|
89
|
+
endTime: endTimeAfter(input.durationSeconds),
|
|
90
|
+
tokenStandard: toApiStandard(input.tokenStandard),
|
|
91
|
+
quantity: isErc1155Standard(input.tokenStandard) ? input.quantity || "1" : void 0
|
|
92
|
+
}), opts);
|
|
93
|
+
}
|
|
94
|
+
function fulfillOrder(ctx, input, opts) {
|
|
95
|
+
return runMarketplaceIntent(ctx, () => ctx.client.createIntent("fulfill", {
|
|
96
|
+
fulfiller: ctx.signer.address,
|
|
97
|
+
orderHash: input.orderHash,
|
|
98
|
+
tokenStandard: toApiStandard(input.tokenStandard),
|
|
99
|
+
quantity: input.quantity
|
|
100
|
+
}), { ...opts, before: input.swap });
|
|
101
|
+
}
|
|
102
|
+
function cancelOrder(ctx, input, opts) {
|
|
103
|
+
return runMarketplaceIntent(ctx, () => ctx.client.createIntent("cancel", {
|
|
104
|
+
offerer: ctx.signer.address,
|
|
105
|
+
orderHash: input.orderHash,
|
|
106
|
+
tokenStandard: toApiStandard(input.tokenStandard)
|
|
107
|
+
}), opts);
|
|
108
|
+
}
|
|
109
|
+
function makeCounterOffer(ctx, input, opts) {
|
|
110
|
+
return runMarketplaceIntent(ctx, () => ctx.client.createIntent("counter-offer", {
|
|
111
|
+
sellerAddress: ctx.signer.address,
|
|
112
|
+
originalOrderHash: input.originalOrderHash,
|
|
113
|
+
durationSeconds: input.durationSeconds,
|
|
114
|
+
priceRaw: input.counterPriceRaw,
|
|
115
|
+
message: input.message
|
|
116
|
+
}), opts);
|
|
117
|
+
}
|
|
118
|
+
function isStarknetAddress(value) {
|
|
119
|
+
return /^0x[0-9a-fA-F]{1,64}$/.test(value) && value.replace(/^0x0*/, "").length > 0;
|
|
120
|
+
}
|
|
121
|
+
async function transferNft({ client, signer }, input) {
|
|
122
|
+
if (!isStarknetAddress(input.toAddress)) throw new UserFacingError("Invalid recipient address.");
|
|
123
|
+
if (!isStarknetAddress(input.contractAddress)) throw new UserFacingError("Invalid token contract address.");
|
|
124
|
+
if (!input.tokenStandard) {
|
|
125
|
+
throw new UserFacingError("Token standard could not be determined. Please try again or contact support.");
|
|
126
|
+
}
|
|
127
|
+
const intent = await client.createIntent("transfer-nft", {
|
|
128
|
+
owner: signer.address,
|
|
129
|
+
contractAddress: input.contractAddress,
|
|
130
|
+
tokenId: input.tokenId,
|
|
131
|
+
recipient: input.toAddress,
|
|
132
|
+
tokenStandard: input.tokenStandard === "ERC1155" ? "ERC1155" : "ERC721"
|
|
133
|
+
});
|
|
134
|
+
const calls = intent.calls;
|
|
135
|
+
if (!calls?.length) throw new Error("No calls returned from intent");
|
|
136
|
+
const { txHash } = await signer.execute(calls, { intentIds: [intent.id] });
|
|
137
|
+
return txHash;
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
cancelOrder,
|
|
141
|
+
createListing,
|
|
142
|
+
fulfillOrder,
|
|
143
|
+
makeCounterOffer,
|
|
144
|
+
makeOffer,
|
|
145
|
+
runMarketplaceIntent,
|
|
146
|
+
transferNft
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=intents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/marketplace/intents.ts"],"sourcesContent":["import { UserFacingError } from \"../describe-error.js\";\nimport type { FastMintSigner } from \"../../components/fast-mint/types.js\";\nimport { SponsoredCallRejectedError, populateSignedCalls, type CreatedIntent, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { Call, TypedData } from \"starknet\";\nimport { SUPPORTED_TOKENS } from \"@medialane/sdk\";\nimport { isErc1155Standard } from \"./token-standard.js\";\n\ntype MarketplaceSigner = FastMintSigner;\n\nexport interface MarketplaceContext {\n client: MedialaneClient;\n signer: MarketplaceSigner;\n}\n\nexport interface MarketplaceResult {\n txHash: string;\n orderHash: string | null;\n}\n\nexport interface CreateListingInput {\n assetContract: string;\n tokenId: string;\n price: string;\n currencySymbol: string;\n durationSeconds: number;\n amount?: string;\n tokenStandard?: \"ERC721\" | \"ERC1155\" | \"UNKNOWN\";\n}\n\nexport interface MakeOfferInput {\n assetContract: string;\n tokenId: string;\n price: string;\n currencySymbol: string;\n durationSeconds: number;\n tokenStandard?: \"ERC721\" | \"ERC1155\" | \"UNKNOWN\";\n quantity?: string;\n}\n\nexport interface FulfillOrderInput {\n orderHash: string;\n tokenStandard?: string;\n quantity?: string;\n swap?: { id: string; calls: Call[] };\n}\n\nexport interface CancelOrderInput {\n orderHash: string;\n tokenStandard?: string;\n}\n\nexport interface TransferInput {\n contractAddress: string;\n tokenId: string;\n toAddress: string;\n tokenStandard?: \"ERC721\" | \"ERC1155\" | \"UNKNOWN\";\n}\n\nexport interface MakeCounterOfferInput {\n originalOrderHash: string;\n counterPriceRaw: string;\n durationSeconds: number;\n message?: string;\n}\n\ninterface RunOptions {\n before?: { id: string; calls: Call[] };\n pollIntervalMs?: number;\n}\n\ntype ActionOptions = Pick<RunOptions, \"pollIntervalMs\">;\n\nconst MAX_POLL_ATTEMPTS = 10;\nconst POLL_INTERVAL_MS = 3000;\n\nconst SYMBOL_TO_ADDRESS: Record<string, string> = Object.fromEntries(\n SUPPORTED_TOKENS.map((t) => [t.symbol, t.address])\n);\n\nfunction resolveCurrencyAddress(symbolOrAddress: string): string {\n if (symbolOrAddress.startsWith(\"0x\")) return symbolOrAddress;\n const address = SYMBOL_TO_ADDRESS[symbolOrAddress.toUpperCase()];\n if (!address) throw new Error(`Unsupported currency: ${symbolOrAddress}`);\n return address;\n}\n\nfunction toApiStandard(standard?: string): \"ERC721\" | \"ERC1155\" | undefined {\n return standard === \"ERC1155\" || standard === \"ERC721\" ? standard : undefined;\n}\n\nfunction sanitizeTypedData(value: unknown): unknown {\n if (typeof value === \"string\") return SYMBOL_TO_ADDRESS[value.toUpperCase()] ?? value;\n if (Array.isArray(value)) return value.map(sanitizeTypedData);\n if (value !== null && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([k, v]) => [k, sanitizeTypedData(v)])\n );\n }\n return value;\n}\n\ninterface SettledIntent {\n status: \"CONFIRMED\" | \"FAILED\";\n orderHash?: string | null;\n}\n\nasync function pollUntilTerminal(client: MedialaneClient, id: string, intervalMs: number): Promise<SettledIntent> {\n for (let i = 0; i < MAX_POLL_ATTEMPTS; i++) {\n if (i > 0) await new Promise<void>((r) => setTimeout(r, intervalMs));\n const intent = (await client.api.intents.get(id)) as unknown as { status?: unknown; orderHash?: string | null };\n if (intent.status === \"CONFIRMED\" || intent.status === \"FAILED\") return intent as SettledIntent;\n }\n throw new Error(\"Verification timed out. Check your account for the transaction status.\");\n}\n\nexport async function runMarketplaceIntent(\n { client, signer }: MarketplaceContext,\n create: () => Promise<CreatedIntent>,\n { before, pollIntervalMs = POLL_INTERVAL_MS }: RunOptions = {},\n): Promise<MarketplaceResult> {\n const intent = await create();\n if (!intent?.id) throw new Error(\"Intent creation failed: no data returned\");\n\n let calls: Call[];\n if (intent.requiresSignature) {\n const typedData = (intent.local ? intent.typedData : sanitizeTypedData(intent.typedData)) as TypedData;\n const sig = await signer.signTypedData(typedData);\n const signed = await client.api.intents.submitSignature(intent.id, sig);\n calls = intent.local ? populateSignedCalls(intent.local.kind, intent.local.built, signed.signature) : (signed.calls as Call[]);\n } else {\n calls = intent.calls as Call[];\n }\n if (!calls?.length) throw new Error(\"No calls returned from intent\");\n\n const intentIds = before ? [before.id, intent.id] : [intent.id];\n if (before) calls = [...before.calls, ...calls];\n\n const { txHash } = await signer.execute(calls, { intentIds });\n await client.api.intents.confirm(intent.id, \"0x\" + txHash.replace(/^0x/, \"\").padStart(64, \"0\"));\n\n const settled = await pollUntilTerminal(client, intent.id, pollIntervalMs);\n if (settled.status === \"FAILED\") {\n throw new UserFacingError(\n \"Transaction was submitted but the marketplace order could not be confirmed onchain. \" +\n \"The order may have already been filled or expired — please refresh and try again.\"\n );\n }\n return { txHash, orderHash: settled.orderHash ?? null };\n}\n\nconst endTimeAfter = (durationSeconds: number) => Math.floor(Date.now() / 1000) + durationSeconds;\n\nconst LISTING_PROBLEM = \"The listing did not complete.\";\n\nexport async function createListing(ctx: MarketplaceContext, input: CreateListingInput, opts?: ActionOptions): Promise<MarketplaceResult> {\n try {\n return await runMarketplaceIntent(ctx, () => ctx.client.createIntent(\"listing\", {\n offerer: ctx.signer.address,\n nftContract: input.assetContract,\n tokenId: input.tokenId,\n currency: resolveCurrencyAddress(input.currencySymbol),\n price: input.price,\n endTime: endTimeAfter(input.durationSeconds),\n ...(isErc1155Standard(input.tokenStandard) ? { amount: input.amount || \"1\" } : {}),\n }), opts);\n } catch (err) {\n if (err instanceof SponsoredCallRejectedError && err.code === \"calls_mismatch\") {\n throw new SponsoredCallRejectedError(LISTING_PROBLEM, err);\n }\n throw err;\n }\n}\n\nexport function makeOffer(ctx: MarketplaceContext, input: MakeOfferInput, opts?: ActionOptions): Promise<MarketplaceResult> {\n return runMarketplaceIntent(ctx, () => ctx.client.createIntent(\"offer\", {\n offerer: ctx.signer.address,\n nftContract: input.assetContract,\n tokenId: input.tokenId,\n currency: resolveCurrencyAddress(input.currencySymbol),\n price: input.price,\n endTime: endTimeAfter(input.durationSeconds),\n tokenStandard: toApiStandard(input.tokenStandard),\n quantity: isErc1155Standard(input.tokenStandard) ? (input.quantity || \"1\") : undefined,\n }), opts);\n}\n\nexport function fulfillOrder(ctx: MarketplaceContext, input: FulfillOrderInput, opts?: ActionOptions): Promise<MarketplaceResult> {\n return runMarketplaceIntent(ctx, () => ctx.client.createIntent(\"fulfill\", {\n fulfiller: ctx.signer.address,\n orderHash: input.orderHash,\n tokenStandard: toApiStandard(input.tokenStandard),\n quantity: input.quantity,\n }), { ...opts, before: input.swap });\n}\n\nexport function cancelOrder(ctx: MarketplaceContext, input: CancelOrderInput, opts?: ActionOptions): Promise<MarketplaceResult> {\n return runMarketplaceIntent(ctx, () => ctx.client.createIntent(\"cancel\", {\n offerer: ctx.signer.address,\n orderHash: input.orderHash,\n tokenStandard: toApiStandard(input.tokenStandard),\n }), opts);\n}\n\nexport function makeCounterOffer(ctx: MarketplaceContext, input: MakeCounterOfferInput, opts?: ActionOptions): Promise<MarketplaceResult> {\n return runMarketplaceIntent(ctx, () => ctx.client.createIntent(\"counter-offer\", {\n sellerAddress: ctx.signer.address,\n originalOrderHash: input.originalOrderHash,\n durationSeconds: input.durationSeconds,\n priceRaw: input.counterPriceRaw,\n message: input.message,\n }), opts);\n}\n\nfunction isStarknetAddress(value: string): boolean {\n return /^0x[0-9a-fA-F]{1,64}$/.test(value) && value.replace(/^0x0*/, \"\").length > 0;\n}\n\nexport async function transferNft({ client, signer }: MarketplaceContext, input: TransferInput): Promise<string> {\n if (!isStarknetAddress(input.toAddress)) throw new UserFacingError(\"Invalid recipient address.\");\n if (!isStarknetAddress(input.contractAddress)) throw new UserFacingError(\"Invalid token contract address.\");\n if (!input.tokenStandard) {\n throw new UserFacingError(\"Token standard could not be determined. Please try again or contact support.\");\n }\n const intent = await client.createIntent(\"transfer-nft\", {\n owner: signer.address,\n contractAddress: input.contractAddress,\n tokenId: input.tokenId,\n recipient: input.toAddress,\n tokenStandard: input.tokenStandard === \"ERC1155\" ? \"ERC1155\" : \"ERC721\",\n });\n const calls = (intent as { calls?: Call[] }).calls;\n if (!calls?.length) throw new Error(\"No calls returned from intent\");\n const { txHash } = await signer.execute(calls, { intentIds: [intent.id] });\n return txHash;\n}\n"],"mappings":"AAAA,SAAS,uBAAuB;AAEhC,SAAS,4BAA4B,2BAAqE;AAE1G,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAmElC,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AAEzB,MAAM,oBAA4C,OAAO;AAAA,EACvD,iBAAiB,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC;AACnD;AAEA,SAAS,uBAAuB,iBAAiC;AAC/D,MAAI,gBAAgB,WAAW,IAAI,EAAG,QAAO;AAC7C,QAAM,UAAU,kBAAkB,gBAAgB,YAAY,CAAC;AAC/D,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,yBAAyB,eAAe,EAAE;AACxE,SAAO;AACT;AAEA,SAAS,cAAc,UAAqD;AAC1E,SAAO,aAAa,aAAa,aAAa,WAAW,WAAW;AACtE;AAEA,SAAS,kBAAkB,OAAyB;AAClD,MAAI,OAAO,UAAU,SAAU,QAAO,kBAAkB,MAAM,YAAY,CAAC,KAAK;AAChF,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,iBAAiB;AAC5D,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,WAAO,OAAO;AAAA,MACZ,OAAO,QAAQ,KAAgC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC;AAAA,IAC5F;AAAA,EACF;AACA,SAAO;AACT;AAOA,eAAe,kBAAkB,QAAyB,IAAY,YAA4C;AAChH,WAAS,IAAI,GAAG,IAAI,mBAAmB,KAAK;AAC1C,QAAI,IAAI,EAAG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AAM;AAAA,IACf,WAAW,MAAM;AAAA,IACjB,eAAe,MAAM,kBAAkB,YAAY,YAAY;AAAA,EACjE,CAAC;AACD,QAAM,QAAS,OAA8B;AAC7C,MAAI,CAAC,OAAO,OAAQ,OAAM,IAAI,MAAM,+BAA+B;AACnE,QAAM,EAAE,OAAO,IAAI,MAAM,OAAO,QAAQ,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;AACzE,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var remix_approval_exports = {};
|
|
20
|
+
__export(remix_approval_exports, {
|
|
21
|
+
approveRemix: () => approveRemix
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(remix_approval_exports);
|
|
24
|
+
var import_sdk = require("@medialane/sdk");
|
|
25
|
+
var import_starknet = require("@medialane/sdk/starknet");
|
|
26
|
+
var import_ipfs_upload = require("../ipfs-upload.js");
|
|
27
|
+
var import_intents = require("./intents.js");
|
|
28
|
+
const LISTING_DURATION_SECONDS = 30 * 24 * 60 * 60;
|
|
29
|
+
const LISTING_LOOKUP_INTERVAL_MS = 2e3;
|
|
30
|
+
const LISTING_LOOKUP_WAIT_MS = 15e3;
|
|
31
|
+
function remixMetadata(offer, name, creator) {
|
|
32
|
+
return {
|
|
33
|
+
name,
|
|
34
|
+
description: `Remix of Token #${offer.originalTokenId}`,
|
|
35
|
+
image: "",
|
|
36
|
+
attributes: [
|
|
37
|
+
{ trait_type: "Parent Contract", value: offer.originalContract },
|
|
38
|
+
{ trait_type: "Parent Token ID", value: offer.originalTokenId },
|
|
39
|
+
{ trait_type: "Remix Type", value: "Derivative" },
|
|
40
|
+
{ trait_type: "License", value: offer.licenseType },
|
|
41
|
+
{ trait_type: "Commercial Use", value: offer.commercial ? "Yes" : "No" },
|
|
42
|
+
{ trait_type: "Derivatives", value: offer.derivatives ? "Yes" : "No" },
|
|
43
|
+
...offer.royaltyPct != null ? [{ trait_type: "Royalty", value: `${offer.royaltyPct}%` }] : [],
|
|
44
|
+
{ trait_type: "Creator", value: creator }
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async function findActiveListing({ client }, { contractAddress, standard }, tokenId, waitMs) {
|
|
49
|
+
const deadline = Date.now() + waitMs;
|
|
50
|
+
for (; ; ) {
|
|
51
|
+
try {
|
|
52
|
+
const { data } = await client.api.orders.forToken(contractAddress, tokenId);
|
|
53
|
+
const listing = data?.find((o) => o.status === "ACTIVE" && o.offer.itemType === standard);
|
|
54
|
+
if (listing) return listing.orderHash;
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
if (Date.now() + LISTING_LOOKUP_INTERVAL_MS > deadline) return null;
|
|
58
|
+
await new Promise((r) => setTimeout(r, LISTING_LOOKUP_INTERVAL_MS));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function approveRemix(ctx, { offer, collection, name }, { pollIntervalMs, listingWaitMs = LISTING_LOOKUP_WAIT_MS } = {}) {
|
|
62
|
+
const { client, signer } = ctx;
|
|
63
|
+
const owner = signer.address;
|
|
64
|
+
const is1155 = collection.standard === "ERC1155";
|
|
65
|
+
const tokenUri = await (0, import_ipfs_upload.uploadJsonToIpfs)(client.api, remixMetadata(offer, name, owner));
|
|
66
|
+
const mintIntent = await client.api.intents.create("mint", is1155 ? { owner, recipient: owner, collectionContract: collection.contractAddress, tokenUri, value: "1" } : { owner, collectionId: collection.collectionId, recipient: owner, tokenUri, royaltyBps: 0 });
|
|
67
|
+
const { receipt } = await (0, import_starknet.executeIntent)(signer, client, mintIntent, { confirm: false });
|
|
68
|
+
const tokenId = (0, import_starknet.mintedTokenIdFromReceipt)(receipt, collection.contractAddress);
|
|
69
|
+
if (!tokenId) throw new Error("Minted, but could not read the assigned token id from the receipt");
|
|
70
|
+
const listing = await (0, import_intents.createListing)(ctx, {
|
|
71
|
+
assetContract: collection.contractAddress,
|
|
72
|
+
tokenId,
|
|
73
|
+
price: offer.price ? (0, import_sdk.formatAmount)(offer.price.raw, offer.price.decimals) : "0",
|
|
74
|
+
currencySymbol: offer.price?.currency ?? "STRK",
|
|
75
|
+
durationSeconds: LISTING_DURATION_SECONDS,
|
|
76
|
+
tokenStandard: is1155 ? "ERC1155" : void 0,
|
|
77
|
+
amount: is1155 ? "1" : void 0
|
|
78
|
+
}, { pollIntervalMs });
|
|
79
|
+
const orderHash = listing.orderHash ?? await findActiveListing(ctx, collection, tokenId, listingWaitMs);
|
|
80
|
+
if (!orderHash) throw new Error("Could not confirm listing orderHash \u2014 check portfolio shortly");
|
|
81
|
+
await client.api.remix.confirm(offer.id, {
|
|
82
|
+
remixContract: collection.contractAddress,
|
|
83
|
+
remixTokenId: tokenId,
|
|
84
|
+
approvedCollection: collection.contractAddress,
|
|
85
|
+
orderHash
|
|
86
|
+
});
|
|
87
|
+
return { contract: collection.contractAddress, tokenId };
|
|
88
|
+
}
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
approveRemix
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=remix-approval.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/marketplace/remix-approval.ts"],"sourcesContent":["import { formatAmount } from \"@medialane/sdk\";\nimport { executeIntent, mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport { uploadJsonToIpfs } from \"../ipfs-upload.js\";\nimport type { ApiRemixOffer as RemixOffer } from \"@medialane/sdk\";\nimport { createListing, type MarketplaceContext } from \"./intents.js\";\n\nexport interface RemixCollection {\n contractAddress: string;\n collectionId: string | null;\n standard: \"ERC721\" | \"ERC1155\";\n}\n\nexport interface RemixApprovalInput {\n offer: RemixOffer;\n collection: RemixCollection;\n name: string;\n}\n\ninterface ApprovalOptions {\n pollIntervalMs?: number;\n listingWaitMs?: number;\n}\n\nconst LISTING_DURATION_SECONDS = 30 * 24 * 60 * 60;\nconst LISTING_LOOKUP_INTERVAL_MS = 2000;\nconst LISTING_LOOKUP_WAIT_MS = 15_000;\n\nfunction remixMetadata(offer: RemixOffer, name: string, creator: string) {\n return {\n name,\n description: `Remix of Token #${offer.originalTokenId}`,\n image: \"\",\n attributes: [\n { trait_type: \"Parent Contract\", value: offer.originalContract },\n { trait_type: \"Parent Token ID\", value: offer.originalTokenId },\n { trait_type: \"Remix Type\", value: \"Derivative\" },\n { trait_type: \"License\", value: offer.licenseType },\n { trait_type: \"Commercial Use\", value: offer.commercial ? \"Yes\" : \"No\" },\n { trait_type: \"Derivatives\", value: offer.derivatives ? \"Yes\" : \"No\" },\n ...(offer.royaltyPct != null ? [{ trait_type: \"Royalty\", value: `${offer.royaltyPct}%` }] : []),\n { trait_type: \"Creator\", value: creator },\n ],\n };\n}\n\nasync function findActiveListing(\n { client }: MarketplaceContext,\n { contractAddress, standard }: RemixCollection,\n tokenId: string,\n waitMs: number,\n): Promise<string | null> {\n const deadline = Date.now() + waitMs;\n for (;;) {\n try {\n const { data } = await client.api.orders.forToken(contractAddress, tokenId);\n const listing = data?.find((o) => o.status === \"ACTIVE\" && o.offer.itemType === standard);\n if (listing) return listing.orderHash;\n } catch {\n }\n if (Date.now() + LISTING_LOOKUP_INTERVAL_MS > deadline) return null;\n await new Promise((r) => setTimeout(r, LISTING_LOOKUP_INTERVAL_MS));\n }\n}\n\nexport async function approveRemix(\n ctx: MarketplaceContext,\n { offer, collection, name }: RemixApprovalInput,\n { pollIntervalMs, listingWaitMs = LISTING_LOOKUP_WAIT_MS }: ApprovalOptions = {},\n): Promise<{ contract: string; tokenId: string }> {\n const { client, signer } = ctx;\n const owner = signer.address;\n const is1155 = collection.standard === \"ERC1155\";\n\n const tokenUri = await uploadJsonToIpfs(client.api, remixMetadata(offer, name, owner));\n const mintIntent = await client.api.intents.create(\"mint\", is1155\n ? { owner, recipient: owner, collectionContract: collection.contractAddress, tokenUri, value: \"1\" }\n : { owner, collectionId: collection.collectionId!, recipient: owner, tokenUri, royaltyBps: 0 });\n const { receipt } = await executeIntent(signer, client, mintIntent, { confirm: false });\n const tokenId = mintedTokenIdFromReceipt(receipt, collection.contractAddress);\n if (!tokenId) throw new Error(\"Minted, but could not read the assigned token id from the receipt\");\n\n const listing = await createListing(ctx, {\n assetContract: collection.contractAddress,\n tokenId,\n price: offer.price ? formatAmount(offer.price.raw, offer.price.decimals) : \"0\",\n currencySymbol: offer.price?.currency ?? \"STRK\",\n durationSeconds: LISTING_DURATION_SECONDS,\n tokenStandard: is1155 ? \"ERC1155\" : undefined,\n amount: is1155 ? \"1\" : undefined,\n }, { pollIntervalMs });\n\n const orderHash = listing.orderHash ?? await findActiveListing(ctx, collection, tokenId, listingWaitMs);\n if (!orderHash) throw new Error(\"Could not confirm listing orderHash — check portfolio shortly\");\n\n await client.api.remix.confirm(offer.id, {\n remixContract: collection.contractAddress,\n remixTokenId: tokenId,\n approvedCollection: collection.contractAddress,\n orderHash,\n });\n return { contract: collection.contractAddress, tokenId };\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Q,MAAM,IAAI;AAAA,IACvC,eAAe,WAAW;AAAA,IAC1B,cAAc;AAAA,IACd,oBAAoB,WAAW;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO,EAAE,UAAU,WAAW,iBAAiB,QAAQ;AACzD;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApiRemixOffer } from '@medialane/sdk';
|
|
2
|
+
import { MarketplaceContext } from './intents.cjs';
|
|
3
|
+
import '../../components/fast-mint/types.cjs';
|
|
4
|
+
import 'starknet';
|
|
5
|
+
import '@medialane/sdk/starknet';
|
|
6
|
+
|
|
7
|
+
interface RemixCollection {
|
|
8
|
+
contractAddress: string;
|
|
9
|
+
collectionId: string | null;
|
|
10
|
+
standard: "ERC721" | "ERC1155";
|
|
11
|
+
}
|
|
12
|
+
interface RemixApprovalInput {
|
|
13
|
+
offer: ApiRemixOffer;
|
|
14
|
+
collection: RemixCollection;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
interface ApprovalOptions {
|
|
18
|
+
pollIntervalMs?: number;
|
|
19
|
+
listingWaitMs?: number;
|
|
20
|
+
}
|
|
21
|
+
declare function approveRemix(ctx: MarketplaceContext, { offer, collection, name }: RemixApprovalInput, { pollIntervalMs, listingWaitMs }?: ApprovalOptions): Promise<{
|
|
22
|
+
contract: string;
|
|
23
|
+
tokenId: string;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
export { type RemixApprovalInput, type RemixCollection, approveRemix };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApiRemixOffer } from '@medialane/sdk';
|
|
2
|
+
import { MarketplaceContext } from './intents.js';
|
|
3
|
+
import '../../components/fast-mint/types.js';
|
|
4
|
+
import 'starknet';
|
|
5
|
+
import '@medialane/sdk/starknet';
|
|
6
|
+
|
|
7
|
+
interface RemixCollection {
|
|
8
|
+
contractAddress: string;
|
|
9
|
+
collectionId: string | null;
|
|
10
|
+
standard: "ERC721" | "ERC1155";
|
|
11
|
+
}
|
|
12
|
+
interface RemixApprovalInput {
|
|
13
|
+
offer: ApiRemixOffer;
|
|
14
|
+
collection: RemixCollection;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
interface ApprovalOptions {
|
|
18
|
+
pollIntervalMs?: number;
|
|
19
|
+
listingWaitMs?: number;
|
|
20
|
+
}
|
|
21
|
+
declare function approveRemix(ctx: MarketplaceContext, { offer, collection, name }: RemixApprovalInput, { pollIntervalMs, listingWaitMs }?: ApprovalOptions): Promise<{
|
|
22
|
+
contract: string;
|
|
23
|
+
tokenId: string;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
export { type RemixApprovalInput, type RemixCollection, approveRemix };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { formatAmount } from "@medialane/sdk";
|
|
2
|
+
import { executeIntent, mintedTokenIdFromReceipt } from "@medialane/sdk/starknet";
|
|
3
|
+
import { uploadJsonToIpfs } from "../ipfs-upload.js";
|
|
4
|
+
import { createListing } from "./intents.js";
|
|
5
|
+
const LISTING_DURATION_SECONDS = 30 * 24 * 60 * 60;
|
|
6
|
+
const LISTING_LOOKUP_INTERVAL_MS = 2e3;
|
|
7
|
+
const LISTING_LOOKUP_WAIT_MS = 15e3;
|
|
8
|
+
function remixMetadata(offer, name, creator) {
|
|
9
|
+
return {
|
|
10
|
+
name,
|
|
11
|
+
description: `Remix of Token #${offer.originalTokenId}`,
|
|
12
|
+
image: "",
|
|
13
|
+
attributes: [
|
|
14
|
+
{ trait_type: "Parent Contract", value: offer.originalContract },
|
|
15
|
+
{ trait_type: "Parent Token ID", value: offer.originalTokenId },
|
|
16
|
+
{ trait_type: "Remix Type", value: "Derivative" },
|
|
17
|
+
{ trait_type: "License", value: offer.licenseType },
|
|
18
|
+
{ trait_type: "Commercial Use", value: offer.commercial ? "Yes" : "No" },
|
|
19
|
+
{ trait_type: "Derivatives", value: offer.derivatives ? "Yes" : "No" },
|
|
20
|
+
...offer.royaltyPct != null ? [{ trait_type: "Royalty", value: `${offer.royaltyPct}%` }] : [],
|
|
21
|
+
{ trait_type: "Creator", value: creator }
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async function findActiveListing({ client }, { contractAddress, standard }, tokenId, waitMs) {
|
|
26
|
+
const deadline = Date.now() + waitMs;
|
|
27
|
+
for (; ; ) {
|
|
28
|
+
try {
|
|
29
|
+
const { data } = await client.api.orders.forToken(contractAddress, tokenId);
|
|
30
|
+
const listing = data?.find((o) => o.status === "ACTIVE" && o.offer.itemType === standard);
|
|
31
|
+
if (listing) return listing.orderHash;
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
if (Date.now() + LISTING_LOOKUP_INTERVAL_MS > deadline) return null;
|
|
35
|
+
await new Promise((r) => setTimeout(r, LISTING_LOOKUP_INTERVAL_MS));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function approveRemix(ctx, { offer, collection, name }, { pollIntervalMs, listingWaitMs = LISTING_LOOKUP_WAIT_MS } = {}) {
|
|
39
|
+
const { client, signer } = ctx;
|
|
40
|
+
const owner = signer.address;
|
|
41
|
+
const is1155 = collection.standard === "ERC1155";
|
|
42
|
+
const tokenUri = await uploadJsonToIpfs(client.api, remixMetadata(offer, name, owner));
|
|
43
|
+
const mintIntent = await client.api.intents.create("mint", is1155 ? { owner, recipient: owner, collectionContract: collection.contractAddress, tokenUri, value: "1" } : { owner, collectionId: collection.collectionId, recipient: owner, tokenUri, royaltyBps: 0 });
|
|
44
|
+
const { receipt } = await executeIntent(signer, client, mintIntent, { confirm: false });
|
|
45
|
+
const tokenId = mintedTokenIdFromReceipt(receipt, collection.contractAddress);
|
|
46
|
+
if (!tokenId) throw new Error("Minted, but could not read the assigned token id from the receipt");
|
|
47
|
+
const listing = await createListing(ctx, {
|
|
48
|
+
assetContract: collection.contractAddress,
|
|
49
|
+
tokenId,
|
|
50
|
+
price: offer.price ? formatAmount(offer.price.raw, offer.price.decimals) : "0",
|
|
51
|
+
currencySymbol: offer.price?.currency ?? "STRK",
|
|
52
|
+
durationSeconds: LISTING_DURATION_SECONDS,
|
|
53
|
+
tokenStandard: is1155 ? "ERC1155" : void 0,
|
|
54
|
+
amount: is1155 ? "1" : void 0
|
|
55
|
+
}, { pollIntervalMs });
|
|
56
|
+
const orderHash = listing.orderHash ?? await findActiveListing(ctx, collection, tokenId, listingWaitMs);
|
|
57
|
+
if (!orderHash) throw new Error("Could not confirm listing orderHash \u2014 check portfolio shortly");
|
|
58
|
+
await client.api.remix.confirm(offer.id, {
|
|
59
|
+
remixContract: collection.contractAddress,
|
|
60
|
+
remixTokenId: tokenId,
|
|
61
|
+
approvedCollection: collection.contractAddress,
|
|
62
|
+
orderHash
|
|
63
|
+
});
|
|
64
|
+
return { contract: collection.contractAddress, tokenId };
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
approveRemix
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=remix-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/marketplace/remix-approval.ts"],"sourcesContent":["import { formatAmount } from \"@medialane/sdk\";\nimport { executeIntent, mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport { uploadJsonToIpfs } from \"../ipfs-upload.js\";\nimport type { ApiRemixOffer as RemixOffer } from \"@medialane/sdk\";\nimport { createListing, type MarketplaceContext } from \"./intents.js\";\n\nexport interface RemixCollection {\n contractAddress: string;\n collectionId: string | null;\n standard: \"ERC721\" | \"ERC1155\";\n}\n\nexport interface RemixApprovalInput {\n offer: RemixOffer;\n collection: RemixCollection;\n name: string;\n}\n\ninterface ApprovalOptions {\n pollIntervalMs?: number;\n listingWaitMs?: number;\n}\n\nconst LISTING_DURATION_SECONDS = 30 * 24 * 60 * 60;\nconst LISTING_LOOKUP_INTERVAL_MS = 2000;\nconst LISTING_LOOKUP_WAIT_MS = 15_000;\n\nfunction remixMetadata(offer: RemixOffer, name: string, creator: string) {\n return {\n name,\n description: `Remix of Token #${offer.originalTokenId}`,\n image: \"\",\n attributes: [\n { trait_type: \"Parent Contract\", value: offer.originalContract },\n { trait_type: \"Parent Token ID\", value: offer.originalTokenId },\n { trait_type: \"Remix Type\", value: \"Derivative\" },\n { trait_type: \"License\", value: offer.licenseType },\n { trait_type: \"Commercial Use\", value: offer.commercial ? \"Yes\" : \"No\" },\n { trait_type: \"Derivatives\", value: offer.derivatives ? \"Yes\" : \"No\" },\n ...(offer.royaltyPct != null ? [{ trait_type: \"Royalty\", value: `${offer.royaltyPct}%` }] : []),\n { trait_type: \"Creator\", value: creator },\n ],\n };\n}\n\nasync function findActiveListing(\n { client }: MarketplaceContext,\n { contractAddress, standard }: RemixCollection,\n tokenId: string,\n waitMs: number,\n): Promise<string | null> {\n const deadline = Date.now() + waitMs;\n for (;;) {\n try {\n const { data } = await client.api.orders.forToken(contractAddress, tokenId);\n const listing = data?.find((o) => o.status === \"ACTIVE\" && o.offer.itemType === standard);\n if (listing) return listing.orderHash;\n } catch {\n }\n if (Date.now() + LISTING_LOOKUP_INTERVAL_MS > deadline) return null;\n await new Promise((r) => setTimeout(r, LISTING_LOOKUP_INTERVAL_MS));\n }\n}\n\nexport async function approveRemix(\n ctx: MarketplaceContext,\n { offer, collection, name }: RemixApprovalInput,\n { pollIntervalMs, listingWaitMs = LISTING_LOOKUP_WAIT_MS }: ApprovalOptions = {},\n): Promise<{ contract: string; tokenId: string }> {\n const { client, signer } = ctx;\n const owner = signer.address;\n const is1155 = collection.standard === \"ERC1155\";\n\n const tokenUri = await uploadJsonToIpfs(client.api, remixMetadata(offer, name, owner));\n const mintIntent = await client.api.intents.create(\"mint\", is1155\n ? { owner, recipient: owner, collectionContract: collection.contractAddress, tokenUri, value: \"1\" }\n : { owner, collectionId: collection.collectionId!, recipient: owner, tokenUri, royaltyBps: 0 });\n const { receipt } = await executeIntent(signer, client, mintIntent, { confirm: false });\n const tokenId = mintedTokenIdFromReceipt(receipt, collection.contractAddress);\n if (!tokenId) throw new Error(\"Minted, but could not read the assigned token id from the receipt\");\n\n const listing = await createListing(ctx, {\n assetContract: collection.contractAddress,\n tokenId,\n price: offer.price ? formatAmount(offer.price.raw, offer.price.decimals) : \"0\",\n currencySymbol: offer.price?.currency ?? \"STRK\",\n durationSeconds: LISTING_DURATION_SECONDS,\n tokenStandard: is1155 ? \"ERC1155\" : undefined,\n amount: is1155 ? \"1\" : undefined,\n }, { pollIntervalMs });\n\n const orderHash = listing.orderHash ?? await findActiveListing(ctx, collection, tokenId, listingWaitMs);\n if (!orderHash) throw new Error(\"Could not confirm listing orderHash — check portfolio shortly\");\n\n await client.api.remix.confirm(offer.id, {\n remixContract: collection.contractAddress,\n remixTokenId: tokenId,\n approvedCollection: collection.contractAddress,\n orderHash,\n });\n return { contract: collection.contractAddress, tokenId };\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe,gCAAgC;AACxD,SAAS,wBAAwB;AAEjC,SAAS,qBAA8C;AAmBvD,MAAM,2BAA2B,KAAK,KAAK,KAAK;AAChD,MAAM,6BAA6B;AACnC,MAAM,yBAAyB;AAE/B,SAAS,cAAc,OAAmB,MAAc,SAAiB;AACvE,SAAO;AAAA,IACL;AAAA,IACA,aAAa,mBAAmB,MAAM,eAAe;AAAA,IACrD,OAAO;AAAA,IACP,YAAY;AAAA,MACV,EAAE,YAAY,mBAAmB,OAAO,MAAM,iBAAiB;AAAA,MAC/D,EAAE,YAAY,mBAAmB,OAAO,MAAM,gBAAgB;AAAA,MAC9D,EAAE,YAAY,cAAc,OAAO,aAAa;AAAA,MAChD,EAAE,YAAY,WAAW,OAAO,MAAM,YAAY;AAAA,MAClD,EAAE,YAAY,kBAAkB,OAAO,MAAM,aAAa,QAAQ,KAAK;AAAA,MACvE,EAAE,YAAY,eAAe,OAAO,MAAM,cAAc,QAAQ,KAAK;AAAA,MACrE,GAAI,MAAM,cAAc,OAAO,CAAC,EAAE,YAAY,WAAW,OAAO,G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AS,OAAM,IAAI,MAAM,mEAAmE;AAEjG,QAAM,UAAU,MAAM,cAAc,KAAK;AAAA,IACvC,eAAe,WAAW;AAAA,IAC1B;AAAA,IACA,OAAO,MAAM,QAAQ,aAAa,MAAM,MAAM,KAAK,MAAM,MAAM,QAAQ,IAAI;AAAA,IAC3E,gBAAgB,MAAM,OAAO,YAAY;AAAA,IACzC,iBAAiB;AAAA,IACjB,eAAe,SAAS,YAAY;AAAA,IACpC,QAAQ,SAAS,MAAM;AAAA,EACzB,GAAG,EAAE,eAAe,CAAC;AAErB,QAAM,YAAY,QAAQ,aAAa,MAAM,kBAAkB,KAAK,YAAY,SAAS,aAAa;AACtG,MAAI,CAAC,UAAW,OAAM,IAAI,MAAM,oEAA+D;AAE/F,QAAM,OAAO,IAAI,MAAM,QAAQ,MAAM,IAAI;AAAA,IACvC,eAAe,WAAW;AAAA,IAC1B,cAAc;AAAA,IACd,oBAAoB,WAAW;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO,EAAE,UAAU,WAAW,iBAAiB,QAAQ;AACzD;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var swap_intent_exports = {};
|
|
20
|
+
__export(swap_intent_exports, {
|
|
21
|
+
createSwapIntent: () => createSwapIntent
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(swap_intent_exports);
|
|
24
|
+
var import_sdk = require("@medialane/sdk");
|
|
25
|
+
function tokenAddress(token) {
|
|
26
|
+
if (typeof token !== "string") return token.address;
|
|
27
|
+
const known = (0, import_sdk.getTokenBySymbol)(token);
|
|
28
|
+
if (!known) throw new Error(`Unsupported currency: ${token}`);
|
|
29
|
+
return known.address;
|
|
30
|
+
}
|
|
31
|
+
async function createSwapIntent(client, params) {
|
|
32
|
+
const amountMode = params.amountMode ?? "buy";
|
|
33
|
+
const created = await client.createIntent("swap", {
|
|
34
|
+
taker: params.takerAddress,
|
|
35
|
+
sellTokenAddress: tokenAddress(params.sell),
|
|
36
|
+
buyTokenAddress: tokenAddress(params.buy),
|
|
37
|
+
[`${amountMode}AmountRaw`]: params.amountRaw
|
|
38
|
+
});
|
|
39
|
+
const intent = created;
|
|
40
|
+
return { id: intent.id, calls: intent.calls };
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
createSwapIntent
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=swap-intent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/marketplace/swap-intent.ts"],"sourcesContent":["import type { Call } from \"starknet\";\nimport { getTokenBySymbol } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { SwapAmountMode, SwapToken } from \"../use-swap-quote.js\";\n\ninterface CreateSwapIntentParams {\n sell: SwapToken;\n buy: SwapToken;\n takerAddress: string;\n amountRaw: string;\n\n amountMode?: SwapAmountMode;\n}\n\nfunction tokenAddress(token: SwapToken): string {\n if (typeof token !== \"string\") return token.address;\n const known = getTokenBySymbol(token);\n if (!known) throw new Error(`Unsupported currency: ${token}`);\n return known.address;\n}\n\nexport async function createSwapIntent(\n client: Pick<MedialaneClient, \"createIntent\">,\n params: CreateSwapIntentParams,\n): Promise<{ id: string; calls: Call[] }> {\n const amountMode = params.amountMode ?? \"buy\";\n const created = await client.createIntent(\"swap\", {\n taker: params.takerAddress,\n sellTokenAddress: tokenAddress(params.sell),\n buyTokenAddress: tokenAddress(params.buy),\n [`${amountMode}AmountRaw`]: params.amountRaw,\n });\n const intent = created as { id: string; calls: Call[] };\n return { id: intent.id, calls: intent.calls };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAiC;AAajC,SAAS,aAAa,OAA0B;AAC9C,MAAI,OAAO,UAAU,SAAU,QAAO,MAAM;AAC5C,QAAM,YAAQ,6BAAiB,KAAK;AACpC,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,yBAAyB,KAAK,EAAE;AAC5D,SAAO,MAAM;AACf;AAEA,eAAsB,iBACpB,QACA,QACwC;AACxC,QAAM,aAAa,OAAO,cAAc;AACxC,QAAM,UAAU,MAAM,OAAO,aAAa,QAAQ;AAAA,IAChD,OAAO,OAAO;AAAA,IACd,kBAAkB,aAAa,OAAO,IAAI;AAAA,IAC1C,iBAAiB,aAAa,OAAO,GAAG;AAAA,IACxC,CAAC,GAAG,UAAU,WAAW,GAAG,OAAO;AAAA,EACrC,CAAC;AACD,QAAM,SAAS;AACf,SAAO,EAAE,IAAI,OAAO,IAAI,OAAO,OAAO,MAAM;AAC9C;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Call } from 'starknet';
|
|
2
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
+
import { SwapToken, SwapAmountMode } from '../use-swap-quote.cjs';
|
|
4
|
+
import '@medialane/sdk';
|
|
5
|
+
|
|
6
|
+
interface CreateSwapIntentParams {
|
|
7
|
+
sell: SwapToken;
|
|
8
|
+
buy: SwapToken;
|
|
9
|
+
takerAddress: string;
|
|
10
|
+
amountRaw: string;
|
|
11
|
+
amountMode?: SwapAmountMode;
|
|
12
|
+
}
|
|
13
|
+
declare function createSwapIntent(client: Pick<MedialaneClient, "createIntent">, params: CreateSwapIntentParams): Promise<{
|
|
14
|
+
id: string;
|
|
15
|
+
calls: Call[];
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export { createSwapIntent };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Call } from 'starknet';
|
|
2
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
+
import { SwapToken, SwapAmountMode } from '../use-swap-quote.js';
|
|
4
|
+
import '@medialane/sdk';
|
|
5
|
+
|
|
6
|
+
interface CreateSwapIntentParams {
|
|
7
|
+
sell: SwapToken;
|
|
8
|
+
buy: SwapToken;
|
|
9
|
+
takerAddress: string;
|
|
10
|
+
amountRaw: string;
|
|
11
|
+
amountMode?: SwapAmountMode;
|
|
12
|
+
}
|
|
13
|
+
declare function createSwapIntent(client: Pick<MedialaneClient, "createIntent">, params: CreateSwapIntentParams): Promise<{
|
|
14
|
+
id: string;
|
|
15
|
+
calls: Call[];
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export { createSwapIntent };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getTokenBySymbol } from "@medialane/sdk";
|
|
2
|
+
function tokenAddress(token) {
|
|
3
|
+
if (typeof token !== "string") return token.address;
|
|
4
|
+
const known = getTokenBySymbol(token);
|
|
5
|
+
if (!known) throw new Error(`Unsupported currency: ${token}`);
|
|
6
|
+
return known.address;
|
|
7
|
+
}
|
|
8
|
+
async function createSwapIntent(client, params) {
|
|
9
|
+
const amountMode = params.amountMode ?? "buy";
|
|
10
|
+
const created = await client.createIntent("swap", {
|
|
11
|
+
taker: params.takerAddress,
|
|
12
|
+
sellTokenAddress: tokenAddress(params.sell),
|
|
13
|
+
buyTokenAddress: tokenAddress(params.buy),
|
|
14
|
+
[`${amountMode}AmountRaw`]: params.amountRaw
|
|
15
|
+
});
|
|
16
|
+
const intent = created;
|
|
17
|
+
return { id: intent.id, calls: intent.calls };
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
createSwapIntent
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=swap-intent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/marketplace/swap-intent.ts"],"sourcesContent":["import type { Call } from \"starknet\";\nimport { getTokenBySymbol } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { SwapAmountMode, SwapToken } from \"../use-swap-quote.js\";\n\ninterface CreateSwapIntentParams {\n sell: SwapToken;\n buy: SwapToken;\n takerAddress: string;\n amountRaw: string;\n\n amountMode?: SwapAmountMode;\n}\n\nfunction tokenAddress(token: SwapToken): string {\n if (typeof token !== \"string\") return token.address;\n const known = getTokenBySymbol(token);\n if (!known) throw new Error(`Unsupported currency: ${token}`);\n return known.address;\n}\n\nexport async function createSwapIntent(\n client: Pick<MedialaneClient, \"createIntent\">,\n params: CreateSwapIntentParams,\n): Promise<{ id: string; calls: Call[] }> {\n const amountMode = params.amountMode ?? \"buy\";\n const created = await client.createIntent(\"swap\", {\n taker: params.takerAddress,\n sellTokenAddress: tokenAddress(params.sell),\n buyTokenAddress: tokenAddress(params.buy),\n [`${amountMode}AmountRaw`]: params.amountRaw,\n });\n const intent = created as { id: string; calls: Call[] };\n return { id: intent.id, calls: intent.calls };\n}\n"],"mappings":"AACA,SAAS,wBAAwB;AAajC,SAAS,aAAa,OAA0B;AAC9C,MAAI,OAAO,UAAU,SAAU,QAAO,MAAM;AAC5C,QAAM,QAAQ,iBAAiB,KAAK;AACpC,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,yBAAyB,KAAK,EAAE;AAC5D,SAAO,MAAM;AACf;AAEA,eAAsB,iBACpB,QACA,QACwC;AACxC,QAAM,aAAa,OAAO,cAAc;AACxC,QAAM,UAAU,MAAM,OAAO,aAAa,QAAQ;AAAA,IAChD,OAAO,OAAO;AAAA,IACd,kBAAkB,aAAa,OAAO,IAAI;AAAA,IAC1C,iBAAiB,aAAa,OAAO,GAAG;AAAA,IACxC,CAAC,GAAG,UAAU,WAAW,GAAG,OAAO;AAAA,EACrC,CAAC;AACD,QAAM,SAAS;AACf,SAAO,EAAE,IAAI,OAAO,IAAI,OAAO,OAAO,MAAM;AAC9C;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var token_standard_exports = {};
|
|
20
|
+
__export(token_standard_exports, {
|
|
21
|
+
isErc1155Standard: () => isErc1155Standard,
|
|
22
|
+
orderNftStandard: () => orderNftStandard,
|
|
23
|
+
resolveTokenStandard: () => resolveTokenStandard
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(token_standard_exports);
|
|
26
|
+
function isErc1155Standard(standard) {
|
|
27
|
+
return standard === "ERC1155";
|
|
28
|
+
}
|
|
29
|
+
function isKnownTokenStandard(standard) {
|
|
30
|
+
return standard === "ERC721" || standard === "ERC1155";
|
|
31
|
+
}
|
|
32
|
+
function resolveTokenStandard(preferred, fallback) {
|
|
33
|
+
if (isKnownTokenStandard(preferred)) return preferred;
|
|
34
|
+
if (isKnownTokenStandard(fallback)) return fallback;
|
|
35
|
+
return "UNKNOWN";
|
|
36
|
+
}
|
|
37
|
+
function orderNftStandard(order) {
|
|
38
|
+
return order.offer.itemType === "ERC20" ? order.consideration.itemType : order.offer.itemType;
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
isErc1155Standard,
|
|
43
|
+
orderNftStandard,
|
|
44
|
+
resolveTokenStandard
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=token-standard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/marketplace/token-standard.ts"],"sourcesContent":["export type TokenStandard = \"ERC721\" | \"ERC1155\" | \"UNKNOWN\";\n\nexport function isErc1155Standard(standard: string | null | undefined): standard is \"ERC1155\" {\n return standard === \"ERC1155\";\n}\n\nfunction isKnownTokenStandard(\n standard: string | null | undefined\n): standard is Exclude<TokenStandard, \"UNKNOWN\"> {\n return standard === \"ERC721\" || standard === \"ERC1155\";\n}\n\nexport function resolveTokenStandard(\n preferred?: string | null,\n fallback?: string | null\n): TokenStandard {\n if (isKnownTokenStandard(preferred)) return preferred;\n if (isKnownTokenStandard(fallback)) return fallback;\n return \"UNKNOWN\";\n}\n\nexport function orderNftStandard(order: { offer: { itemType: string }; consideration: { itemType: string } }): string {\n return order.offer.itemType === \"ERC20\" ? order.consideration.itemType : order.offer.itemType;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,kBAAkB,UAA4D;AAC5F,SAAO,aAAa;AACtB;AAEA,SAAS,qBACP,UAC+C;AAC/C,SAAO,aAAa,YAAY,aAAa;AAC/C;AAEO,SAAS,qBACd,WACA,UACe;AACf,MAAI,qBAAqB,SAAS,EAAG,QAAO;AAC5C,MAAI,qBAAqB,QAAQ,EAAG,QAAO;AAC3C,SAAO;AACT;AAEO,SAAS,iBAAiB,OAAqF;AACpH,SAAO,MAAM,MAAM,aAAa,UAAU,MAAM,cAAc,WAAW,MAAM,MAAM;AACvF;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type TokenStandard = "ERC721" | "ERC1155" | "UNKNOWN";
|
|
2
|
+
declare function isErc1155Standard(standard: string | null | undefined): standard is "ERC1155";
|
|
3
|
+
declare function resolveTokenStandard(preferred?: string | null, fallback?: string | null): TokenStandard;
|
|
4
|
+
declare function orderNftStandard(order: {
|
|
5
|
+
offer: {
|
|
6
|
+
itemType: string;
|
|
7
|
+
};
|
|
8
|
+
consideration: {
|
|
9
|
+
itemType: string;
|
|
10
|
+
};
|
|
11
|
+
}): string;
|
|
12
|
+
|
|
13
|
+
export { type TokenStandard, isErc1155Standard, orderNftStandard, resolveTokenStandard };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type TokenStandard = "ERC721" | "ERC1155" | "UNKNOWN";
|
|
2
|
+
declare function isErc1155Standard(standard: string | null | undefined): standard is "ERC1155";
|
|
3
|
+
declare function resolveTokenStandard(preferred?: string | null, fallback?: string | null): TokenStandard;
|
|
4
|
+
declare function orderNftStandard(order: {
|
|
5
|
+
offer: {
|
|
6
|
+
itemType: string;
|
|
7
|
+
};
|
|
8
|
+
consideration: {
|
|
9
|
+
itemType: string;
|
|
10
|
+
};
|
|
11
|
+
}): string;
|
|
12
|
+
|
|
13
|
+
export { type TokenStandard, isErc1155Standard, orderNftStandard, resolveTokenStandard };
|