Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion packages/periphery/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @0xintuition/periphery

TypeScript helpers for Intuition periphery contracts, currently focused on `TrustSwapAndBridgeRouter` and direct meta-bridge wrappers.
TypeScript helpers for Intuition periphery contracts, including `FeeProxy`, `TrustSwapAndBridgeRouter`, and direct meta-bridge wrappers.

Alpha status: published under the alpha dist-tag. Periphery bridge/router addresses stay in this package; shared Intuition chain IDs come from `@0xintuition/deployments`.

Expand All @@ -17,6 +17,7 @@ Peer dependency: `viem ^2.0.0`. Release smoke tests install `viem@2.31.4`.
## Scope

- Deployment helpers for published Intuition periphery contracts.
- FeeProxy artifacts, URI-aware atom creation encoders and client wrappers, affiliate registration and fee reads, and refund helpers.
- Calldata encoders and client wrappers for `TrustSwapAndBridgeRouter`.
- Direct bridge helpers for `MetaERC20Hub`, `MetaERC20Spoke`, and `MetaNativeSpoke`.
- Base bridge asset address helpers for `USDC` and `WETH` approval flows.
Expand All @@ -27,6 +28,10 @@ Current deployments are mainnet-oriented:
- Intuition mainnet for `MetaERC20Spoke` and `MetaNativeSpoke`.
- Base mainnet bridge asset addresses for `USDC` and `WETH`.

Bridge helpers cover router-based TRUST transfers from Base to Intuition, direct TRUST transfers from Intuition to Base, and direct USDC and WETH transfers in both directions. No periphery testnet deployments are included.

The FeeProxy deployment map is empty. `getFeeProxyAddressFromChainId` throws until an address is published; FeeProxy wrappers accept an explicit contract address.

## Usage

```ts
Expand All @@ -36,4 +41,21 @@ import { base } from 'viem/chains'
const routerAddress = getTrustSwapAndBridgeRouterAddressFromChainId(base.id)
```

Generate deterministic calldata for a bridge call:

```ts
import { trustSwapAndBridgeRouterBridgeTrustEncode } from '@0xintuition/periphery'

const calldata = trustSwapAndBridgeRouterBridgeTrustEncode(
1_000n,
'0x2222222222222222222222222222222222222222'
)
```

Router swap encoders and client wrappers require a `deadline` Unix timestamp. `trustSwapAndBridgeRouterQuoteExactInput` returns `[amountOut, success]`; check `success` and abort the swap when it is `false` before deriving a minimum output.

`feeProxyCreateAtomsWithUrisViaEncode` encodes the affiliate, atom data, gross assets, URI lists, and a `FeeGuard` with `maxFeeBps` and `maxFixedFee`. `feeProxyCreateAtomsWithUrisVia` simulates and submits that call with the gross transaction value. Use `feeProxyPreviewCreationFee` to read the fee and forwarded amount, and `feeProxyPendingRefund` / `feeProxyClaimRefund` for pull-fallback refunds.

`WrappedTrust`, `MultiVault`, and other core protocol deployment addresses resolve from `@0xintuition/deployments`, not this package.

`@0xintuition/protocol` provides core contract helpers; router, bridge, meta-bridge, and FeeProxy helpers belong to `@0xintuition/periphery`.
Loading
Loading