diff --git a/cspell.json b/cspell.json index e4476094f95b..9ec411d33ea8 100644 --- a/cspell.json +++ b/cspell.json @@ -336,7 +336,16 @@ "isfacebook", "findtruman", "uaddr", - "consts" + "consts", + "cryptoartai", + "cryptoart", + "avator", + "testweb", + "metadate", + "AICANFT", + "CANFT", + "Kodav", + "koda" ], "ignoreRegExpList": ["/@servie/"], "overrides": [ diff --git a/packages/dashboard/src/locales/en-US.json b/packages/dashboard/src/locales/en-US.json index c16ead8605fd..e8e7cb5d146f 100644 --- a/packages/dashboard/src/locales/en-US.json +++ b/packages/dashboard/src/locales/en-US.json @@ -339,6 +339,8 @@ "labs_pets_desc": "Explore the endless possibilities of NFTs. Link and display your NFTs on social media in a revolutionized way.", "labs_setup_tutorial": "Setup Tutorial", "labs_do_not_show_again": "Don't show again.", + "labs_cryptoartai": "CRYPTOART.AI", + "labs_cryptoartai_desc": "Connect CryptoArt Digital Artworks. The Internationale is a classic anthem that has been a shared memory for generations.", "dashboard_mobile_test": "Join Tests for Mobile", "dashboard_source_code": "Source Code", "privacy_policy": "Privacy Policy", diff --git a/packages/dashboard/src/pages/Labs/constants.ts b/packages/dashboard/src/pages/Labs/constants.ts index 84da37b752ee..fdd9e875f6f3 100644 --- a/packages/dashboard/src/pages/Labs/constants.ts +++ b/packages/dashboard/src/pages/Labs/constants.ts @@ -14,6 +14,7 @@ export const PLUGIN_IDS = { MASK_BOX: 'com.maskbook.box', POOL_TOGETHER: 'com.pooltogether', GOOD_GHOSTING: 'co.good_ghosting', + CRYPTOARTAI: 'com.maskbook.cryptoartai', } type TUTORIAL_URLS_OPT = { diff --git a/packages/dashboard/src/pages/Labs/index.tsx b/packages/dashboard/src/pages/Labs/index.tsx index a8bd4f2b8935..983000e23de8 100644 --- a/packages/dashboard/src/pages/Labs/index.tsx +++ b/packages/dashboard/src/pages/Labs/index.tsx @@ -69,6 +69,7 @@ export default function Plugins() { [PLUGIN_IDS.MASK_BOX]: true, [PLUGIN_IDS.GOOD_GHOSTING]: true, [PLUGIN_IDS.POOL_TOGETHER]: true, + [PLUGIN_IDS.CRYPTOARTAI]: true, }) const plugins = [ @@ -171,6 +172,13 @@ export default function Plugins() { icon: , enabled: pluginStatus[PLUGIN_IDS.POOL_TOGETHER], }, + { + id: PLUGIN_IDS.POOL_TOGETHER, + title: t.labs_cryptoartai(), + desc: t.labs_cryptoartai_desc(), + icon: , + enabled: pluginStatus[PLUGIN_IDS.CRYPTOARTAI], + }, ] const language = useLanguage() diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index dbf54f31dcc0..e94e8c0176d8 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -605,6 +605,7 @@ "plugin_collectible_post_listing": "Post Listing", "plugin_collectible_description": "Current price is {{price}} {{symbol}}.", "plugin_collectible_article": "Article", + "plugin_collectible_overview": "Overview", "plugin_collectible_details": "Details", "plugin_collectible_offers": "Offers", "plugin_collectible_listing": "Listing", @@ -628,6 +629,7 @@ "plugin_collectible_block_chain": "BlockChain", "plugin_collectible_create_by": "Created by", "plugin_collectible_owned_by": "Owned by", + "plugin_collectible_view_on": "View on", "plugin_collectible_no_history": "No History", "plugin_collectible_ensure_unreviewed_item": "Please ensure unreviewed item", "plugin_collectible_check_tos_document": "Please check ToS document", @@ -678,6 +680,31 @@ "plugin_collectible_make_an_offer": "Make an Offer", "plugin_collectible_approved_by_open_sea": "By checking this box, I acknowledge that this item has not been reviewed or approved by OpenSea.", "plugin_collectible_legal_text": "By checking this box, I agree to OpenSea's Terms of Service.", + "plugin_cryptoartai_description_title": "Description", + "plugin_cryptoartai_edition": "Edition of", + "plugin_cryptoartai_operator": "Operator", + "plugin_cryptoartai_activity_type": "Type", + "plugin_cryptoartai_status": "Status", + "plugin_cryptoartai_time": "Time", + "plugin_cryptoartai_price": "Price", + "plugin_cryptoartai_tx": "Tx", + "plugin_cryptoartai_latest_bid": "Latest Bid", + "plugin_cryptoartai_description": "Current Bid is {{bidPrice}}{{symbol}}, price is {{price}}{{symbol}}. Edition {{soldNum}} of {{totalAvailable}} #{{editionNumber}}.", + "plugin_cryptoartai_no_price_description": "Current Bid is {{bidPrice}}{{symbol}}. Edition {{soldNum}} of {{totalAvailable}} #{{editionNumber}}.", + "plugin_cryptoartai_sold_description": "Sold for {{soldPrice}}{{symbol}}. Edition {{soldNum}} of {{totalAvailable}} #{{editionNumber}}.", + "plugin_cryptoartai_buy": "Buy", + "plugin_cryptoartai_buy_now": "Buy now", + "plugin_cryptoartai_current_balance": "Current balance", + "plugin_cryptoartai_current_highest_offer": "Current highest offer is ", + "plugin_cryptoartai_bid_least": "Your must bid at least ", + "plugin_cryptoartai_escrowed": "Your offer will be escrowed in the smart contract until it is accepted or you withdraw it", + "plugin_cryptoartai_current_balance_is": "Current balance is ", + "plugin_cryptoartai_auction_end": "Auction has ended", + "plugin_cryptoartai_auction_end_time": "Auction end time ", + "plugin_cryptoartai_share": "I just paid {{amount}} {{symbol}} for {{title}} on {{assetLink}}.\nPlease install Mask plugin, and follow @{{account}} to join it too.\n#mask_io", + "plugin_cryptoartai_share_no_official_account": "I just paid {{amount}} {{symbol}} for {{title}} on {{assetLink}}. Welcome to join.", + "plugin_cryptoartai_offer_share": "I just offered {{amount}} {{symbol}} for {{title}} on {{assetLink}}.\nPlease install Mask plugin, and follow @{{account}} to join it too.\n#mask_io", + "plugin_cryptoartai_offer_share_no_official_account": "I just offered {{amount}} {{symbol}} for {{title}} on {{assetLink}}. Welcome to join.", "plugin_snapshot_info_title": "Information", "plugin_snapshot_info_strategy": "Strategie(s)", "plugin_snapshot_info_author": "Author", diff --git a/packages/mask/shared-ui/locales/ja-JP.json b/packages/mask/shared-ui/locales/ja-JP.json index 8b57e57784fe..fc973bda27b3 100644 --- a/packages/mask/shared-ui/locales/ja-JP.json +++ b/packages/mask/shared-ui/locales/ja-JP.json @@ -348,6 +348,7 @@ "plugin_collectible_post_listing": "投稿リスト", "plugin_collectible_description": "現在の価格は {{price}} {{symbol}} です。", "plugin_collectible_article": "品目", + "plugin_collectible_overview": "概要", "plugin_collectible_details": "詳細", "plugin_collectible_offers": "オファー", "plugin_collectible_listing": "リスティング", @@ -369,6 +370,7 @@ "plugin_collectible_block_chain": "ブロックチェーン", "plugin_collectible_create_by": "作成者", "plugin_collectible_owned_by": "所持者", + "plugin_collectible_view_on": "查看", "plugin_collectible_no_history": "履歴がありません", "plugin_collectible_ensure_unreviewed_item": "未レビューのアイテムを確認してください", "plugin_collectible_check_tos_document": "ToS ドキュメントを確認してください", @@ -418,6 +420,27 @@ "plugin_collectible_make_an_offer": "オファーする", "plugin_collectible_approved_by_open_sea": "このボックスをチェックすることで、このアイテムが OpenSea によってレビューまたは承認されていないことを認めます。", "plugin_collectible_legal_text": "このボックスをチェックすることで、OpenSea の利用規約に同意します。", + "plugin_cryptoartai_description_title": "説明", + "plugin_cryptoartai_edition": "のエディション", + "plugin_cryptoartai_operator": "オペレーター", + "plugin_cryptoartai_activity_type": "タイプ", + "plugin_cryptoartai_status": "状態", + "plugin_cryptoartai_time": "時間", + "plugin_cryptoartai_price": "価格", + "plugin_cryptoartai_tx": "Tx", + "plugin_cryptoartai_latest_bid": "最新の入札", + "plugin_cryptoartai_description": "最新の入札は {{bidPrice}}{{symbol}},価格 {{price}}{{symbol}}。バージョン {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_no_price_description": "最新の入札は {{bidPrice}}{{symbol}}。バージョン {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_sold_description": "販売価格 {{soldPrice}}{{symbol}}。バージョン {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_buy": "購入", + "plugin_cryptoartai_buy_now": "今すぐ購入", + "plugin_cryptoartai_current_balance": "現在の残高", + "plugin_cryptoartai_current_highest_offer": "現在の最高のオファーは ", + "plugin_cryptoartai_bid_least": "少なくとも入札する必要があります ", + "plugin_cryptoartai_escrowed": "あなたのオファーは、それが受け入れられるか、あなたがそれを撤回するまで、スマートコントラクトでエスクローされます", + "plugin_cryptoartai_current_balance_is": "現在の残高は ", + "plugin_cryptoartai_auction_end": "オークション終了しました", + "plugin_cryptoartai_auction_end_time": "オークション終了時間 ", "plugin_snapshot_info_title": "情報", "plugin_snapshot_info_strategy": "戦略家", "plugin_snapshot_info_author": "著者", diff --git a/packages/mask/shared-ui/locales/ko-KR.json b/packages/mask/shared-ui/locales/ko-KR.json index 21e6d6173a70..748b3bd8bb59 100644 --- a/packages/mask/shared-ui/locales/ko-KR.json +++ b/packages/mask/shared-ui/locales/ko-KR.json @@ -474,6 +474,7 @@ "plugin_collectible_post_listing": "포스트 리스팅", "plugin_collectible_description": "현재의 가격은 {{price}} {{symbol}}.", "plugin_collectible_article": "글", + "plugin_collectible_overview": "개요", "plugin_collectible_details": "디테일", "plugin_collectible_offers": "오퍼", "plugin_collectible_listing": "리스팅", @@ -497,6 +498,7 @@ "plugin_collectible_block_chain": "불록체인", "plugin_collectible_create_by": "만든사람:", "plugin_collectible_owned_by": "소유자:", + "plugin_collectible_view_on": "보기:", "plugin_collectible_no_history": "기록없음", "plugin_collectible_ensure_unreviewed_item": "리뷰되지 않는 아이템을 확인하세요", "plugin_collectible_check_tos_document": "ToS 파일을 확인하세요", @@ -547,6 +549,27 @@ "plugin_collectible_make_an_offer": "오퍼하기", "plugin_collectible_approved_by_open_sea": "이 백스를 체크하면 OpenSea에서 이 항목을 리뷰받거나 승인받지 않았다는 것을 알 수 있습니다.", "plugin_collectible_legal_text": "이 박스를 체크하면 OpenSea의 항목과 서비스 동의합니다.", + "plugin_cryptoartai_description_title": "설명", + "plugin_cryptoartai_edition": "에디션", + "plugin_cryptoartai_operator": "운영자", + "plugin_cryptoartai_activity_type": "유형", + "plugin_cryptoartai_status": "상태", + "plugin_cryptoartai_time": "시간", + "plugin_cryptoartai_price": "가격", + "plugin_cryptoartai_tx": "Tx", + "plugin_cryptoartai_latest_bid": "최근 입찰", + "plugin_cryptoartai_description": "최근 입찰 {{bidPrice}}{{symbol}},가격 {{price}}{{symbol}}。버전 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_no_price_description": "최근 입찰 {{bidPrice}}{{symbol}}。버전 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_sold_description": "판매 {{soldPrice}}{{symbol}}。버전 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_buy": "구매", + "plugin_cryptoartai_buy_now": "지금 구매", + "plugin_cryptoartai_current_balance": "현재 잔액", + "plugin_cryptoartai_current_highest_offer": "현재 가장 높은 제안은 ", + "plugin_cryptoartai_bid_least": "최소한 입찰해야 합니다 ", + "plugin_cryptoartai_escrowed": "귀하의 제안은 수락되거나 철회할 때까지 스마트 계약에 에스크로됩니다", + "plugin_cryptoartai_current_balance_is": "현재 잔액은 ", + "plugin_cryptoartai_auction_end": "경매가 종료되었습니다", + "plugin_cryptoartai_auction_end_time": "경매 종료 시간 ", "plugin_snapshot_info_title": "정보", "plugin_snapshot_info_strategy": "전략", "plugin_snapshot_info_author": "저자", diff --git a/packages/mask/shared-ui/locales/zh-CN.json b/packages/mask/shared-ui/locales/zh-CN.json index a99ce28f9c55..02c4a76e2db9 100644 --- a/packages/mask/shared-ui/locales/zh-CN.json +++ b/packages/mask/shared-ui/locales/zh-CN.json @@ -497,6 +497,7 @@ "plugin_collectible_post_listing": "上架", "plugin_collectible_description": "当前价格是 {{price}} {{symbol}}", "plugin_collectible_article": "文章", + "plugin_collectible_overview": "概述", "plugin_collectible_details": "详情", "plugin_collectible_offers": "报价", "plugin_collectible_listing": "上架列表", @@ -520,6 +521,7 @@ "plugin_collectible_block_chain": "区块链", "plugin_collectible_create_by": "创建者", "plugin_collectible_owned_by": "持有者", + "plugin_collectible_view_on": "浏览", "plugin_collectible_no_history": "无历史记录", "plugin_collectible_ensure_unreviewed_item": "请确保未经审核的收藏品", "plugin_collectible_check_tos_document": "请查阅 ToS 文档", @@ -570,6 +572,31 @@ "plugin_collectible_make_an_offer": "发出报价", "plugin_collectible_approved_by_open_sea": "通过勾选此框,我确认此收藏品尚未被 OpenSea 审核或批准。", "plugin_collectible_legal_text": "通过勾选此框,我同意OpenSea的 服务条款。", + "plugin_cryptoartai_description_title": "描述", + "plugin_cryptoartai_edition": "版本", + "plugin_cryptoartai_operator": "操作者", + "plugin_cryptoartai_activity_type": "类型", + "plugin_cryptoartai_status": "状态", + "plugin_cryptoartai_time": "时间", + "plugin_cryptoartai_price": "价格", + "plugin_cryptoartai_tx": "Tx", + "plugin_cryptoartai_latest_bid": "最新出价", + "plugin_cryptoartai_description": "最新出价 {{bidPrice}} {{symbol}},价格 {{price}} {{symbol}}。版本 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_no_price_description": "最新出价 {{bidPrice}} {{symbol}}。版本 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_sold_description": "已出售价格 {{soldPrice}}{{symbol}}. Edition {{soldNum}} of {{totalAvailable}} #{{editionNumber}}.", + "plugin_cryptoartai_buy": "购买", + "plugin_cryptoartai_buy_now": "立即购买", + "plugin_cryptoartai_current_balance": "当前余额", + "plugin_cryptoartai_current_highest_offer": "当前最高报价为 ", + "plugin_cryptoartai_bid_least": "你必须至少出价 ", + "plugin_cryptoartai_escrowed": "您的报价将被托管在智能合约中,直到被接受或您撤回为止", + "plugin_cryptoartai_current_balance_is": "当前余额为 ", + "plugin_cryptoartai_auction_end": "拍卖已结束", + "plugin_cryptoartai_auction_end_time": "拍卖结束时间 ", + "plugin_cryptoartai_share": "我刚刚花费 {{amount}} {{symbol}} 购买了 {{title}},链接:{{assetLink}}。\n请安装 Mask 插件并跟随 @{{account}} 一起参与进来。\n#mask_io", + "plugin_cryptoartai_share_no_official_account": "我刚刚花费 {{amount}} {{symbol}} 购买了 {{title}},链接:{{assetLink}}。欢迎一次参与进来。", + "plugin_cryptoartai_offer_share": "我刚刚出价 {{amount}} {{symbol}} 来竞标 {{title}},链接:{{assetLink}}。\n请安装 Mask 插件并跟随 @{{account}} 一起参与进来。\n#mask_io", + "plugin_cryptoartai_offer_share_no_official_account": "我刚刚出价 {{amount}} {{symbol}} 来竞标 {{title}},链接:{{assetLink}}。欢迎一次参与进来。", "plugin_snapshot_info_title": "相关信息", "plugin_snapshot_info_strategy": "策略", "plugin_snapshot_info_author": "作者", diff --git a/packages/mask/shared-ui/locales/zh-TW.json b/packages/mask/shared-ui/locales/zh-TW.json index 7d9849684ed6..41f0b5bcc82b 100644 --- a/packages/mask/shared-ui/locales/zh-TW.json +++ b/packages/mask/shared-ui/locales/zh-TW.json @@ -375,6 +375,7 @@ "plugin_collectible_post_listing": "上架", "plugin_collectible_description": "目前的價格是 {{price}} {{symbol}}。", "plugin_collectible_article": "文章", + "plugin_collectible_overview": "概述", "plugin_collectible_details": "詳細資訊", "plugin_collectible_offers": "報價", "plugin_collectible_listing": "上架的物品", @@ -398,6 +399,7 @@ "plugin_collectible_block_chain": "區塊練", "plugin_collectible_create_by": "建立者", "plugin_collectible_owned_by": "擁有者", + "plugin_collectible_view_on": "瀏覽", "plugin_collectible_no_history": "沒有歷史資運", "plugin_collectible_ensure_unreviewed_item": "請確保未審核的物品", "plugin_collectible_check_tos_document": "請查閱 ToS 文件", @@ -447,6 +449,27 @@ "plugin_collectible_make_an_offer": "商議價格", "plugin_collectible_approved_by_open_sea": "通過勾選此框,我確認此收藏品未經 OpenSea 審查。", "plugin_collectible_legal_text": "通過勾選此框,我同意 OpenSea 的 使用者條約。", + "plugin_cryptoartai_description_title": "描述", + "plugin_cryptoartai_edition": "版本", + "plugin_cryptoartai_operator": "操作員", + "plugin_cryptoartai_activity_type": "類型", + "plugin_cryptoartai_status": "狀態", + "plugin_cryptoartai_time": "時間", + "plugin_cryptoartai_price": "價錢", + "plugin_cryptoartai_tx": "Tx", + "plugin_cryptoartai_latest_bid": "最新出价", + "plugin_cryptoartai_description": "最新出价 {{bidPrice}} {{symbol}},价格 {{price}} {{symbol}}。版本 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_no_price_description": "最新出价 {{bidPrice}} {{symbol}}。版本 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_sold_description": "已出售價格 {{soldPrice}}{{symbol}}。版本 {{soldNum}} / {{totalAvailable}} #{{editionNumber}}。", + "plugin_cryptoartai_buy": "購買", + "plugin_cryptoartai_buy_now": "立即購買", + "plugin_cryptoartai_current_balance": "當前餘額", + "plugin_cryptoartai_current_highest_offer": "當前最高報價為 ", + "plugin_cryptoartai_bid_least": "你必須至少出價 ", + "plugin_cryptoartai_escrowed": "您的報價將被託管在智能合約中,直到被接受或您撤回為止", + "plugin_cryptoartai_current_balance_is": "當前餘額為 ", + "plugin_cryptoartai_auction_end": "拍賣已結束", + "plugin_cryptoartai_auction_end_time": "拍賣結束時間 ", "plugin_snapshot_info_title": "資訊", "plugin_snapshot_info_strategy": "策略", "plugin_snapshot_info_author": "作者", diff --git a/packages/mask/src/plugin-infra/register.ts b/packages/mask/src/plugin-infra/register.ts index 3e32238fde24..028f5dcade5e 100644 --- a/packages/mask/src/plugin-infra/register.ts +++ b/packages/mask/src/plugin-infra/register.ts @@ -25,4 +25,5 @@ import '../plugins/Furucombo' import '../plugins/MaskBox' import '../plugins/Profile' import '../plugins/Pets' +import '../plugins/CryptoartAI' import '../plugins/FindTruman' diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Account.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Account.tsx new file mode 100644 index 000000000000..2abe8ecd5ecb --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Account.tsx @@ -0,0 +1,14 @@ +import { useI18N } from '../../../utils' +import { useAccount, isSameAddress } from '@masknet/web3-shared-evm' + +export interface AccountProps { + address?: string + username?: string +} + +export function Account({ address, username }: AccountProps) { + const account = useAccount() + const { t } = useI18N() + + return <>{isSameAddress(account, address ?? '') ? t('plugin_collectible_you') : username || address?.slice(2, 8)} +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx new file mode 100644 index 000000000000..f6dce0601a4b --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ActionBar.tsx @@ -0,0 +1,93 @@ +import { useMemo } from 'react' +import { Box } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { useI18N } from '../../../utils' +import { CollectibleState } from '../hooks/useCollectibleState' +import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' +import { useControlledDialog } from '../../../utils/hooks/useControlledDialog' +import { MakeOfferDialog } from './MakeOfferDialog' +import { CheckoutDialog } from './CheckoutDialog' + +const useStyles = makeStyles()((theme) => { + return { + root: { + marginLeft: theme.spacing(-0.5), + marginRight: theme.spacing(-0.5), + }, + button: { + flex: 1, + margin: `0 ${theme.spacing(0.5)}`, + }, + } +}) + +export interface ActionBarProps {} + +export function ActionBar(props: ActionBarProps) { + const { t } = useI18N() + const { classes } = useStyles() + const { asset } = CollectibleState.useContainer() + + const assetSource = useMemo(() => { + if (!asset.value || asset.error) return + return asset.value + }, [asset.value]) + + const { + open: openCheckoutDialog, + onOpen: onOpenCheckoutDialog, + onClose: onCloseCheckoutDialog, + } = useControlledDialog() + const { open: openOfferDialog, onOpen: onOpenOfferDialog, onClose: onCloseOfferDialog } = useControlledDialog() + + if (!asset.value) return null + + return ( + + {!assetSource?.isSoldOut && + !assetSource?.is_owner && + assetSource?.is24Auction && + new Date(assetSource?.latestBidVo?.auctionEndTime ?? 0).getTime() > Date.now() ? ( + { + onOpenOfferDialog() + }}> + {t('plugin_collectible_place_bid')} + + ) : null} + {!assetSource?.isSoldOut && + !assetSource?.is24Auction && + (!assetSource?.trade?.latestBid || assetSource?.trade?.latestBid < assetSource?.priceInEth) && + assetSource?.trade?.isCanAuction ? ( + { + onOpenOfferDialog() + }}> + {t('plugin_collectible_make_offer')} + + ) : null} + {!assetSource?.isSoldOut && + assetSource?.totalSurplus > 0 && + !assetSource?.is24Auction && + assetSource?.priceInEth < 100000 && + assetSource?.trade?.isCanBuy ? ( + + {t('plugin_collectible_buy_now')} + + ) : null} + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ArticleTab.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ArticleTab.tsx new file mode 100644 index 000000000000..16ad27c340e0 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/ArticleTab.tsx @@ -0,0 +1,40 @@ +import { Link } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { CollectibleTab } from './CollectibleTab' +import { CollectibleState } from '../hooks/useCollectibleState' + +const useStyles = makeStyles()({ + body: { + display: 'flex', + justifyContent: 'center', + height: '300px', + }, + player: { + maxWidth: '100%', + maxHeight: '100%', + border: 'none', + }, +}) + +export interface ArticleTabProps {} + +export function ArticleTab(props: ArticleTabProps) { + const { classes } = useStyles() + const { asset } = CollectibleState.useContainer() + + if (!asset.value) return null + const resourceUrl = asset.value.shareUrl || asset.value.ossUrl + return ( + +
+ {asset.value.ossUrl.match(/\.(mp4|avi|webm)$/i) ? ( + + {asset.value.title} + + ) : ( + {asset.value.title} + )} +
+
+ ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CheckoutDialog.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CheckoutDialog.tsx new file mode 100644 index 000000000000..e148b089eda2 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CheckoutDialog.tsx @@ -0,0 +1,219 @@ +import { useCallback, useMemo, useEffect } from 'react' +import { DialogContent, Box, Card, CardContent, CardActions, Typography, Link } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { first } from 'lodash-unified' +import BigNumber from 'bignumber.js' +import { useChainId, useFungibleTokenWatched, TransactionStateType } from '@masknet/web3-shared-evm' +import { InjectedDialog } from '../../../components/shared/InjectedDialog' +import { useI18N } from '../../../utils' +import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' +import { EthereumWalletConnectedBoundary } from '../../../web3/UI/EthereumWalletConnectedBoundary' +import { useRemoteControlledDialog } from '@masknet/shared' +import { WalletMessages } from '../../Wallet/messages' +import type { useAsset } from '../hooks/useAsset' +import { formatBalance } from '@masknet/web3-shared-evm' +import { resolvePaymentTokensOnCryptoartAI } from '../pipes' +import { usePurchaseCallback } from '../hooks/usePurchaseCallback' +import { resolveAssetLinkOnCryptoartAI } from '../pipes' +import { activatedSocialNetworkUI } from '../../../social-network' +import { isTwitter } from '../../../social-network-adaptor/twitter.com/base' +import { isFacebook } from '../../../social-network-adaptor/facebook.com/base' + +const useStyles = makeStyles()((theme) => { + return { + content: { + padding: 0, + }, + footer: { + display: 'flex', + justifyContent: 'flex-end', + padding: theme.spacing(0, 2, 2), + }, + panel: { + marginTop: theme.spacing(2), + '&:first-child': { + marginTop: 0, + }, + }, + label: {}, + buttons: { + width: '100%', + margin: `0 ${theme.spacing(-0.5)}`, + }, + button: { + flex: 1, + margin: `${theme.spacing(1.5)} ${theme.spacing(0.5)} 0`, + }, + container: { + padding: theme.spacing(1), + }, + chain_row: { + display: 'flex', + justifyContent: 'space-between', + marginBottom: theme.spacing(0.5), + '&:last-child': { + marginBottom: 0, + }, + }, + mediaContent: { + display: 'flex', + justifyContent: 'center', + height: '200px', + }, + player: { + maxWidth: '100%', + maxHeight: '100%', + border: 'none', + }, + } +}) + +export interface CheckoutDialogProps { + asset?: ReturnType + open: boolean + onClose: () => void +} + +export function CheckoutDialog(props: CheckoutDialogProps) { + const { asset, open, onClose } = props + const isVerified = + (!asset?.value?.isSoldOut && + asset?.value?.totalSurplus > 0 && + !asset?.value?.is24Auction && + asset?.value?.priceInEth < 100000 && + asset?.value?.trade?.isCanBuy) ?? + false + + const { t } = useI18N() + const { classes } = useStyles() + + const chainId = useChainId() + + const paymentTokens = resolvePaymentTokensOnCryptoartAI(chainId) ?? [] + const selectedPaymentToken = first(paymentTokens) + const { token, balance } = useFungibleTokenWatched(selectedPaymentToken) + + const [purchaseState, purchaseCallback, resetCallback] = usePurchaseCallback( + asset?.value?.editionNumber ?? '0', + asset?.value?.priceInWei > 0 + ? asset?.value?.priceInWei + : new BigNumber(0.01).shiftedBy(selectedPaymentToken?.decimals ?? 18).toNumber(), + ) + + const onCheckout = useCallback(() => { + purchaseCallback() + }, [purchaseCallback]) + + const assetLink = resolveAssetLinkOnCryptoartAI(asset?.value?.creator?.username, asset?.value?.token_id, chainId) + const shareLink = activatedSocialNetworkUI.utils + .getShareLinkURL?.( + token + ? t( + isTwitter(activatedSocialNetworkUI) || isFacebook(activatedSocialNetworkUI) + ? 'plugin_cryptoartai_share' + : 'plugin_cryptoartai_share_no_official_account', + { + amount: asset?.value?.priceInEth, + symbol: token?.value?.symbol, + title: asset?.value?.title, + assetLink: assetLink, + account: isTwitter(activatedSocialNetworkUI) ? t('twitter_account') : t('facebook_account'), + }, + ) + : '', + ) + .toString() + + const { setDialog: setTransactionDialog } = useRemoteControlledDialog( + WalletMessages.events.transactionDialogUpdated, + useCallback( + (ev) => { + if (!ev.open) { + if (purchaseState.type === TransactionStateType.HASH) onClose() + } + resetCallback() + }, + [purchaseState, onClose], + ), + ) + + useEffect(() => { + if (purchaseState.type === TransactionStateType.UNKNOWN) return + setTransactionDialog({ + open: true, + shareLink, + state: purchaseState, + summary: t('plugin_cryptoartai_buy') + ' ' + asset?.value?.title, + }) + }, [purchaseState]) + + const validationMessage = useMemo(() => { + if (!isVerified) return t('plugin_collectible_check_tos_document') + if (new BigNumber(asset?.value?.priceInEth).gt(formatBalance(balance.value, token?.value?.decimals, 4))) { + return t('plugin_collectible_insufficient_balance') + } + return '' + }, [isVerified, balance.value, asset?.value]) + + return ( + + + + + + {asset?.value?.ossUrl.match(/\.(mp4|avi|webm)$/i) ? ( + + {asset.value.title} + + ) : ( + {asset?.value?.title} + )} + + + + + {t('plugin_cryptoartai_buy') + + ' ' + + asset?.value?.title + + ' ' + + asset?.value?.priceInEth + + ' ETH'} + + + + {t('plugin_collectible_token_id')} + {asset?.value?.editionNumber} + + + {t('plugin_cryptoartai_current_balance')} + + {formatBalance(balance.value, token?.value?.decimals, 4)} + + + + + + + + {validationMessage || t('plugin_cryptoartai_buy_now')} + + + + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx new file mode 100644 index 000000000000..3e19b88235e9 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx @@ -0,0 +1,341 @@ +import { useState, useEffect, useMemo } from 'react' +import { + Avatar, + Box, + Button, + CardActions, + CardContent, + CardHeader, + Link, + Paper, + Tab, + Tabs, + Typography, +} from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { Trans } from 'react-i18next' +import VerifiedUserIcon from '@mui/icons-material/VerifiedUser' +import { useI18N } from '../../../utils' +import { ArticleTab } from './ArticleTab' +import { TokenTab } from './TokenTab' +import { OfferTab } from './OfferTab' +import { HistoryTab } from './HistoryTab' +import { CollectibleState } from '../hooks/useCollectibleState' +import { CollectibleCard } from './CollectibleCard' +import { PluginSkeleton } from './PluginSkeleton' +import { TabState } from '../types' +import { MaskTextIcon } from '../../../resources/MaskIcon' +import { resolveAssetLinkOnCryptoartAI } from '../pipes' +import { Markdown } from '../../Snapshot/SNSAdaptor/Markdown' +import { ActionBar } from './ActionBar' +import { useChainId } from '@masknet/web3-shared-evm' +import { resolveWebLinkOnCryptoartAI } from '../pipes' +import { TransactionType } from '../types' + +const useStyles = makeStyles()((theme) => { + return { + root: { + width: '100%', + border: `solid 1px ${theme.palette.divider}`, + padding: 0, + }, + content: { + width: '100%', + height: 'var(--contentHeight)', + display: 'flex', + flexDirection: 'column', + padding: '0 !important', + }, + body: { + flex: 1, + overflow: 'auto', + maxHeight: 350, + borderRadius: 0, + scrollbarWidth: 'none', + '&::-webkit-scrollbar': { + display: 'none', + }, + }, + footer: { + marginTop: -1, // merge duplicate borders + zIndex: 1, + position: 'relative', + borderTop: `solid 1px ${theme.palette.divider}`, + justifyContent: 'space-between', + }, + tabs: { + height: 'var(--tabHeight)', + width: '100%', + minHeight: 'unset', + borderTop: `solid 1px ${theme.palette.divider}`, + borderBottom: `solid 1px ${theme.palette.divider}`, + }, + tab: { + height: 'var(--tabHeight)', + minHeight: 'unset', + minWidth: 'unset', + whiteSpace: 'nowrap', + }, + subtitle: { + fontSize: 12, + marginRight: theme.spacing(0.5), + maxHeight: '3.5rem', + overflow: 'hidden', + wordBreak: 'break-word', + }, + description: { + fontSize: 12, + '& > strong': { + color: theme.palette.text.primary, + fontWeight: 300, + }, + }, + footnote: { + fontSize: 10, + marginRight: theme.spacing(1), + }, + footLink: { + cursor: 'pointer', + marginRight: theme.spacing(0.5), + '&:last-child': { + marginRight: 0, + }, + }, + footMenu: { + color: theme.palette.text.secondary, + fontSize: 10, + display: 'flex', + alignItems: 'center', + }, + footName: { + marginLeft: theme.spacing(0.5), + }, + mask: { + width: 40, + height: 10, + }, + countdown: { + fontSize: 12, + borderRadius: 8, + display: 'block', + white: '100%', + color: theme.palette.common.white, + backgroundColor: '#eb5757', + padding: theme.spacing(0.5, 2), + }, + } +}) + +export interface CollectibleProps {} + +export function Collectible(props: CollectibleProps) { + const { t } = useI18N() + const { classes } = useStyles() + const chainId = useChainId() + const { asset, events, tabIndex, setTabIndex } = CollectibleState.useContainer() + + const assetSource = useMemo(() => { + if (!asset.value || asset.error) return + return asset.value + }, [asset.value]) + + const [soldPrice, setSoldPrice] = useState(0) + useEffect(() => { + if ( + assetSource?.is24Auction && + assetSource?.isSoldOut && + [TransactionType.BID_PLACED, TransactionType.SETTLED].includes(events.value?.data[0].transactionType) + ) { + setSoldPrice(events.value?.data[0].priceInEth) + } else setSoldPrice(0) + }, [asset, events]) + + if (asset.loading) return + if (!asset.value) + return ( + + + Failed to load your collectible on CRYPTOART.AI. + + + + ) + + const tabs = [ + , + , + , + , + ] + + return ( + <> + + + + + } + title={ + + {assetSource?.tokenUri && assetSource?.token_id ? ( + + {assetSource?.title ?? ''} + + ) : ( + assetSource?.title ?? '' + )} + + + } + subheader={ + <> + {assetSource?.description ? ( + + + + + + ) : null} + + {assetSource?.priceInEth > 100000 && !assetSource?.isSoldOut ? ( + + + + + + ) : ( + '' + )} + {assetSource?.priceInEth && assetSource?.priceInEth <= 100000 && !assetSource?.isSoldOut ? ( + + + + + + ) : ( + '' + )} + {assetSource?.is24Auction && assetSource?.isSoldOut ? ( + + + + + + ) : ( + '' + )} + + } + /> + + , newValue: number) => setTabIndex(newValue)} + TabIndicatorProps={{ + style: { + display: 'none', + }, + }}> + {tabs} + + + {tabIndex === TabState.ARTICLE ? : null} + {tabIndex === TabState.TOKEN ? : null} + {tabIndex === TabState.OFFER ? : null} + {tabIndex === TabState.HISTORY ? : null} + + + + + {t('plugin_powered_by')} + + + + +
+ + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CollectibleCard.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CollectibleCard.tsx new file mode 100644 index 000000000000..c8ba95c36454 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CollectibleCard.tsx @@ -0,0 +1,14 @@ +import { Card } from '@mui/material' +export interface CollectibleCardProps extends withClasses<'root'> { + children?: React.ReactNode +} + +export function CollectibleCard(props: CollectibleCardProps) { + const { children } = props + const classes = props.classes + return ( + + {children} + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CollectibleTab.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CollectibleTab.tsx new file mode 100644 index 000000000000..24ead3481e75 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/CollectibleTab.tsx @@ -0,0 +1,26 @@ +import { Card, CardContent, CardProps } from '@mui/material' +import { makeStyles, useStylesExtends } from '@masknet/theme' + +const useStyles = makeStyles()({ + root: { + width: '100%', + height: '100%', + borderRadius: 0, + overflow: 'auto', + }, +}) + +export interface CollectibleTabProps extends withClasses<'root' | 'content'> { + children: React.ReactNode + CardProps?: Partial +} + +export function CollectibleTab(props: CollectibleTabProps) { + const classes = useStylesExtends(useStyles(), props) + + return ( + + {props.children} + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/HistoryTab/Row.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/HistoryTab/Row.tsx new file mode 100644 index 000000000000..3db74675101f --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/HistoryTab/Row.tsx @@ -0,0 +1,100 @@ +import { Avatar, Link, TableCell, TableRow, Typography } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { Account } from '../Account' +import type { ChainId } from '@masknet/web3-shared-evm' +import { resolveWebLinkOnCryptoartAI } from '../../pipes' +import { truncate } from 'lodash-unified' + +const useStyles = makeStyles()((theme) => { + return { + account: { + display: 'flex', + alignItems: 'center', + }, + avatar: { + width: 18, + height: 18, + }, + accountName: { + marginLeft: theme.spacing(0.5), + }, + relativeTime: { + whiteSpace: 'nowrap', + }, + token: { + objectFit: 'contain', + width: 18, + height: 18, + marginRight: theme.spacing(0.5), + }, + content: { + display: 'flex', + alignItems: 'center', + }, + ethPrice: { + display: 'flex', + alignItems: 'center', + fontWeight: 700, + }, + usdcPrice: { + display: 'flex', + alignItems: 'center', + color: 'grey', + }, + } +}) + +interface Props { + event: any + chainId: ChainId +} + +export function Row({ event, chainId }: Props) { + const { classes } = useStyles() + return ( + + + + + + + + + + + + + {event.transactionTypeName} + + + + + + {event.createTime.substr(0, event.createTime.length - 3)} + + + + + {`${event.priceInEth} Ξ`} + + + {`($${event.priceInUsd})`} + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/HistoryTab/index.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/HistoryTab/index.tsx new file mode 100644 index 000000000000..414c31b64ace --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/HistoryTab/index.tsx @@ -0,0 +1,84 @@ +import { Button, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material' +import { useChainId } from '@masknet/web3-shared-evm' +import { makeStyles } from '@masknet/theme' +import { useI18N } from '../../../../utils' +import { CollectibleTab } from '../CollectibleTab' +import { CollectibleState } from '../../hooks/useCollectibleState' +import { Row } from './Row' +import { LoadingTable } from '../LoadingTable' + +const useStyles = makeStyles()((theme) => { + return { + root: { + overflow: 'auto', + }, + content: { + padding: '0 !important', + }, + spacer: { + flex: 0, + }, + empty: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'center', + height: '100%', + padding: theme.spacing(8, 0), + }, + emptyCell: { + borderStyle: 'none', + }, + } +}) + +export interface HistoryTabProps {} + +export function HistoryTab(props: HistoryTabProps) { + const { t } = useI18N() + const { classes } = useStyles() + const chainId = useChainId() + const { events } = CollectibleState.useContainer() + + if (events.loading) return + if (!events.value || events.error || !events.value?.data.length) + return ( + + + + + {t('plugin_collectible_no_history')} + + + + +
+ ) + + return ( + + + + + {t('plugin_cryptoartai_operator')} + {t('plugin_cryptoartai_activity_type')} + {t('plugin_cryptoartai_time')} + {t('plugin_cryptoartai_price')} + + + + {events.value.data.map((order: any) => ( + + ))} + +
+
+ ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/LoadingTable.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/LoadingTable.tsx new file mode 100644 index 000000000000..10458ae06fc0 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/LoadingTable.tsx @@ -0,0 +1,33 @@ +import { Skeleton, Table, TableBody, TableCell, TableFooter, TableHead, TableRow } from '@mui/material' + +export function LoadingTable() { + return ( + + + + + + + + + + {Array.from({ length: 5 }) + .fill(0) + .map((_, i) => ( + + + + + + ))} + + + + + + + + +
+ ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/MakeOfferDialog.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/MakeOfferDialog.tsx new file mode 100644 index 000000000000..96167d41efd3 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/MakeOfferDialog.tsx @@ -0,0 +1,274 @@ +import { useState, useCallback, useMemo, useEffect } from 'react' +import { DialogContent, Box, Card, CardContent, CardActions, Link } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { first } from 'lodash-unified' +import BigNumber from 'bignumber.js' +import { FungibleTokenDetailed, isNative, useFungibleTokenWatched, useChainId } from '@masknet/web3-shared-evm' +import { useI18N } from '../../../utils' +import { InjectedDialog } from '../../../components/shared/InjectedDialog' +import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' +import { SelectTokenAmountPanel } from '../../ITO/SNSAdaptor/SelectTokenAmountPanel' +import { EthereumWalletConnectedBoundary } from '../../../web3/UI/EthereumWalletConnectedBoundary' +import { useRemoteControlledDialog } from '@masknet/shared' +import { WalletMessages } from '../../Wallet/messages' +import type { useAsset } from '../hooks/useAsset' +import { formatBalance, TransactionStateType } from '@masknet/web3-shared-evm' +import { resolvePaymentTokensOnCryptoartAI } from '../pipes' +import { usePlaceBidCallback } from '../hooks/usePlaceBidCallback' +import { resolveAssetLinkOnCryptoartAI } from '../pipes' +import { activatedSocialNetworkUI } from '../../../social-network' +import { isTwitter } from '../../../social-network-adaptor/twitter.com/base' +import { isFacebook } from '../../../social-network-adaptor/facebook.com/base' + +const useStyles = makeStyles()((theme) => { + return { + content: { + padding: 0, + }, + details: { + color: '#999', + fontSize: '14px', + margin: '0px', + }, + footer: { + display: 'flex', + justifyContent: 'flex-end', + padding: theme.spacing(0, 2, 2), + }, + panel: { + marginTop: theme.spacing(2), + '&:first-child': { + marginTop: 0, + }, + }, + label: {}, + buttons: { + width: '100%', + margin: `0 ${theme.spacing(-0.5)}`, + }, + button: { + flex: 1, + margin: `${theme.spacing(1.5)} ${theme.spacing(0.5)} 0`, + }, + markdown: { + margin: theme.spacing(1, 0), + }, + mediaContent: { + display: 'flex', + justifyContent: 'center', + height: '200px', + }, + player: { + maxWidth: '100%', + maxHeight: '100%', + border: 'none', + }, + } +}) + +export interface MakeOfferDialogProps { + asset?: ReturnType + open: boolean + onClose: () => void +} + +export function MakeOfferDialog(props: MakeOfferDialogProps) { + const { t } = useI18N() + const { classes } = useStyles() + const { asset, open, onClose } = props + + const assetSource = useMemo(() => { + if (!asset || !asset.value || asset.error) return + return asset.value + }, [asset?.value]) + + const is24Auction = assetSource?.is24Auction ?? false + const isVerified = (!assetSource?.isSoldOut && !assetSource?.is_owner) ?? false + + const chainId = useChainId() + + const paymentTokens = resolvePaymentTokensOnCryptoartAI(chainId) ?? [] + const selectedPaymentToken = first(paymentTokens) + + const { amount, token, balance, setAmount, setToken } = useFungibleTokenWatched(selectedPaymentToken) + + const [atLeastBidValue, setAtLeastBidValue] = useState(0) + useEffect(() => { + const price = new BigNumber(is24Auction ? assetSource?.latestBidVo?.priceInEth : assetSource?.trade?.latestBid) + setAtLeastBidValue(price.isFinite() ? price.plus(price.gte(1) ? '0.1' : '0.01').toNumber() : 0.01) + }, [assetSource?.latestBidVo]) + + const [placeBidState, placeBidCallback, resetCallback] = usePlaceBidCallback( + is24Auction, + assetSource?.editionNumber ?? '0', + ) + + const onMakeOffer = useCallback(() => { + placeBidCallback(new BigNumber(amount).shiftedBy(selectedPaymentToken?.decimals ?? 18).toNumber()) + }, [placeBidCallback, amount]) + + const assetLink = resolveAssetLinkOnCryptoartAI(assetSource?.creator?.username, assetSource?.token_id, chainId) + const shareLink = activatedSocialNetworkUI.utils + .getShareLinkURL?.( + token + ? t( + isTwitter(activatedSocialNetworkUI) || isFacebook(activatedSocialNetworkUI) + ? 'plugin_cryptoartai_offer_share' + : 'plugin_cryptoartai_offer_share_no_official_account', + { + amount: amount, + symbol: token?.value?.symbol, + title: assetSource?.title, + assetLink: assetLink, + account: isTwitter(activatedSocialNetworkUI) ? t('twitter_account') : t('facebook_account'), + }, + ) + : '', + ) + .toString() + + const { setDialog: setTransactionDialog } = useRemoteControlledDialog( + WalletMessages.events.transactionDialogUpdated, + useCallback( + (ev) => { + if (!ev.open) { + if (placeBidState.type === TransactionStateType.HASH) onClose() + if (placeBidState.type === TransactionStateType.CONFIRMED) { + asset?.retry() + } + } + resetCallback() + }, + [placeBidState, onClose], + ), + ) + + useEffect(() => { + if (placeBidState.type === TransactionStateType.UNKNOWN) return + setTransactionDialog({ + open: true, + shareLink, + state: placeBidState, + summary: + (assetSource?.is24Auction + ? t('plugin_collectible_place_a_bid') + : t('plugin_collectible_make_an_offer')) + + ' ' + + assetSource?.title, + }) + }, [placeBidState]) + + useEffect(() => { + setAmount(atLeastBidValue.toString()) + }, [open]) + + const validationMessage = useMemo(() => { + const amount_ = new BigNumber(amount || '0') + const balance_ = new BigNumber(balance.value ?? '0') + if (amount_.isZero()) return t('plugin_collectible_enter_a_price') + if (amount_.lt(atLeastBidValue)) return t('plugin_collectible_enter_a_price') + if (balance_.isZero() || amount_.gt(formatBalance(balance.value, token?.value?.decimals, 4))) + return t('plugin_collectible_insufficient_balance') + if ( + assetSource?.is24Auction && + new Date(assetSource?.latestBidVo?.auctionEndTime).getTime() - Date.now() <= 0 + ) { + return t('plugin_cryptoartai_auction_end') + } + return '' + }, [amount, balance.value, isVerified, is24Auction]) + + if (!asset || !asset.value) return null + return ( + + + + + + {assetSource?.ossUrl.match(/\.(mp4|avi|webm)$/i) ? ( + + {assetSource?.title} + + ) : ( + {assetSource?.title} + )} + +

+ {(assetSource?.is24Auction + ? t('plugin_collectible_place_a_bid') + : t('plugin_collectible_make_an_offer')) + + ' ' + + assetSource?.title} +

+ isNative(x.address))} + onAmountChange={setAmount} + onTokenChange={setToken} + TokenAmountPanelProps={{ + label: t('plugin_collectible_price'), + }} + FixedTokenListProps={{ + selectedTokens: selectedPaymentToken ? [selectedPaymentToken.address] : [], + tokens: paymentTokens, + whitelist: paymentTokens.map((x: any) => x.address), + }} + /> +

+ {t('plugin_cryptoartai_current_highest_offer')} + + {(is24Auction ? assetSource?.latestBidVo?.priceInEth : assetSource?.trade?.latestBid) + + ' ETH'} + +

+

+ {t('plugin_cryptoartai_bid_least') + atLeastBidValue + ' ETH'} +

+

{t('plugin_cryptoartai_escrowed')}

+

+ {t('plugin_cryptoartai_current_balance_is') + + formatBalance(balance.value, token?.value?.decimals, 4) + + ' ETH'} +

+ {assetSource?.is24Auction ? ( +

+ {t('plugin_cryptoartai_auction_end_time')} + {assetSource?.latestBidVo?.auctionEndTime} +

+ ) : null} +
+ + + + + {validationMessage || + t( + is24Auction + ? 'plugin_collectible_place_bid' + : 'plugin_collectible_make_offer', + )} + + + + +
+
+
+ ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/OfferTab.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/OfferTab.tsx new file mode 100644 index 000000000000..c55505ea3761 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/OfferTab.tsx @@ -0,0 +1,136 @@ +import { useMemo } from 'react' +import { Box, Button, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material' +import { useChainId } from '@masknet/web3-shared-evm' +import { makeStyles } from '@masknet/theme' +import { useI18N } from '../../../utils' +import { CollectibleState } from '../hooks/useCollectibleState' +import { CollectibleTab } from './CollectibleTab' +import { OrderRow } from './OrderRow' +import { LoadingTable } from './LoadingTable' + +const useStyles = makeStyles()((theme) => { + return { + root: { + overflow: 'auto', + }, + content: { + padding: '0 !important', + }, + container: { + padding: theme.spacing(2), + }, + latest_bid: { + maxWidth: 112, + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + }, + chain_row: { + display: 'flex', + justifyContent: 'space-between', + marginBottom: theme.spacing(0.5), + '&:last-child': { + marginBottom: 0, + }, + }, + empty: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'center', + height: '100%', + padding: theme.spacing(8, 0), + }, + emptyCell: { + borderStyle: 'none', + }, + button: { + marginLeft: theme.spacing(1), + }, + } +}) + +export function OfferTab() { + const { t } = useI18N() + const { classes } = useStyles() + const chainId = useChainId() + const { asset, offers } = CollectibleState.useContainer() + + const assetSource = useMemo(() => { + if (!asset.value || asset.error) return + return asset.value + }, [asset.value]) + + const dataSource = useMemo(() => { + if (!offers.value || offers.error) return + return offers.value + }, [offers.value]) + + if (offers.loading) return + if (!offers.value || offers.error || dataSource?.history?.length <= 0) + return ( + + + + + {t('plugin_collectible_no_offers')} + + + + +
+ ) + + return ( + + {dataSource?.trade?.latestBid > 0 ? ( + + + {t('plugin_cryptoartai_latest_bid')} + + + + {t('plugin_cryptoartai_price')} + + + {(dataSource?.trade?.latestBid ?? 'Unknown') + ' Ξ'} + + + + ) : null} + {assetSource?.is24Auction && assetSource?.latestBidVo?.auctionEndTime ? ( + + + {t('plugin_cryptoartai_auction_end_time')} + {assetSource?.latestBidVo?.auctionEndTime} + + + ) : null} + {dataSource?.history?.length > 0 ? ( + + + + {t('plugin_cryptoartai_operator')} + {t('plugin_cryptoartai_status')} + {t('plugin_cryptoartai_time')} + {t('plugin_cryptoartai_price')} + {t('plugin_cryptoartai_tx')} + + + + {dataSource?.history?.map((order: any) => ( + + ))} + +
+ ) : null} +
+ ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/OrderRow.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/OrderRow.tsx new file mode 100644 index 000000000000..3e23270e3a13 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/OrderRow.tsx @@ -0,0 +1,116 @@ +import { Avatar, Link, TableCell, TableRow, Typography } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { Account } from './Account' +import type { ChainId } from '@masknet/web3-shared-evm' +import { useI18N } from '../../../utils' +import { resolveWebLinkOnCryptoartAI } from '../pipes' +import { truncate } from 'lodash-unified' + +const useStyles = makeStyles()((theme) => { + return { + account: { + display: 'flex', + alignItems: 'center', + lineHeight: 1, + }, + avatar: { + width: 18, + height: 18, + }, + accountName: { + marginLeft: theme.spacing(0.5), + fontSize: 14, + lineHeight: 1, + }, + relativeTime: { + whiteSpace: 'nowrap', + }, + token: { + objectFit: 'contain', + width: 18, + height: 18, + marginRight: theme.spacing(0.5), + }, + tokenLink: { + display: 'flex', + alignItems: 'center', + }, + content: { + display: 'flex', + alignItems: 'center', + fontSize: 14, + lineHeight: 1, + }, + ethPrice: { + display: 'flex', + alignItems: 'center', + fontWeight: 700, + }, + usdcPrice: { + display: 'flex', + alignItems: 'center', + color: 'grey', + }, + } +}) + +interface IRowProps { + event: any + chainId: ChainId + acceptable?: boolean +} + +export function OrderRow({ event, chainId }: IRowProps) { + const { t } = useI18N() + const { classes } = useStyles() + + return ( + + + + + + + + + + + + {event.status} + + + + + {event.createTime.substr(0, event.createTime.length - 3)} + + + + + {`${event.priceInEth} Ξ`} + + + {`($${event.priceInUsd})`} + + + + + {t('plugin_cryptoartai_tx')} + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/PluginSkeleton.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/PluginSkeleton.tsx new file mode 100644 index 000000000000..fb969968cfaf --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/PluginSkeleton.tsx @@ -0,0 +1,33 @@ +import { Skeleton } from '@mui/material' +import { makeStyles } from '@masknet/theme' + +const useStyles = makeStyles()((theme) => { + return { + skeleton: { + margin: theme.spacing(2), + '&:first-child': { + marginTop: theme.spacing(3), + }, + }, + } +}) + +export function PluginSkeleton() { + const { classes } = useStyles() + return ( + <> + {Array.from({ length: 2 }) + .fill(0) + .map((_, i) => ( + + ))} + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/PostInspector.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/PostInspector.tsx new file mode 100644 index 000000000000..b611ed2f1710 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/PostInspector.tsx @@ -0,0 +1,26 @@ +import type { PayloadType } from '../types' +import { Collectible } from './Collectible' +import { CollectibleState } from '../hooks/useCollectibleState' +import { EthereumChainBoundary } from '../../../web3/UI/EthereumChainBoundary' + +export interface PostInspectorProps { + payload: PayloadType +} + +export function PostInspector(props: PostInspectorProps) { + const token = props.payload + + return ( + + + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/TokenTab.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/TokenTab.tsx new file mode 100644 index 000000000000..08af6489d3d4 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/TokenTab.tsx @@ -0,0 +1,175 @@ +import { useMemo } from 'react' +import { Box, Link, Typography } from '@mui/material' +import { makeStyles } from '@masknet/theme' +import { useI18N } from '../../../utils' +import { CollectibleTab } from './CollectibleTab' +import { CollectibleState } from '../hooks/useCollectibleState' +import { FormattedAddress } from '@masknet/shared' +import { resolveAddressLinkOnExplorer, getChainName, useChainId, formatEthereumAddress } from '@masknet/web3-shared-evm' +import { Markdown } from '../../Snapshot/SNSAdaptor/Markdown' +import { Account } from './Account' +import { resolveWebLinkOnCryptoartAI } from '../pipes' + +const useStyles = makeStyles()((theme) => { + return { + content: { + paddingTop: 0, + paddingBottom: '0 !important', + }, + container: { + padding: theme.spacing(1), + }, + markdown: { + margin: theme.spacing(1, 0), + }, + description: { + fontSize: 14, + wordBreak: 'break-all', + }, + trait_content: { + display: 'grid', + gridTemplateColumns: 'repeat(2,1fr)', + gap: theme.spacing(2), + }, + trait: { + padding: theme.spacing(2), + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + fontSize: 14, + fontWeight: 600, + }, + chain_row: { + display: 'flex', + justifyContent: 'space-between', + marginBottom: theme.spacing(0.5), + '&:last-child': { + marginBottom: 0, + }, + }, + edition_row: { + display: 'flex', + marginBottom: theme.spacing(0.5), + }, + tokenId: { + maxWidth: 112, + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + }, + } +}) + +export interface TokenTabProps {} + +export function TokenTab(props: TokenTabProps) { + const { t } = useI18N() + const { classes } = useStyles() + const chainId = useChainId() + const { token, asset } = CollectibleState.useContainer() + + const assetSource = useMemo(() => { + if (!asset.value || asset.error) return + return asset.value + }, [asset.value]) + + if (!asset.value) return null + return ( + + + + {t('plugin_collectible_base')} + + {assetSource?.creator ? ( + + {t('plugin_collectible_create_by')}{' '} + + + + + ) : null} + {assetSource?.owner[0] ? ( + + {t('plugin_collectible_owned_by')}{' '} + + + + + ) : null} + + + + {t('plugin_cryptoartai_description_title')} + + + + + + {t('plugin_cryptoartai_edition')} + + + {assetSource?.linkWithCreation ? ( + + {t('plugin_collectible_view_on')}{' '} + + ΞEtherscan + + + ) : null} + {assetSource?.linkWithIpfs ? ( + + {t('plugin_collectible_view_on')}{' '} + + IPFS + + + ) : null} + + + + + + {t('plugin_collectible_chain_info')} + + + + {t('plugin_collectible_contract_address')} + + + + + + + + {t('plugin_collectible_token_id')} + + {assetSource?.editionNumber} + + + + {t('plugin_collectible_block_chain')} + {getChainName(chainId)} + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/index.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/index.tsx new file mode 100644 index 000000000000..38a4d23e0f21 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/index.tsx @@ -0,0 +1,37 @@ +import { uniq } from 'lodash-unified' +import { Plugin, usePostInfoDetails } from '@masknet/plugin-infra' +import { getTypedMessageContent } from '../../../protocols/typed-message' +import MaskPluginWrapper from '../../MaskPluginWrapper' +import { PostInspector } from './PostInspector' +import { base } from '../base' +import { checkUrl, getAssetInfoFromURL, getRelevantUrl } from '../utils' +import { PLUGIN_NAME } from '../constants' +import type { PayloadType } from '../types' + +const sns: Plugin.SNSAdaptor.Definition = { + ...base, + init(signal) {}, + PostInspector: function Component() { + const links = usePostInfoDetails.postMetadataMentionedLinks().concat(usePostInfoDetails.postMentionedLinks()) + const link = uniq(links).find(checkUrl) + + const asset = getAssetInfoFromURL(link) + + return asset ? renderPostInspector(asset) : null + }, + DecryptedInspector: function Component(props) { + const collectibleUrl = getRelevantUrl(getTypedMessageContent(props.message)) + const asset = getAssetInfoFromURL(collectibleUrl) + return asset ? renderPostInspector(asset) : null + }, +} + +export default sns + +function renderPostInspector(payload: PayloadType) { + return ( + + + + ) +} diff --git a/packages/mask/src/plugins/CryptoartAI/Worker/index.ts b/packages/mask/src/plugins/CryptoartAI/Worker/index.ts new file mode 100644 index 000000000000..2da0563bd149 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/Worker/index.ts @@ -0,0 +1,8 @@ +import type { Plugin } from '@masknet/plugin-infra' +import { base } from '../base' + +const worker: Plugin.Worker.Definition = { + ...base, + init(signal) {}, +} +export default worker diff --git a/packages/mask/src/plugins/CryptoartAI/apis/index.ts b/packages/mask/src/plugins/CryptoartAI/apis/index.ts new file mode 100644 index 000000000000..dc1aed1c45cb --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/apis/index.ts @@ -0,0 +1,106 @@ +import { OrderSide } from 'opensea-js/lib/types' +import type { ChainId } from '@masknet/web3-shared-evm' +import urlcat from 'urlcat' +import { resolveAPILinkOnCryptoartAI } from '../pipes' +import { TransactionType } from '../types' + +export async function getAsset(tokenId: string, chainId?: ChainId) { + const ownersResponse: any = await ( + await fetch(urlcat(resolveAPILinkOnCryptoartAI(chainId), '/api/artwork/current/owners/:tokenId', { tokenId }), { + mode: 'cors', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + Accept: 'application/json', + }, + }) + ).json() + + const tradeResponse: any = await ( + await fetch(urlcat(resolveAPILinkOnCryptoartAI(chainId), '/api/artwork/tradeInfo/:tokenId', { tokenId }), { + mode: 'cors', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + Accept: 'application/json', + }, + }) + ).json() + + const fetchResponse = await ( + await fetch(urlcat(resolveAPILinkOnCryptoartAI(chainId), '/api/artwork/detail'), { + mode: 'cors', + method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + Accept: 'application/json', + }, + body: JSON.stringify({ + artworkId: tokenId, + ethAddress: '', + }), + }) + ).json() + + return { + ...fetchResponse.data, + owners: + ownersResponse.data && ownersResponse.data.length === 0 && fetchResponse.data.creatorInfo + ? [ + { + ownerAddress: fetchResponse.data.creatorInfo.ethAddress, + ownerName: fetchResponse.data.creatorInfo.username, + ownerAvator: fetchResponse.data.creatorInfo.avatorPath, + ownerRoleType: fetchResponse.data.creatorInfo.roleType, + }, + ] + : ownersResponse.data, + trade: tradeResponse.data, + } +} + +export async function getEvents(tokenId: string, chainId?: ChainId) { + const historyResponse: any = await ( + await fetch(urlcat(resolveAPILinkOnCryptoartAI(chainId), '/api/artwork/recent/history/:tokenId', { tokenId }), { + mode: 'cors', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + Accept: 'application/json', + }, + }) + ).json() + + return historyResponse.data +} + +export async function getOrders(tokenId: string, side = OrderSide.Buy, chainId?: ChainId) { + const tradeResponse: any = await ( + await fetch(urlcat(resolveAPILinkOnCryptoartAI(chainId), '/api/artwork/tradeInfo/:tokenId', { tokenId }), { + mode: 'cors', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + Accept: 'application/json', + }, + }) + ).json() + + const filterType = [TransactionType.BID_PLACED, TransactionType.BID_WITHDRAW, TransactionType.SETTLED] as const + const historyResponse = (await getEvents(tokenId, chainId)) + .filter((event: any) => { + return filterType.includes(event.transactionType) + }) + .map((event: any, idx: any) => { + event.status = 'Expired' + if (event.transactionType === TransactionType.BID_WITHDRAW) event.status = 'Withdrawn' + else if (event.transactionType === TransactionType.SETTLED) event.status = 'Settled' + return event + }) + + return { + trade: tradeResponse.data, + history: historyResponse.map((event: any, idx: any) => { + if (idx === 0 && event.transactionType === TransactionType.BID_PLACED) { + event.status = 'Active' + } + return event + }), + } +} diff --git a/packages/mask/src/plugins/CryptoartAI/base.ts b/packages/mask/src/plugins/CryptoartAI/base.ts new file mode 100644 index 000000000000..6ee46ee1b738 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/base.ts @@ -0,0 +1,15 @@ +import type { Plugin } from '@masknet/plugin-infra' +import { PLUGIN_DESCRIPTION, PLUGIN_ICON, PLUGIN_IDENTIFIER, PLUGIN_NAME } from './constants' + +export const base: Plugin.Shared.Definition = { + ID: PLUGIN_IDENTIFIER, + icon: PLUGIN_ICON, + name: { fallback: PLUGIN_NAME }, + description: { fallback: PLUGIN_DESCRIPTION }, + publisher: { name: { fallback: 'Mask Network' }, link: 'https://mask.io/' }, + enableRequirement: { + architecture: { app: true, web: true }, + networks: { type: 'opt-out', networks: {} }, + target: 'stable', + }, +} diff --git a/packages/mask/src/plugins/CryptoartAI/constants.ts b/packages/mask/src/plugins/CryptoartAI/constants.ts new file mode 100644 index 000000000000..d0633be39064 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/constants.ts @@ -0,0 +1,37 @@ +import { ChainId, ZERO_ADDRESS } from '@masknet/web3-shared-evm' + +export const PLUGIN_NAME = 'CRYPTOART.AI' +export const PLUGIN_ICON = '🖼️' +export const PLUGIN_DESCRIPTION = 'The decentralized world of CryptoArt.' +export const PLUGIN_IDENTIFIER = 'com.maskbook.cryptoartai' +export const PLUGIN_META_KEY = 'com.maskbook.cryptoartai:1' + +export const prefixPath = '/gallery/detail' + +export const mainNetwork = { + contractAddress: '0x3AD503084f1bD8d15A7F5EbE7A038C064e1E3Fa1', + hostname: 'cryptoart.ai', + endpoint: 'https://api.cryptoart.ai', + paymentToken: { + type: 0, + chainId: ChainId.Mainnet, + address: ZERO_ADDRESS, + decimals: 18, + name: 'Ether', + symbol: 'ETH', + }, +} + +export const testNetwork = { + contractAddress: '0x54395e6c737734D3de29Fc62C10a3ed51eFA2E8A', + hostname: 'testweb.cryptoart.ai', + endpoint: 'https://apitest.cryptoart.ai', + paymentToken: { + type: 0, + chainId: ChainId.Kovan, + address: ZERO_ADDRESS, + decimals: 18, + name: 'Kovan Ether', + symbol: 'KOV', + }, +} diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/useAsset.ts b/packages/mask/src/plugins/CryptoartAI/hooks/useAsset.ts new file mode 100644 index 000000000000..606a65cb4a59 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/useAsset.ts @@ -0,0 +1,74 @@ +import { useAccount, useChainId, useTokenConstants, isSameAddress } from '@masknet/web3-shared-evm' +import { useAsyncRetry } from 'react-use' +import { toTokenIdentifier } from '../utils' +import type { Token } from '../types' + +import { getAsset } from '../apis' + +interface OwnerProps { + ownerAddress: string +} + +export function useAsset(token?: Token) { + const account = useAccount() + const chainId = useChainId() + const { WNATIVE_ADDRESS } = useTokenConstants() + + return useAsyncRetry(async () => { + if (!token) return + + const assetResponse = await getAsset(token.tokenId, chainId) + + return { + owner: assetResponse.owners, + trade: assetResponse.trade, + is_owner: assetResponse.owners.some((owner: OwnerProps) => isSameAddress(owner.ownerAddress, account)), + creator: assetResponse.creatorInfo, + token_id: assetResponse.id, + title: assetResponse.title, + description: assetResponse.description, + ossUrl: assetResponse.ossUrl, + ossUrlCompress: assetResponse.ossUrlCompress, + shareUrl: assetResponse.shareUrl, + priceInWei: assetResponse.priceInWei, + priceInEth: assetResponse.priceInEth, + lowestAuctionPriceWei: assetResponse.lowestAuctionPriceWei, + lowestAuctionPriceEth: assetResponse.lowestAuctionPriceEth, + isEnableAuction: assetResponse.isEnableAuction, + totalAvailable: assetResponse.totalAvailable, + rareType: assetResponse.rareType, + artistCommission: assetResponse.artistCommission, + tokenUri: assetResponse.tokenUri, + editionType: assetResponse.editionType, + editionNumber: assetResponse.editionNumber, + metadataContentLength: assetResponse.metadataContentLength, + metadataContentType: assetResponse.metadataContentType, + metadateColorModel: assetResponse.metadateColorModel, + metadataHasAlpha: assetResponse.metadataHasAlpha, + metadataPixelWidth: assetResponse.metadataPixelWidth, + metadataPixelHeight: assetResponse.metadataPixelHeight, + viewCount: assetResponse.viewCount, + createTime: assetResponse.createTime, + soldNum: assetResponse.soldNum, + totalSurplus: assetResponse.totalSurplus, + labelList: assetResponse.labelList, + priceInUsd: assetResponse.priceInUsd, + likeNum: assetResponse.likeNum, + hasLike: assetResponse.hasLike, + linkWithCreation: assetResponse.linkWithCreation, + linkWithIpfs: assetResponse.linkWithIpfs, + latestBidVo: assetResponse.latestBidVo, + bidVoList: assetResponse.bidVoList, + auditStatus: assetResponse.auditStatus, + auditReason: assetResponse.auditReason, + isSoldOut: assetResponse.isSoldOut, + is24Auction: assetResponse.is24Auction, + isCreateSplit: assetResponse.isCreateSplit, + splitList: assetResponse.splitList, + auctionId: assetResponse.auctionId, + onSales: assetResponse.onSales, + startTimestamp24Auction: assetResponse.startTimestamp24Auction, + is_auction: false, + } + }, [toTokenIdentifier(token), account, chainId, WNATIVE_ADDRESS]) +} diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/useCollectibleState.ts b/packages/mask/src/plugins/CryptoartAI/hooks/useCollectibleState.ts new file mode 100644 index 000000000000..282dd2f04f34 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/useCollectibleState.ts @@ -0,0 +1,26 @@ +import { useState } from 'react' +import { createContainer } from 'unstated-next' +import { OrderSide } from 'opensea-js/lib/types' +import { TabState, Token } from '../types' +import { useAsset } from './useAsset' +import { useOrders } from './useOrders' +import { useEvents } from './useEvents' + +function useCollectibleState(token?: Token) { + const [tabIndex, setTabIndex] = useState(TabState.ARTICLE) + + const asset = useAsset(token) + const offers = useOrders(tabIndex === TabState.OFFER ? token : undefined, OrderSide.Buy) + const events = useEvents(token) + + return { + token, + asset, + tabIndex, + setTabIndex, + offers, + events, + } +} + +export const CollectibleState = createContainer(useCollectibleState) diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/useCryptoArtAI_Contract.ts b/packages/mask/src/plugins/CryptoartAI/hooks/useCryptoArtAI_Contract.ts new file mode 100644 index 000000000000..7bff90145df4 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/useCryptoArtAI_Contract.ts @@ -0,0 +1,27 @@ +import type { AbiItem } from 'web3-utils' +import KnownOriginDigitalAssetV2_ABI from '@masknet/web3-contracts/abis/CryptoArtAIKnownOriginDigitalAssetV2.json' +import ArtistAcceptingBidsV2_ABI from '@masknet/web3-contracts/abis/CryptoArtAIArtistAcceptingBidsV2.json' +import CANFTMarket_ABI from '@masknet/web3-contracts/abis/CryptoArtAICANFTMarket.json' +import type { CryptoArtAIKnownOriginDigitalAssetV2 } from '@masknet/web3-contracts/types/CryptoArtAIKnownOriginDigitalAssetV2' +import type { CryptoArtAIArtistAcceptingBidsV2 } from '@masknet/web3-contracts/types/CryptoArtAIArtistAcceptingBidsV2' +import type { CryptoArtAICANFTMarket } from '@masknet/web3-contracts/types/CryptoArtAICANFTMarket' +import { useContract, useCryptoArtAIConstants } from '@masknet/web3-shared-evm' + +export function useCryptoArtAI_Contract() { + const { KNOWN_ORIGIN_DIGITAL_ASSET_V2, ARTIST_ACCEPTING_BIDS_V2, CANFT_MARKET } = useCryptoArtAIConstants() + const KnownOriginDigitalAssetV2_CONTRACT = useContract( + KNOWN_ORIGIN_DIGITAL_ASSET_V2, + KnownOriginDigitalAssetV2_ABI as AbiItem[], + ) + const ArtistAcceptingBidsV2_CONTRACT = useContract( + ARTIST_ACCEPTING_BIDS_V2, + ArtistAcceptingBidsV2_ABI as AbiItem[], + ) + const CANFTMarket_CONTRACT = useContract(CANFT_MARKET, CANFTMarket_ABI as AbiItem[]) + + return { + knownOriginDigitalAssetV2_contract: KnownOriginDigitalAssetV2_CONTRACT, + artistAcceptingBidsV2_contract: ArtistAcceptingBidsV2_CONTRACT, + cANFTMarket_contract: CANFTMarket_CONTRACT, + } +} diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/useEvents.ts b/packages/mask/src/plugins/CryptoartAI/hooks/useEvents.ts new file mode 100644 index 000000000000..a4c62b390637 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/useEvents.ts @@ -0,0 +1,37 @@ +import { useAsyncRetry } from 'react-use' +import { useChainId } from '@masknet/web3-shared-evm' +import type { Token } from '../types' +import { toTokenIdentifier } from '../utils' + +import { getEvents } from '../apis' + +export function useEvents(token?: Token) { + const chainId = useChainId() + return useAsyncRetry(async () => { + if (!token) { + return { + data: [], + } + } + + const assetEvents = await getEvents(token.tokenId, chainId) + + return { + data: assetEvents.map((event: any) => { + return { + avatorPath: event.avatorPath, + award: event.award, + createTime: event.createTime, + operatorAddress: event.operatorAddress, + operatorName: event.operatorName, + operatorNikeName: event.operatorNikeName, + priceInEth: event.priceInEth, + priceInUsd: event.priceInUsd, + transactionType: event.transactionType, + transactionTypeName: event.transactionTypeName, + transactionUrl: event.transactionUrl, + } + }), + } + }, [chainId, toTokenIdentifier(token)]) +} diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/useOrders.ts b/packages/mask/src/plugins/CryptoartAI/hooks/useOrders.ts new file mode 100644 index 000000000000..4f76cf24a6f2 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/useOrders.ts @@ -0,0 +1,20 @@ +import { useAsyncRetry } from 'react-use' +import { useChainId } from '@masknet/web3-shared-evm' +import { OrderSide } from 'opensea-js/lib/types' +import type { Token } from '../types' +import { toTokenIdentifier } from '../utils' +import { getOrders } from '../apis' + +export function useOrders(token?: Token, side = OrderSide.Buy) { + const chainId = useChainId() + return useAsyncRetry(async () => { + if (!token) return + + const tradeResponse = await getOrders(token.tokenId, side, chainId) + + return { + trade: tradeResponse.trade, + history: tradeResponse.history, + } + }, [chainId, toTokenIdentifier(token)]) +} diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/usePlaceBidCallback.ts b/packages/mask/src/plugins/CryptoartAI/hooks/usePlaceBidCallback.ts new file mode 100644 index 000000000000..c1209ba56741 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/usePlaceBidCallback.ts @@ -0,0 +1,140 @@ +import { useCallback } from 'react' +import BigNumber from 'bignumber.js' +import { ZERO_ADDRESS } from '@masknet/web3-shared-evm' +import type { NonPayableTx } from '@masknet/web3-contracts/types/types' +import { + TransactionEventType, + TransactionStateType, + useTransactionState, + useAccount, + useChainId, +} from '@masknet/web3-shared-evm' +import { useCryptoArtAI_Contract } from './useCryptoArtAI_Contract' + +export function usePlaceBidCallback(is24Auction: boolean, editionNumber: string) { + const account = useAccount() + const chainId = useChainId() + const { artistAcceptingBidsV2_contract, cANFTMarket_contract } = useCryptoArtAI_Contract() + const [placeBidState, setPlaceBidState] = useTransactionState() + + const placeBidCallback = useCallback( + async (priceInWei: number) => { + if (!is24Auction && !artistAcceptingBidsV2_contract) { + setPlaceBidState({ + type: TransactionStateType.UNKNOWN, + }) + return + } + if (is24Auction && !cANFTMarket_contract) { + setPlaceBidState({ + type: TransactionStateType.UNKNOWN, + }) + return + } + + // start waiting for provider to confirm tx + setPlaceBidState({ + type: TransactionStateType.WAIT_FOR_CONFIRMING, + }) + + // estimate gas and compose transaction + const config = { + from: account, + value: new BigNumber(priceInWei).toFixed(), + gas: !is24Auction + ? await artistAcceptingBidsV2_contract?.methods + .placeBid(editionNumber) + .estimateGas({ + from: account, + value: new BigNumber(priceInWei).toFixed(), + }) + .catch((error) => { + setPlaceBidState({ + type: TransactionStateType.FAILED, + error, + }) + throw error + }) + : await cANFTMarket_contract?.methods + .placeBid(editionNumber, ZERO_ADDRESS) + .estimateGas({ + from: account, + value: new BigNumber(priceInWei).toFixed(), + }) + .catch((error) => { + setPlaceBidState({ + type: TransactionStateType.FAILED, + error, + }) + throw error + }), + } + + // send transaction and wait for hash + return new Promise(async (resolve, reject) => { + if (!is24Auction) { + artistAcceptingBidsV2_contract?.methods + .placeBid(editionNumber) + .send(config as NonPayableTx) + .on(TransactionEventType.RECEIPT, (receipt) => { + setPlaceBidState({ + type: TransactionStateType.CONFIRMED, + no: 0, + receipt, + }) + resolve() + }) + .on(TransactionEventType.TRANSACTION_HASH, (hash) => { + setPlaceBidState({ + type: TransactionStateType.HASH, + hash, + }) + resolve() + }) + .on(TransactionEventType.ERROR, (error) => { + setPlaceBidState({ + type: TransactionStateType.FAILED, + error, + }) + reject(error) + }) + } else { + cANFTMarket_contract?.methods + .placeBid(editionNumber, ZERO_ADDRESS) + .send(config as NonPayableTx) + .on(TransactionEventType.RECEIPT, (receipt) => { + setPlaceBidState({ + type: TransactionStateType.CONFIRMED, + no: 0, + receipt, + }) + resolve() + }) + .on(TransactionEventType.TRANSACTION_HASH, (hash) => { + setPlaceBidState({ + type: TransactionStateType.HASH, + hash, + }) + resolve() + }) + .on(TransactionEventType.ERROR, (error) => { + setPlaceBidState({ + type: TransactionStateType.FAILED, + error, + }) + reject(error) + }) + } + }) + }, + [account, chainId, is24Auction, editionNumber, artistAcceptingBidsV2_contract, cANFTMarket_contract], + ) + + const resetCallback = useCallback(() => { + setPlaceBidState({ + type: TransactionStateType.UNKNOWN, + }) + }, []) + + return [placeBidState, placeBidCallback, resetCallback] as const +} diff --git a/packages/mask/src/plugins/CryptoartAI/hooks/usePurchaseCallback.ts b/packages/mask/src/plugins/CryptoartAI/hooks/usePurchaseCallback.ts new file mode 100644 index 000000000000..6f7e9c26feb0 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/hooks/usePurchaseCallback.ts @@ -0,0 +1,88 @@ +import { useCallback } from 'react' +import BigNumber from 'bignumber.js' +import type { NonPayableTx } from '@masknet/web3-contracts/types/types' +import { + TransactionEventType, + TransactionStateType, + useTransactionState, + useAccount, + useChainId, +} from '@masknet/web3-shared-evm' +import { useCryptoArtAI_Contract } from './useCryptoArtAI_Contract' + +export function usePurchaseCallback(editionNumber: string, priceInWei: number) { + const account = useAccount() + const chainId = useChainId() + const { knownOriginDigitalAssetV2_contract } = useCryptoArtAI_Contract() + const [purchaseState, setPurchaseState] = useTransactionState() + + const purchaseCallback = useCallback(async () => { + if (!knownOriginDigitalAssetV2_contract) { + setPurchaseState({ + type: TransactionStateType.UNKNOWN, + }) + return + } + + // start waiting for provider to confirm tx + setPurchaseState({ + type: TransactionStateType.WAIT_FOR_CONFIRMING, + }) + + // estimate gas and compose transaction + const config = { + from: account, + value: new BigNumber(priceInWei).toFixed(), + gas: await knownOriginDigitalAssetV2_contract.methods + .purchase(editionNumber) + .estimateGas({ + from: account, + value: new BigNumber(priceInWei).toFixed(), + }) + .catch((error) => { + setPurchaseState({ + type: TransactionStateType.FAILED, + error, + }) + throw error + }), + } + + // send transaction and wait for hash + return new Promise(async (resolve, reject) => { + knownOriginDigitalAssetV2_contract.methods + .purchase(editionNumber) + .send(config as NonPayableTx) + .on(TransactionEventType.RECEIPT, (receipt) => { + setPurchaseState({ + type: TransactionStateType.CONFIRMED, + no: 0, + receipt, + }) + resolve() + }) + .on(TransactionEventType.TRANSACTION_HASH, (hash) => { + setPurchaseState({ + type: TransactionStateType.HASH, + hash, + }) + resolve() + }) + .on(TransactionEventType.ERROR, (error) => { + setPurchaseState({ + type: TransactionStateType.FAILED, + error, + }) + reject(error) + }) + }) + }, [account, chainId, knownOriginDigitalAssetV2_contract]) + + const resetCallback = useCallback(() => { + setPurchaseState({ + type: TransactionStateType.UNKNOWN, + }) + }, []) + + return [purchaseState, purchaseCallback, resetCallback] as const +} diff --git a/packages/mask/src/plugins/CryptoartAI/index.ts b/packages/mask/src/plugins/CryptoartAI/index.ts new file mode 100644 index 000000000000..eb51ba0afe25 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/index.ts @@ -0,0 +1,16 @@ +import { registerPlugin } from '@masknet/plugin-infra' +import { base } from './base' + +registerPlugin({ + ...base, + SNSAdaptor: { + load: () => import('./SNSAdaptor'), + hotModuleReload: (hot) => + import.meta.webpackHot && import.meta.webpackHot.accept('./SNSAdaptor', () => hot(import('./SNSAdaptor'))), + }, + Worker: { + load: () => import('./Worker'), + hotModuleReload: (hot) => + import.meta.webpackHot && import.meta.webpackHot.accept('./Worker', () => hot(import('./Worker'))), + }, +}) diff --git a/packages/mask/src/plugins/CryptoartAI/pipes/index.ts b/packages/mask/src/plugins/CryptoartAI/pipes/index.ts new file mode 100644 index 000000000000..f841adc22368 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/pipes/index.ts @@ -0,0 +1,34 @@ +import { ChainId } from '@masknet/web3-shared-evm' +import urlcat from 'urlcat' +import { prefixPath, mainNetwork, testNetwork } from '../constants' + +export function resolveAPILinkOnCryptoartAI(chainId?: ChainId) { + if (chainId === ChainId.Kovan) { + return testNetwork.endpoint + } + + return mainNetwork.endpoint +} + +export function resolveWebLinkOnCryptoartAI(chainId?: ChainId) { + if (chainId === ChainId.Kovan) { + return `https://${testNetwork.hostname}` + } + + return `https://${mainNetwork.hostname}` +} + +export function resolveAssetLinkOnCryptoartAI(creator: string, token_id: string, chainId?: ChainId) { + return urlcat(resolveWebLinkOnCryptoartAI(chainId), `${prefixPath}/:creator/:token_id`, { + creator: encodeURI(creator), + token_id, + }) +} + +export function resolvePaymentTokensOnCryptoartAI(chainId?: ChainId) { + if (chainId === ChainId.Kovan) { + return [testNetwork.paymentToken] + } + + return [mainNetwork.paymentToken] +} diff --git a/packages/mask/src/plugins/CryptoartAI/types/index.ts b/packages/mask/src/plugins/CryptoartAI/types/index.ts new file mode 100644 index 000000000000..3daf5b453f6f --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/types/index.ts @@ -0,0 +1,30 @@ +import type { ChainId } from '@masknet/web3-shared-evm' + +export interface PayloadType { + chain_id: ChainId + creator: string + token_id: string + contractAddress: string +} + +export enum TabState { + ARTICLE = 0, + TOKEN = 1, + OFFER = 2, + HISTORY = 3, +} + +export interface Token { + chainId: ChainId + creator: string + tokenId: string + contractAddress: string +} + +export enum TransactionType { + BID_WITHDRAW = 'Bid Withdrawn', + SETTLED = 'Settled', + BID_PLACED = 'Bid Placed', + ON_SALE = 'On Sale', + EDITION_CREATED = 'Edition Created', +} diff --git a/packages/mask/src/plugins/CryptoartAI/utils.ts b/packages/mask/src/plugins/CryptoartAI/utils.ts new file mode 100644 index 000000000000..95f9c25673b7 --- /dev/null +++ b/packages/mask/src/plugins/CryptoartAI/utils.ts @@ -0,0 +1,67 @@ +import BigNumber from 'bignumber.js' +import type { AssetEvent, Order } from 'opensea-js/lib/types' +import { parseURL } from '../../utils/utils' +import { ChainId, formatBalance } from '@masknet/web3-shared-evm' +import { escapeRegExp } from 'lodash-unified' +import { prefixPath, mainNetwork, testNetwork } from './constants' +import type { Token } from './types' + +export function checkUrl(url: string): boolean { + const protocol = 'https://' + const _url = new URL(url.startsWith(protocol) ? url : protocol + url) + return [mainNetwork.hostname, testNetwork.hostname].includes(_url.hostname) && _url.pathname.includes(prefixPath) +} + +export function getRelevantUrl(textContent: string) { + const urls = parseURL(textContent) + return urls.find(checkUrl) +} + +export function getAssetInfoFromURL(url?: string) { + if (!url) return null + + const addresses = { + [ChainId.Kovan]: testNetwork.contractAddress, + [ChainId.Mainnet]: mainNetwork.contractAddress, + } + + const { hostname, pathname } = new URL(url) + const pattern = new RegExp(`^${escapeRegExp(prefixPath)}${/\/([^/]+)\/(\d+)/.source}$`, 'g') + const matched = pattern.exec(pathname) + if (!matched) { + return null // early return + } + + const chain_id = hostname === testNetwork.hostname ? ChainId.Kovan : ChainId.Mainnet + const creator = matched[1] + const token_id = matched[2] + const contractAddress = addresses[chain_id] + return { chain_id, creator, token_id, contractAddress } +} + +export function getOrderUnitPrice(order: Order) { + if (!order.currentPrice || !order.paymentTokenContract?.decimals) return + const price = formatBalance(order.currentPrice, order.paymentTokenContract.decimals) + const quantity = formatBalance(order.quantity, new BigNumber(order.quantity).toString() !== '1' ? 8 : 0) + + return new BigNumber(price).dividedBy(quantity).toFixed(4, 1) +} + +export function getOrderUSDPrice(order: Order) { + if (!order.currentPrice || !order.paymentTokenContract?.decimals) return + const price = formatBalance(order.paymentTokenContract.usdPrice, 0) + const quantity = formatBalance(order.currentPrice, order.paymentTokenContract.decimals) + + return new BigNumber(price).multipliedBy(quantity).toFixed(2, 1) +} + +export function getLastSalePrice(lastSale: AssetEvent | null) { + if (!lastSale?.totalPrice || !lastSale?.paymentToken?.decimals) return + const price = formatBalance(lastSale.totalPrice, lastSale.paymentToken.decimals) + return price +} + +export function toTokenIdentifier(token?: Token) { + if (!token) return '' + return `${token.contractAddress}_${token.tokenId}` +} diff --git a/packages/web3-constants/evm/cryptoartai.json b/packages/web3-constants/evm/cryptoartai.json new file mode 100644 index 000000000000..f5f33306fa32 --- /dev/null +++ b/packages/web3-constants/evm/cryptoartai.json @@ -0,0 +1,44 @@ +{ + "KNOWN_ORIGIN_DIGITAL_ASSET_V2": { + "Mainnet": "0x3AD503084f1bD8d15A7F5EbE7A038C064e1E3Fa1", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "0x54395e6c737734d3de29fc62c10a3ed51efa2e8a", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "" + }, + "ARTIST_ACCEPTING_BIDS_V2": { + "Mainnet": "0x78C889749f29D2965a76Ede3BBb232A9729Ccf0b", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "0x7bd41f5c8cb6225e7415f1406e117701a40626e0", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "" + }, + "CANFT_MARKET": { + "Mainnet": "0x72d081953957723e540780a0C6bA31725469238E", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "0xf690444aae2371da6f83af442f52535530702ab4", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "" + } +} diff --git a/packages/web3-contracts/abis/CryptoArtAIArtistAcceptingBidsV2.json b/packages/web3-contracts/abis/CryptoArtAIArtistAcceptingBidsV2.json new file mode 100644 index 000000000000..fd6ec57c610c --- /dev/null +++ b/packages/web3-contracts/abis/CryptoArtAIArtistAcceptingBidsV2.json @@ -0,0 +1,1035 @@ +[ + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "increaseBid", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "highestBidForEdition", + "outputs": [ + { + "name": "_bidder", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_operator", + "type": "address" + }, + { + "name": "_role", + "type": "string" + } + ], + "name": "checkRole", + "outputs": [], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "withdrawBid", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ROLE_WHITELISTED", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_operator", + "type": "address" + }, + { + "name": "_role", + "type": "string" + } + ], + "name": "hasRole", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_operators", + "type": "address[]" + } + ], + "name": "removeAddressesFromWhitelist", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_withdrawalAccount", + "type": "address" + } + ], + "name": "withdrawStuckEther", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_operator", + "type": "address" + } + ], + "name": "removeAddressFromWhitelist", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "acceptBid", + "outputs": [ + { + "name": "tokenId", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "addedEditions", + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "unpause", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_minBidAmount", + "type": "uint256" + } + ], + "name": "setMinBidAmount", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "editionHighestBid", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minBidAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "editionsOnceEnabledForAuctions", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "paused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "editionController", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "rejectBid", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "koCommissionAccount", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "disableEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "editionNumberToArtistControlAddress", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_operator", + "type": "address" + } + ], + "name": "addAddressToWhitelist", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "pause", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "auctionDetails", + "outputs": [ + { + "name": "_enabled", + "type": "bool" + }, + { + "name": "_bidder", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_controller", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "enableEditionForArtist", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_bidder", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "manualOverrideEditionHighestBidAndBidder", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_koCommissionAccount", + "type": "address" + } + ], + "name": "setKoCommissionAccount", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "cancelAuction", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_bidder", + "type": "address" + } + ], + "name": "manualDeleteEditionBids", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "placeBid", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_operator", + "type": "address" + } + ], + "name": "whitelist", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_address", + "type": "address" + } + ], + "name": "setArtistsControlAddressAndEnabledEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_withdrawalAccount", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdrawStuckEtherOfAmount", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_kodaAddress", + "type": "address" + } + ], + "name": "setKodavV2", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "enabledEditions", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_address", + "type": "address" + } + ], + "name": "setArtistsControlAddress", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kodaAddress", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_operators", + "type": "address[]" + } + ], + "name": "addAddressesToWhitelist", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "isEditionEnabled", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "enableEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_kodaAddress", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_bidder", + "type": "address" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "BidPlaced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_bidder", + "type": "address" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "BidIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_bidder", + "type": "address" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "BidWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_bidder", + "type": "address" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "BidAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_caller", + "type": "address" + }, + { + "indexed": true, + "name": "_bidder", + "type": "address" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "BidRejected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_bidder", + "type": "address" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "BidderRefunded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "AuctionCancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_auctioneer", + "type": "address" + } + ], + "name": "AuctionEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_auctioneer", + "type": "address" + } + ], + "name": "AuctionDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Pause", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Unpause", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "name": "role", + "type": "string" + } + ], + "name": "RoleAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "name": "role", + "type": "string" + } + ], + "name": "RoleRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + } + ], + "name": "OwnershipRenounced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + } +] diff --git a/packages/web3-contracts/abis/CryptoArtAICANFTMarket.json b/packages/web3-contracts/abis/CryptoArtAICANFTMarket.json new file mode 100644 index 000000000000..309bb0e115df --- /dev/null +++ b/packages/web3-contracts/abis/CryptoArtAICANFTMarket.json @@ -0,0 +1,371 @@ +[ + { + "inputs": [ + { "internalType": "contract IAccessControl", "name": "access", "type": "address" }, + { "internalType": "contract ICAAsset", "name": "caAsset", "type": "address" }, + { "internalType": "address payable", "name": "treasury", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "bidder", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "award", "type": "uint256" } + ], + "name": "AuctionAwardUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint32", "name": "caPoints", "type": "uint32" }, + { "indexed": false, "internalType": "uint32", "name": "artistPoints", "type": "uint32" }, + { "indexed": false, "internalType": "uint32", "name": "sellerPoints", "type": "uint32" }, + { "indexed": false, "internalType": "uint32", "name": "auctionAwardPoints", "type": "uint32" }, + { "indexed": false, "internalType": "uint32", "name": "sharePoints", "type": "uint32" } + ], + "name": "MarketFeesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "bidder", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "endTime", "type": "uint256" } + ], + "name": "ReserveAuctionBidPlaced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }], + "name": "ReserveAuctionCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": false, "internalType": "string", "name": "reason", "type": "string" } + ], + "name": "ReserveAuctionCanceledByAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "minPercentIncrementInBasisPoints", + "type": "uint32" + }, + { "indexed": false, "internalType": "uint256", "name": "maxBidIncrementRequirement", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "duration", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "extensionDuration", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "goLiveDate", "type": "uint256" } + ], + "name": "ReserveAuctionConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "seller", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "duration", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "extensionDuration", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "ReserveAuctionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "seller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "bidder", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "ReserveAuctionFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "originalSellerAddress", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newSellerAddress", "type": "address" } + ], + "name": "ReserveAuctionSellerMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "ReserveAuctionUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "share", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "award", "type": "uint256" } + ], + "name": "ShareAwardUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "WithdrawPending", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [], + "name": "accessControl", + "outputs": [{ "internalType": "contract IAccessControl", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "internalType": "string", "name": "reason", "type": "string" } + ], + "name": "adminCancelReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "minPercentIncrementInBasisPoints", "type": "uint32" }, + { "internalType": "uint32", "name": "duration", "type": "uint32" }, + { "internalType": "uint32", "name": "_caPoints", "type": "uint32" }, + { "internalType": "uint32", "name": "_artistPoints", "type": "uint32" }, + { "internalType": "uint32", "name": "_sellerPoints", "type": "uint32" }, + { "internalType": "uint32", "name": "_auctionAwardPoints", "type": "uint32" }, + { "internalType": "uint32", "name": "_sharePoints", "type": "uint32" } + ], + "name": "adminUpdateConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "awards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "auctionId", "type": "uint256" }], + "name": "cancelReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "address", "name": "seller", "type": "address" }, + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "createReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "auctionId", "type": "uint256" }], + "name": "finalizeReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }], + "name": "getArtist", + "outputs": [{ "internalType": "address", "name": "artist", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCATreasury", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFeeConfig", + "outputs": [ + { "internalType": "uint32", "name": "", "type": "uint32" }, + { "internalType": "uint32", "name": "", "type": "uint32" }, + { "internalType": "uint32", "name": "", "type": "uint32" }, + { "internalType": "uint32", "name": "", "type": "uint32" }, + { "internalType": "uint32", "name": "", "type": "uint32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "getFees", + "outputs": [ + { "internalType": "uint256", "name": "caFee", "type": "uint256" }, + { "internalType": "uint256", "name": "artistFee", "type": "uint256" }, + { "internalType": "uint256", "name": "sellerFee", "type": "uint256" }, + { "internalType": "uint256", "name": "auctionFee", "type": "uint256" }, + { "internalType": "uint256", "name": "shareFee", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }], + "name": "getIsPrimary", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "auctionId", "type": "uint256" }], + "name": "getMinBidAmount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getPendingWithdrawal", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "auctionId", "type": "uint256" }], + "name": "getReserveAuction", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, + { "internalType": "address", "name": "seller", "type": "address" }, + { "internalType": "uint32", "name": "duration", "type": "uint32" }, + { "internalType": "uint32", "name": "extensionDuration", "type": "uint32" }, + { "internalType": "uint32", "name": "endTime", "type": "uint32" }, + { "internalType": "address", "name": "bidder", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "shareUser", "type": "address" } + ], + "internalType": "struct NFTMarketReserveAuction.ReserveAuction", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserveAuctionConfig", + "outputs": [ + { "internalType": "uint256", "name": "minPercentIncrementInBasisPoints", "type": "uint256" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }], + "name": "getReserveAuctionIdFor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "internalType": "address", "name": "shareUser", "type": "address" } + ], + "name": "placeBid", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address payable", "name": "_treasury", "type": "address" }], + "name": "setCATreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "auctionId", "type": "uint256" }, + { "internalType": "uint256", "name": "reservePrice", "type": "uint256" } + ], + "name": "updateReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address payable", "name": "user", "type": "address" }], + "name": "withdrawFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "withdrawFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_withdrawalAccount", "type": "address" }], + "name": "withdrawStuckEther", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawThreshold", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/CryptoArtAIKnownOriginDigitalAssetV2.json b/packages/web3-contracts/abis/CryptoArtAIKnownOriginDigitalAssetV2.json new file mode 100644 index 000000000000..b45000482299 --- /dev/null +++ b/packages/web3-contracts/abis/CryptoArtAIKnownOriginDigitalAssetV2.json @@ -0,0 +1,1955 @@ +[ + { + "constant": true, + "inputs": [ + { + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_active", + "type": "bool" + } + ], + "name": "updateActive", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "priceInWeiToken", + "outputs": [ + { + "name": "_priceInWei", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + }, + { + "name": "_uri", + "type": "string" + } + ], + "name": "setTokenURI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_koCommissionAccount", + "type": "address" + } + ], + "name": "updateKoCommissionAccount", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "InterfaceId_ERC165", + "outputs": [ + { + "name": "", + "type": "bytes4" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "editionData", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newBaseURI", + "type": "string" + } + ], + "name": "updateTokenBaseURI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_operator", + "type": "address" + }, + { + "name": "_role", + "type": "uint8" + } + ], + "name": "checkRole", + "outputs": [], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalPurchaseValueInWei", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_startDate", + "type": "uint256" + } + ], + "name": "updateStartDate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "artistCommission", + "outputs": [ + { + "name": "_artistAccount", + "type": "address" + }, + { + "name": "_artistCommission", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "tokenURIEdition", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "unpause", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalNumberAvailable", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_operator", + "type": "address" + }, + { + "name": "_role", + "type": "uint8" + } + ], + "name": "addAddressToAccessControl", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "priceInWeiEdition", + "outputs": [ + { + "name": "_priceInWei", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "tokenBaseURI", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_rate", + "type": "uint256" + } + ], + "name": "updateArtistCommission", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "editionType", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "tokensOf", + "outputs": [ + { + "name": "_tokenIds", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "paused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "purchaseDatesEdition", + "outputs": [ + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_artistsAccount", + "type": "address" + } + ], + "name": "artistsEditions", + "outputs": [ + { + "name": "_editionNumbers", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "totalAvailableEdition", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "koCommissionAccount", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "editionNumber", + "type": "uint256" + } + ], + "name": "detailsOfEdition", + "outputs": [ + { + "name": "_editionData", + "type": "bytes32" + }, + { + "name": "_editionType", + "type": "uint256" + }, + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + }, + { + "name": "_artistAccount", + "type": "address" + }, + { + "name": "_artistCommission", + "type": "uint256" + }, + { + "name": "_priceInWei", + "type": "uint256" + }, + { + "name": "_tokenURI", + "type": "string" + }, + { + "name": "_totalSupply", + "type": "uint256" + }, + { + "name": "_totalAvailable", + "type": "uint256" + }, + { + "name": "_active", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_uri", + "type": "string" + } + ], + "name": "updateEditionTokenURI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "tokensOfEdition", + "outputs": [ + { + "name": "_tokenIds", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "underMint", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_priceInWei", + "type": "uint256" + } + ], + "name": "updatePriceInWei", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "editionOfTokenId", + "outputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "pause", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "purchaseTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_editionData", + "type": "bytes32" + }, + { + "name": "_editionType", + "type": "uint256" + }, + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + }, + { + "name": "_artistAccount", + "type": "address" + }, + { + "name": "_artistCommission", + "type": "uint256" + }, + { + "name": "_priceInWei", + "type": "uint256" + }, + { + "name": "_tokenURI", + "type": "string" + }, + { + "name": "_totalAvailable", + "type": "uint256" + } + ], + "name": "createActiveEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ROLE_MINTER", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_operator", + "type": "address" + }, + { + "name": "_role", + "type": "uint8" + } + ], + "name": "hasRole", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_operator", + "type": "address" + }, + { + "name": "_role", + "type": "uint8" + } + ], + "name": "removeAddressFromAccessControl", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_rate", + "type": "uint256" + }, + { + "name": "_recipient", + "type": "address" + } + ], + "name": "updateOptionalCommission", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ROLE_UNDER_MINTER", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_editionData", + "type": "bytes32" + }, + { + "name": "_editionType", + "type": "uint256" + }, + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + }, + { + "name": "_artistAccount", + "type": "address" + }, + { + "name": "_artistCommission", + "type": "uint256" + }, + { + "name": "_priceInWei", + "type": "uint256" + }, + { + "name": "_tokenURI", + "type": "string" + }, + { + "name": "_totalSupply", + "type": "uint256" + }, + { + "name": "_totalAvailable", + "type": "uint256" + } + ], + "name": "createInactivePreMintedEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "reclaimEther", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "highestEditionNumber", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_tokenIds", + "type": "uint256[]" + } + ], + "name": "batchTransfer", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_editionData", + "type": "bytes32" + }, + { + "name": "_editionType", + "type": "uint256" + }, + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + }, + { + "name": "_artistAccount", + "type": "address" + }, + { + "name": "_artistCommission", + "type": "uint256" + }, + { + "name": "_priceInWei", + "type": "uint256" + }, + { + "name": "_tokenURI", + "type": "string" + }, + { + "name": "_totalSupply", + "type": "uint256" + }, + { + "name": "_totalAvailable", + "type": "uint256" + } + ], + "name": "createActivePreMintedEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_artistAccount", + "type": "address" + } + ], + "name": "updateArtistsAccount", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "tokenData", + "outputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_editionType", + "type": "uint256" + }, + { + "name": "_editionData", + "type": "bytes32" + }, + { + "name": "_tokenURI", + "type": "string" + }, + { + "name": "_owner", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "totalSupplyEdition", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_tokenId", + "type": "uint256" + }, + { + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "purchaseDatesToken", + "outputs": [ + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "editionActive", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "totalRemaining", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_totalAvailable", + "type": "uint256" + } + ], + "name": "updateTotalAvailable", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ROLE_KNOWN_ORIGIN", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "editionExists", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_editionType", + "type": "uint256" + } + ], + "name": "updateEditionType", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "editionOptionalCommission", + "outputs": [ + { + "name": "_rate", + "type": "uint256" + }, + { + "name": "_recipient", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + } + ], + "name": "updateEndDate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_editionData", + "type": "bytes32" + }, + { + "name": "_editionType", + "type": "uint256" + }, + { + "name": "_startDate", + "type": "uint256" + }, + { + "name": "_endDate", + "type": "uint256" + }, + { + "name": "_artistAccount", + "type": "address" + }, + { + "name": "_artistCommission", + "type": "uint256" + }, + { + "name": "_priceInWei", + "type": "uint256" + }, + { + "name": "_tokenURI", + "type": "string" + }, + { + "name": "_totalAvailable", + "type": "uint256" + } + ], + "name": "createInactiveEdition", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_type", + "type": "uint256" + } + ], + "name": "editionsOfType", + "outputs": [ + { + "name": "_editionNumbers", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + } + ], + "name": "purchase", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalNumberMinted", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_tokenIds", + "type": "uint256[]" + } + ], + "name": "batchTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_editionNumber", + "type": "uint256" + }, + { + "name": "_totalSupply", + "type": "uint256" + } + ], + "name": "updateTotalSupply", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "tokenURISafe", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": true, + "stateMutability": "payable", + "type": "constructor" + }, + { + "payable": false, + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_buyer", + "type": "address" + }, + { + "indexed": false, + "name": "_priceInWei", + "type": "uint256" + } + ], + "name": "Purchase", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_buyer", + "type": "address" + } + ], + "name": "Minted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_editionNumber", + "type": "uint256" + }, + { + "indexed": true, + "name": "_editionData", + "type": "bytes32" + }, + { + "indexed": true, + "name": "_editionType", + "type": "uint256" + } + ], + "name": "EditionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Pause", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Unpause", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + } + ], + "name": "OwnershipRenounced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "name": "role", + "type": "uint8" + } + ], + "name": "RoleAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "name": "role", + "type": "uint8" + } + ], + "name": "RoleRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_approved", + "type": "address" + }, + { + "indexed": true, + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_operator", + "type": "address" + }, + { + "indexed": false, + "name": "_approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + } +] diff --git a/packages/web3-contracts/types/CryptoArtAIArtistAcceptingBidsV2.d.ts b/packages/web3-contracts/types/CryptoArtAIArtistAcceptingBidsV2.d.ts new file mode 100644 index 000000000000..2931ddecf45c --- /dev/null +++ b/packages/web3-contracts/types/CryptoArtAIArtistAcceptingBidsV2.d.ts @@ -0,0 +1,330 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +export interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type BidPlaced = ContractEventLog<{ + _bidder: string + _editionNumber: string + _amount: string + 0: string + 1: string + 2: string +}> +export type BidIncreased = ContractEventLog<{ + _bidder: string + _editionNumber: string + _amount: string + 0: string + 1: string + 2: string +}> +export type BidWithdrawn = ContractEventLog<{ + _bidder: string + _editionNumber: string + 0: string + 1: string +}> +export type BidAccepted = ContractEventLog<{ + _bidder: string + _editionNumber: string + _tokenId: string + _amount: string + 0: string + 1: string + 2: string + 3: string +}> +export type BidRejected = ContractEventLog<{ + _caller: string + _bidder: string + _editionNumber: string + _amount: string + 0: string + 1: string + 2: string + 3: string +}> +export type BidderRefunded = ContractEventLog<{ + _editionNumber: string + _bidder: string + _amount: string + 0: string + 1: string + 2: string +}> +export type AuctionCancelled = ContractEventLog<{ + _editionNumber: string + 0: string +}> +export type AuctionEnabled = ContractEventLog<{ + _editionNumber: string + _auctioneer: string + 0: string + 1: string +}> +export type AuctionDisabled = ContractEventLog<{ + _editionNumber: string + _auctioneer: string + 0: string + 1: string +}> +export type Pause = ContractEventLog<{}> +export type Unpause = ContractEventLog<{}> +export type RoleAdded = ContractEventLog<{ + operator: string + role: string + 0: string + 1: string +}> +export type RoleRemoved = ContractEventLog<{ + operator: string + role: string + 0: string + 1: string +}> +export type OwnershipRenounced = ContractEventLog<{ + previousOwner: string + 0: string +}> +export type OwnershipTransferred = ContractEventLog<{ + previousOwner: string + newOwner: string + 0: string + 1: string +}> + +export interface CryptoArtAIArtistAcceptingBidsV2 extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CryptoArtAIArtistAcceptingBidsV2 + clone(): CryptoArtAIArtistAcceptingBidsV2 + methods: { + increaseBid(_editionNumber: number | string | BN): PayableTransactionObject + + highestBidForEdition(_editionNumber: number | string | BN): NonPayableTransactionObject<{ + _bidder: string + _value: string + 0: string + 1: string + }> + + checkRole(_operator: string, _role: string): NonPayableTransactionObject + + withdrawBid(_editionNumber: number | string | BN): NonPayableTransactionObject + + ROLE_WHITELISTED(): NonPayableTransactionObject + + hasRole(_operator: string, _role: string): NonPayableTransactionObject + + removeAddressesFromWhitelist(_operators: string[]): NonPayableTransactionObject + + withdrawStuckEther(_withdrawalAccount: string): NonPayableTransactionObject + + removeAddressFromWhitelist(_operator: string): NonPayableTransactionObject + + acceptBid(_editionNumber: number | string | BN): NonPayableTransactionObject + + addedEditions(): NonPayableTransactionObject + + unpause(): NonPayableTransactionObject + + setMinBidAmount(_minBidAmount: number | string | BN): NonPayableTransactionObject + + editionHighestBid(arg0: number | string | BN): NonPayableTransactionObject + + minBidAmount(): NonPayableTransactionObject + + editionsOnceEnabledForAuctions(arg0: number | string | BN): NonPayableTransactionObject + + paused(): NonPayableTransactionObject + + editionController(_editionNumber: number | string | BN): NonPayableTransactionObject + + rejectBid(_editionNumber: number | string | BN): NonPayableTransactionObject + + koCommissionAccount(): NonPayableTransactionObject + + renounceOwnership(): NonPayableTransactionObject + + disableEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + editionNumberToArtistControlAddress(arg0: number | string | BN): NonPayableTransactionObject + + addAddressToWhitelist(_operator: string): NonPayableTransactionObject + + pause(): NonPayableTransactionObject + + auctionDetails(_editionNumber: number | string | BN): NonPayableTransactionObject<{ + _enabled: boolean + _bidder: string + _value: string + _controller: string + 0: boolean + 1: string + 2: string + 3: string + }> + + enableEditionForArtist(_editionNumber: number | string | BN): NonPayableTransactionObject + + manualOverrideEditionHighestBidAndBidder( + _editionNumber: number | string | BN, + _bidder: string, + _amount: number | string | BN, + ): NonPayableTransactionObject + + owner(): NonPayableTransactionObject + + setKoCommissionAccount(_koCommissionAccount: string): NonPayableTransactionObject + + cancelAuction(_editionNumber: number | string | BN): NonPayableTransactionObject + + manualDeleteEditionBids( + _editionNumber: number | string | BN, + _bidder: string, + ): NonPayableTransactionObject + + placeBid(_editionNumber: number | string | BN): PayableTransactionObject + + whitelist(_operator: string): NonPayableTransactionObject + + setArtistsControlAddressAndEnabledEdition( + _editionNumber: number | string | BN, + _address: string, + ): NonPayableTransactionObject + + withdrawStuckEtherOfAmount( + _withdrawalAccount: string, + _amount: number | string | BN, + ): NonPayableTransactionObject + + setKodavV2(_kodaAddress: string): NonPayableTransactionObject + + enabledEditions(arg0: number | string | BN): NonPayableTransactionObject + + setArtistsControlAddress( + _editionNumber: number | string | BN, + _address: string, + ): NonPayableTransactionObject + + kodaAddress(): NonPayableTransactionObject + + addAddressesToWhitelist(_operators: string[]): NonPayableTransactionObject + + isEditionEnabled(_editionNumber: number | string | BN): NonPayableTransactionObject + + enableEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + transferOwnership(_newOwner: string): NonPayableTransactionObject + } + events: { + BidPlaced(cb?: Callback): EventEmitter + BidPlaced(options?: EventOptions, cb?: Callback): EventEmitter + + BidIncreased(cb?: Callback): EventEmitter + BidIncreased(options?: EventOptions, cb?: Callback): EventEmitter + + BidWithdrawn(cb?: Callback): EventEmitter + BidWithdrawn(options?: EventOptions, cb?: Callback): EventEmitter + + BidAccepted(cb?: Callback): EventEmitter + BidAccepted(options?: EventOptions, cb?: Callback): EventEmitter + + BidRejected(cb?: Callback): EventEmitter + BidRejected(options?: EventOptions, cb?: Callback): EventEmitter + + BidderRefunded(cb?: Callback): EventEmitter + BidderRefunded(options?: EventOptions, cb?: Callback): EventEmitter + + AuctionCancelled(cb?: Callback): EventEmitter + AuctionCancelled(options?: EventOptions, cb?: Callback): EventEmitter + + AuctionEnabled(cb?: Callback): EventEmitter + AuctionEnabled(options?: EventOptions, cb?: Callback): EventEmitter + + AuctionDisabled(cb?: Callback): EventEmitter + AuctionDisabled(options?: EventOptions, cb?: Callback): EventEmitter + + Pause(cb?: Callback): EventEmitter + Pause(options?: EventOptions, cb?: Callback): EventEmitter + + Unpause(cb?: Callback): EventEmitter + Unpause(options?: EventOptions, cb?: Callback): EventEmitter + + RoleAdded(cb?: Callback): EventEmitter + RoleAdded(options?: EventOptions, cb?: Callback): EventEmitter + + RoleRemoved(cb?: Callback): EventEmitter + RoleRemoved(options?: EventOptions, cb?: Callback): EventEmitter + + OwnershipRenounced(cb?: Callback): EventEmitter + OwnershipRenounced(options?: EventOptions, cb?: Callback): EventEmitter + + OwnershipTransferred(cb?: Callback): EventEmitter + OwnershipTransferred(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'BidPlaced', cb: Callback): void + once(event: 'BidPlaced', options: EventOptions, cb: Callback): void + + once(event: 'BidIncreased', cb: Callback): void + once(event: 'BidIncreased', options: EventOptions, cb: Callback): void + + once(event: 'BidWithdrawn', cb: Callback): void + once(event: 'BidWithdrawn', options: EventOptions, cb: Callback): void + + once(event: 'BidAccepted', cb: Callback): void + once(event: 'BidAccepted', options: EventOptions, cb: Callback): void + + once(event: 'BidRejected', cb: Callback): void + once(event: 'BidRejected', options: EventOptions, cb: Callback): void + + once(event: 'BidderRefunded', cb: Callback): void + once(event: 'BidderRefunded', options: EventOptions, cb: Callback): void + + once(event: 'AuctionCancelled', cb: Callback): void + once(event: 'AuctionCancelled', options: EventOptions, cb: Callback): void + + once(event: 'AuctionEnabled', cb: Callback): void + once(event: 'AuctionEnabled', options: EventOptions, cb: Callback): void + + once(event: 'AuctionDisabled', cb: Callback): void + once(event: 'AuctionDisabled', options: EventOptions, cb: Callback): void + + once(event: 'Pause', cb: Callback): void + once(event: 'Pause', options: EventOptions, cb: Callback): void + + once(event: 'Unpause', cb: Callback): void + once(event: 'Unpause', options: EventOptions, cb: Callback): void + + once(event: 'RoleAdded', cb: Callback): void + once(event: 'RoleAdded', options: EventOptions, cb: Callback): void + + once(event: 'RoleRemoved', cb: Callback): void + once(event: 'RoleRemoved', options: EventOptions, cb: Callback): void + + once(event: 'OwnershipRenounced', cb: Callback): void + once(event: 'OwnershipRenounced', options: EventOptions, cb: Callback): void + + once(event: 'OwnershipTransferred', cb: Callback): void + once(event: 'OwnershipTransferred', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/CryptoArtAICANFTMarket.d.ts b/packages/web3-contracts/types/CryptoArtAICANFTMarket.d.ts new file mode 100644 index 000000000000..48d2101e718e --- /dev/null +++ b/packages/web3-contracts/types/CryptoArtAICANFTMarket.d.ts @@ -0,0 +1,319 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +export interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type AuctionAwardUpdated = ContractEventLog<{ + auctionId: string + bidder: string + award: string + 0: string + 1: string + 2: string +}> +export type MarketFeesUpdated = ContractEventLog<{ + caPoints: string + artistPoints: string + sellerPoints: string + auctionAwardPoints: string + sharePoints: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type ReserveAuctionBidPlaced = ContractEventLog<{ + auctionId: string + bidder: string + amount: string + endTime: string + 0: string + 1: string + 2: string + 3: string +}> +export type ReserveAuctionCanceled = ContractEventLog<{ + auctionId: string + 0: string +}> +export type ReserveAuctionCanceledByAdmin = ContractEventLog<{ + auctionId: string + reason: string + 0: string + 1: string +}> +export type ReserveAuctionConfigUpdated = ContractEventLog<{ + minPercentIncrementInBasisPoints: string + maxBidIncrementRequirement: string + duration: string + extensionDuration: string + goLiveDate: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type ReserveAuctionCreated = ContractEventLog<{ + seller: string + tokenId: string + auctionId: string + duration: string + extensionDuration: string + reservePrice: string + 0: string + 1: string + 2: string + 3: string + 4: string + 5: string +}> +export type ReserveAuctionFinalized = ContractEventLog<{ + auctionId: string + seller: string + bidder: string + tokenId: string + amount: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type ReserveAuctionSellerMigrated = ContractEventLog<{ + auctionId: string + originalSellerAddress: string + newSellerAddress: string + 0: string + 1: string + 2: string +}> +export type ReserveAuctionUpdated = ContractEventLog<{ + auctionId: string + reservePrice: string + 0: string + 1: string +}> +export type ShareAwardUpdated = ContractEventLog<{ + share: string + award: string + 0: string + 1: string +}> +export type WithdrawPending = ContractEventLog<{ + user: string + amount: string + 0: string + 1: string +}> +export type Withdrawal = ContractEventLog<{ + user: string + amount: string + 0: string + 1: string +}> + +export interface CryptoArtAICANFTMarket extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CryptoArtAICANFTMarket + clone(): CryptoArtAICANFTMarket + methods: { + accessControl(): NonPayableTransactionObject + + adminCancelReserveAuction(auctionId: number | string | BN, reason: string): NonPayableTransactionObject + + adminUpdateConfig( + minPercentIncrementInBasisPoints: number | string | BN, + duration: number | string | BN, + _caPoints: number | string | BN, + _artistPoints: number | string | BN, + _sellerPoints: number | string | BN, + _auctionAwardPoints: number | string | BN, + _sharePoints: number | string | BN, + ): NonPayableTransactionObject + + awards(arg0: string): NonPayableTransactionObject + + cancelReserveAuction(auctionId: number | string | BN): NonPayableTransactionObject + + createReserveAuction( + tokenId: number | string | BN, + seller: string, + reservePrice: number | string | BN, + ): NonPayableTransactionObject + + finalizeReserveAuction(auctionId: number | string | BN): NonPayableTransactionObject + + getArtist(tokenId: number | string | BN): NonPayableTransactionObject + + getCATreasury(): NonPayableTransactionObject + + getFeeConfig(): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + 3: string + 4: string + }> + + getFees( + tokenId: number | string | BN, + price: number | string | BN, + ): NonPayableTransactionObject<{ + caFee: string + artistFee: string + sellerFee: string + auctionFee: string + shareFee: string + 0: string + 1: string + 2: string + 3: string + 4: string + }> + + getIsPrimary(tokenId: number | string | BN): NonPayableTransactionObject + + getMinBidAmount(auctionId: number | string | BN): NonPayableTransactionObject + + getPendingWithdrawal(user: string): NonPayableTransactionObject + + getReserveAuction( + auctionId: number | string | BN, + ): NonPayableTransactionObject<[string, string, string, string, string, string, string, string]> + + getReserveAuctionConfig(): NonPayableTransactionObject<{ + minPercentIncrementInBasisPoints: string + duration: string + 0: string + 1: string + }> + + getReserveAuctionIdFor(tokenId: number | string | BN): NonPayableTransactionObject + + placeBid(auctionId: number | string | BN, shareUser: string): PayableTransactionObject + + setCATreasury(_treasury: string): NonPayableTransactionObject + + updateReserveAuction( + auctionId: number | string | BN, + reservePrice: number | string | BN, + ): NonPayableTransactionObject + + withdraw(): NonPayableTransactionObject + + withdrawFor(user: string): NonPayableTransactionObject + + withdrawFunds(to: string): NonPayableTransactionObject + + withdrawStuckEther(_withdrawalAccount: string): NonPayableTransactionObject + + withdrawThreshold(): NonPayableTransactionObject + } + events: { + AuctionAwardUpdated(cb?: Callback): EventEmitter + AuctionAwardUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + MarketFeesUpdated(cb?: Callback): EventEmitter + MarketFeesUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionBidPlaced(cb?: Callback): EventEmitter + ReserveAuctionBidPlaced(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionCanceled(cb?: Callback): EventEmitter + ReserveAuctionCanceled(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionCanceledByAdmin(cb?: Callback): EventEmitter + ReserveAuctionCanceledByAdmin( + options?: EventOptions, + cb?: Callback, + ): EventEmitter + + ReserveAuctionConfigUpdated(cb?: Callback): EventEmitter + ReserveAuctionConfigUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionCreated(cb?: Callback): EventEmitter + ReserveAuctionCreated(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionFinalized(cb?: Callback): EventEmitter + ReserveAuctionFinalized(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionSellerMigrated(cb?: Callback): EventEmitter + ReserveAuctionSellerMigrated(options?: EventOptions, cb?: Callback): EventEmitter + + ReserveAuctionUpdated(cb?: Callback): EventEmitter + ReserveAuctionUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + ShareAwardUpdated(cb?: Callback): EventEmitter + ShareAwardUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + WithdrawPending(cb?: Callback): EventEmitter + WithdrawPending(options?: EventOptions, cb?: Callback): EventEmitter + + Withdrawal(cb?: Callback): EventEmitter + Withdrawal(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'AuctionAwardUpdated', cb: Callback): void + once(event: 'AuctionAwardUpdated', options: EventOptions, cb: Callback): void + + once(event: 'MarketFeesUpdated', cb: Callback): void + once(event: 'MarketFeesUpdated', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionBidPlaced', cb: Callback): void + once(event: 'ReserveAuctionBidPlaced', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionCanceled', cb: Callback): void + once(event: 'ReserveAuctionCanceled', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionCanceledByAdmin', cb: Callback): void + once( + event: 'ReserveAuctionCanceledByAdmin', + options: EventOptions, + cb: Callback, + ): void + + once(event: 'ReserveAuctionConfigUpdated', cb: Callback): void + once(event: 'ReserveAuctionConfigUpdated', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionCreated', cb: Callback): void + once(event: 'ReserveAuctionCreated', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionFinalized', cb: Callback): void + once(event: 'ReserveAuctionFinalized', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionSellerMigrated', cb: Callback): void + once(event: 'ReserveAuctionSellerMigrated', options: EventOptions, cb: Callback): void + + once(event: 'ReserveAuctionUpdated', cb: Callback): void + once(event: 'ReserveAuctionUpdated', options: EventOptions, cb: Callback): void + + once(event: 'ShareAwardUpdated', cb: Callback): void + once(event: 'ShareAwardUpdated', options: EventOptions, cb: Callback): void + + once(event: 'WithdrawPending', cb: Callback): void + once(event: 'WithdrawPending', options: EventOptions, cb: Callback): void + + once(event: 'Withdrawal', cb: Callback): void + once(event: 'Withdrawal', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/CryptoArtAIKnownOriginDigitalAssetV2.d.ts b/packages/web3-contracts/types/CryptoArtAIKnownOriginDigitalAssetV2.d.ts new file mode 100644 index 000000000000..14e1422c0fc4 --- /dev/null +++ b/packages/web3-contracts/types/CryptoArtAIKnownOriginDigitalAssetV2.d.ts @@ -0,0 +1,492 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +export interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type Purchase = ContractEventLog<{ + _tokenId: string + _editionNumber: string + _buyer: string + _priceInWei: string + 0: string + 1: string + 2: string + 3: string +}> +export type Minted = ContractEventLog<{ + _tokenId: string + _editionNumber: string + _buyer: string + 0: string + 1: string + 2: string +}> +export type EditionCreated = ContractEventLog<{ + _editionNumber: string + _editionData: string + _editionType: string + 0: string + 1: string + 2: string +}> +export type Pause = ContractEventLog<{}> +export type Unpause = ContractEventLog<{}> +export type OwnershipRenounced = ContractEventLog<{ + previousOwner: string + 0: string +}> +export type OwnershipTransferred = ContractEventLog<{ + previousOwner: string + newOwner: string + 0: string + 1: string +}> +export type RoleAdded = ContractEventLog<{ + operator: string + role: string + 0: string + 1: string +}> +export type RoleRemoved = ContractEventLog<{ + operator: string + role: string + 0: string + 1: string +}> +export type Transfer = ContractEventLog<{ + _from: string + _to: string + _tokenId: string + 0: string + 1: string + 2: string +}> +export type Approval = ContractEventLog<{ + _owner: string + _approved: string + _tokenId: string + 0: string + 1: string + 2: string +}> +export type ApprovalForAll = ContractEventLog<{ + _owner: string + _operator: string + _approved: boolean + 0: string + 1: string + 2: boolean +}> + +export interface CryptoArtAIKnownOriginDigitalAssetV2 extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CryptoArtAIKnownOriginDigitalAssetV2 + clone(): CryptoArtAIKnownOriginDigitalAssetV2 + methods: { + supportsInterface(_interfaceId: string | number[]): NonPayableTransactionObject + + updateActive(_editionNumber: number | string | BN, _active: boolean): NonPayableTransactionObject + + name(): NonPayableTransactionObject + + getApproved(_tokenId: number | string | BN): NonPayableTransactionObject + + approve(_to: string, _tokenId: number | string | BN): NonPayableTransactionObject + + priceInWeiToken(_tokenId: number | string | BN): NonPayableTransactionObject + + setTokenURI(_tokenId: number | string | BN, _uri: string): NonPayableTransactionObject + + totalSupply(): NonPayableTransactionObject + + updateKoCommissionAccount(_koCommissionAccount: string): NonPayableTransactionObject + + InterfaceId_ERC165(): NonPayableTransactionObject + + editionData(_editionNumber: number | string | BN): NonPayableTransactionObject + + updateTokenBaseURI(_newBaseURI: string): NonPayableTransactionObject + + checkRole(_operator: string, _role: number | string | BN): NonPayableTransactionObject + + transferFrom(_from: string, _to: string, _tokenId: number | string | BN): NonPayableTransactionObject + + totalPurchaseValueInWei(): NonPayableTransactionObject + + tokenOfOwnerByIndex(_owner: string, _index: number | string | BN): NonPayableTransactionObject + + updateStartDate( + _editionNumber: number | string | BN, + _startDate: number | string | BN, + ): NonPayableTransactionObject + + artistCommission(_editionNumber: number | string | BN): NonPayableTransactionObject<{ + _artistAccount: string + _artistCommission: string + 0: string + 1: string + }> + + tokenURIEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + unpause(): NonPayableTransactionObject + + mint(_to: string, _editionNumber: number | string | BN): NonPayableTransactionObject + + 'safeTransferFrom(address,address,uint256)'( + _from: string, + _to: string, + _tokenId: number | string | BN, + ): NonPayableTransactionObject + + 'safeTransferFrom(address,address,uint256,bytes)'( + _from: string, + _to: string, + _tokenId: number | string | BN, + _data: string | number[], + ): NonPayableTransactionObject + + burn(_tokenId: number | string | BN): NonPayableTransactionObject + + totalNumberAvailable(): NonPayableTransactionObject + + addAddressToAccessControl(_operator: string, _role: number | string | BN): NonPayableTransactionObject + + priceInWeiEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + tokenBaseURI(): NonPayableTransactionObject + + exists(_tokenId: number | string | BN): NonPayableTransactionObject + + tokenByIndex(_index: number | string | BN): NonPayableTransactionObject + + updateArtistCommission( + _editionNumber: number | string | BN, + _rate: number | string | BN, + ): NonPayableTransactionObject + + editionType(_editionNumber: number | string | BN): NonPayableTransactionObject + + tokensOf(_owner: string): NonPayableTransactionObject + + paused(): NonPayableTransactionObject + + ownerOf(_tokenId: number | string | BN): NonPayableTransactionObject + + purchaseDatesEdition(_editionNumber: number | string | BN): NonPayableTransactionObject<{ + _startDate: string + _endDate: string + 0: string + 1: string + }> + + artistsEditions(_artistsAccount: string): NonPayableTransactionObject + + totalAvailableEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + koCommissionAccount(): NonPayableTransactionObject + + balanceOf(_owner: string): NonPayableTransactionObject + + renounceOwnership(): NonPayableTransactionObject + + detailsOfEdition(editionNumber: number | string | BN): NonPayableTransactionObject<{ + _editionData: string + _editionType: string + _startDate: string + _endDate: string + _artistAccount: string + _artistCommission: string + _priceInWei: string + _tokenURI: string + _totalSupply: string + _totalAvailable: string + _active: boolean + 0: string + 1: string + 2: string + 3: string + 4: string + 5: string + 6: string + 7: string + 8: string + 9: string + 10: boolean + }> + + updateEditionTokenURI(_editionNumber: number | string | BN, _uri: string): NonPayableTransactionObject + + tokensOfEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + underMint(_to: string, _editionNumber: number | string | BN): NonPayableTransactionObject + + updatePriceInWei( + _editionNumber: number | string | BN, + _priceInWei: number | string | BN, + ): NonPayableTransactionObject + + editionOfTokenId(_tokenId: number | string | BN): NonPayableTransactionObject + + pause(): NonPayableTransactionObject + + purchaseTo(_to: string, _editionNumber: number | string | BN): PayableTransactionObject + + createActiveEdition( + _editionNumber: number | string | BN, + _editionData: string | number[], + _editionType: number | string | BN, + _startDate: number | string | BN, + _endDate: number | string | BN, + _artistAccount: string, + _artistCommission: number | string | BN, + _priceInWei: number | string | BN, + _tokenURI: string, + _totalAvailable: number | string | BN, + ): NonPayableTransactionObject + + owner(): NonPayableTransactionObject + + ROLE_MINTER(): NonPayableTransactionObject + + hasRole(_operator: string, _role: number | string | BN): NonPayableTransactionObject + + symbol(): NonPayableTransactionObject + + removeAddressFromAccessControl( + _operator: string, + _role: number | string | BN, + ): NonPayableTransactionObject + + updateOptionalCommission( + _editionNumber: number | string | BN, + _rate: number | string | BN, + _recipient: string, + ): NonPayableTransactionObject + + ROLE_UNDER_MINTER(): NonPayableTransactionObject + + createInactivePreMintedEdition( + _editionNumber: number | string | BN, + _editionData: string | number[], + _editionType: number | string | BN, + _startDate: number | string | BN, + _endDate: number | string | BN, + _artistAccount: string, + _artistCommission: number | string | BN, + _priceInWei: number | string | BN, + _tokenURI: string, + _totalSupply: number | string | BN, + _totalAvailable: number | string | BN, + ): NonPayableTransactionObject + + reclaimEther(): NonPayableTransactionObject + + setApprovalForAll(_to: string, _approved: boolean): NonPayableTransactionObject + + highestEditionNumber(): NonPayableTransactionObject + + batchTransfer(_to: string, _tokenIds: (number | string | BN)[]): NonPayableTransactionObject + + createActivePreMintedEdition( + _editionNumber: number | string | BN, + _editionData: string | number[], + _editionType: number | string | BN, + _startDate: number | string | BN, + _endDate: number | string | BN, + _artistAccount: string, + _artistCommission: number | string | BN, + _priceInWei: number | string | BN, + _tokenURI: string, + _totalSupply: number | string | BN, + _totalAvailable: number | string | BN, + ): NonPayableTransactionObject + + updateArtistsAccount( + _editionNumber: number | string | BN, + _artistAccount: string, + ): NonPayableTransactionObject + + tokenData(_tokenId: number | string | BN): NonPayableTransactionObject<{ + _editionNumber: string + _editionType: string + _editionData: string + _tokenURI: string + _owner: string + 0: string + 1: string + 2: string + 3: string + 4: string + }> + + totalSupplyEdition(_editionNumber: number | string | BN): NonPayableTransactionObject + + purchaseDatesToken(_tokenId: number | string | BN): NonPayableTransactionObject<{ + _startDate: string + _endDate: string + 0: string + 1: string + }> + + editionActive(_editionNumber: number | string | BN): NonPayableTransactionObject + + totalRemaining(_editionNumber: number | string | BN): NonPayableTransactionObject + + updateTotalAvailable( + _editionNumber: number | string | BN, + _totalAvailable: number | string | BN, + ): NonPayableTransactionObject + + ROLE_KNOWN_ORIGIN(): NonPayableTransactionObject + + editionExists(_editionNumber: number | string | BN): NonPayableTransactionObject + + tokenURI(_tokenId: number | string | BN): NonPayableTransactionObject + + updateEditionType( + _editionNumber: number | string | BN, + _editionType: number | string | BN, + ): NonPayableTransactionObject + + editionOptionalCommission(_editionNumber: number | string | BN): NonPayableTransactionObject<{ + _rate: string + _recipient: string + 0: string + 1: string + }> + + updateEndDate( + _editionNumber: number | string | BN, + _endDate: number | string | BN, + ): NonPayableTransactionObject + + createInactiveEdition( + _editionNumber: number | string | BN, + _editionData: string | number[], + _editionType: number | string | BN, + _startDate: number | string | BN, + _endDate: number | string | BN, + _artistAccount: string, + _artistCommission: number | string | BN, + _priceInWei: number | string | BN, + _tokenURI: string, + _totalAvailable: number | string | BN, + ): NonPayableTransactionObject + + editionsOfType(_type: number | string | BN): NonPayableTransactionObject + + isApprovedForAll(_owner: string, _operator: string): NonPayableTransactionObject + + purchase(_editionNumber: number | string | BN): PayableTransactionObject + + totalNumberMinted(): NonPayableTransactionObject + + transferOwnership(_newOwner: string): NonPayableTransactionObject + + batchTransferFrom( + _from: string, + _to: string, + _tokenIds: (number | string | BN)[], + ): NonPayableTransactionObject + + updateTotalSupply( + _editionNumber: number | string | BN, + _totalSupply: number | string | BN, + ): NonPayableTransactionObject + + tokenURISafe(_tokenId: number | string | BN): NonPayableTransactionObject + } + events: { + Purchase(cb?: Callback): EventEmitter + Purchase(options?: EventOptions, cb?: Callback): EventEmitter + + Minted(cb?: Callback): EventEmitter + Minted(options?: EventOptions, cb?: Callback): EventEmitter + + EditionCreated(cb?: Callback): EventEmitter + EditionCreated(options?: EventOptions, cb?: Callback): EventEmitter + + Pause(cb?: Callback): EventEmitter + Pause(options?: EventOptions, cb?: Callback): EventEmitter + + Unpause(cb?: Callback): EventEmitter + Unpause(options?: EventOptions, cb?: Callback): EventEmitter + + OwnershipRenounced(cb?: Callback): EventEmitter + OwnershipRenounced(options?: EventOptions, cb?: Callback): EventEmitter + + OwnershipTransferred(cb?: Callback): EventEmitter + OwnershipTransferred(options?: EventOptions, cb?: Callback): EventEmitter + + RoleAdded(cb?: Callback): EventEmitter + RoleAdded(options?: EventOptions, cb?: Callback): EventEmitter + + RoleRemoved(cb?: Callback): EventEmitter + RoleRemoved(options?: EventOptions, cb?: Callback): EventEmitter + + Transfer(cb?: Callback): EventEmitter + Transfer(options?: EventOptions, cb?: Callback): EventEmitter + + Approval(cb?: Callback): EventEmitter + Approval(options?: EventOptions, cb?: Callback): EventEmitter + + ApprovalForAll(cb?: Callback): EventEmitter + ApprovalForAll(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'Purchase', cb: Callback): void + once(event: 'Purchase', options: EventOptions, cb: Callback): void + + once(event: 'Minted', cb: Callback): void + once(event: 'Minted', options: EventOptions, cb: Callback): void + + once(event: 'EditionCreated', cb: Callback): void + once(event: 'EditionCreated', options: EventOptions, cb: Callback): void + + once(event: 'Pause', cb: Callback): void + once(event: 'Pause', options: EventOptions, cb: Callback): void + + once(event: 'Unpause', cb: Callback): void + once(event: 'Unpause', options: EventOptions, cb: Callback): void + + once(event: 'OwnershipRenounced', cb: Callback): void + once(event: 'OwnershipRenounced', options: EventOptions, cb: Callback): void + + once(event: 'OwnershipTransferred', cb: Callback): void + once(event: 'OwnershipTransferred', options: EventOptions, cb: Callback): void + + once(event: 'RoleAdded', cb: Callback): void + once(event: 'RoleAdded', options: EventOptions, cb: Callback): void + + once(event: 'RoleRemoved', cb: Callback): void + once(event: 'RoleRemoved', options: EventOptions, cb: Callback): void + + once(event: 'Transfer', cb: Callback): void + once(event: 'Transfer', options: EventOptions, cb: Callback): void + + once(event: 'Approval', cb: Callback): void + once(event: 'Approval', options: EventOptions, cb: Callback): void + + once(event: 'ApprovalForAll', cb: Callback): void + once(event: 'ApprovalForAll', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-shared/evm/constants/index.ts b/packages/web3-shared/evm/constants/index.ts index ebad208cc9ff..92b561b71db9 100644 --- a/packages/web3-shared/evm/constants/index.ts +++ b/packages/web3-shared/evm/constants/index.ts @@ -16,6 +16,7 @@ import GoodGhosting from '@masknet/web3-constants/evm/good-ghosting.json' import SpaceStationGalaxy from '@masknet/web3-constants/evm/space-station-galaxy.json' import OpenseaAPI from '@masknet/web3-constants/evm/opensea-api.json' import Chain from '@masknet/web3-constants/evm/chain.json' +import CryptoArtAI from '@masknet/web3-constants/evm/cryptoartai.json' import { hookTransform, transform, transformFromJSON } from './utils' export { ZERO_ADDRESS, FAKE_SIGN_PASSWORD, EthereumNameType } from './specific' @@ -75,5 +76,8 @@ export const useOpenseaAPIConstants = hookTransform(getOpenseaAPIConstants) export const getChainConstants = transform(Chain) export const useChainConstants = hookTransform(getChainConstants) +export const getCryptoArtAIConstants = transform(CryptoArtAI) +export const useCryptoArtAIConstants = hookTransform(getCryptoArtAIConstants) + export const getNftRedPacketConstants = transform(NftRedPacket) export const useNftRedPacketConstants = hookTransform(getNftRedPacketConstants)