Skip to main content
Check out the deployed demo here.
wallet_demo
Compass API is well suited for adding earn features to existing custody solutions. In the following example, we are adding an Earn feature to a hypothetical wallet provider. You can find the code on Github.

This single flow demonstrates

  1. Swapping between stablecoins within the Product Account
  2. Depositing into yield-generating vaults
  3. Gas sponsorship so user never needs ETH
  4. Embedded fees so you monetize the transaction
  5. Position monitoring for dashboards and risk management
  6. All bundled atomically in one user signature

Key takeaways

  • For the end user, everything is fully abstracted away. They just sign on transactions, as always.
  • The end user can deposit and withdraw, without requiring gas tokens
  • We don’t require the user to sign token allowances
  • The wallet provider earns a small fee on every vault deposit.
  • Everything has been implemented fully using the Compass typescript SDK

Step by step

Package imports

Compass API can be used directly, or used via typescript SDK.

Call EarnManage Endpoint

Your main point of entry for managing positions is the Manage earn position endpoint. Compass returns an unsigned intent-payload.

Create 712 signature

Users simply sign the payload with standard cryptographic signatures.

Call to request gas sponsorship

The gas sponsor (in this case the wallet), calls the gas sponsorship endpoint. This is optional, the end user can also submit transactions themselves and pay for gas.

Gas Sponsor signs and submits transaction.

The gas sponsor signs and submits the transaction.