New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@reservoir0x/gelato-adapter

Package Overview
Dependencies
Maintainers
8
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reservoir0x/gelato-adapter

An adapter used to enhance a ethers wallet adapter with the gelato SDK for use in the @reservoir0x/reservoir-sdk to enable gasless transactions

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
369
decreased by-7.52%
Maintainers
8
Weekly downloads
 
Created
Source

Reservoir Ethers Wallet Adapter

Installation

yarn add @reservoir0x/gelato-adapter @reservoir0x/reservoir-sdk

Also make sure to install the peer dependencies required by the adapter if your application doesn't already include them:

yarn add ethers viem @reservoir0x/reservoir-sdk

Usage

To use the adapter pass in your ethers signer and gelato api key. In return receive a normalized ReservoirWallet object:

import { getClient } from '@reservoir0x/reservoir-sdk'
import { adaptGelatoRelayer } from '@reservoir0x/gelato-adapter'
import { useSigner } from 'wagmi'

...

const { data: signer } = useSigner()
const wallet = adaptGelatoRelayer(signer, GELATO_API_KEY)

getClient().actions.buyToken({
  items: [
    {
      collection: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
    },
  ],
  options: {
    usePermit: true,
    currency: '0x07865c6e87b9f70255377e024ace6630c1eaa37f', //GOERLI USDC
  },
  wallet,
  onProgress: () => {},
})

In the code snippet above we use the wagmi useSigner method, which is not required, you can create your ethers signer however you wish. We then adapt the signer to the ReservoirWallet object and pass this into any of the SDK methods. Here we pass it into the buyToken method along with the other required parameters. In order for the purchase to be successful you'll need the following:

  • Configure your gelato application to whitelist Reservoir's PermitProxy.
  • Pass usePermit: true to make the API return calldata that routes to the permit proxy
  • Make sure the erc20 used for purchase is compatible with Permit2. (USDC, etc)

Keywords

FAQs

Package last updated on 15 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc