# Class SolanaAutomaticTokenBridge<N, C>

#### Type Parameters

- #### N extends Network

- #### C extends SolanaChains

#### Hierarchy

- SolanaAutomaticTokenBridge

#### Implements

- AutomaticTokenBridge<N, SolanaPlatformType, C>

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:54

#####
Index

### Constructors

constructor

### Properties

chain
chainId
connection
contracts
coreBridgeProgramId
network
tokenBridgeProgramId
tokenBridgeRelayer

### Methods

calculateNativeSwapRate
createUnsignedTx
getForeignContract
getRedeemerConfig
getRegisteredToken
getRegisteredTokens
getRelayerFee
isRegisteredToken
maxSwapAmount
nativeTokenAmount
redeem
transfer
fromRpc

## Constructors

### `Private` constructor

- new SolanaAutomaticTokenBridge<N, C>(network, chain, connection, contracts): SolanaAutomaticTokenBridge<N, C>

- #### Type Parameters

  - #### N extends "Mainnet" | "Testnet" | "Devnet"

  - #### C extends "Solana" | "Pythnet"

  #### Parameters

  - ##### network: N

  - ##### chain: C

  - ##### connection: Connection

  - ##### contracts: Contracts

  #### Returns SolanaAutomaticTokenBridge<N, C>

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:65

## Properties

### `Readonly` chain

chain: C

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:67

### `Readonly` chainId

chainId: 2 | 1 | 3 | 8 | 5 | 6 | 4 | 22 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 3104 | 4000 | 4001 | 4002 | 10002 | 10003 | 10004 | 10005 | 10006

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:59

### `Readonly` connection

connection: Connection

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:68

### `Readonly` contracts

contracts: Contracts

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:69

### `Readonly` coreBridgeProgramId

coreBridgeProgramId: PublicKey

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:61

### `Readonly` network

network: N

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:66

### `Readonly` tokenBridgeProgramId

tokenBridgeProgramId: PublicKey

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:62

### `Readonly` tokenBridgeRelayer

tokenBridgeRelayer: Program<TokenBridgeRelayer>

- Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:63

## Methods

### `Private` calculateNativeSwapRate

- calculateNativeSwapRate(solSwapRate, swapRate): BN

- #### Parameters

  - ##### solSwapRate: BN

  - ##### swapRate: BN

  #### Returns BN

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:308

### `Private` createUnsignedTx

- createUnsignedTx(txReq, description, parallelizable?): SolanaUnsignedTransaction<N, C>

- #### Parameters

  - ##### txReq: SolanaTransaction

  - ##### description: string

  - ##### parallelizable: boolean = false

  #### Returns SolanaUnsignedTransaction<N, C>

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:330

### `Private` getForeignContract

- getForeignContract(chain): Promise<ForeignContract>

- #### Parameters

  - ##### chain: "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Returns Promise<ForeignContract>

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:312

### `Private` getRedeemerConfig

- getRedeemerConfig(): Promise<RedeemerConfig>

- #### Returns Promise<RedeemerConfig>

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:324

### `Private` getRegisteredToken

- getRegisteredToken(mint): Promise<RegisteredToken>

- #### Parameters

  - ##### mint: PublicKey

  #### Returns Promise<RegisteredToken>

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:318

### getRegisteredTokens

