Skip to content

Commit fa1fcee

Browse files
committed
improve wallets page
1 parent 767b98e commit fa1fcee

File tree

2 files changed

+52
-22
lines changed

2 files changed

+52
-22
lines changed

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default defineConfig({
8787
{
8888
label: "Developers",
8989
items: [
90-
{ label: "Ecency SDK", slug: "developers/wallets" },
90+
{ label: "Ecency wallets", slug: "developers/wallets" },
9191
{ label: "Ecency chats", slug: "developers/chats" },
9292
{ label: "Ecency analytics", slug: "developers/analytics" },
9393
{ label: "API Reference", slug: "developers/api" }, // if you later add this

src/content/docs/developers/wallets.mdx

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,70 @@
11
---
2-
title: External wallets
2+
title: Ecency wallets
33
---
44

55
import { Code } from "@astrojs/starlight/components";
66
import { Aside } from "@astrojs/starlight/components";
77

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.
8+
Ecency wallets replaces the older Ecency SDK experience and focuses purely on
9+
wallet-related operations across the Ecency website and mobile app. The new
10+
`@ecency/wallets` package gives us a single, dedicated layer for creating and
11+
managing wallets while keeping the rest of the Ecency stack lightweight.
912

10-
### Storage
13+
## Standard seed phrase, multi-chain addresses
1114

12-
Each token's public information is storing in two places:
15+
We utilize a blockchain-standard seed phrase to derive wallet addresses across
16+
different blockchains. A single mnemonic can be used to:
1317

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.
18+
1. Generate addresses for multiple supported chains without asking the user to
19+
juggle several keys.
20+
2. Keep derivation compatible with common wallet tooling, so the same seed can
21+
be recovered in other BIP39-style wallets.
22+
3. Sync addresses between web and mobile clients while still letting each
23+
client enforce its own encryption and secure storage policies.
1624

17-
### Create a wallet
25+
<Aside type="note">
26+
The seed phrase never leaves the client. When a wallet needs to be backed up
27+
or restored, the mnemonic is provided by the user, and derived addresses are
28+
synced to Ecency services only after local encryption is applied.
29+
</Aside>
30+
31+
## What `@ecency/wallets` handles
32+
33+
`@ecency/wallets` is scoped to wallet functionality so the rest of the Ecency
34+
codebase can stay focused on social and content features. The package is
35+
responsible for:
36+
37+
- Generating or importing the mnemonic that seeds all derived addresses.
38+
- Deriving per-chain addresses from the same seed phrase, so Ecency can surface
39+
balances and transactions for multiple blockchains.
40+
- Publishing public wallet metadata to Ecency services when users choose to
41+
make their addresses available.
1842

19-
To create a wallet SDK provides mutations and automatically set it to query. No need to handle it automatically.
43+
## Example: derive addresses from a mnemonic
44+
45+
The snippet below shows the general flow for creating a mnemonic and deriving a
46+
set of addresses. The exact API surface may evolve, but the key steps—create or
47+
import a seed, derive addresses for requested chains, and persist only the
48+
public detailsremain the same.
2049

2150
export const exampleCode = `
22-
import { useWalletCreate, EcencyWalletCurrency } from '@ecency/sdk';
51+
import { createWalletClient } from '@ecency/wallets';
52+
53+
// Create a client for wallet-only operations in web or mobile apps
54+
const walletClient = createWalletClient();
2355
24-
const username = 'demo.com';
25-
const currency = EcencyWalletCurrency.BTC;
56+
// Either generate or import a mnemonic
57+
const mnemonic = await walletClient.createMnemonic();
2658
27-
const { mutateAsync: createWallet } = useWalletCreate(username, currency);
59+
// Derive addresses for the chains you need to display in Ecency
60+
const addresses = await walletClient.deriveAddresses({
61+
mnemonic,
62+
chains: ['hive', 'bitcoin', 'ethereum'],
63+
});
2864
29-
// Wallets contains all wallets in a Record<EcencyWalletCurrency, {...}> format
30-
const { data: wallets } = useQuery({ queryKey: ["ecency-wallets", "wallets", username] })
65+
// Store only public addresses with Ecency services; keep the mnemonic local
66+
await walletClient.publishPublicWallets({ addresses });
3167
`;
32-
export const fileName = "create-wallet.ts";
68+
export const fileName = "wallets.ts";
3369

3470
<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)