Skip to content

Commit

Permalink
Show event dates in transaction status output
Browse files Browse the repository at this point in the history
  • Loading branch information
jtolio committed Feb 20, 2024
1 parent e2175e2 commit 523f697
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 53 deletions.
4 changes: 2 additions & 2 deletions cmd_confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (cmd *cmdConfirm) Setup(params clingy.Parameters) {
}

func (cmd *cmdConfirm) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -29,6 +29,6 @@ func (cmd *cmdConfirm) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
printTransactionStatus(ctx, transactor.Caller, cmd.transactionID)
printTransactionStatus(ctx, client, transactor.Caller, cmd.transactionID)
return nil
}
4 changes: 2 additions & 2 deletions cmd_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (cmd *cmdExecute) Setup(params clingy.Parameters) {
}

func (cmd *cmdExecute) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -29,5 +29,5 @@ func (cmd *cmdExecute) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, cmd.transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, cmd.transactionID)
}
2 changes: 1 addition & 1 deletion cmd_query_multisig_owner_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (cmd *cmdQueryMultiSigOwnerList) Setup(params clingy.Parameters) {
}

func (cmd *cmdQueryMultiSigOwnerList) Execute(ctx context.Context) error {
caller, err := cmd.caller.open(ctx)
_, caller, err := cmd.caller.open(ctx)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd_query_multisig_requirement.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (cmd *cmdQueryMultiSigRequirement) Setup(params clingy.Parameters) {
}

func (cmd *cmdQueryMultiSigRequirement) Execute(ctx context.Context) error {
caller, err := cmd.caller.open(ctx)
_, caller, err := cmd.caller.open(ctx)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd_query_multisig_transaction_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (cmd *cmdQueryMultiSigTransactionList) Setup(params clingy.Parameters) {
}

func (cmd *cmdQueryMultiSigTransactionList) Execute(ctx context.Context) error {
caller, err := cmd.caller.open(ctx)
client, caller, err := cmd.caller.open(ctx)
if err != nil {
return err
}
Expand Down Expand Up @@ -51,7 +51,7 @@ func (cmd *cmdQueryMultiSigTransactionList) Execute(ctx context.Context) error {
if needsSeparator {
fmt.Fprintln(clingy.Stdout(ctx))
}
if err := printTransactionStatus(ctx, caller, transactionID); err != nil {
if err := printTransactionStatus(ctx, client, caller, transactionID); err != nil {
return err
}
needsSeparator = true
Expand Down
4 changes: 2 additions & 2 deletions cmd_query_multisig_transaction_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func (cmd *cmdQueryMultiSigTransactionStatus) Setup(params clingy.Parameters) {
}

func (cmd *cmdQueryMultiSigTransactionStatus) Execute(ctx context.Context) error {
caller, err := cmd.caller.open(ctx)
client, caller, err := cmd.caller.open(ctx)
if err != nil {
return err
}
return printTransactionStatus(ctx, caller, cmd.transactionID)
return printTransactionStatus(ctx, client, caller, cmd.transactionID)
}
4 changes: 2 additions & 2 deletions cmd_revoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (cmd *cmdRevoke) Setup(params clingy.Parameters) {
}

func (cmd *cmdRevoke) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -29,5 +29,5 @@ func (cmd *cmdRevoke) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, cmd.transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, cmd.transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (cmd *cmdSubmitContractCall) Execute(ctx context.Context) error {
return err
}

transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -57,7 +57,7 @@ func (cmd *cmdSubmitContractCall) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}

func loadABI(path string) (*abi.ABI, error) {
Expand Down
4 changes: 2 additions & 2 deletions cmd_submit_eth_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (cmd *cmdSubmitETHTransfer) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitETHTransfer) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -34,5 +34,5 @@ func (cmd *cmdSubmitETHTransfer) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_multisig_owner_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (cmd *cmdSubmitMultisigOwnerAdd) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitMultisigOwnerAdd) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -31,5 +31,5 @@ func (cmd *cmdSubmitMultisigOwnerAdd) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_multisig_owner_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (cmd *cmdSubmitMultisigOwnerRemove) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitMultisigOwnerRemove) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -31,5 +31,5 @@ func (cmd *cmdSubmitMultisigOwnerRemove) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_multisig_owner_replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (cmd *cmdSubmitMultisigOwnerReplace) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitMultisigOwnerReplace) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -33,5 +33,5 @@ func (cmd *cmdSubmitMultisigOwnerReplace) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_multisig_requirement_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (cmd *cmdSubmitMultisigRequirementChange) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitMultisigRequirementChange) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -30,5 +30,5 @@ func (cmd *cmdSubmitMultisigRequirementChange) Execute(ctx context.Context) erro
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_token_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (cmd *cmdSubmitTokenApprove) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitTokenApprove) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -36,5 +36,5 @@ func (cmd *cmdSubmitTokenApprove) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_token_set_upgrade_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (cmd *cmdSubmitTokenSetUpgradeMaster) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitTokenSetUpgradeMaster) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -33,5 +33,5 @@ func (cmd *cmdSubmitTokenSetUpgradeMaster) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_token_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (cmd *cmdSubmitTokenTransfer) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitTokenTransfer) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -36,5 +36,5 @@ func (cmd *cmdSubmitTokenTransfer) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
4 changes: 2 additions & 2 deletions cmd_submit_token_transfer_from.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (cmd *cmdSubmitTokenTransferFrom) Setup(params clingy.Parameters) {
}

