improve DX for additional account creation

master
Niko PLP 2 weeks ago
parent e3e04ce1bd
commit f3ffc5ce70
  1. 12
      DEV.md
  2. 9
      ng-app/src/routes/WalletCreate.svelte
  3. 8
      ng-sdk-js/src/lib.rs

@ -72,7 +72,17 @@ cargo run -p ngcli -- --save-key --save-config -s 127.0.0.1,14400,<PEER_ID_OF_SE
### Adding more accounts and wallets
In your dev env, if you want to create more wallets and accounts, you need to run a local instance of `ngaccount`.
In your dev env, if you want to create more wallets and accounts, you have 2 options:
- creating an invitation link from the admin account
```
cargo run -p ngcli -- -s 127.0.0.1,14400,<PEER_ID_OF_SERVER> -u <THE_PRIVATE_KEY_OF_THE_USER_YOU_JUST_CREATED> admin add-invitation --notos
```
and then open the link after replacing the port number from `14400` to `1421`.
- run a local instance of `ngaccount`. this is useful if you want to test or develop the ngaccount part of the flow..
See the [README of ngaccount here](ngaccount/README.md).

@ -195,9 +195,10 @@
invitation = await ng.decode_invitation(param.get("i"));
window.location.replace(window.location.href.split("?")[0]);
} else if (param.get("i")) {
invitation = await ng.get_local_bootstrap(
invitation = await ng.get_local_bootstrap_with_public(
location.href,
param.get("i")
param.get("i"),
import.meta.env.PROD
);
console.log("invitation", invitation);
if (invitation && invitation.V0.url) {
@ -215,7 +216,9 @@
}
} else {
pre_invitation = await ng.get_local_bootstrap_with_public(
location.href
location.href,
undefined,
true
);
console.log("pre_invitation", pre_invitation);
}

@ -78,8 +78,12 @@ pub async fn get_local_bootstrap(location: String, invite: JsValue) -> JsValue {
}
#[wasm_bindgen]
pub async fn get_local_bootstrap_with_public(location: String, invite: JsValue) -> JsValue {
let res = retrieve_local_bootstrap(location, invite.as_string(), true).await;
pub async fn get_local_bootstrap_with_public(
location: String,
invite: JsValue,
must_be_public: bool,
) -> JsValue {
let res = retrieve_local_bootstrap(location, invite.as_string(), must_be_public).await;
if res.is_some() {
serde_wasm_bindgen::to_value(&res.unwrap()).unwrap()
} else {

Loading…
Cancel
Save