Commit 9f00140
* adding changes for snip29.
* fix: outdated function name call due to merge with main
* chore: remove new paymaster tests from the mock_test.go file
This file is planned to be removed in the future, so no need to add more tests here. We can use the mockgen pkg intead
* refactor: move paymaster code to a dedicated paymaster pkg
* refactor: update Paymaster client and the NewPaymasterClient() logic
* chore: regenerate paymaster mock
* chore: go mod tidy
* test: add setup function for paymaster tests with mock and integration environments
* fix: fix circular import error by removing the paymaster mock and interface
We are not using this interface anywere, nor the mock
* refactor: simplify paymaster test setup functions by introducing MockPaymaster and removing environment enum
* test: add IsAvailable method tests for both integration and mock scenarios
* fix: linter errors + wrong additional parameter in the paymaster RPC calls
* docs: update comments for Paymaster methods and TokenData structure for clarity and consistency
* test: add GetSupportedTokens method tests and enable parallel execution for existing tests
* test: enhance GetSupportedTokens test with mock test and enable parallel execution
* docs: enhance comments for TrackingIdResponse and add new enum for txnStatus
* refactor: update comments for BuildTransaction method and enhance UserTransaction type with new enum for transaction types
* feat: add JSON marshaling and unmarshaling for TxnStatus to improve serialization handling
* refactor: move BuildTransaction method and related types to a separate file better organization
* feat: add PaymasterInterface with method signatures
* refactor: improve UserTransaction type with new types
* refactor: update transaction building types to use pointers and enhance fee mode handling
* refactor: enhance UserParameters with optional TimeBounds
* test: new test for the UserTxnType type and a helper to facilitate enum tests
* test: add new tests for FeeModeType
* test: add integration test for BuildTransaction and improve parallel execution in existing tests
* fix: linter errors
* refactor: introduce UserParamVersion type for execution parameter versioning and enhance JSON marshaling
* test: add unit tests for UserParamVersion type to validate input and expected outcomes
* test: update integration test for BuildTransaction to utilize UserParamV1
* feat: add Paymaster-specific error handling and structured error data for transaction execution
* feat: improve error handling in BuildTransaction by wrapping errors with Paymaster-specific error types
* test: update test environment handling and add main test for Paymaster integration
* test: enhance test environment setup for Paymaster tests and improve parallel execution
* test: remove redundant paymaster tests
* fix: linter errors
* test: enhance BuildTransaction test for 'deploy' transaction type and improve request logging
* test: refactor SetupPaymaster to return spy for enhanced testing and update related tests
* test: update BuildTransaction test to assert JSON equality with spy's last response
* test: enhance BuildTransaction test for 'deploy' transaction type with sponsored and default fee modes
* chore: move Call and UserInvoke types to build_txn.go for better organization
* test: add utility function for STRK account data retrieval
* test: add 'invoke' transaction type tests with sponsored and default fee modes
* chore: update BuildTransactionResponse to use typedData.TypedData for better type safety
* feat: implement the fee mode changes in the SNIP-29 introduced by the PR 154 in the snip repo
ref: starknet-io/SNIPs#154
* test: add ExecuteTransaction test file
* test: enhance TestBuildTransaction with deploy-and-invoke transaction type
- Added tests for deploying and invoking transactions, including different fee modes.
- Refactored setup for deployment and invocation data to improve clarity and reduce redundancy.
- Updated test cases to validate behavior under sponsored and default fee modes with varying tip priorities.
* test: add mock tests for deploy transaction type in TestBuildTransaction
- Introduced mock tests for the deploy transaction type, validating the request and response against expected JSON structures.
- Added new JSON files for expected request and response data to facilitate testing.
* test: add mock tests for invoke transaction type in TestBuildTransaction
- Introduced mock tests for the invoke transaction type, validating the request and response against expected JSON structures.
- Added new JSON files for expected request and response data to facilitate testing.
* test: add mock tests for deploy_and_invoke transaction type in TestBuildTransaction
- Introduced mock tests for the deploy_and_invoke transaction type, validating the request and response against expected JSON structures.
- Added new JSON files for expected request and response data to facilitate testing.
* feat: implement ExecuteTransaction functionality in paymaster
- Added ExecuteTransaction method to handle the execution of signed transactions via the paymaster service.
- Introduced ExecuteTransactionRequest and ExecuteTransactionResponse types for structured transaction execution requests and responses.
* test: update ExecuteTransaction tests and refactor related functions
- Modified the ExecuteTransactionRequest struct to use pointers for Transaction and Parameters for better handling of nil values.
- Updated the buildDeployTxn function to accept a public key parameter, enhancing its functionality.
- Refactored SetupPaymaster to return a tests.Spyer interface for improved testability.
- Added logging for transaction responses to aid in debugging during integration tests.
* fix: improve error handling in ExecuteTransaction method
- Enhanced the error handling in the ExecuteTransaction method by wrapping the error with the errors specified in the SNIP-29 spec.
* test: enhance ExecuteTransaction tests with additional logging and invoke transaction handling
- Added detailed logging to the ExecuteTransaction tests to improve traceability during execution.
- Introduced a new test case for executing invoke transactions, including signing and parameter handling.
- Updated the buildDeployTxn function to include logging for better debugging of transaction building processes.
- Modified the ExecutableUserInvoke struct to use a pointer for TypedData, improving memory management.
* test: enhance ExecuteTransaction tests with improved logging and invoke transaction construction
- Updated the ExecuteTransaction tests to include additional logging for better traceability of transaction execution.
- Refactored the buildInvokeTxn function to include detailed logging of the transaction building process and the invoke data structure.
* test: update buildDeployTxn for Argent account class support
- Changed the class hash in buildDeployTxn to use the Argent account class that supports outside executions.
- Updated constructor calldata to reflect the Argent account contract constructor.
* test: enhance ExecuteTransaction tests with deploy_and_invoke transaction case
- Added a new test case for executing deploy_and_invoke transactions, including the construction of the request and signing process.
* test: improve transaction building functions with dedicated data creation methods
- Streamlined the transaction building process by separating data creation from the transaction execution logic.
* test: refactor ExecuteTransaction test to utilize buildDeployAndInvokeTxn
- Updated the TestExecuteTransaction to use the new buildDeployAndInvokeTxn function for constructing deploy and invoke transactions.
- Improved the clarity and efficiency of the test by consolidating transaction building logic.
- The test now is passing
* test: add mock tests for ExecuteTransaction with test case for the deploy txn type
* test: add invoke transaction test case to ExecuteTransaction mock tests
- Introduced a new test case for executing invoke transactions within the ExecuteTransaction tests.
- Added detailed logging for building the invoke request and asserting the request and response against expected values.
- Included a new JSON file for the invoke request structure to facilitate testing.
* test: add deploy_and_invoke transaction test case to ExecuteTransaction mock tests
- Introduced a new test case for executing deploy_and_invoke transactions within the ExecuteTransaction tests.
- Included detailed logging for request construction and response validation.
- Utilized JSON files for expected request and response structures to enhance test accuracy.
* fix: linter errors
* refactor: remove unused outside execution typed data structures and related tests
- Deleted the OutsideExecutionTypedData structure and its associated message types (V1, V2, V3).
- Removed corresponding test cases for outside execution typed data from paymaster_test.go.
- Cleaned up the paymaster.go file by eliminating constants and functions related to outside execution typed data.
* refactor: separate the IsAvailable method and related tests to separate files
* refactor: separate the GetSupportedTokens method and related tests to separate files
* refactor: separate the TrackingIdToLatestHash method to a separate file
* refactor: make TrackingIdToLatestHash return rpc error
* test: add unit test for TrackingIdToLatestHash method in paymaster
- The test mocks the paymaster environment and checks the response against expected values.
- Ensured proper error handling and JSON response validation within the test.
* test: add unit tests for TxnStatus enum in paymaster
* refactor: move TxnStatus and TrackingIdResponse to tracking_id.go
- Moved the TxnStatus enum and its JSON marshaling/unmarshaling methods from types_paymaster.go to tracking_id.go for better organization.
* refactor: move TokenData type to the get_tokens.go file to better organization
* refactor: rename types_paymaster.go to errors.go
- Since the file only has error types, makes sense to rename it
* refactor: make PaymasterInterface a private type
- It has no other use inside the code than asserting implementation
* docs: clarify Cairo version comment in AccDeploymentData struct
* test: move CompareEnumsHelper to the main_test.go file
* refactor: update FeeMode and TipPriority structures for clarity
- Made the Tip field in FeeMode optional, and returns nothing if it is ommited. No magic side effects in the MarshalJSON method.
- Updated comments for better understanding of default behaviors.
- Adjusted JSON test data to reflect changes in the FeeMode structure.
* refactor: rename NewPaymasterClient to New
* feat: add paymaster example
- Introduced a new example in the`examples/` folder demonstrating the usage of the paymaster provider.
* docs: add description to the options parameter in the paymaster.New() func
* feat: new deploy txn paymaster example
- Added a new `deploy.go` file showing how to use the paymaster to deploy an account sending a `deploy` txn.
- Introduced a constant for the AVNU paymaster URL to improve code readability.
* feat: new deploy_and_invoke txn paymaster example
- Added a new `deploy_and_invoke.go` file showing how to use the paymaster to deploy an account and invoke a txn by sending a `deploy_and_invoke` txn.
* docs: enhance paymaster example with detailed usage instructions about SNIP-9 and 29
* docs: add README for paymaster example with detailed instructions on usage and setup
* feat: add AVNU_API_KEY var support in paymaster examples
- Introduced a new function to retrieve the AVNU_API_KEY from the environment.
- Updated paymaster example files to load the AVNU_API_KEY for deployment and invocation.
- Modified the README to include instructions for setting the AVNU_API_KEY in the .env file.
* docs: update README and examples to include paymaster interaction
- Added a new section in the main README to link to the paymaster example.
- Updated examples README to provide instructions on how to interact with the paymaster and send transactions.
* feat: add paymaster integration tests workflow
- Created a new GitHub Actions workflow for running integration tests on the paymaster module.
- Updated the existing test workflow to include building the paymaster directory.
* fix: linter errors
* refactor: update code to new changes from main
* fix: linter errors
* chore: increase hugeParam threshold
* refactor: make BuildTransaction accept and return values instead of pointers
* docs: explain the reason of not use omitempty in TimeBounds
* refactor: make ExecuteTransaction accept and return values instead of pointers
* chore: update examples with the new changes
* docs: nolint statement automatically removed with the new hugeParam threshold
* chore: rename ConstructorCalldata to Calldata in AccDeploymentData
* chore: rename AccDeploymentData to AccountDeploymentData
* refactor: change UserTxnType to use int values instead of string
* refactor: change UserParamVersion to use int values instead of string
* refactor: change FeeModeType to use int values instead of string
* refactor: change TipPriorityEnum to use int values instead of string
* test: add unit tests for TipPriority type and improve JSON marshaling
* refactor: update account contract versioning to use CairoVersion type
* refactor: update Paymaster client initialization to include context parameter
* test: add linter comment to IsAvailable test
* refactor: update transaction request parameters to use pointer types for BuildTransactionRequest and ExecuteTransactionRequest
* test: fix mock tests
* fix: missing context param in paymaster example
* test: udpat with new changes from the PR 3
* refactor: update transaction status representation to use enum type
* refactor: reorder interface methods in paymasterInterface
* test: update with new changes from the PR 4
* refactor: improve error handling in paymaster examples by using %w for error wrapping
* chore: add changes from PR 5
* chore: update CHANGELOG to include new `paymaster` package and examples
---------
Co-authored-by: thiagodeev <[email protected]>
Co-authored-by: Thiago Ribeiro <[email protected]>
1 parent 4fd6168 commit 9f00140
File tree
39 files changed
+3571
-5
lines changed- .github/workflows
- examples
- internal
- paymaster
- internal/tests
- paymaster
- testdata
- build_txn
- execute_txn
- rpc
- typedata
39 files changed
+3571
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| 115 | + | |
112 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
0 commit comments