Skip to content

Commit

Permalink
api: add tx gas override params to contract write endpoint (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecananian authored May 10, 2024
1 parent c0ae6a3 commit fa0ec61
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 409 deletions.
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@prisma/client": "^5.3.0",
"@sinclair/typebox": "^0.32.5",
"@thirdweb-dev/auth": "^4.1.4",
"@thirdweb-dev/engine": "^0.0.5",
"@thirdweb-dev/engine": "^0.0.6",
"@treasure-dev/tdk-core": "*",
"@wagmi/core": "^2.9.1",
"abitype": "^1.0.0",
Expand Down
48 changes: 45 additions & 3 deletions apps/api/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,51 @@ export type ReadContractReply = Static<typeof readContractReplySchema>;

// Transactions
export const createTransactionBodySchema = Type.Object({
address: Type.String(),
functionName: Type.String(),
args: Type.Any(),
address: Type.String({
description: "The address of the contract to call",
}),
functionName: Type.String({
description: "The function to call on the contract",
}),
args: Type.Array(
Type.Union([
Type.String({
description: "The arguments to call on the function",
}),
Type.Tuple([Type.String(), Type.String()]),
Type.Object({}),
Type.Array(Type.Any()),
Type.Any(),
]),
),
txOverrides: Type.Optional(
Type.Object({
value: Type.Optional(
Type.String({
examples: ["10000000000"],
description: "Amount of native currency to send",
}),
),
gas: Type.Optional(
Type.String({
examples: ["530000"],
description: "Gas limit for the transaction",
}),
),
maxFeePerGas: Type.Optional(
Type.String({
examples: ["1000000000"],
description: "Maximum fee per gas",
}),
),
maxPriorityFeePerGas: Type.Optional(
Type.String({
examples: ["1000000000"],
description: "Maximum priority fee per gas",
}),
),
}),
),
});

export const createTransactionReplySchema = Type.Object({
Expand Down
Loading

0 comments on commit fa0ec61

Please sign in to comment.