forked from nostr-dev-kit/ndk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
25,383 additions
and
19,563 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,29 +1,29 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node | ||
{ | ||
"name": "NDK devcontainer", | ||
"build": { | ||
// Path is relative to the devcontainer.json file. | ||
"dockerfile": "Dockerfile", | ||
"context": "../" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
} | ||
} | ||
}, | ||
// Add pnpm bin to path, so we have turbo available | ||
"postStartCommand": "echo 'export PATH=$(pnpm bin):$PATH' >> ~/.bashrc && . ~/.bashrc" | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} | ||
"name": "NDK devcontainer", | ||
"build": { | ||
// Path is relative to the devcontainer.json file. | ||
"dockerfile": "Dockerfile", | ||
"context": "../" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
} | ||
} | ||
}, | ||
// Add pnpm bin to path, so we have turbo available | ||
"postStartCommand": "echo 'export PATH=$(pnpm bin):$PATH' >> ~/.bashrc && . ~/.bashrc" | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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 |
---|---|---|
|
@@ -18,4 +18,3 @@ pnpm install | |
cd ndk | ||
pnpm build | ||
``` | ||
|
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 |
---|---|---|
|
@@ -40,4 +40,4 @@ to this list. | |
- Stateful wrapper library of React hooks around NDK. | ||
- [magicCity h=n](https://github.com/tezosmiami/hicetnunc) - By [@hicetnunc2000](https://github.com/hicetnunc2000/), [@tezosmiami](https://njump.me/npub190rqwj0nud4uhvmaeg7cgn0gypu0s09j87vqjluhfhju0req2khsskh9w7) | ||
- [notepress](https://github.com/utxo-one/notepress) - By [@utxo](httsp://njump.me/[email protected]) | ||
- No frameworks! A very simple long-form (NIP-23) reader | ||
- No frameworks! A very simple long-form (NIP-23) reader |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Discover wallets | ||
|
||
A user might have configured your application to use a specific wallet (e.g. via WebLN), or they could be | ||
interfacing with your application with a NIP-60 wallet created somewhere else. | ||
|
||
Additionally, a user might have NIP-61 nutzaps enabled. | ||
|
||
The `NDKWalletService` provides a simple interface to handle these cases: | ||
* Configure + Discover configured wallets | ||
* See NIP-61 nutzaps | ||
|
||
## Discovering configured wallets | ||
```typescript | ||
const walletService = new NDKWalletService(ndk); | ||
|
||
walletService.start(); | ||
walletService.on("wallet", (wallet: NDKWallet, isDefault: boolean) => { | ||
console.log("Found a wallet of type " + wallet.type, isDefault ? "(default)" : ""); | ||
}); | ||
``` | ||
|
||
`walletService.start()` will do the following: | ||
* If you have established a client name via `ndk.clientName`, it will look for a NIP-78 configuration | ||
|
||
## Configuring a wallet for your application | ||
```typescript | ||
ndk.clientName = 'my-application'; | ||
const walletService = new NDKWalletService(ndk); | ||
const wallet = new NDKWebLNWallet(); | ||
await walletService.setDefaultWallet(wallet); | ||
``` | ||
|
||
`walletService.setDefaultWallet(wallet)` will add to your applications's NIP-78, the configuration to be able to use this wallet next time your application starts, next time your application is initialized, `walletService.start()` will emit a `wallet` event for this wallet. | ||
|
||
## Seeing NIP-61 nutzaps | ||
```typescript | ||
const walletService = new NDKWalletService(ndk); | ||
walletService.start(); | ||
walletService.on("nutzap", (nutzap: NDKNutzap) => { | ||
console.log("Received a nutzap from " + nutzap.pubkey + " for " + nutzap.amount + " " + nutzap.unit + " on mint " + nutzap.mint); | ||
// -> "Received a nutzap from fa98..... for 1 usd on mint https://..." | ||
}); | ||
``` | ||
|
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
Oops, something went wrong.