-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fireblocks adjust confirmation threshold
- Loading branch information
Showing
6 changed files
with
97 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package fireblocks | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
type SetConfirmationThresholdRequest struct { | ||
NumOfConfirmations int `json:"numOfConfirmations"` | ||
} | ||
|
||
type SetConfirmationThresholdResponse struct { | ||
Success bool `json:"success"` | ||
Transactions []string `json:"transactions"` | ||
} | ||
|
||
func (f *client) SetConfirmationThreshold(ctx context.Context, txID string, threshold int) (bool, error) { | ||
f.logger.Debug("Fireblocks set confirmation threshold", "txID", txID, "threshold", threshold) | ||
url := fmt.Sprintf("/v1/transactions/%s/set_confirmation_threshold", txID) | ||
res, err := f.makeRequest(ctx, "POST", url, &SetConfirmationThresholdRequest{ | ||
NumOfConfirmations: threshold, | ||
}) | ||
if err != nil { | ||
return false, fmt.Errorf("error making request: %w", err) | ||
} | ||
var response SetConfirmationThresholdResponse | ||
err = json.NewDecoder(strings.NewReader(string(res))).Decode(&response) | ||
if err != nil { | ||
return false, fmt.Errorf("error parsing response body: %w", err) | ||
} | ||
f.logger.Debug("Fireblocks set confirmation threshold response", "response", string(res)) | ||
|
||
return response.Success, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters