Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Chore: Block iframes, update Engine docs on overloaded methods (#344)
Browse files Browse the repository at this point in the history
* chore: Engine overloaded functions

* disallow iframe

* add soruce
  • Loading branch information
arcoraven authored Apr 17, 2024
1 parent 34a744e commit 080f588
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
18 changes: 18 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ const withMDX = createMDX({
const nextConfig = {
pageExtensions: ["mdx", "tsx", "ts"],
redirects,
headers: async () => {
return [
// Disallow all pages from being embedded in an iframe.
{
source: "/:path*",
headers: [
{
key: "Content-Security-Policy",
value: `frame-ancestors 'none';`,
},
{
key: "X-Frame-Options",
value: "DENY",
},
],
},
];
},
};

export default withMDX(nextConfig);
31 changes: 29 additions & 2 deletions src/app/engine/features/contracts/page.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createMetadata } from "@doc";
import { Details, createMetadata } from "@doc";

export const metadata = createMetadata({
title: "Contracts | thirdweb Engine",
Expand Down Expand Up @@ -40,7 +40,34 @@ const { result } = await resp.json();
console.log("Queue ID:", result.queueId);
```

[See API reference.](https://redocly.github.io/redoc/?url=https://demo.web3api.thirdweb.com/json#tag/Contract/operation/write)
<Details id="handling-overloaded-functions" summary="Handling overloaded functions">

If there are multiple signatures for `functionName` on the contract, provide the full signature with args.

**Example**

Your contract has two functions named `mintTo`:

```solidity
function mintTo(address to) public
```

```solidity
function mintTo(address to, uint256 quantity) public
```

This is the request body to call the second function:

```json
{
"functionName": "mintTo(address, uint256)",
"args": ["0x4Ff9aa707AE1eAeb40E581DF2cf4e14AffcC553d", "3"]
}
```

</Details>

[See API reference](https://redocly.github.io/redoc/?url=https://demo.web3api.thirdweb.com/json#tag/Contract/operation/write)

### Call a payable method

Expand Down

0 comments on commit 080f588

Please sign in to comment.