Namespace
L1 network name (e.g. 'mainnet', 'goerli')
Optional
signer: TProviderEthers Signer
for signing transactions.
Optional
chainProviders: ChainProvidersNew Hop SDK instance.
Instantiates Hop SDK. Returns a new Hop SDK instance.
import { Hop } from '@hop-protocol/sdk'
const hop = new Hop('mainnet')
import { Hop } from '@hop-protocol/sdk'
import { Wallet } from 'ethers'
const signer = new Wallet(privateKey)
const hop = new Hop('mainnet', signer)
Chain class
Event enum
Token class
Rest
...args: [signerOrProvider: TProvider]Network name
Ethers signer or provider
Static
ChainChain class
Static
EventEvent enum
Static
TokenToken class
version string
Returns the SDK version.
import { Hop } from '@hop-protocol/sdk'
const hop = new Hop()
console.log(hop.version)
Protected
_getProtected
_getEthers Signer
for signing transactions.
A new Hop SDK instance with connected Ethers Signer.
Returns hop instance with signer connected. Used for adding or changing signer.
import { Hop } from '@hop-protocol/sdk'
import { Wallet } from 'ethers'
const signer = new Wallet(privateKey)
let hop = new Hop()
// ...
hop = hop.connect(signer)
Ether's Signer
Percentage to bump by.
Bumped as price as BigNumber
Calculates current gas price plus increased percentage amount.
import { Hop } from '@hop-protocol/sdk'
const hop = new Hop()
const bumpedGasPrice = await hop.getBumpedGasPrice(signer, 1.20)
console.log(bumpedGasPrice.toNumber())
Chain model.
Returns Chain ID for specified Chain model.
Chain model.
Ethers provider.
Returns Ethers provider for specified Chain model.
Token name or model.
Token model.
Returns a Token instance.
Watches for Hop transaction events.
import { Hop } from '@hop-protocol/sdk'
const hop = new Hop()
hop
.watch(tx.hash, 'USDC', Chain.Ethereum, Chain.Gnosis)
.on('receipt', ({receipt, chain}) => {
console.log(chain.Name, receipt)
})
Generated using TypeDoc
Class reprensenting Hop Hop