@@ -17,8 +17,7 @@ const (
1717 mirrorHbarBalanceRetryDelay = 2 * time .Second
1818)
1919
20- // mirrorHbarBalanceEventually polls until ready accepts the result, absorbing mirror node ingestion
21- // lag. On timeout it returns the last balance and error so the caller's assertion reports it.
20+ // mirrorHbarBalanceEventually polls until ready accepts the result, absorbing mirror node lag.
2221func mirrorHbarBalanceEventually (env * IntegrationTestEnv , query * MirrorNodeAccountBalanceQuery , ready func (MirrorNodeAccountBalance ) bool ) (MirrorNodeAccountBalance , error ) {
2322 var balance MirrorNodeAccountBalance
2423 var err error
@@ -40,7 +39,6 @@ func nonZeroHbars(balance MirrorNodeAccountBalance) bool {
4039 return balance .Hbars .AsTinybar () > 0
4140}
4241
43- // Acceptance 1: a valid account ID returns the hbar balance the mirror node holds.
4442func TestIntegrationMirrorNodeAccountBalanceQueryCanExecute (t * testing.T ) {
4543 t .Parallel ()
4644 env := NewIntegrationTestEnv (t )
@@ -55,7 +53,6 @@ func TestIntegrationMirrorNodeAccountBalanceQueryCanExecute(t *testing.T) {
5553 assert .Positive (t , balance .Hbars .AsTinybar (), "the operator account must hold hbars" )
5654}
5755
58- // The query is free and must work without an operator, unlike the consensus-node queries.
5956func TestIntegrationMirrorNodeAccountBalanceQueryWithoutOperator (t * testing.T ) {
6057 t .Parallel ()
6158 env := NewIntegrationTestEnv (t )
@@ -73,7 +70,6 @@ func TestIntegrationMirrorNodeAccountBalanceQueryWithoutOperator(t *testing.T) {
7370 assert .Positive (t , balance .Hbars .AsTinybar ())
7471}
7572
76- // Acceptance 6: an unset account ID fails before any request is made.
7773func TestIntegrationMirrorNodeAccountBalanceQueryNoIDError (t * testing.T ) {
7874 t .Parallel ()
7975 env := NewIntegrationTestEnv (t )
@@ -83,7 +79,6 @@ func TestIntegrationMirrorNodeAccountBalanceQueryNoIDError(t *testing.T) {
8379 require .ErrorIs (t , err , errMirrorNodeAccountBalanceQueryNoAccountID )
8480}
8581
86- // Acceptance 2: an account addressed by its EVM address alias resolves and returns its balance.
8782func TestIntegrationMirrorNodeAccountBalanceQueryCanGetBalanceByEvmAddress (t * testing.T ) {
8883 t .Parallel ()
8984 env := NewIntegrationTestEnv (t )
@@ -113,7 +108,6 @@ func TestIntegrationMirrorNodeAccountBalanceQueryCanGetBalanceByEvmAddress(t *te
113108 assert .Equal (t , NewHbar (1 ).AsTinybar (), balance .Hbars .AsTinybar ())
114109}
115110
116- // Acceptance 3: an account addressed by an ED25519 public-key alias resolves and returns its balance.
117111func TestIntegrationMirrorNodeAccountBalanceQueryCanGetBalanceByPublicKeyAlias (t * testing.T ) {
118112 t .Parallel ()
119113 env := NewIntegrationTestEnv (t )
@@ -140,7 +134,6 @@ func TestIntegrationMirrorNodeAccountBalanceQueryCanGetBalanceByPublicKeyAlias(t
140134 assert .Equal (t , NewHbar (1 ).AsTinybar (), balance .Hbars .AsTinybar ())
141135}
142136
143- // Acceptance 4: a contract's balance is read through the same account.id parameter.
144137func TestIntegrationMirrorNodeAccountBalanceQueryCanGetContractBalance (t * testing.T ) {
145138 t .Parallel ()
146139 env := NewIntegrationTestEnv (t )
@@ -159,20 +152,16 @@ func TestIntegrationMirrorNodeAccountBalanceQueryCanGetContractBalance(t *testin
159152 resp , err = NewContractCreateTransaction ().
160153 SetAdminKey (env .Client .GetOperatorPublicKey ()).
161154 SetNodeAccountIDs ([]AccountID {resp .NodeID }).
162- SetGas (contractDeployGas ).
163- SetConstructorParameters (NewContractFunctionParameters ().AddString ("hello from hiero" )).
155+ SetGas (400_000 ).
164156 SetBytecodeFileID (fileID ).
165- SetContractMemo ("hiero-sdk-go::MirrorNodeAccountBalanceQuery" ).
166157 Execute (env .Client )
167158 require .NoError (t , err )
168159 receipt , err = resp .SetValidateStatus (true ).GetReceipt (env .Client )
169160 require .NoError (t , err )
170161 contractID := * receipt .ContractID
171162
172- // No SetContractID: a contract goes through account.id as the equivalent AccountID.
173163 contractAccountID := AccountID {Shard : contractID .Shard , Realm : contractID .Realm , Account : contractID .Contract }
174164
175- // Fund by transfer: the constructor is not payable, so an initial balance reverts.
176165 tx , err := NewTransferTransaction ().
177166 AddHbarTransfer (contractAccountID , NewHbar (1 )).
178167 AddHbarTransfer (env .OperatorID , NewHbar (- 1 )).
@@ -200,8 +189,6 @@ func TestIntegrationMirrorNodeAccountBalanceQueryCanGetContractBalance(t *testin
200189 require .NoError (t , err )
201190}
202191
203- // Acceptance 5: an unknown account yields a zero balance, not an error -- the endpoint returns an
204- // empty list rather than a 404, unlike the consensus-node query's INVALID_ACCOUNT_ID.
205192func TestIntegrationMirrorNodeAccountBalanceQueryNonExistentAccountIsZero (t * testing.T ) {
206193 t .Parallel ()
207194 env := NewIntegrationTestEnv (t )
0 commit comments