Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/beroburny/refactor-ci-cd' into b…
Browse files Browse the repository at this point in the history
…eroburny/refactor-ci-cd
  • Loading branch information
BeroBurny committed Dec 10, 2024
2 parents 2767be7 + 2c43885 commit e5fee55
Show file tree
Hide file tree
Showing 44 changed files with 793 additions and 673 deletions.
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

docs/.docusaurus
docs/build
docs/_temp
2 changes: 1 addition & 1 deletion docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
6 changes: 6 additions & 0 deletions docs/docs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"useTabs": false,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 100
}
3 changes: 2 additions & 1 deletion docs/docs/01-introduction/01-introduction.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
id: intro
slug: /
title: What Is Sprinter?
sidebar_position: 1
---
Expand All @@ -11,7 +12,7 @@ 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.
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

Expand Down
5 changes: 3 additions & 2 deletions docs/docs/01-introduction/02-key-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ 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

- ⚖️ 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)
Expand All @@ -31,7 +32,7 @@ Sprinter provides execution for chain abstracton providers by operating a large

## 💳 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.
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

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/01-introduction/03-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Below is a simplified diagram illustrating the Sprinter application flow:
|
v
+------------------------+
| Balance Aggregation |
| Balance Aggregation |
+-----------+------------+
|
v
Expand All @@ -47,11 +47,11 @@ Below is a simplified diagram illustrating the Sprinter application flow:
|
v
+------------------------+
| Execute Transaction |
| Execute Transaction |
+-----------+------------+
|
v
+------------------------+
| Error Handling |
| Error Handling |
+------------------------+
```
8 changes: 4 additions & 4 deletions docs/docs/01-introduction/04-supported-networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ sidebar_position: 4
import SupportedList from '@site/src/components/SupportedList';

:::tip
New routes, networks, and tokens can readily be added by the Sprinter team. Please reach out at [[email protected]](mailto:[email protected]) to get a conversation started.
New routes, networks, and tokens can readily be added by the Sprinter team. Please reach out at [[email protected]](mailto:[email protected]) to get a conversation started.
:::

### Supported Bridges

* [LI.FI](https://li.fi/)
* [Across](https://across.to/)
* [Sygma](https://buildwithsygma.com)
- [LI.FI](https://li.fi/)
- [Across](https://across.to/)
- [Sygma](https://buildwithsygma.com)

### Supported Networks and Tokens

Expand Down
16 changes: 9 additions & 7 deletions docs/docs/02-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ The Sprinter SDK provides a streamlined interface for retrieving intent-based so
Here’s a quick example of how to use the SDK in your project:

```typescript
import { Sprinter, Environment } from '@chainsafe/sprinter-sdk';
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";

const sprinter = new Sprinter({ baseUrl: Environment.MAINNET });

sprinter.getUserBalances('0xYourAddressHere').then(console.log);
sprinter.getUserBalances("0xYourAddressHere").then(console.log);
```

For more details on using the SDK, refer to the [SDK Documentation](./sdk).
Expand All @@ -47,12 +47,12 @@ If you're building a React application, you can use the Sprinter React SDK (`@ch
Here’s how to set up a simple React component to fetch user balances:

```tsx
import React, { useEffect } from 'react';
import { SprinterContext, useSprinterBalances } from '@chainsafe/sprinter-react';
import { Environment } from '@chainsafe/sprinter-sdk';
import React, { useEffect } from "react";
import { SprinterContext, useSprinterBalances } from "@chainsafe/sprinter-react";
import { Environment } from "@chainsafe/sprinter-sdk";

function BalancesComponent() {
const { balances, getUserBalances } = useSprinterBalances('0xYourAddressHere');
const { balances, getUserBalances } = useSprinterBalances("0xYourAddressHere");

useEffect(() => {
getUserBalances();
Expand All @@ -64,7 +64,9 @@ function BalancesComponent() {
return (
<ul>
{Object.entries(balances.data || {}).map(([symbol, balanceEntry]) => (
<li key={symbol}>{symbol}: {balanceEntry.total}</li>
<li key={symbol}>
{symbol}: {balanceEntry.total}
</li>
))}
</ul>
);
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/03-sdk/02-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Sprinter SDK allows developers to interact with cross-chain solutions such a

Before installing the SDK, ensure you have the following installed:

- **Node.js**: Version 20 (recommended) or higher
- **Node.js**: Version 20 (recommended) or higher
- **npm** or **yarn**: A package manager for JavaScript

## Installation
Expand All @@ -30,7 +30,7 @@ Once the SDK is installed, you can initialize it to interact with blockchain net
### Example: Initialize `Sprinter`

```typescript
import { Sprinter, Environment } from '@chainsafe/sprinter-sdk';
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";

const sprinter = new Sprinter({ baseUrl: Environment.MAINNET });

Expand All @@ -43,7 +43,7 @@ sprinter.getUserBalances(ownerAddress).then(console.log);
You can also call specific API endpoints directly using the SDK. Here’s an example:

```typescript
import { api } from '@chainsafe/sprinter-sdk';
import { api } from "@chainsafe/sprinter-sdk";

const ownerAddress = "0xYourAddressHere";
const tokenSymbol = "USDC";
Expand All @@ -58,7 +58,7 @@ You can configure the SDK using environment variables to set the base URL for AP
### Example: Set Base URL

```typescript
import { setBaseUrl } from '@chainsafe/sprinter-sdk';
import { setBaseUrl } from "@chainsafe/sprinter-sdk";

setBaseUrl("https://api.sprinter.buildwithsygma.com");
```
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/03-sdk/03-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ When initializing the `Sprinter` class, you can pass a `baseUrl` configuration o
The `baseUrl` is the API server endpoint. You can either set it manually or use the predefined `Environment` enum to simplify configuration.

```typescript
import { Sprinter, Environment } from '@chainsafe/sprinter-sdk';
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";

// Using a custom base URL
const sprinter = new Sprinter({
baseUrl: 'https://api.sprinter.buildwithsygma.com',
baseUrl: "https://api.sprinter.buildwithsygma.com",
});

