1-click+gas-step 11: using orby for in-wallet gas and single-click - #13
Open
felimadu wants to merge 3 commits into
Open
1-click+gas-step 11: using orby for in-wallet gas and single-click#13felimadu wants to merge 3 commits into
felimadu wants to merge 3 commits into
Conversation
|
📦 build.zip [updated at Aug 15, 7:25:26 PM UTC] |
felimadu
force-pushed
the
step-10/handling-solana
branch
from
July 23, 2025 02:39
97f1d35 to
951a250
Compare
felimadu
force-pushed
the
step-11/use-orby-for-in-wallet-interactions
branch
from
July 23, 2025 02:52
922fbbc to
d527915
Compare
felimadu
force-pushed
the
step-10/handling-solana
branch
from
August 15, 2025 19:23
bb7c3cf to
06a1122
Compare
felimadu
force-pushed
the
step-11/use-orby-for-in-wallet-interactions
branch
from
August 15, 2025 19:23
ecb8997 to
b3a70d8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is step 3 of the steps to add Orby and support 1-click transactions and gas abstraction on the Zerion Chrome Extension. The same steps and similar code can be used on other Chrome Extension wallets.
[✅] Step 0 PR (#4) : Setup feature flags
one_click_transactions_and_gas_abstraction[✅] Step 1 [(No PR needed)]: Get EVM and SVM testing accounts and set them up.
[✅] Step 2 PR (#5): Get the Orby API keys for an instance and add them to your environment variables.
The team will give you keys and urls that look like:
Note: the private and public keys correspond to a particular instance with specific features enabled on that instance. Given that we're working on 1-click transactions and gas abstraction, make sure that only those 2 features are be enabled.
[✅] Step 3 PR (#6): Add OrbyProvider to the root of your app
OrbyProvidereasilyOrbyProvider: Adding OrbyProvider to the root of the app setups all the context and variables that will be used in hooks and function calls to communicate with Orby.[✅] Step 4 PR (#7): Configure Orby to handle communication with app frontends
eth_call) that are routed to the apps from the wallet (some apps do this)."activeTab","scripting", andunlimitedStoragepermissions in thesrc/manifest.jsonfile./src/content-script/before building, and meaning the files are build together with the other content script files.unifyBalancesOnAppsfunction your background script with the first argument being the location of the files from step 4 above relative to the root of the build output directoryuseBulkConnectAppSessionsto register them to the background script. Similarly, call thegetVirtualNodeRpcUrlsForSupportedChainsfunction to get virtual nodes, and add them to your RPC state as the primary way to forward RPC requests from apps the orby. This is necessary because some apps still call wallets for balances, and even genericeth_calls. For the Zerion Extension, this is done in the newRegisterSessionscomponent, which is conditionally rendered if the feature flag is set.Testing: At this point, we want to test that the wallet is function as expected.
Control:Using the Zerion wallet on App store, connect to uniswap with an account that does not have native funds on a chain like BNB Chain, ETH Mainnet, Arbitrum, Base or Optimism. You should be blocked with a "Insufficient funds for gas" error when you attempt a swap.Orby Enabled:Now, switch to this Orby enabled Zerion wallet but with the same account. You should not be blocked with a "Insufficient funds for gas" any error when you attempt a swap, and instead you should be able to send the transaction to the wallet for signing.Control:Using the Zerion wallet on App store, connect to uniswap with an account with sufficient funds on a chain like BNB Chain, ETH Mainnet, Arbitrum, Base or Optimism, and attempt a swap with an ERC20 token (e.g. USDC) that has not been approved on uniswap. You should see an "Approve and Swap" CTA when you attempt to swap. Clicking the button sends an ERC20 approval request to the wallet.Orby Enabled:Now, switch to this Orby enabled Zerion wallet but with the same account. You should see "Swap" with no approvals needed. Clicking the CTA sends a permit2 typedData to the wallet and not an approval transaction.[✅] Step 5 PR (#8): Ping Orby to get operations for every send transaction from apps
useIsOrbyEnabledhook to check if a chain is orby enabled and if a user has the feature flag enableduseGetOperationsToExecuteTransactionwith the transaction data from the user.Testing:
[✅] Step 6 PR (#9): Ping Orby to get operations for every send transaction from apps
useIsOrbyEnabledhook to check if a chain is orby enabled and if a user has the feature flag enableduseGetOperationsToSignTransactionOrSignTypedDatawith the typeddata from the user.Testing:
Follow the same steps as those above but using typeddata instead. Use Uniswap or Morpho for testing[❌] Step 7: Verify operations using transaction verification systems such as Blockaid.
[✅] Step 8 PR (#10): Sign and submit operations
signOperation,signTransaction, and signUserOperation functions insrc/shared/core/orb.tsfile. The functions call the actual wallet signing functions insrc/background/Wallet/Wallet.ts.subscribeToOperationStatusesfunction[✅] Step 9: Fetch and render batched user activity.
[✅] Step 10: Add Support for Solana
useGetOperationsToSignTransactionOrSignTypedDatahook to interact with Orby whenisOrbyEnabledis true. The encoded SVMserializedtransaction is passed as a data to the hook along with options to tell the Orby the SVM RPC function we are handling.signOperationto support signing of SVM operations[👉] Step 11: Support 1-click transactions and gas abstraction for in-wallet Swap, Bridge and Sends
Similar to transactions from dapps, we want to support 1-click transactions and gas abstraction for in-wallet actions like swap, send and bridge. More importantly, we want to keep the existing 3rd-party services we have been using for bridging swapping and sends. So, for each action, we do the following:
useGetOperationsToSignTransactionOrSignTypedDatafor all users were Orby is enabled. We also allow the user to pick a gas token that Orby can use when orchestrating the delivery of the transaction.