diff --git a/docs/tutorials/utils/index.md b/docs/tutorials/utils/index.md new file mode 100644 index 00000000..d7973ccb --- /dev/null +++ b/docs/tutorials/utils/index.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 11 +title: Utilities + +--- + +The following tutorials provide a detailed, step-by-step guide on how to use Biconomy SDK utility methods. + +```mdx-code-block +import DocCardList from '@theme/DocCardList'; + + +``` \ No newline at end of file diff --git a/docs/tutorials/utils/offsetGasValues.md b/docs/tutorials/utils/offsetGasValues.md new file mode 100644 index 00000000..cb624b41 --- /dev/null +++ b/docs/tutorials/utils/offsetGasValues.md @@ -0,0 +1,41 @@ +--- +sidebar_label: "Offset Gas Values" +sidebar_position: 1 +title: "Offset User Operation Gas Values" +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +### Overview + +This tutorial provides insights into adjusting user operation gas values by a specified percentage. + +:::caution +Exercise caution when implementing this approach. It is recommended to use this only for urgent situations where gas estimates fall short for specific operations. +::: + +For instance, if gas estimates for verificationGasLimitOffsetPct and preVerificationGasOffsetPct are inaccurately low, this method allows for increasing these values by a defined percentage. + +```typescript +const encodedCall = encodeFunctionData({ + abi: parseAbi(["function safeMint(address _to)"]), + functionName: "safeMint", + args: [recipient] +}) +const transaction = { + to: nftAddress, + data: encodedCall +} +const { wait } = await smartAccount.sendTransaction(transaction, { + gasOffset: { + verificationGasLimitOffsetPct: 25, // 25% increase + preVerificationGasOffsetPct: 9.80, // 9.80% increase + } +}) +const { + receipt: { transactionHash }, + userOpHash, + success +} = await wait() +``` \ No newline at end of file