You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on improving our SDK's interface and could use some input. Here are the main issues I'm trying to solve:
Current Problems
The interface is inconsistent - we have omniTransfer for some operations but then you need to manually create clients for others
Different chains need different steps (like NEAR->ETH needing that extra signing step)
All cross-chain operations actually go through NEAR but this isn't clear in the API
You have to manually coordinate between blockchain operations and our centralized API (for fees, status tracking, etc.)
There's no clean way to handle operation lifecycles or state
The Wallet Problem
A big challenge is that different chains handle wallets and signing differently. You need to:
Connect different types of wallets
Handle transaction signing
Deal with NEAR storage deposits
Configure gas differently for each chain
Maybe use custom RPC providers
One Possible Solution
I've been exploring an operation-centric interface that might look something like this:
consttransfer=Transfer.create({sourceChain: ChainKind.Eth,destChain: ChainKind.Near,token: "eth:0x123...",recipient: "near:account.near",amount: "1.5"})// You control the wallets/signingtransfer.setSigners({eth: {wallet: ethWallet,provider: customProvider// Optional},near: {account: nearAccount,// Your signing config}})// The SDK handles API integration and state management automaticallyawaittransfer.init()// Includes fee calculationawaittransfer.sign()// For NEAR egress onlyawaittransfer.finalize()// Handles proof generation, status monitoring, etc// Can check status/details at any pointconsole.log(transfer.getStatus())// e.g. 'initialized', 'signed', etc.console.log(transfer.getTransactionIds())// Get tx hashes for each step// Or just do it all at once if you preferawaittransfer.execute()
For comparison, here's what integration currently looks like:
// Have to manually call APIconstapi=newOmniBridgeAPI("mainnet")constfee=awaitapi.getFee(sender,recipient,tokenAddress)// Connect wallet yourselfconstwallet=awaitconnectWallet()// Create client manuallyconstclient=newEvmBridgeClient(wallet,ChainKind.Eth)consttx=awaitclient.initTransfer({tokenAddress: "eth:0x123...",amount: amount,fee: fee.transferred_token_fee,nativeFee: fee.native_token_fee,recipient: "near:account.near"})// Check status manually conststatus=awaitapi.getTransferStatus(originChain,originNonce)// Wait for proof generation and get proofconstproof=awaitgetEvmProof(tx.hash,TRANSFER_TOPIC)// Create new client for finalization on NEARconstnearClient=newNearBridgeClient(nearWallet)awaitnearClient.finalizeTransfer(token,account,storageDeposit,ChainKind.Eth,undefined,// vaaproof)
Status Monitoring
One key design question is how much the SDK should handle vs. leaving to the apps. For example, with transfer status monitoring, the SDK could either manage all the monitoring internally (polling, waiting for proofs etc.), or just provide the tools and let you implement your own monitoring.
I can see valid reasons for both. Your app might want to show its own progress UI, handle timeouts differently, or branch into different flows at each stage.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on improving our SDK's interface and could use some input. Here are the main issues I'm trying to solve:
Current Problems
omniTransferfor some operations but then you need to manually create clients for othersThe Wallet Problem
A big challenge is that different chains handle wallets and signing differently. You need to:
One Possible Solution
I've been exploring an operation-centric interface that might look something like this:
For comparison, here's what integration currently looks like:
Status Monitoring
One key design question is how much the SDK should handle vs. leaving to the apps. For example, with transfer status monitoring, the SDK could either manage all the monitoring internally (polling, waiting for proofs etc.), or just provide the tools and let you implement your own monitoring.
I can see valid reasons for both. Your app might want to show its own progress UI, handle timeouts differently, or branch into different flows at each stage.
Feedback
Open to any feedback here, especially around:
Beta Was this translation helpful? Give feedback.
All reactions