Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: also include lud16 in nwc success event #1057

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,19 @@ func (api *api) CreateApp(createAppRequest *CreateAppRequest) (*CreateAppRespons

relayUrl := api.cfg.GetRelayUrl()

lightningAddress, err := api.albyOAuthSvc.GetLightningAddress()
if err != nil {
return nil, err
}

responseBody := &CreateAppResponse{}
responseBody.Id = app.ID
responseBody.Name = createAppRequest.Name
responseBody.Pubkey = app.AppPubkey
responseBody.PairingSecret = pairingSecretKey
responseBody.WalletPubkey = *app.WalletPubkey
responseBody.RelayUrl = relayUrl

lightningAddress, err := api.albyOAuthSvc.GetLightningAddress()
if err != nil {
return nil, err
}
responseBody.Lud16 = lightningAddress

if createAppRequest.ReturnTo != "" {
returnToUrl, err := url.Parse(createAppRequest.ReturnTo)
Expand Down
1 change: 1 addition & 0 deletions api/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ type CreateAppResponse struct {
Pubkey string `json:"pairingPublicKey"`
RelayUrl string `json:"relayUrl"`
WalletPubkey string `json:"walletPubkey"`
Lud16 string `json:"lud16"`
Id uint `json:"id"`
Name string `json:"name"`
ReturnTo string `json:"returnTo"`
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/screens/apps/AppCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function AppCreatedInternal() {
detail: {
relayUrl: createAppResponse.relayUrl,
walletPubkey: createAppResponse.walletPubkey,
lud16: createAppResponse.lud16,
},
});
window.dispatchEvent(nwcEvent);
Expand All @@ -73,11 +74,16 @@ function AppCreatedInternal() {
type: "nwc:success",
relayUrl: createAppResponse.relayUrl,
walletPubkey: createAppResponse.walletPubkey,
lud16: createAppResponse.lud16,
},
"*"
);
}
}, [createAppResponse.relayUrl, createAppResponse.walletPubkey]);
}, [
createAppResponse.relayUrl,
createAppResponse.walletPubkey,
createAppResponse.lud16,
]);

if (!createAppResponse) {
return <Navigate to="/apps/new" />;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export interface CreateAppResponse {
pairingSecretKey: string;
relayUrl: string;
walletPubkey: string;
lud16: string;
returnTo: string;
}

Expand Down