diff --git a/.cache-video/videos/3d_toys_playground-5a319b2b041635649dbefd017a5619f5-cd2d2d1c8620b4b9bf8529b5962aa8f4-h264.mp4 b/.cache-video/videos/3d_toys_playground-5a319b2b041635649dbefd017a5619f5-cd2d2d1c8620b4b9bf8529b5962aa8f4-h264.mp4 deleted file mode 100644 index 90c8d8b..0000000 Binary files a/.cache-video/videos/3d_toys_playground-5a319b2b041635649dbefd017a5619f5-cd2d2d1c8620b4b9bf8529b5962aa8f4-h264.mp4 and /dev/null differ diff --git a/.cache-video/videos/pexels-olya-kobruseva-5236593-4371a36bd10c54527439c433f6cdab63-cd2d2d1c8620b4b9bf8529b5962aa8f4-h264.mp4 b/.cache-video/videos/pexels-olya-kobruseva-5236593-4371a36bd10c54527439c433f6cdab63-cd2d2d1c8620b4b9bf8529b5962aa8f4-h264.mp4 deleted file mode 100644 index 00766b9..0000000 Binary files a/.cache-video/videos/pexels-olya-kobruseva-5236593-4371a36bd10c54527439c433f6cdab63-cd2d2d1c8620b4b9bf8529b5962aa8f4-h264.mp4 and /dev/null differ diff --git a/.gitignore b/.gitignore index 4ff78fd..7166d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ typings/ # gatsby files .cache/ public +.bin/ # Mac files .DS_Store @@ -72,4 +73,9 @@ yarn-error.log graphql-types.ts # Auto-generated by gatsby-plugin-extract-schema -schema.graphql \ No newline at end of file +schema.graphql + +#No need to track +stale-data-from-build-time.json +yarn.lock +package-lock.json \ No newline at end of file diff --git a/config/i18n/en.json b/config/i18n/en.json index 03216fa..24c4e2c 100644 --- a/config/i18n/en.json +++ b/config/i18n/en.json @@ -1,29 +1,31 @@ { "viewIn": "View in English", "langPicker": "English", - "title": "Cool NFT Project", - "description": "This is the minting page for Cool NFT Project", + "title": "Cheddar PowerUp 5555", + "description": "PowerUp DEFI with the Cheddy PowerUp NFT.", "calendarEvent": "Go Mint an NFT!", "connectWallet": "Login with NEAR", "signOut": "Sign Out", "new": "New!", "myNFTs": "My NFTs", + "myNFTsDesc": "Click the image or # below to view full version.", "nextNFT": "Next NFT", "prevNFT": "Previous NFT", "close": "Close", "zoomIn": "Zoom In", "zoomOut": "Zoom Out", "hero": { - "video": "3d_toys_playground.mp4", + "image": "Cheddar-Power-Up-Preview.gif", "title": "NFTs drop at SALE_START!", - "body": "Tagline goes here.", - "ps": "Want early access? Sign in.", + "body": "PowerUp DEFI with Cheddy!", + "ps": "Have a White List spot Login. PUBLIC Sale not started.", "remaining": "NFTs remaining: REMAINING_COUNT", "cta": "Add to Calendar", + "ctaCheddar": "Add to Calendar", "action": "ADD_TO_CALENDAR(SALE_START)", "saleClosed": { "signedIn": { - "ps": "Pre-mint start: PRESALE_START\n\nJoin the whitelist! [Join our Discord](https://discord.com/invite/UY9Xf2k) and request an invite." + "ps": "Pre-mint start: PRESALE_START\n\nJoin the whitelist! [Join our Discord](https://discord.com/invite/XVBxDBqP2v) and request an invite." }, "vip": { "title": "Welcome, CURRENT_USER!", @@ -36,16 +38,18 @@ "title": "Pre-mint started!", "body": "Public minting starts at SALE_START", "ps": "Your remaining pre-mint allowance: MINT_LIMIT", - "setNumber": "Number to mint", + "setNumber": "LIMIT 1 PER USER", "cta": "Mint for MINT_PRICE", + "ctaCheddar": "Mint for MINT_CHEDDAR_PRICE", "action": "MINT" } }, "saleOpen": { - "title": "Minting has begun!", + "title": "MINT is ON! Save 30% with $Cheddar", "ps": "", - "setNumber": "Number to mint", + "setNumber": "LIMIT 1 PER USER", "cta": "Mint for MINT_PRICE", + "ctaCheddar": "Mint for MINT_CHEDDAR_PRICE", "action": "MINT", "signedOut": { "action": "SIGN_IN" @@ -56,14 +60,15 @@ "body": "The NFTs have all been created", "ps": "", "cta": "Buy on Marketplace", + "ctaCheddar": "Mint for MINT_CHEDDAR_PRICE", "action": "GO_TO_PARAS" } }, "extraSections": [ { "className": "this-class-is-set-in-i18n-files", - "text": "# Introducing Cool NFT Project\n\nThis is a longer description of the project. About a paragraph long. Some [filler text](https://placehodler.shapelabs.co/) to demonstrate: Token standard surrendered some burned mnemonic phrase until some wallet because blockchain detected many pre-mine. It based on many automated token generation event, and when Tether formed some trustless in the FUD, Dogecoin slept on lots of anti-money laundering of many stale block!\n\nSolidity limited lots of reinvested distributed denial of service attack! ICO specialises in lots of lightning fast private chain since Zilliqa surrendered few reinvested cryptocurrency, however, because someone limited few provably fiat until the vanity address, Augur stuck many burned pre-mine. They sharded many technical analysis, or NFT specialises in the FOMO in few wash trade.", - "image": "example.png" + "text": "The Cheddar PowerUp ⚡️  featuring Cheddy Cheezy!\nBOOST your DEFI experience on Cheddar and beyond!\n\n▶️ 24 Hour Whitelist PreSale\n\n▶️ Limit 5 per user\n\n▶️ Escalating Price after GEN 0, +1 NEAR after every 100 Sold\n\n▶️ Stake & Boost Farm Yields\n\n▶️ 5 Cheddy 1/1's included in 5555", + "image": "1of1.png" } - ] + ] } \ No newline at end of file diff --git a/config/i18n/es.json b/config/i18n/es.json deleted file mode 100644 index 852f0a4..0000000 --- a/config/i18n/es.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "viewIn": "Ver en Español", - "langPicker": "Español", - "title": "Cool NFT Project", - "description": "Los primeros NFTs de tipo \"PFP\" de NEAR", - "calendarEvent": "¡Crear un NFT!", - "connectWallet": "Iniciar Sesión con NEAR", - "signOut": "Desconectar", - "new": "¡Nuevo!", - "myNFTs": "Mi NFTs", - "nextNFT": "Siguiente NFT", - "prevNFT": "Anterior NFT", - "close": "Cerrar", - "zoomIn": "Dar un golpe de zoom", - "zoomOut": "Disminuir el zoom", - "hero": { - "video": "3d_toys_playground.mp4", - "title": "El Eslogan Va Aquí", - "body": "Una descripción de una línea va aquí.", - "ps": "¡Puedes crear tu primero a las SALE_START!", - "remaining": "NFTs que quedan: REMAINING_COUNT", - "cta": "Añadir a Calendario", - "action": "ADD_TO_CALENDAR(SALE_START)", - "saleClosed": { - "signedIn": { - "ps": "* Crear tu primero: SALE_START\n\n* Si estás en el listo \"VIP\": PRESALE_START\n\nQuedate un/a VIP! [Joino nuestro Discord](https://discord.com/invite/UY9Xf2k)." - }, - "vip": { - "title": "¡Bienvenid@, CURRENT_USER!", - "ps": "Puedes crear un NFT a las PRESALE_START", - "action": "ADD_TO_CALENDAR(PRESALE_START)" - } - }, - "presale": { - "vip": { - "title": "La creación temprano ha comenzado!", - "ps": "El creación publico empezar a las SALE_START.\n\nTu VIP asignación restante: MINT_LIMIT", - "setNumber": "Crear quantidad de", - "cta": "Crear para MINT_PRICE", - "action": "MINT" - } - }, - "saleOpen": { - "title": "Minting has begun!", - "ps": "", - "setNumber": "Crear quantidad de", - "cta": "Crear para MINT_PRICE", - "action": "MINT", - "signedOut": { - "action": "SIGN_IN" - } - }, - "allSold": { - "title": "¡Todos INITIAL_COUNT han estado creado!", - "body": "", - "ps": "", - "cta": "Compra en el Mercado", - "action": "GO_TO_PARAS" - } - }, - "extraSections": [ - { - "className": "this-class-is-set-in-i18n-files", - "text": "# Introducing Cool NFT Project\n\nThis is a longer description of the project. About a paragraph long. Some [filler text](https://placehodler.shapelabs.co/) to demonstrate: Token standard surrendered some burned mnemonic phrase until some wallet because blockchain detected many pre-mine. It based on many automated token generation event, and when Tether formed some trustless in the FUD, Dogecoin slept on lots of anti-money laundering of many stale block!\n\nSolidity limited lots of reinvested distributed denial of service attack! ICO specialises in lots of lightning fast private chain since Zilliqa surrendered few reinvested cryptocurrency, however, because someone limited few provably fiat until the vanity address, Augur stuck many burned pre-mine. They sharded many technical analysis, or NFT specialises in the FOMO in few wash trade.", - "image": "example.png" - } - ] -} \ No newline at end of file diff --git a/config/i18n/zh.json b/config/i18n/zh.json deleted file mode 100644 index b1ae6f2..0000000 --- a/config/i18n/zh.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "viewIn": "中文查看", - "langPicker": "中文", - "title": "酷NFT项目", - "description": "NEAR生态上首个头像类NFT", - "calendarEvent": "立即铸造!", - "connectWallet": "使用 NEAR 登录", - "signOut": "登出", - "new": "新的!", - "myNFTs": "我的NFT", - "nextNFT": "下一个NFT", - "prevNFT": "上一个NFT", - "close": "关闭", - "zoomIn": "放大", - "zoomOut": "缩小", - "hero": { - "video": "3d_toys_playground.mp4", - "title": "标语在这里", - "body": "一行描述在这里", - "ps": "首发日期 SALE_START!", - "remaining": "剩余NFT:REMAINING_COUNT", - "cta": "添加到日历", - "action": "ADD_TO_CALENDAR(SALE_START)", - "saleClosed": { - "signedIn": { - "ps": "* 首发单价: SALE_START\n\n* 预售单价: PRESALE_START\n\n加入预售! [加入社区 Discord](https://discord.com/invite/UY9Xf2k) 参与白名单活动" - }, - "vip": { - "title": "欢迎, CURRENT_USER!", - "ps": "预售单价: PRESALE_START", - "action": "ADD_TO_CALENDAR(PRESALE_START)" - } - }, - "presale": { - "vip": { - "title": "早期创作已经开始", - "ps": "公开销售时间为 SALE_START.\n\n 剩余购买额度: MINT_LIMIT", - "setNumber": "购买数量", - "cta": "支付金额: MINT_PRICE", - "action": "MINT" - } - }, - "saleOpen": { - "title": "铸币开始了!", - "ps": "", - "setNumber": "购买数量", - "cta": "支付金额: MINT_PRICE", - "action": "MINT", - "signedOut": { - "action": "SIGN_IN" - } - }, - "allSold": { - "title": "All INITIAL_COUNT 售罄!", - "body": "The NFTs 已经全部售罄", - "ps": "", - "cta": "在市场上购买", - "action": "GO_TO_PARAS" - } - }, - "extraSections": [ - { - "className": "this-class-is-set-in-i18n-files", - "text": "# Introducing Cool NFT Project\n\nThis is a longer description of the project. About a paragraph long. Some [filler text](https://placehodler.shapelabs.co/) to demonstrate: Token standard surrendered some burned mnemonic phrase until some wallet because blockchain detected many pre-mine. It based on many automated token generation event, and when Tether formed some trustless in the FUD, Dogecoin slept on lots of anti-money laundering of many stale block!\n\nSolidity limited lots of reinvested distributed denial of service attack! ICO specialises in lots of lightning fast private chain since Zilliqa surrendered few reinvested cryptocurrency, however, because someone limited few provably fiat until the vanity address, Augur stuck many burned pre-mine. They sharded many technical analysis, or NFT specialises in the FOMO in few wash trade.", - "image": "example.png" - } - ] -} \ No newline at end of file diff --git a/config/images/1of1.png b/config/images/1of1.png new file mode 100644 index 0000000..021df7e Binary files /dev/null and b/config/images/1of1.png differ diff --git a/config/images/Cheddar-Power-Up-Preview.gif b/config/images/Cheddar-Power-Up-Preview.gif new file mode 100644 index 0000000..32bf528 Binary files /dev/null and b/config/images/Cheddar-Power-Up-Preview.gif differ diff --git a/config/images/cheddy-new-logo.jpg b/config/images/cheddy-new-logo.jpg new file mode 100644 index 0000000..a247afb Binary files /dev/null and b/config/images/cheddy-new-logo.jpg differ diff --git a/config/images/favicon.png b/config/images/favicon.png index 62b6b55..a5d477d 100644 Binary files a/config/images/favicon.png and b/config/images/favicon.png differ diff --git a/config/settings.json b/config/settings.json index ece8b06..bf45e66 100644 --- a/config/settings.json +++ b/config/settings.json @@ -1,15 +1,17 @@ { - "author": "@TenKBay", - "siteUrl": "https://tenkbay.com", - "contractName": "v2.tenk.testnet", + "author": "@CheddarFi", + "siteUrl": "https://cheddar.farm", + "contractName": "nft.cheddar.near", + "image": "cheddy-new-logo.jpg", + "ftcontractName": "token.cheddar.near", "social": [ { - "href": "https://discord.com/invite/UY9Xf2k", + "href": "https://discord.com/invite/XVBxDBqP2v", "img": "discord.svg", "alt": "Discord" }, { - "href": "https://twitter.com/TenKBay", + "href": "https://twitter.com/CheddarFi", "img": "twitter.svg", "alt": "Twitter" } diff --git a/config/styles.scss b/config/styles.scss index 5166fbf..f96bff7 100644 --- a/config/styles.scss +++ b/config/styles.scss @@ -4,7 +4,7 @@ */ $white: #fdfdfd; $black: #262626; -$accent: #e73b93; +$accent: #FFD60B; /** * You can add any other styles below diff --git a/lib/locales/Locale.ts b/lib/locales/Locale.ts index 018541a..8c2a3e1 100644 --- a/lib/locales/Locale.ts +++ b/lib/locales/Locale.ts @@ -17,6 +17,7 @@ export const requiredHeroFields = [ 'title', 'body', 'cta', + 'ctaCheddar', 'action', 'remaining', ] as const diff --git a/lib/locales/Locale.validator.ts b/lib/locales/Locale.validator.ts index 8bc1bb5..5c3740c 100644 --- a/lib/locales/Locale.validator.ts +++ b/lib/locales/Locale.validator.ts @@ -41,6 +41,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -60,6 +64,7 @@ export const SCHEMA = { "action", "body", "cta", + "ctaCheddar", "remaining", "title" ] @@ -87,6 +92,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -137,6 +146,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -187,6 +200,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -234,6 +251,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -287,6 +308,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -337,6 +362,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -387,6 +416,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -434,6 +467,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -487,6 +524,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -537,6 +578,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -587,6 +632,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -634,6 +683,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -687,6 +740,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -737,6 +794,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -787,6 +848,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -834,6 +899,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ @@ -880,6 +949,10 @@ export const SCHEMA = { "type": "string", "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" }, + "ctaCheddar": { + "type": "string", + "description": "Commonmark-formatted markdown. @see https://remarkjs.github.io/react-markdown/" + }, "action": { "type": "string", "enum": [ diff --git a/lib/locales/runtimeUtils.ts b/lib/locales/runtimeUtils.ts index 896d6b9..2d00ec8 100644 --- a/lib/locales/runtimeUtils.ts +++ b/lib/locales/runtimeUtils.ts @@ -1,13 +1,38 @@ -import { Gas, NEAR } from 'near-units' -import { atcb_action as addToCalendar } from 'add-to-calendar-button' -import settings from '../../config/settings.json' -import { signIn } from '../../src/near' -import { TenK } from '../../src/near/contracts' +import { baseDecode } from "borsh" +import BN from "bn.js" +import { + connect, + Contract, + keyStores, + Near, + WalletConnection, + ConnectedWalletAccount, + RequestSignTransactionsOptions, + utils, +} from "near-api-js" +import { + Action, + createTransaction, + functionCall, + Transaction, +} from "near-api-js/lib/transaction" +import { PublicKey } from "near-api-js/lib/utils" + +import { Gas, NEAR } from "near-units" +import { atcb_action as addToCalendar } from "add-to-calendar-button" +import settings from "../../config/settings.json" +import { signIn, wallet, near } from "../../src/near" +import { TenK } from "../../src/near/contracts" +import { FT } from "../../src/near/contracts" import { TenkData } from "../../src/hooks/useTenk" -import { saleStatuses, userStatuses } from './Locale' -import { Locale } from '../../src/hooks/useLocales' +import { saleStatuses, userStatuses } from "./Locale" +import { Locale } from "../../src/hooks/useLocales" type Timestamp = number +let nearWebWalletConnection: WalletConnection +let nearConnectedWalletAccount: ConnectedWalletAccount +let requestSignTransOptions: RequestSignTransactionsOptions +let present_account_id = wallet.account().accountId type Data = TenkData & { currentUser: string @@ -17,32 +42,99 @@ type Data = TenkData & { userStatus: typeof userStatuses[number] } +async function setupTransaction({ + receiverId, + actions, + nonceOffset = 1, +}: { + receiverId: string + actions: Action[] + nonceOffset?: number +}) { + const localKey = + await nearConnectedWalletAccount.connection.signer.getPublicKey( + nearConnectedWalletAccount.accountId, + nearConnectedWalletAccount.connection.networkId + ) + let accessKey = await nearConnectedWalletAccount.accessKeyForTransaction( + receiverId, + actions, + localKey + ) + if (!accessKey) { + throw new Error( + `Cannot find matching key for transaction sent to ${receiverId}` + ) + } + + const block = await nearConnectedWalletAccount.connection.provider.block({ + finality: "final", + }) + const blockHash = baseDecode(block.header.hash) + + const publicKey = PublicKey.from(accessKey.public_key) + const nonce = accessKey.access_key.nonce + nonceOffset + + return createTransaction( + nearConnectedWalletAccount.accountId, + publicKey, + receiverId, + nonce, + actions, + blockHash + ) +} + function formatNumber( num: number | string, /** * `undefined` will default to browser's locale (may not work correctly in Node during build) */ - locale?: string, + locale?: string ) { - return new Intl.NumberFormat(locale, { maximumSignificantDigits: 3, }).format(Number(num)) } +function formatRemainingNumber( + num: number | string, + + /** + * `undefined` will default to browser's locale (may not work correctly in Node during build) + */ + locale?: string +) { + return new Intl.NumberFormat(locale, { + maximumSignificantDigits: 4, + }).format(Number(num)) +} + function formatCurrency( num: number | string, - currency: string = 'NEAR', + currency: string = "NEAR *", /** * `undefined` will default to browser's locale (may not work correctly in Node during build) */ - locale?: string, + locale?: string ) { return `${formatNumber(num, locale)} ${currency}` } +function formatCheddar( + num: number | string, + currency: string = "CHEDDAR *", + + /** + * `undefined` will default to browser's locale (may not work correctly in Node during build) + */ + locale?: string +) { + return `${formatNumber(num.replace(/\,/g, ""), locale)} ${currency}` +} + function formatDate( d: Timestamp | Date, @@ -54,9 +146,9 @@ function formatDate( ): string { const date = typeof d === "number" ? new Date(d) : d - return new Intl.DateTimeFormat(locale, { - dateStyle: 'short', - timeStyle: 'short', + return new Intl.DateTimeFormat(locale, { + dateStyle: "short", + timeStyle: "short", ...options, }).format(date) } @@ -66,32 +158,44 @@ const replacers = { PRESALE_START: (d: Data) => formatDate(d.saleInfo.presale_start), SALE_START: (d: Data) => formatDate(d.saleInfo.sale_start), MINT_LIMIT: (d: Data) => d.remainingAllowance ?? 0, - MINT_PRICE: (d: Data) => formatCurrency( - NEAR.from(d.saleInfo.price).mul(NEAR.from('' + (d.numberToMint ?? 1))).toHuman().split(' ')[0] - ), + MINT_PRICE: (d: Data) => + formatCurrency( + NEAR.from(d.saleInfo.price) + .mul(NEAR.from("" + (d.numberToMint ?? 1))) + .toHuman() + .split(" ")[0] + ), + MINT_CHEDDAR_PRICE: (d: Data) => + formatCheddar( + NEAR.from(d.totalCost) + .mul(NEAR.from("" + (d.numberToMint ?? 1))) + .toHuman() + .split(" ")[0] + ), + MINT_CHED: (d: Data) => {}, MINT_RATE_LIMIT: (d: Data) => d.mintRateLimit, INITIAL_COUNT: (d: Data) => formatNumber(d.saleInfo.token_final_supply), - REMAINING_COUNT: (d: Data) => formatNumber(d.tokensLeft), + REMAINING_COUNT: (d: Data) => formatRemainingNumber(d.tokensLeft), } as const export const placeholderStrings = Object.keys(replacers) export type PlaceholderString = keyof typeof replacers -const placeholderRegex = new RegExp(`(${placeholderStrings.join('|')})`, 'gm') +const placeholderRegex = new RegExp(`(${placeholderStrings.join("|")})`, "gm") export function fill(text: string, data: Data): string { - return text.replace(placeholderRegex, (match) => { + return text.replace(placeholderRegex, match => { return String(replacers[match as PlaceholderString](data)) }) } // add-to-calendar-button has strange strict requirements on time format function formatDatesForAtcb(d: Timestamp) { - let [start, end] = new Date(d).toISOString().split('T') + let [start, end] = new Date(d).toISOString().split("T") return [ start, - end.replace(/:\d\d\..*$/, '') // strip seconds, ms, & TZ + end.replace(/:\d\d\..*$/, ""), // strip seconds, ms, & TZ ] } @@ -103,48 +207,190 @@ function getStartAndEnd(d: Timestamp) { } const actions = { - 'ADD_TO_CALENDAR(SALE_START)': (d: Data) => addToCalendar({ - name: d.locale.calendarEvent!, - ...getStartAndEnd(d.saleInfo.sale_start), - options: ['Google', 'iCal', 'Apple', 'Microsoft365', 'MicrosoftTeams', 'Outlook.com', 'Yahoo'], - timeZone: "UTC", - trigger: 'click', - }), - 'ADD_TO_CALENDAR(PRESALE_START)': (d: Data) => addToCalendar({ - name: d.locale.calendarEvent!, - ...getStartAndEnd(d.saleInfo.presale_start), - options: ['Google', 'iCal', 'Apple', 'Microsoft365', 'MicrosoftTeams', 'Outlook.com', 'Yahoo'], - timeZone: "UTC", - trigger: 'click', - }), - 'SIGN_IN': signIn, - 'MINT': (d: Data) => TenK.nft_mint_many({ num: d.numberToMint ?? 1 }, { - gas: Gas.parse('40 Tgas').mul(Gas.from('' + d.numberToMint)), - attachedDeposit: NEAR.from(d.saleInfo.price).mul(NEAR.from('' + d.numberToMint)), - }), - 'GO_TO_PARAS': () => window.open(`https://paras.id/search?q=${settings.contractName}&sort=priceasc&pmin=.01&is_verified=true`), + "ADD_TO_CALENDAR(SALE_START)": (d: Data) => + addToCalendar({ + name: d.locale.calendarEvent!, + ...getStartAndEnd(d.saleInfo.sale_start), + options: [ + "Google", + "iCal", + "Apple", + "Microsoft365", + "MicrosoftTeams", + "Outlook.com", + "Yahoo", + ], + timeZone: "UTC", + trigger: "click", + }), + "ADD_TO_CALENDAR(PRESALE_START)": (d: Data) => + addToCalendar({ + name: d.locale.calendarEvent!, + ...getStartAndEnd(d.saleInfo.presale_start), + options: [ + "Google", + "iCal", + "Apple", + "Microsoft365", + "MicrosoftTeams", + "Outlook.com", + "Yahoo", + ], + timeZone: "UTC", + trigger: "click", + }), + SIGN_IN: signIn, + MintForNear: (d: Data) => + TenK.nft_mint_many( + { with_cheddar: false, num: d.numberToMint ?? 1 }, + { + gas: Gas.parse("40 Tgas").mul(Gas.from("" + d.numberToMint)), + attachedDeposit: NEAR.from( + new BN(d.saleInfo.price).add(new BN("15000000000000000000000")) + ).mul(NEAR.from("" + d.numberToMint)), + } + ), + MintForChed: (d: Data) => {}, + GO_TO_PARAS: () => + window.open( + `https://paras.id/search?q=${settings.contractName}&sort=priceasc&pmin=.01&is_verified=true` + ), } -export type Action = keyof typeof actions +export type ActionE = keyof typeof actions + +export async function act(action: ActionE, data: Data): void { + if (action === "MintForChed") { + const transactions: Transaction[] = [] + + let ft_amount: string = "" + + ft_amount = NEAR.from(data.totalCost).mul( + NEAR.from("" + (data.numberToMint ?? 1)) + ) + //(data.totalCost * (data.numberToMint ?? 1)).toString() + + nearWebWalletConnection = wallet + nearConnectedWalletAccount = new ConnectedWalletAccount( + nearWebWalletConnection, + near.connection, + nearWebWalletConnection.getAccountId() + ) + + transactions.unshift({ + receiverId: settings.contractName, + functionCalls: [ + { + methodName: "nft_mint_many", + args: { + with_cheddar: true, + num: data.numberToMint ?? 1, + }, + gas: Gas.parse("40 Tgas").mul(Gas.from("" + data.numberToMint)), + amount: NEAR.from("15000000000000000000000").mul( + NEAR.from("" + data.numberToMint) + ), + }, + ], + }) -export function act(action: Action, data: Data): void { - actions[action](data) + transactions.unshift({ + receiverId: settings.ftcontractName, + functionCalls: [ + { + methodName: "ft_transfer_call", + args: { + receiver_id: settings.contractName, + amount: ft_amount, + msg: "transfer ft", + }, + amount: new BN( + utils.format.parseNearAmount("0.000000000000000000000001") + ), + gas: new BN("75000000000000"), + }, + ], + }) + + // let isAccountRegistered = (await FT.storageBalance(present_account_id)) != null; + + // if(!isAccountRegistered) { + // transactions.unshift({ + // receiverId: settings.ftcontractName, + // functionCalls: [ + // { + // methodName: 'storage_deposit', + // args: { + // account_id: present_account_id + // }, + // amount: new BN(utils.format.parseNearAmount('0.2')), + // gas: new BN('100000000000000') + // } + // ] + // }); + // } + + const currentTransactions = await Promise.all( + transactions.map((t, i) => { + return setupTransaction({ + receiverId: t.receiverId, + nonceOffset: i + 1, + actions: t.functionCalls.map(fc => + functionCall(fc.methodName, fc.args, fc.gas, fc.amount) + ), + }) + }) + ) + + requestSignTransOptions = currentTransactions + nearWebWalletConnection.requestSignTransactions(requestSignTransOptions) + } else { + actions[action](data) + } } -export function can(action: Action, data: Data): boolean { - if (action === 'MINT') { - return Boolean(data.currentUser) && ( - (data.saleStatus === 'presale' && +export function can(action: ActionE, data: Data): boolean { + if (action === "MintForNear" || action === "MintForChed") { + return ( + Boolean(data.currentUser) && + ((data.saleStatus === "presale" && data.remainingAllowance !== undefined && - data.remainingAllowance > 0 - ) || - (data.saleStatus === 'saleOpen' && ( - // users are added to the whitelist as they mint during saleOpen; - // undefined means they haven't minted yet - data.remainingAllowance === undefined || - data.remainingAllowance > 0 - )) + data.remainingAllowance > 0) || + (data.saleStatus === "saleOpen" && + // users are added to the whitelist as they mint during saleOpen; + // undefined means they haven't minted yet + (data.remainingAllowance === undefined || + data.remainingAllowance > 0))) ) } return true -} \ No newline at end of file +} + +// if(action === "MintForNear") +// { +// let s; +// console.log("Here is MintForNear!") + +// s = TenK.nft_mint_many({ with_cheddar: false, num: data.numberToMint ?? 1 }, { +// gas: Gas.parse('40 Tgas').mul(Gas.from('' + data.numberToMint)), +// attachedDeposit: NEAR.from("5150000000000000000000000").mul(NEAR.from('' + data.numberToMint)), +// }) +// console.log("\ndata: " + s) +// } + +// if(action === "MintForChed") +// { +// console.log("Here is MintForChed!"); +// FT.storage_deposit({ account_id: "aronpayout.testnet" }, { +// attachedDeposit: NEAR.from("150000000000000000000000"), +// }) + +// FT.ft_transfer_call({ receiver_id: settings.contractName, amount: "2250000000000000000000000000", msg: "transfer ft" }, { +// gas: Gas.parse('75000000000000 gas'), +// attachedDeposit: NEAR.from("1"), +// }) + +// TenK.nft_mint_many({ with_cheddar: true, num: data.numberToMint ?? 1 }, { +// attachedDeposit: NEAR.from("1500000000000000000000000"), +// }) +// } diff --git a/src/components/footer/index.tsx b/src/components/footer/index.tsx index 180622d..884a08d 100644 --- a/src/components/footer/index.tsx +++ b/src/components/footer/index.tsx @@ -11,15 +11,8 @@ export default function Footer() { ) -} +} \ No newline at end of file diff --git a/src/components/hero/hero.module.css b/src/components/hero/hero.module.css index df6638d..525fe2c 100644 --- a/src/components/hero/hero.module.css +++ b/src/components/hero/hero.module.css @@ -9,7 +9,7 @@ } .content h1 { font-weight: var(--fw-black); - font-size: 4rem; + font-size: 3.5rem; line-height: 0.9; margin-top: var(--spacing-l); } diff --git a/src/components/hero/index.tsx b/src/components/hero/index.tsx index dd04aa5..c424b3d 100644 --- a/src/components/hero/index.tsx +++ b/src/components/hero/index.tsx @@ -18,6 +18,7 @@ const Hero: React.FC<{ heroTree: ExpandedHeroTree }> = ({ heroTree }) => { const { saleStatus, userStatus } = useHeroStatuses() const [numberToMint, setNumberToMint] = React.useState(1) const hero = heroTree[saleStatus][userStatus] + // console.log(heroTree + "\n" + saleStatus) if (!locale) return null @@ -28,6 +29,14 @@ const Hero: React.FC<{ heroTree: ExpandedHeroTree }> = ({ heroTree }) => { saleStatus, userStatus, } + + const mintForNear = function () { + act("MintForNear", { ...data, numberToMint}) + } + + const mintForCheddar = function() { + act("MintForChed", { ...data, numberToMint}) + } return (
= ({ heroTree }) => { }} >
- {can(hero.action, data) && ( + {can("MintForNear", data) && (
{ e.preventDefault() - act(hero.action, { ...data, numberToMint }) + // act(hero.action, { ...data, numberToMint }) }}> {hero.setNumber && ( <> @@ -61,10 +70,7 @@ const Hero: React.FC<{ heroTree: ExpandedHeroTree }> = ({ heroTree }) => {
setNumberToMint(v)} @@ -72,9 +78,16 @@ const Hero: React.FC<{ heroTree: ExpandedHeroTree }> = ({ heroTree }) => { /> )} - + + +

* Storage Deposit of 0.15 NEAR Required
Swap 🧀 on ↔️ Ref Finance

+

+ )}
diff --git a/src/components/layout/layout.scss b/src/components/layout/layout.scss index 70af756..3291d9b 100644 --- a/src/components/layout/layout.scss +++ b/src/components/layout/layout.scss @@ -2,10 +2,11 @@ @import "./atcb.css"; @import "../../../config/styles.scss"; @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;900&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Bubblegum+Sans&display=swap'); $white: white !default; $black: black !default; -$accent: #e73b93 !default; +$accent: #FCA602 !default; :root { /* Typographic Scale */ @@ -18,7 +19,7 @@ $accent: #e73b93 !default; } /* Font Family */ - --sans: Montserrat, sans-serif; + --sans: Bubblegum Sans, sans-serif; --monospace: "Source Code Pro", monospace; /* Font Weights */ diff --git a/src/components/my-nfts/index.tsx b/src/components/my-nfts/index.tsx index e384b13..5ae35ea 100644 --- a/src/components/my-nfts/index.tsx +++ b/src/components/my-nfts/index.tsx @@ -66,6 +66,7 @@ const MyNFTs: React.FC<{ × +

{locale.myNFTsDesc}

{nfts.map((nft, index) => (