@@ -42,7 +42,7 @@ final class AccountTests: XCTestCase {
4242 }
4343
4444 func testGetNonce( ) async throws {
45- let _ = try await account. getNonce ( )
45+ let _ = await ( try ? provider . send ( request : account. getNonce ( ) ) )
4646 }
4747
4848 func testExecuteV3( ) async throws {
@@ -61,6 +61,26 @@ final class AccountTests: XCTestCase {
6161 try await Self . devnetClient. assertTransactionSucceeded ( transactionHash: result. transactionHash)
6262 }
6363
64+ func testExecuteV3WithTip( ) async throws {
65+ let recipientAddress = AccountTests . devnetClient. constants. predeployedAccount2. address
66+
67+ let calldata : [ Felt ] = [
68+ recipientAddress,
69+ 1000 ,
70+ 0 ,
71+ ]
72+
73+ let params = StarknetOptionalInvokeParamsV3 ( tip: UInt64AsHex ( 12345 ) )
74+ let call = StarknetCall ( contractAddress: ethContractAddress, entrypoint: starknetSelector ( from: " transfer " ) , calldata: calldata)
75+
76+ let result = try await provider. send ( request: account. executeV3 ( calls: [ call] , params: params) )
77+
78+ try await Self . devnetClient. assertTransactionSucceeded ( transactionHash: result. transactionHash)
79+
80+ let tx = try await provider. send ( request: RequestBuilder . getTransactionBy ( hash: result. transactionHash) ) . transaction as? StarknetInvokeTransactionV3
81+ XCTAssertEqual ( params. tip, tx? . tip)
82+ }
83+
6484 func testExecuteV3FeeMultipliers( ) async throws {
6585 let recipientAddress = AccountTests . devnetClient. constants. predeployedAccount2. address
6686
@@ -144,6 +164,33 @@ final class AccountTests: XCTestCase {
144164 XCTAssertEqual ( newNonce. value - nonce. value, Felt . one. value)
145165 }
146166
167+ func testDeployAccountV3WithTip( ) async throws {
168+ let newSigner = StarkCurveSigner ( privateKey: 4444 ) !
169+ let newPublicKey = newSigner. publicKey
170+ let newAccountAddress = StarknetContractAddressCalculator . calculateFrom ( classHash: accountContractClassHash, calldata: [ newPublicKey] , salt: . one)
171+ let newAccount = StarknetAccount ( address: newAccountAddress, signer: newSigner, provider: provider, chainId: chainId, cairoVersion: . zero)
172+
173+ try await Self . devnetClient. prefundAccount ( address: newAccountAddress, unit: . fri)
174+
175+ let nonce = await ( try ? provider. send ( request: newAccount. getNonce ( ) ) ) ?? . zero
176+
177+ let feeEstimate = try await provider. send ( request: newAccount. estimateDeployAccountFeeV3 ( classHash: accountContractClassHash, calldata: [ newPublicKey] , salt: . one, nonce: nonce) ) [ 0 ]
178+
179+ let params = StarknetDeployAccountParamsV3 ( nonce: nonce, resourceBounds: feeEstimate. toResourceBounds ( ) , tip: UInt64AsHex ( 10 ) )
180+
181+ let deployAccountTransaction = try newAccount. signDeployAccountV3 ( classHash: accountContractClassHash, calldata: [ newPublicKey] , salt: . one, params: params, forFeeEstimation: false )
182+
183+ let response = try await provider. send ( request: RequestBuilder . addDeployAccountTransaction ( deployAccountTransaction) )
184+
185+ try await Self . devnetClient. assertTransactionSucceeded ( transactionHash: response. transactionHash)
186+
187+ let newNonce = try await provider. send ( request: newAccount. getNonce ( ) )
188+ XCTAssertEqual ( newNonce. value - nonce. value, Felt . one. value)
189+
190+ let tx = try await provider. send ( request: RequestBuilder . getTransactionBy ( hash: response. transactionHash) ) . transaction as? StarknetDeployAccountTransactionV3
191+ XCTAssertEqual ( params. tip, tx? . tip)
192+ }
193+
147194 func testSignTypedDataRev0( ) async throws {
148195 let typedData = try loadTypedDataFromFile ( name: " typed_data_rev_0_struct_array_example " )
149196
0 commit comments