solana_web3_sys/
wallet.rs1use crate::imports::*;
6use crate::prelude::Connection;
7use crate::transaction::*;
8
9#[wasm_bindgen]
10extern "C" {
11 #[wasm_bindgen(js_namespace=solanaWeb3, js_name = PhantomWalletAdapter)]
12 #[derive(Debug, Clone)]
13 pub type WalletAdapter;
16
17 #[wasm_bindgen(getter, method, js_namespace=solanaWeb3, js_name = "publicKey")]
18 pub fn pubkey(this: &WalletAdapter) -> JsValue;
21
22 #[wasm_bindgen(method, catch, js_namespace=solanaWeb3, js_name = "signTransaction")]
23 pub async fn sign_transaction_impl(this: &WalletAdapter, tx: Transaction) -> Result<JsValue>;
26
27 #[wasm_bindgen(method, catch, js_namespace=solanaWeb3, js_name = "signAndSendTransaction")]
28 pub async fn sign_and_send_transaction(
31 this: &WalletAdapter,
32 tx: Transaction,
33 ) -> Result<JsValue>;
34
35 #[wasm_bindgen(method, catch, js_namespace=solanaWeb3, js_name = "sendTransaction")]
36 pub async fn send_transaction(
39 this: &WalletAdapter,
40 tx: Transaction,
41 con: Connection,
42 ) -> Result<JsValue>;
43}
44
45impl WalletAdapter {
46 pub async fn sign_transaction(&self, tx: &Transaction) -> Result<JsValue> {
47 self.sign_transaction_impl(tx.clone()).await
48 }
49}