Open g00nix opened 2 years ago
@g00nix good question. You can use the window
object for the purpose. But when we use Rust
, we want strong typed api. That's why I bind the solana.js
instead of call the connect function directly.
BTW, I am working on a native RPC api in Rust
. You can check it out. It would be better.
https://github.com/russellwmy/web3-rs
BTW, I am working on a native RPC api in Rust. You can check it out. It would be better. https://github.com/russellwmy/web3-rs
looks great! I will keep an eye on that!
That's why I bind the solana.js instead of call the connect function directly.
Regarding this, do you know how we could suppress this warning?
warning: unused manifest key: package.author
warning: static variable `solana` should have an upper case name
--> src/phantom.rs:13:16
|
13 | pub static solana: Solana;
| ^^^^^^ help: convert the identifier to upper case: `SOLANA`
|
= note: `#[warn(non_upper_case_globals)]` on by default
warning: `solana-dapp-example` (bin "solana-dapp-example") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.23s
BTW, I am working on a native RPC api in Rust. You can check it out. It would be better. https://github.com/russellwmy/web3-rs
looks great! I will keep an eye on that!
That's why I bind the solana.js instead of call the connect function directly.
Regarding this, do you know how we could suppress this warning?
warning: unused manifest key: package.author warning: static variable `solana` should have an upper case name --> src/phantom.rs:13:16 | 13 | pub static solana: Solana; | ^^^^^^ help: convert the identifier to upper case: `SOLANA` | = note: `#[warn(non_upper_case_globals)]` on by default warning: `solana-dapp-example` (bin "solana-dapp-example") generated 1 warning Finished dev [unoptimized + debuginfo] target(s) in 0.23s
You can use #[allow(non_upper_case_globals)]
@russellwmy does this work for you?
Hello Russel,
First of all, congrats on making this work. I find this repo exceptionally cool. You earned your star.
I was under the impression that a JS binding was required in order to connect to phantom, like so: in your Rust app:
and in
/js/solana.js
:However I see all you have is https://github.com/russellwmy/yew-dapp-examples/blob/main/solana-dapp-example/src/phantom.rs.
I suspect wasm can do an implicit binding to JS Objects that already exist under
window.
, but I think some extra documentation (maybe comments) would help to better understand the behavior.Thank you, g00nix