- getRegisteredTokens(): Promise<GetNativeAddress<(C extends bigint
  ? `bigint(${C})`
  : C extends boolean
  ? `boolean(${C})`
  : C) extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"
  ? {
  Acala: "Evm";
  Algorand: "Algorand";
  Aptos: "Aptos";
  Arbitrum: "Evm";
  ArbitrumSepolia: "Evm";
  Aurora: "Evm";
  Avalanche: "Evm";
  Base: "Evm";
  BaseSepolia: "Evm";
  Bsc: "Evm";
  Btc: "Btc";
  Celo: "Evm";
  Cosmoshub: "Cosmwasm";
  Ethereum: "Evm";
  Evmos: "Cosmwasm";
  Fantom: "Evm";
  Gnosis: "Evm";
  Holesky: "Evm";
  Injective: "Cosmwasm";
  Karura: "Evm";
  Klaytn: "Evm";
  Kujira: "Cosmwasm";
  Moonbeam: "Evm";
  Near: "Near";
  Neon: "Evm";
  Oasis: "Evm";
  Optimism: "Evm";
  OptimismSepolia: "Evm";
  Osmosis: "Cosmwasm";
  Polygon: "Evm";
  Pythnet: "Solana";
  Rootstock: "Evm";
  Sei: "Cosmwasm";
  Sepolia: "Evm";
  Solana: "Solana";
  Sui: "Sui";
  Terra: "Cosmwasm";
  Terra2: "Cosmwasm";
  Wormchain: "Cosmwasm";
  Xpla: "Cosmwasm";
  }[Object] extends {
  [key: string]: unknown;
  }
  ? {
  Acala: "Evm";
  Algorand: "Algorand";
  Aptos: "Aptos";
  Arbitrum: "Evm";
  ArbitrumSepolia: "Evm";
  Aurora: "Evm";
  Avalanche: "Evm";
  Base: "Evm";
  BaseSepolia: "Evm";
  Bsc: "Evm";
  Btc: "Btc";
  Celo: "Evm";
  Cosmoshub: "Cosmwasm";
  Ethereum: "Evm";
  Evmos: "Cosmwasm";
  Fantom: "Evm";
  Gnosis: "Evm";
  Holesky: "Evm";
  Injective: "Cosmwasm";
  Karura: "Evm";
  Klaytn: "Evm";
  Kujira: "Cosmwasm";
  Moonbeam: "Evm";
  Near: "Near";
  Neon: "Evm";
  Oasis: "Evm";
  Optimism: "Evm";
  OptimismSepolia: "Evm";
  Osmosis: "Cosmwasm";
  Polygon: "Evm";
  Pythnet: "Solana";
  Rootstock: "Evm";
  Sei: "Cosmwasm";
  Sepolia: "Evm";
  Solana: "Solana";
  Sui: "Sui";
  Terra: "Cosmwasm";
  Terra2: "Cosmwasm";
  Wormchain: "Cosmwasm";
  Xpla: "Cosmwasm";
  }[Object]
  : {
  Acala: "Evm";
  Algorand: "Algorand";
  Aptos: "Aptos";
  Arbitrum: "Evm";
  ArbitrumSepolia: "Evm";
  Aurora: "Evm";
  Avalanche: "Evm";
  Base: "Evm";
  BaseSepolia: "Evm";
  Bsc: "Evm";
  Btc: "Btc";
  Celo: "Evm";
  Cosmoshub: "Cosmwasm";
  Ethereum: "Evm";
  Evmos: "Cosmwasm";
  Fantom: "Evm";
  Gnosis: "Evm";
  Holesky: "Evm";
  Injective: "Cosmwasm";
  Karura: "Evm";
  Klaytn: "Evm";
  Kujira: "Cosmwasm";
  Moonbeam: "Evm";
  Near: "Near";
  Neon: "Evm";
  Oasis: "Evm";
  Optimism: "Evm";
  OptimismSepolia: "Evm";
  Osmosis: "Cosmwasm";
  Polygon: "Evm";
  Pythnet: "Solana";
  Rootstock: "Evm";
  Sei: "Cosmwasm";
  Sepolia: "Evm";
  Solana: "Solana";
  Sui: "Sui";
  Terra: "Cosmwasm";
  Terra2: "Cosmwasm";
  Wormchain: "Cosmwasm";
  Xpla: "Cosmwasm";
  }[Object]
  : never>[]>

