This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad1ec86
commit 8e83f47
Showing
5 changed files
with
136 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/app/connect/account-abstraction/gasless/engine/page.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { SDKCard, Grid, DocImage, createMetadata, Step, Steps, InstallTabs, OpenSourceCard } from "@doc"; | ||
|
||
# Engine | ||
|
||
Learn to setup gasless transactions using TransactionButton and Engine | ||
|
||
This guide assumes you have already installed Connect SDK into your application. If you have not, please refer to the [quickstart guide](/connect/quickstart). | ||
|
||
<Steps> | ||
|
||
<Step title="Relayer URL"> | ||
|
||
Obtain the Relayer URL using Engine. For steps on how to obtain the Relayer URL, refer to the [Engine relayer guide](/engine/features/relayers). | ||
|
||
</Step> | ||
|
||
|
||
<Step title="Add transaction button"> | ||
Add a transaction button for the method you want to sponsor funds for. Pass in the `relayerUrl` and `relayerForwarderAddress` | ||
|
||
```jsx | ||
function Example() { | ||
return ( | ||
<TransactionButton | ||
transaction={() => { | ||
// Create a transaction object and return it | ||
const tx = prepareContractCall({ | ||
contract, | ||
method: "mint", | ||
params: [address, amount], | ||
}); | ||
return tx; | ||
}} | ||
onTransactionSent={(result) => { | ||
console.log("Transaction submitted", result.transactionHash); | ||
}} | ||
onTransactionConfirmed={(receipt) => { | ||
console.log("Transaction confirmed", receipt.transactionHash); | ||
}} | ||
onError={(error) => { | ||
console.error("Transaction error", error); | ||
}} | ||
gasless={{ | ||
provider: "engine", | ||
relayerUrl: "...", | ||
relayerForwarderAddress: "...", | ||
}} | ||
> | ||
Confirm Transaction | ||
</TransactionButton> | ||
); | ||
} | ||
``` | ||
|
||
</Step> | ||
|
||
</Steps> |
63 changes: 63 additions & 0 deletions
63
src/app/connect/account-abstraction/gasless/openzeppelin/page.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { SDKCard, Grid, DocImage, createMetadata, Step, Steps, InstallTabs, OpenSourceCard } from "@doc"; | ||
|
||
# OpenZeppelin | ||
|
||
Learn to setup gasless transactions using TransactionButton and OpenZeppelin's gasless relayers. | ||
|
||
This guide assumes you have already installed Connect SDK into your application. If you have not, please refer to the [quickstart guide](/connect/quickstart). | ||
|
||
<Steps> | ||
|
||
<Step title="Relayer URL"> | ||
|
||
Obtain the Relayer URL using OpenZeppelin. For steps on how to obtain the Relayer URL, refer to the [OpenZeppelin documentation](https://docs.openzeppelin.com/defender/v2/manage.html#relayers). | ||
|
||
<Step title="Forwarder Address"> | ||
|
||
Obtain a Forwarder Address using Biconomy for the specified network. Learn how to obtain a forwarder address from [OpenZeppelin documentation](https://docs.openzeppelin.com/contracts/5.x/api/metatx) | ||
|
||
</Step> | ||
|
||
</Step> | ||
|
||
|
||
<Step title="Add transaction button"> | ||
Add a transaction button for the method you want to sponsor funds for. Pass in the `relayerUrl` and `relayerForwarderAddress` | ||
|
||
```jsx | ||
function Example() { | ||
return ( | ||
<TransactionButton | ||
transaction={() => { | ||
// Create a transaction object and return it | ||
const tx = prepareContractCall({ | ||
contract, | ||
method: "mint", | ||
params: [address, amount], | ||
}); | ||
return tx; | ||
}} | ||
onTransactionSent={(result) => { | ||
console.log("Transaction submitted", result.transactionHash); | ||
}} | ||
onTransactionConfirmed={(receipt) => { | ||
console.log("Transaction confirmed", receipt.transactionHash); | ||
}} | ||
onError={(error) => { | ||
console.error("Transaction error", error); | ||
}} | ||
gasless={{ | ||
provider: "openzeppelin", | ||
relayerUrl: "...", | ||
relayerForwarderAddress: "...", | ||
}} | ||
> | ||
Confirm Transaction | ||
</TransactionButton> | ||
); | ||
} | ||
``` | ||
|
||
</Step> | ||
|
||
</Steps> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters