diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9409d97..6f55ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,4 +46,4 @@ jobs: projectName: gopher-docs directory: ./docs/build gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.head_ref || github.ref_name }} + branch: ${{ github.head_ref || github.ref_name }} \ No newline at end of file diff --git a/docs/docs/01-introduction/01-introduction.md b/docs/docs/01-introduction/01-introduction.md new file mode 100644 index 0000000..eb83d92 --- /dev/null +++ b/docs/docs/01-introduction/01-introduction.md @@ -0,0 +1,21 @@ +--- +id: intro +title: What Is Sprinter? +sidebar_position: 1 +--- + +# Welcome To The Sprinter Docs + +Sprinter is a **fast, smooth, interoperable intent execution engine**. Our aim is to make multichain interactions feel like one. In doing so, we enhance cross-chain UX *for all* as a first-class citizen in both existing and upcoming web3 technologies. + +## What's Next + +- If you're new to Sprinter, begin with [Quick Start](../02-quick-start.md). +- Explore detailed examples and advanced usage in the [SDK Documentation](../03-sdk/01-overview.md). +- Dive into the specifics of our API in the [API Documentation](../04-api/01-api-usage.md). + +Stay tuned for the complete source code. + +## Need Assistance? + +If you have questions about Sprinter, the code, the docs, or have a business inquiry, please reach out to us on [Discord](https://discord.gg/Qdf6GyNB5J) or via email at [requests@buildwithsygma.com](mailto:requests@buildwithsygma.com). diff --git a/docs/docs/01-introduction/02-key-features.md b/docs/docs/01-introduction/02-key-features.md new file mode 100644 index 0000000..987fde4 --- /dev/null +++ b/docs/docs/01-introduction/02-key-features.md @@ -0,0 +1,38 @@ +--- +id: features +title: Key Features +sidebar_position: 2 +--- + +Sprinter provides execution for chain abstracton providers by operating a large cluster of solvers that are designed to: +- ⚖️ simplify cross-chain balance aggregation and transaction management +- 🔀 automatically provide optimized execution paths by determining the fastest and cheapest paths for a transfer, regardless of layer +- 🥰 provide the ultimate UX buff to users, applications, protocols, and wallets +- ⚙️ be unopinionated about account types (EOAs or smart contract accounts) + +## 🏃‍♀️ Fast + +- **Extensive Route Search**: Our solvers explore a wide array of routes to access deeper liquidity pools. +- **Execution Guarantee**: Ensures transaction execution through our advanced mechanism. +- **Just-in-Time (JIT) Liquidity**: Provides JIT liquidity and capital fronting to facilitate transactions efficiently. + +## 🥃 Smooth + +- **Flexible Account Compatibility**: Supports both externally owned accounts (EOA) and smart contract wallets. +- **Minimized Slippage**: Quotes are derived from multiple pools across various intent protocols to minimize slippage. +- **One-Click Solutions**: Enables seamless and straightforward one-click solutions for user convenience. + +## 🤝 Interoperable + +- **Multi-Protocol Integration**: Our solvers integrate with multiple protocols to enhance functionality. +- **Account Type Agnostic**: Operates seamlessly regardless of account type. +- **Wallet Implementation Agnostic**: Functions efficiently with various wallet implementations. +- **Flexible Capital Fronting**: Capable of fronting capital across different networks as needed. + +## 💳 Capital Efficient + +The Sprinter solver engine creates capital efficiency across the cross-chain transaction flow by bearing equivocation risk for users and intent providers. In effect, this optimizes the transaction supply chain for the user since we create the destination calldata. + +## ↔️ Horizontal Scaling + +Just as the explosion of the EVM L2 ecosystem has brought about horizontal scalability for the entire Ethereum ecosystem, Sprinter amplifies this effect by facilitating movement of funds between all chains. diff --git a/docs/docs/01-introduction/03-flow.md b/docs/docs/01-introduction/03-flow.md new file mode 100644 index 0000000..6b2d57e --- /dev/null +++ b/docs/docs/01-introduction/03-flow.md @@ -0,0 +1,57 @@ +--- +id: flow +title: Sprinter x Application Flow +sidebar_position: 3 +--- + +The following section showcases how cross-chain balances and transactions are managed in a Sprinter-integrated application flow. + +### 1. Prepare User + +Before using Sprinter, the user must authenticate or connect to the decentralized application (dApp). This step is handled by your application, ensuring that the user is authenticated and their wallet is connected. + +### 2. Balance Aggregation + +Once the user is prepared, Sprinter can optionally aggregate the user's balances across multiple blockchains. This involves fetching data from different networks and consolidating it into a single view. + +### 3. Get Quote + +The next step is to get the transaction quote. This provides the necessary information for the dApp to execute the required transactions. Sprinter finds the best single-hop cross-bridge transaction to optimize this process. + +### 4. Execute Transaction + +After obtaining the transaction quote, the dApp executes the transaction. Sprinter provides the best options for the transaction, but the actual execution and transaction status monitoring is handled by the dApp. + +### 5. Error Handling + +Error handling is managed by the dApp. Sprinter ensures that it provides accurate data and options, but the dApp is responsible for handling any errors that may arise during the transaction process. + +## Diagram of the Sprinter Flow + +Below is a simplified diagram illustrating the Sprinter application flow: + +```plaintext ++------------------------+ +| Prepare User (Auth) | ++-----------+------------+ + | + v ++------------------------+ +| Balance Aggregation | ++-----------+------------+ + | + v ++------------------------+ +| Get Quote | ++-----------+------------+ + | + v ++------------------------+ +| Execute Transaction | ++-----------+------------+ + | + v ++------------------------+ +| Error Handling | ++------------------------+ +``` diff --git a/docs/docs/01-introduction/04-supported-networks.md b/docs/docs/01-introduction/04-supported-networks.md new file mode 100644 index 0000000..bbf04d6 --- /dev/null +++ b/docs/docs/01-introduction/04-supported-networks.md @@ -0,0 +1,18 @@ +--- +id: supported +title: Supported Bridges And Networks +sidebar_position: 4 +--- + +:::tip +New routes, networks, and tokens can readily be added by the Sprinter team. Please reach out at [requests@buildwithsygma.com](mailto:requests@buildwithsygma.com) to get a conversation started. +::: + +| Supported Bridges | Supported Networks | Supported Tokens | +|-------------------------------------|--------------------|------------------| +| [LI.FI](https://li.fi/) | Ethereum Mainnet | Native ETH | +| [Across](https://across.to/) | Base | Wrapped ETH | +| [Sygma](https://buildwithsygma.com) | Arbitrum | USDC | +| | Polygon | USDT | +| | Gnosis | DAI | +| | Cronos | | diff --git a/docs/docs/02-quick-start.md b/docs/docs/02-quick-start.md new file mode 100644 index 0000000..2f2d92c --- /dev/null +++ b/docs/docs/02-quick-start.md @@ -0,0 +1,49 @@ +--- +id: quickstart +title: Quick Start +sidebar_position: 2 +--- + +You have two main options for interacting with Sprinter: + +- [Using the SDK](#using-the-sdk) +- [Calling API Endpoints Directly](#calling-api-endpoints-directly) + +### Using the SDK + +Using the Sprinter SDK provides a convenient and unified interface for blockchain interactions, complete with TypeScript support for enhanced type safety and a better development experience. This approach is recommended for developers working with TypeScript or popular web frameworks. + +**Quick Example** + +Here's a quick example of how to use the SDK in your project: + +```typescript +import { Sprinter } from '@chainsafe/sprinter-sdk'; + +const sprinter = new Sprinter(window.ethereum); + +sprinter.getUserBalances().then(console.log); +``` + +For a more detailed guide on setting up and using the SDK, refer to the [SDK Documentation](03-sdk/01-overview.md). + +### Calling API Endpoints Directly + +If you prefer more control or wish to implement the solution in a different programming language, you can directly interact with the API endpoints provided by Sprinter. + +**Quick Example** + +Here’s how you can call the API directly using JavaScript's Fetch API: + +```javascript +const ownerAddress = "0x3E101Ec02e7A48D16DADE204C96bFF842E7E2519"; +const tokenSymbol = "USDC"; +const baseUrl = "https://api.sprinter.buildwithsygma.com/"; + +fetch(`${baseUrl}/accounts/${ownerAddress}/assets/fungible/${tokenSymbol}`) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error fetching user fungible tokens:', error)); +``` + +For a comprehensive list of available endpoints and how to use them, check out the [API Documentation](04-api/01-api-usage.md). diff --git a/docs/docs/sdk/overview.md b/docs/docs/03-sdk/01-overview.md similarity index 64% rename from docs/docs/sdk/overview.md rename to docs/docs/03-sdk/01-overview.md index 6c3c0ce..4449abc 100644 --- a/docs/docs/sdk/overview.md +++ b/docs/docs/03-sdk/01-overview.md @@ -4,13 +4,7 @@ sidebar_position: 1 # SDK Overview -The Sprinter SDK is a powerful tool designed to simplify interaction with multiple blockchain networks. It provides a unified interface for aggregating balances and optimizing cross-chain operations, making it easier to build decentralized applications (DApps). - -## Key Features - -- **Cross-Chain Balance Aggregation**: Consolidate balances from various blockchain networks. -- **Best Single-Hop Cross-Bridge Transactions**: Optimize transactions across different blockchains. -- **TypeScript Support**: Ensure type safety and a better development experience with TypeScript. +The Sprinter SDK simplifies interactions with multiple blockchain networks. It provides a unified interface for aggregating balances and optimizing cross-chain operations, making it easier to build decentralized applications (dApps). ## Installation @@ -28,6 +22,10 @@ yarn add @chainsafe/sprinter-sdk ## Basic Usage +:::info +If you would like to test this without custom front-end code, you can directly do so by adding `vite` as a package. You will then need to create an `index.html` file to serve as the entry way for the following script using `