- #### Returns Promise<GetNativeAddress<(C extends bigint
  ? `bigint(${C})`
  : C extends boolean
  ? `boolean(${C})`
  : C) extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"
  ? {
  Acala: "Evm";
  Algorand: "Algorand";
  Aptos: "Aptos";
  Arbitrum: "Evm";
  ArbitrumSepolia: "Evm";
  Aurora: "Evm";
  Avalanche: "Evm";
  Base: "Evm";
  BaseSepolia: "Evm";
  Bsc: "Evm";
  Btc: "Btc";
  Celo: "Evm";
  Cosmoshub: "Cosmwasm";
  Ethereum: "Evm";
  Evmos: "Cosmwasm";
  Fantom: "Evm";
  Gnosis: "Evm";
  Holesky: "Evm";
  Injective: "Cosmwasm";
  Karura: "Evm";
  Klaytn: "Evm";
  Kujira: "Cosmwasm";
  Moonbeam: "Evm";
  Near: "Near";
  Neon: "Evm";
  Oasis: "Evm";
  Optimism: "Evm";
  OptimismSepolia: "Evm";
  Osmosis: "Cosmwasm";
  Polygon: "Evm";
  Pythnet: "Solana";
  Rootstock: "Evm";
  Sei: "Cosmwasm";
  Sepolia: "Evm";
  Solana: "Solana";
  Sui: "Sui";
  Terra: "Cosmwasm";
  Terra2: "Cosmwasm";
  Wormchain: "Cosmwasm";
  Xpla: "Cosmwasm";
  }[Object] extends {
  [key: string]: unknown;
  }
  ? {
  Acala: "Evm";
  Algorand: "Algorand";
  Aptos: "Aptos";
  Arbitrum: "Evm";
  ArbitrumSepolia: "Evm";
  Aurora: "Evm";
  Avalanche: "Evm";
  Base: "Evm";
  BaseSepolia: "Evm";
  Bsc: "Evm";
  Btc: "Btc";
  Celo: "Evm";
  Cosmoshub: "Cosmwasm";
  Ethereum: "Evm";
  Evmos: "Cosmwasm";
  Fantom: "Evm";
  Gnosis: "Evm";
  Holesky: "Evm";
  Injective: "Cosmwasm";
  Karura: "Evm";
  Klaytn: "Evm";
  Kujira: "Cosmwasm";
  Moonbeam: "Evm";
  Near: "Near";
  Neon: "Evm";
  Oasis: "Evm";
  Optimism: "Evm";
  OptimismSepolia: "Evm";
  Osmosis: "Cosmwasm";
  Polygon: "Evm";
  Pythnet: "Solana";
  Rootstock: "Evm";
  Sei: "Cosmwasm";
  Sepolia: "Evm";
  Solana: "Solana";
  Sui: "Sui";
  Terra: "Cosmwasm";
  Terra2: "Cosmwasm";
  Wormchain: "Cosmwasm";
  Xpla: "Cosmwasm";
  }[Object]
  : {
  Acala: "Evm";
  Algorand: "Algorand";
  Aptos: "Aptos";
  Arbitrum: "Evm";
  ArbitrumSepolia: "Evm";
  Aurora: "Evm";
  Avalanche: "Evm";
  Base: "Evm";
  BaseSepolia: "Evm";
  Bsc: "Evm";
  Btc: "Btc";
  Celo: "Evm";
  Cosmoshub: "Cosmwasm";
  Ethereum: "Evm";
  Evmos: "Cosmwasm";
  Fantom: "Evm";
  Gnosis: "Evm";
  Holesky: "Evm";
  Injective: "Cosmwasm";
  Karura: "Evm";
  Klaytn: "Evm";
  Kujira: "Cosmwasm";
  Moonbeam: "Evm";
  Near: "Near";
  Neon: "Evm";
  Oasis: "Evm";
  Optimism: "Evm";
  OptimismSepolia: "Evm";
  Osmosis: "Cosmwasm";
  Polygon: "Evm";
  Pythnet: "Solana";
  Rootstock: "Evm";
  Sei: "Cosmwasm";
  Sepolia: "Evm";
  Solana: "Solana";
  Sui: "Sui";
  Terra: "Cosmwasm";
  Terra2: "Cosmwasm";
  Wormchain: "Cosmwasm";
  Xpla: "Cosmwasm";
  }[Object]
  : never>[]>

  Implementation of AutomaticTokenBridge.getRegisteredTokens

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:302

### getRelayerFee

- getRelayerFee(sender, recipient, token): Promise<bigint>

- #### Parameters

  - ##### sender: AccountAddress<C>

  - ##### recipient: ChainAddress

  - ##### token: TokenAddress<C>

  #### Returns Promise<bigint>

  Implementation of AutomaticTokenBridge.getRelayerFee

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:192

### isRegisteredToken

- isRegisteredToken(token): Promise<boolean>

- #### Parameters

  - ##### token: TokenAddress<C>

  #### Returns Promise<boolean>

  Implementation of AutomaticTokenBridge.isRegisteredToken

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:284

### maxSwapAmount

- maxSwapAmount(token): Promise<bigint>

- #### Parameters

  - ##### token: TokenAddress<C>

  #### Returns Promise<bigint>

  Implementation of AutomaticTokenBridge.maxSwapAmount

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:220

### nativeTokenAmount

- nativeTokenAmount(token, amount): Promise<bigint>

- #### Parameters

  - ##### token: TokenAddress<C>

  - ##### amount: bigint

  #### Returns Promise<bigint>

  Implementation of AutomaticTokenBridge.nativeTokenAmount

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:252

### redeem

- redeem(sender, vaa): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>

- #### Parameters

  - ##### sender: AccountAddress<C>

  - ##### vaa: VAA<"AutomaticTokenBridge:TransferWithRelay">

  #### Returns AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>

  Implementation of AutomaticTokenBridge.redeem

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:186

### transfer

- transfer(sender, recipient, token, amount, nativeGas?): AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>

- #### Parameters

  - ##### sender: AccountAddress<C>

  - ##### recipient: ChainAddress

  - ##### token: TokenAddress<C>

  - ##### amount: bigint

  - ##### `Optional` nativeGas: bigint

  #### Returns AsyncGenerator<SolanaUnsignedTransaction<N, C>, void, unknown>

  Implementation of AutomaticTokenBridge.transfer

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:106

### `Static` fromRpc

- fromRpc<N>(connection, config): Promise<SolanaAutomaticTokenBridge<N, "Solana" | "Pythnet">>

- #### Type Parameters

  - #### N extends "Mainnet" | "Testnet" | "Devnet"

  #### Parameters

  - ##### connection: Connection

  - ##### config: ChainsConfig<N, "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm">

  #### Returns Promise<SolanaAutomaticTokenBridge<N, "Solana" | "Pythnet">>

  - Defined in platforms/solana/protocols/tokenBridge/src/automaticTokenBridge.ts:87

Generated using TypeDoc