-
Notifications
You must be signed in to change notification settings - Fork 13
Description
1) Motivation
GoodSDKs needs a new @goodsdks/bridging-sdk package that wraps user-facing flows for MessagePassingBridge so developers can integrate bridging reliably. The SDK must follow existing SDK patterns in this repo (viem class + optional wagmi hook) and be the foundation for future UI components. The contract source of truth lives in the GoodBridge repo, and ABIs should be pulled from the published @gooddollar/bridge-contracts package. Clear SDK documentation aligned with GoodBridge MessagePassingBridge docs (https://github.com/GoodDollar/GoodBridge/tree/master/packages/bridge-contracts/contracts/messagePassingBridge) is required, including explicit guidance on decimal handling and msg.value requirements, with fees sourced primarily from the goodserver estimate fees API.
Expected output and supported features:
- New
packages/bridging-sdkpackage. - Should support bridging from/to: Celo/Ethereum mainnet/Fuse/XDC, using either Axelar or LayerZero
- Event and tx status + history fetching helpers for
BridgeRequestandExecutedTransfer. - Documentation with usage examples and decimal handling guidance.
- Take care of bridge fee (ie indicate to user and send correct value in native token)
- User should be able to see status of TX based on layerzero/axelar api
- Link to layerzero/axelar explorer relevant tx
2) Guidelines
- Typed methods for
canBridge,bridgeTo,bridgeToWithLz, andbridgeToWithAxelar. - Fee estimation uses the GoodServer
estimatefeesAPI as the primary source (covers Axelar + LayerZero and all supported directions), and documentsmsg.valueexpectations (nonzero; should cover the estimated fee). Treatmsg.valueas the bridge fee and require it to be at least the estimated fee. - Decimal handling is documented: source-chain amounts for
bridgeTo/approveuse native token decimals (the bridge amount should match the approve value), while limit checks on the target chain use 18-decimal normalized amounts. - Event helpers for
BridgeRequestandExecutedTransferare exposed with typed helpers or utilities. - Chain support for Celo, Fuse, Ethereum Mainnet, and XDC is included.
- Documentation includes usage examples and aligns with GoodBridge MessagePassingBridge docs (https://github.com/GoodDollar/GoodBridge/tree/master/packages/bridge-contracts/contracts/messagePassingBridge), including a note that bridge amounts use native token decimals (Fuse/Ethereum: 2 decimals; Celo: 18) and
canBridgechecks on the target chain use 18-decimal units. - new package
packages/bridging-sdkwith viem-based class and optional wagmi hook, ABI consumption from@gooddollar/bridge-contracts(no local ABI hand-editing), minimal configuration for supported chains, and docs/README describing the SDK structure and usage.
4) Starting points (top paths + notes)
- GoodBridge MessagePassingBridge contract sources/docs (https://github.com/GoodDollar/GoodBridge/tree/master/packages/bridge-contracts/contracts/messagePassingBridge).
(Align with structures that you can see in)
packages/savings-sdk/src/viem-sdk.ts— minimal viem SDK structure and tx submission pattern.packages/savings-sdk/src/wagmi-sdk.ts— wagmi hook wrapper pattern.packages/engagement-sdk/src/viem-sdk.ts— event helpers and utility patterns.packages/citizen-sdk/src/constants.ts— chain config patterns (IDs, labels, RPCs).
5) Definition of Done (DoD) + How to test
DoD
-
packages/bridging-sdkexists withpackage.json,tsup.config.ts, andsrc/index.tsexports consistent with other SDKs. - Viem SDK class provides typed methods for bridge calls and
canBridgepre-checks. - Fee estimation helper(s) implemented and documented, using
https://goodserver.gooddollar.org/bridge/estimatefeesas the primary source, includingmsg.valueusage and failure conditions when insufficient (treatmsg.valueas the bridge fee). - Event helpers for
BridgeRequestandExecutedTransferare exposed with typed outputs. - Helper methods are provided to request/show list of pending/past bridge transactions done.
- ABI is sourced from
@gooddollar/bridge-contractsand not duplicated locally. - Documentation/README added describing API, supported chains, example usage, and decimal handling (native decimals for bridge calls; 18-decimal amounts for target-chain
canBridgechecks; Fuse/Ethereum 2 decimals and Celo 18 decimals). - Security consideration: only user-facing methods exposed, and chain ID validation/guardrails are documented.
- Provide minimal UI demo (new demo app, following structure of existing demo-apps), demonstrating the bridging SDK
Design Reference
Design is not part of this issue and we don't expect a UI component, however, contributor should still review the screens so that all features are supported.
See things like:
- Bridge fees and estimates
- Choosing bridge-provider and the different chains it supports to swap to
- progress tracking of the transaction

Metadata
Metadata
Assignees
Labels
Type
Projects
Status