// Or using a predefined environment URL
Expand All @@ -35,10 +35,10 @@ const sprinterWithEnv = new Sprinter({
You can change the `baseUrl` dynamically in your application using the `setBaseUrl` function provided by the SDK. This is useful when you need to modify the API endpoint during runtime.

```typescript
import { setBaseUrl } from '@chainsafe/sprinter-sdk';
import { setBaseUrl } from "@chainsafe/sprinter-sdk";

// Dynamically set the base URL during runtime
setBaseUrl('https://custom.api.url');
setBaseUrl("https://custom.api.url");
```

## Set Base URL Using Environment Variables
Expand All @@ -53,7 +53,7 @@ SPRINTER_URL=https://api.sprinter.buildwithsygma.com
In your code, the SDK will use this environment variable automatically:

```typescript
import { setBaseUrl } from '@chainsafe/sprinter-sdk';
import { setBaseUrl } from "@chainsafe/sprinter-sdk";

// Automatically set the base URL from the environment variable
setBaseUrl(process.env.SPRINTER_URL);
Expand All @@ -75,7 +75,7 @@ Every method in the SDK accepts an optional `fetchOptions` parameter, which cont
### Example: Overriding `baseUrl` for a Single Request

```typescript
sprinter.getAvailableTokens({ baseUrl: 'https://custom.api.url' }).then(tokens => {
sprinter.getAvailableTokens({ baseUrl: "https://custom.api.url" }).then((tokens) => {
console.log(tokens);
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/03-sdk/04-methods-reference/_category_.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"label": "Methods Reference"
}
}
57 changes: 29 additions & 28 deletions docs/docs/03-sdk/04-methods-reference/_how-to-calldata.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ The following examples demonstrate how to create the `callData` parameter requir
<details>
<summary>Show Example Staking Contract and ABI</summary>

```solidity
pragma solidity ^0.8.0;
contract StakingContract {
mapping(address => uint256) public stakes;
uint256 public totalStakes;
function stake(uint256 amount) public {
require(amount > 0, "Amount must be greater than zero");
stakes[msg.sender] += amount;
totalStakes += amount;
}
function withdraw(uint256 amount) public {
require(amount > 0 && stakes[msg.sender] >= amount, "Invalid amount");
stakes[msg.sender] -= amount;
totalStakes -= amount;
}
function getStake(address user) public view returns (uint256) {
return stakes[user];
}
}
```

```json
{
```solidity
pragma solidity ^0.8.0;
contract StakingContract {
mapping(address => uint256) public stakes;
uint256 public totalStakes;
function stake(uint256 amount) public {
require(amount > 0, "Amount must be greater than zero");
stakes[msg.sender] += amount;
totalStakes += amount;
}
function withdraw(uint256 amount) public {
require(amount > 0 && stakes[msg.sender] >= amount, "Invalid amount");
stakes[msg.sender] -= amount;
totalStakes -= amount;
}
function getStake(address user) public view returns (uint256) {
return stakes[user];
}
}
```

```json
{
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -83,7 +83,8 @@ The following examples demonstrate how to create the `callData` parameter requir
}
]
}
```
```

</details>

<Tabs queryString="web3-libs">
Expand Down
59 changes: 30 additions & 29 deletions docs/docs/03-sdk/04-methods-reference/_how-to-gas-limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TabItem from '@theme/TabItem';

### Estimating `gasLimit`

The following examples demonstrate how to estimate the `gasLimit` parameter required for interacting with a staking smart contract. We provide examples using different web3 libraries: Web3JS, Viem, and Ethers.
The following examples demonstrate how to estimate the `gasLimit` parameter required for interacting with a staking smart contract. We provide examples using different web3 libraries: Web3JS, Viem, and Ethers.

:::note
To ensure that the transaction has enough gas, we recommend using the estimated gas limit from the provider, adding 25% as a buffer, and then adding an additional 100,000 units for fail-safe calculations. This ensures the transaction won’t run out of gas, even for complex contract interactions.
Expand All @@ -12,33 +12,33 @@ To ensure that the transaction has enough gas, we recommend using the estimated
<details>
<summary>Show Example Staking Contract and ABI</summary>

```solidity
pragma solidity ^0.8.0;
contract StakingContract {
mapping(address => uint256) public stakes;
uint256 public totalStakes;
function stake(uint256 amount) public {
require(amount > 0, "Amount must be greater than zero");
stakes[msg.sender] += amount;
totalStakes += amount;
}
function withdraw(uint256 amount) public {
require(amount > 0 && stakes[msg.sender] >= amount, "Invalid amount");
stakes[msg.sender] -= amount;
totalStakes -= amount;
}
function getStake(address user) public view returns (uint256) {
return stakes[user];
}
}
```

```json
{
```solidity
pragma solidity ^0.8.0;
contract StakingContract {
mapping(address => uint256) public stakes;
uint256 public totalStakes;
function stake(uint256 amount) public {
require(amount > 0, "Amount must be greater than zero");
stakes[msg.sender] += amount;
totalStakes += amount;
}
function withdraw(uint256 amount) public {
require(amount > 0 && stakes[msg.sender] >= amount, "Invalid amount");
stakes[msg.sender] -= amount;
totalStakes -= amount;
}
function getStake(address user) public view returns (uint256) {
return stakes[user];
}
}
```

```json
{
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -87,7 +87,8 @@ To ensure that the transaction has enough gas, we recommend using the estimated
}
]
}
```
```

</details>

<Tabs queryString="web3-libs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"collapsed": false,
"collapsible": false,
"position": 1
}
}
Loading

0 comments on commit e5fee55

Please sign in to comment.