@riocrypto/common 1.0.503 → 1.0.506

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/build/index.d.ts +0 -41
  2. package/build/index.js +0 -41
  3. package/package.json +1 -1
  4. package/build/client.d.ts +0 -93
  5. package/build/client.js +0 -109
  6. package/build/clients/bitstamp-client.d.ts +0 -16
  7. package/build/clients/bitstamp-client.js +0 -83
  8. package/build/clients/ccxt-client.d.ts +0 -48
  9. package/build/clients/ccxt-client.js +0 -201
  10. package/build/clients/etherscan-client.d.ts +0 -6
  11. package/build/clients/etherscan-client.js +0 -24
  12. package/build/clients/fireblocks-client.d.ts +0 -15
  13. package/build/clients/fireblocks-client.js +0 -140
  14. package/build/clients/fixer-client.d.ts +0 -8
  15. package/build/clients/fixer-client.js +0 -34
  16. package/build/clients/gueno-client.d.ts +0 -10
  17. package/build/clients/gueno-client.js +0 -44
  18. package/build/clients/kapstar-client.d.ts +0 -6
  19. package/build/clients/kapstar-client.js +0 -26
  20. package/build/clients/kushki-client.d.ts +0 -14
  21. package/build/clients/kushki-client.js +0 -150
  22. package/build/clients/rio-client.d.ts +0 -82
  23. package/build/clients/rio-client.js +0 -315
  24. package/build/clients/slack-client.d.ts +0 -7
  25. package/build/clients/slack-client.js +0 -34
  26. package/build/helpers/get-user-from-client-helper.d.ts +0 -4
  27. package/build/helpers/get-user-from-client-helper.js +0 -41
  28. package/build/helpers/get-user-helper.d.ts +0 -4
  29. package/build/helpers/get-user-helper.js +0 -35
  30. package/build/middlewares/authorize.d.ts +0 -28
  31. package/build/middlewares/authorize.js +0 -195
  32. package/build/middlewares/current-admin-auth.d.ts +0 -15
  33. package/build/middlewares/current-admin-auth.js +0 -20
  34. package/build/middlewares/current-auth.d.ts +0 -16
  35. package/build/middlewares/current-auth.js +0 -20
  36. package/build/middlewares/error-handler.d.ts +0 -2
  37. package/build/middlewares/error-handler.js +0 -14
  38. package/build/middlewares/get-order.d.ts +0 -11
  39. package/build/middlewares/get-order.js +0 -57
  40. package/build/middlewares/get-partner.d.ts +0 -10
  41. package/build/middlewares/get-partner.js +0 -41
  42. package/build/middlewares/get-user.d.ts +0 -12
  43. package/build/middlewares/get-user.js +0 -45
  44. package/build/middlewares/require-admin-api-key.d.ts +0 -2
  45. package/build/middlewares/require-admin-api-key.js +0 -11
  46. package/build/middlewares/require-auth.d.ts +0 -2
  47. package/build/middlewares/require-auth.js +0 -11
  48. package/build/middlewares/require-priveleges.d.ts +0 -2
  49. package/build/middlewares/require-priveleges.js +0 -15
  50. package/build/middlewares/validate-auth.d.ts +0 -2
  51. package/build/middlewares/validate-auth.js +0 -30
  52. package/build/middlewares/validate-kyc.d.ts +0 -2
  53. package/build/middlewares/validate-kyc.js +0 -30
  54. package/build/middlewares/validate-order.d.ts +0 -0
  55. package/build/middlewares/validate-order.js +0 -20
  56. package/build/middlewares/validate-request.d.ts +0 -2
  57. package/build/middlewares/validate-request.js +0 -13
  58. package/build/middlewares/verify-admin-api-key.d.ts +0 -9
  59. package/build/middlewares/verify-admin-api-key.js +0 -11
  60. package/build/models/admin-auth.d.ts +0 -16
  61. package/build/models/admin-auth.js +0 -59
  62. package/build/models/auth.d.ts +0 -24
  63. package/build/models/auth.js +0 -83
  64. package/build/models/bank-payout.d.ts +0 -20
  65. package/build/models/bank-payout.js +0 -44
  66. package/build/models/business-user.d.ts +0 -57
  67. package/build/models/business-user.js +0 -111
  68. package/build/models/ccxt-order.d.ts +0 -16
  69. package/build/models/ccxt-order.js +0 -37
  70. package/build/models/checked-address.d.ts +0 -17
  71. package/build/models/checked-address.js +0 -37
  72. package/build/models/kushki-payment.d.ts +0 -16
  73. package/build/models/kushki-payment.js +0 -37
  74. package/build/models/kyc.d.ts +0 -20
  75. package/build/models/kyc.js +0 -45
  76. package/build/models/order.d.ts +0 -67
  77. package/build/models/order.js +0 -123
  78. package/build/models/partner.d.ts +0 -35
  79. package/build/models/partner.js +0 -69
  80. package/build/models/rio-settings.d.ts +0 -12
  81. package/build/models/rio-settings.js +0 -29
  82. package/build/models/user.d.ts +0 -53
  83. package/build/models/user.js +0 -94
  84. package/build/services/apiKey.d.ts +0 -3
  85. package/build/services/apiKey.js +0 -24
  86. package/build/services/password.d.ts +0 -4
  87. package/build/services/password.js +0 -32
  88. package/build/services/s3.d.ts +0 -5
  89. package/build/services/s3.js +0 -21
@@ -1,201 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ccxtWrapper = void 0;
16
- const ccxt_1 = __importDefault(require("ccxt"));
17
- const ccxt_liquidity_provider_1 = require("../types/ccxt-liquidity-provider");
18
- const rio_env_1 = require("../types/rio-env");
19
- const side_1 = require("../types/side");
20
- class CCXTClient {
21
- constructor(env) {
22
- this.env = env;
23
- }
24
- createBuyOrder(amount, crypto, fiat, ccxtLiquidityProvider) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- if (this.env === "production") {
27
- const exchange = yield this.getExchange(ccxtLiquidityProvider);
28
- const order = yield exchange.createOrder(`${crypto}/${fiat}`, "market", "buy", amount);
29
- return {
30
- ccxtId: order.id,
31
- price: order.price,
32
- amountCrypto: order.amount,
33
- amountFiat: amount,
34
- crypto,
35
- fiat,
36
- side: side_1.Side.Buy,
37
- };
38
- }
39
- else {
40
- return {
41
- ccxtId: "1",
42
- price: 1,
43
- amountCrypto: amount,
44
- amountFiat: amount,
45
- crypto,
46
- fiat,
47
- side: side_1.Side.Buy,
48
- };
49
- }
50
- });
51
- }
52
- createSellOrder(amount, crypto, fiat, ccxtLiquidityProvider) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- if (this.env === "production") {
55
- const exchange = yield this.getExchange(ccxtLiquidityProvider);
56
- const order = yield exchange.createOrder(`${crypto}/${fiat}`, "market", "sell", amount);
57
- return {
58
- ccxtId: order.id,
59
- price: order.price,
60
- amountCrypto: amount,
61
- amountFiat: order.amount * order.price,
62
- crypto,
63
- fiat,
64
- side: side_1.Side.Sell,
65
- };
66
- }
67
- else {
68
- return {
69
- ccxtId: "1",
70
- price: 1,
71
- amountCrypto: amount,
72
- amountFiat: amount,
73
- crypto,
74
- fiat,
75
- side: side_1.Side.Sell,
76
- };
77
- }
78
- });
79
- }
80
- transfer(side, amount, crypto, cryptoAddress, ccxtLiquidityProvider) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- if (this.env === "production") {
83
- const exchange = yield this.getExchange(ccxtLiquidityProvider);
84
- const params = ccxtLiquidityProvider === ccxt_liquidity_provider_1.CCXTLiquidityProvider.Kraken
85
- ? {
86
- key: "Metamask",
87
- }
88
- : undefined;
89
- yield exchange.withdraw(crypto, this.round(amount, 8), cryptoAddress, undefined, params);
90
- }
91
- });
92
- }
93
- getBuyQuote(amount, crypto, fiat) {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- if (this.env === "production") {
96
- const exchange = yield this.getOptimalExchange(crypto);
97
- if (!exchange)
98
- throw new Error("Unable to get optimal exchange");
99
- let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
100
- if (!ticker.vwap)
101
- throw new Error("Unable to get ticker vwap");
102
- return {
103
- price: ticker.vwap,
104
- amountCrypto: amount / ticker.vwap,
105
- amountFiat: amount,
106
- crypto,
107
- fiat,
108
- side: side_1.Side.Buy,
109
- };
110
- }
111
- else {
112
- return {
113
- price: 0.5,
114
- amountCrypto: amount,
115
- amountFiat: amount,
116
- crypto,
117
- fiat,
118
- side: side_1.Side.Buy,
119
- };
120
- }
121
- });
122
- }
123
- getOptimalExchange(crypto) {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- for (let exchangeId of ccxt_1.default.exchanges) {
126
- if (exchangeId === "bitstamp") {
127
- //@ts-ignore
128
- const exchangeClass = ccxt_1.default[exchangeId], exchange = new exchangeClass({
129
- apiKey: process.env[`${exchangeId.toLocaleUpperCase()}_API_KEY`],
130
- secret: process.env[`${exchangeId.toLocaleUpperCase()}_SECRET`],
131
- });
132
- return exchange;
133
- }
134
- }
135
- return null;
136
- });
137
- }
138
- round(value, precision) {
139
- if (Number.isInteger(precision)) {
140
- var shift = Math.pow(10, precision);
141
- // Limited preventing decimal issue
142
- return Math.round(value * shift + 0.00000000000001) / shift;
143
- }
144
- else {
145
- return Math.round(value);
146
- }
147
- }
148
- getExchange(ccxtLiquidityProvider) {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- // @ts-ignore
151
- const exchangeClass = ccxt_1.default[ccxtLiquidityProvider], exchange = new exchangeClass({
152
- apiKey: process.env[`${ccxtLiquidityProvider.toLocaleUpperCase()}_API_KEY`],
153
- secret: process.env[`${ccxtLiquidityProvider.toLocaleUpperCase()}_SECRET`],
154
- });
155
- return exchange;
156
- });
157
- }
158
- getSellQuote(amount, crypto, fiat) {
159
- return __awaiter(this, void 0, void 0, function* () {
160
- if (this.env === "production") {
161
- const exchange = yield this.getOptimalExchange(crypto);
162
- if (!exchange)
163
- throw new Error("Unable to get optimal exchange");
164
- exchange.options["fetchMarketsMethod"] = "fetch_markets_from_api";
165
- let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
166
- if (!ticker.vwap)
167
- throw new Error("Unable to get ticker vwap");
168
- return {
169
- price: ticker.vwap,
170
- amountCrypto: amount,
171
- amountFiat: amount * ticker.vwap,
172
- crypto,
173
- fiat,
174
- };
175
- }
176
- else {
177
- return {
178
- price: 1,
179
- amountCrypto: 100,
180
- amountFiat: 100,
181
- crypto,
182
- fiat,
183
- };
184
- }
185
- });
186
- }
187
- getDepositAddress(crypto) {
188
- return __awaiter(this, void 0, void 0, function* () {
189
- const exchange = yield this.getOptimalExchange(crypto);
190
- if (!exchange)
191
- throw new Error("Unable to get optimal exchange");
192
- let depositAddress = yield exchange.fetchDepositAddress(crypto);
193
- if (!depositAddress)
194
- throw new Error("Unable to get deposit address");
195
- return depositAddress.address;
196
- });
197
- }
198
- }
199
- exports.ccxtWrapper = new CCXTClient([rio_env_1.RioEnv.Production, rio_env_1.RioEnv.Staging].includes(process.env.RIO_ENV)
200
- ? "production"
201
- : "development");
@@ -1,6 +0,0 @@
1
- import { AxiosInstance, AxiosStatic } from "axios";
2
- export declare class EtherscanClient {
3
- private axios;
4
- constructor(axios: AxiosStatic | AxiosInstance);
5
- getTransactions(address: string): Promise<any[]>;
6
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EtherscanClient = void 0;
13
- class EtherscanClient {
14
- constructor(axios) {
15
- this.axios = axios;
16
- }
17
- getTransactions(address) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=1&offset=100&sort=asc&apikey=${"DDR78IVPYXCVGFKTT6YWBBYZBRD18S2EW1"}`);
20
- return data.result;
21
- });
22
- }
23
- }
24
- exports.EtherscanClient = EtherscanClient;
@@ -1,15 +0,0 @@
1
- import { Crypto } from "../types/crypto";
2
- import { FireblocksSDK } from "fireblocks-sdk";
3
- declare class FireblocksClient {
4
- fireblocks: FireblocksSDK;
5
- constructor(privateKey: string, apiKey: string);
6
- estimateWithdrawFromExchangeFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | undefined>;
7
- estimateWithdrawFromVaultFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | undefined>;
8
- withdrawFromExchange(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
9
- withdrawFromVault(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
10
- getVaultCryptoBalance(crypto: Crypto): Promise<number>;
11
- getExchangeCryptoBalance(crypto: Crypto): Promise<number>;
12
- getExchangeFiatBalance(): Promise<number>;
13
- }
14
- export declare const fireblocksClient: FireblocksClient;
15
- export {};
@@ -1,140 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.fireblocksClient = void 0;
13
- const fireblocks_sdk_1 = require("fireblocks-sdk");
14
- class FireblocksClient {
15
- constructor(privateKey, apiKey) {
16
- this.fireblocks = new fireblocks_sdk_1.FireblocksSDK(privateKey, apiKey, "https://api.fireblocks.io");
17
- }
18
- estimateWithdrawFromExchangeFee(crypto, address, amountCrypto) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- let estimate = yield this.fireblocks.estimateFeeForTransaction({
21
- assetId: crypto,
22
- source: {
23
- type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
24
- id: "0",
25
- },
26
- destination: {
27
- type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
28
- oneTimeAddress: {
29
- address,
30
- },
31
- },
32
- amount: amountCrypto,
33
- operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
34
- });
35
- return estimate.medium.networkFee;
36
- });
37
- }
38
- estimateWithdrawFromVaultFee(crypto, address, amountCrypto) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- let estimate = yield this.fireblocks.estimateFeeForTransaction({
41
- assetId: crypto,
42
- source: {
43
- type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
44
- id: "0",
45
- },
46
- destination: {
47
- type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
48
- oneTimeAddress: {
49
- address,
50
- },
51
- },
52
- amount: amountCrypto,
53
- operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
54
- });
55
- return estimate.medium.networkFee;
56
- });
57
- }
58
- withdrawFromExchange(crypto, address, amountCrypto) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- let withdraw = yield this.fireblocks.createTransaction({
61
- assetId: crypto,
62
- source: {
63
- type: fireblocks_sdk_1.PeerType.EXCHANGE_ACCOUNT,
64
- id: "b227e245-a32e-c7ab-ff37-b365fa361077",
65
- },
66
- destination: {
67
- type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
68
- oneTimeAddress: {
69
- address,
70
- },
71
- },
72
- amount: amountCrypto,
73
- operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
74
- });
75
- });
76
- }
77
- withdrawFromVault(crypto, address, amountCrypto) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- let withdraw = yield this.fireblocks.createTransaction({
80
- assetId: crypto,
81
- source: {
82
- type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
83
- id: "2",
84
- },
85
- destination: {
86
- type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
87
- oneTimeAddress: {
88
- address,
89
- },
90
- },
91
- amount: amountCrypto,
92
- operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
93
- });
94
- });
95
- }
96
- getVaultCryptoBalance(crypto) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- let vault = yield this.fireblocks.getVaultAccountById("2");
99
- let balance = 0;
100
- if (!(vault === null || vault === void 0 ? void 0 : vault.assets)) {
101
- throw new Error();
102
- }
103
- vault.assets.forEach((asset) => {
104
- if (asset.id === crypto) {
105
- balance += Number(asset.available);
106
- }
107
- });
108
- return balance;
109
- });
110
- }
111
- getExchangeCryptoBalance(crypto) {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- let exchanges = yield this.fireblocks.getExchangeAccounts();
114
- let balance = 0;
115
- exchanges.forEach((exchange) => {
116
- exchange.assets.forEach((asset) => {
117
- if (asset.id === crypto) {
118
- balance += Number(asset.available);
119
- }
120
- });
121
- });
122
- return balance;
123
- });
124
- }
125
- getExchangeFiatBalance() {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- let exchanges = yield this.fireblocks.getExchangeAccounts();
128
- let balance = 0;
129
- exchanges.forEach((exchange) => {
130
- exchange.assets.forEach((asset) => {
131
- if (asset.id === "USD") {
132
- balance += Number(asset.available);
133
- }
134
- });
135
- });
136
- return balance;
137
- });
138
- }
139
- }
140
- exports.fireblocksClient = new FireblocksClient(process.env.FIREBLOCKS_PRIVATE_KEY, process.env.FIREBLOCKS_API_KEY);
@@ -1,8 +0,0 @@
1
- import { Fiat } from "../types/fiat";
2
- declare class FixerClient {
3
- private apiKey;
4
- constructor(apiKey: string);
5
- convert(from: Fiat, to: Fiat): Promise<number>;
6
- }
7
- export declare const fixerClient: FixerClient;
8
- export {};
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.fixerClient = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- class FixerClient {
18
- constructor(apiKey) {
19
- this.apiKey = apiKey;
20
- }
21
- convert(from, to) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const fixerResponse = yield axios_1.default.get(`https://api.apilayer.com/fixer/latest?base=${from}&symbols=${to}`, {
24
- headers: {
25
- apikey: this.apiKey,
26
- "Accept-Encoding": "gzip,deflate,compress",
27
- },
28
- });
29
- const exchangeRate = fixerResponse.data.rates[to];
30
- return exchangeRate;
31
- });
32
- }
33
- }
34
- exports.fixerClient = new FixerClient(process.env.FIXER_API_KEY);
@@ -1,10 +0,0 @@
1
- declare class GuenoClient {
2
- private email;
3
- private password;
4
- private env;
5
- constructor(email: string, password: string, env: "sandbox" | "production");
6
- getAddressRiskScore(address: string, protocol: Crypto): Promise<any>;
7
- getAccessToken(): Promise<any>;
8
- }
9
- export declare const guenoClient: GuenoClient;
10
- export {};
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.guenoClient = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- class GuenoClient {
18
- constructor(email, password, env) {
19
- this.email = email;
20
- this.password = password;
21
- this.env = env;
22
- }
23
- getAddressRiskScore(address, protocol) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const accessToken = yield this.getAccessToken();
26
- const { data } = yield axios_1.default.get(`https://api-gueno.${this.env === "production" ? "prd" : "stg"}.gueno.com/api/amlCrypto/addressRiskScore?address=${address}&protocol=${protocol}`, {
27
- headers: {
28
- Authorization: `Bearer ${accessToken}`,
29
- },
30
- });
31
- return data;
32
- });
33
- }
34
- getAccessToken() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const { data } = yield axios_1.default.post(`https://api-gueno.${this.env === "production" ? "prd" : "stg"}.gueno.com/api/auth/login`, {
37
- email: this.email,
38
- password: this.password,
39
- });
40
- return data.access_token;
41
- });
42
- }
43
- }
44
- exports.guenoClient = new GuenoClient(process.env.GUENO_EMAIL, process.env.GUENO_PASSWORD, process.env.GUENO_ENV);
@@ -1,6 +0,0 @@
1
- declare class KapstarClient {
2
- constructor();
3
- getBRLExchangeRateUSD(): Promise<number>;
4
- }
5
- export declare const kapstarClient: KapstarClient;
6
- export {};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.kapstarClient = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- class KapstarClient {
18
- constructor() { }
19
- getBRLExchangeRateUSD() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const kapstarResponse = yield axios_1.default.get(`https://api.ecsa.finance/quotation-service/v1/quotation/last`);
22
- return 1 / kapstarResponse.data;
23
- });
24
- }
25
- }
26
- exports.kapstarClient = new KapstarClient();
@@ -1,14 +0,0 @@
1
- import { BusinessUser } from "../types/business-user";
2
- import { Order } from "../types/order";
3
- import { User } from "../types/user";
4
- declare class KushkiClient {
5
- private privateMerchantId;
6
- private environment;
7
- private baseUrl;
8
- constructor(privateMerchantId: string, environment: "sandbox" | "production");
9
- createPaymentLink(order: Order, user: User, token: string): Promise<any>;
10
- createBankPaymentToken(order: Order, user: User | BusinessUser): Promise<any>;
11
- createBankPayment(order: Order, user: User | BusinessUser, token: string): Promise<any>;
12
- }
13
- export declare const kushkiClient: KushkiClient;
14
- export {};