Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #566 from BuxOrg/rc-v1.1
Browse files Browse the repository at this point in the history
Release Candidate v1.1.0
  • Loading branch information
jakubmkowalski authored Feb 12, 2024
2 parents 292c86b + 8b96022 commit 0ace965
Show file tree
Hide file tree
Showing 62 changed files with 635 additions and 2,902 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ go.list
# Jetbrains
.idea/

#VSCode
.vscode/

# Eclipse
.project

Expand Down
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
]
}
],
"[go][go.mod]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
}
}
116 changes: 0 additions & 116 deletions action_blockheader.go

This file was deleted.

58 changes: 18 additions & 40 deletions action_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ package bux

import (
"context"
"database/sql"
"time"

"github.com/mrz1836/go-datastore"
customTypes "github.com/mrz1836/go-datastore/custom_types"
)

// NewDestination will get a new destination for an existing xPub
//
// xPubKey is the raw public xPub
func (c *Client) NewDestination(ctx context.Context, xPubKey string, chain uint32,
destinationType string, monitor bool, opts ...ModelOps) (*Destination, error) {

destinationType string, opts ...ModelOps,
) (*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "new_destination")

Expand All @@ -39,13 +36,6 @@ func (c *Client) NewDestination(ctx context.Context, xPubKey string, chain uint3
return nil, err
}

if monitor {
destination.Monitor = customTypes.NullTime{NullTime: sql.NullTime{
Valid: true,
Time: time.Now(),
}}
}

// Save the destination
if err = destination.Save(ctx); err != nil {
return nil, err
Expand All @@ -57,8 +47,8 @@ func (c *Client) NewDestination(ctx context.Context, xPubKey string, chain uint3

// NewDestinationForLockingScript will create a new destination based on a locking script
func (c *Client) NewDestinationForLockingScript(ctx context.Context, xPubID, lockingScript string,
monitor bool, opts ...ModelOps) (*Destination, error) {

opts ...ModelOps,
) (*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "new_destination_for_locking_script")

Expand All @@ -77,15 +67,6 @@ func (c *Client) NewDestinationForLockingScript(ctx context.Context, xPubID, loc
return nil, ErrUnknownLockingScript
}

// set the monitoring, passed down from the initiating function
// this will be set when calling NewDestination from http, but not for instance paymail
if monitor {
destination.Monitor = customTypes.NullTime{NullTime: sql.NullTime{
Valid: true,
Time: time.Now(),
}}
}

// Save the destination
if err := destination.Save(ctx); err != nil {
return nil, err
Expand All @@ -97,8 +78,8 @@ func (c *Client) NewDestinationForLockingScript(ctx context.Context, xPubID, loc

// GetDestinations will get all the destinations from the Datastore
func (c *Client) GetDestinations(ctx context.Context, metadataConditions *Metadata,
conditions *map[string]interface{}, queryParams *datastore.QueryParams, opts ...ModelOps) ([]*Destination, error) {

conditions *map[string]interface{}, queryParams *datastore.QueryParams, opts ...ModelOps,
) ([]*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destinations")

Expand All @@ -116,8 +97,8 @@ func (c *Client) GetDestinations(ctx context.Context, metadataConditions *Metada

// GetDestinationsCount will get a count of all the destinations from the Datastore
func (c *Client) GetDestinationsCount(ctx context.Context, metadataConditions *Metadata,
conditions *map[string]interface{}, opts ...ModelOps) (int64, error) {

conditions *map[string]interface{}, opts ...ModelOps,
) (int64, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destinations_count")

Expand All @@ -137,8 +118,8 @@ func (c *Client) GetDestinationsCount(ctx context.Context, metadataConditions *M
//
// metadataConditions are the search criteria used to find destinations
func (c *Client) GetDestinationsByXpubID(ctx context.Context, xPubID string, metadataConditions *Metadata,
conditions *map[string]interface{}, queryParams *datastore.QueryParams) ([]*Destination, error) {

conditions *map[string]interface{}, queryParams *datastore.QueryParams,
) ([]*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destinations")

Expand All @@ -155,8 +136,8 @@ func (c *Client) GetDestinationsByXpubID(ctx context.Context, xPubID string, met

// GetDestinationsByXpubIDCount will get a count of all destinations based on an xPub
func (c *Client) GetDestinationsByXpubIDCount(ctx context.Context, xPubID string, metadataConditions *Metadata,
conditions *map[string]interface{}) (int64, error) {

conditions *map[string]interface{},
) (int64, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destinations")

Expand All @@ -173,7 +154,6 @@ func (c *Client) GetDestinationsByXpubIDCount(ctx context.Context, xPubID string

// GetDestinationByID will get a destination by id
func (c *Client) GetDestinationByID(ctx context.Context, xPubID, id string) (*Destination, error) {

// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destination_by_id")

Expand All @@ -195,7 +175,6 @@ func (c *Client) GetDestinationByID(ctx context.Context, xPubID, id string) (*De

// GetDestinationByLockingScript will get a destination for a locking script
func (c *Client) GetDestinationByLockingScript(ctx context.Context, xPubID, lockingScript string) (*Destination, error) {

// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destination_by_locking_script")

Expand All @@ -217,7 +196,6 @@ func (c *Client) GetDestinationByLockingScript(ctx context.Context, xPubID, lock

// GetDestinationByAddress will get a destination for an address
func (c *Client) GetDestinationByAddress(ctx context.Context, xPubID, address string) (*Destination, error) {

// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "get_destination_by_address")

Expand All @@ -239,8 +217,8 @@ func (c *Client) GetDestinationByAddress(ctx context.Context, xPubID, address st

// UpdateDestinationMetadataByID will update the metadata in an existing destination by id
func (c *Client) UpdateDestinationMetadataByID(ctx context.Context, xPubID, id string,
metadata Metadata) (*Destination, error) {

metadata Metadata,
) (*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "update_destination_by_id")

Expand All @@ -261,8 +239,8 @@ func (c *Client) UpdateDestinationMetadataByID(ctx context.Context, xPubID, id s

// UpdateDestinationMetadataByLockingScript will update the metadata in an existing destination by locking script
func (c *Client) UpdateDestinationMetadataByLockingScript(ctx context.Context, xPubID,
lockingScript string, metadata Metadata) (*Destination, error) {

lockingScript string, metadata Metadata,
) (*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "update_destination_by_locking_script")

Expand All @@ -283,8 +261,8 @@ func (c *Client) UpdateDestinationMetadataByLockingScript(ctx context.Context, x

// UpdateDestinationMetadataByAddress will update the metadata in an existing destination by address
func (c *Client) UpdateDestinationMetadataByAddress(ctx context.Context, xPubID, address string,
metadata Metadata) (*Destination, error) {

metadata Metadata,
) (*Destination, error) {
// Check for existing NewRelic transaction
ctx = c.GetOrStartTxn(ctx, "update_destination_by_address")

Expand Down
Loading

0 comments on commit 0ace965

Please sign in to comment.