-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72f9b29
commit 4329202
Showing
7 changed files
with
119 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,11 @@ | ||
// Chrome Extension Wallet Adaptor | ||
|
||
use crate::imports::*; | ||
use wasm_bindgen::prelude::*; | ||
|
||
struct Inner { | ||
#[allow(dead_code)] | ||
runtime: Runtime, | ||
pub enum WebEvent { | ||
AccountSelection(AccountId), | ||
} | ||
|
||
impl Inner { | ||
pub fn new(runtime: Runtime) -> Self { | ||
Self { runtime } | ||
} | ||
pub trait AdaptorApi: Sync + Send { | ||
fn post_to_server(&self, event: WebEvent); | ||
} | ||
|
||
#[wasm_bindgen] | ||
pub struct Adaptor { | ||
#[allow(dead_code)] | ||
inner: Arc<Inner>, | ||
} | ||
|
||
impl Adaptor { | ||
pub fn new(runtime: Runtime) -> Self { | ||
Self { | ||
inner: Arc::new(Inner::new(runtime.clone())), | ||
} | ||
} | ||
} | ||
|
||
#[wasm_bindgen] | ||
impl Adaptor { | ||
#[wasm_bindgen(js_name = "sendTransaction")] | ||
pub fn send_transaction(&self) -> Result<()> { | ||
Ok(()) | ||
} | ||
} | ||
|
||
// static mut ADAPTOR : Option<Adaptor> = None; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.