Skip to content

Commit 9f00140

Browse files
feat: implement SNIP-29 (issue #745) (#768)
* 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

39 files changed

+3571
-5
lines changed

.github/workflows/test_mock_and_examples.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
cd ../readEvents && go build
3030
cd ../simpleCall && go build
3131
cd ../simpleDeclare && go build
32+
cd ../paymaster && go build
3233
cd ../typedData && go build
3334
cd ../websocket && go build
3435
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: paymaster integration tests
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
run:
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- name: Checkout branch
17+
uses: actions/checkout@v5
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v6
21+
with:
22+
go-version-file: go.mod
23+
24+
- name: Run paymaster tests
25+
run: cd paymaster && go test -timeout 300s -v -env integration .
26+
env:
27+
STARKNET_PRIVATE_KEY: ${{ secrets.TESTNET_ACCOUNT_PRIVATE_KEY }}
28+
STARKNET_PUBLIC_KEY: ${{ secrets.TESTNET_ACCOUNT_PUBLIC_KEY }}
29+
STARKNET_ACCOUNT_ADDRESS: ${{ secrets.TESTNET_ACCOUNT_ADDRESS }}
30+
AVNU_API_KEY: ${{ secrets.AVNU_API_KEY }}

.golangci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ linters:
4949
min-occurrences: 3
5050
gocritic:
5151
enable-all: true
52+
settings:
53+
hugeParam:
54+
sizeThreshold: 256
5255
gocyclo:
5356
min-complexity: 15
5457
govet:
@@ -109,7 +112,12 @@ linters:
109112
- gosec
110113
- lll
111114
- mnd
115+
- funlen # it's ok for the examples to have big main() functions
112116
path: examples/
117+
- linters:
118+
- gocritic #commentedOutCode: "curve.SignFelts..." is there just as an explanation
119+
- unused # it's part of the example to have two unused functions
120+
path: examples/paymaster/
113121
- linters:
114122
- exhaustruct
115123
- noctx

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
-->
1717

1818
### Added
19+
- New `paymaster` pkg for interacting with paymaster services via the SNIP-29 API.
20+
- New `examples/paymaster` folder with examples of how to use the `paymaster` pkg.
1921
- New `rpc.IsCompatible` method to the `rpc.Provider` type. It returns whether the node RPC version is compatible
2022
with the version implemented by the starknet.go provider or not.
2123
- New `rpc.ErrIncompatibleVersion` error variable, used in the `rpc.NewProvider` function.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ operations on the wallets. The package has excellent documentation for a smooth
6161
- [invoke transaction example](./examples/invoke) to add a new invoke transaction on testnet.
6262
- [declare transaction example](./examples/simpleDeclare) to add a new contract on testnet.
6363
- [deploy contract UDC example](./examples/deployContractUDC) to deploy an ERC20 token using [UDC (Universal Deployer Contract)](https://docs.openzeppelin.com/contracts-cairo/1.0.0/udc) on testnet.
64+
- [paymaster example](./examples/paymaster) to learn how to interact with a paymaster and send transactions with it.
6465
- [typed data example](./examples/typedData) to sign and verify a typed data.
6566
- [websocket example](./examples/websocket) to learn how to subscribe to WebSocket methods.
6667

examples/.env.template

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
#ACCOUNT_ADDRESS=0xyour_account_address
77
#PUBLIC_KEY=0xyour_starknet_public_key
88
#PRIVATE_KEY=0xyour_private_key
9-
#ACCOUNT_CAIRO_VERSION=2
9+
#ACCOUNT_CAIRO_VERSION=2
10+
11+
# ----- use this variable for specific cases in the paymaster example
12+
#AVNU_API_KEY=your-api-key

examples/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ To run an example:
4747
R: See [typedData](./typedData/main.go).
4848
1. How to use WebSocket methods? How to subscribe, unsubscribe, handle errors, and read values from them?
4949
R: See [websocket](./websocket/main.go).
50+
1. How to interact with a paymaster? How to send transactions with it?
51+
R: See [paymaster](./paymaster/main.go).

examples/internal/setup.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ func GetAccountCairoVersion() account.CairoVersion {
6262
}
6363
}
6464

65+
// Validates whether the AVNU_API_KEY variable has been set in the '.env' file and returns it; panics otherwise.
66+
func GetAVNUApiKey() string {
67+
return getEnv("AVNU_API_KEY")
68+
}
69+
6570
// Loads an env variable by name and returns it; panics otherwise.
6671
func getEnv(envName string) string {
6772
env := os.Getenv(envName)

examples/paymaster/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
This example demonstrates how to send transactions on Starknet with a paymaster using the Starkent.go [SNIP-29](https://github.com/starknet-io/SNIPs/blob/dfd91b275ea65413f8c8aedb26677a8afff70f37/SNIPS/snip-29.md) implementation, allowing you to pay fees with tokens other than STRK.
2+
It has three files: main.go, deploy.go, and deploy_and_invoke.go.
3+
4+
The main.go file shows how to send an invoke transaction using a paymaster with the "default" fee mode, where you pay fees using supported tokens (like STRK). It demonstrates the complete 3-step process: building the transaction via the paymaster, signing it with your account, and executing the transaction.
5+
6+
The deploy.go file demonstrates how to deploy a new account using a paymaster with the "sponsored" fee mode, where an entity covers the transaction fees.
7+
The deploy_and_invoke.go file shows how to deploy an account and invoke a function in the same transaction using a paymaster, combining both deployment and execution in a single request.
8+
Both of these `deploy...`examples require a valid paymaster API key.
9+
10+
All examples demonstrate integration with the AVNU paymaster service and require SNIP-9 compatible accounts.
11+
12+
Steps:
13+
1. Rename the ".env.template" file located at the root of the "examples" folder to ".env"
14+
2. Uncomment, and assign your Sepolia testnet endpoint to the `RPC_PROVIDER_URL` variable in the ".env" file
15+
3. Uncomment, and assign your SNIP-9 compatible account address to the `ACCOUNT_ADDRESS` variable in the ".env" file (make sure to have some STRK tokens in it)
16+
4. Uncomment, and assign your starknet public key to the `PUBLIC_KEY` variable in the ".env" file
17+
5. Uncomment, and assign your private key to the `PRIVATE_KEY` variable in the ".env" file
18+
6. Make sure you are in the "paymaster" directory
19+
7. Execute `go run .` to run the basic paymaster invoke example
20+
8. To run the deploy examples (requires API key), uncomment the function calls at the end of main.go and execute again. Also, uncomment, and assign your paymaster API key to the `AVNU_API_KEY` variable in the ".env" file
21+
22+
The transaction hashes, tracking IDs, and execution status will be returned at the end of each example.

examples/paymaster/deploy.go

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
"github.com/NethermindEth/juno/core/felt"
8+
"github.com/NethermindEth/starknet.go/account"
9+
"github.com/NethermindEth/starknet.go/client"
10+
setup "github.com/NethermindEth/starknet.go/examples/internal"
11+
"github.com/NethermindEth/starknet.go/internal/utils"
12+
pm "github.com/NethermindEth/starknet.go/paymaster"
13+
)
14+
15+
// OpenZeppelin account class hash that supports outside executions
16+
const OZAccountClassHash = "0x05b4b537eaa2399e3aa99c4e2e0208ebd6c71bc1467938cd52c798c601e43564"
17+
18+
// An example of how to deploy a contract with a paymaster.
19+
func deployWithPaymaster() {
20+
fmt.Println("Starting paymaster example - deploying an account")
21+
22+
// Load variables from '.env' file
23+
AVNUApiKey := setup.GetAVNUApiKey()
24+
25+
// Since all accounts in Starknet are smart contracts, we need to deploy them first before we can use them.
26+
// And to do so, we need to calculate the address of the new account and fund it with
27+
// enough STRK tokens before deploying it. This tokens will be used to pay the fees for the `deploy` txn.
28+
//
29+
// Deploy an account with a paymaster using the `default` fee mode doesn't make much sense, as we will
30+
// need to send some tokens for the account anyway. So, we will use the `sponsored` fee mode now,
31+
// which will allow the paymaster to fully cover the fees for the `deploy` txn. This mode requires
32+
// an API key from an entity. You can only run this example with it.
33+
34+
// Let's initialise the paymaster client, but now, we will also pass our API key to the client.
35+
// In the AVNU paymaster, the API key is a http header called `x-paymaster-api-key`.
36+
// In the current Starknet.go client, you can set a custom http header using the `client.WithHeader` option.
37+
paymaster, err := pm.New(
38+
context.Background(),
39+
AVNUPaymasterURL,
40+
client.WithHeader("x-paymaster-api-key", AVNUApiKey),
41+
)
42+
if err != nil {
43+
panic(fmt.Errorf("error connecting to the paymaster provider with the API key: %w", err))
44+
}
45+
46+
fmt.Println("Established connection with the paymaster provider")
47+
fmt.Print("Step 1: Build the deploy transaction\n\n")
48+
49+
// First, let's get all the data we need for deploy an account.
50+
_, pubKey, privK := account.GetRandomKeys() // Get random keys for the account
51+
fmt.Println("Public key:", pubKey)
52+
fmt.Println("Private key:", privK)
53+
classHash, _ := utils.HexToFelt(
54+
OZAccountClassHash,
55+
) // It needs to be an SNIP-9 compatible account
56+
constructorCalldata := []*felt.Felt{
57+
pubKey,
58+
} // The OZ account constructor requires the public key
59+
salt, _ := utils.HexToFelt("0xdeadbeef") // Just a random salt
60+
// Precompute the address of the new account based on the salt, class hash and constructor calldata
61+
precAddress := account.PrecomputeAccountAddress(salt, classHash, constructorCalldata)
62+
63+
fmt.Println("Precomputed address:", precAddress)
64+
65+
// Now we can create the deploy data for the transaction.
66+
deployData := &pm.AccountDeploymentData{
67+
Address: precAddress, // The precomputed address of the new account
68+
ClassHash: classHash,
69+
Salt: salt,
70+
Calldata: constructorCalldata,
71+
SignatureData: []*felt.Felt{}, // Optional. For the OZ account, we don't need to add anything in the signature data.
72+
Version: pm.Cairo1,
73+
}
74+
75+
// With the deploy data, we can build the transaction by calling the `paymaster_buildTransaction` method.
76+
// REMEMBER: this will only work if you have a valid API key configured.
77+
//
78+
// A full explanation about the paymaster_buildTransaction method can be found in the `main.go` file of this same example.
79+
builtTxn, err := paymaster.BuildTransaction(context.Background(), &pm.BuildTransactionRequest{
80+
Transaction: pm.UserTransaction{
81+
Type: pm.UserTxnDeploy, // we are building an `deploy` transaction
82+
Deployment: deployData,
83+
},
84+
Parameters: pm.UserParameters{
85+
Version: pm.UserParamV1,
86+
FeeMode: pm.FeeMode{
87+
Mode: pm.FeeModeSponsored, // We then set the fee mode to `sponsored`
88+
Tip: &pm.TipPriority{
89+
Priority: pm.TipPriorityNormal,
90+
},
91+
},
92+
},
93+
})
94+
if err != nil {
95+
panic(fmt.Errorf("error building the deploy transaction: %w", err))
96+
}
97+
fmt.Println("Transaction successfully built by the paymaster")
98+
PrettyPrint(builtTxn)
99+
100+
// Since we are deploying an account, we don't need to sign the transaction, just execute it.
101+
102+
fmt.Println("Step 2: Send the signed transaction")
103+
104+
// With our built deploy transaction, we can send it to the paymaster by calling the `paymaster_executeTransaction` method.
105+
response, err := paymaster.ExecuteTransaction(
106+
context.Background(),
107+
&pm.ExecuteTransactionRequest{
108+
Transaction: pm.ExecutableUserTransaction{
109+
Type: pm.UserTxnDeploy,
110+
Deployment: builtTxn.Deployment, // The deployment data is the same. We can use our `deployData` variable, or
111+
// the `builtTxn.Deployment` value.
112+
},
113+
Parameters: pm.UserParameters{
114+
Version: pm.UserParamV1,
115+
116+
// Using the same fee options as in the `paymaster_buildTransaction` method.
117+
FeeMode: pm.FeeMode{
118+
Mode: pm.FeeModeSponsored,
119+
Tip: &pm.TipPriority{
120+
Priority: pm.TipPriorityNormal,
121+
},
122+
},
123+
},
124+
},
125+
)
126+
if err != nil {
127+
panic(fmt.Errorf("error executing the deploy transaction with the paymaster: %w", err))
128+
}
129+
130+
fmt.Println("Deploy transaction successfully executed by the paymaster")
131+
fmt.Println("Tracking ID:", response.TrackingID)
132+
fmt.Println("Transaction Hash:", response.TransactionHash)
133+
}

0 commit comments

Comments
 (0)