alby-hub/nip47/models/models.go
Roland 3e1d16d423
Feat: NWA auth for self-hosted hubs (#1016)
* feat: nwc create_connection command (WIP)

* feat: allow creating superuser apps from the ui

* fix: pass methods rather than scopes in create_connection method

* chore: add extra tests

* fix: use browser router in http mode

* fix: update links to not use hash router

* fix: add redirect from hash router url

* fix: return nostrWalletConnectUrl in nwc connection success event and message

* feat: publish nwa event

* chore: use nwc info event instead of nwa event

* feat: create custom alby go detail page

* chore: allow creating/editing apps with the same name

* fix: convert budget from msats to sats (#1111)

* chore: address NWA feedback

* chore: address feedback

- adjust button copy
- make create_connection methods consistent with http deeplink flow
- remove unused constant
- add empty string check before adding lud16 tag
- fix test

* feat: add support for notification_types in create_connection method

* fix: shorter button copy

* fix: do not include lud16 tag in published info event

* Feat: add lud16 to get_info response (#1128)

feat: add lud16 to get_info response

* chore: minor alby go screen improvements

* fix: incorrect unlock password error message to create app with superuser access

* chore: minor ui improvements on alby go detail page

* chore: avoid duplicate app names by adding a suffix

* chore: move scopes check to apps service, add new tests, DRY controller test setup

* fix: scopes component full access scopes and isolated scope group check

* fix: use supported capabilities for Alby Go

* fix: return correct app name

* chore: address minor comments

---------

Co-authored-by: im-adithya <imadithyavardhan@gmail.com>
2025-02-27 19:12:55 +07:00

63 lines
1.8 KiB
Go

package models
import (
"encoding/json"
)
const (
INFO_EVENT_KIND = 13194
REQUEST_KIND = 23194
RESPONSE_KIND = 23195
LEGACY_NOTIFICATION_KIND = 23196
NOTIFICATION_KIND = 23197
// request methods
PAY_INVOICE_METHOD = "pay_invoice"
GET_BALANCE_METHOD = "get_balance"
GET_BUDGET_METHOD = "get_budget"
GET_INFO_METHOD = "get_info"
MAKE_INVOICE_METHOD = "make_invoice"
LOOKUP_INVOICE_METHOD = "lookup_invoice"
LIST_TRANSACTIONS_METHOD = "list_transactions"
PAY_KEYSEND_METHOD = "pay_keysend"
MULTI_PAY_INVOICE_METHOD = "multi_pay_invoice"
MULTI_PAY_KEYSEND_METHOD = "multi_pay_keysend"
SIGN_MESSAGE_METHOD = "sign_message"
CREATE_CONNECTION_METHOD = "create_connection"
)
type Transaction struct {
Type string `json:"type"`
State string `json:"state"`
Invoice string `json:"invoice"`
Description string `json:"description"`
DescriptionHash string `json:"description_hash"`
Preimage string `json:"preimage"`
PaymentHash string `json:"payment_hash"`
Amount int64 `json:"amount"`
FeesPaid int64 `json:"fees_paid"`
CreatedAt int64 `json:"created_at"`
ExpiresAt *int64 `json:"expires_at"`
SettledAt *int64 `json:"settled_at"`
Metadata interface{} `json:"metadata,omitempty"`
}
type PayRequest struct {
Invoice string `json:"invoice"`
}
type Request struct {
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
type Response struct {
Error *Error `json:"error,omitempty"`
Result interface{} `json:"result,omitempty"`
ResultType string `json:"result_type"`
}
type Error struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}