Class HopNamespace

Class reprensenting Hop Hop

Hierarchy

Constructors

Properties

Accessors

Methods

_getBonderAddress _getMessengerWrapperAddress bridge checkBlocklist connect debugTimeLog estimateGas estimateOptimismL1FeeFromData fetchBonderAvailableLiquidityData fetchBonderAvailableLiquidityDataWithIpfsFallback fetchConfigFromS3 fetchCoreConfigData fetchCoreConfigDataWithIpfsFallback fetchIpfsBonderAvailableLiquidityData fetchIpfsCoreConfigData geConfigChains getArbChainAddress getAvailableRoutes getBumpedGasPrice getChainId getChainProvider getChainProviderUrls getChainProviders getConfigAddresses getDebugTimeLogs getDestinationFeeGasPriceMultiplier getExplorerUrl getExplorerUrlForAccount getExplorerUrlForTransactionHash getExplorerUrlForTransferId getFeeBps getIpfsBaseConfigUrl getIsBridgeDeprecated getL1AmbBridgeAddress getL1BridgeAddress getL1CanonicalBridgeAddress getL1CanonicalTokenAddress getL1PosErc20PredicateAddress getL1PosRootChainManagerAddress getL2AmbBridgeAddress getL2AmmWrapperAddress getL2BridgeAddress getL2CanonicalBridgeAddress getL2CanonicalTokenAddress getL2HopBridgeTokenAddress getL2SaddleLpTokenAddress getL2SaddleSwapAddress getProviderRpcUrl getRelayerFee getS3ConfigData getSignerAddress getSignerOrProvider getSupportedAssets getSupportedAssetsForChain getSupportedChains getSupportedTokens getTokenBalancesForAccount getTransferStatus getTransferTimes isValidChain isValidNetwork resolveDnslink sendTransaction setAvailableLiqudityJsonUrl setBaseConfigUrl setChainProvider setChainProviderUrls setChainProviders setConfigAddresses setConfigFileFetchEnabled setCoreConfigJsonUrl setGasPriceMultiplier setPriceFeedApiKeys toChainModel toTokenModel txOverrides watch watchBridge

Constructors

  • Parameters

    • networkOrOptionsObject: string | BaseConstructorOptions

      L1 network name (e.g. 'mainnet', 'goerli')

    • Optional signer: TProvider

      Ethers Signer for signing transactions.

    • Optional chainProviders: ChainProviders

    Returns Hop

    New Hop SDK instance.

    Desc

    Instantiates Hop SDK. Returns a new Hop SDK instance.

    Example

    import { Hop } from '@hop-protocol/sdk'

    const hop = new Hop('mainnet')

    Example

    import { Hop } from '@hop-protocol/sdk'
    import { Wallet } from 'ethers'

    const signer = new Wallet(privateKey)
    const hop = new Hop('mainnet', signer)

Properties

Chain: typeof Chain = Chain

Chain class

Event: typeof Event = Event

Event enum

Token: typeof TokenModel = Token

Token class

addresses: Record<string, any>
baseConfigUrl: string = defaultBaseConfigUrl
baseExplorerUrl: string = 'https://explorer.hop.exchange'
blocklist: Record<string, boolean> = null
bonders: Record<string, any>
bridgeDeprecated: Record<string, boolean>
chainProviders: ChainProviders = {}
chains: Record<string, any>
configFileFetchEnabled: boolean = true
customAvailableLiquidityJsonUrl: string = ''
customCoreConfigJsonUrl: string = ''
debugTimeLogsCache: any[] = []
debugTimeLogsCacheEnabled: boolean = false
debugTimeLogsEnabled: boolean = false
destinationFeeGasPriceMultiplier: number = 1
fees: {
    [token: string]: Record<string, number>;
}

Type declaration

  • [token: string]: Record<string, number>
gasPriceMultiplier: number = 0
getContract: ((factory, address, provider) => Promise<any>) = getContract

Type declaration

    • (factory, address, provider): Promise<any>
    • Parameters

      • factory: Factory
      • address: string
      • provider: TProvider

      Returns Promise<any>

getGasPrice: ((...args) => Promise<BigNumber>) = ...

Type declaration

    • (...args): Promise<BigNumber>
    • Parameters

      Returns Promise<BigNumber>

network: string

Network name

