From cb08eaf13fd8d611c32ee5d092bd094580438d43 Mon Sep 17 00:00:00 2001 From: Adeyemi Gbenga Date: Wed, 8 Jan 2025 08:14:09 +0100 Subject: [PATCH] Argent mobile connector fix (#424) * start fix script and others stuff and redeploy * new contract * contrazt deploy and ui * try fix ui argent connection mobile * fix import * upgrade package starknetkit * issue error tsconfig in mobile * moduleRes bundler * use next import with nnpm: * dupliacte to delete * fix: argent mobile wallet --------- Co-authored-by: MSGhais --- apps/mobile/metro.config.js | 139 +++--------------- apps/mobile/package.json | 8 +- apps/mobile/src/app/StarknetProvider.tsx | 50 ++++++- .../src/modules/TokenCreatedModal/styles.ts | 1 - apps/mobile/src/modules/WalletModal/index.tsx | 5 +- .../src/modules/WalletQRModal/index.tsx | 124 ++++++++-------- apps/mobile/src/screens/Launchpad/styles.ts | 4 +- apps/mobile/tsconfig.json | 2 +- apps/nestjs-indexer/src/common/constants.ts | 3 +- .../src/indexer/token-launch.indexer.ts | 2 + .../token-launch/token-launch.service.ts | 2 + apps/pwa/package.json | 2 - apps/pwa/src/app/page.tsx | 2 + apps/website/package.json | 2 - onchain/cairo/afk/src/interfaces/pixel.cairo | 2 +- .../games/src/tests/nameservice_tests.cairo | 4 +- .../cairo/games/src/types/keys_types.cairo | 2 +- .../launchpad/src/launchpad/launchpad.cairo | 20 +-- .../cairo/launchpad/src/launchpad/unrug.cairo | 14 +- packages/common/src/contracts.ts | 19 ++- scripts/deploy/launchpad.ts | 26 ++-- scripts/utils/launchpad.ts | 21 ++- scripts/utils/pixel/art_peace.ts | 47 +++--- scripts/utils/pixel/canvas_nft.ts | 4 +- scripts/utils/pixel/faction_quest.ts | 4 +- scripts/utils/pixel/pixel_quest.ts | 12 +- scripts/utils/pixel/quest_tap.ts | 12 +- scripts/utils/quest.ts | 8 +- turbo.json | 6 +- 29 files changed, 259 insertions(+), 288 deletions(-) diff --git a/apps/mobile/metro.config.js b/apps/mobile/metro.config.js index e13ce7bb5..2b7597938 100644 --- a/apps/mobile/metro.config.js +++ b/apps/mobile/metro.config.js @@ -1,29 +1,39 @@ -// // Learn more https://docs.expo.io/guides/customizing-metro -// metro.config.js - -// const { getDefaultConfig } = require('metro-config'); -// const path = require("path"); -// Learn more https://docs.expo.io/guides/customizing-metro -const { getDefaultConfig } = require('expo/metro-config'); +const {getDefaultConfig} = require('expo/metro-config'); const path = require('path'); -// Find the workspace root, this can be replaced with `find-yarn-workspace-root` const workspaceRoot = path.resolve(__dirname, '../..'); const projectRoot = __dirname; const config = getDefaultConfig(projectRoot); -// 1. Watch all files within the monorepo config.watchFolders = [workspaceRoot]; -// 2. Let Metro know where to resolve packages, and in what order config.resolver.nodeModulesPaths = [ path.resolve(projectRoot, 'node_modules'), - path.resolve(workspaceRoot, 'node_modules') + path.resolve(workspaceRoot, 'node_modules'), ]; -// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` config.resolver.disableHierarchicalLookup = true; -// Add this configuration for WSL +config.resolver = { + ...config.resolver, + resolveRequest: (context, moduleName, platform) => { + // Handle the starknetkit specific case + if (moduleName.startsWith('starknetkit/')) { + try { + const path = require.resolve(moduleName); + return { + filePath: path, + type: 'sourceFile', + }; + } catch (e) { + // Fall back to default resolution + return context.resolveRequest(context, moduleName, platform); + } + } + // Default resolution for all other modules + return context.resolveRequest(context, moduleName, platform); + }, +}; + config.watchFolders = [workspaceRoot]; config.server = { ...config.server, @@ -32,106 +42,3 @@ config.server = { }; module.exports = config; - -// module.exports = (async () => { -// const { -// resolver: { sourceExts, assetExts } -// } = await getDefaultConfig(); - -// return { -// transformer: { -// getTransformOptions: async () => ({ -// transform: { -// experimentalImportSupport: false, -// inlineRequires: false, -// }, -// }), -// }, -// resolver: { -// assetExts: [...assetExts, 'svg', 'png', 'jpg', 'gif', 'ttf'], -// sourceExts: [...sourceExts, 'js', 'jsx', 'ts', 'tsx'], // Ensure js is listed -// }, -// }; -// })(); - - -// module.exports = (async () => { -// const { -// resolver: { sourceExts, assetExts } -// } = await getDefaultConfig(); - -// return { -// transformer: { -// getTransformOptions: async () => ({ -// transform: { -// experimentalImportSupport: false, -// inlineRequires: true, -// }, -// }), -// }, -// resolver: { -// assetExts: assetExts.filter(ext => ext), -// sourceExts: [...sourceExts, 'svg','ttf'], -// extraNodeModules: new Proxy({}, { -// get: (target, name) => { -// return path.join(process.cwd(), `node_modules/${name}`); -// }, -// }), -// }, -// }; -// })(); - - - -// const { getDefaultConfig } = require("expo/metro-config"); -// const path = require("path"); - -// // Find the workspace root, this can be replaced with `find-yarn-workspace-root` -// const workspaceRoot = path.resolve(__dirname, "../.."); -// const projectRoot = __dirname; - -// const config = getDefaultConfig(projectRoot); - -// // 1. Watch all files within the monorepo -// config.watchFolders = [workspaceRoot]; -// // 2. Let Metro know where to resolve packages, and in what order -// config.resolver.nodeModulesPaths = [ -// path.resolve(projectRoot, "node_modules"), -// path.resolve(workspaceRoot, "node_modules"), -// ]; -// // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` -// config.resolver.disableHierarchicalLookup = true; - -// module.exports = config; - -// TEST -// const path = require('path'); - -// module.exports = { -// ...config, -// watchFolders: [ -// path.resolve(__dirname, '../../node_modules'), -// ], -// resolver: { - -// extraNodeModules: new Proxy({}, { -// get: (target, name) => path.join(process.cwd(), `node_modules/${name}`), -// }), -// }, -// }; - -// const {assetExts} = getDefaultConfig(); -// module.exports = { -// // ...config, -// watchFolders: [ -// path.resolve(__dirname, '../../node_modules'), -// ], -// resolver: { -// // assetExts: assetExts.filter(ext => ext), -// // sourceExts: [...sourceExts, 'svg','ttf'], -// // sourceExts: ["png","jpg", 'svg','ttf'], -// extraNodeModules: new Proxy({}, { -// get: (target, name) => path.join(process.cwd(), `node_modules/${name}`), -// }), -// }, -// }; \ No newline at end of file diff --git a/apps/mobile/package.json b/apps/mobile/package.json index e0593b602..dc46c9b4a 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -59,11 +59,10 @@ "@reown/appkit-auth-wagmi-react-native": "~1.0.1", "@reown/appkit-siwe-react-native": "~1.0.1", "@reown/appkit-wagmi-react-native": "~1.0.1", + "@scure/bip39": "^1.5.0", "@starknet-react/chains": "^3.1.0", "@starknet-react/core": "^3.5.0", "@starknet-react/kakarot": "^3.0.9", - "@starknet-wc/core": "0.0.4", - "@starknet-wc/react": "0.0.4", "@stripe/stripe-react-native": "0.38.6", "@tanstack/react-query": "^5.40.0", "@tanstack/react-query-persist-client": "5.40.0", @@ -131,12 +130,11 @@ "react-native-webview": "~13.6.4", "react-native-webview-crypto": "^0.0.25", "starknet": "6.11.0", - "starknetkit": "^1.1.9", + "starknetkit": "^2.6.1", "text-encoding": "^0.7.0", "viem": "2.x", "wagmi": "^2.12.8", - "zustand": "^4.5.2", - "@scure/bip39": "^1.5.0" + "zustand": "^4.5.2" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/apps/mobile/src/app/StarknetProvider.tsx b/apps/mobile/src/app/StarknetProvider.tsx index c915e102f..c1aaf1e19 100644 --- a/apps/mobile/src/app/StarknetProvider.tsx +++ b/apps/mobile/src/app/StarknetProvider.tsx @@ -8,14 +8,21 @@ import { voyager, } from '@starknet-react/core'; import {kakarotConnectors} from '@starknet-react/kakarot'; -import {ConnectorProvider as StarknetWCProvider} from '@starknet-wc/react'; +// import {ConnectorProvider as StarknetWCProvider} from '@starknet-wc/react'; import {Platform} from 'react-native'; +// import { ArgentMobileConnector, isInArgentMobileAppBrowser } from "starknetkit/argentMobile" +// import { InjectedConnector } from "starknetkit/injected" +// import { WebWalletConnector } from "starknetkit/webwallet" import {NETWORK_NAME} from '../constants/env'; import {RpcProviderProvider} from '../context/RpcProvider'; -import {WalletQRModal} from '../modules/WalletQRModal'; +// import {WalletQRModal} from '../modules/WalletQRModal'; import {providers} from '../services/provider'; +import {ArgentMobileConnector, isInArgentMobileAppBrowser} from 'starknetkit/argentMobile'; +import {InjectedConnector} from 'starknetkit/injected'; +import {WebWalletConnector} from 'starknetkit/webwallet'; + export const StarknetReactProvider: React.FC = ({children}) => { const chain = { SN_MAIN: mainnet, @@ -31,6 +38,36 @@ export const StarknetReactProvider: React.FC = ({childr ? [argent(), braavos(), ...kakarotConnectors(providerRpc)] : [argent(), braavos()]; + const chains = [mainnet, sepolia]; + // const connectors = [ + // new InjectedConnector({ options: { id: "braavos", name: "Braavos" }}), + // new InjectedConnector({ options: { id: "argentX", name: "Argent X" }}), + // new WebWalletConnector({ url: "https://web.argent.xyz" }), + // new ArgentMobileConnector(), + // ] + + const connectors = isInArgentMobileAppBrowser() + ? [ + ArgentMobileConnector.init({ + options: { + dappName: 'AFK Dapp', + projectId: process.env.EXPO_PUBLIC_WC_ID ?? 'example-project-id', + }, + inAppBrowserOptions: {}, + }), + ] + : [ + new InjectedConnector({options: {id: 'braavos', name: 'Braavos'}}), + new InjectedConnector({options: {id: 'argentX', name: 'Argent X'}}), + new WebWalletConnector({url: 'https://web.argent.xyz'}), + ArgentMobileConnector.init({ + options: { + dappName: 'AFK Dapp', + projectId: process.env.EXPO_PUBLIC_WC_ID ?? 'example-project-id', + }, + }), + ]; + const {connectors: injected} = useInjectedConnectors({ recommended, includeRecommended: 'always', @@ -45,7 +82,8 @@ export const StarknetReactProvider: React.FC = ({childr chains={[chain]} provider={providers} autoConnect - connectors={[...(Platform.OS === 'web' ? injected : [])]} + connectors={connectors} + // connectors={[...(Platform.OS === 'web' ? injected : [])]} explorer={voyager} > {children} @@ -56,8 +94,8 @@ export const StarknetReactProvider: React.FC = ({childr export const StarknetProvider: React.FC = ({children}) => { return ( - - {children} - + // + {children} + // ); }; diff --git a/apps/mobile/src/modules/TokenCreatedModal/styles.ts b/apps/mobile/src/modules/TokenCreatedModal/styles.ts index b477aedb0..d74dabbb6 100644 --- a/apps/mobile/src/modules/TokenCreatedModal/styles.ts +++ b/apps/mobile/src/modules/TokenCreatedModal/styles.ts @@ -22,7 +22,6 @@ export default ThemedStyleSheet((theme) => ({ icon: { color: theme.colors.primary, }, - cardHeader: { flexDirection: 'row', justifyContent: 'space-between', diff --git a/apps/mobile/src/modules/WalletModal/index.tsx b/apps/mobile/src/modules/WalletModal/index.tsx index 8a6e09148..79c60b95f 100644 --- a/apps/mobile/src/modules/WalletModal/index.tsx +++ b/apps/mobile/src/modules/WalletModal/index.tsx @@ -78,9 +78,8 @@ export const WalletModal: React.FC = ({hide}) => { })} - + {/* EVM - {/* */} { @@ -90,7 +89,7 @@ export const WalletModal: React.FC = ({hide}) => { > Connect EVM - + */} +// +// - - - - ); -}; +// +// +// +// ); +// }; diff --git a/apps/mobile/src/screens/Launchpad/styles.ts b/apps/mobile/src/screens/Launchpad/styles.ts index 66bd198e6..02e01dff1 100644 --- a/apps/mobile/src/screens/Launchpad/styles.ts +++ b/apps/mobile/src/screens/Launchpad/styles.ts @@ -2,11 +2,11 @@ import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { - position: 'relative', + // position: 'relative', flex: 1, backgroundColor: theme.colors.background, color: theme.colors.text, - padding: 40, + // padding: 40, }, createTokenButton: { width: 200, diff --git a/apps/mobile/tsconfig.json b/apps/mobile/tsconfig.json index d891973bb..7e0bb5f9c 100644 --- a/apps/mobile/tsconfig.json +++ b/apps/mobile/tsconfig.json @@ -17,7 +17,7 @@ "noImplicitThis": true, "noImplicitReturns": true, "useUnknownInCatchVariables": false, - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "downlevelIteration": true, diff --git a/apps/nestjs-indexer/src/common/constants.ts b/apps/nestjs-indexer/src/common/constants.ts index c67d6fc9e..6cd9088be 100644 --- a/apps/nestjs-indexer/src/common/constants.ts +++ b/apps/nestjs-indexer/src/common/constants.ts @@ -14,7 +14,8 @@ export default { // '0x3cb02be4090f94929a7d964266fdb1c74cefdd9066f7be08fb8a6bc33c619cd', // LAUNCHPAD_ADDRESS:"0x3b74f8994f11870aa77c3719aa5ef4d432a2a10fe07f93d5ba3bb701fdfffd1", // LAUNCHPAD_ADDRESS:"0x3ed3046bf62bfcfba32e9282d64f432de3f0c383755b1aee8514c3d67109573", - LAUNCHPAD_ADDRESS:"0x1488623bcbd76a0d078cc4c4743630c2650800626ce20774b8f3706a42591e9", + // LAUNCHPAD_ADDRESS:"0x1488623bcbd76a0d078cc4c4743630c2650800626ce20774b8f3706a42591e9", + LAUNCHPAD_ADDRESS:"0x58b6601ce6010306e47fbc44d5489ede3f841414f2440329e841982e0d5e911", NAMESERVICE_ADDRESS: '0x15dcd3c28c07846fa98d3a40d29446de21b5e6cd8d49a43773da0f237d5ea7f', }, diff --git a/apps/nestjs-indexer/src/indexer/token-launch.indexer.ts b/apps/nestjs-indexer/src/indexer/token-launch.indexer.ts index b91f660ee..cb4a0a5b3 100644 --- a/apps/nestjs-indexer/src/indexer/token-launch.indexer.ts +++ b/apps/nestjs-indexer/src/indexer/token-launch.indexer.ts @@ -135,6 +135,7 @@ export class TokenLaunchIndexer { thresholdLiquidityRaw, constants.DECIMALS, ).toString(); + console.log("thresholdLiquidity", thresholdLiquidity) // const bondingType = bondingTypeFelt; // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -144,6 +145,7 @@ export class TokenLaunchIndexer { ) : ''; + console.log("bondingType", bondingType) const data = { transactionHash, diff --git a/apps/nestjs-indexer/src/services/token-launch/token-launch.service.ts b/apps/nestjs-indexer/src/services/token-launch/token-launch.service.ts index b93e8c4a7..678997cc0 100644 --- a/apps/nestjs-indexer/src/services/token-launch/token-launch.service.ts +++ b/apps/nestjs-indexer/src/services/token-launch/token-launch.service.ts @@ -32,6 +32,8 @@ export class TokenLaunchService { quote_token: data.quoteToken, price: data.price, total_supply: data.totalSupply, + current_supply: data.totalSupply, + is_liquidity_added: false, threshold_liquidity: data.thresholdLiquidity, bonding_type: data.bondingType, owner_address: data.ownerAddress, diff --git a/apps/pwa/package.json b/apps/pwa/package.json index e30da4ee2..10c07a279 100644 --- a/apps/pwa/package.json +++ b/apps/pwa/package.json @@ -32,8 +32,6 @@ "@rainbow-me/rainbowkit": "^2.1.5", "@starknet-react/chains": "^0.1.7", "@starknet-react/core": "^2.8.2", - "@starknet-wc/core": "0.0.4", - "@starknet-wc/react": "0.0.4", "@tanstack/react-query": "^5.40.0", "axios": "^1.7.2", "common": "workspace:*", diff --git a/apps/pwa/src/app/page.tsx b/apps/pwa/src/app/page.tsx index b245768eb..fe2772f6f 100644 --- a/apps/pwa/src/app/page.tsx +++ b/apps/pwa/src/app/page.tsx @@ -16,7 +16,9 @@ export default function App() { {/* */} diff --git a/apps/website/package.json b/apps/website/package.json index 05fe72607..45ef3586a 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -26,8 +26,6 @@ "@rainbow-me/rainbowkit": "^2.1.5", "@starknet-react/chains": "^0.1.7", "@starknet-react/core": "^2.8.2", - "@starknet-wc/core": "0.0.4", - "@starknet-wc/react": "0.0.4", "@tanstack/react-query": "^5.40.0", "common": "workspace:*", "d3": "^7.9.0", diff --git a/onchain/cairo/afk/src/interfaces/pixel.cairo b/onchain/cairo/afk/src/interfaces/pixel.cairo index f23608f11..fec8d0489 100644 --- a/onchain/cairo/afk/src/interfaces/pixel.cairo +++ b/onchain/cairo/afk/src/interfaces/pixel.cairo @@ -434,7 +434,7 @@ pub struct ChainFactionTemplateRemoved { #[derive(Drop, Serde)] pub struct InitParams { - // pub host: ContractAddress, + pub host: ContractAddress, pub canvas_width: u128, pub canvas_height: u128, pub time_between_pixels: u64, diff --git a/onchain/cairo/games/src/tests/nameservice_tests.cairo b/onchain/cairo/games/src/tests/nameservice_tests.cairo index 9e9a2d224..0ea83d4d2 100644 --- a/onchain/cairo/games/src/tests/nameservice_tests.cairo +++ b/onchain/cairo/games/src/tests/nameservice_tests.cairo @@ -236,7 +236,9 @@ mod nameservice_tests { stop_cheat_caller_address(nameservice_dispatcher.contract_address); let admin_balance = payment_token_dispatcher.balance_of(ADMIN()); - assert(admin_balance == 60_u256, 'Admin did not receive fees'); // 50 initial + 10 withdrawn + assert( + admin_balance == 60_u256, 'Admin did not receive fees' + ); // 50 initial + 10 withdrawn let contract_balance = payment_token_dispatcher .balance_of(nameservice_dispatcher.contract_address); diff --git a/onchain/cairo/games/src/types/keys_types.cairo b/onchain/cairo/games/src/types/keys_types.cairo index d36ef89e4..700531835 100644 --- a/onchain/cairo/games/src/types/keys_types.cairo +++ b/onchain/cairo/games/src/types/keys_types.cairo @@ -118,7 +118,7 @@ pub fn get_current_price(key: @Keys, supply: u256, amount_to_buy: u256) -> u256 pub fn get_linear_price( // key: @Keys, -key: Keys, supply: u256, // amount_to_buy: u256 + key: Keys, supply: u256, // amount_to_buy: u256 ) -> u256 { let step_increase_linear = key.token_quote.step_increase_linear.clone(); let initial_key_price = key.token_quote.initial_key_price.clone(); diff --git a/onchain/cairo/launchpad/src/launchpad/launchpad.cairo b/onchain/cairo/launchpad/src/launchpad/launchpad.cairo index a07d06aef..c83a33aef 100644 --- a/onchain/cairo/launchpad/src/launchpad/launchpad.cairo +++ b/onchain/cairo/launchpad/src/launchpad/launchpad.cairo @@ -1022,7 +1022,7 @@ pub mod LaunchpadMarketplace { if old_pool.liquidity_raised < quote_amount { // TODO due to estimation, approximation or rounding // maybe substract the difference between quote_amount and old_pool.liquidity_raised - println!("old_pool.liquidity_raised < quote_amount"); + // println!("old_pool.liquidity_raised < quote_amount"); quote_amount = old_pool.liquidity_raised.clone(); quote_amount_total = old_pool.liquidity_raised.clone(); quote_amount_received = old_pool.liquidity_raised.clone(); @@ -1691,10 +1691,10 @@ pub mod LaunchpadMarketplace { }; // println!("initial_pool_supply : {}", lp_supply.clone()); - println!("liquidity raised: {}", lp_quote_supply.clone()); + // println!("liquidity raised: {}", lp_quote_supply.clone()); // Assertion: Check if the contract has enough quote tokens to transfer let contract_quote_balance = quote_token.balance_of(get_contract_address()); - println!("add liquidity contract_quote_balance final {:?}", contract_quote_balance); + // println!("add liquidity contract_quote_balance final {:?}", contract_quote_balance); // TODO fix this // @@ -1703,16 +1703,16 @@ pub mod LaunchpadMarketplace { // Edge case of approximation estimation amount and fees can cause it if contract_quote_balance < lp_quote_supply && contract_quote_balance < launch.threshold_liquidity { - println!( - "contract_quote_balance < lp_quote_supply - && contract_quote_balance < launch.threshold_liquidity: {}", - contract_quote_balance < lp_quote_supply - && contract_quote_balance < launch.threshold_liquidity - ); + // println!( + // "contract_quote_balance < lp_quote_supply + // && contract_quote_balance < launch.threshold_liquidity: {}", + // contract_quote_balance < lp_quote_supply + // && contract_quote_balance < launch.threshold_liquidity + // ); // println!("launch.threshold_liquidity: {}", launch.threshold_liquidity.clone()); lp_quote_supply = contract_quote_balance.clone(); } - println!("liquidity raised: {}", lp_quote_supply.clone()); + // println!("liquidity raised: {}", lp_quote_supply.clone()); let params = EkuboUnrugLaunchParameters { // owner: launch.owner, // TODO add optional parameters to be select LIQ percent to diff --git a/onchain/cairo/launchpad/src/launchpad/unrug.cairo b/onchain/cairo/launchpad/src/launchpad/unrug.cairo index 6a48fe2e8..6e48019ed 100644 --- a/onchain/cairo/launchpad/src/launchpad/unrug.cairo +++ b/onchain/cairo/launchpad/src/launchpad/unrug.cairo @@ -899,12 +899,12 @@ pub mod UnrugLiquidity { unlock_time: u64 ) -> u256 { // ) -> (u64, EkuboLP) { - println!("In _add_liquidity_jediswap",); + // println!("In _add_liquidity_jediswap",); let mut factory_address = self.address_jediswap_factory_v2.read(); let nft_router_address = self.address_jediswap_nft_router_v2.read(); - println!("check address"); + // println!("check address"); if nft_router_address.is_zero() { return 0_u256; @@ -922,7 +922,7 @@ pub mod UnrugLiquidity { // TODO check if pool exist // Pool need to be create - println!("step setup params",); + // println!("step setup params",); let fee: u32 = 10_000; let factory = IJediswapFactoryV2Dispatcher { contract_address: factory_address }; let token_a = coin_address.clone(); @@ -941,7 +941,7 @@ pub mod UnrugLiquidity { let total_supply = lp_supply.clone(); let liquidity_raised = quote_amount.clone(); - println!("prepare params jediswap pool",); + // println!("prepare params jediswap pool",); // TODO // Better params default // let amount_coin_liq = total_supply / LIQUIDITY_RATIO; @@ -959,12 +959,12 @@ pub mod UnrugLiquidity { let mut id_token_lp: u256 = 0; - println!("check if pool exist"); + // println!("check if pool exist"); // TODO // Check if using Router or NFTRouter to add liquidity if pool.into() == 0_felt252 { - println!("pool still not created"); + // println!("pool still not created"); pool = factory.create_pool(token_a, token_b, fee); pool = nft_router.create_and_initialize_pool(token_a, token_b, fee, sqrt_price_X96); @@ -991,7 +991,7 @@ pub mod UnrugLiquidity { deadline: deadline, }; - println!("step {}", 9); + // println!("step {}", 9); let (token_id, _, _, _) = nft_router.mint(mint_params); id_token_lp = token_id.try_into().unwrap(); diff --git a/packages/common/src/contracts.ts b/packages/common/src/contracts.ts index 3ecae3da9..3f04b6063 100644 --- a/packages/common/src/contracts.ts +++ b/packages/common/src/contracts.ts @@ -58,10 +58,10 @@ export const LAUNCHPAD_ADDRESS = { // [constants.StarknetChainId.SN_SEPOLIA]: // "0x3ed3046bf62bfcfba32e9282d64f432de3f0c383755b1aee8514c3d67109573" + // [constants.StarknetChainId.SN_SEPOLIA]: + // "0x1488623bcbd76a0d078cc4c4743630c2650800626ce20774b8f3706a42591e9" [constants.StarknetChainId.SN_SEPOLIA]: - "0x1488623bcbd76a0d078cc4c4743630c2650800626ce20774b8f3706a42591e9" - - + "0x58b6601ce6010306e47fbc44d5489ede3f841414f2440329e841982e0d5e911" }; @@ -151,8 +151,14 @@ export const ART_PEACE_ADDRESS = { // [constants.StarknetChainId.SN_SEPOLIA]: "0x78a022e6906c83e049a30f7464b939b831ecbe47029480d7e89684f20c8d263", // [constants.StarknetChainId.SN_SEPOLIA]: // "0x1c3e2cae24f0f167fb389a7e4c797002c4f0465db29ecf1753ed944c6ae746e", + // [constants.StarknetChainId.SN_SEPOLIA]: + // "0x4a115963fd4ea03a0c187d87574924852184a6d6997f199ad050679af6c9653", + + // [constants.StarknetChainId.SN_SEPOLIA]: + // "0x1c3e2cae24f0f167fb389a7e4c797002c4f0465db29ecf1753ed944c6ae746e", [constants.StarknetChainId.SN_SEPOLIA]: - "0x4a115963fd4ea03a0c187d87574924852184a6d6997f199ad050679af6c9653", + "0x1d3c8e4dcc100eb88e418d89a012326bd904fe5de061aee5df505a30d0ff5e9", + }; @@ -203,8 +209,11 @@ export const UNRUGGABLE_LIQUIDITY_ADDRESSES = { // "0xe39ea1a892ea736b2720cae35186cec2961364e88de4c502d0c076da916305", [constants.StarknetChainId.SN_MAIN]: "0x01a46467a9246f45c8c340f1f155266a26a71c07bd55d36e8d1c7d0d438a2dbc", + // [constants.StarknetChainId.SN_SEPOLIA]: + // "0xadbfdaa6d61bdc65e912c7bdb92881e55d42dfed4e367c8feaee734eee4676", [constants.StarknetChainId.SN_SEPOLIA]: - "0xadbfdaa6d61bdc65e912c7bdb92881e55d42dfed4e367c8feaee734eee4676", + "0x4f9a2d7613dbe428b7b8508acce666febd5a656dbb4387f6c6de7e5c52787f6", + // [constants.StarknetChainId.SN_SEPOLIA]: "0x5e89dc74f1a40d7814966b028a9b1853d39006a954b27828a9de7e333ec8119", }; diff --git a/scripts/deploy/launchpad.ts b/scripts/deploy/launchpad.ts index fcb9c8472..51a0cd2ac 100644 --- a/scripts/deploy/launchpad.ts +++ b/scripts/deploy/launchpad.ts @@ -25,7 +25,7 @@ export const deployLaunchpad = async () => { const accountAddress0 = process.env.DEV_PUBLIC_KEY as string; const account = new Account(provider, accountAddress0, privateKey0, "1"); - const chainId = await provider.getChainId(); + // const chainId = await provider.getChainId(); // const TOKEN_QUOTE_ADDRESS= TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].STRK; const TOKEN_QUOTE_ADDRESS = TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].STRK; @@ -51,20 +51,20 @@ export const deployLaunchpad = async () => { let EKUBO_REGISTRY_ADDRESS = EKUBO_REGISTRY[constants.StarknetChainId.SN_SEPOLIA]; - if (chainId == constants.StarknetChainId.SN_MAIN) { - JEDISWAP_ADDRESS_NFT = - JEDISWAP_V2_NFT_ROUTER[constants.StarknetChainId.SN_MAIN]; - JEDISWAP_FACTORY_ADDRESS = - JEDISWAP_V2_FACTORY[constants.StarknetChainId.SN_MAIN]; + // if (chainId == constants.StarknetChainId.SN_MAIN) { + // JEDISWAP_ADDRESS_NFT = + // JEDISWAP_V2_NFT_ROUTER[constants.StarknetChainId.SN_MAIN]; + // JEDISWAP_FACTORY_ADDRESS = + // JEDISWAP_V2_FACTORY[constants.StarknetChainId.SN_MAIN]; - EKUBO_POSITION_ADDRESS = - EKUBO_POSITION[constants.StarknetChainId.SN_MAIN]; - EKUBO_CORE_ADDRESS = - EKUBO_CORE[constants.StarknetChainId.SN_MAIN]; + // EKUBO_POSITION_ADDRESS = + // EKUBO_POSITION[constants.StarknetChainId.SN_MAIN]; + // EKUBO_CORE_ADDRESS = + // EKUBO_CORE[constants.StarknetChainId.SN_MAIN]; - UNRUG_FACTORY_ADDRESS= UNRUGGABLE_FACTORY_ADDRESS[constants.StarknetChainId.SN_MAIN] - EKUBO_REGISTRY_ADDRESS= EKUBO_REGISTRY[constants.StarknetChainId.SN_MAIN] - } + // UNRUG_FACTORY_ADDRESS= UNRUGGABLE_FACTORY_ADDRESS[constants.StarknetChainId.SN_MAIN] + // EKUBO_REGISTRY_ADDRESS= EKUBO_REGISTRY[constants.StarknetChainId.SN_MAIN] + // } const initial_key_price = cairo.uint256(1); const step_increase_linear = cairo.uint256(1); diff --git a/scripts/utils/launchpad.ts b/scripts/utils/launchpad.ts index bff752b2e..9a3de7827 100644 --- a/scripts/utils/launchpad.ts +++ b/scripts/utils/launchpad.ts @@ -108,15 +108,20 @@ export const createLaunchpad = async ( console.log('check memecoin class hash') - const declareIfNotToken = await account0.declareIfNot({ - contract: compiledContract, - casm: compiledCasm, - }); - console.log("coin_class_hash_memecoin_last", coin_class_hash_memecoin_last); + // const declareIfNotToken = await account0.declareIfNot({ + // contract: compiledContract, + // casm: compiledCasm, + // }); + + // if(declareIfNotToken?.transaction_hash) { + // console.log("coin_class_hash_memecoin_last", coin_class_hash_memecoin_last); + + // console.log("declareIfNotToken", declareIfNotToken); + // coin_class_hash_memecoin_last = declareIfNotToken?.class_hash ?? coin_class_hash + // console.log("coin_class_hash_memecoin_last", coin_class_hash_memecoin_last); + // } + // coin_class_hash_memecoin_last = declareIfNotToken?.class_hash - console.log("declareIfNotToken", declareIfNotToken); - coin_class_hash_memecoin_last = declareIfNotToken?.class_hash ?? coin_class_hash - console.log("coin_class_hash_memecoin_last", coin_class_hash_memecoin_last); console.log("try declare launchpad"); const declareResponse = await account0.declareIfNot({ diff --git a/scripts/utils/pixel/art_peace.ts b/scripts/utils/pixel/art_peace.ts index 9c0662443..edc501d72 100644 --- a/scripts/utils/pixel/art_peace.ts +++ b/scripts/utils/pixel/art_peace.ts @@ -17,11 +17,11 @@ import { CanvasConfig } from "common"; dotenv.config(); const PATH_ART_PEACE = path.resolve( __dirname, - "../../../onchain/cairo/afk/target/dev/afk_ArtPeace.contract_class.json" + "../../../onchain/cairo/games/target/dev/afk_games_ArtPeace.contract_class.json" ); const PATH_ART_PEACE_COMPILED = path.resolve( __dirname, - "../../../onchain/cairo/afk/target/dev/afk_ArtPeace.compiled_contract_class.json" + "../../../onchain/cairo/games/target/dev/afk_games_ArtPeace.compiled_contract_class.json" ); /** @TODO spec need to be discuss. This function serve as an example */ @@ -82,17 +82,20 @@ export const createArtPeace = async ( if (process.env.REDECLARE_CONTRACT == "true") { console.log("try declare account"); - const declareResponse = await account0.declare({ + const declareResponse = await account0.declareIfNot({ contract: compiledSierraAAaccount, casm: compiledAACasm, }); console.log("Declare deploy", declareResponse?.transaction_hash); - await provider.waitForTransaction(declareResponse?.transaction_hash); - const contractClassHash = declareResponse.class_hash; - ArtPeaceClassHash = contractClassHash; + if(declareResponse?.transaction_hash){ + await provider.waitForTransaction(declareResponse?.transaction_hash); + const contractClassHash = declareResponse.class_hash; + ArtPeaceClassHash = contractClassHash; + } - const nonce = await account0?.getNonce(); - console.log("nonce", nonce); + + // const nonce = await account0?.getNonce(); + // console.log("nonce", nonce); } console.log("host", host); @@ -108,7 +111,7 @@ export const createArtPeace = async ( console.log("devmode", devmode); console.log("account0 address", account0?.address); const initParams = { - // host: account0?.address, + host: account0?.address, canvas_width: cairo.uint256(canvas_width), canvas_height: cairo.uint256(canvas_height), time_between_pixels, @@ -121,6 +124,8 @@ export const createArtPeace = async ( devmode, }; console.log("initParams", initParams); + + let addressHost = account0?.address; const ArtPeaceCalldata = CallData.compile({ host: account0?.address, canvas_width: cairo.uint256(canvas_width), @@ -139,19 +144,23 @@ export const createArtPeace = async ( classHash: ArtPeaceClassHash, // constructorCalldata:ArtPeaceCalldata constructorCalldata: [ + { + addressHost, + canvas_width, + canvas_height, + time_between_pixels, + color_palette, + votable_colors, + daily_new_colors_count, + start_time, + end_time, + daily_quests_count, + devmode, + } // host ?? account0?.address, // cairo.uint256(canvas_width), // cairo.uint256(canvas_height), - canvas_width, - canvas_height, - time_between_pixels, - color_palette, - votable_colors, - daily_new_colors_count, - start_time, - end_time, - daily_quests_count, - devmode, + ], // constructorCalldata: [ // initParams diff --git a/scripts/utils/pixel/canvas_nft.ts b/scripts/utils/pixel/canvas_nft.ts index 025e9c49d..4c7fb549e 100644 --- a/scripts/utils/pixel/canvas_nft.ts +++ b/scripts/utils/pixel/canvas_nft.ts @@ -12,11 +12,11 @@ import path from "path"; dotenv.config(); const PATH_ART_CANVAS_NFT = path.resolve( __dirname, - "../../../onchain/cairo/afk/target/dev/afk_CanvasNFT.contract_class.json" + "../../../onchain/cairo/games/target/dev/afk_games_CanvasNFT.contract_class.json" ); const PATH_ART_CANVAS_NFT_COMPILED = path.resolve( __dirname, - "../../../onchain/cairo/afk/target/dev/afk_CanvasNFT.compiled_contract_class.json" + "../../../onchain/cairo/games/target/dev/afk_games_CanvasNFT.compiled_contract_class.json" ); /** @TODO spec need to be discuss. This function serve as an example */ diff --git a/scripts/utils/pixel/faction_quest.ts b/scripts/utils/pixel/faction_quest.ts index 216927dbb..14eb4953c 100644 --- a/scripts/utils/pixel/faction_quest.ts +++ b/scripts/utils/pixel/faction_quest.ts @@ -10,11 +10,11 @@ import path from "path"; dotenv.config(); const PATH_ART_PEACE = path.resolve( __dirname, - "../../onchain/cairo/target/dev/afk_UsernameStore.contract_class.json" + "../../onchain/cairo/games/target/dev/afk_games_UsernameStore.contract_class.json" ); const PATH_ART_PEACE_COMPILED = path.resolve( __dirname, - "../../onchain/cairo/target/dev/afk_UsernameStore.compiled_contract_class.json" + "../../onchain/cairo/games/target/dev/afk_games_UsernameStore.compiled_contract_class.json" ); /** @TODO spec need to be discuss. This function serve as an example */ diff --git a/scripts/utils/pixel/pixel_quest.ts b/scripts/utils/pixel/pixel_quest.ts index 216927dbb..c388677de 100644 --- a/scripts/utils/pixel/pixel_quest.ts +++ b/scripts/utils/pixel/pixel_quest.ts @@ -8,13 +8,13 @@ import { provider } from "../starknet"; import path from "path"; dotenv.config(); -const PATH_ART_PEACE = path.resolve( +const PATH_QUEST = path.resolve( __dirname, - "../../onchain/cairo/target/dev/afk_UsernameStore.contract_class.json" + "../../onchain/cairo/games/target/dev/afk_games_Quest.contract_class.json" ); -const PATH_ART_PEACE_COMPILED = path.resolve( +const PATH_QUEST_COMPILED = path.resolve( __dirname, - "../../onchain/cairo/target/dev/afk_UsernameStore.compiled_contract_class.json" + "../../onchain/cairo/games/target/dev/afk_games_Quest.compiled_contract_class.json" ); /** @TODO spec need to be discuss. This function serve as an example */ @@ -31,10 +31,10 @@ export const createQuest = async ( let UsernameStoreClassHash = process.env.USERNAME_STORE_CLASS_HASH as string; const compiledSierraAAaccount = json.parse( - fs.readFileSync(PATH_ART_PEACE).toString("ascii") + fs.readFileSync(PATH_QUEST).toString("ascii") ); const compiledAACasm = json.parse( - fs.readFileSync(PATH_ART_PEACE_COMPILED).toString("ascii") + fs.readFileSync(PATH_QUEST_COMPILED).toString("ascii") ); /** Get class hash account */ diff --git a/scripts/utils/pixel/quest_tap.ts b/scripts/utils/pixel/quest_tap.ts index 216927dbb..9ce1bfba6 100644 --- a/scripts/utils/pixel/quest_tap.ts +++ b/scripts/utils/pixel/quest_tap.ts @@ -8,13 +8,13 @@ import { provider } from "../starknet"; import path from "path"; dotenv.config(); -const PATH_ART_PEACE = path.resolve( +const PATH_TAP_QUEST = path.resolve( __dirname, - "../../onchain/cairo/target/dev/afk_UsernameStore.contract_class.json" + "../../onchain/cairo/games/target/dev/afk_games_TapQuests.contract_class.json" ); -const PATH_ART_PEACE_COMPILED = path.resolve( +const PATH_TAP_QUEST_COMPILED = path.resolve( __dirname, - "../../onchain/cairo/target/dev/afk_UsernameStore.compiled_contract_class.json" + "../../onchain/cairo/games/target/dev/afk_games_TapQuests.compiled_contract_class.json" ); /** @TODO spec need to be discuss. This function serve as an example */ @@ -31,10 +31,10 @@ export const createQuest = async ( let UsernameStoreClassHash = process.env.USERNAME_STORE_CLASS_HASH as string; const compiledSierraAAaccount = json.parse( - fs.readFileSync(PATH_ART_PEACE).toString("ascii") + fs.readFileSync(PATH_TAP_QUEST).toString("ascii") ); const compiledAACasm = json.parse( - fs.readFileSync(PATH_ART_PEACE_COMPILED).toString("ascii") + fs.readFileSync(PATH_TAP_QUEST_COMPILED).toString("ascii") ); /** Get class hash account */ diff --git a/scripts/utils/quest.ts b/scripts/utils/quest.ts index 12457a4e7..f00c505d1 100644 --- a/scripts/utils/quest.ts +++ b/scripts/utils/quest.ts @@ -8,11 +8,11 @@ import { provider } from "./starknet"; import path from "path"; dotenv.config(); -const PATH_ART_PEACE = path.resolve( +const PATH_QUEST = path.resolve( __dirname, "../../onchain/cairo/target/dev/afk_UsernameStore.contract_class.json" ); -const PATH_ART_PEACE_COMPILED = path.resolve( +const PATH_QUEST_COMPILED = path.resolve( __dirname, "../../onchain/cairo/target/dev/afk_UsernameStore.compiled_contract_class.json" ); @@ -31,10 +31,10 @@ export const createQuest = async ( let UsernameStoreClassHash = process.env.USERNAME_STORE_CLASS_HASH as string; const compiledSierraAAaccount = json.parse( - fs.readFileSync(PATH_ART_PEACE).toString("ascii") + fs.readFileSync(PATH_QUEST).toString("ascii") ); const compiledAACasm = json.parse( - fs.readFileSync(PATH_ART_PEACE_COMPILED).toString("ascii") + fs.readFileSync(PATH_QUEST_COMPILED).toString("ascii") ); /** Get class hash account */ diff --git a/turbo.json b/turbo.json index a9c3d3ae8..4329ac7c5 100644 --- a/turbo.json +++ b/turbo.json @@ -89,7 +89,8 @@ "TELEGRAM_MOBILE_APP", "EXPO_PUBLIC_PIXEL_URL", "NEXT_PUBLIC_BACKEND_URL", - "NEXT_PUBLIC_NODE_ENV" + "NEXT_PUBLIC_NODE_ENV", + "EXPO_PUBLIC_WC_ID" ] }, "run": { @@ -105,7 +106,8 @@ "NEXT_PUBLIC_WALLET_CONNECT_ID", "EXPO_PUBLIC_PIXEL_URL", "NEXT_PUBLIC_BACKEND_URL", - "NEXT_PUBLIC_NODE_ENV" + "NEXT_PUBLIC_NODE_ENV", + "EXPO_PUBLIC_WC_ID" ] }, "deploy": {