fix linking
This commit is contained in:
parent
fb17b05441
commit
24e0c67775
10 changed files with 227 additions and 4 deletions
|
|
@ -85,6 +85,7 @@ type Client struct {
|
|||
GetLnurlWithdrawInfo func(query GetLnurlWithdrawInfo_Query) (*LnurlWithdrawInfoResponse, error)
|
||||
GetLnurlWithdrawLink func() (*LnurlLinkResponse, error)
|
||||
GetMigrationUpdate func() (*MigrationUpdate, error)
|
||||
GetNPubLinkingState func(req GetNPubLinking) (*NPubLinking, error)
|
||||
GetPaymentState func(req GetPaymentStateRequest) (*PaymentState, error)
|
||||
GetSeed func() (*LndSeed, error)
|
||||
GetUsageMetrics func() (*UsageMetrics, error)
|
||||
|
|
@ -834,6 +835,35 @@ func NewClient(params ClientParams) *Client {
|
|||
return &res, nil
|
||||
},
|
||||
// server streaming method: GetMigrationUpdate not implemented
|
||||
GetNPubLinkingState: func(req GetNPubLinking) (*NPubLinking, error) {
|
||||
auth, err := params.RetrieveAppAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalRoute := "/api/app/user/npub/token"
|
||||
body, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := ResultError{}
|
||||
err = json.Unmarshal(resBody, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Status == "ERROR" {
|
||||
return nil, fmt.Errorf(result.Reason)
|
||||
}
|
||||
res := NPubLinking{}
|
||||
err = json.Unmarshal(resBody, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &res, nil
|
||||
},
|
||||
GetPaymentState: func(req GetPaymentStateRequest) (*PaymentState, error) {
|
||||
auth, err := params.RetrieveUserAuth()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@ type GetInviteTokenStateRequest struct {
|
|||
type GetInviteTokenStateResponse struct {
|
||||
Used bool `json:"used"`
|
||||
}
|
||||
type GetNPubLinking struct {
|
||||
User_identifier string `json:"user_identifier"`
|
||||
}
|
||||
type GetPaymentStateRequest struct {
|
||||
Invoice string `json:"invoice"`
|
||||
}
|
||||
|
|
@ -333,6 +336,9 @@ type MigrationUpdate struct {
|
|||
Closure *ClosureMigration `json:"closure"`
|
||||
Relays *RelaysMigration `json:"relays"`
|
||||
}
|
||||
type NPubLinking struct {
|
||||
State *NPubLinking_state `json:"state"`
|
||||
}
|
||||
type NewAddressRequest struct {
|
||||
Addresstype AddressType `json:"addressType"`
|
||||
}
|
||||
|
|
@ -542,3 +548,17 @@ type LiveDebitRequest_debit struct {
|
|||
Full_access *Empty `json:"full_access"`
|
||||
Invoice *string `json:"invoice"`
|
||||
}
|
||||
type NPubLinking_state_type string
|
||||
|
||||
const (
|
||||
LINKED_NPUB NPubLinking_state_type = "linked_npub"
|
||||
LINKING_TOKEN NPubLinking_state_type = "linking_token"
|
||||
UNLINKED NPubLinking_state_type = "unlinked"
|
||||
)
|
||||
|
||||
type NPubLinking_state struct {
|
||||
Type NPubLinking_state_type `json:"type"`
|
||||
Linked_npub *string `json:"linked_npub"`
|
||||
Linking_token *string `json:"linking_token"`
|
||||
Unlinked *Empty `json:"unlinked"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue