Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable other regions #744

Draft
wants to merge 19 commits into
base: feat/latency-dns-routing
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/sub-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ jobs:

validate-staging:
name: Validate Staging
strategy:
matrix:
endpoint:
- "https://staging.rpc.walletconnect.com"
- "https://eu-central-1.staging.rpc.walletconnect.com"
# - "https://us-east-1.staging.rpc.walletconnect.com"
# - "https://ap-southeast-1.staging.rpc.walletconnect.com"
needs: [ cd-staging ]
uses: ./.github/workflows/sub-validate.yml
secrets: inherit
with:
stage: staging
stage-url: https://staging.${{ vars.SUBDOMAIN_NAME }}.walletconnect.com
stage-url: ${{ matrix.endpoint }}

cd-prod:
name: Prod
Expand All @@ -71,9 +78,16 @@ jobs:

validate-prod:
name: Validate Prod
strategy:
matrix:
endpoint:
- "https://rpc.walletconnect.com"
- "https://eu-central-1.rpc.walletconnect.com"
# - "https://us-east-1.rpc.walletconnect.com"
# - "https://ap-southeast-1.rpc.walletconnect.com"
needs: [ cd-prod ]
uses: ./.github/workflows/sub-validate.yml
secrets: inherit
with:
stage: prod
stage-url: https://${{ vars.SUBDOMAIN_NAME }}.walletconnect.com
stage-url: ${{ matrix.endpoint }}
16 changes: 4 additions & 12 deletions .github/workflows/sub-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
health-check:
name: Health Check - ${{ inputs.stage }}
name: Health Check - ${{ inputs.stage-url }}
runs-on: ubuntu-latest
environment:
name: ${{ inputs.stage }}
Expand All @@ -31,7 +31,7 @@ jobs:
run: curl "${{ inputs.stage-url }}/health"

integration-tests:
name: Integration Tests - ${{ inputs.stage }}
name: Integration Tests - ${{ inputs.stage-url }}
runs-on: ubuntu-latest
services:
postgres:
Expand Down Expand Up @@ -74,15 +74,15 @@ jobs:
args: --test integration

integration-tests-providers:
name: Providers Integration Tests - ${{ inputs.stage }}
name: Providers Integration Tests - ${{ inputs.stage-url }}
uses: ./.github/workflows/sub-providers.yml
secrets: inherit
with:
providers-directory: "src/providers/"
stage-url: ${{ inputs.stage-url }}

integration-tests-ts:
name: TS Integration Tests - ${{ inputs.stage }}
name: TS Integration Tests - ${{ inputs.stage-url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -98,15 +98,7 @@ jobs:
- name: Yarn Install
run: yarn install

# Temporary ignoring `Sessions tests` for staging until IRN peering for staging is ready
- name: Run Yarn Integration Tests (no IRN tests)
if: ${{ inputs.stage == 'staging' }}
run: yarn integration --testPathIgnorePatterns='sessions.test.ts'
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
RPC_URL: ${{ inputs.stage-url }}
- name: Yarn Integration Tests
if: ${{ inputs.stage == 'prod' }}
run: yarn integration
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.

- - -
## 0.93.1 - 2024-08-26
#### Bug Fixes
- **(tests)** fixing transactions history integration tests (#747) - (828dee9) - Max Kalashnikoff | maksy.eth

- - -

## 0.93.0 - 2024-08-26
#### Features
- **(transactions)** implementing Solana transactions history support (#742) - (1c65dc0) - Max Kalashnikoff | maksy.eth
Expand Down
82 changes: 64 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rpc-proxy"
version = "0.93.0"
version = "0.93.1"
edition = "2021"
authors = [
"Derek <[email protected]>",
Expand Down Expand Up @@ -83,6 +83,7 @@ alloy-primitives = "0.7"

bytes = "1.7.1"
base64 = "0.22"
bs58 = "0.5"
regex = "1.10"
sha256 = "1.5"
uuid = "1.10"
Expand Down
12 changes: 10 additions & 2 deletions integration/history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Transactions history', () => {
expect(typeof item.metadata).toBe('object')
// expect chain to be null or caip-2 format
if (item.metadata.chain !== null) {
expect(item.metadata.chain).toEqual(expect.stringMatching(/^(solana:)?\d+$/));
expect(item.metadata.chain).toEqual(expect.stringMatching(/^(solana:)?[a-zA-Z0-9]+$/));
} else {
expect(item.metadata.chain).toBeNull();
}
Expand Down Expand Up @@ -76,11 +76,19 @@ describe('Transactions history', () => {
expect(resp.data.next).toBeNull()
})

it('wrong address format', async () => {
it('wrong addresses', async () => {
// wrong Ethereum address format
let resp: any = await httpClient.get(
`${baseUrl}/v1/account/X${fulfilled_eth_address}/history?projectId=${projectId}`,
)
expect(resp.status).toBe(400)

// wrong Solana address format
let solana_chainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
resp = await httpClient.get(
`${baseUrl}/v1/account/X${fulfilled_solana_address}/history?projectId=${projectId}&chainId=${solana_chainId}`,
)
expect(resp.status).toBe(400)
})

it('onramp Coinbase provider', async () => {
Expand Down
9 changes: 7 additions & 2 deletions src/providers/solscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl HistoryProvider for SolScanProvider {
}
let body = response.json::<HistoryResponse>().await?;

let transactions = body
let transactions: Vec<HistoryTransaction> = body
.data
.into_iter()
.map(|f| HistoryTransaction {
Expand Down Expand Up @@ -229,7 +229,12 @@ impl HistoryProvider for SolScanProvider {
})
.collect();

let next = Some((page.parse::<u64>().unwrap_or(1) + 1).to_string());
let next = if !transactions.is_empty() {
Some((page.parse::<u64>().unwrap_or(1) + 1).to_string())
} else {
None
};

Ok(HistoryResponseBody {
data: transactions,
next,
Expand Down
18 changes: 16 additions & 2 deletions src/utils/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use {
},
alloy_primitives::Address,
base64::prelude::*,
bs58,
ethers::{
abi::Token,
core::{
Expand Down Expand Up @@ -548,8 +549,21 @@ pub fn is_coin_type_supported(coin_type: u32) -> bool {
/// Check if the address is in correct format
pub fn is_address_valid(address: &str, namespace: &CaipNamespaces) -> bool {
match namespace {
CaipNamespaces::Eip155 => CAIP_ETH_ADDRESS_REGEX.is_match(address),
CaipNamespaces::Solana => CAIP_SOLANA_ADDRESS_REGEX.is_match(address),
CaipNamespaces::Eip155 => {
if !CAIP_ETH_ADDRESS_REGEX.is_match(address) {
return false;
}
H160::from_str(address).is_ok()
}
CaipNamespaces::Solana => {
if !CAIP_SOLANA_ADDRESS_REGEX.is_match(address) {
return false;
}
match bs58::decode(address).into_vec() {
Ok(decoded) => decoded.len() == 32,
Err(_) => false,
}
}
}
}

Expand Down
Loading
Loading