chore: gitignore and untrack TypeScript dist/ (pnpm run build)
Made-with: Cursor
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
dist/
|
||||
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,MAA4C;QAJ/C,OAAE,GAAG,OAAO,CAAC;QAEd,YAAO,GAAG,mBAAmB,CAAC;QAGpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,MAAM,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,M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C,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,SAAS,CAAC,KAAK,CAAC;YAChC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE;YAC3C,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,gBAAgB,EAAE,MAAM,CAAC,MAAM;SAChC,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,OAAO;YAAE,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,O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,GAAG,GAAG,oBAAoB,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG,WAAW,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAErF,OAAO;YACL,GAAG;YACH,SAAS;YACT,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YAChD,QAAQ,EAAE,IAAI,CAAC,EAAE;SAClB,CAAC;IACJ,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC;YAC1C,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;AAlED,sDAkEC"}
|
||||
@@ -1,2 +0,0 @@
|
||||
export { CoinbaseRampsProvider } from './coinbase-ramps.provider';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +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,EAAE,MAAM,CAAC,YAAY;oBAC7B,YAAY,EAAE,MAAM,CAAC,WAAW;iBACjC,CAAC;aACH,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,GA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ps/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","sourceRoot":"","sources":["../../../../src/ramps/providers/honeycoin/honeycoin.provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAa,iBAAiB;IAK5B,YAAY,MAA4C;QAJ/C,OAAE,GAAG,WAAW,CAAC;QAElB,YAAO,GAAG,2BAA2B,CAAC;QAG5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,MAAM,C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E,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":"","sources":["../../../../src/ramps/providers/moonpay/moonpay.provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAYH,MAAM,UAAU,GAA2B;IACzC,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,KAAK;IACf,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,eAAe;IACtB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CAAC,CAAC;YAExC,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG;gBACnG,IAAI;gBACJ,eAAe;gBACf,QAAQ,EAAE,IAAI,CAAC,EAAE;gBACjB,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;aAChD,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;YACxC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;YAC9C,yBAAyB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;SAC1E,CAAC;IACJ,CAAC;CACF;AA/FD,0CA+FC"}
|
||||
2
dist/ramps/providers/onramper/index.d.ts
vendored
2
dist/ramps/providers/onramper/index.d.ts
vendored
@@ -1,2 +0,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,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,QAAQ;YACrB,SAAS,EAAE,MAAM;YACjB,aAAa,EAAE,QAAQ;YACvB,WAAW,EAAE,MAAM;YACnB,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YAChB,GAAG,EAAE,KAAK;SACX,CAAC;QACF,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QAChD,IAAI,OAAO,KAAK,CAAC;YAAE,OAAO,GAAG,IAAI,MAAM,CAAC;QACxC,IAAI,OAAO,KAAK,GAAG;YAAE,OAAO,GAAG,IAAI,QAAQ,CAAC;QAC5C,IAAI,OAAO,KAAK,EAAE;YAAE,OAAO,GAAG,IAAI,MAAM,CAAC;QACzC,IAAI,OAAO,KAAK,KAAK;YAAE,OAAO,GAAG,IAAI,WAAW,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC;YACrD,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;YAC5D,yBAAyB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC;SAClF,CAAC;IACJ,CAAC;CACF;AA3GD,4CA2GC"}
|
||||
2
dist/ramps/providers/ramp-network/index.d.ts
vendored
2
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,CAAC;QACpC,IAAI,MAAM,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,IAAI,eAAe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AO,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,MAAM,CAAC;QAC5B,IAAI,MAAM,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,mBAAmB,EAAE;YAC1D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE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BAAyB,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,IA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EAAE,EAAE,CAAC,EAAE,CAAC;YAEpF,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,iCAAkC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,OAAgB;QACrC,MAAM,GAAG,GAA2B;YAClC,CAAC,EAAE,UAAU;YACb,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,UAAU;YACjB,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,MAAM;SACb,CAAC;QACF,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAC7D,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC;YAC1C,uBAAuB,EAAE,CAAC,KAAK,CAAC;YAChC,yBAAyB,EAAE,CAAC,KAAK,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
|
||||
1
dist/ramps/providers/transak/index.d.ts.map
vendored
1
dist/ramps/providers/transak/index.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/transak/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
||||
6
dist/ramps/providers/transak/index.js
vendored
6
dist/ramps/providers/transak/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TransakProvider = void 0;
|
||||
var transak_provider_1 = require("./transak.provider");
|
||||
Object.defineProperty(exports, "TransakProvider", { enumerable: true, get: function () { return transak_provider_1.TransakProvider; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/ramps/providers/transak/index.js.map
vendored
1
dist/ramps/providers/transak/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ramps/providers/transak/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Transak on-ramp and off-ramp provider
|
||||
* Docs: https://docs.transak.com
|
||||
*/
|
||||
import type { IOnRampProvider, IOffRampProvider } from '../../provider.interface';
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampSession, ProviderCapabilities } from '../../types';
|
||||
export declare class TransakProvider implements IOnRampProvider, IOffRampProvider {
|
||||
readonly id = "transak";
|
||||
private apiKey;
|
||||
private baseUrl;
|
||||
constructor(config: {
|
||||
apiKey: string;
|
||||
baseUrl?: string;
|
||||
});
|
||||
createSession(params: OnRampSessionParams): Promise<RampSession>;
|
||||
createPayoutSession(params: OffRampSessionParams): Promise<RampSession>;
|
||||
private chainToNetwork;
|
||||
getCapabilities(): ProviderCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=transak.provider.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"transak.provider.d.ts","sourceRoot":"","sources":["../../../../src/ramps/providers/transak/transak.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,eAAgB,YAAW,eAAe,EAAE,gBAAgB;IACvE,QAAQ,CAAC,EAAE,aAAa;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAgC;gBAEnC,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;IAuBhE,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAsB7E,OAAO,CAAC,cAAc;IAYtB,eAAe,IAAI,oBAAoB;CAYxC"}
|
||||
85
dist/ramps/providers/transak/transak.provider.js
vendored
85
dist/ramps/providers/transak/transak.provider.js
vendored
@@ -1,85 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Transak on-ramp and off-ramp provider
|
||||
* Docs: https://docs.transak.com
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TransakProvider = void 0;
|
||||
class TransakProvider {
|
||||
constructor(config) {
|
||||
this.id = 'transak';
|
||||
this.baseUrl = 'https://global.transak.com';
|
||||
this.apiKey = config.apiKey;
|
||||
if (config.baseUrl)
|
||||
this.baseUrl = config.baseUrl;
|
||||
}
|
||||
async createSession(params) {
|
||||
const search = new URLSearchParams({
|
||||
apiKey: this.apiKey,
|
||||
walletAddress: params.walletAddress,
|
||||
defaultCryptoCurrency: params.cryptoCurrency,
|
||||
defaultFiatCurrency: params.fiatCurrency,
|
||||
defaultFiatAmount: params.amount,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('networks', this.chainToNetwork(params.chainId));
|
||||
if (params.redirectUrl)
|
||||
search.set('redirectURL', params.redirectUrl);
|
||||
if (params.email)
|
||||
search.set('email', params.email);
|
||||
const url = `${this.baseUrl}/?${search.toString()}`;
|
||||
const sessionId = `tk-${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({
|
||||
apiKey: this.apiKey,
|
||||
walletAddress: params.walletAddress,
|
||||
defaultCryptoCurrency: params.cryptoCurrency,
|
||||
defaultFiatCurrency: params.fiatCurrency,
|
||||
defaultCryptoAmount: params.amount,
|
||||
});
|
||||
if (params.chainId)
|
||||
search.set('networks', this.chainToNetwork(params.chainId));
|
||||
if (params.redirectUrl)
|
||||
search.set('redirectURL', params.redirectUrl);
|
||||
const url = `${this.baseUrl}/?${search.toString()}&defaultScreen=selling`;
|
||||
const sessionId = `tk-sell-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return {
|
||||
url,
|
||||
sessionId,
|
||||
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
|
||||
provider: this.id,
|
||||
};
|
||||
}
|
||||
chainToNetwork(chainId) {
|
||||
const map = {
|
||||
1: 'ethereum',
|
||||
137: 'polygon',
|
||||
56: 'bsc',
|
||||
42161: 'arbitrum',
|
||||
10: 'optimism',
|
||||
8453: 'base',
|
||||
};
|
||||
return map[chainId] ?? 'ethereum';
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: 'Transak',
|
||||
onRamp: true,
|
||||
offRamp: true,
|
||||
quoteSupport: false,
|
||||
supportedChains: [1, 137, 56, 42161, 10, 8453],
|
||||
supportedFiatCurrencies: ['usd', 'eur', 'gbp', 'inr'],
|
||||
supportedCryptoCurrencies: ['eth', 'btc', 'usdc', 'usdt', 'matic', 'bnb'],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.TransakProvider = TransakProvider;
|
||||
//# sourceMappingURL=transak.provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"transak.provider.js","sourceRoot":"","sources":["../../../../src/ramps/providers/transak/transak.provider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAa,eAAe;IAK1B,YAAY,MAA4C;QAJ/C,OAAE,GAAG,SAAS,CAAC;QAEhB,YAAO,GAAG,4BAA4B,CAAC;QAG7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,MAAM,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,qBAAqB,EAAE,MAAM,CAAC,cAAc;YAC5C,mBAAmB,EAAE,MAAM,CAAC,YAAY;YACxC,iBAAiB,EAAE,MAAM,CAAC,MAAM;SACjC,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,OAAO;YAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,IAAI,MAAM,CAAC,WAAW;YAAE,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACtE,IAAI,MAAM,CAAC,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAEpD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO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YACT,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YAChD,QAAQ,EAAE,IAAI,CAAC,EAAE;SAClB,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,OAAe;QACpC,MAAM,GAAG,GAA2B;YAClC,CAAC,EAAE,UAAU;YACb,GAAG,EAAE,SAAS;YACd,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,UAAU;YACjB,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,MAAM;SACb,CAAC;QACF,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC;IACpC,CAAC;IAED,eAAe;QACb,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;YACb,YAAY,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,EAAE,KAAK,CAAC;SAC1E,CAAC;IACJ,CAAC;CACF;AA/ED,0CA+EC"}
|
||||
22
dist/ramps/ramp-factory.service.d.ts
vendored
22
dist/ramps/ramp-factory.service.d.ts
vendored
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* Ramp factory service - creates and selects ramp providers
|
||||
*/
|
||||
import type { OnRampSessionParams, OffRampSessionParams, RampQuoteParams, RampSession, RampQuote, ProviderCapabilities } from './types';
|
||||
export type RampProviderId = 'moonpay' | 'ramp-network' | 'onramper' | 'transak' | 'banxa' | 'coinbase-ramps' | 'stripe-crypto' | 'cybrid' | 'sardine' | 'honeycoin';
|
||||
export declare class RampFactoryService {
|
||||
private onRampProviders;
|
||||
private offRampProviders;
|
||||
private quoteProviders;
|
||||
private defaultOnRamp;
|
||||
private defaultOffRamp;
|
||||
constructor();
|
||||
private registerProviders;
|
||||
createOnRampSession(params: OnRampSessionParams, providerId?: RampProviderId): Promise<RampSession>;
|
||||
createOffRampSession(params: OffRampSessionParams, providerId?: RampProviderId): Promise<RampSession>;
|
||||
getQuote(params: RampQuoteParams, providerId?: RampProviderId): Promise<RampQuote | null>;
|
||||
getProviders(): ProviderCapabilities[];
|
||||
setDefaultOnRamp(id: RampProviderId): void;
|
||||
setDefaultOffRamp(id: RampProviderId): void;
|
||||
}
|
||||
export declare const rampFactoryService: RampFactoryService;
|
||||
//# sourceMappingURL=ramp-factory.service.d.ts.map
|
||||
1
dist/ramps/ramp-factory.service.d.ts.map
vendored
1
dist/ramps/ramp-factory.service.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ramp-factory.service.d.ts","sourceRoot":"","sources":["../../src/ramps/ramp-factory.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAYxI,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,cAAc,GACd,UAAU,GACV,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,eAAe,GACf,QAAQ,GACR,SAAS,GACT,WAAW,CAAC;AAKhB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,eAAe,CAA2C;IAClE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,aAAa,CAA4C;IACjE,OAAO,CAAC,cAAc,CAA6C;;IAMnE,OAAO,CAAC,iBAAiB;IAsEnB,mBAAmB,CACvB,MAAM,EAAE,mBAAmB,EAC3B,UAAU,CAAC,EAAE,cAAc,GAC1B,OAAO,CAAC,WAAW,CAAC;IAcjB,oBAAoB,CACxB,MAAM,EAAE,oBAAoB,EAC5B,UAAU,CAAC,EAAE,cAAc,GAC1B,OAAO,CAAC,WAAW,CAAC;IAcjB,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAY/F,YAAY,IAAI,oBAAoB,EAAE;IAqBtC,gBAAgB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI;IAI1C,iBAAiB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI;CAG5C;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|
||||
153
dist/ramps/ramp-factory.service.js
vendored
153
dist/ramps/ramp-factory.service.js
vendored
@@ -1,153 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Ramp factory service - creates and selects ramp providers
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rampFactoryService = exports.RampFactoryService = void 0;
|
||||
const moonpay_1 = require("./providers/moonpay");
|
||||
const ramp_network_1 = require("./providers/ramp-network");
|
||||
const onramper_1 = require("./providers/onramper");
|
||||
const transak_1 = require("./providers/transak");
|
||||
const banxa_1 = require("./providers/banxa");
|
||||
const coinbase_ramps_1 = require("./providers/coinbase-ramps");
|
||||
const stripe_crypto_1 = require("./providers/stripe-crypto");
|
||||
const cybrid_1 = require("./providers/cybrid");
|
||||
const sardine_1 = require("./providers/sardine");
|
||||
const honeycoin_1 = require("./providers/honeycoin");
|
||||
const DEFAULT_ON_RAMP_PROVIDER = 'onramper';
|
||||
const DEFAULT_OFF_RAMP_PROVIDER = 'moonpay';
|
||||
class RampFactoryService {
|
||||
constructor() {
|
||||
this.onRampProviders = new Map();
|
||||
this.offRampProviders = new Map();
|
||||
this.quoteProviders = new Map();
|
||||
this.defaultOnRamp = DEFAULT_ON_RAMP_PROVIDER;
|
||||
this.defaultOffRamp = DEFAULT_OFF_RAMP_PROVIDER;
|
||||
this.registerProviders();
|
||||
}
|
||||
registerProviders() {
|
||||
const moonpayKey = process.env.MOONPAY_API_KEY;
|
||||
if (moonpayKey) {
|
||||
const moonpay = new moonpay_1.MoonPayProvider({ apiKey: moonpayKey });
|
||||
this.onRampProviders.set('moonpay', moonpay);
|
||||
this.offRampProviders.set('moonpay', moonpay);
|
||||
this.quoteProviders.set('moonpay', moonpay);
|
||||
}
|
||||
const rampKey = process.env.RAMP_NETWORK_API_KEY;
|
||||
if (rampKey) {
|
||||
const ramp = new ramp_network_1.RampNetworkProvider({ hostApiKey: rampKey });
|
||||
this.onRampProviders.set('ramp-network', ramp);
|
||||
this.offRampProviders.set('ramp-network', ramp);
|
||||
}
|
||||
const onramperKey = process.env.ONRAMPER_API_KEY;
|
||||
if (onramperKey) {
|
||||
const onramper = new onramper_1.OnramperProvider({ apiKey: onramperKey });
|
||||
this.onRampProviders.set('onramper', onramper);
|
||||
this.quoteProviders.set('onramper', onramper);
|
||||
}
|
||||
const transakKey = process.env.TRANSAK_API_KEY;
|
||||
if (transakKey) {
|
||||
const transak = new transak_1.TransakProvider({ apiKey: transakKey });
|
||||
this.onRampProviders.set('transak', transak);
|
||||
this.offRampProviders.set('transak', transak);
|
||||
}
|
||||
const banxaKey = process.env.BANXA_API_KEY;
|
||||
if (banxaKey) {
|
||||
const banxa = new banxa_1.BanxaProvider({ apiKey: banxaKey });
|
||||
this.onRampProviders.set('banxa', banxa);
|
||||
this.offRampProviders.set('banxa', banxa);
|
||||
}
|
||||
const coinbaseAppId = process.env.COINBASE_CLIENT_ID;
|
||||
if (coinbaseAppId) {
|
||||
const coinbase = new coinbase_ramps_1.CoinbaseRampsProvider({ appId: coinbaseAppId });
|
||||
this.onRampProviders.set('coinbase-ramps', coinbase);
|
||||
this.offRampProviders.set('coinbase-ramps', coinbase);
|
||||
}
|
||||
const stripeKey = process.env.STRIPE_SECRET_KEY;
|
||||
if (stripeKey) {
|
||||
const stripe = new stripe_crypto_1.StripeCryptoProvider({ apiKey: stripeKey });
|
||||
this.onRampProviders.set('stripe-crypto', stripe);
|
||||
}
|
||||
const cybridKey = process.env.CYBRID_API_KEY;
|
||||
if (cybridKey) {
|
||||
const cybrid = new cybrid_1.CybridProvider({ apiKey: cybridKey });
|
||||
this.onRampProviders.set('cybrid', cybrid);
|
||||
this.offRampProviders.set('cybrid', cybrid);
|
||||
}
|
||||
const sardineKey = process.env.SARDINE_API_KEY;
|
||||
if (sardineKey) {
|
||||
const sardine = new sardine_1.SardineProvider({ apiKey: sardineKey });
|
||||
this.onRampProviders.set('sardine', sardine);
|
||||
}
|
||||
const honeycoinKey = process.env.HONEYCOIN_API_KEY;
|
||||
if (honeycoinKey) {
|
||||
const honeycoin = new honeycoin_1.HoneyCoinProvider({ apiKey: honeycoinKey });
|
||||
this.offRampProviders.set('honeycoin', honeycoin);
|
||||
}
|
||||
}
|
||||
async createOnRampSession(params, providerId) {
|
||||
const id = providerId ?? this.defaultOnRamp;
|
||||
const provider = this.onRampProviders.get(id);
|
||||
if (!provider) {
|
||||
const fallback = this.onRampProviders.get(DEFAULT_ON_RAMP_PROVIDER)
|
||||
?? Array.from(this.onRampProviders.values())[0];
|
||||
if (!fallback) {
|
||||
throw new Error(`No on-ramp provider configured. Set MOONPAY_API_KEY, RAMP_NETWORK_API_KEY, or ONRAMPER_API_KEY`);
|
||||
}
|
||||
return fallback.createSession(params);
|
||||
}
|
||||
return provider.createSession(params);
|
||||
}
|
||||
async createOffRampSession(params, providerId) {
|
||||
const id = providerId ?? this.defaultOffRamp;
|
||||
const provider = this.offRampProviders.get(id);
|
||||
if (!provider) {
|
||||
const fallback = this.offRampProviders.get(DEFAULT_OFF_RAMP_PROVIDER)
|
||||
?? Array.from(this.offRampProviders.values())[0];
|
||||
if (!fallback) {
|
||||
throw new Error(`No off-ramp provider configured. Set MOONPAY_API_KEY or RAMP_NETWORK_API_KEY`);
|
||||
}
|
||||
return fallback.createPayoutSession(params);
|
||||
}
|
||||
return provider.createPayoutSession(params);
|
||||
}
|
||||
async getQuote(params, providerId) {
|
||||
const providers = providerId
|
||||
? [this.quoteProviders.get(providerId)].filter((p) => !!p)
|
||||
: Array.from(this.quoteProviders.values());
|
||||
for (const provider of providers) {
|
||||
const quote = await provider.getQuote(params);
|
||||
if (quote)
|
||||
return quote;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
getProviders() {
|
||||
const seen = new Set();
|
||||
const caps = [];
|
||||
for (const p of this.onRampProviders.values()) {
|
||||
const c = p.getCapabilities();
|
||||
if (!seen.has(c.id)) {
|
||||
seen.add(c.id);
|
||||
caps.push(c);
|
||||
}
|
||||
}
|
||||
for (const p of this.offRampProviders.values()) {
|
||||
const c = p.getCapabilities();
|
||||
if (!seen.has(c.id)) {
|
||||
seen.add(c.id);
|
||||
caps.push(c);
|
||||
}
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
setDefaultOnRamp(id) {
|
||||
this.defaultOnRamp = id;
|
||||
}
|
||||
setDefaultOffRamp(id) {
|
||||
this.defaultOffRamp = id;
|
||||
}
|
||||
}
|
||||
exports.RampFactoryService = RampFactoryService;
|
||||
exports.rampFactoryService = new RampFactoryService();
|
||||
//# sourceMappingURL=ramp-factory.service.js.map
|
||||
1
dist/ramps/ramp-factory.service.js.map
vendored
1
dist/ramps/ramp-factory.service.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/ramps/ramp.routes.d.ts
vendored
6
dist/ramps/ramp.routes.d.ts
vendored
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Ramp API routes - on-ramp and off-ramp session creation, quotes, providers
|
||||
*/
|
||||
declare const router: import("express-serve-static-core").Router;
|
||||
export default router;
|
||||
//# sourceMappingURL=ramp.routes.d.ts.map
|
||||
1
dist/ramps/ramp.routes.d.ts.map
vendored
1
dist/ramps/ramp.routes.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ramp.routes.d.ts","sourceRoot":"","sources":["../../src/ramps/ramp.routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,QAAA,MAAM,MAAM,4CAAW,CAAC;AAgKxB,eAAe,MAAM,CAAC"}
|
||||
138
dist/ramps/ramp.routes.js
vendored
138
dist/ramps/ramp.routes.js
vendored
@@ -1,138 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Ramp API routes - on-ramp and off-ramp session creation, quotes, providers
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const express_1 = require("express");
|
||||
const ramp_factory_service_1 = require("./ramp-factory.service");
|
||||
const router = (0, express_1.Router)();
|
||||
function safeJsonParse(body, fallback) {
|
||||
if (body && typeof body === 'object')
|
||||
return body;
|
||||
return fallback;
|
||||
}
|
||||
/**
|
||||
* POST /ramps/on-ramp/session
|
||||
* Create buy session - returns URL for MoonPay/Ramp/Onramper widget
|
||||
*/
|
||||
router.post('/on-ramp/session', async (req, res, next) => {
|
||||
try {
|
||||
const body = safeJsonParse(req.body, {});
|
||||
const { walletAddress, amount, fiatCurrency, cryptoCurrency, chainId, email, redirectUrl, provider } = body;
|
||||
if (!walletAddress || !amount || !fiatCurrency || !cryptoCurrency) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Missing required fields: walletAddress, amount, fiatCurrency, cryptoCurrency',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
walletAddress,
|
||||
amount: String(amount),
|
||||
fiatCurrency,
|
||||
cryptoCurrency,
|
||||
chainId,
|
||||
email,
|
||||
redirectUrl,
|
||||
};
|
||||
const session = await ramp_factory_service_1.rampFactoryService.createOnRampSession(params, provider);
|
||||
res.status(201).json({ success: true, data: session, timestamp: new Date() });
|
||||
}
|
||||
catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* POST /ramps/off-ramp/session
|
||||
* Create sell/payout session
|
||||
*/
|
||||
router.post('/off-ramp/session', async (req, res, next) => {
|
||||
try {
|
||||
const body = safeJsonParse(req.body, {});
|
||||
const { walletAddress, amount, fiatCurrency, cryptoCurrency, chainId, destinationAccount, redirectUrl, provider, } = body;
|
||||
if (!walletAddress || !amount || !fiatCurrency || !cryptoCurrency) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Missing required fields: walletAddress, amount, fiatCurrency, cryptoCurrency',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
walletAddress,
|
||||
amount: String(amount),
|
||||
fiatCurrency,
|
||||
cryptoCurrency,
|
||||
chainId,
|
||||
destinationAccount,
|
||||
redirectUrl,
|
||||
};
|
||||
const session = await ramp_factory_service_1.rampFactoryService.createOffRampSession(params, provider);
|
||||
res.status(201).json({ success: true, data: session, timestamp: new Date() });
|
||||
}
|
||||
catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* GET /ramps/quote
|
||||
* Get quote for buy/sell
|
||||
* Query: amount, fiatCurrency, cryptoCurrency, side (buy|sell), chainId?, provider?
|
||||
*/
|
||||
router.get('/quote', async (req, res, next) => {
|
||||
try {
|
||||
const { amount, fiatCurrency, cryptoCurrency, side, chainId, provider } = req.query;
|
||||
if (!amount || !fiatCurrency || !cryptoCurrency || !side) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Missing required query params: amount, fiatCurrency, cryptoCurrency, side',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (side !== 'buy' && side !== 'sell') {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'side must be "buy" or "sell"',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
amount: String(amount),
|
||||
fiatCurrency: String(fiatCurrency),
|
||||
cryptoCurrency: String(cryptoCurrency),
|
||||
side,
|
||||
chainId: chainId ? Number(chainId) : undefined,
|
||||
};
|
||||
const quote = await ramp_factory_service_1.rampFactoryService.getQuote(params, provider ? provider : undefined);
|
||||
if (!quote) {
|
||||
res.status(404).json({
|
||||
success: false,
|
||||
error: 'No quote available for the requested pair',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
res.json({ success: true, data: quote, timestamp: new Date() });
|
||||
}
|
||||
catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* GET /ramps/providers
|
||||
* List enabled providers and capabilities
|
||||
*/
|
||||
router.get('/providers', (_req, res, next) => {
|
||||
try {
|
||||
const providers = ramp_factory_service_1.rampFactoryService.getProviders();
|
||||
res.json({ success: true, data: providers, timestamp: new Date() });
|
||||
}
|
||||
catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
exports.default = router;
|
||||
//# sourceMappingURL=ramp.routes.js.map
|
||||
1
dist/ramps/ramp.routes.js.map
vendored
1
dist/ramps/ramp.routes.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ramp.routes.js","sourceRoot":"","sources":["../../src/ramps/ramp.routes.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,qCAAkE;AAElE,iEAA4D;AAG5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,SAAS,aAAa,CAAI,IAAa,EAAE,QAAW;IAClD,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAS,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACxF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,aAAa,CACxB,GAAG,CAAC,IAAI,EACR,EAAE,CACH,CAAC;QACF,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE5G,IAAI,CAAC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S,GAAG,yCAAkB,CAAC,YAAY,EAAE,CAAC;QACpD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
|
||||
6
dist/ramps/server.d.ts
vendored
6
dist/ramps/server.d.ts
vendored
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Standalone ramp API server
|
||||
* Mount ramp routes at /ramps
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=server.d.ts.map
|
||||
1
dist/ramps/server.d.ts.map
vendored
1
dist/ramps/server.d.ts.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/ramps/server.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
||||
26
dist/ramps/server.js
vendored
26
dist/ramps/server.js
vendored
@@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Standalone ramp API server
|
||||
* Mount ramp routes at /ramps
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const express_1 = __importDefault(require("express"));
|
||||
const ramp_routes_1 = __importDefault(require("./ramp.routes"));
|
||||
const app = (0, express_1.default)();
|
||||
const PORT = process.env.RAMP_API_PORT || 3080;
|
||||
app.use(express_1.default.json());
|
||||
app.use('/ramps', ramp_routes_1.default);
|
||||
app.get('/health', (_req, res) => {
|
||||
res.json({ status: 'ok', service: 'ramp-api', timestamp: new Date() });
|
||||
});
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Ramp API server listening on port ${PORT}`);
|
||||
console.log(` POST /ramps/on-ramp/session`);
|
||||
console.log(` POST /ramps/off-ramp/session`);
|
||||
console.log(` GET /ramps/quote`);
|
||||
console.log(` GET /ramps/providers`);
|
||||
});
|
||||
//# sourceMappingURL=server.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user