Skip to content

Commit 65024b1

Browse files
author
Ildar Timerbaev
committed
Added SDK create wallet docs
1 parent d46a247 commit 65024b1

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

astro.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ export default defineConfig({
9595
{ label: "What is it?", slug: "hivesigner/about" },
9696
],
9797
},
98+
{
99+
label: "SDK",
100+
items: [
101+
{
102+
label: "External wallets",
103+
slug: "sdk/wallets",
104+
},
105+
],
106+
},
98107
{
99108
label: "FAQ",
100109
slug: "faq",

src/content/docs/sdk/wallets.mdx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: External wallets
3+
---
4+
5+
import { Code } from "@astrojs/starlight/components";
6+
import { Aside } from "@astrojs/starlight/components";
7+
8+
Any user in a Ecency system can create/import external tokens to account. It helps different clients and Ecency to operate with these tokens, show overview or detailed view etc.
9+
10+
### Storage
11+
12+
Each token's public information is storing in two places:
13+
14+
1. **Private Ecency API** – uses for Ecency only purposes, strong-safe place;
15+
2. **Profile metadata** – can be used in any Hive client, weak-safe place, could be overrided by any client.
16+
17+
### Create a wallet
18+
19+
To create a wallet SDK provides mutations and automatically set it to query. No need to handle it automatically.
20+
21+
export const exampleCode = `
22+
import { useWalletCreate, EcencyWalletCurrency } from '@ecency/sdk';
23+
24+
const username = 'demo.com';
25+
const currency = EcencyWalletCurrency.BTC;
26+
27+
const { mutateAsync: createWallet } = useWalletCreate(username, currency);
28+
29+
// Wallets contains all wallets in a Record<EcencyWalletCurrency, {...}> format
30+
const { data: wallets } = useQuery({ queryKey: ["ecency-wallets", "wallets", username] })
31+
`;
32+
export const fileName = "create-wallet.ts";
33+
34+
<Code code={exampleCode} lang="ts" title={fileName} />
35+
36+
<Aside type="caution">
37+
Created wallets exists only in current session. Wallets haven't published
38+
anywhere on this step. Saving to private API or metadata are different
39+
mutations.
40+
</Aside>

0 commit comments

Comments
 (0)