-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: fix react exmaple * fix: convert amount fields to amountMsats * feat: add several docs pages
- Loading branch information
1 parent
649b296
commit 9468ef5
Showing
11 changed files
with
126 additions
and
29 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 | ||
--- | ||
|
||
Rename amount fields to include units: (e.g., amountMsats) |
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,5 +1,22 @@ | ||
This guide hasn't been written yet. | ||
# cleanup | ||
|
||
If you'd like to contribute, please open a PR! | ||
### `cleanup()` | ||
|
||
You can use the `Suggest changes to this page` link below. | ||
Cleans up browser resources associated with the wallet. This should be called when the wallet is no longer needed. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
await wallet.open() | ||
// ... use the wallet | ||
|
||
// Once we're no longer using the wallet, // [!code focus] | ||
// we can call cleanup to free up resources // [!code focus] | ||
await wallet.cleanup() // [!code focus] | ||
|
||
// If we want to use the wallet again, we can call open() again | ||
await wallet.open() | ||
``` |
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,5 +1,20 @@ | ||
This guide hasn't been written yet. | ||
# open | ||
|
||
If you'd like to contribute, please open a PR! | ||
### `isOpen()` | ||
|
||
You can use the `Suggest changes to this page` link below. | ||
Check if the wallet is open. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
const isOpen = wallet.isOpen() // [!code focus] | ||
|
||
if (!isOpen) { | ||
await wallet.joinFederation('fed123...') | ||
} else { | ||
const balance = await wallet.balance.getBalance() | ||
} | ||
``` |
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,5 +1,29 @@ | ||
This guide hasn't been written yet. | ||
# joinFederation | ||
|
||
If you'd like to contribute, please open a PR! | ||
### `joinFederation(federationId: string)` | ||
|
||
You can use the `Suggest changes to this page` link below. | ||
Attempts to join a federation. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
const didJoin = await wallet.joinFederation('fed123...') // [!code focus] | ||
|
||
if (didJoin) { | ||
const balance = await wallet.balance.getBalance() | ||
} | ||
``` | ||
|
||
To support multiple wallets within a single application, you can pass in a custom client name. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
const didJoin = await wallet.joinFederation('fed456...', 'my-client-name') // [!code focus] | ||
``` |
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,5 +1,33 @@ | ||
This guide hasn't been written yet. | ||
# open | ||
|
||
If you'd like to contribute, please open a PR! | ||
### `open(clientName?: string)` | ||
|
||
You can use the `Suggest changes to this page` link below. | ||
Attempts to open an existing wallet. | ||
|
||
Default client name is `fm-wallet`. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
const isOpen = await wallet.open() // [!code focus] | ||
|
||
if (isOpen) { | ||
const balance = await wallet.balance.getBalance() | ||
} else { | ||
await wallet.joinFederation('fed123...') | ||
} | ||
``` | ||
|
||
To support multiple wallets within a single application, you can pass in a custom client name. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
const isOpen = await wallet.open('my-client-name') // [!code focus] | ||
``` |
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,5 +1,14 @@ | ||
This guide hasn't been written yet. | ||
# setLogLevel | ||
|
||
If you'd like to contribute, please open a PR! | ||
### `setLogLevel()` | ||
|
||
You can use the `Suggest changes to this page` link below. | ||
Set the log level for the wallet. | ||
|
||
```ts twoslash | ||
// @esModuleInterop | ||
import { FedimintWallet } from '@fedimint/core-web' | ||
|
||
const wallet = new FedimintWallet() | ||
|
||
wallet.setLogLevel('debug') // [!code focus] | ||
``` |
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