func (cmd *cmdSubmitTokenTransferFrom) Execute(ctx context.Context) error {
transactor, done, err := cmd.transactor.open(ctx)
client, transactor, done, err := cmd.transactor.open(ctx)
if err != nil {
return err
}
Expand All @@ -38,5 +38,5 @@ func (cmd *cmdSubmitTokenTransferFrom) Execute(ctx context.Context) error {
}

fmt.Fprintln(clingy.Stdout(ctx))
return printTransactionStatus(ctx, transactor.Caller, transactionID)
return printTransactionStatus(ctx, client, transactor.Caller, transactionID)
}
11 changes: 8 additions & 3 deletions dep_multisig_caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/zeebo/clingy"

"storj.io/briskitall/internal/eth"
"storj.io/briskitall/internal/multisig"
)

Expand All @@ -18,10 +19,14 @@ func (dep *depMultiSigCaller) setup(params clingy.Parameters) {
dep.multiSig.setup(params)
}

func (dep *depMultiSigCaller) open(ctx context.Context) (*multisig.Caller, error) {
func (dep *depMultiSigCaller) open(ctx context.Context) (eth.Client, *multisig.Caller, error) {
client, err := dep.client.open(ctx)
if err != nil {
return nil, err
return nil, nil, err
}
return multisig.NewCaller(client, dep.multiSig.contractAddress)
caller, err := multisig.NewCaller(client, dep.multiSig.contractAddress)
if err != nil {
return nil, nil, err
}
return client, caller, nil
}
11 changes: 6 additions & 5 deletions dep_multisig_transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/zeebo/clingy"

"storj.io/briskitall/internal/eth"
"storj.io/briskitall/internal/multisig"
)

Expand All @@ -20,21 +21,21 @@ func (dep *depMultiSigTransactor) setup(params clingy.Parameters) {
dep.sender.setup(params)
}

func (dep *depMultiSigTransactor) open(ctx context.Context) (*multisig.Transactor, func(), error) {
func (dep *depMultiSigTransactor) open(ctx context.Context) (eth.Client, *multisig.Transactor, func(), error) {
client, err := dep.client.open(ctx)
if err != nil {
return nil, nil, err
return nil, nil, nil, err
}

opts, done, err := dep.sender.transactOpts(ctx, client)
if err != nil {
return nil, nil, err
return nil, nil, nil, err
}

transactor, err := multisig.NewTransactor(client, dep.multiSig.contractAddress, opts, waiter(ctx, client))
if err != nil {
done()
return nil, nil, err
return nil, nil, nil, err
}
return transactor, done, nil
return client, transactor, done, nil
}
2 changes: 2 additions & 0 deletions internal/eth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/zeebo/errs"
)
Expand All @@ -18,6 +19,7 @@ type Client interface {
ethereum.ChainStateReader

ChainID(ctx context.Context) (*big.Int, error)
BlockByNumber(context.Context, *big.Int) (*types.Block, error)
Close()
}

Expand Down
Loading

0 comments on commit 523f697

Please sign in to comment.