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

Commit

Permalink
fix: moves .With methods to exposed broadcast packages
Browse files Browse the repository at this point in the history
  • Loading branch information
wregulski committed Aug 16, 2023
1 parent afc626d commit fbb0cd6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
21 changes: 0 additions & 21 deletions broadcast/internal/arc/arc_submit_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,6 @@ func createSubmitBatchTxsBody(txs []*broadcast.Transaction) ([]byte, error) {
return data, nil
}

func WithCallback(callbackURL string, callbackToken ...string) broadcast.TransactionOptFunc {
return func(o *broadcast.TransactionOpts) {
o.CallbackToken = callbackURL
if len(callbackToken) > 0 {
o.CallbackToken = callbackToken[0]
}
}
}

func WithMerkleProof() broadcast.TransactionOptFunc {
return func(o *broadcast.TransactionOpts) {
o.MerkleProof = true
}
}

func WithWaitForStatus(status broadcast.TxStatus) broadcast.TransactionOptFunc {
return func(o *broadcast.TransactionOpts) {
o.WaitForStatus = status
}
}

func appendSubmitTxHeaders(pld *httpclient.HTTPRequest, opts *broadcast.TransactionOpts) {
if opts == nil {
return
Expand Down
23 changes: 22 additions & 1 deletion broadcast/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ type TransactionOpts struct {
CallbackToken string
// MerkleProof is a flag that indicates if the merkle proof should be returned in the submit transaction response.
MerkleProof bool
// TxStatus is the status that the callback request will wait for.
// WaitForStatus is the status that the callback request will wait for.
WaitForStatus TxStatus
}

func WithCallback(callbackURL string, callbackToken ...string) TransactionOptFunc {
return func(o *TransactionOpts) {
o.CallbackToken = callbackURL
if len(callbackToken) > 0 {
o.CallbackToken = callbackToken[0]
}
}
}

func WithMerkleProof() TransactionOptFunc {
return func(o *TransactionOpts) {
o.MerkleProof = true
}
}

func WithWaitForStatus(status TxStatus) TransactionOptFunc {
return func(o *TransactionOpts) {
o.WaitForStatus = status
}
}

0 comments on commit fbb0cd6

Please sign in to comment.