-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(infrastructure): codecov, crates.io
- Loading branch information
1 parent
71ca304
commit 0fe2b33
Showing
5 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ref: https://docs.codecov.com/docs/codecovyml-reference | ||
coverage: | ||
# Hold ourselves to a high bar | ||
range: 85..100 | ||
round: down | ||
precision: 1 | ||
status: | ||
# ref: https://docs.codecov.com/docs/commit-status | ||
project: | ||
default: | ||
# Avoid false negatives | ||
threshold: 1% | ||
|
||
# Test files aren't important for coverage | ||
ignore: | ||
- "tests" | ||
|
||
# Make comments less noisy | ||
comment: | ||
layout: "files" | ||
require_changes: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
name: main | ||
jobs: | ||
codecov: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,64 @@ | ||
# Symbiosis API Binding Written in Rust (currently support api-v2) | ||
# symbiosis-api | ||
|
||
You can find the Swagger of Symbiosis API at | ||
[this URL](https://api-v2.symbiosis.finance/crosschain/docs/). | ||
[![Crates.io](https://img.shields.io/crates/v/symbiosis-api.svg)](https://crates.io/crates/symbiosis-api) | ||
[![Documentation](https://docs.rs/symbiosis-api/badge.svg)](https://docs.rs/symbiosis-api/) | ||
[![Codecov](https://codecov.io/github/phnaharris/symbiosis-api/coverage.svg?branch=main)](https://codecov.io/gh/phnaharris/symbiosis-api) | ||
[![Build Status](https://github.com/phnaharris/symbiosis-api-rs/actions/workflows/main.yml/badge.svg)](https://github.com/phnaharris/symbiosis-api-rs/actions/workflows/main.yml) | ||
|
||
# Installation | ||
A high-level binding for Symbiosis API, written in Rust. | ||
|
||
```bash | ||
cargo add symbiosis-api | ||
Symbiosis API allows you to integrate the functionalities of the Symbiosis Protocol into your | ||
application, platform or protocol. | ||
|
||
By integrating the Symbiosis API, you can quickly and effectively enable decentralized | ||
cross-chain swaps and cross-chain liquidity management for your users. | ||
|
||
This crate uses the [reqwest] crate for a convenient, higher-level HTTP Client, for request and | ||
response, to and from Symbiosis, and [serde] for serialize and deserialize from and to | ||
appropriate data format. | ||
|
||
## Examples | ||
|
||
Let's start out swapping from ETH on Ethereum to MNT on Mantle network. | ||
|
||
```rust | ||
use symbiosis_api::{ | ||
types::{ | ||
request::{Request, SwappingExactInBody}, | ||
response::Response, | ||
Token, TokenAmount, | ||
}, | ||
SymbiosisApi, | ||
}; | ||
use ethers_core::types::{Address, Chain, U256}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<Response, anyhow::Error> { | ||
// initialize the `SymbiosisApi` client | ||
let symbiosis = SymbiosisApi::builder().with_partner_id("your_partner_id").build(); | ||
|
||
// preparing the request body | ||
let address: Address = "0x690b9a9e9aa1c9db991c7721a92d351db4fac990".parse()?; | ||
let eth_mainnet = Token::builder().build(); | ||
let eth_mainnet_amount = TokenAmount::new(eth_mainnet, U256::from(1000000000000000u64)); // 0.001 ETH | ||
let mnt_mantle = Token::builder().chain_id(Chain::Mantle).build(); | ||
let swap_exact_in = SwappingExactInBody::builder() | ||
.token_amount_in(eth_mainnet_amount) | ||
.token_out(mnt_mantle) | ||
.from(address) | ||
.to(address) | ||
.build(); | ||
let req = Request::SwappingExactIn(swap_exact_in); | ||
|
||
// send the request and receive the response back | ||
let resp = symbiosis.post_v1_swapping_exact_in(req)?.send().await?; | ||
|
||
return anyhow::Ok(resp); | ||
} | ||
``` | ||
|
||
For more examples, take a look at the `examples/` directory. | ||
|
||
Current version: 0.1.0 | ||
|
||
License: GPL-3.0-or-later |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# {{crate}} | ||
|
||
[![Crates.io](https://img.shields.io/crates/v/symbiosis-api.svg)](https://crates.io/crates/symbiosis-api) | ||
[![Documentation](https://docs.rs/symbiosis-api/badge.svg)](https://docs.rs/symbiosis-api/) | ||
[![Codecov](https://codecov.io/github/phnaharris/symbiosis-api/coverage.svg?branch=main)](https://codecov.io/gh/phnaharris/symbiosis-api) | ||
[![Build Status](https://github.com/phnaharris/symbiosis-api-rs/actions/workflows/main.yml/badge.svg)](https://github.com/phnaharris/symbiosis-api-rs/actions/workflows/main.yml) | ||
|
||
{{readme}} | ||
|
||
Current version: {{version}} | ||
|
||
License: {{license}} |