-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC 0.6.0 cleanup #381
RPC 0.6.0 cleanup #381
Conversation
… correctly handled by networks
76099bc
to
09e24da
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #381 +/- ##
==========================================
+ Coverage 67.64% 69.29% +1.65%
==========================================
Files 72 72
Lines 3171 3127 -44
Branches 322 315 -7
==========================================
+ Hits 2145 2167 +22
+ Misses 863 810 -53
+ Partials 163 150 -13 ☔ View full report in Codecov by Sentry. |
…ateTransactionsTest
- SEPOLIA_TESTNET -> SEPOLIA - SEPOLIA_INTEGRATION -> INTEGRATION_SEPOLIA
tip = tip, | ||
paymasterData = paymasterData, | ||
accountDeploymentData = accountDeploymentData, | ||
nonceDataAvailabilityMode = nonceDataAvailabilityMode, | ||
feeDataAvailabilityMode = feeDataAvailabilityMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also make primary constructor private similarly to TransactionPayload
, v3 params and so on, and create constructor with hardcoded fields? I decided to not do it for now:
- to not further clutter the PR
- because there were previously some non-rpc fields and we didn't hardcode anything
- we mainly use
TransactionFactory
to correctly createTransaction
objects anyway
This would be easily solved with #394, but we decided to do it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need, I suppose
lib/src/main/kotlin/com/swmansion/starknet/data/types/transactions/TransactionPayload.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glanced through tests
let's remember about carefully describing this changes in changelog, when new version is released
@@ -146,21 +170,6 @@ data class InvokeTransactionV1( | |||
version = version, | |||
) | |||
} | |||
|
|||
companion object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this no longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use it anywhere, I'm not sure if we ever did use it. I couldn't find it being used in #197 (PR where it was added). Since this is an internal method and we don't use it anywhere internally, I don't think we need it.
tip = tip, | ||
paymasterData = paymasterData, | ||
accountDeploymentData = accountDeploymentData, | ||
nonceDataAvailabilityMode = nonceDataAvailabilityMode, | ||
feeDataAvailabilityMode = feeDataAvailabilityMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need, I suppose
lib/src/main/kotlin/com/swmansion/starknet/data/types/transactions/TransactionPayload.kt
Show resolved
Hide resolved
@Serializable(with = JsonRpcStandardErrorSerializer::class) | ||
internal data class JsonRpcStandardError( | ||
@SerialName("code") | ||
override val code: Int, | ||
|
||
@SerialName("message") | ||
override val message: String, | ||
|
||
@SerialName("data") | ||
override val data: String? = null, | ||
) : JsonRpcError() | ||
|
||
@Serializable | ||
internal data class JsonRpcContractError( | ||
@SerialName("code") | ||
override val code: Int, | ||
|
||
@SerialName("message") | ||
override val message: String, | ||
|
||
@SerialName("data") | ||
override val data: JsonRpcContractErrorData, | ||
) : JsonRpcError() | ||
|
||
@Serializable | ||
internal data class JsonRpcContractErrorData( | ||
@SerialName("revert_error") | ||
val revertError: String, | ||
) { | ||
override fun toString(): String { | ||
return revertError | ||
} | ||
} | ||
val data: String? = null, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this change related to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, I guess 😅
Describe your changes
Refactoring and cleanup post #358. Includes missing transaction v3 functionalities, more streamlined interface, bug fixes and tests covering Starknet 0.13 features.
Account
,StandardAccount
V1
,V2
,V3
postfixes respectivelyestimateFeeV(1|3)
no longer acceptsSet<SimulationFlagForEstimateFee>
, instead takesskipValidate: Bool
estimateFeeV3(Call)
executeV3
estimates incorrect fee #396Deployer
,StandardDeployer
: AdddeployContractV3
methods ; renamedeployContract
->deployContractV1
ExecutionParamsV3
->InvokeParamsV3
TransactionPayload
: make primary constructor private; add custom constructor with hardcoded valuesTransactionFactory
: don't accept v3 transaction paramsDeprecatedTransaction
andTransactionV3
interfacesStarknetChainId
: RenameSEPOLIA_TESTNET
->SEPOLIA
, renamedSEPOLIA_INTEGRATOIN
->INTEGATION_SEPOLIA
(should we remove enum altogether?)TransactionHashCalculator
: test v3s; add missing declare v1/v2 testsFeltTests
->NumAsHexBaseTests
; test all numbers; nest Felt-specific tests; add Uint256 tetsStandardAccountTest
DeclareEstimateTest
,DeclareTests
,DeployAccountEstimateTest
,DeployAccountTest
,DeployAccountEstimateTest
simulateTransactions
,estimateFee
)SKIP_VALIDATE
testStandardDeployerTest
: test deploy v3contract_with_constructor.cairo
(no longer used in tests)Linked issues
Closes #402
Closes #372
Closes #393
Closes #395
Closes #396
Closes #374
Breaking changes
Account
,StandardAccount
: all methods that have v1, v2 and v3 variants now haveV1
,V2
,V3
postfixes respectivelyDeployer
,StandardDeployer
:deployContract
split intodeployContractV1
anddeployContractV3
estimateFeeV(1|3)
no longer acceptsSet<SimulationFlagForEstimateFee>
, instead takesskipValidate: Bool
tip
,paymasterData
,accountDeploymentData
,nonceDataAvailabilityMode
,feeDataAvailabilityMode
) fromTransactionPayload
constructorstip
,paymasterData
,accountDeploymentData
,nonceDataAvailabilityMode
,feeDataAvailabilityMode
) fromTransactionFactory
methodsExecutionParamsV3
->InvokeParamsV3
StarknetChainId
: RenamedSEPOLIA_TESTNET
->SEPOLIA
, renamedSEPOLIA_INTEGRATOIN
->INTEGATION_SEPOLIA
,