-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: gradient on docs home * chore: reorganize docs * feat: add head meta for docs * feat: docs progress * feat: added a bunch of docs * feat: removed bolt11 from function names * chore: changeset * fix: dead links
- Loading branch information
1 parent
7ea5b6d
commit ada54ce
Showing
53 changed files
with
549 additions
and
763 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@fedimint/core-web': patch | ||
--- | ||
|
||
Shortened lightning function names to omit "Bolt11". (createBolt11Invoice --> createInvoice |
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
@alexlwn123 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[View Contributing Guide on our docs page](https://web.fedimint.org/dev/contributing) |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
![GitHub License](https://img.shields.io/github/license/fedimint/fedimint-web-sdk?style=plastic&color=blue&link=https%3A%2F%2Fgithub.com%2Ffedimint%2Ffedimint-web-sdk%2Fblob%2Fmain%2FLICENSE) | ||
![NPM Version (latest)](<https://img.shields.io/npm/v/%40fedimint%2Fcore-web?style=plastic&logo=npm&logoColor=rgb(187%2C%2054%2C%2057)&label=%40fedimint%2Fcore-web&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40fedimint%2Fcore-web>) | ||
![Docs Workflow](https://img.shields.io/github/actions/workflow/status/fedimint/fedimint-web-sdk/deploy-docs.yml?style=plastic&label=Docs%20Site&color=%2303b1fc&link=https%3A%2F%2Fweb.fedimint.org%2F) | ||
![Release Workflow](https://img.shields.io/github/actions/workflow/status/fedimint/fedimint-web-sdk/.github%2Fworkflows%2Fchangesets.yml?style=plastic&label=Test%20%26%20Release&color=green) | ||
|
||
# Fedimint Web SDK Monorepo | ||
|
||
### Docs Site: [web.fedimint.org](https://web.fedimint.org) | ||
|
||
--- | ||
|
||
### Structure | ||
|
||
This monorepo is structured as a pnpm workspace. There are some helpful scripts in the root `package.json` to help manage the workspace. | ||
|
||
```bash | ||
fedimint-web-sdk | ||
├── README.md | ||
├── examples | ||
│ ├── vite-core | ||
│ └── bare-js | ||
└── packages | ||
├── core-web | ||
├── react | ||
├── wasm-web | ||
└── wasm-bundler | ||
``` | ||
|
||
### Packages | ||
|
||
- [`core-web`](https://web.fedimint.org/docs/core/getting-started): Provides a typescript interface for the Fedimint client wasm. | ||
- `react`: TBD - React components and hooks for interacting with the Fedimint client | ||
- [`wasm-web`](../packages/wasm-web/README.md): Not intended for direct use. Contains the wasm pack output (target web) for the Fedimint client wasm. | ||
- [`wasm-bundler`](../packages/wasm-bundler/README.md): Not intended for direct use. Contains the wasm pack output (target bundler) for the Fedimint client wasm. | ||
|
||
### Examples | ||
|
||
- [`vite-core`](../examples/vite-core/README.md): Simple example of how to use the `core-web` package within a React app bundled with Vite. | ||
- [`bare-js`](../examples/bare-js/README.md): Simple example of how to use the `core-web` package in a bare javascript environment (no bundler) | ||
|
||
### Credit | ||
|
||
Used the [wagmi](https://github.com/wevm/wagmi) library as a reference for the repo's structure. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,116 @@ | ||
import type { DefaultTheme } from 'vitepress' | ||
import typedocSidebar from '../core/api/typedoc-sidebar.json' | ||
|
||
export function getSidebar() { | ||
return { | ||
'/core/': [ | ||
{ | ||
text: 'Getting Started', | ||
base: '/core/', | ||
text: 'Introduction', | ||
items: [ | ||
{ text: 'Overview', link: '/core/overview' }, | ||
{ text: 'Installation', link: '/core/getting-started' }, | ||
{ text: 'Architecture', link: '/core/architecture' }, | ||
{ text: 'Overview', link: 'overview' }, | ||
{ text: 'Getting Started', link: 'getting-started' }, | ||
{ text: 'Architecture', link: 'architecture' }, | ||
], | ||
}, | ||
...FedimintWalletSidebar, | ||
{ | ||
text: 'API', | ||
link: '/core/api/index.md', | ||
items: typedocSidebar, | ||
text: 'Dev', | ||
base: '/core/dev/', | ||
items: [ | ||
{ text: 'Contributing', link: 'contributing' }, | ||
{ text: 'Testing', link: 'testing' }, | ||
], | ||
}, | ||
], | ||
} satisfies DefaultTheme.Sidebar | ||
} | ||
|
||
const FedimintWalletSidebar = [ | ||
{ | ||
text: 'FedimintWallet', | ||
link: '.', | ||
base: '/core/FedimintWallet/', | ||
items: [ | ||
{ | ||
text: 'new FedimintWallet()', | ||
link: 'constructor', | ||
}, | ||
{ | ||
text: 'setLogLevel()', | ||
link: 'setLogLevel', | ||
}, | ||
{ | ||
text: 'joinFederation()', | ||
link: 'joinFederation', | ||
}, | ||
{ | ||
text: 'initialize()', | ||
link: 'initialize', | ||
}, | ||
{ | ||
text: 'TEMP', | ||
text: 'isOpen()', | ||
link: 'isOpen', | ||
}, | ||
{ | ||
text: 'cleanup()', | ||
link: 'cleanup', | ||
}, | ||
{ | ||
text: 'BalanceService', | ||
base: '/core/FedimintWallet/BalanceService/', | ||
items: [ | ||
{ text: 'Markdown Examples', link: '/temp/markdown-examples' }, | ||
{ text: 'Runtime API Examples', link: '/temp/api-examples' }, | ||
{ text: 'getBalance()', link: 'getBalance' }, | ||
{ text: 'subscribeBalance()', link: 'subscribeBalance' }, | ||
], | ||
}, | ||
], | ||
'/dev/': [ | ||
{ | ||
text: 'Dev', | ||
text: 'LightningService', | ||
base: '/core/FedimintWallet/LightningService/', | ||
items: [ | ||
{ text: 'Contributing', link: '/dev/contributing' }, | ||
{ text: 'Testing', link: '/dev/testing' }, | ||
{ text: 'Docs TODO' }, | ||
// { text: 'payInvoice()', link: 'payInvoice' }, | ||
// { text: 'createInvoice()', link: 'createInvoice' }, | ||
// { | ||
// text: 'createInvoiceWithGateway()', | ||
// link: 'createInvoiceWithGateway', | ||
// }, | ||
// { text: 'subscribeInvoiceStatus()', link: 'subscribeInvoiceStatus' }, | ||
// { text: 'subscribeLnPay()', link: 'subscribeLnPay' }, | ||
// { text: 'subscribeLnReceive()', link: 'subscribeLnReceive' }, | ||
// { text: 'listGateways()', link: 'listGateways' }, | ||
// { text: 'getGateway()', link: 'getGateway' }, | ||
// { text: 'updateGatewayCache()', link: 'updateGatewayCache' }, | ||
], | ||
}, | ||
{ | ||
text: 'MintService', | ||
base: '/core/FedimintWallet/MintService/', | ||
items: [{ text: 'Docs TODO' }], | ||
}, | ||
{ | ||
text: 'FederationService', | ||
base: '/core/FedimintWallet/FederationService/', | ||
items: [{ text: 'Docs TODO' }], | ||
}, | ||
{ | ||
text: 'RecoveryService', | ||
base: '/core/FedimintWallet/RecoveryService/', | ||
items: [{ text: 'Docs TODO' }], | ||
}, | ||
], | ||
} satisfies DefaultTheme.Sidebar | ||
} | ||
}, | ||
{ | ||
text: 'Type Aliases', | ||
collapsed: true, | ||
base: '/core/type-aliases/', | ||
items: [ | ||
{ text: 'CreateResponse', link: 'CreateResponse' }, | ||
{ text: 'FeeToAmount', link: 'FeeToAmount' }, | ||
{ text: 'LightningGateway', link: 'LightningGateway' }, | ||
{ text: 'LnPayState', link: 'LnPayState' }, | ||
{ text: 'OutgoingLightningPayment', link: 'OutgoingLightningPayment' }, | ||
{ text: 'PayType', link: 'PayType' }, | ||
{ text: 'RouteHint', link: 'RouteHint' }, | ||
], | ||
}, | ||
] |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
:root { | ||
--vp-home-hero-name-color: transparent; | ||
--vp-home-hero-name-background: -webkit-linear-gradient( | ||
120deg, | ||
#bd34fe 30%, | ||
#41d1ff | ||
); | ||
|
||
--vp-home-hero-image-background-image: linear-gradient( | ||
-45deg, | ||
rgba(189, 52, 254, 0.3) 50%, | ||
rgba(71, 202, 255, 0.3) 50% | ||
); | ||
--vp-home-hero-image-filter: blur(68px); | ||
} | ||
|
||
@media (min-width: 640px) { | ||
:root { | ||
--vp-home-hero-image-filter: blur(88px); | ||
} | ||
} | ||
|
||
@media (min-width: 960px) { | ||
:root { | ||
--vp-home-hero-image-filter: blur(120px); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import DefaultTheme from 'vitepress/theme' | ||
import './custom.css' | ||
|
||
export default DefaultTheme |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Get Balance | ||
|
||
### `balance.getBalance()` | ||
|
||
Get the current balance of the wallet. | ||
|
||
```ts | ||
// const wallet = new FedimintWallet() | ||
// wallet.open() | ||
|
||
const mSats = await wallet.balance.getBalance() | ||
|
||
// 1000 mSats = 1 satoshi | ||
``` |
18 changes: 18 additions & 0 deletions
18
docs/core/FedimintWallet/BalanceService/subscribeBalance.md
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Subscribe Balance | ||
|
||
### `balance.subscribeBalance()` <Badge type="info" text="Streaming" /> | ||
|
||
Subscribe to balance updates as they occur. | ||
|
||
```ts | ||
// const wallet = new FedimintWallet() | ||
// wallet.open() | ||
|
||
const unsubscribe = wallet.balance.subscribeBalance((mSats) => { | ||
console.log('Balance updated:', mSats) | ||
// 1000 mSats = 1 satoshi | ||
}) | ||
|
||
// ...Cleanup Later | ||
unsubscribe() | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This guide hasn't been written yet. | ||
|
||
If you'd like to contribute, please open a PR! | ||
|
||
You can use the `Edit This Page` link below. |
Oops, something went wrong.