github.com/celestiaorg/celestia-node@v0.15.0-beta.1/nodebuilder/state/stub.go (about) 1 package state 2 3 import ( 4 "context" 5 "errors" 6 7 "github.com/cosmos/cosmos-sdk/x/staking/types" 8 9 "github.com/celestiaorg/celestia-node/blob" 10 "github.com/celestiaorg/celestia-node/state" 11 ) 12 13 var ErrNoStateAccess = errors.New("node is running without state access. run with --core.ip <CORE NODE IP> to resolve") 14 15 // stubbedStateModule provides a stub for the state module to return 16 // errors when state endpoints are accessed without a running connection 17 // to a core endpoint. 18 type stubbedStateModule struct{} 19 20 func (s stubbedStateModule) AccountAddress(context.Context) (state.Address, error) { 21 return state.Address{}, ErrNoStateAccess 22 } 23 24 func (s stubbedStateModule) Balance(context.Context) (*state.Balance, error) { 25 return nil, ErrNoStateAccess 26 } 27 28 func (s stubbedStateModule) BalanceForAddress( 29 context.Context, 30 state.Address, 31 ) (*state.Balance, error) { 32 return nil, ErrNoStateAccess 33 } 34 35 func (s stubbedStateModule) Transfer( 36 _ context.Context, 37 _ state.AccAddress, 38 _, _ state.Int, 39 _ uint64, 40 ) (*state.TxResponse, error) { 41 return nil, ErrNoStateAccess 42 } 43 44 func (s stubbedStateModule) SubmitTx(context.Context, state.Tx) (*state.TxResponse, error) { 45 return nil, ErrNoStateAccess 46 } 47 48 func (s stubbedStateModule) SubmitPayForBlob( 49 context.Context, 50 state.Int, 51 uint64, 52 []*blob.Blob, 53 ) (*state.TxResponse, error) { 54 return nil, ErrNoStateAccess 55 } 56 57 func (s stubbedStateModule) CancelUnbondingDelegation( 58 _ context.Context, 59 _ state.ValAddress, 60 _, _, _ state.Int, 61 _ uint64, 62 ) (*state.TxResponse, error) { 63 return nil, ErrNoStateAccess 64 } 65 66 func (s stubbedStateModule) BeginRedelegate( 67 _ context.Context, 68 _, _ state.ValAddress, 69 _, _ state.Int, 70 _ uint64, 71 ) (*state.TxResponse, error) { 72 return nil, ErrNoStateAccess 73 } 74 75 func (s stubbedStateModule) Undelegate( 76 _ context.Context, 77 _ state.ValAddress, 78 _, _ state.Int, 79 _ uint64, 80 ) (*state.TxResponse, error) { 81 return nil, ErrNoStateAccess 82 } 83 84 func (s stubbedStateModule) Delegate( 85 _ context.Context, 86 _ state.ValAddress, 87 _, _ state.Int, 88 _ uint64, 89 ) (*state.TxResponse, error) { 90 return nil, ErrNoStateAccess 91 } 92 93 func (s stubbedStateModule) QueryDelegation( 94 context.Context, 95 state.ValAddress, 96 ) (*types.QueryDelegationResponse, error) { 97 return nil, ErrNoStateAccess 98 } 99 100 func (s stubbedStateModule) QueryUnbonding( 101 context.Context, 102 state.ValAddress, 103 ) (*types.QueryUnbondingDelegationResponse, error) { 104 return nil, ErrNoStateAccess 105 } 106 107 func (s stubbedStateModule) QueryRedelegations( 108 _ context.Context, 109 _, _ state.ValAddress, 110 ) (*types.QueryRedelegationsResponse, error) { 111 return nil, ErrNoStateAccess 112 }