Gasless publish flow (#216)

* gasless publish flow

* switch to publishing one at a time for now to support gasless
This commit is contained in:
Joaquim Verges
2022-06-29 15:18:24 -07:00
committed by GitHub
parent 9e706d0e86
commit 1dc0490070
7 changed files with 48 additions and 26 deletions
+21 -2
View File
@@ -1,5 +1,5 @@
import { ThirdwebSDKProvider, useSigner } from "@thirdweb-dev/react";
import { SUPPORTED_CHAIN_ID } from "@thirdweb-dev/sdk";
import { ChainId, SDKOptions, SUPPORTED_CHAIN_ID } from "@thirdweb-dev/sdk";
import {
StorageSingleton,
alchemyUrlMap,
@@ -9,7 +9,8 @@ import { useProvider } from "wagmi";
export const CustomSDKContext: ComponentWithChildren<{
desiredChainId?: SUPPORTED_CHAIN_ID | -1;
}> = ({ desiredChainId, children }) => {
options?: SDKOptions;
}> = ({ desiredChainId, options, children }) => {
const signer = useSigner();
const provider = useProvider();
@@ -29,6 +30,7 @@ export const CustomSDKContext: ComponentWithChildren<{
rpcUrl: alchemyUrlMap[desiredChainId],
}
: undefined,
...options,
}}
storageInterface={StorageSingleton}
>
@@ -36,3 +38,20 @@ export const CustomSDKContext: ComponentWithChildren<{
</ThirdwebSDKProvider>
);
};
export const PublisherSDKContext: ComponentWithChildren = ({ children }) => (
<CustomSDKContext
desiredChainId={ChainId.Polygon}
options={{
gasless: {
openzeppelin: {
relayerUrl:
"https://api.defender.openzeppelin.com/autotasks/a94b58a0-dc78-4df7-bd4e-e123d165d5ad/runs/webhook/7d6a1834-dd33-4b7b-8af4-b6b4719a0b97/J1a6Dwmk2cMZGs1b4273tj",
relayerForwarderAddress: "0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81",
},
},
}}
>
{children}
</CustomSDKContext>
);