Skip to content

Commit

Permalink
Rename "Isolated" app permission to "Sub-wallet" (#982)
Browse files Browse the repository at this point in the history
* Rename "Isolated" app permission to "Sub-wallet"

* chore: undo comment

* chore: more renaming of isolated app to sub-wallet

---------

Co-authored-by: Roland <[email protected]>
Co-authored-by: Roland Bewick <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent e269425 commit fae02f3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ The LNClient interface abstracts the differences between wallet implementations

### Transactions Service

Alby Hub maintains its own database of transactions to enable features like self-payments for isolated app connections (subaccounts), additional metadata (that apps can provide when creating invoices or making keysend payments), and to associate transactions with apps, providing additional context to users about how their wallet is being used across apps.
Alby Hub maintains its own database of transactions to enable features like self-payments for isolated app connections (sub-wallets), additional metadata (that apps can provide when creating invoices or making keysend payments), and to associate transactions with apps, providing additional context to users about how their wallet is being used across apps.

The transactions service sits between the LNClient and two possible entry points: the NIP-47 handlers, and our internal API which is used by the Alby Hub frontend.

Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (api *api) CreateApp(createAppRequest *CreateAppRequest) (*CreateAppRespons
backendType != "LDK" &&
backendType != "LND" {
return nil, fmt.Errorf(
"isolated apps are currently not supported on your node backend. Try LDK or LND")
"sub-wallets are currently not supported on your node backend. Try LDK or LND")
}

expiresAt, err := api.parseExpiresAt(createAppRequest.ExpiresAt)
Expand Down
2 changes: 1 addition & 1 deletion api/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (api *api) TopupIsolatedApp(ctx context.Context, userApp *db.App, amountMsa
return errors.New("LNClient not started")
}
if !userApp.Isolated {
return errors.New("app is not isolated")
return errors.New("this app is not a sub-wallet")
}

transaction, err := api.svc.GetTransactionsService().MakeInvoice(ctx, amountMsat, "top up", "", 0, nil, api.svc.GetLNClient(), &userApp.ID, nil)
Expand Down
2 changes: 1 addition & 1 deletion apps/apps_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewAppsService(db *gorm.DB, eventPublisher events.EventPublisher, keys keys
func (svc *appsService) CreateApp(name string, pubkey string, maxAmountSat uint64, budgetRenewal string, expiresAt *time.Time, scopes []string, isolated bool, metadata map[string]interface{}) (*db.App, string, error) {
if isolated && (slices.Contains(scopes, constants.SIGN_MESSAGE_SCOPE)) {
// cannot sign messages because the isolated app is a custodial sub-wallet
return nil, "", errors.New("isolated app cannot have sign_message scope")
return nil, "", errors.New("Sub-wallet app connection cannot have sign_message scope")
}

var pairingPublicKey string
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/components/IsolatedAppTopupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,11 @@ export function IsolatedAppTopupDialog({
});
await reloadApp();
toast({
title: "Successfully increased isolated app balance",
title: "Successfully increased sub-wallet balance",
});
setOpen(false);
} catch (error) {
handleRequestError(
toast,
"Failed to increase isolated app balance",
error
);
handleRequestError(toast, "Failed to increase sub-wallet balance", error);
}
setLoading(false);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Scopes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const scopeGroupIconMap: ScopeGroupIconMap = {
const scopeGroupTitle: Record<ScopeGroup, string> = {
full_access: "Full Access",
read_only: "Read Only",
isolated: "Isolated",
isolated: "Sub-wallet",
custom: "Custom",
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/screens/apps/AppCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function AppCreatedInternal() {
</li>
{app?.isolated && (
<li>
Optional: Increase isolated balance (
Optional: Increase sub-wallet balance (
{new Intl.NumberFormat().format(Math.floor(app.balance / 1000))}{" "}
sats){" "}
<IsolatedAppTopupDialog appPubkey={app.appPubkey}>
Expand Down
4 changes: 2 additions & 2 deletions http/http_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,9 @@ func (httpSvc *HttpService) isolatedAppTopupHandler(c echo.Context) error {
err := httpSvc.api.TopupIsolatedApp(c.Request().Context(), dbApp, requestData.AmountSat*1000)

if err != nil {
logger.Logger.WithError(err).Error("Failed to topup isolated app")
logger.Logger.WithError(err).Error("Failed to topup sub-wallet")
return c.JSON(http.StatusInternalServerError, ErrorResponse{
Message: fmt.Sprintf("Failed to topup isolated app: %v", err),
Message: fmt.Sprintf("Failed to topup sub-wallet: %v", err),
})
}

Expand Down

0 comments on commit fae02f3

Please sign in to comment.