Skip to content

Commit 70f5267

Browse files
authored
Updated: Backend-wallet send-transaction to allow tx-overrides (#532)
* Updated: Backend-wallet transaction to allow tx-overrides * bumping sdk version with this update * brought back example
1 parent 0825932 commit 70f5267

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thirdweb-dev/engine",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"main": "dist/thirdweb-dev-engine.cjs.js",
55
"module": "dist/thirdweb-dev-engine.esm.js",
66
"files": [

src/server/routes/backend-wallet/sendTransaction.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
standardResponseSchema,
88
transactionWritesResponseSchema,
99
} from "../../schemas/sharedApiSchemas";
10+
import { txOverridesWithoutValue } from "../../schemas/txOverrides";
1011
import { walletHeaderSchema } from "../../schemas/wallet";
1112
import { getChainIdFromChain } from "../../utils/chain";
1213

@@ -26,13 +27,17 @@ const requestBodySchema = Type.Object({
2627
value: Type.String({
2728
examples: ["10000000"],
2829
}),
30+
...txOverridesWithoutValue.properties,
2931
});
3032

3133
requestBodySchema.examples = [
3234
{
3335
toAddress: "0x7a0ce8524bea337f0bee853b68fabde145dac0a0",
3436
data: "0x449a52f800000000000000000000000043cae0d7fe86c713530e679ce02574743b2ee9fc0000000000000000000000000000000000000000000000000de0b6b3a7640000",
3537
value: "0x00",
38+
txOverrides: {
39+
gas: "50000",
40+
},
3641
},
3742
];
3843

@@ -61,7 +66,7 @@ export async function sendTransaction(fastify: FastifyInstance) {
6166
},
6267
handler: async (request, reply) => {
6368
const { chain } = request.params;
64-
const { toAddress, data, value } = request.body;
69+
const { toAddress, data, value, txOverrides } = request.body;
6570
const { simulateTx } = request.query;
6671
const {
6772
"x-backend-wallet-address": fromAddress,
@@ -77,6 +82,7 @@ export async function sendTransaction(fastify: FastifyInstance) {
7782
value,
7883
simulateTx,
7984
idempotencyKey,
85+
...txOverrides,
8086
});
8187

8288
reply.status(StatusCodes.OK).send({

src/server/schemas/txOverrides.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,28 @@ export const txOverrides = Type.Object({
3030
}),
3131
),
3232
});
33+
34+
export const txOverridesWithoutValue = Type.Object({
35+
txOverrides: Type.Optional(
36+
Type.Object({
37+
gas: Type.Optional(
38+
Type.String({
39+
examples: ["530000"],
40+
description: "Gas limit for the transaction",
41+
}),
42+
),
43+
maxFeePerGas: Type.Optional(
44+
Type.String({
45+
examples: ["1000000000"],
46+
description: "Maximum fee per gas",
47+
}),
48+
),
49+
maxPriorityFeePerGas: Type.Optional(
50+
Type.String({
51+
examples: ["1000000000"],
52+
description: "Maximum priority fee per gas",
53+
}),
54+
),
55+
}),
56+
),
57+
});

0 commit comments

Comments
 (0)