Ame1ma / solana-monopoly-game

Solana on-chain monopoly game written by Dioxus and Anchor | 使用 Dioxus 和 Anchor 编写的 Solana 链上大富翁游戏
https://solana-monopoly-game-frontend-deploy-1j2d63jo-ame1ma.4everland.app/
MIT License
3 stars 1 forks source link

Installation frontend error #1

Closed Boyquotes closed 2 months ago

Boyquotes commented 2 months ago

I have follow instructions and the anchor build and deploy works fines, the dx build --release works but when I serve the content qith dx sever --hot-reload and I load the home page, everything look ok but when I click on the wallet button I got this error :

monopoly_frontend.js:268 wasm-bindgen: imported JS function that was not marked as `catch` threw an error: solana is not defined

Stack:
ReferenceError: solana is not defined

I have comment the base_path option in Dioxus.toml because I use the root ip eg: my-ip:8080/

Have you an idea why solana lib was not found despites she is on the Cargo.toml file in the dependencies section ?

My rust toolchain versions:

rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.79.0 (129f3b996 2024-06-10)`
rustc 1.79.0 (129f3b996 2024-06-10)
cargo 1.79.0 (ffa9cf99a 2024-06-03)
solana-cli 1.18.14 (src:d8e08244; feat:4215500110, client:SolanaLabs)
anchor-cli 0.29.0
Ame1ma commented 2 months ago

Hello, you need to install the Phantom Wallet Extension on your browser.

The solana here does not refer to the solana lib crate in Cargo.toml, but rather to the JavaScript SDK object injected into the page by the Phantom Wallet Extension, https://docs.phantom.app/solana/detecting-the-provider.

The Rust code calls the method of this JavaScript object through wasm_bindgen to sign and send transactions to the Sonala blockchain.

Boyquotes commented 2 months ago

Hi, you have rigth, I have a problem with my server conf(maybe extension or cache browser in chrome, but the same with another browser brave...) and wallet, I don't know why but phantom or talisman was not loaded/regonize like installed when I run react app with solana web3js or polkadot js api in the dApp, the same for dioxus, in localhost or for this case a github pages deploy fix the problem. Thanks!

https://github.com/Boyquotes/solana-monopoly-game-deploy

Ame1ma commented 2 months ago

I get it.You are welcome.