Skip to content

Commit

Permalink
ARCO-170: add sdkTx alias to sdk.Transaction package
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Aug 22, 2024
1 parent 83c5598 commit 40737a2
Show file tree
Hide file tree
Showing 42 changed files with 315 additions and 319 deletions.
26 changes: 13 additions & 13 deletions internal/beef/beef.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"

"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
)

const (
Expand All @@ -25,8 +25,8 @@ const (
)

type TxData struct {
Transaction *transaction.Transaction
BumpIndex *transaction.VarInt
Transaction *sdkTx.Transaction
BumpIndex *sdkTx.VarInt
txID string
}

Expand All @@ -43,7 +43,7 @@ func (td *TxData) GetTxID() string {
}

type BEEF struct {
BUMPs []*transaction.MerklePath
BUMPs []*sdkTx.MerklePath
Transactions []*TxData
}

Expand Down Expand Up @@ -83,27 +83,27 @@ func DecodeBEEF(beefHex []byte) (*BEEF, []byte, error) {
return decodedBeef, remainingBytes, nil
}

func (d *BEEF) GetLatestTx() *transaction.Transaction {
func (d *BEEF) GetLatestTx() *sdkTx.Transaction {
return d.Transactions[len(d.Transactions)-1].Transaction // get the last transaction as the processed transaction - it should be the last one because of khan's ordering
}

func decodeBUMPs(beefBytes []byte) ([]*transaction.MerklePath, []byte, error) {
func decodeBUMPs(beefBytes []byte) ([]*sdkTx.MerklePath, []byte, error) {
if len(beefBytes) == 0 {
return nil, nil, errors.New("cannot decode BUMP - no bytes provided")
}

nBump, bytesUsed := transaction.NewVarIntFromBytes(beefBytes)
nBump, bytesUsed := sdkTx.NewVarIntFromBytes(beefBytes)

if nBump == 0 {
return nil, nil, errors.New("invalid BEEF - lack of BUMPs")
}

beefBytes = beefBytes[bytesUsed:]

bumps := make([]*transaction.MerklePath, 0, uint64(nBump))
bumps := make([]*sdkTx.MerklePath, 0, uint64(nBump))
for i := uint64(0); i < uint64(nBump); i++ {
fmt.Println(len(beefBytes))
bump, err := transaction.NewMerklePathFromBinary(beefBytes)
bump, err := sdkTx.NewMerklePathFromBinary(beefBytes)
if err != nil {
return nil, nil, err
}
Expand All @@ -128,7 +128,7 @@ func decodeTransactionsWithPathIndexes(beefBytes []byte) ([]*TxData, []byte, err
return nil, nil, errors.New("invalid BEEF - no transaction")
}

nTransactions, bytesUsed := transaction.NewVarIntFromBytes(beefBytes)
nTransactions, bytesUsed := sdkTx.NewVarIntFromBytes(beefBytes)

if nTransactions < 2 {
return nil, nil, errors.New("invalid BEEF- not enough transactions provided to decode BEEF")
Expand All @@ -139,7 +139,7 @@ func decodeTransactionsWithPathIndexes(beefBytes []byte) ([]*TxData, []byte, err
transactions := make([]*TxData, 0, int(nTransactions))

for i := 0; i < int(nTransactions); i++ {
tx, bytesUsed, err := transaction.NewTransactionFromStream(beefBytes)
tx, bytesUsed, err := sdkTx.NewTransactionFromStream(beefBytes)
if err != nil {
return nil, nil, err
}
Expand All @@ -149,15 +149,15 @@ func decodeTransactionsWithPathIndexes(beefBytes []byte) ([]*TxData, []byte, err
return nil, nil, errors.New("invalid BEEF - no HasBUMP flag")
}

var pathIndex *transaction.VarInt
var pathIndex *sdkTx.VarInt

switch beefBytes[0] {
case hasBump:
beefBytes = beefBytes[1:]
if len(beefBytes) == 0 {
return nil, nil, errors.New("invalid BEEF - HasBUMP flag set, but no BUMP index")
}
value, bytesUsed := transaction.NewVarIntFromBytes(beefBytes)
value, bytesUsed := sdkTx.NewVarIntFromBytes(beefBytes)
pathIndex = &value
beefBytes = beefBytes[bytesUsed:]
case hasNoBump:
Expand Down
24 changes: 12 additions & 12 deletions internal/beef/beef_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/bitcoin-sv/go-sdk/script"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -42,47 +42,47 @@ func TestCheckBeefFormat(t *testing.T) {

func TestDecodeBEEF_DecodeBEEF_HappyPaths(t *testing.T) {
expected_bump_str := "fe636d0c0007021400fe507c0c7aa754cef1f7889d5fd395cf1f785dd7de98eed895dbedfe4e5bc70d1502ac4e164f5bc16746bb0868404292ac8318bbac3800e4aad13a014da427adce3e010b00bc4ff395efd11719b277694cface5aa50d085a0bb81f613f70313acd28cf4557010400574b2d9142b8d28b61d88e3b2c3f44d858411356b49a28a4643b6d1a6a092a5201030051a05fc84d531b5d250c23f4f886f6812f9fe3f402d61607f977b4ecd2701c19010000fd781529d58fc2523cf396a7f25440b409857e7e221766c57214b1d38c7b481f01010062f542f45ea3660f86c013ced80534cb5fd4c19d66c56e7e8c5d4bf2d40acc5e010100b121e91836fd7cd5102b654e9f72f3cf6fdbfd0b161c53a9c54b12c841126331"
expected_bump, _ := transaction.NewMerklePathFromHex(expected_bump_str)
expected_bump, _ := sdkTx.NewMerklePathFromHex(expected_bump_str)
testCases := []struct {
name string
hexStream string
expectedDecodedBEEF *BEEF
pathIndexForTheOldestInput *transaction.VarInt
pathIndexForTheOldestInput *sdkTx.VarInt
}{
{
name: "valid BEEF with 1 BUMP and 1 input transaction",
hexStream: "0100beef01fe636d0c0007021400fe507c0c7aa754cef1f7889d5fd395cf1f785dd7de98eed895dbedfe4e5bc70d1502ac4e164f5bc16746bb0868404292ac8318bbac3800e4aad13a014da427adce3e010b00bc4ff395efd11719b277694cface5aa50d085a0bb81f613f70313acd28cf4557010400574b2d9142b8d28b61d88e3b2c3f44d858411356b49a28a4643b6d1a6a092a5201030051a05fc84d531b5d250c23f4f886f6812f9fe3f402d61607f977b4ecd2701c19010000fd781529d58fc2523cf396a7f25440b409857e7e221766c57214b1d38c7b481f01010062f542f45ea3660f86c013ced80534cb5fd4c19d66c56e7e8c5d4bf2d40acc5e010100b121e91836fd7cd5102b654e9f72f3cf6fdbfd0b161c53a9c54b12c841126331020100000001cd4e4cac3c7b56920d1e7655e7e260d31f29d9a388d04910f1bbd72304a79029010000006b483045022100e75279a205a547c445719420aa3138bf14743e3f42618e5f86a19bde14bb95f7022064777d34776b05d816daf1699493fcdf2ef5a5ab1ad710d9c97bfb5b8f7cef3641210263e2dee22b1ddc5e11f6fab8bcd2378bdd19580d640501ea956ec0e786f93e76ffffffff013e660000000000001976a9146bfd5c7fbe21529d45803dbcf0c87dd3c71efbc288ac0000000001000100000001ac4e164f5bc16746bb0868404292ac8318bbac3800e4aad13a014da427adce3e000000006a47304402203a61a2e931612b4bda08d541cfb980885173b8dcf64a3471238ae7abcd368d6402204cbf24f04b9aa2256d8901f0ed97866603d2be8324c2bfb7a37bf8fc90edd5b441210263e2dee22b1ddc5e11f6fab8bcd2378bdd19580d640501ea956ec0e786f93e76ffffffff013c660000000000001976a9146bfd5c7fbe21529d45803dbcf0c87dd3c71efbc288ac0000000000",
expectedDecodedBEEF: &BEEF{
BUMPs: []*transaction.MerklePath{expected_bump},
BUMPs: []*sdkTx.MerklePath{expected_bump},
Transactions: []*TxData{
{
Transaction: &transaction.Transaction{
Transaction: &sdkTx.Transaction{
Version: 1,
LockTime: 0,
Inputs: []*transaction.TransactionInput{
Inputs: []*sdkTx.TransactionInput{
{
SequenceNumber: 4294967295,
},
},
Outputs: []*transaction.TransactionOutput{
Outputs: []*sdkTx.TransactionOutput{
{
Satoshis: 26174,
LockingScript: script.NewFromBytes([]byte("76a9146bfd5c7fbe21529d45803dbcf0c87dd3c71efbc288ac")),
},
},
},
BumpIndex: func(v transaction.VarInt) *transaction.VarInt { return &v }(0x0),
BumpIndex: func(v sdkTx.VarInt) *sdkTx.VarInt { return &v }(0x0),
},
{
Transaction: &transaction.Transaction{
Transaction: &sdkTx.Transaction{
Version: 1,
LockTime: 0,
Inputs: []*transaction.TransactionInput{
Inputs: []*sdkTx.TransactionInput{
{
SequenceNumber: 4294967295,
},
},
Outputs: []*transaction.TransactionOutput{
Outputs: []*sdkTx.TransactionOutput{
{
Satoshis: 26172,
LockingScript: script.NewFromBytes([]byte("76a9146bfd5c7fbe21529d45803dbcf0c87dd3c71efbc288ac")),
Expand All @@ -93,7 +93,7 @@ func TestDecodeBEEF_DecodeBEEF_HappyPaths(t *testing.T) {
},
},
},
pathIndexForTheOldestInput: func(v transaction.VarInt) *transaction.VarInt { return &v }(0x0),
pathIndexForTheOldestInput: func(v sdkTx.VarInt) *sdkTx.VarInt { return &v }(0x0),
},
}
for _, tc := range testCases {
Expand Down
6 changes: 3 additions & 3 deletions internal/beef/bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package beef
import (
"errors"

"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
)

type MerkleRootVerificationRequest struct {
MerkleRoot string
BlockHeight uint64
}

func CalculateMerkleRootsFromBumps(bumps []*transaction.MerklePath) ([]MerkleRootVerificationRequest, error) {
func CalculateMerkleRootsFromBumps(bumps []*sdkTx.MerklePath) ([]MerkleRootVerificationRequest, error) {
merkleRoots := make([]MerkleRootVerificationRequest, 0)

for _, bump := range bumps {
Expand All @@ -33,7 +33,7 @@ func CalculateMerkleRootsFromBumps(bumps []*transaction.MerklePath) ([]MerkleRoo
return merkleRoots, nil
}

func calculateMerkleRootFromBump(bump *transaction.MerklePath) (string, error) {
func calculateMerkleRootFromBump(bump *sdkTx.MerklePath) (string, error) {
blockMerkleRoot := ""

for _, pathElement := range bump.Path {
Expand Down
6 changes: 3 additions & 3 deletions internal/beef/bump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"testing"

"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -41,10 +41,10 @@ func TestCalculateMerkleRootsFromBumps(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
bump, err := transaction.NewMerklePathFromHex(tc.bumpStr)
bump, err := sdkTx.NewMerklePathFromHex(tc.bumpStr)
require.NoError(t, err)

merkleRoots, err := CalculateMerkleRootsFromBumps([]*transaction.MerklePath{bump})
merkleRoots, err := CalculateMerkleRootsFromBumps([]*sdkTx.MerklePath{bump})

assert.Equal(t, tc.expectedResult, merkleRoots)
assert.Equal(t, tc.expectedError, err)
Expand Down
10 changes: 5 additions & 5 deletions internal/blocktx/peer_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/bitcoin-sv/arc/internal/blocktx/blocktx_api"
"github.com/bitcoin-sv/arc/internal/blocktx/store"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
"github.com/bitcoin-sv/go-sdk/util"
"github.com/libsv/go-bc"
"github.com/libsv/go-p2p"
Expand Down Expand Up @@ -51,7 +51,7 @@ func init() {
bytesRead += 80 // the bitcoin header is always 80 bytes

var read int64
var txCount transaction.VarInt
var txCount sdkTx.VarInt
read, err = txCount.ReadFrom(reader)
if err != nil {
return bytesRead, nil, nil, err
Expand All @@ -60,11 +60,11 @@ func init() {

blockMessage.TransactionHashes = make([]*chainhash.Hash, txCount)

var tx *transaction.Transaction
var tx *sdkTx.Transaction
var hash *chainhash.Hash
var txBytes []byte
for i := 0; i < int(txCount); i++ {
tx = transaction.NewTransaction()
tx = sdkTx.NewTransaction()
read, err = tx.ReadFrom(reader)
if err != nil {
return bytesRead, nil, nil, err
Expand Down Expand Up @@ -715,7 +715,7 @@ func (ph *PeerHandler) markBlockAsProcessed(ctx context.Context, block *p2p.Bloc
}

// exported for testing purposes
func ExtractHeightFromCoinbaseTx(tx *transaction.Transaction) uint64 {
func ExtractHeightFromCoinbaseTx(tx *sdkTx.Transaction) uint64 {
// Coinbase tx has a special format, the height is encoded in the first 4 bytes of the scriptSig
// https://en.bitcoin.it/wiki/Protocol_documentation#tx
// Get the length
Expand Down
6 changes: 3 additions & 3 deletions internal/blocktx/peer_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/bitcoin-sv/arc/internal/blocktx/store"
storeMocks "github.com/bitcoin-sv/arc/internal/blocktx/store/mocks"
"github.com/bitcoin-sv/arc/internal/testdata"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
"github.com/libsv/go-bc"
"github.com/libsv/go-p2p"
"github.com/libsv/go-p2p/bsvutil"
Expand All @@ -35,7 +35,7 @@ func TestExtractHeight(t *testing.T) {
buff := bytes.NewBuffer(nil)
err = tx.MsgTx().Serialize(buff)
require.NoError(t, err)
btTx, err := transaction.NewTransactionFromBytes(buff.Bytes())
btTx, err := sdkTx.NewTransactionFromBytes(buff.Bytes())
require.NoError(t, err)

height := blocktx.ExtractHeightFromCoinbaseTx(btTx)
Expand All @@ -51,7 +51,7 @@ func TestExtractHeightForRegtest(t *testing.T) {
buff := bytes.NewBuffer(nil)
err = tx.MsgTx().Serialize(buff)
require.NoError(t, err)
btTx, err := transaction.NewTransactionFromBytes(buff.Bytes())
btTx, err := sdkTx.NewTransactionFromBytes(buff.Bytes())
require.NoError(t, err)

height := blocktx.ExtractHeightFromCoinbaseTx(btTx)
Expand Down
6 changes: 3 additions & 3 deletions internal/broadcaster/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/bitcoin-sv/arc/internal/metamorph/metamorph_api"
"github.com/bitcoin-sv/arc/pkg/api"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
)

type APIBroadcaster struct {
Expand Down Expand Up @@ -40,7 +40,7 @@ func NewHTTPBroadcaster(arcServer string, auth *Auth) (*APIBroadcaster, error) {
return &APIBroadcaster{arcClient: arcClient}, nil
}

func (a *APIBroadcaster) BroadcastTransactions(ctx context.Context, txs transaction.Transactions, waitForStatus metamorph_api.Status, callbackURL string, callbackToken string, fullStatusUpdates bool, skipFeeValidation bool) ([]*metamorph_api.TransactionStatus, error) {
func (a *APIBroadcaster) BroadcastTransactions(ctx context.Context, txs sdkTx.Transactions, waitForStatus metamorph_api.Status, callbackURL string, callbackToken string, fullStatusUpdates bool, skipFeeValidation bool) ([]*metamorph_api.TransactionStatus, error) {
waitFor, ok := metamorph_api.Status_name[int32(waitForStatus)]
if !ok {
return nil, fmt.Errorf("status code %d not supported", waitForStatus)
Expand Down Expand Up @@ -120,7 +120,7 @@ func (a *APIBroadcaster) BroadcastTransactions(ctx context.Context, txs transact
return txStatuses, nil
}

func (a *APIBroadcaster) BroadcastTransaction(ctx context.Context, tx *transaction.Transaction, waitForStatus metamorph_api.Status, callbackURL string) (*metamorph_api.TransactionStatus, error) {
func (a *APIBroadcaster) BroadcastTransaction(ctx context.Context, tx *sdkTx.Transaction, waitForStatus metamorph_api.Status, callbackURL string) (*metamorph_api.TransactionStatus, error) {
waitFor, ok := metamorph_api.Status_name[int32(waitForStatus)]
if !ok {
return nil, fmt.Errorf("status code %d not supported", waitForStatus)
Expand Down
8 changes: 4 additions & 4 deletions internal/broadcaster/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/bitcoin-sv/arc/internal/metamorph/metamorph_api"
"github.com/bitcoin-sv/arc/pkg/api"
"github.com/bitcoin-sv/arc/pkg/api/mocks"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -96,10 +96,10 @@ func TestBroadcastTransactions(t *testing.T) {
}

// random valid transaction
tx, err := transaction.NewTransactionFromHex("020000000000000000ef010f117b3f9ea4955d5c592c61838bea10096fc88ac1ad08561a9bcabd715a088200000000494830450221008fd0e0330470ac730b9f6b9baf1791b76859cbc327e2e241f3ebeb96561a719602201e73532eb1312a00833af276d636254b8aa3ecbb445324fb4c481f2a493821fb41feffffff00f2052a01000000232103b12bda06e5a3e439690bf3996f1d4b81289f4747068a5cbb12786df83ae14c18ac02a0860100000000001976a914b7b88045cc16f442a0c3dcb3dc31ecce8d156e7388ac605c042a010000001976a9147a904b8ae0c2f9d74448993029ad3c040ebdd69a88ac66000000")
tx, err := sdkTx.NewTransactionFromHex("020000000000000000ef010f117b3f9ea4955d5c592c61838bea10096fc88ac1ad08561a9bcabd715a088200000000494830450221008fd0e0330470ac730b9f6b9baf1791b76859cbc327e2e241f3ebeb96561a719602201e73532eb1312a00833af276d636254b8aa3ecbb445324fb4c481f2a493821fb41feffffff00f2052a01000000232103b12bda06e5a3e439690bf3996f1d4b81289f4747068a5cbb12786df83ae14c18ac02a0860100000000001976a914b7b88045cc16f442a0c3dcb3dc31ecce8d156e7388ac605c042a010000001976a9147a904b8ae0c2f9d74448993029ad3c040ebdd69a88ac66000000")
require.NoError(t, err)

status, err := broadcaster.BroadcastTransactions(context.Background(), transaction.Transactions{tx}, metamorph_api.Status_SEEN_ON_NETWORK, "", "", false, false)
status, err := broadcaster.BroadcastTransactions(context.Background(), sdkTx.Transactions{tx}, metamorph_api.Status_SEEN_ON_NETWORK, "", "", false, false)

assert.Equal(t, tc.expectedTxStatuses, status)
assert.Equal(t, tc.expectedError, err)
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestBroadcastTransaction(t *testing.T) {
}

// random valid transaction
tx, err := transaction.NewTransactionFromHex("020000000000000000ef010f117b3f9ea4955d5c592c61838bea10096fc88ac1ad08561a9bcabd715a088200000000494830450221008fd0e0330470ac730b9f6b9baf1791b76859cbc327e2e241f3ebeb96561a719602201e73532eb1312a00833af276d636254b8aa3ecbb445324fb4c481f2a493821fb41feffffff00f2052a01000000232103b12bda06e5a3e439690bf3996f1d4b81289f4747068a5cbb12786df83ae14c18ac02a0860100000000001976a914b7b88045cc16f442a0c3dcb3dc31ecce8d156e7388ac605c042a010000001976a9147a904b8ae0c2f9d74448993029ad3c040ebdd69a88ac66000000")
tx, err := sdkTx.NewTransactionFromHex("020000000000000000ef010f117b3f9ea4955d5c592c61838bea10096fc88ac1ad08561a9bcabd715a088200000000494830450221008fd0e0330470ac730b9f6b9baf1791b76859cbc327e2e241f3ebeb96561a719602201e73532eb1312a00833af276d636254b8aa3ecbb445324fb4c481f2a493821fb41feffffff00f2052a01000000232103b12bda06e5a3e439690bf3996f1d4b81289f4747068a5cbb12786df83ae14c18ac02a0860100000000001976a914b7b88045cc16f442a0c3dcb3dc31ecce8d156e7388ac605c042a010000001976a9147a904b8ae0c2f9d74448993029ad3c040ebdd69a88ac66000000")
require.NoError(t, err)

status, err := broadcaster.BroadcastTransaction(context.Background(), tx, metamorph_api.Status_SEEN_ON_NETWORK, "")
Expand Down
6 changes: 3 additions & 3 deletions internal/broadcaster/arc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"context"

"github.com/bitcoin-sv/arc/internal/metamorph/metamorph_api"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
)

type ArcClient interface {
BroadcastTransaction(ctx context.Context, tx *transaction.Transaction, waitForStatus metamorph_api.Status, callbackURL string) (*metamorph_api.TransactionStatus, error)
BroadcastTransactions(ctx context.Context, txs transaction.Transactions, waitForStatus metamorph_api.Status, callbackURL string, callbackToken string, fullStatusUpdates bool, skipFeeValidation bool) ([]*metamorph_api.TransactionStatus, error)
BroadcastTransaction(ctx context.Context, tx *sdkTx.Transaction, waitForStatus metamorph_api.Status, callbackURL string) (*metamorph_api.TransactionStatus, error)
BroadcastTransactions(ctx context.Context, txs sdkTx.Transactions, waitForStatus metamorph_api.Status, callbackURL string, callbackToken string, fullStatusUpdates bool, skipFeeValidation bool) ([]*metamorph_api.TransactionStatus, error)
GetTransactionStatus(ctx context.Context, txID string) (*metamorph_api.TransactionStatus, error)
}
8 changes: 4 additions & 4 deletions internal/broadcaster/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/bitcoin-sv/arc/internal/fees"
"github.com/bitcoin-sv/arc/internal/metamorph/metamorph_api"
"github.com/bitcoin-sv/go-sdk/script"
"github.com/bitcoin-sv/go-sdk/transaction"
sdkTx "github.com/bitcoin-sv/go-sdk/transaction"
)

const (
Expand All @@ -18,8 +18,8 @@ const (
)

type UtxoClient interface {
GetUTXOs(ctx context.Context, lockingScript *script.Script, address string) (transaction.UTXOs, error)
GetUTXOsWithRetries(ctx context.Context, lockingScript *script.Script, address string, constantBackoff time.Duration, retries uint64) (transaction.UTXOs, error)
GetUTXOs(ctx context.Context, lockingScript *script.Script, address string) (sdkTx.UTXOs, error)
GetUTXOsWithRetries(ctx context.Context, lockingScript *script.Script, address string, constantBackoff time.Duration, retries uint64) (sdkTx.UTXOs, error)
GetBalance(ctx context.Context, address string) (int64, int64, error)
GetBalanceWithRetries(ctx context.Context, address string, constantBackoff time.Duration, retries uint64) (int64, int64, error)
TopUp(ctx context.Context, address string) error
Expand Down Expand Up @@ -106,6 +106,6 @@ func NewBroadcaster(logger *slog.Logger, client ArcClient, utxoClient UtxoClient
return b, nil
}

func (b *Broadcaster) calculateFeeSat(tx *transaction.Transaction) uint64 {
func (b *Broadcaster) calculateFeeSat(tx *sdkTx.Transaction) uint64 {
return CalculateFeeSat(tx, b.standardMiningFee)
}
Loading

0 comments on commit 40737a2

Please sign in to comment.