priceFeedApiKeys: ApiKeys = null
relayerFeeEnabled: Record<string, boolean>
relayerFeeWei: Record<string, string>
signer: TProvider

Ethers signer or provider

Chain: typeof Chain = Chain

Chain class

Event: typeof Event = Event

Event enum

Token: typeof TokenModel = Token

Token class

Accessors

  • get availableLiqudityJsonUrl(): string
  • Returns string

  • get configChains(): string[]
  • Returns string[]

  • get coreConfigJsonUrl(): string
  • Returns string

  • get supportedChains(): string[]
  • Returns string[]

  • get supportedNetworks(): string[]
  • Returns string[]

  • get version(): string
  • Returns string

    version string

    Desc

    Returns the SDK version.

    Example

    import { Hop } from '@hop-protocol/sdk'

    const hop = new Hop()
    console.log(hop.version)

Methods

  • Parameters

    • token: TToken

      Token model or symbol of token of bridge to use.

    Returns HopBridge

    A HopBridge instance.

    Desc

    Returns a bridge set instance.

    Example

    import { Hop } from '@hop-protocol/sdk'

    const hop = new Hop()
    const bridge = hop.bridge('USDC')
  • Parameters

    • signer: TProvider

      Ethers Signer for signing transactions.

    Returns Hop

    A new Hop SDK instance with connected Ethers Signer.

    Desc

    Returns hop instance with signer connected. Used for adding or changing signer.

    Example

    import { Hop } from '@hop-protocol/sdk'
    import { Wallet } from 'ethers'

    const signer = new Wallet(privateKey)
    let hop = new Hop()
    // ...
    hop = hop.connect(signer)
  • Parameters

    • gasLimit: BigNumberish
    • data: string = '0x'
    • to: string = constants.AddressZero
    • destChain: string | Chain = Chain.Optimism

    Returns Promise<any>

  • Parameters

    • signer: TProvider

      Ether's Signer

    • percent: number

      Percentage to bump by.

    Returns Promise<BigNumber>

    Bumped as price as BigNumber

    Desc

    Calculates current gas price plus increased percentage amount.

    Example

    import { Hop } from '@hop-protocol/sdk'

    const hop = new Hop()
    const bumpedGasPrice = await hop.getBumpedGasPrice(signer, 1.20)
    console.log(bumpedGasPrice.toNumber())
  • Parameters

    • chain: Chain

      Chain model.

    Returns number

    • Chain ID.

    Desc

    Returns Chain ID for specified Chain model.

  • Parameters

    • chain: string | Chain

      Chain model.

    Returns any

    Ethers provider.

    Desc

    Returns Ethers provider for specified Chain model.

  • Parameters

    • destinationChain: TChain
    • tokenSymbol: string

    Returns Promise<BigNumber>

  • Returns Promise<string>

    Ethers signer address.

    Desc

    Returns the connected signer address.

    Example

    import { Hop } from '@hop-protocol/sdk'

    const hop = new Hop()
    const address = await hop.getSignerAddress()
    console.log(address)
  • Parameters

    • chain: TChain

      Chain name or model

    • signer: TProvider = ...

      Ethers signer or provider

    Returns Promise<Provider | Signer>

    Ethers signer or provider

    Desc

    Returns the connected signer if it's connected to the specified chain id, otherwise it returns a regular provider for the specified chain.

  • Parameters

    • sourceChainSlug: string
    • destinationChainSlug: string

    Returns Promise<any>

  • Parameters

    • transactionRequest: TransactionRequest
    • chain: TChain

    Returns Promise<any>

  • Parameters

    • apiKeys: ApiKeys = {}

    Returns void

  • Parameters

    • chain: TChain

      Chain name or model.

    Returns Chain

    Chain model with connected provider.

    Desc

    Returns a Chain model instance with connected provider.

  • Parameters

    • txHash: string

      Source transaction hash.

    • token: TToken

      Token name or model.

    • sourceChain: TChain

      Source chain name or model.

    • destinationChain: TChain

      Destination chain name or model.

    • isCanonicalTransfer: boolean = false
    • options: WatchOptions = {}

    Returns any

    Desc

    Watches for Hop transaction events.

    Example

    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)
    })
  • Parameters

    • txHash: string
    • token: TToken
    • sourceChain: TChain
    • destinationChain: TChain
    • options: WatchOptions = {}

    Returns EventEmitter<string | symbol, any>

Generated using TypeDoc