@thru/bridge-sdk when you need to move assets between Polygon and Thru from a wallet, deposit flow, or bridge integration.
Install
Import
The package exposes a single root entry point.When to use it
Use@thru/bridge-sdk when your task is explicitly about bridge deposits or redemptions. If you only need general RPC reads, block queries, or transaction submission, use @thru/thru-sdk instead. If you only need raw protobuf messages, use @thru/proto.
What it exports
The root export includes:createBridgeClient(config)andBridgeClientPOLYGON_BRIDGE_ABIPOLYGON_ERC20_ABITHRU_POLYGON_CHAIN_IDSTHRU_STATE_PROOF_WIRE_TYPESTHRU_TOKEN_PROGRAM_ADDRESS- Types for bridge config, requests, results, routes, and token metadata
Setup
Create a bridge client with Polygon signer settings, Thru signer settings, or both depending on which direction you need to support.Polygon To Thru
Use the Polygon side when you want to approve an ERC-20 and deposit it into Thru.getPolygonTokenMetadata(polygonTokenAddress)approvePolygonToken({ polygonTokenAddress, rawAmount })depositPolygonToThru({ thruRecipient, polygonTokenAddress, rawAmount })getPolygonDepositFromTx(txHash)
depositPolygonToThru(...) validates the Thru recipient address, checks ERC-20 allowance, submits the Polygon bridge deposit, and returns the receipt plus the parsed deposit event when available.
Thru To Polygon
Use the Thru side when you want to deposit a bridged Thru token back to Polygon.getThruPolygonTokenRoute(thruTokenMintAddress)depositThruToPolygon({ thruTokenMintAddress, polygonRecipientAddress, rawAmount, thruTokenAccountAddress?, payloadHex? })
getThruPolygonTokenRoute(...) tells you whether a mint is bridged from Polygon and, if so, which Polygon token it maps to.
Good fit for
This package is a good fit when you are building:- a wallet deposit flow that starts on Polygon and finishes on Thru
- a redeem flow that starts on Thru and pays out on Polygon
- a custom bridge UI or backend that needs to inspect token metadata, allowances, or parsed deposit events