Transactions
Migrating from Transactions v2 to v3
Learn how to migrate your applications from v2 to v3. We'll cover common operations and highlight the differences in API requests and authentication.
Migrating Wallets
If you'd like to migrate your wallets from v2 to v3 to also be secured by Vault or thirdweb's key management service, please contact us for assistance.
Migrating your contract write operations from v2 to v3 involves changes to the endpoint, authentication mechanism, and request payload structure.
The v2 approach used your dedicated Transactions url, with a specific endpoint for each chain and contract and backend wallet address in the header.
The v3 approach uses a generic POST endpoint, with authentication via secret key and vault access token. Contract, chain, and execution details are now part of a structured JSON payload.
- API Endpoint: The endpoint has changed from a specific path per chain and contract (
<engine_url>/contract/<chain>/<contract_address>/write) to a general endpoint (https://engine.thirdweb.com/v1/write/contract). - Authentication:
- V2 used an
Authorization: Bearer <access_token>header for general API access and anx-backend-wallet-addressheader to specify the sender. - V3 uses an
x-secret-keyheader (your project's secret key, found in your thirdweb dashboard) for authentication. Your backend wallet is managed by thirdweb Vault, anx-vault-access-tokenheader is required for all write operations.
- V2 used an
- Request Structure:
- Sender & Chain: In V2, the sender wallet was a header, and the chain was part of the URL. In V3, these are specified in the request body within an
executionOptionsobject:fromfor the sender wallet address andchainIdfor the target chain. - Contract Call: V2 took
functionNameandargsdirectly in the body. V3 uses aparamsarray in the request body. Each element in this array is an object defining the targetcontractAddress, the partial or fullmethodsignature (e.g.,"function mintTo(address to, uint256 amount)"), and theparams(arguments) for that method.
- Sender & Chain: In V2, the sender wallet was a header, and the chain was part of the URL. In V3, these are specified in the request body within an
- Function Specification: While V3 supports using just the method name (e.g., "transferFrom") in the
methodfield, providing the full function signature (e.g., "function transferFrom(address from, address to, uint256 amount)") is highly recommended for optimal performance as it avoids an ABI lookup. V2 only required thefunctionName.
Querying transaction status has also been updated, moving from a direct ID lookup via GET to a POST request with a filter-based search.
In v2, transaction status was fetched using a GET request with the queue_id in the URL.
V3 uses a search endpoint with a POST request, where transaction identifiers are passed in the request body using filters.
- API Endpoint & Method: The V2
GETendpoint (<engine_url>/transaction/status/<queue_id>) is replaced by a V3POSTendpoint (https://engine.thirdweb.com/v1/transactions/search). - Authentication:
- V2 used an
Authorization: Bearer <access_token>header. - V3 uses an
x-secret-keyheader (your project's secret key).
- V2 used an
- Querying Transaction Status:
- In V2, the
queue_idwas passed directly in the URL path. - In V3, you send a
POSTrequest with a JSON body containing afiltersarray. To find a specific transaction, you filter by itsid(the equivalent of V2'squeue_id). This filter-based approach is more flexible for querying transactions based on various criteria.
- In V2, the
Reading data from a smart contract has also been updated in v3, shifting from URL-based parameters to a structured JSON payload over POST.
In v2, contract reads were GET requests. The chain, contract address, function name, and arguments were specified in the URL path and query parameters.
V3 uses a POST request to a dedicated read endpoint. All parameters, including chain, contract details, method signature, and arguments, are provided in the JSON body.
- API Endpoint & Method:
- V2 used a
GETrequest to<engine_url>/contract/<chain>/<contract_address>/readwith function details as query parameters. - V3 uses a
POSTrequest to the generic endpointhttps://engine.thirdweb.com/v1/read/contract.
- V2 used a
- Authentication:
- V2 used an
Authorization: Bearer <access_token>header. - V3 uses an
x-secret-key: <your-project-secret-key>header.
- V2 used an
- Request Structure:
- In V2, the chain and contract address were part of the URL path, and the function name (
functionName) and its arguments (args) were URL query parameters. - In V3, the request body is a JSON object. It includes a
paramsarray (where each object specifiescontractAddress, the partial or fullmethodsignature, and itsparams) and areadOptionsobject to specify thechainId.
- In V2, the chain and contract address were part of the URL path, and the function name (
- Function Specification: Similar to contract writes, while V3 supports using just the method name (e.g., "balanceOf") in the
methodfield, providing the full function signature (e.g., "function balanceOf(address account) returns (uint256)") is highly recommended for optimal performance as it avoids an ABI lookup. V2 primarily used just the function name in thefunctionNamequery parameter.
V2 has a large number of endpoints to do specific contract calls, like mintTo, claimTo, etc.
V3 does not have these endpoints yet, but they are coming soon. In the meantime, if your backend is written in typescript, we recommend using the thirdweb SDK to do these operations:
The entire thirdweb SDK is available to use with Transactions v3 in this manner using the Transactions namespace. Check the thirdweb SDK docs for all available functions.