Compare commits
13 Commits
25c96e210a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8896234a8d | ||
|
|
b15b13c57e | ||
|
|
f9c7929a41 | ||
|
|
265b96e0ca | ||
|
|
7e5f65a086 | ||
|
|
2752c5fa24 | ||
|
|
bdb70bef22 | ||
|
|
c55eedf3f1 | ||
|
|
2b26a315ff | ||
|
|
2d1ca5e156 | ||
|
|
b18f2e79a6 | ||
|
|
522ce98806 | ||
|
|
b3a7f081ca |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
dist/
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "chain138-snap-minimal"]
|
||||
path = chain138-snap-minimal
|
||||
url = https://github.com/Defi-Oracle-Tooling/chain138-snap-minimal.git
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
This repository contains all MetaMask integration components for ChainID 138, including:
|
||||
- Network configuration
|
||||
- Token lists
|
||||
- Token lists (**`config/token-list.json`** mirrors the parent repo **`token-lists/lists/dbis-138.tokenlist.json`**; live apps typically use **`https://explorer.d-bis.org/api/config/token-list`** for the multichain DUAL list)
|
||||
- Price feed integration
|
||||
- **Smart Accounts Kit integration** ✅
|
||||
- Documentation
|
||||
|
||||
1
chain138-snap-minimal
Submodule
1
chain138-snap-minimal
Submodule
Submodule chain138-snap-minimal added at 8c52fea845
@@ -1,7 +1,9 @@
|
||||
# Copy to .env and set values. .env is gitignored.
|
||||
|
||||
# npm registry token for publishing chain138-snap (granular token with Publish + Bypass 2FA).
|
||||
# npm registry token for publishing chain138-snap and chain138-open-snap (granular:
|
||||
# Publish; enable "Bypass two-factor authentication" if npm requires it for automation).
|
||||
# Create at: https://www.npmjs.com/settings/~/tokens → Generate New Token → Granular.
|
||||
# Repo script: scripts/deployment/publish-chain138-open-snap.sh loads this file automatically.
|
||||
NPM_ACCESS_TOKEN=
|
||||
|
||||
# Optional: token-aggregation API for companion site (see packages/site/.env.production.dist).
|
||||
|
||||
@@ -50,4 +50,4 @@ For the companion site (this repo’s `packages/site`):
|
||||
|
||||
## RPC methods
|
||||
|
||||
See [TESTING_INSTRUCTIONS.md](TESTING_INSTRUCTIONS.md) for the full list: `hello`, `get_networks`, `get_chain138_config`, `get_chain138_market_chains`, `get_token_list`, `get_token_list_url`, `get_oracles`, `show_dynamic_info`, `get_market_summary`, `show_market_data`, `get_bridge_routes`, `show_bridge_routes`, `get_swap_quote`, `show_swap_quote`.
|
||||
See [TESTING_INSTRUCTIONS.md](TESTING_INSTRUCTIONS.md) for the full list: `hello`, `get_networks`, `get_chain138_config`, `get_chain138_market_chains`, `get_token_list`, `get_token_list_url`, `get_oracles`, `show_dynamic_info`, `get_market_summary`, `get_current_price`, `get_historical_price`, `get_pricing_context`, `show_market_data`, `get_bridge_routes`, `show_bridge_routes`, `get_swap_quote`, `show_swap_quote`.
|
||||
|
||||
444
chain138-snap/docs/SNAP_PRICING_REQUIREMENTS.md
Normal file
444
chain138-snap/docs/SNAP_PRICING_REQUIREMENTS.md
Normal file
@@ -0,0 +1,444 @@
|
||||
# Chain 138 Snap Pricing Requirements
|
||||
|
||||
This note traces what is required to make Chain 138 pricing "MetaMask-Snap-grade" end to end for both:
|
||||
|
||||
- current valuation on EOA and token detail surfaces
|
||||
- transfer-time locked valuation on transaction detail surfaces
|
||||
|
||||
It is based on the current live API contract and the current Snap implementation in this repo.
|
||||
|
||||
## Current state
|
||||
|
||||
The Snap already supports:
|
||||
|
||||
- network config via `get_networks` and `get_chain138_config`
|
||||
- token list via `get_token_list`
|
||||
- current market summary via `get_market_summary`
|
||||
- swap and bridge helper RPCs
|
||||
|
||||
The token-aggregation API already supports:
|
||||
|
||||
- current token summaries via `GET /api/v1/tokens`
|
||||
- token detail via `GET /api/v1/tokens/:address`
|
||||
- OHLCV candles via `GET /api/v1/tokens/:address/ohlcv`
|
||||
- historical point lookup via `GET /api/v1/tokens/:address/price-at`
|
||||
|
||||
The gap is that the Snap only consumes current market summary, while transfer-time pricing still depends on OHLCV coverage that is not yet reliably backfilled.
|
||||
|
||||
## What the Snap calls today
|
||||
|
||||
Current Snap RPC implementation:
|
||||
|
||||
- `get_market_summary` calls `GET {apiBaseUrl}/api/v1/tokens?chainId={chainId}&limit=50`
|
||||
- `get_oracles` calls `GET {apiBaseUrl}/api/v1/config?chainId={chainId}`
|
||||
- `get_networks` calls `GET {apiBaseUrl}/api/v1/networks`
|
||||
|
||||
Relevant implementation:
|
||||
|
||||
- `metamask-integration/chain138-snap/packages/snap/src/index.tsx`
|
||||
- `smom-dbis-138/services/token-aggregation/src/api/routes/tokens.ts`
|
||||
|
||||
## Verified live payloads
|
||||
|
||||
### 1. Networks
|
||||
|
||||
Request:
|
||||
|
||||
```http
|
||||
GET /token-aggregation/api/v1/networks
|
||||
```
|
||||
|
||||
Live shape:
|
||||
|
||||
```json
|
||||
{
|
||||
"source": "built-in",
|
||||
"version": "1.0.0",
|
||||
"networks": [
|
||||
{
|
||||
"chainId": "0x8a",
|
||||
"chainIdDecimal": 138,
|
||||
"chainName": "DeFi Oracle Meta Mainnet",
|
||||
"rpcUrls": ["..."],
|
||||
"blockExplorerUrls": ["https://explorer.d-bis.org"],
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"iconUrls": ["..."],
|
||||
"oracles": [
|
||||
{
|
||||
"name": "ETH/USD",
|
||||
"address": "0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6",
|
||||
"decimals": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Oracles config
|
||||
|
||||
Request:
|
||||
|
||||
```http
|
||||
GET /token-aggregation/api/v1/config?chainId=138
|
||||
```
|
||||
|
||||
Live shape:
|
||||
|
||||
```json
|
||||
{
|
||||
"source": "built-in",
|
||||
"version": "1.0.0",
|
||||
"chainId": 138,
|
||||
"oracles": [
|
||||
{
|
||||
"name": "ETH/USD",
|
||||
"address": "0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6",
|
||||
"decimals": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Current market summary
|
||||
|
||||
Request:
|
||||
|
||||
```http
|
||||
GET /token-aggregation/api/v1/tokens?chainId=138&limit=2
|
||||
```
|
||||
|
||||
Live shape:
|
||||
|
||||
```json
|
||||
{
|
||||
"source": "db",
|
||||
"pagination": {
|
||||
"limit": 2,
|
||||
"offset": 0,
|
||||
"count": 2
|
||||
},
|
||||
"tokens": [
|
||||
{
|
||||
"address": "0x...",
|
||||
"symbol": "USDT",
|
||||
"name": "Tether USD (Chain 138)",
|
||||
"market": {
|
||||
"chainId": 138,
|
||||
"tokenAddress": "0x...",
|
||||
"priceUsd": 1,
|
||||
"volume24h": 0,
|
||||
"volume7d": 0,
|
||||
"volume30d": 0,
|
||||
"liquidityUsd": 12104786.72586392,
|
||||
"holdersCount": 0,
|
||||
"transfers24h": 0,
|
||||
"lastUpdated": "2026-04-26T03:31:01.926Z"
|
||||
},
|
||||
"pricing": {
|
||||
"priceUsd": 1,
|
||||
"sourceLayer": "indexer_market",
|
||||
"precedenceRank": 1,
|
||||
"stale": false,
|
||||
"maxAgeSeconds": 900,
|
||||
"asOf": "2026-04-26T03:31:01.926Z",
|
||||
"ageSeconds": 3
|
||||
},
|
||||
"explorer": {
|
||||
"chainId": 138,
|
||||
"explorerBaseUrl": "https://explorer.d-bis.org",
|
||||
"addressUrl": "https://explorer.d-bis.org/address/0x...",
|
||||
"tokenUrl": "https://explorer.d-bis.org/address/0x..."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Historical point lookup
|
||||
|
||||
Request:
|
||||
|
||||
```http
|
||||
GET /token-aggregation/api/v1/tokens/0xc02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/price-at?chainId=138×tamp=2026-04-26T01:33:02.000Z
|
||||
```
|
||||
|
||||
Live shape today:
|
||||
|
||||
```json
|
||||
{
|
||||
"chainId": 138,
|
||||
"tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
||||
"requestedTimestamp": "2026-04-26T01:33:02.000Z",
|
||||
"effectiveTimestamp": "2026-04-26T03:31:01.988Z",
|
||||
"priceUsd": 2490,
|
||||
"source": "current_market_fallback"
|
||||
}
|
||||
```
|
||||
|
||||
This proves the endpoint contract exists, but also proves that the current result is not yet a locked historical candle for this timestamp.
|
||||
|
||||
## Why transfer-time pricing is not fully locked yet
|
||||
|
||||
### 1. The Snap does not call historical pricing yet
|
||||
|
||||
Current Snap market RPCs only call:
|
||||
|
||||
- `GET /api/v1/tokens`
|
||||
|
||||
They do not call:
|
||||
|
||||
- `GET /api/v1/tokens/:address/price-at`
|
||||
- `GET /api/v1/tokens/:address/ohlcv`
|
||||
|
||||
So the Snap is current-price compatible, but not transfer-time-price aware.
|
||||
|
||||
### 2. The indexer only rolls OHLCV for the last 7 days
|
||||
|
||||
Current indexing flow:
|
||||
|
||||
- discovers pools
|
||||
- indexes tokens
|
||||
- updates current market data
|
||||
- generates OHLCV for `5m`, `1h`, `24h`
|
||||
- only for `now - 7 days` through `now`
|
||||
|
||||
That means a historical valuation request can miss if:
|
||||
|
||||
- `swap_events` were never backfilled for the requested token or time
|
||||
- the requested timestamp is older than the rolling backfill window
|
||||
- the token had sparse or no swap coverage in the indexed pool set
|
||||
|
||||
### 3. Historical lookup deliberately falls back
|
||||
|
||||
The current `price-at` route tries:
|
||||
|
||||
1. `5m` OHLCV near the timestamp
|
||||
2. broader `15m`, `1h`, `4h`, `24h` windows
|
||||
3. current market data fallback
|
||||
4. canonical fallback
|
||||
|
||||
This is correct defensive behavior for explorer UX, but it is not sufficient for wallet-grade "locked at transfer time" semantics unless the caller can distinguish a true historical hit from a fallback. The `source` field already exposes that distinction.
|
||||
|
||||
## What is required
|
||||
|
||||
## A. Backfill OHLCV history
|
||||
|
||||
Minimum requirement:
|
||||
|
||||
- backfill `swap_events` and `token_ohlcv` for the token universe the Snap will price
|
||||
- include native-wrapped asset pairs for WETH9/WETH10 and key stables
|
||||
- preserve enough history to cover transaction lookback expectations
|
||||
|
||||
Required data sources:
|
||||
|
||||
- on-chain swap event replay into `swap_events`
|
||||
- optional external pair OHLCV seeding where on-chain coverage is missing, using the existing CMC pair OHLCV adapter
|
||||
|
||||
Implementation requirements:
|
||||
|
||||
- add an explicit backfill job, not just rolling indexer generation
|
||||
- support `fromBlock` / `toBlock` or `fromTimestamp` / `toTimestamp`
|
||||
- generate `5m`, `15m`, `1h`, `4h`, `24h` candles, not only `5m`, `1h`, `24h`
|
||||
- seed historical candles before enabling wallet-grade transfer-time valuation
|
||||
|
||||
Operational acceptance criteria:
|
||||
|
||||
- `price-at` for known transaction timestamps returns `source: ohlcv_*`, not `current_market_fallback`
|
||||
- the requested timestamp and effective timestamp are within the expected candle tolerance
|
||||
- historical coverage exists across the curated Chain 138 token set
|
||||
|
||||
## B. Expose a Snap-ready pricing method
|
||||
|
||||
The Snap needs a wallet-facing RPC for pricing, instead of overloading `get_market_summary`.
|
||||
|
||||
Recommended new Snap RPC methods:
|
||||
|
||||
- `get_current_price`
|
||||
- `get_historical_price`
|
||||
- `get_pricing_context`
|
||||
|
||||
Recommended behavior:
|
||||
|
||||
### `get_current_price`
|
||||
|
||||
Request params:
|
||||
|
||||
```json
|
||||
{
|
||||
"apiBaseUrl": "https://explorer.d-bis.org/token-aggregation",
|
||||
"chainId": 138,
|
||||
"address": "0x..."
|
||||
}
|
||||
```
|
||||
|
||||
Recommended response:
|
||||
|
||||
```json
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x...",
|
||||
"priceUsd": 1,
|
||||
"asOf": "2026-04-26T03:31:01.926Z",
|
||||
"sourceLayer": "indexer_market",
|
||||
"stale": false
|
||||
}
|
||||
```
|
||||
|
||||
This can be implemented by calling `GET /api/v1/tokens/:address?chainId=138` and projecting `token.pricing` plus selected `token.market` fields.
|
||||
|
||||
### `get_historical_price`
|
||||
|
||||
Request params:
|
||||
|
||||
```json
|
||||
{
|
||||
"apiBaseUrl": "https://explorer.d-bis.org/token-aggregation",
|
||||
"chainId": 138,
|
||||
"address": "0x...",
|
||||
"timestamp": "2026-04-26T01:33:02.000Z"
|
||||
}
|
||||
```
|
||||
|
||||
Recommended response:
|
||||
|
||||
```json
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x...",
|
||||
"requestedTimestamp": "2026-04-26T01:33:02.000Z",
|
||||
"effectiveTimestamp": "2026-04-26T01:30:00.000Z",
|
||||
"priceUsd": 2490,
|
||||
"source": "ohlcv_5m",
|
||||
"historical": true
|
||||
}
|
||||
```
|
||||
|
||||
Important rule:
|
||||
|
||||
- if `source` is `current_market_fallback` or `canonical_fallback`, the response should include `historical: false`
|
||||
- callers must not treat fallback data as transfer-locked valuation
|
||||
|
||||
### `get_pricing_context`
|
||||
|
||||
This is the most Snap-friendly single call.
|
||||
|
||||
Request params:
|
||||
|
||||
```json
|
||||
{
|
||||
"apiBaseUrl": "https://explorer.d-bis.org/token-aggregation",
|
||||
"chainId": 138,
|
||||
"address": "0x...",
|
||||
"timestamp": "2026-04-26T01:33:02.000Z"
|
||||
}
|
||||
```
|
||||
|
||||
Recommended response:
|
||||
|
||||
```json
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x...",
|
||||
"current": {
|
||||
"priceUsd": 2490,
|
||||
"asOf": "2026-04-26T03:31:01.988Z",
|
||||
"sourceLayer": "indexer_market",
|
||||
"stale": false
|
||||
},
|
||||
"historical": {
|
||||
"requestedTimestamp": "2026-04-26T01:33:02.000Z",
|
||||
"effectiveTimestamp": "2026-04-26T01:30:00.000Z",
|
||||
"priceUsd": 2488.42,
|
||||
"source": "ohlcv_5m",
|
||||
"locked": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This gives the Snap everything it needs for:
|
||||
|
||||
- current wallet balance valuation
|
||||
- transaction review valuation
|
||||
- explicit distinction between live and transfer-time price
|
||||
|
||||
## C. Exact payload shape the Snap/provider should call
|
||||
|
||||
If we do not add a new backend endpoint immediately, the Snap/provider should call these existing routes:
|
||||
|
||||
### Current valuation
|
||||
|
||||
Use:
|
||||
|
||||
```http
|
||||
GET /api/v1/tokens/:address?chainId=138
|
||||
```
|
||||
|
||||
Read:
|
||||
|
||||
- `token.market.priceUsd`
|
||||
- `token.market.lastUpdated`
|
||||
- `token.pricing.priceUsd`
|
||||
- `token.pricing.asOf`
|
||||
- `token.pricing.sourceLayer`
|
||||
- `token.pricing.stale`
|
||||
|
||||
### Historical valuation
|
||||
|
||||
Use:
|
||||
|
||||
```http
|
||||
GET /api/v1/tokens/:address/price-at?chainId=138×tamp={ISO_8601}
|
||||
```
|
||||
|
||||
Read:
|
||||
|
||||
- `chainId`
|
||||
- `tokenAddress`
|
||||
- `requestedTimestamp`
|
||||
- `effectiveTimestamp`
|
||||
- `priceUsd`
|
||||
- `source`
|
||||
|
||||
Caller rule:
|
||||
|
||||
- only treat `source` values starting with `ohlcv_` as locked historical valuation
|
||||
- treat `current_market_fallback` and `canonical_fallback` as non-historical fallback data
|
||||
|
||||
### Optional charting
|
||||
|
||||
Use:
|
||||
|
||||
```http
|
||||
GET /api/v1/tokens/:address/ohlcv?chainId=138&interval=1h&from={ISO_8601}&to={ISO_8601}
|
||||
```
|
||||
|
||||
Read:
|
||||
|
||||
- `chainId`
|
||||
- `tokenAddress`
|
||||
- `interval`
|
||||
- `data[]` with `timestamp`, `open`, `high`, `low`, `close`, `volume`, `volumeUsd`
|
||||
|
||||
## Recommended implementation order
|
||||
|
||||
1. Add a backfill job for `swap_events` and `token_ohlcv`.
|
||||
2. Expand candle generation to include `15m` and `4h` in the indexer, not only the API fallback reader.
|
||||
3. Add a single Snap-oriented API response, preferably `GET /api/v1/tokens/:address/pricing-context`.
|
||||
4. Add new Snap RPC methods for current and historical pricing.
|
||||
5. Update the companion site and provider examples to call the new pricing RPCs.
|
||||
6. Add release checks that fail if curated assets return fallback instead of `ohlcv_*` for known test timestamps.
|
||||
|
||||
## Practical definition of "MetaMask-Snap-grade"
|
||||
|
||||
The pricing path is Snap-grade only when all of the following are true:
|
||||
|
||||
- current price is available from the API for curated assets
|
||||
- historical price is available for transaction timestamps from OHLCV, not fallback
|
||||
- the Snap exposes current and historical valuation as distinct methods or a clearly typed combined method
|
||||
- the caller can programmatically distinguish `locked historical` from `best-effort fallback`
|
||||
- docs and examples show the exact request and response contract
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 318 KiB |
@@ -39,12 +39,38 @@ const PoweredByContainer = styled.div`
|
||||
margin-left: 1rem;
|
||||
`;
|
||||
|
||||
const LegalColumn = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
min-width: 16rem;
|
||||
`;
|
||||
|
||||
const SectionTitle = styled.div`
|
||||
font-size: ${({ theme }) => theme.fontSizes.small};
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: ${({ theme }) => theme.colors.text?.muted};
|
||||
margin-bottom: 0.4rem;
|
||||
`;
|
||||
|
||||
const FooterLink = styled.a`
|
||||
color: ${({ theme }) => theme.colors.text?.default};
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns The Snap footer with brand, legal links, and build metadata.
|
||||
*/
|
||||
export const Footer = () => {
|
||||
const theme = useTheme();
|
||||
const buildVersion = getBuildVersion();
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
return (
|
||||
<FooterWrapper>
|
||||
@@ -55,6 +81,27 @@ export const Footer = () => {
|
||||
<MetaMask color={theme.colors.text?.default} />
|
||||
</PoweredByContainer>
|
||||
</PoweredByButton>
|
||||
<LegalColumn>
|
||||
<SectionTitle>Explorer</SectionTitle>
|
||||
<FooterLink href="/docs">
|
||||
Documentation
|
||||
</FooterLink>
|
||||
<FooterLink href="/privacy.html">
|
||||
Privacy Policy
|
||||
</FooterLink>
|
||||
<FooterLink href="/terms.html">
|
||||
Terms of Service
|
||||
</FooterLink>
|
||||
<FooterLink href="/acknowledgments.html">
|
||||
Acknowledgments
|
||||
</FooterLink>
|
||||
<FooterLink href="mailto:support@d-bis.org">
|
||||
support@d-bis.org
|
||||
</FooterLink>
|
||||
</LegalColumn>
|
||||
<VersionSpan title="Copyright">
|
||||
© {currentYear} DBIS / Defi Oracle
|
||||
</VersionSpan>
|
||||
{buildVersion ? (
|
||||
<VersionSpan title="Build version">v{buildVersion}</VersionSpan>
|
||||
) : null}
|
||||
|
||||
@@ -6,21 +6,44 @@ import { Toggle } from './Toggle';
|
||||
import { getThemePreference } from '../utils';
|
||||
|
||||
const HeaderWrapper = styled.header`
|
||||
color: #fff;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
${(props) => props.theme.colors.primary?.default} 0%,
|
||||
${(props) => props.theme.colors.primary?.dark} 100%
|
||||
);
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
border-bottom: 1px solid ${(props) => props.theme.colors.border?.default};
|
||||
`;
|
||||
|
||||
const HeaderInner = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 2.4rem;
|
||||
border-bottom: 1px solid ${(props) => props.theme.colors.border?.default};
|
||||
gap: 0.85rem;
|
||||
padding: 0.7rem 1.25rem;
|
||||
max-width: 1320px;
|
||||
margin: 0 auto;
|
||||
|
||||
${({ theme }) => theme.mediaQueries.small} {
|
||||
padding: 0.55rem 0.9rem;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
`;
|
||||
|
||||
const Title = styled.p`
|
||||
font-size: ${(props) => props.theme.fontSizes.title};
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
margin-left: 1.2rem;
|
||||
line-height: 1.05;
|
||||
|
||||
${({ theme }) => theme.mediaQueries.small} {
|
||||
display: none;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -28,42 +51,95 @@ const LogoWrapper = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
padding: 0.25rem 0.4rem;
|
||||
border-radius: 11px;
|
||||
transition:
|
||||
background 0.2s,
|
||||
transform 0.2s;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
transform: translateY(-1px);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
${({ theme }) => theme.mediaQueries.small} {
|
||||
gap: 0.45rem;
|
||||
padding: 0.22rem 0.35rem;
|
||||
}
|
||||
`;
|
||||
|
||||
const RightContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
|
||||
${({ theme }) => theme.mediaQueries.small} {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
`;
|
||||
|
||||
const Brand = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.08rem;
|
||||
|
||||
${({ theme }) => theme.mediaQueries.small} {
|
||||
gap: 0.08rem;
|
||||
}
|
||||
`;
|
||||
|
||||
const BrandSubtitle = styled.span`
|
||||
font-size: 0.7rem;
|
||||
font-weight: normal;
|
||||
opacity: 0.9;
|
||||
line-height: 1.1;
|
||||
|
||||
${({ theme }) => theme.mediaQueries.small} {
|
||||
font-size: 0.62rem;
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* Render the companion site header.
|
||||
*
|
||||
* @param options0
|
||||
* @param options0.handleToggleClick
|
||||
* @param options0 - Header props.
|
||||
* @param options0.handleToggleClick - Toggles the site theme.
|
||||
* @returns The header element.
|
||||
*/
|
||||
export const Header = ({
|
||||
handleToggleClick,
|
||||
}: {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/** Toggles the site theme. */
|
||||
handleToggleClick: () => void;
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<HeaderWrapper>
|
||||
<LogoWrapper>
|
||||
<SnapLogo color={theme.colors.icon?.default} size={36} />
|
||||
<Title>Chain 138 Snap</Title>
|
||||
</LogoWrapper>
|
||||
<RightContainer>
|
||||
<Toggle
|
||||
onToggle={handleToggleClick}
|
||||
defaultChecked={getThemePreference()}
|
||||
/>
|
||||
<HeaderButtons />
|
||||
</RightContainer>
|
||||
<HeaderInner>
|
||||
<LogoWrapper as="a" href="/home" aria-label="Go to explorer home">
|
||||
<SnapLogo color={theme.colors.icon?.default} size={30} />
|
||||
<Brand>
|
||||
<Title>Chain 138 Snap</Title>
|
||||
<BrandSubtitle>Chain 138 Explorer by DBIS</BrandSubtitle>
|
||||
</Brand>
|
||||
</LogoWrapper>
|
||||
<RightContainer>
|
||||
<Toggle
|
||||
onToggle={handleToggleClick}
|
||||
defaultChecked={getThemePreference()}
|
||||
/>
|
||||
<HeaderButtons />
|
||||
</RightContainer>
|
||||
</HeaderInner>
|
||||
</HeaderWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -9,7 +9,8 @@ export const getSnapApiBaseUrl = (): string =>
|
||||
'';
|
||||
|
||||
/**
|
||||
* Public origin of the Snap companion site (e.g. https://explorer.d-bis.org).
|
||||
* Public origin of the Snap companion site (e.g. https://blockscout.defi-oracle.io
|
||||
* or https://explorer.d-bis.org).
|
||||
* Set GATSBY_SNAP_SITE_URL so "Send on Chain 138" link is absolute HTTPS and never redirects to HTTP.
|
||||
*/
|
||||
export const getSnapSiteUrl = (): string =>
|
||||
|
||||
@@ -18,7 +18,7 @@ const CHAIN_138_PARAMS = {
|
||||
chainName: 'DeFi Oracle Meta Mainnet',
|
||||
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
||||
rpcUrls: ['https://rpc-http-pub.d-bis.org'],
|
||||
blockExplorerUrls: ['https://explorer.d-bis.org'],
|
||||
blockExplorerUrls: ['https://explorer.d-bis.org', 'https://blockscout.defi-oracle.io'],
|
||||
};
|
||||
|
||||
const Container = styled.div`
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":"dev","buildTime":"2026-02-22T19:21:30.615Z"}
|
||||
{"version":"dev","buildTime":"2026-04-10T08:39:18.051Z"}
|
||||
@@ -51,6 +51,9 @@ For **market data**, **swap quotes**, and **bridge routes**, the dApp must pass
|
||||
| `get_oracles` | Oracles config. |
|
||||
| `show_dynamic_info` | In-Snap dialog with networks and token list URL. |
|
||||
| `get_market_summary` / `show_market_data` | Tokens and USD prices. |
|
||||
| `get_current_price` | Current USD price snapshot for one token. |
|
||||
| `get_historical_price` | Point-in-time USD valuation for one token at a timestamp. |
|
||||
| `get_pricing_context` | Combined current and historical pricing response. |
|
||||
| `get_bridge_routes` / `show_bridge_routes` | CCIP and Trustless bridge routes. |
|
||||
| `get_swap_quote` / `show_swap_quote` | Swap quote (requires `tokenIn`, `tokenOut`, `amountIn`). |
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"url": "https://github.com/bis-innovations/chain138-snap.git"
|
||||
},
|
||||
"source": {
|
||||
"shasum": "8GYAFlgbiR/jXAwnprqqE4jTIvQv/Uhkn3MiH23g/tQ=",
|
||||
"shasum": "n8O3BEDN45Q8+QgiyLpEhli82ZoNnyZy5r2zuu7jmqM=",
|
||||
"location": {
|
||||
"npm": {
|
||||
"filePath": "dist/bundle.js",
|
||||
|
||||
@@ -22,6 +22,8 @@ export type SnapRpcParams = {
|
||||
toChain?: number;
|
||||
/** For get_token_mapping (resolve): token address on source chain to resolve to destination */
|
||||
address?: string;
|
||||
/** For historical pricing requests */
|
||||
timestamp?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -123,6 +125,14 @@ async function fetchNetworks(apiBase: string) {
|
||||
}>;
|
||||
}
|
||||
|
||||
async function fetchJson<T>(url: string): Promise<T> {
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP ${res.status}`);
|
||||
}
|
||||
return res.json() as Promise<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle incoming JSON-RPC requests, sent through `wallet_invokeSnap`.
|
||||
*
|
||||
@@ -578,6 +588,119 @@ export const onRpcRequest: OnRpcRequestHandler = async ({
|
||||
}
|
||||
}
|
||||
|
||||
case 'get_current_price': {
|
||||
if (!base) {
|
||||
return {
|
||||
error:
|
||||
'Pass apiBaseUrl (token-aggregation service URL) to fetch current price',
|
||||
};
|
||||
}
|
||||
const chainIdParam = params?.chainId ?? 138;
|
||||
const address = typeof params?.address === 'string' ? params.address.trim() : '';
|
||||
if (!address) {
|
||||
return { error: 'Missing params: address' };
|
||||
}
|
||||
try {
|
||||
const data = await fetchJson<{
|
||||
token?: {
|
||||
pricing?: {
|
||||
priceUsd?: number;
|
||||
asOf?: string;
|
||||
sourceLayer?: string;
|
||||
stale?: boolean;
|
||||
};
|
||||
market?: {
|
||||
lastUpdated?: string;
|
||||
};
|
||||
};
|
||||
}>(`${base}/api/v1/tokens/${address}?chainId=${String(chainIdParam)}`);
|
||||
return {
|
||||
chainId: chainIdParam,
|
||||
address,
|
||||
priceUsd: data.token?.pricing?.priceUsd,
|
||||
asOf: data.token?.pricing?.asOf ?? data.token?.market?.lastUpdated,
|
||||
sourceLayer: data.token?.pricing?.sourceLayer,
|
||||
stale: data.token?.pricing?.stale,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
error:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: 'Failed to fetch current price',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
case 'get_historical_price': {
|
||||
if (!base) {
|
||||
return {
|
||||
error:
|
||||
'Pass apiBaseUrl (token-aggregation service URL) to fetch historical price',
|
||||
};
|
||||
}
|
||||
const chainIdParam = params?.chainId ?? 138;
|
||||
const address = typeof params?.address === 'string' ? params.address.trim() : '';
|
||||
const timestamp = typeof params?.timestamp === 'string' ? params.timestamp.trim() : '';
|
||||
if (!address || !timestamp) {
|
||||
return { error: 'Missing params: address, timestamp' };
|
||||
}
|
||||
try {
|
||||
const url = new URL(`${base}/api/v1/tokens/${address}/price-at`);
|
||||
url.searchParams.set('chainId', String(chainIdParam));
|
||||
url.searchParams.set('timestamp', timestamp);
|
||||
const data = await fetchJson<{
|
||||
chainId: number;
|
||||
tokenAddress: string;
|
||||
requestedTimestamp: string;
|
||||
effectiveTimestamp?: string;
|
||||
priceUsd?: number;
|
||||
source: string;
|
||||
}>(url.toString());
|
||||
return {
|
||||
...data,
|
||||
address,
|
||||
historical: data.source.startsWith('ohlcv_') || data.source === 'swap_event',
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
error:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: 'Failed to fetch historical price',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
case 'get_pricing_context': {
|
||||
if (!base) {
|
||||
return {
|
||||
error:
|
||||
'Pass apiBaseUrl (token-aggregation service URL) to fetch pricing context',
|
||||
};
|
||||
}
|
||||
const chainIdParam = params?.chainId ?? 138;
|
||||
const address = typeof params?.address === 'string' ? params.address.trim() : '';
|
||||
if (!address) {
|
||||
return { error: 'Missing params: address' };
|
||||
}
|
||||
try {
|
||||
const url = new URL(`${base}/api/v1/tokens/${address}/pricing-context`);
|
||||
url.searchParams.set('chainId', String(chainIdParam));
|
||||
if (typeof params?.timestamp === 'string' && params.timestamp.trim()) {
|
||||
url.searchParams.set('timestamp', params.timestamp.trim());
|
||||
}
|
||||
return await fetchJson(url.toString());
|
||||
} catch (error) {
|
||||
return {
|
||||
error:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: 'Failed to fetch pricing context',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
case 'get_swap_quote': {
|
||||
if (!base) {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the Snap companion site for https://explorer.d-bis.org/snap/
|
||||
# Uses GATSBY_SNAP_API_BASE_URL=https://explorer.d-bis.org so Market data, Bridge, Swap cards work.
|
||||
# For that to work, explorer.d-bis.org must serve the token-aggregation API at /api/v1/... (deploy
|
||||
# Build the Snap companion site for https://blockscout.defi-oracle.io/snap/
|
||||
# Uses GATSBY_SNAP_API_BASE_URL=https://blockscout.defi-oracle.io so Market data, Bridge, Swap cards work.
|
||||
# For that to work, blockscout.defi-oracle.io must serve the token-aggregation API at /api/v1/... (deploy
|
||||
# smom-dbis-138/services/token-aggregation and proxy it, or set GATSBY_SNAP_API_BASE_URL to the API host).
|
||||
# Output: packages/site/public/ (upload to /var/www/html/snap/ on VMID 5000).
|
||||
set -euo pipefail
|
||||
@@ -9,9 +9,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
export GATSBY_PATH_PREFIX=/snap
|
||||
export GATSBY_SNAP_API_BASE_URL="${GATSBY_SNAP_API_BASE_URL:-https://explorer.d-bis.org}"
|
||||
export GATSBY_SNAP_API_BASE_URL="${GATSBY_SNAP_API_BASE_URL:-https://blockscout.defi-oracle.io}"
|
||||
# So "Send on Chain 138" link is absolute HTTPS (avoids redirect to http and mixed-content).
|
||||
export GATSBY_SNAP_SITE_URL="${GATSBY_SNAP_SITE_URL:-https://explorer.d-bis.org}"
|
||||
export GATSBY_SNAP_SITE_URL="${GATSBY_SNAP_SITE_URL:-https://blockscout.defi-oracle.io}"
|
||||
# Production: use npm snap so MetaMask does not try to fetch localhost:8080 (GATSBY_* is inlined into client bundle).
|
||||
export GATSBY_SNAP_ORIGIN="${GATSBY_SNAP_ORIGIN:-npm:chain138-snap}"
|
||||
# Required for Gatsby to apply pathPrefix to script/asset URLs (see path prefix docs).
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
{
|
||||
"name": "SMOM-DBIS-138 Token List",
|
||||
"name": "DBIS Mainnet Token List",
|
||||
"version": {
|
||||
"major": 1,
|
||||
"minor": 4,
|
||||
"patch": 0
|
||||
"minor": 7,
|
||||
"patch": 5
|
||||
},
|
||||
"timestamp": "2026-02-28T00:00:00.000Z",
|
||||
"timestamp": "2026-04-14T22:00:00.000Z",
|
||||
"keywords": [
|
||||
"dbis",
|
||||
"chain138",
|
||||
"defi oracle meta"
|
||||
],
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/chain138-list.svg",
|
||||
"tokens": [
|
||||
{
|
||||
"chainId": 138,
|
||||
@@ -29,7 +35,17 @@
|
||||
"tags": [
|
||||
"defi",
|
||||
"wrapped"
|
||||
]
|
||||
],
|
||||
"extensions": {
|
||||
"category": "wrapped-native",
|
||||
"instrument": "wrapped-native",
|
||||
"settlement": "crypto-native",
|
||||
"cashLike": false,
|
||||
"backing": "native-gas-asset",
|
||||
"walletClass": "token",
|
||||
"alias": "WETH9",
|
||||
"aliasNote": "Expose WETH9 as a compatibility alias on s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
@@ -41,7 +57,15 @@
|
||||
"tags": [
|
||||
"defi",
|
||||
"wrapped"
|
||||
]
|
||||
],
|
||||
"extensions": {
|
||||
"category": "wrapped-native",
|
||||
"instrument": "wrapped-native",
|
||||
"settlement": "crypto-native",
|
||||
"cashLike": false,
|
||||
"backing": "native-gas-asset",
|
||||
"walletClass": "token"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
@@ -59,28 +83,632 @@
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x93E66202A11B1772E55407B32B44e5Cd8eda7f22",
|
||||
"name": "Compliant Tether USD",
|
||||
"name": "Tether USD (Compliant)",
|
||||
"symbol": "cUSDT",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://ipfs.io/ipfs/QmRfhPs9DcyFPpGjKwF6CCoVDWUHSxkQR34n9NK7JSbPCP",
|
||||
"logoURI": "https://explorer.d-bis.org/token-icons/cUSDT.png",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant"
|
||||
]
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "USD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cUSDT",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x9FBfab33882Efe0038DAa608185718b772EE5660",
|
||||
"name": "Tether USD (Compliant V2)",
|
||||
"symbol": "cUSDT",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://explorer.d-bis.org/token-icons/cUSDT.png",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"v2",
|
||||
"x402",
|
||||
"fwdcanon",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "USD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v2",
|
||||
"gruFamily": "cUSDT",
|
||||
"x402Ready": true,
|
||||
"fwdCanon": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xf22258f57794CC8E06237084b353Ab30fFfa640b",
|
||||
"name": "Compliant USD Coin",
|
||||
"name": "USD Coin (Compliant)",
|
||||
"symbol": "cUSDC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://ipfs.io/ipfs/QmNPq4D5JXzurmi9jAhogVMzhAQRk1PZ1r9H3qQUV9gjDm",
|
||||
"logoURI": "https://explorer.d-bis.org/token-icons/cUSDC.png",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant"
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "USD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cUSDC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x219522c60e83dEe01FC5b0329d6fA8fD84b9D13d",
|
||||
"name": "USD Coin (Compliant V2)",
|
||||
"symbol": "cUSDC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://explorer.d-bis.org/token-icons/cUSDC.png",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"v2",
|
||||
"x402",
|
||||
"fwdcanon",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "USD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v2",
|
||||
"gruFamily": "cUSDC",
|
||||
"x402Ready": true,
|
||||
"fwdCanon": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x71D6687F38b93CCad569Fa6352c876eea967201b",
|
||||
"name": "USD Coin (Chain 138)",
|
||||
"symbol": "USDC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"fiat",
|
||||
"cash"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "fiat-backed-stablecoin",
|
||||
"currency": "USD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false,
|
||||
"walletClass": "cash-like-token"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1",
|
||||
"name": "Tether USD (Chain 138)",
|
||||
"symbol": "USDT",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"fiat",
|
||||
"cash"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "fiat-backed-stablecoin",
|
||||
"currency": "USD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false,
|
||||
"walletClass": "cash-like-token"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x8085961F9cF02b4d800A3c6d386D31da4B34266a",
|
||||
"name": "Euro Coin (Compliant)",
|
||||
"symbol": "cEURC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cEURC.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "EUR",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cEURC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xdf4b71c61E5912712C1Bdd451416B9aC26949d72",
|
||||
"name": "Tether EUR (Compliant)",
|
||||
"symbol": "cEURT",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cEURT.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "EUR",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cEURT",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x003960f16D9d34F2e98d62723B6721Fb92074aD2",
|
||||
"name": "Pound Sterling (Compliant)",
|
||||
"symbol": "cGBPC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cGBPC.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "GBP",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cGBPC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x350f54e4D23795f86A9c03988c7135357CCaD97c",
|
||||
"name": "Tether GBP (Compliant)",
|
||||
"symbol": "cGBPT",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cGBPT.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "GBP",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cGBPT",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xD51482e567c03899eecE3CAe8a058161FD56069D",
|
||||
"name": "Australian Dollar (Compliant)",
|
||||
"symbol": "cAUDC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cAUDC.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "AUD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cAUDC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xEe269e1226a334182aace90056EE4ee5Cc8A6770",
|
||||
"name": "Japanese Yen (Compliant)",
|
||||
"symbol": "cJPYC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cJPYC.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "JPY",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cJPYC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x873990849DDa5117d7C644f0aF24370797C03885",
|
||||
"name": "Swiss Franc (Compliant)",
|
||||
"symbol": "cCHFC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cCHFC.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "CHF",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cCHFC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x54dBd40cF05e15906A2C21f600937e96787f5679",
|
||||
"name": "Canadian Dollar (Compliant)",
|
||||
"symbol": "cCADC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://raw.githubusercontent.com/Order-of-Hospitallers/proxmox-cp/main/token-lists/logos/gru/cCADC.svg",
|
||||
"tags": [
|
||||
"stablecoin",
|
||||
"defi",
|
||||
"compliant",
|
||||
"fiat",
|
||||
"cash",
|
||||
"gru"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "tokenized-fiat",
|
||||
"instrument": "emoney-or-fiat-backed-stablecoin",
|
||||
"currency": "CAD",
|
||||
"settlement": "fiat",
|
||||
"cashLike": true,
|
||||
"backing": "cash,cash-equivalents",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cCADC",
|
||||
"x402Ready": false,
|
||||
"fwdCanon": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x290E52a8819A4fbD0714E517225429aA2B70EC6b",
|
||||
"name": "Gold (Compliant)",
|
||||
"symbol": "cXAUC",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://explorer.d-bis.org/token-icons/cXAUC.png",
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gru",
|
||||
"commodity"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "commodity-token",
|
||||
"instrument": "commodity-referenced-token",
|
||||
"settlement": "commodity",
|
||||
"cashLike": false,
|
||||
"backing": "commodity-reserves",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cXAUC",
|
||||
"walletClass": "token",
|
||||
"commodity": "gold",
|
||||
"unit": "troy_ounce"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x94e408E26c6FD8F4ee00b54dF19082FDA07dC96E",
|
||||
"name": "Tether XAU (Compliant)",
|
||||
"symbol": "cXAUT",
|
||||
"decimals": 6,
|
||||
"logoURI": "https://explorer.d-bis.org/token-icons/cXAUT.png",
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gru",
|
||||
"commodity"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "commodity-token",
|
||||
"instrument": "commodity-referenced-token",
|
||||
"settlement": "commodity",
|
||||
"cashLike": false,
|
||||
"backing": "commodity-reserves",
|
||||
"gruVersion": "v1",
|
||||
"gruFamily": "cXAUT",
|
||||
"walletClass": "token",
|
||||
"commodity": "gold",
|
||||
"unit": "troy_ounce"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xF8e9802a1766422e33a269556AD5fC032338EeFc",
|
||||
"name": "Ethereum Mainnet Gas (Compliant)",
|
||||
"symbol": "cETH",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x18A6B163d255cC0Cb32B99697843b487D059907d",
|
||||
"name": "Ethereum L2 Gas (Compliant)",
|
||||
"symbol": "cETHL2",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x94517875f32680984a5921DA7abf78E22f65d70F",
|
||||
"name": "BNB Gas (Compliant)",
|
||||
"symbol": "cBNB",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/smartchain/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x19fec21eDedE9EdB91D1FbeC7C4095C5Ac1FC10c",
|
||||
"name": "Polygon Gas (Compliant)",
|
||||
"symbol": "cPOL",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x9c8f6F4fe1e535e6F85a78Ee95249deD5540A2D0",
|
||||
"name": "Avalanche Gas (Compliant)",
|
||||
"symbol": "cAVAX",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xFb48bb6c623571F9795B535B73f0D660E8643fd4",
|
||||
"name": "Cronos Gas (Compliant)",
|
||||
"symbol": "cCRO",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cronos/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0xA39A59138F8a45b4a31455875b8A29FF31E76Ec8",
|
||||
"name": "Gnosis Gas (Compliant)",
|
||||
"symbol": "cXDAI",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/xdai/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x1814661DAE0933Bf397b1274f5a62411B94195C7",
|
||||
"name": "Celo Gas (Compliant)",
|
||||
"symbol": "cCELO",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/celo/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chainId": 138,
|
||||
"address": "0x4D82206BeC5B4Dfa17759FFEDE07E35f4f63a050",
|
||||
"name": "Wemix Gas (Compliant)",
|
||||
"symbol": "cWEMIX",
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/wemix/info/logo.png",
|
||||
"decimals": 18,
|
||||
"tags": [
|
||||
"defi",
|
||||
"compliant",
|
||||
"gasnative"
|
||||
],
|
||||
"extensions": {
|
||||
"category": "wrapped-native",
|
||||
"instrument": "wrapped-native",
|
||||
"settlement": "crypto-native",
|
||||
"cashLike": false,
|
||||
"backing": "native-gas-asset"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tags": {
|
||||
"defi": {
|
||||
"name": "DeFi",
|
||||
"description": "Decentralized Finance tokens"
|
||||
},
|
||||
"wrapped": {
|
||||
"name": "Wrapped",
|
||||
"description": "Wrapped tokens representing assets"
|
||||
},
|
||||
"stablecoin": {
|
||||
"name": "Stablecoin",
|
||||
"description": "Stable value tokens pegged to fiat"
|
||||
},
|
||||
"compliant": {
|
||||
"name": "Compliant",
|
||||
"description": "Regulatory compliant assets"
|
||||
},
|
||||
"fiat": {
|
||||
"name": "Fiat",
|
||||
"description": "Fiat referenced tokens"
|
||||
},
|
||||
"cash": {
|
||||
"name": "Cashlike",
|
||||
"description": "Cash reserve or cash rail assets"
|
||||
},
|
||||
"gru": {
|
||||
"name": "GRU",
|
||||
"description": "GRU transport assets"
|
||||
},
|
||||
"commodity": {
|
||||
"name": "Commodity",
|
||||
"description": "Commodity referenced tokens"
|
||||
},
|
||||
"oracle": {
|
||||
"name": "Oracle",
|
||||
"description": "Oracle price feed tokens"
|
||||
},
|
||||
"pricefeed": {
|
||||
"name": "Price Feed",
|
||||
"description": "Price feed oracle contracts"
|
||||
},
|
||||
"ccip": {
|
||||
"name": "CCIP",
|
||||
"description": "Cross Chain Interoperability Protocol tokens"
|
||||
},
|
||||
"v2": {
|
||||
"name": "Version 2",
|
||||
"description": "Next generation GRU token contracts"
|
||||
},
|
||||
"x402": {
|
||||
"name": "x402 Ready",
|
||||
"description": "Permit or authorization capable payment tokens"
|
||||
},
|
||||
"fwdcanon": {
|
||||
"name": "Forward canonical",
|
||||
"description": "GRU v2 forward canonical token variant"
|
||||
},
|
||||
"gasnative": {
|
||||
"name": "Gas native",
|
||||
"description": "Gas native compliant families and wrapped gas mirrors"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
dist/ramps/index.d.ts
vendored
18
dist/ramps/index.d.ts
vendored
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Ramps module - fiat on/off-ramp integrations
|
||||
*/
|
||||
export * from './types';
|
||||
export * from './provider.interface';
|
||||
export * from './ramp-factory.service';
|
||||
export { default as rampRoutes } from './ramp.routes';
|
||||
export { MoonPayProvider } from './providers/moonpay';
|
||||
export { RampNetworkProvider } from './providers/ramp-network';
|
||||
export { OnramperProvider } from './providers/onramper';
|
||||
export { TransakProvider } from './providers/transak';
|
||||
export { BanxaProvider } from './providers/banxa';
|
||||
export { CoinbaseRampsProvider } from './providers/coinbase-ramps';
|
||||
export { StripeCryptoProvider } from './providers/stripe-crypto';
|
||||
export { CybridProvider } from './providers/cybrid';
|
||||
export { SardineProvider } from './providers/sardine';
|
||||
export { HoneyCoinProvider } from './providers/honeycoin';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dist/ramps/index.d.ts.map
vendored
1
dist/ramps/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ramps/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
||||
49
dist/ramps/index.js
vendored
49
dist/ramps/index.js
vendored
@@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Ramps module - fiat on/off-ramp integrations
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HoneyCoinProvider = exports.SardineProvider = exports.CybridProvider = exports.StripeCryptoProvider = exports.CoinbaseRampsProvider = exports.BanxaProvider = exports.TransakProvider = exports.OnramperProvider = exports.RampNetworkProvider = exports.MoonPayProvider = exports.rampRoutes = void 0;
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./provider.interface"), exports);
|
||||
__exportStar(require("./ramp-factory.service"), exports);
|
||||
var ramp_routes_1 = require("./ramp.routes");
|
||||
Object.defineProperty(exports, "rampRoutes", { enumerable: true, get: function () { return __importDefault(ramp_routes_1).default; } });
|
||||
var moonpay_1 = require("./providers/moonpay");
|
||||
Object.defineProperty(exports, "MoonPayProvider", { enumerable: true, get: function () { return moonpay_1.MoonPayProvider; } });
|
||||
var ramp_network_1 = require("./providers/ramp-network");
|
||||
Object.defineProperty(exports, "RampNetworkProvider", { enumerable: true, get: function () { return ramp_network_1.RampNetworkProvider; } });
|
||||
var onramper_1 = require("./providers/onramper");
|
||||
Object.defineProperty(exports, "OnramperProvider", { enumerable: true, get: function () { return onramper_1.OnramperProvider; } });
|
||||
var transak_1 = require("./providers/transak");
|
||||
Object.defineProperty(exports, "TransakProvider", { enumerable: true, get: function () { return transak_1.TransakProvider; } });
|
||||
var banxa_1 = require("./providers/banxa");
|
||||
Object.defineProperty(exports, "BanxaProvider", { enumerable: true, get: function () { return banxa_1.BanxaProvider; } });
|
||||
var coinbase_ramps_1 = require("./providers/coinbase-ramps");
|
||||
Object.defineProperty(exports, "CoinbaseRampsProvider", { enumerable: true, get: function () { return coinbase_ramps_1.CoinbaseRampsProvider; } });
|
||||
var stripe_crypto_1 = require("./providers/stripe-crypto");
|
||||
Object.defineProperty(exports, "StripeCryptoProvider", { enumerable: true, get: function () { return stripe_crypto_1.StripeCryptoProvider; } });
|
||||
var cybrid_1 = require("./providers/cybrid");
|
||||
Object.defineProperty(exports, "CybridProvider", { enumerable: true, get: function () { return cybrid_1.CybridProvider; } });
|
||||
var sardine_1 = require("./providers/sardine");
|
||||
Object.defineProperty(exports, "SardineProvider", { enumerable: true, get: function () { return sardine_1.SardineProvider; } });
|
||||
var honeycoin_1 = require("./providers/honeycoin");
|
||||
Object.defineProperty(exports, "HoneyCoinProvider", { enumerable: true, get: function () { return honeycoin_1.HoneyCoinProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/index.js.map
vendored
1
dist/ramps/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ramps/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,uDAAqC;AACrC,yDAAuC;AACvC,6CAAsD;AAA7C,0HAAA,OAAO,OAAc;AAC9B,+CAAsD;AAA7C,0GAAA,eAAe,OAAA;AACxB,yDAA+D;AAAtD,mHAAA,mBAAmB,OAAA;AAC5B,iDAAwD;AAA/C,4GAAA,gBAAgB,OAAA;AACzB,+CAAsD;AAA7C,0GAAA,eAAe,OAAA;AACxB,2CAAkD;AAAzC,sGAAA,aAAa,OAAA;AACtB,6DAAmE;AAA1D,uHAAA,qBAAqB,OAAA;AAC9B,2DAAiE;AAAxD,qHAAA,oBAAoB,OAAA;AAC7B,6CAAoD;AAA3C,wGAAA,cAAc,OAAA;AACvB,+CAAsD;AAA7C,0GAAA,eAAe,OAAA;AACxB,mDAA0D;AAAjD,8GAAA,iBAAiB,OAAA"}
|
||||
21
dist/ramps/provider.interface.d.ts
vendored
21
dist/ramps/provider.interface.d.ts
vendored
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* Ramp provider interfaces for fiat on/off-ramp integrations
|
||||
*/
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampQuoteParams, RampSession, RampQuote, ProviderCapabilities } from './types';
|
||||
export interface IOnRampProvider {
|
||||
readonly id: string;
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
export interface IOffRampProvider {
|
||||
readonly id: string;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
export interface IRampQuoteProvider {
|
||||
readonly id: string;
|
||||
getQuote(params: RampQuoteParams): Promise<RampQuote | null>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
export type RampProvider = IOnRampProvider | IOffRampProvider | IRampQuoteProvider;
|
||||
//# sourceMappingURL=provider.interface.d.ts.map
|
||||
1
dist/ramps/provider.interface.d.ts.map
vendored
1
dist/ramps/provider.interface.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"provider.interface.d.ts","sourceRoot":"","sources":["../../src/ramps/provider.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,SAAS,EACT,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACjE,eAAe,IAAI,oBAAoB,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACxE,eAAe,IAAI,oBAAoB,CAAC;CACzC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC7D,eAAe,IAAI,oBAAoB,CAAC;CACzC;AAED,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,gBAAgB,GAAG,kBAAkB,CAAC"}
|
||||
6
dist/ramps/provider.interface.js
vendored
6
dist/ramps/provider.interface.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Ramp provider interfaces for fiat on/off-ramp integrations
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=provider.interface.js.map
|
||||
1
dist/ramps/provider.interface.js.map
vendored
1
dist/ramps/provider.interface.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"provider.interface.js","sourceRoot":"","sources":["../../src/ramps/provider.interface.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
||||
20
dist/ramps/providers/banxa/banxa.provider.d.ts
vendored
20
dist/ramps/providers/banxa/banxa.provider.d.ts
vendored
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Banxa on-ramp and off-ramp provider
|
||||
* Docs: https://docs.banxa.com
|
||||
*/
|
||||
import type { IOnRampProvider, IOffRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class BanxaProvider implements IOnRampProvider, IOffRampProvider {
|
||||
readonly id = "banxa";
|
||||
private apiKey;
|
||||
private baseUrl;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
baseUrl?: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
private chainToBlockchain;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=banxa.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"banxa.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/banxa/banxa.provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhH,qBAAa,aAAc,YAAW,eAAe,EAAE,gBAAgB;IACrE,QAAQ,CAAC,EAAE,WAAW;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAuB;gBAE1B,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKlD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAehE,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAc7E,OAAO,CAAC,iBAAiB;IAKzB,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
64
dist/ramps/providers/banxa/banxa.provider.js
vendored
64
dist/ramps/providers/banxa/banxa.provider.js
vendored
@@ -1,64 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Banxa on-ramp and off-ramp provider
|
||||
* Docs: https://docs.banxa.com
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BanxaProvider = void 0;
|
||||
class BanxaProvider {
|
||||
constructor(config) {
|
||||
this.id = 'banxa';
|
||||
this.baseUrl = 'https://banxa.com';
|
||||
this.apiKey = config.apiKey;
|
||||
if (config.baseUrl)
|
||||
this.baseUrl = config.baseUrl;
|
||||
}
|
||||
async createSession(params) {
|
||||
const search = new URLSearchParams({
|
||||
coinType: params.cryptoCurrency.toUpperCase(),
|
||||
fiatType: params.fiatCurrency.toUpperCase(),
|
||||
fiatAmount: params.amount,
|
||||
blockchains: this.chainToBlockchain(params.chainId),
|
||||
walletAddress: params.walletAddress,
|
||||
});
|
||||
if (params.redirectUrl)
|
||||
search.set('returnUrl', params.redirectUrl);
|
||||
if (params.email)
|
||||
search.set('email', params.email);
|
||||
const url = this.baseUrl + '/app/buy?' + search.toString();
|
||||
const sessionId = 'bx-' + Date.now() + '-' + Math.random().toString(36).slice(2, 10);
|
||||
return { url, sessionId, expiresAt: new Date(Date.now() + 30 * 60 * 1000), provider: this.id };
|
||||
}
|
||||
async createPayoutSession(params) {
|
||||
const search = new URLSearchParams({
|
||||
coinType: params.cryptoCurrency.toUpperCase(),
|
||||
fiatType: params.fiatCurrency.toUpperCase(),
|
||||
cryptoAmount: params.amount,
|
||||
blockchains: this.chainToBlockchain(params.chainId),
|
||||
walletAddress: params.walletAddress,
|
||||
});
|
||||
if (params.redirectUrl)
|
||||
search.set('returnUrl', params.redirectUrl);
|
||||
const url = this.baseUrl + '/app/sell?' + search.toString();
|
||||
const sessionId = 'bx-sell-' + Date.now() + '-' + Math.random().toString(36).slice(2, 10);
|
||||
return { url, sessionId, expiresAt: new Date(Date.now() + 30 * 60 * 1000), provider: this.id };
|
||||
}
|
||||
chainToBlockchain(chainId) {
|
||||
const map = { 1: 'ETH', 137: 'MATIC', 56: 'BNB', 42161: 'ARBITRUM', 10: 'OPTIMISM' };
|
||||
return chainId ? (map[chainId] ?? 'ETH') : 'ETH';
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Banxa',
|
||||
onRamp: true,
|
||||
offRamp: true,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137, 56, 42161, 10],
|
||||
supportedFiatCurrencies: ['usd', 'eur', 'gbp', 'aud'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt', 'matic', 'bnb'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.BanxaProvider = BanxaProvider;
|
||||
//# sourceMappingURL=banxa.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"banxa.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/banxa/banxa.provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAa,aAAa;IAKxB,YAAY,MAA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AAC,KAAK,CAAC;IACnD,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;YACxC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;YACrD,yBAAyB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;SAC1E,CAAC;IACJ,CAAC;CACF;AAxDD,sCAwDC"}
|
||||
2
dist/ramps/providers/banxa/index.d.ts
vendored
2
dist/ramps/providers/banxa/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { BanxaProvider } from './banxa.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dist/ramps/providers/banxa/index.d.ts.map
vendored
1
dist/ramps/providers/banxa/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/banxa/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
||||
6
dist/ramps/providers/banxa/index.js
vendored
6
dist/ramps/providers/banxa/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BanxaProvider = void 0;
|
||||
var banxa_provider_1 = require("./banxa.provider");
|
||||
Object.defineProperty(exports, "BanxaProvider", { enumerable: true, get: function () { return banxa_provider_1.BanxaProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/banxa/index.js.map
vendored
1
dist/ramps/providers/banxa/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/banxa/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Coinbase Onramp and Offramp provider
|
||||
* Creates hosted widget URL sessions via Coinbase CDP
|
||||
*/
|
||||
import type { IOnRampProvider, IOffRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class CoinbaseRampsProvider implements IOnRampProvider, IOffRampProvider {
|
||||
readonly id = "coinbase-ramps";
|
||||
private appId;
|
||||
constructor(config: {
|
||||
appId: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=coinbase-ramps.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"coinbase-ramps.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/coinbase-ramps/coinbase-ramps.provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKhH,qBAAa,qBAAsB,YAAW,eAAe,EAAE,gBAAgB;IAC7E,QAAQ,CAAC,EAAE,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAI/B,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBhE,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuB7E,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
@@ -1,73 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Coinbase Onramp and Offramp provider
|
||||
* Creates hosted widget URL sessions via Coinbase CDP
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoinbaseRampsProvider = void 0;
|
||||
const COINBASE_ONRAMP_URL = 'https://pay.coinbase.com/buy/select-asset';
|
||||
const COINBASE_OFFRAMP_URL = 'https://pay.coinbase.com/sell/select-asset';
|
||||
class CoinbaseRampsProvider {
|
||||
constructor(config) {
|
||||
this.id = 'coinbase-ramps';
|
||||
this.appId = config.appId;
|
||||
}
|
||||
async createSession(params) {
|
||||
const addrs = { [params.cryptoCurrency]: params.walletAddress };
|
||||
const search = new URLSearchParams({
|
||||
appId: this.appId,
|
||||
addresses: JSON.stringify(addrs),
|
||||
assets: params.cryptoCurrency.toUpperCase(),
|
||||
fiatCurrency: params.fiatCurrency,
|
||||
presetFiatAmount: params.amount,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('network', String(params.chainId));
|
||||
if (params.redirectUrl)
|
||||
search.set('redirectUrl', params.redirectUrl);
|
||||
const url = `${COINBASE_ONRAMP_URL}?${search.toString()}`;
|
||||
const sessionId = `cb-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
async createPayoutSession(params) {
|
||||
const addrs = { [params.cryptoCurrency]: params.walletAddress };
|
||||
const search = new URLSearchParams({
|
||||
appId: this.appId,
|
||||
addresses: JSON.stringify(addrs),
|
||||
assets: params.cryptoCurrency.toUpperCase(),
|
||||
fiatCurrency: params.fiatCurrency,
|
||||
presetCryptoAmount: params.amount,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('network', String(params.chainId));
|
||||
if (params.redirectUrl)
|
||||
search.set('redirectUrl', params.redirectUrl);
|
||||
const url = `${COINBASE_OFFRAMP_URL}?${search.toString()}`;
|
||||
const sessionId = `cb-sell-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Coinbase Ramps',
|
||||
onRamp: true,
|
||||
offRamp: true,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137, 42161, 10, 8453],
|
||||
supportedFiatCurrencies: ['usd', 'eur', 'gbp'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.CoinbaseRampsProvider = CoinbaseRampsProvider;
|
||||
//# sourceMappingURL=coinbase-ramps.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"coinbase-ramps.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/coinbase-ramps/coinbase-ramps.provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAM,mBAAmB,GAAG,2CAA2C,CAAC;AACxE,MAAM,oBAAoB,GAAG,4CAA4C,CAAC;AAE1E,MAAa,qBAAqB;IAIhC,YAAY,MAAyB;QAH5B,OAAE,GAAG,gBAAgB,CAAC;QAI7B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,KAAK,GAA2B,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;QACxF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SA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+0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/coinbase-ramps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
|
||||
6
dist/ramps/providers/coinbase-ramps/index.js
vendored
6
dist/ramps/providers/coinbase-ramps/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoinbaseRampsProvider = void 0;
|
||||
var coinbase_ramps_provider_1 = require("./coinbase-ramps.provider");
|
||||
Object.defineProperty(exports, "CoinbaseRampsProvider", { enumerable: true, get: function () { return coinbase_ramps_provider_1.CoinbaseRampsProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/coinbase-ramps/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA"}
|
||||
20
dist/ramps/providers/cybrid/cybrid.provider.d.ts
vendored
20
dist/ramps/providers/cybrid/cybrid.provider.d.ts
vendored
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Cybrid fiat↔crypto on/off-ramp provider
|
||||
* Full embedded platform API
|
||||
* Docs: https://cybrid.xyz
|
||||
*/
|
||||
import type { IOnRampProvider, IOffRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class CybridProvider implements IOnRampProvider, IOffRampProvider {
|
||||
readonly id = "cybrid";
|
||||
private apiKey;
|
||||
private baseUrl;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
baseUrl?: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=cybrid.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"cybrid.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/cybrid/cybrid.provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhH,qBAAa,cAAe,YAAW,eAAe,EAAE,gBAAgB;IACtE,QAAQ,CAAC,EAAE,YAAY;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKlD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAqChE,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAsC7E,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
98
dist/ramps/providers/cybrid/cybrid.provider.js
vendored
98
dist/ramps/providers/cybrid/cybrid.provider.js
vendored
@@ -1,98 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Cybrid fiat↔crypto on/off-ramp provider
|
||||
* Full embedded platform API
|
||||
* Docs: https://cybrid.xyz
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CybridProvider = void 0;
|
||||
class CybridProvider {
|
||||
constructor(config) {
|
||||
this.id = 'cybrid';
|
||||
this.apiKey = config.apiKey;
|
||||
this.baseUrl = config.baseUrl ?? 'https://api.cybrid.xyz';
|
||||
}
|
||||
async createSession(params) {
|
||||
try {
|
||||
const res = await fetch(`${this.baseUrl}/api/transfer_bank_links`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${this.apiKey}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
transfer_destination_address: params.walletAddress,
|
||||
asset: params.cryptoCurrency.toUpperCase(),
|
||||
amount: params.amount,
|
||||
currency: params.fiatCurrency,
|
||||
redirect_url: params.redirectUrl,
|
||||
}),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.text();
|
||||
throw new Error(`Cybrid API error: ${res.status} ${err}`);
|
||||
}
|
||||
const data = (await res.json());
|
||||
const url = data.url ?? `${this.baseUrl}/platform?link=${data.guid}`;
|
||||
const sessionId = `cybrid-${data.guid ?? Date.now()}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Cybrid on-ramp failed: ${err.message}`);
|
||||
}
|
||||
}
|
||||
async createPayoutSession(params) {
|
||||
try {
|
||||
const res = await fetch(`${this.baseUrl}/api/transfer_bank_links`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${this.apiKey}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
transfer_source_address: params.walletAddress,
|
||||
asset: params.cryptoCurrency.toUpperCase(),
|
||||
amount: params.amount,
|
||||
currency: params.fiatCurrency,
|
||||
destination_account: params.destinationAccount,
|
||||
redirect_url: params.redirectUrl,
|
||||
}),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.text();
|
||||
throw new Error(`Cybrid API error: ${res.status} ${err}`);
|
||||
}
|
||||
const data = (await res.json());
|
||||
const url = data.url ?? `${this.baseUrl}/platform/sell?link=${data.guid}`;
|
||||
const sessionId = `cybrid-sell-${data.guid ?? Date.now()}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Cybrid off-ramp failed: ${err.message}`);
|
||||
}
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Cybrid',
|
||||
onRamp: true,
|
||||
offRamp: true,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137],
|
||||
supportedFiatCurrencies: ['usd', 'eur', 'cad'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.CybridProvider = CybridProvider;
|
||||
//# sourceMappingURL=cybrid.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"cybrid.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/cybrid/cybrid.provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAKH,MAAa,cAAc;IAKzB,YAAY,MAA4C;QAJ/C,OAAE,GAAG,QAAQ,CAAC;QAKrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,wBAAwB,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,0BAA0B,EAAE;gBACjE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;oBACxC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,4BAA4B,EAAE,MAAM,CAAC,aAAa;oBAClD,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE;oBAC1C,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,QAAQ,EAA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AAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;YACzB,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;YAC9C,yBAAyB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;SAC1D,CAAC;IACJ,CAAC;CACF;AAjGD,wCAiGC"}
|
||||
2
dist/ramps/providers/cybrid/index.d.ts
vendored
2
dist/ramps/providers/cybrid/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { CybridProvider } from './cybrid.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dist/ramps/providers/cybrid/index.d.ts.map
vendored
1
dist/ramps/providers/cybrid/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/cybrid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
||||
6
dist/ramps/providers/cybrid/index.js
vendored
6
dist/ramps/providers/cybrid/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CybridProvider = void 0;
|
||||
var cybrid_provider_1 = require("./cybrid.provider");
|
||||
Object.defineProperty(exports, "CybridProvider", { enumerable: true, get: function () { return cybrid_provider_1.CybridProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/cybrid/index.js.map
vendored
1
dist/ramps/providers/cybrid/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/cybrid/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* HoneyCoin Offramps provider (off-ramp focused)
|
||||
* Stablecoins to bank/mobile money - docs.honeycoin.app
|
||||
*/
|
||||
import type { IOffRampProvider } from '../../provider.interface';
|
||||
import type { OffRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class HoneyCoinProvider implements IOffRampProvider {
|
||||
readonly id = "honeycoin";
|
||||
private apiKey;
|
||||
private baseUrl;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
baseUrl?: string;
|
||||
});
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=honeycoin.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"honeycoin.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/honeycoin/honeycoin.provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAa,iBAAkB,YAAW,gBAAgB;IACxD,QAAQ,CAAC,EAAE,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA+B;gBAElC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKlD,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuC7E,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
@@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* HoneyCoin Offramps provider (off-ramp focused)
|
||||
* Stablecoins to bank/mobile money - docs.honeycoin.app
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HoneyCoinProvider = void 0;
|
||||
class HoneyCoinProvider {
|
||||
constructor(config) {
|
||||
this.id = 'honeycoin';
|
||||
this.baseUrl = 'https://api.honeycoin.app';
|
||||
this.apiKey = config.apiKey;
|
||||
if (config.baseUrl)
|
||||
this.baseUrl = config.baseUrl;
|
||||
}
|
||||
async createPayoutSession(params) {
|
||||
try {
|
||||
const res = await fetch(`${this.baseUrl}/v1/offramp/sessions`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.apiKey}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
source_address: params.walletAddress,
|
||||
amount: params.amount,
|
||||
asset: params.cryptoCurrency,
|
||||
fiat_currency: params.fiatCurrency,
|
||||
destination_account: params.destinationAccount,
|
||||
chain_id: params.chainId ?? 1,
|
||||
redirect_url: params.redirectUrl,
|
||||
}),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.text();
|
||||
throw new Error(`HoneyCoin API error: ${res.status} ${err}`);
|
||||
}
|
||||
const data = (await res.json());
|
||||
const url = data.checkout_url ?? `${this.baseUrl}/checkout/${data.session_id}`;
|
||||
const sessionId = `honeycoin-${data.session_id ?? Date.now()}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 60 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`HoneyCoin off-ramp failed: ${err.message}`);
|
||||
}
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'HoneyCoin',
|
||||
onRamp: false,
|
||||
offRamp: true,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137],
|
||||
supportedFiatCurrencies: ['usd', 'eur'],
|
||||
supportedCryptoCurrencies: ['usdc', 'usdt'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.HoneyCoinProvider = HoneyCoinProvider;
|
||||
//# sourceMappingURL=honeycoin.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"honeycoin.provider.js","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CAAmD,CAAC;YAClF,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/E,MAAM,SAAS,GAAG,aAAa,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAE/D,OAAO;gBACL,GAAG;gBACH,SAAS;gBACT,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;gBAChD,QAAQ,EAAE,IAAI,CAAC,EAAE;aAClB,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,8BAA+B,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;YACzB,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YACvC,yBAAyB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;SAC5C,CAAC;IACJ,CAAC;CACF;AA7DD,8CA6DC"}
|
||||
2
dist/ramps/providers/honeycoin/index.d.ts
vendored
2
dist/ramps/providers/honeycoin/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { HoneyCoinProvider } from './honeycoin.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/honeycoin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
|
||||
6
dist/ramps/providers/honeycoin/index.js
vendored
6
dist/ramps/providers/honeycoin/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HoneyCoinProvider = void 0;
|
||||
var honeycoin_provider_1 = require("./honeycoin.provider");
|
||||
Object.defineProperty(exports, "HoneyCoinProvider", { enumerable: true, get: function () { return honeycoin_provider_1.HoneyCoinProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/honeycoin/index.js.map
vendored
1
dist/ramps/providers/honeycoin/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/honeycoin/index.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA"}
|
||||
2
dist/ramps/providers/moonpay/index.d.ts
vendored
2
dist/ramps/providers/moonpay/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { MoonPayProvider } from './moonpay.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dist/ramps/providers/moonpay/index.d.ts.map
vendored
1
dist/ramps/providers/moonpay/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/moonpay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
||||
6
dist/ramps/providers/moonpay/index.js
vendored
6
dist/ramps/providers/moonpay/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MoonPayProvider = void 0;
|
||||
var moonpay_provider_1 = require("./moonpay.provider");
|
||||
Object.defineProperty(exports, "MoonPayProvider", { enumerable: true, get: function () { return moonpay_provider_1.MoonPayProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/moonpay/index.js.map
vendored
1
dist/ramps/providers/moonpay/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/moonpay/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* MoonPay on-ramp and off-ramp provider
|
||||
* Creates buy/sell URLs for the MoonPay widget
|
||||
* Docs: https://developers.moonpay.com
|
||||
*/
|
||||
import type { IOnRampProvider, IOffRampProvider, IRampQuoteProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampQuoteParams, RampSession, RampQuote, ProviderCapabilities } from '../../types';
|
||||
export declare class MoonPayProvider implements IOnRampProvider, IOffRampProvider, IRampQuoteProvider {
|
||||
readonly id = "moonpay";
|
||||
private apiKey;
|
||||
private baseUrl;
|
||||
private sellBaseUrl;
|
||||
private apiBaseUrl;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
baseUrl?: string;
|
||||
sellBaseUrl?: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
getQuote(params: RampQuoteParams): Promise<RampQuote | null>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=moonpay.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"moonpay.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/moonpay/moonpay.provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,SAAS,EACT,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAuBrB,qBAAa,eAAgB,YAAW,eAAe,EAAE,gBAAgB,EAAE,kBAAkB;IAC3F,QAAQ,CAAC,EAAE,aAAa;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,UAAU,CAA6B;gBAEnC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAMxE,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBhE,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBvE,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAwBlE,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
126
dist/ramps/providers/moonpay/moonpay.provider.js
vendored
126
dist/ramps/providers/moonpay/moonpay.provider.js
vendored
@@ -1,126 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* MoonPay on-ramp and off-ramp provider
|
||||
* Creates buy/sell URLs for the MoonPay widget
|
||||
* Docs: https://developers.moonpay.com
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MoonPayProvider = void 0;
|
||||
const MAP_CRYPTO = {
|
||||
eth: 'eth',
|
||||
ethereum: 'eth',
|
||||
btc: 'btc',
|
||||
bitcoin: 'btc',
|
||||
usdc: 'usdc_ethereum',
|
||||
usdt: 'usdt_ethereum',
|
||||
matic: 'matic_polygon',
|
||||
polygon: 'matic_polygon',
|
||||
bnb: 'bnb_bsc',
|
||||
};
|
||||
function toMoonPayCryptoCode(crypto, chainId) {
|
||||
const lower = crypto.toLowerCase();
|
||||
if (MAP_CRYPTO[lower])
|
||||
return MAP_CRYPTO[lower];
|
||||
if (chainId === 1)
|
||||
return `${lower}_ethereum`;
|
||||
if (chainId === 137)
|
||||
return `${lower}_polygon`;
|
||||
if (chainId === 56)
|
||||
return `${lower}_bsc`;
|
||||
return lower;
|
||||
}
|
||||
class MoonPayProvider {
|
||||
constructor(config) {
|
||||
this.id = 'moonpay';
|
||||
this.baseUrl = 'https://buy.moonpay.com';
|
||||
this.sellBaseUrl = 'https://sell.moonpay.com';
|
||||
this.apiBaseUrl = 'https://api.moonpay.com';
|
||||
this.apiKey = config.apiKey;
|
||||
if (config.baseUrl)
|
||||
this.baseUrl = config.baseUrl;
|
||||
if (config.sellBaseUrl)
|
||||
this.sellBaseUrl = config.sellBaseUrl;
|
||||
}
|
||||
async createSession(params) {
|
||||
const currencyCode = toMoonPayCryptoCode(params.cryptoCurrency, params.chainId);
|
||||
const search = new URLSearchParams({
|
||||
apiKey: this.apiKey,
|
||||
walletAddress: params.walletAddress,
|
||||
currencyCode,
|
||||
baseCurrencyCode: params.fiatCurrency.toLowerCase(),
|
||||
baseCurrencyAmount: params.amount,
|
||||
});
|
||||
if (params.redirectUrl)
|
||||
search.set('redirectURL', params.redirectUrl);
|
||||
if (params.email)
|
||||
search.set('email', params.email);
|
||||
const url = `${this.baseUrl}?${search.toString()}`;
|
||||
const sessionId = `mp-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
async createPayoutSession(params) {
|
||||
const currencyCode = toMoonPayCryptoCode(params.cryptoCurrency, params.chainId);
|
||||
const search = new URLSearchParams({
|
||||
apiKey: this.apiKey,
|
||||
walletAddress: params.walletAddress,
|
||||
currencyCode,
|
||||
baseCurrencyCode: params.fiatCurrency.toLowerCase(),
|
||||
baseCurrencyAmount: params.amount,
|
||||
});
|
||||
if (params.redirectUrl)
|
||||
search.set('redirectURL', params.redirectUrl);
|
||||
if (params.destinationAccount)
|
||||
search.set('payoutAddress', params.destinationAccount);
|
||||
const url = `${this.sellBaseUrl}?${search.toString()}`;
|
||||
const sessionId = `mp-sell-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
async getQuote(params) {
|
||||
try {
|
||||
const currencyCode = toMoonPayCryptoCode(params.cryptoCurrency, params.chainId);
|
||||
const url = `${this.apiBaseUrl}/v3/currencies/${currencyCode}/buy_quote?apiKey=${this.apiKey}&baseCurrencyAmount=${params.amount}&baseCurrencyCode=${params.fiatCurrency.toLowerCase()}`;
|
||||
const res = await fetch(url);
|
||||
if (!res.ok)
|
||||
return null;
|
||||
const data = (await res.json());
|
||||
const estimatedAmount = params.side === 'buy'
|
||||
? String(data.quoteCurrencyAmount ?? 0)
|
||||
: params.amount;
|
||||
const fees = String(data.totalFee ?? 0);
|
||||
return {
|
||||
rate: data.quoteCurrencyAmount ? String(parseFloat(params.amount) / data.quoteCurrencyAmount) : '0',
|
||||
fees,
|
||||
estimatedAmount,
|
||||
provider: this.id,
|
||||
expiresAt: new Date(Date.now() + 5 * 60 * 1000),
|
||||
};
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'MoonPay',
|
||||
onRamp: true,
|
||||
offRamp: true,
|
||||
quoteSupport: true,
|
||||
supportedChains: [1, 137, 56, 42161, 10],
|
||||
supportedFiatCurrencies: ['usd', 'eur', 'gbp'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt', 'matic', 'bnb'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.MoonPayProvider = MoonPayProvider;
|
||||
//# sourceMappingURL=moonpay.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"moonpay.provider.js","sourceRoot":"","s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,0 @@
|
||||
export { OnramperProvider } from './onramper.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dist/ramps/providers/onramper/index.d.ts.map
vendored
1
dist/ramps/providers/onramper/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/onramper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
||||
6
dist/ramps/providers/onramper/index.js
vendored
6
dist/ramps/providers/onramper/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.OnramperProvider = void 0;
|
||||
var onramper_provider_1 = require("./onramper.provider");
|
||||
Object.defineProperty(exports, "OnramperProvider", { enumerable: true, get: function () { return onramper_provider_1.OnramperProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/onramper/index.js.map
vendored
1
dist/ramps/providers/onramper/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/onramper/index.ts"],"names":[],"mappings":";;;AAAA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA"}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Onramper aggregator provider
|
||||
* One API to many ramps - best-rate routing
|
||||
* Docs: https://docs.onramper.com
|
||||
*/
|
||||
import type { IOnRampProvider, IRampQuoteProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, RampQuoteParams, RampSession, RampQuote, ProviderCapabilities } from '../../types';
|
||||
export declare class OnramperProvider implements IOnRampProvider, IRampQuoteProvider {
|
||||
readonly id = "onramper";
|
||||
private apiKey;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
getQuote(params: RampQuoteParams): Promise<RampQuote | null>;
|
||||
private toOnramperCryptoId;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=onramper.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"onramper.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/onramper/onramper.provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,SAAS,EACT,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAIrB,qBAAa,gBAAiB,YAAW,eAAe,EAAE,kBAAkB;IAC1E,QAAQ,CAAC,EAAE,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAIhC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IA0BhE,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAwClE,OAAO,CAAC,kBAAkB;IAqB1B,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
107
dist/ramps/providers/onramper/onramper.provider.js
vendored
107
dist/ramps/providers/onramper/onramper.provider.js
vendored
@@ -1,107 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Onramper aggregator provider
|
||||
* One API to many ramps - best-rate routing
|
||||
* Docs: https://docs.onramper.com
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.OnramperProvider = void 0;
|
||||
const ONRAMPER_API = 'https://api.onramper.com';
|
||||
class OnramperProvider {
|
||||
constructor(config) {
|
||||
this.id = 'onramper';
|
||||
this.apiKey = config.apiKey;
|
||||
}
|
||||
async createSession(params) {
|
||||
const cryptoId = this.toOnramperCryptoId(params.cryptoCurrency, params.chainId);
|
||||
const fiatId = params.fiatCurrency.toUpperCase();
|
||||
const search = new URLSearchParams({
|
||||
apiKey: this.apiKey,
|
||||
mode: 'buy',
|
||||
onlyCryptos: cryptoId,
|
||||
onlyFiats: fiatId,
|
||||
defaultCrypto: cryptoId,
|
||||
defaultFiat: fiatId,
|
||||
defaultAmount: params.amount,
|
||||
wallets: `${params.cryptoCurrency}:${params.walletAddress}`,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('themeName', 'default');
|
||||
const url = `https://buy.onramper.com?${search.toString()}`;
|
||||
const sessionId = `onr-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
async getQuote(params) {
|
||||
try {
|
||||
const cryptoId = this.toOnramperCryptoId(params.cryptoCurrency, params.chainId);
|
||||
const fiatId = params.fiatCurrency.toUpperCase();
|
||||
const amountType = params.side === 'buy' ? 'fiat' : 'crypto';
|
||||
const amount = params.amount;
|
||||
const url = `${ONRAMPER_API}/quotes/${cryptoId}/${fiatId}/${amount}/${amountType}?apiKey=${this.apiKey}`;
|
||||
const res = await fetch(url);
|
||||
if (!res.ok)
|
||||
return null;
|
||||
const data = (await res.json());
|
||||
const estimatedAmount = params.side === 'buy'
|
||||
? String(data.crypto?.amount ?? 0)
|
||||
: String(data.fiat?.amount ?? 0);
|
||||
const fees = String(data.totalFee ?? 0);
|
||||
const rate = data.crypto?.amount && data.fiat?.amount
|
||||
? String(data.fiat.amount / data.crypto.amount)
|
||||
: '0';
|
||||
return {
|
||||
rate,
|
||||
fees,
|
||||
estimatedAmount,
|
||||
provider: this.id,
|
||||
expiresAt: new Date(Date.now() + 5 * 60 * 1000),
|
||||
};
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
toOnramperCryptoId(crypto, chainId) {
|
||||
const lower = crypto.toLowerCase();
|
||||
const map = {
|
||||
eth: 'ETH',
|
||||
ethereum: 'ETH',
|
||||
btc: 'BTC',
|
||||
bitcoin: 'BTC',
|
||||
usdc: 'USDC',
|
||||
usdt: 'USDT',
|
||||
matic: 'MATIC',
|
||||
polygon: 'MATIC',
|
||||
bnb: 'BNB',
|
||||
};
|
||||
const base = map[lower] ?? crypto.toUpperCase();
|
||||
if (chainId === 1)
|
||||
return `${base}_ETH`;
|
||||
if (chainId === 137)
|
||||
return `${base}_MATIC`;
|
||||
if (chainId === 56)
|
||||
return `${base}_BSC`;
|
||||
if (chainId === 42161)
|
||||
return `${base}_ARBITRUM`;
|
||||
return base;
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Onramper',
|
||||
onRamp: true,
|
||||
offRamp: false,
|
||||
quoteSupport: true,
|
||||
supportedChains: [1, 137, 56, 42161, 10, 8453, 43114],
|
||||
supportedFiatCurrencies: ['USD', 'EUR', 'GBP', 'PLN', 'BRL'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt', 'matic', 'bnb', 'avax'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.OnramperProvider = OnramperProvider;
|
||||
//# sourceMappingURL=onramper.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"onramper.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/onramper/onramper.provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAWH,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAa,gBAAgB;IAI3B,YAAY,MAA0B;QAH7B,OAAE,GAAG,UAAU,CAAC;QAIvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAChF,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
dist/ramps/providers/ramp-network/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { RampNetworkProvider } from './ramp-network.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/ramp-network/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
||||
6
dist/ramps/providers/ramp-network/index.js
vendored
6
dist/ramps/providers/ramp-network/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RampNetworkProvider = void 0;
|
||||
var ramp_network_provider_1 = require("./ramp-network.provider");
|
||||
Object.defineProperty(exports, "RampNetworkProvider", { enumerable: true, get: function () { return ramp_network_provider_1.RampNetworkProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/ramp-network/index.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA"}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Ramp Network on-ramp and off-ramp provider
|
||||
* Creates URLs for the Ramp Instant widget
|
||||
* Docs: https://docs.rampnetwork.com
|
||||
*/
|
||||
import type { IOnRampProvider, IOffRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class RampNetworkProvider implements IOnRampProvider, IOffRampProvider {
|
||||
readonly id = "ramp-network";
|
||||
private hostApiKey;
|
||||
private baseUrl;
|
||||
constructor(config: {
|
||||
hostApiKey: string;
|
||||
baseUrl?: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=ramp-network.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ramp-network.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/ramp-network/ramp-network.provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAmBhH,qBAAa,mBAAoB,YAAW,eAAe,EAAE,gBAAgB;IAC3E,QAAQ,CAAC,EAAE,kBAAkB;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAA+C;gBAElD,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKtD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAyBhE,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAwB7E,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
@@ -1,95 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Ramp Network on-ramp and off-ramp provider
|
||||
* Creates URLs for the Ramp Instant widget
|
||||
* Docs: https://docs.rampnetwork.com
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RampNetworkProvider = void 0;
|
||||
const MAP_CRYPTO = {
|
||||
eth: 'ETH',
|
||||
ethereum: 'ETH',
|
||||
btc: 'BTC',
|
||||
bitcoin: 'BTC',
|
||||
usdc: 'USDC',
|
||||
usdt: 'USDT',
|
||||
matic: 'MATIC',
|
||||
polygon: 'POLYGON_MATIC',
|
||||
};
|
||||
function toRampAsset(crypto, chainId) {
|
||||
const lower = crypto.toLowerCase();
|
||||
if (MAP_CRYPTO[lower])
|
||||
return MAP_CRYPTO[lower];
|
||||
return crypto.toUpperCase();
|
||||
}
|
||||
class RampNetworkProvider {
|
||||
constructor(config) {
|
||||
this.id = 'ramp-network';
|
||||
this.baseUrl = 'https://ri-widget-staging.firebaseapp.com';
|
||||
this.hostApiKey = config.hostApiKey;
|
||||
if (config.baseUrl)
|
||||
this.baseUrl = config.baseUrl;
|
||||
}
|
||||
async createSession(params) {
|
||||
const swapAsset = toRampAsset(params.cryptoCurrency, params.chainId);
|
||||
const search = new URLSearchParams({
|
||||
hostApiKey: this.hostApiKey,
|
||||
userAddress: params.walletAddress,
|
||||
swapAsset,
|
||||
swapAmount: params.amount,
|
||||
fiatCurrency: params.fiatCurrency,
|
||||
fiatValue: params.amount,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('network', String(params.chainId));
|
||||
if (params.redirectUrl)
|
||||
search.set('finalUrl', params.redirectUrl);
|
||||
if (params.email)
|
||||
search.set('userEmailAddress', params.email);
|
||||
const url = `${this.baseUrl}/?${search.toString()}`;
|
||||
const sessionId = `rn-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
async createPayoutSession(params) {
|
||||
const swapAsset = toRampAsset(params.cryptoCurrency, params.chainId);
|
||||
const search = new URLSearchParams({
|
||||
hostApiKey: this.hostApiKey,
|
||||
userAddress: params.walletAddress,
|
||||
swapAsset,
|
||||
swapAmount: params.amount,
|
||||
fiatCurrency: params.fiatCurrency,
|
||||
fiatValue: params.amount,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('network', String(params.chainId));
|
||||
if (params.redirectUrl)
|
||||
search.set('finalUrl', params.redirectUrl);
|
||||
const url = `${this.baseUrl}/sell/?${search.toString()}`;
|
||||
const sessionId = `rn-sell-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Ramp Network',
|
||||
onRamp: true,
|
||||
offRamp: true,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137, 56, 42161, 10, 8453],
|
||||
supportedFiatCurrencies: ['usd', 'eur', 'gbp', 'pln'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt', 'matic'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.RampNetworkProvider = RampNetworkProvider;
|
||||
//# sourceMappingURL=ramp-network.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ramp-network.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/ramp-network/ramp-network.provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAKH,MAAM,UAAU,GAA2B;IACzC,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,KAAK;IACf,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,eAAe;CACzB,CAAC;AAEF,SAAS,WAAW,CAAC,MAAc,EAAE,OAAgB;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;AAC9B,CAAC;AAED,MAAa,mBAAmB;IAK9B,YAAY,MAAgD;QAJnD,OAAE,GAAG,cAAc,CAAC;QAErB,YAAO,GAAG,2CAA2C,CAAC;QAG5D,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU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AAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC;YAC9C,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;YACrD,yBAAyB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;SACnE,CAAC;IACJ,CAAC;CACF;AAvED,kDAuEC"}
|
||||
2
dist/ramps/providers/sardine/index.d.ts
vendored
2
dist/ramps/providers/sardine/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { SardineProvider } from './sardine.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dist/ramps/providers/sardine/index.d.ts.map
vendored
1
dist/ramps/providers/sardine/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/sardine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
||||
6
dist/ramps/providers/sardine/index.js
vendored
6
dist/ramps/providers/sardine/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SardineProvider = void 0;
|
||||
var sardine_provider_1 = require("./sardine.provider");
|
||||
Object.defineProperty(exports, "SardineProvider", { enumerable: true, get: function () { return sardine_provider_1.SardineProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/sardine/index.js.map
vendored
1
dist/ramps/providers/sardine/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/sardine/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Sardine Payments Onramp provider (on-ramp focused)
|
||||
*/
|
||||
import type { IOnRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class SardineProvider implements IOnRampProvider {
|
||||
readonly id = "sardine";
|
||||
private apiKey;
|
||||
private baseUrl;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
baseUrl?: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=sardine.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"sardine.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/sardine/sardine.provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE1F,qBAAa,eAAgB,YAAW,eAAe;IACrD,QAAQ,CAAC,EAAE,aAAa;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA4B;gBAE/B,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKlD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBtE,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
49
dist/ramps/providers/sardine/sardine.provider.js
vendored
49
dist/ramps/providers/sardine/sardine.provider.js
vendored
@@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Sardine Payments Onramp provider (on-ramp focused)
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SardineProvider = void 0;
|
||||
class SardineProvider {
|
||||
constructor(config) {
|
||||
this.id = 'sardine';
|
||||
this.baseUrl = 'https://api.sardine.ai';
|
||||
this.apiKey = config.apiKey;
|
||||
if (config.baseUrl)
|
||||
this.baseUrl = config.baseUrl;
|
||||
}
|
||||
async createSession(params) {
|
||||
const res = await fetch(this.baseUrl + '/v1/onramp/orders', {
|
||||
method: 'POST',
|
||||
headers: { Authorization: 'Bearer ' + this.apiKey, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
source_amount: params.amount,
|
||||
source_currency: params.fiatCurrency,
|
||||
destination_currency: params.cryptoCurrency,
|
||||
destination_address: params.walletAddress,
|
||||
chain_id: params.chainId ?? 1,
|
||||
redirect_url: params.redirectUrl,
|
||||
}),
|
||||
});
|
||||
if (!res.ok)
|
||||
throw new Error('Sardine API error: ' + res.status);
|
||||
const data = (await res.json());
|
||||
const url = data.checkout_url ?? this.baseUrl + '/checkout/' + data.order_id;
|
||||
const sessionId = 'sardine-' + (data.order_id ?? Date.now());
|
||||
return { url, sessionId, expiresAt: new Date(Date.now() + 3600000), provider: this.id };
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Sardine Payments',
|
||||
onRamp: true,
|
||||
offRamp: false,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137, 42161],
|
||||
supportedFiatCurrencies: ['usd'],
|
||||
supportedCryptoCurrencies: ['eth', 'usdc', 'usdt'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.SardineProvider = SardineProvider;
|
||||
//# sourceMappingURL=sardine.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"sardine.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/sardine/sardine.provider.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAKH,MAAa,eAAe;IAK1B,YAAY,MAA4C;QAJ/C,OAAE,GAAG,SAAS,CAAC;QAEhB,YAAO,GAAG,wBAAwB,CAAC;QAGzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MA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,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,kBAAkB;YACxB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC;YAChC,uBAAuB,EAAE,CAAC,KAAK,CAAC;YAChC,yBAAyB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;SACnD,CAAC;IACJ,CAAC;CACF;AA1CD,0CA0CC"}
|
||||
@@ -1,2 +0,0 @@
|
||||
export { StripeCryptoProvider } from './stripe-crypto.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/stripe-crypto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
||||
6
dist/ramps/providers/stripe-crypto/index.js
vendored
6
dist/ramps/providers/stripe-crypto/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StripeCryptoProvider = void 0;
|
||||
var stripe_crypto_provider_1 = require("./stripe-crypto.provider");
|
||||
Object.defineProperty(exports, "StripeCryptoProvider", { enumerable: true, get: function () { return stripe_crypto_provider_1.StripeCryptoProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/stripe-crypto/index.ts"],"names":[],"mappings":";;;AAAA,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA"}
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Stripe Crypto Onramp provider (on-ramp only)
|
||||
* Creates on-ramp sessions via Stripe API
|
||||
*/
|
||||
import type { IOnRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class StripeCryptoProvider implements IOnRampProvider {
|
||||
readonly id = "stripe-crypto";
|
||||
private apiKey;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
private chainToNetwork;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=stripe-crypto.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"stripe-crypto.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/stripe-crypto/stripe-crypto.provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE1F,qBAAa,oBAAqB,YAAW,eAAe;IAC1D,QAAQ,CAAC,EAAE,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAIhC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuCtE,OAAO,CAAC,cAAc;IAWtB,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
@@ -1,73 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Stripe Crypto Onramp provider (on-ramp only)
|
||||
* Creates on-ramp sessions via Stripe API
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StripeCryptoProvider = void 0;
|
||||
class StripeCryptoProvider {
|
||||
constructor(config) {
|
||||
this.id = 'stripe-crypto';
|
||||
this.apiKey = config.apiKey;
|
||||
}
|
||||
async createSession(params) {
|
||||
try {
|
||||
const body = new URLSearchParams({
|
||||
'transaction_details[destination_wallet_address]': params.walletAddress,
|
||||
'transaction_details[destination_network]': this.chainToNetwork(params.chainId),
|
||||
'transaction_details[destination_currency]': params.cryptoCurrency.toLowerCase(),
|
||||
'transaction_details[destination_currency_amount]': params.amount,
|
||||
});
|
||||
if (params.email)
|
||||
body.set('customer_information[email]', params.email);
|
||||
const res = await fetch('https://api.stripe.com/v1/crypto/onramp_sessions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.apiKey}`,
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body: body.toString(),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.text();
|
||||
throw new Error(`Stripe API error: ${res.status} ${err}`);
|
||||
}
|
||||
const data = (await res.json());
|
||||
const url = `https://crypto.onramp.stripe.com?client_secret=${data.client_secret ?? ''}`;
|
||||
const sessionId = `stripe-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 60 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Stripe Crypto on-ramp failed: ${err.message}`);
|
||||
}
|
||||
}
|
||||
chainToNetwork(chainId) {
|
||||
const map = {
|
||||
1: 'ethereum',
|
||||
137: 'polygon',
|
||||
42161: 'arbitrum',
|
||||
10: 'optimism',
|
||||
8453: 'base',
|
||||
};
|
||||
return chainId ? (map[chainId] ?? 'ethereum') : 'ethereum';
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Stripe Crypto',
|
||||
onRamp: true,
|
||||
offRamp: false,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137, 42161, 10, 8453],
|
||||
supportedFiatCurrencies: ['usd'],
|
||||
supportedCryptoCurrencies: ['eth', 'usdc', 'usdt'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.StripeCryptoProvider = StripeCryptoProvider;
|
||||
//# sourceMappingURL=stripe-crypto.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"stripe-crypto.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/stripe-crypto/stripe-crypto.provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAa,oBAAoB;IAI/B,YAAY,MAA0B;QAH7B,OAAE,GAAG,eAAe,CAAC;QAI5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC;gBAC/B,iDAAiD,EAAE,MAAM,CAAC,aAAa;gBACvE,0CAA0C,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC/E,2CAA2C,EAAE,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE;gBAChF,kDAAkD,EAAE,MAAM,CAAC,MAAM;aAClE,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,KAAK;gBAAE,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAExE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,kDAAkD,EAAE;gBAC1E,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;oBACtC,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE;aACtB,CAAC,CAAC;YAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACZ,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC;YAC5D,CAAC;YAED,MAAM,IAAI,GAAG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AAK,EAAE,MAAM,EAAE,MAAM,CAAC;SACnD,CAAC;IACJ,CAAC;CACF;AAtED,oDAsEC"}
|
||||
2
dist/ramps/providers/transak/index.d.ts
vendored
2
dist/ramps/providers/transak/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export { TransakProvider } from './transak.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user