Skip to content

Commit

Permalink
fix: also include lud16 in nwc success event (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Feb 6, 2025
1 parent 7fafed3 commit 99d8c8f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
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

0 comments on commit 99d8c8f

Please sign in to comment.