@riocrypto/common-server 1.0.1674 → 1.0.1677
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.
- package/build/clients/bridge-client.js +0 -1
- package/build/clients/circle-client.js +0 -1
- package/build/clients/cloud-vision-api-client.d.ts +0 -9
- package/build/clients/cloud-vision-api-client.js +54 -58
- package/build/clients/coincover-client.js +0 -1
- package/build/clients/cosigner-client.js +0 -1
- package/build/index.d.ts +0 -17
- package/build/index.js +0 -17
- package/package.json +3 -9
- package/build/clients/aiprise-client.d.ts +0 -13
- package/build/clients/aiprise-client.js +0 -109
- package/build/clients/bitstamp-client.d.ts +0 -16
- package/build/clients/bitstamp-client.js +0 -97
- package/build/clients/brex-client.d.ts +0 -17
- package/build/clients/brex-client.js +0 -92
- package/build/clients/ccxt-client.d.ts +0 -25
- package/build/clients/ccxt-client.js +0 -164
- package/build/clients/coinbase-client.d.ts +0 -13
- package/build/clients/coinbase-client.js +0 -119
- package/build/clients/etherscan-client.d.ts +0 -7
- package/build/clients/etherscan-client.js +0 -40
- package/build/clients/fogbender-client.d.ts +0 -7
- package/build/clients/fogbender-client.js +0 -47
- package/build/clients/google-sheets-api-client.d.ts +0 -10
- package/build/clients/google-sheets-api-client.js +0 -75
- package/build/clients/gueno-client.d.ts +0 -11
- package/build/clients/gueno-client.js +0 -58
- package/build/clients/invopop-client.d.ts +0 -17
- package/build/clients/invopop-client.js +0 -225
- package/build/clients/kapstar-client.d.ts +0 -13
- package/build/clients/kapstar-client.js +0 -71
- package/build/clients/killb-client.d.ts +0 -13
- package/build/clients/killb-client.js +0 -76
- package/build/clients/polygon-client.d.ts +0 -11
- package/build/clients/polygon-client.js +0 -38
- package/build/helpers/get-polygon-exchange-rates.d.ts +0 -8
- package/build/helpers/get-polygon-exchange-rates.js +0 -34
- package/build/helpers/sanitize-chained-order-doc.d.ts +0 -27
- package/build/helpers/sanitize-chained-order-doc.js +0 -10
- package/build/helpers/sanitize-order-doc.d.ts +0 -27
- package/build/helpers/sanitize-order-doc.js +0 -20
- package/build/helpers/sanitize-quote-doc.d.ts +0 -27
- package/build/helpers/sanitize-quote-doc.js +0 -17
|
@@ -233,7 +233,6 @@ const buildBridgeClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
233
233
|
if (!BRIDGE_API_KEY) {
|
|
234
234
|
throw new common_1.SecretManagerError();
|
|
235
235
|
}
|
|
236
|
-
// Create GuenoClient instance and return
|
|
237
236
|
return new BridgeClient(BRIDGE_API_KEY);
|
|
238
237
|
});
|
|
239
238
|
exports.buildBridgeClient = buildBridgeClient;
|
|
@@ -136,7 +136,6 @@ const buildCircleClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
136
136
|
if (!CIRCLE_API_KEY) {
|
|
137
137
|
throw new common_1.SecretManagerError();
|
|
138
138
|
}
|
|
139
|
-
// Create GuenoClient instance and return
|
|
140
139
|
return new CircleClient(CIRCLE_API_KEY);
|
|
141
140
|
});
|
|
142
141
|
exports.buildCircleClient = buildCircleClient;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RioEnv } from "@riocrypto/common";
|
|
2
|
-
declare class cloudVisionAPIClient {
|
|
3
|
-
private env;
|
|
4
|
-
googleAuth: any;
|
|
5
|
-
constructor(env: RioEnv);
|
|
6
|
-
getDataFromPDF(bucketName: string, fileName: string, outputPrefix: string): Promise<any>;
|
|
7
|
-
}
|
|
8
|
-
export declare const googleVisionAPIClient: cloudVisionAPIClient;
|
|
9
|
-
export {};
|
|
@@ -1,59 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.googleVisionAPIClient = new cloudVisionAPIClient(process.env.RIO_ENV || process.env.NEXT_PUBLIC_RIO_ENV);
|
|
2
|
+
// import { RioEnv } from "@riocrypto/common";
|
|
3
|
+
// import { google } from "googleapis";
|
|
4
|
+
// import { v1 } from "@google-cloud/vision";
|
|
5
|
+
// class cloudVisionAPIClient {
|
|
6
|
+
// googleAuth: any;
|
|
7
|
+
// constructor(private env: RioEnv) {
|
|
8
|
+
// this.googleAuth = new google.auth.GoogleAuth({
|
|
9
|
+
// keyFile:
|
|
10
|
+
// "/etc/secrets/cloud-vision/cloud-vision-service-account-key.json",
|
|
11
|
+
// });
|
|
12
|
+
// }
|
|
13
|
+
// async getDataFromPDF(
|
|
14
|
+
// bucketName: string,
|
|
15
|
+
// fileName: string,
|
|
16
|
+
// outputPrefix: string
|
|
17
|
+
// ) {
|
|
18
|
+
// const client = new v1.ImageAnnotatorClient({
|
|
19
|
+
// auth: this.googleAuth,
|
|
20
|
+
// });
|
|
21
|
+
// const gcsSourceUri = `gs://${bucketName}/${fileName}`;
|
|
22
|
+
// const gcsDestinationUri = `gs://${bucketName}/${outputPrefix}/`;
|
|
23
|
+
// const inputConfig = {
|
|
24
|
+
// // Supported mime_types are: 'application/pdf' and 'image/tiff'
|
|
25
|
+
// mimeType: "application/pdf",
|
|
26
|
+
// gcsSource: {
|
|
27
|
+
// uri: gcsSourceUri,
|
|
28
|
+
// },
|
|
29
|
+
// };
|
|
30
|
+
// const outputConfig = {
|
|
31
|
+
// gcsDestination: {
|
|
32
|
+
// uri: gcsDestinationUri,
|
|
33
|
+
// },
|
|
34
|
+
// };
|
|
35
|
+
// const features = [{ type: "DOCUMENT_TEXT_DETECTION" }];
|
|
36
|
+
// const request = {
|
|
37
|
+
// requests: [
|
|
38
|
+
// {
|
|
39
|
+
// inputConfig: inputConfig,
|
|
40
|
+
// features: features,
|
|
41
|
+
// outputConfig: outputConfig,
|
|
42
|
+
// },
|
|
43
|
+
// ],
|
|
44
|
+
// };
|
|
45
|
+
// //@ts-ignore
|
|
46
|
+
// const [operation] = await client.asyncBatchAnnotateFiles(request);
|
|
47
|
+
// const [filesResponse] = await operation.promise();
|
|
48
|
+
// const destinationUri =
|
|
49
|
+
// filesResponse.responses[0].outputConfig.gcsDestination.uri;
|
|
50
|
+
// return destinationUri;
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
// export const googleVisionAPIClient = new cloudVisionAPIClient(
|
|
54
|
+
// (process.env.RIO_ENV as RioEnv) || (process.env.NEXT_PUBLIC_RIO_ENV as RioEnv)
|
|
55
|
+
// );
|
|
@@ -67,7 +67,6 @@ const buildCoincoverClient = () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
67
67
|
if (!COINCOVER_API_KEY) {
|
|
68
68
|
throw new common_1.SecretManagerError();
|
|
69
69
|
}
|
|
70
|
-
// Create GuenoClient instance and return
|
|
71
70
|
return new CoincoverClient(COINCOVER_API_KEY);
|
|
72
71
|
});
|
|
73
72
|
exports.buildCoincoverClient = buildCoincoverClient;
|
|
@@ -56,7 +56,6 @@ const buildCosignerClient = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
56
56
|
if (!COSIGNER_WEBHOOK_SECRET) {
|
|
57
57
|
throw new Error("Unable to get COSIGNER_WEBHOOK_SECRET");
|
|
58
58
|
}
|
|
59
|
-
// Create GuenoClient instance and return
|
|
60
59
|
return new CosignerClient(COSIGNER_API_KEY, COSIGNER_WEBHOOK_SECRET);
|
|
61
60
|
});
|
|
62
61
|
exports.buildCosignerClient = buildCosignerClient;
|
package/build/index.d.ts
CHANGED
|
@@ -59,30 +59,17 @@ export * from "./models/bank-account-verification";
|
|
|
59
59
|
export * from "./models/coincover-transaction";
|
|
60
60
|
export * from "./models/coinbase-order";
|
|
61
61
|
export * from "./models/multipart-liquidity-order";
|
|
62
|
-
export * from "./clients/bitstamp-client";
|
|
63
|
-
export * from "./clients/ccxt-client";
|
|
64
62
|
export * from "./clients/slack-client";
|
|
65
|
-
export * from "./clients/gueno-client";
|
|
66
63
|
export * from "./clients/fireblocks-client";
|
|
67
|
-
export * from "./clients/kapstar-client";
|
|
68
|
-
export * from "./clients/etherscan-client";
|
|
69
64
|
export * from "./clients/secret-manager-client";
|
|
70
65
|
export * from "./clients/gcloud-storage-client";
|
|
71
|
-
export * from "./clients/cloud-vision-api-client";
|
|
72
66
|
export * from "./clients/currency-api-client";
|
|
73
|
-
export * from "./clients/aiprise-client";
|
|
74
67
|
export * from "./clients/bridge-client";
|
|
75
|
-
export * from "./clients/google-sheets-api-client";
|
|
76
|
-
export * from "./clients/invopop-client";
|
|
77
68
|
export * from "./clients/cluster-client";
|
|
78
69
|
export * from "./clients/cosigner-client";
|
|
79
70
|
export * from "./clients/bitso-client";
|
|
80
71
|
export * from "./clients/circle-client";
|
|
81
|
-
export * from "./clients/polygon-client";
|
|
82
72
|
export * from "./clients/coincover-client";
|
|
83
|
-
export * from "./clients/fogbender-client";
|
|
84
|
-
export * from "./clients/brex-client";
|
|
85
|
-
export * from "./clients/coinbase-client";
|
|
86
73
|
export * from "./helpers/get-user-helper";
|
|
87
74
|
export * from "./helpers/get-processor-fees";
|
|
88
75
|
export * from "./helpers/get-network-fees";
|
|
@@ -93,10 +80,6 @@ export * from "./helpers/get-user";
|
|
|
93
80
|
export * from "./helpers/unescape";
|
|
94
81
|
export * from "./helpers/get-user-transaction-limits";
|
|
95
82
|
export * from "./helpers/sanitize-user-doc";
|
|
96
|
-
export * from "./helpers/sanitize-quote-doc";
|
|
97
|
-
export * from "./helpers/sanitize-order-doc";
|
|
98
|
-
export * from "./helpers/sanitize-chained-order-doc";
|
|
99
|
-
export * from "./helpers/get-polygon-exchange-rates";
|
|
100
83
|
export * from "./helpers/get-currency-api-exchange-rates";
|
|
101
84
|
export * from "./helpers/get-tax-rate";
|
|
102
85
|
export * from "./helpers/get-asset-price";
|
package/build/index.js
CHANGED
|
@@ -75,30 +75,17 @@ __exportStar(require("./models/bank-account-verification"), exports);
|
|
|
75
75
|
__exportStar(require("./models/coincover-transaction"), exports);
|
|
76
76
|
__exportStar(require("./models/coinbase-order"), exports);
|
|
77
77
|
__exportStar(require("./models/multipart-liquidity-order"), exports);
|
|
78
|
-
__exportStar(require("./clients/bitstamp-client"), exports);
|
|
79
|
-
__exportStar(require("./clients/ccxt-client"), exports);
|
|
80
78
|
__exportStar(require("./clients/slack-client"), exports);
|
|
81
|
-
__exportStar(require("./clients/gueno-client"), exports);
|
|
82
79
|
__exportStar(require("./clients/fireblocks-client"), exports);
|
|
83
|
-
__exportStar(require("./clients/kapstar-client"), exports);
|
|
84
|
-
__exportStar(require("./clients/etherscan-client"), exports);
|
|
85
80
|
__exportStar(require("./clients/secret-manager-client"), exports);
|
|
86
81
|
__exportStar(require("./clients/gcloud-storage-client"), exports);
|
|
87
|
-
__exportStar(require("./clients/cloud-vision-api-client"), exports);
|
|
88
82
|
__exportStar(require("./clients/currency-api-client"), exports);
|
|
89
|
-
__exportStar(require("./clients/aiprise-client"), exports);
|
|
90
83
|
__exportStar(require("./clients/bridge-client"), exports);
|
|
91
|
-
__exportStar(require("./clients/google-sheets-api-client"), exports);
|
|
92
|
-
__exportStar(require("./clients/invopop-client"), exports);
|
|
93
84
|
__exportStar(require("./clients/cluster-client"), exports);
|
|
94
85
|
__exportStar(require("./clients/cosigner-client"), exports);
|
|
95
86
|
__exportStar(require("./clients/bitso-client"), exports);
|
|
96
87
|
__exportStar(require("./clients/circle-client"), exports);
|
|
97
|
-
__exportStar(require("./clients/polygon-client"), exports);
|
|
98
88
|
__exportStar(require("./clients/coincover-client"), exports);
|
|
99
|
-
__exportStar(require("./clients/fogbender-client"), exports);
|
|
100
|
-
__exportStar(require("./clients/brex-client"), exports);
|
|
101
|
-
__exportStar(require("./clients/coinbase-client"), exports);
|
|
102
89
|
__exportStar(require("./helpers/get-user-helper"), exports);
|
|
103
90
|
__exportStar(require("./helpers/get-processor-fees"), exports);
|
|
104
91
|
__exportStar(require("./helpers/get-network-fees"), exports);
|
|
@@ -109,10 +96,6 @@ __exportStar(require("./helpers/get-user"), exports);
|
|
|
109
96
|
__exportStar(require("./helpers/unescape"), exports);
|
|
110
97
|
__exportStar(require("./helpers/get-user-transaction-limits"), exports);
|
|
111
98
|
__exportStar(require("./helpers/sanitize-user-doc"), exports);
|
|
112
|
-
__exportStar(require("./helpers/sanitize-quote-doc"), exports);
|
|
113
|
-
__exportStar(require("./helpers/sanitize-order-doc"), exports);
|
|
114
|
-
__exportStar(require("./helpers/sanitize-chained-order-doc"), exports);
|
|
115
|
-
__exportStar(require("./helpers/get-polygon-exchange-rates"), exports);
|
|
116
99
|
__exportStar(require("./helpers/get-currency-api-exchange-rates"), exports);
|
|
117
100
|
__exportStar(require("./helpers/get-tax-rate"), exports);
|
|
118
101
|
__exportStar(require("./helpers/get-asset-price"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1677",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -23,26 +23,20 @@
|
|
|
23
23
|
"typescript": "^4.7.4"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
|
+
"@google-cloud/secret-manager": "^5.3.0",
|
|
28
27
|
"@google-cloud/storage": "^6.9.5",
|
|
29
|
-
"@google-cloud/vision": "^4.0.2",
|
|
30
28
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
29
|
+
"@riocrypto/common": "^1.0.1476",
|
|
32
30
|
"@types/express": "^4.17.13",
|
|
33
31
|
"axios": "^1.6.0",
|
|
34
|
-
"ccxt": "^3.0.30",
|
|
35
32
|
"crypto-js": "^4.2.0",
|
|
36
33
|
"express": "^4.18.1",
|
|
37
34
|
"express-validator": "^6.14.2",
|
|
38
35
|
"fireblocks-sdk": "^4.0.0",
|
|
39
|
-
"google-auth-library": "^9.0.0",
|
|
40
|
-
"googleapis": "^123.0.0",
|
|
41
36
|
"he": "^1.2.0",
|
|
42
37
|
"jsonwebtoken": "^9.0.1",
|
|
43
38
|
"mongoose": "^7.6.8",
|
|
44
39
|
"node-cache": "^5.1.2",
|
|
45
|
-
"node-nats-streaming": "^0.3.2",
|
|
46
40
|
"uuid": "^9.0.0",
|
|
47
41
|
"winston": "^3.11.0"
|
|
48
42
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare class AiPriseClient {
|
|
2
|
-
private apiKey;
|
|
3
|
-
private decafApiKey;
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
constructor(apiKey: string, decafApiKey: string);
|
|
6
|
-
createVerificationLink(userId: string, firstName: string, lastName: string, metadata?: Object): Promise<string>;
|
|
7
|
-
createVerificationLinkWithoutName(): Promise<string>;
|
|
8
|
-
getVerificationResult(sessionId: string, partner?: "decaf"): Promise<any>;
|
|
9
|
-
private getCallbackUrl;
|
|
10
|
-
private getRedirectUrl;
|
|
11
|
-
}
|
|
12
|
-
export declare const buildAiPriseClient: () => Promise<AiPriseClient>;
|
|
13
|
-
export {};
|
|
@@ -1,109 +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.buildAiPriseClient = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const secret_manager_client_1 = require("./secret-manager-client");
|
|
18
|
-
const common_1 = require("@riocrypto/common");
|
|
19
|
-
class AiPriseClient {
|
|
20
|
-
constructor(apiKey, decafApiKey) {
|
|
21
|
-
this.apiKey = apiKey;
|
|
22
|
-
this.decafApiKey = decafApiKey;
|
|
23
|
-
this.getCallbackUrl = (rioEnv) => {
|
|
24
|
-
switch (rioEnv) {
|
|
25
|
-
case common_1.RioEnv.Local:
|
|
26
|
-
return "localhost/api/kyc/notifications/aiprise";
|
|
27
|
-
case common_1.RioEnv.Development:
|
|
28
|
-
return "https://dev.riotransfer.co/api/kyc/notifications/aiprise";
|
|
29
|
-
case common_1.RioEnv.Sandbox:
|
|
30
|
-
return "https://sandbox.riotransfer.co/api/kyc/notifications/aiprise";
|
|
31
|
-
case common_1.RioEnv.Staging:
|
|
32
|
-
return "https://staging.riotransfer.co/api/kyc/notifications/aiprise";
|
|
33
|
-
case common_1.RioEnv.Production:
|
|
34
|
-
return "https://www.riotransfer.co/api/kyc/notifications/aiprise";
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
this.getRedirectUrl = (rioEnv) => {
|
|
38
|
-
switch (rioEnv) {
|
|
39
|
-
case common_1.RioEnv.Local:
|
|
40
|
-
return "https://sandbox.riotransfer.co";
|
|
41
|
-
case common_1.RioEnv.Development:
|
|
42
|
-
return "https://dev.riotransfer.co";
|
|
43
|
-
case common_1.RioEnv.Sandbox:
|
|
44
|
-
return "https://sandbox.riotransfer.co";
|
|
45
|
-
case common_1.RioEnv.Staging:
|
|
46
|
-
return "https://staging.riotransfer.co";
|
|
47
|
-
case common_1.RioEnv.Production:
|
|
48
|
-
return "https://www.riotransfer.co";
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
this.baseUrl = [common_1.RioEnv.Staging, common_1.RioEnv.Production].includes(process.env.RIO_ENV)
|
|
52
|
-
? "api"
|
|
53
|
-
: "api-sandbox";
|
|
54
|
-
}
|
|
55
|
-
createVerificationLink(userId, firstName, lastName, metadata) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const response = yield axios_1.default.post(`https://${this.baseUrl}.aiprise.com/api/v1/verify/get_user_verification_url`, {
|
|
58
|
-
template_id: "15cd1203-5c60-470b-8cbc-4d806433c7b7",
|
|
59
|
-
client_reference_id: userId,
|
|
60
|
-
user_data: {
|
|
61
|
-
first_name: firstName,
|
|
62
|
-
last_name: lastName,
|
|
63
|
-
},
|
|
64
|
-
redirect_uri: this.getRedirectUrl(process.env.RIO_ENV),
|
|
65
|
-
callback_url: this.getCallbackUrl(process.env.RIO_ENV),
|
|
66
|
-
client_reference_data: metadata,
|
|
67
|
-
}, {
|
|
68
|
-
headers: {
|
|
69
|
-
"X-API-KEY": this.apiKey,
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
return response.data.verification_url;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
createVerificationLinkWithoutName() {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const response = yield axios_1.default.post(`https://${this.baseUrl}.aiprise.com/api/v1/verify/get_user_verification_url`, {
|
|
78
|
-
template_id: "15cd1203-5c60-470b-8cbc-4d806433c7b7",
|
|
79
|
-
redirect_uri: this.getRedirectUrl(process.env.RIO_ENV),
|
|
80
|
-
}, {
|
|
81
|
-
headers: {
|
|
82
|
-
"X-API-KEY": this.apiKey,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
return response.data.verification_url;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
getVerificationResult(sessionId, partner) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const apiKey = partner === "decaf" ? this.decafApiKey : this.apiKey;
|
|
91
|
-
const response = yield axios_1.default.get(`https://${this.baseUrl}.aiprise.com/api/v1/verify/get_user_verification_result/${sessionId}`, {
|
|
92
|
-
headers: {
|
|
93
|
-
"X-API-KEY": apiKey,
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
return response.data;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const buildAiPriseClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
-
const AIPRISE_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("AIPRISE_API_KEY");
|
|
102
|
-
const DECAF_AIPRISE_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("DECAF_AIPRISE_API_KEY");
|
|
103
|
-
if (!AIPRISE_API_KEY || !DECAF_AIPRISE_API_KEY) {
|
|
104
|
-
throw new common_1.SecretManagerError();
|
|
105
|
-
}
|
|
106
|
-
// Create FixerClient instance and return
|
|
107
|
-
return new AiPriseClient(AIPRISE_API_KEY, DECAF_AIPRISE_API_KEY);
|
|
108
|
-
});
|
|
109
|
-
exports.buildAiPriseClient = buildAiPriseClient;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare class BitstampClient {
|
|
2
|
-
private apiKey;
|
|
3
|
-
private apiSecret;
|
|
4
|
-
constructor(apiKey: string, apiSecret: string);
|
|
5
|
-
getHeaders(payload?: any): Promise<{
|
|
6
|
-
"X-Auth": string;
|
|
7
|
-
"X-Auth-Signature": string;
|
|
8
|
-
"X-Auth-Nonce": string;
|
|
9
|
-
"X-Auth-Timestamp": string;
|
|
10
|
-
"X-Auth-Version": string;
|
|
11
|
-
"Content-Type": string;
|
|
12
|
-
}>;
|
|
13
|
-
getTransactions(limit: string, offset: string): Promise<any>;
|
|
14
|
-
}
|
|
15
|
-
export declare const buildBitstampClient: () => Promise<BitstampClient>;
|
|
16
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.buildBitstampClient = void 0;
|
|
39
|
-
const axios_1 = __importDefault(require("axios"));
|
|
40
|
-
const crypto = __importStar(require("crypto"));
|
|
41
|
-
const uuid = __importStar(require("uuid"));
|
|
42
|
-
const secret_manager_client_1 = require("./secret-manager-client");
|
|
43
|
-
const common_1 = require("@riocrypto/common");
|
|
44
|
-
class BitstampClient {
|
|
45
|
-
constructor(apiKey, apiSecret) {
|
|
46
|
-
this.apiKey = apiKey;
|
|
47
|
-
this.apiSecret = apiSecret;
|
|
48
|
-
}
|
|
49
|
-
getHeaders(payload) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const timestamp = String(Math.round(Date.now()));
|
|
52
|
-
const nonce = uuid.v4().toString();
|
|
53
|
-
const content_type = "application/x-www-form-urlencoded";
|
|
54
|
-
let payload_string = new URLSearchParams(payload).toString();
|
|
55
|
-
const message = `BITSTAMP ${this.apiKey}POSTwww.bitstamp.net/api/v2/crypto-transactions/${content_type}${nonce}${timestamp}v2${payload_string}`;
|
|
56
|
-
const message_encoded = new TextEncoder().encode(message);
|
|
57
|
-
const signature = crypto
|
|
58
|
-
.createHmac("sha256", this.apiSecret)
|
|
59
|
-
.update(message_encoded)
|
|
60
|
-
.digest("hex");
|
|
61
|
-
const headers = {
|
|
62
|
-
"X-Auth": `BITSTAMP ${this.apiKey}`,
|
|
63
|
-
"X-Auth-Signature": signature,
|
|
64
|
-
"X-Auth-Nonce": nonce,
|
|
65
|
-
"X-Auth-Timestamp": timestamp,
|
|
66
|
-
"X-Auth-Version": "v2",
|
|
67
|
-
"Content-Type": content_type,
|
|
68
|
-
};
|
|
69
|
-
return headers;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
getTransactions(limit, offset) {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const payload = { offset, limit };
|
|
75
|
-
let payload_string = new URLSearchParams(payload).toString();
|
|
76
|
-
const headers = yield this.getHeaders(payload);
|
|
77
|
-
const response = yield axios_1.default.post("https://www.bitstamp.net/api/v2/crypto-transactions/", payload_string, { headers });
|
|
78
|
-
if (response.status !== 200) {
|
|
79
|
-
throw new common_1.GenericInternalError("Status code not 200");
|
|
80
|
-
}
|
|
81
|
-
return response.data;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const buildBitstampClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
-
const BITSTAMP_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("BITSTAMP_API_KEY");
|
|
87
|
-
if (!BITSTAMP_API_KEY) {
|
|
88
|
-
throw new common_1.SecretManagerError();
|
|
89
|
-
}
|
|
90
|
-
const BITSTAMP_SECRET = yield secret_manager_client_1.secretManagerClient.getSecretValue("BITSTAMP_SECRET");
|
|
91
|
-
if (!BITSTAMP_SECRET) {
|
|
92
|
-
throw new common_1.SecretManagerError();
|
|
93
|
-
}
|
|
94
|
-
const bitstampClient = new BitstampClient(BITSTAMP_API_KEY, BITSTAMP_SECRET);
|
|
95
|
-
return bitstampClient;
|
|
96
|
-
});
|
|
97
|
-
exports.buildBitstampClient = buildBitstampClient;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare class BrexClient {
|
|
2
|
-
private apiKey;
|
|
3
|
-
private baseUrl;
|
|
4
|
-
constructor(apiKey: string);
|
|
5
|
-
getTransfer(brexTransferId: string): Promise<{
|
|
6
|
-
processDate: Date;
|
|
7
|
-
status: "PROCESSED";
|
|
8
|
-
amount: number;
|
|
9
|
-
paymentType: "INTERNATIONAL_WIRE" | "DOMESTIC_WIRE";
|
|
10
|
-
accountNumber: string;
|
|
11
|
-
}>;
|
|
12
|
-
createTransferToCoinbase(amount: number, idempotencyKey: string): Promise<{
|
|
13
|
-
id: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
export declare const buildBrexClient: () => Promise<BrexClient>;
|
|
17
|
-
export {};
|
|
@@ -1,92 +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.buildBrexClient = void 0;
|
|
16
|
-
const secret_manager_client_1 = require("./secret-manager-client");
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
const common_1 = require("@riocrypto/common");
|
|
19
|
-
class BrexClient {
|
|
20
|
-
constructor(apiKey) {
|
|
21
|
-
this.apiKey = apiKey;
|
|
22
|
-
if ([common_1.RioEnv.Development, common_1.RioEnv.Production, common_1.RioEnv.Staging].includes(process.env.RIO_ENV)) {
|
|
23
|
-
this.baseUrl = "https://platform.brexapis.com";
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
throw new common_1.GenericInputError("Brex client cannot be initialized in this environment");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
getTransfer(brexTransferId) {
|
|
30
|
-
var _a;
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const { data } = yield axios_1.default.get(`${this.baseUrl}/v1/transfers/${brexTransferId}`, {
|
|
33
|
-
headers: {
|
|
34
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
processDate: new Date(data.process_date),
|
|
39
|
-
status: data.status,
|
|
40
|
-
amount: Math.abs(data.amount.amount),
|
|
41
|
-
paymentType: data.payment_type,
|
|
42
|
-
accountNumber: (_a = data.counterparty) === null || _a === void 0 ? void 0 : _a.account_number,
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
createTransferToCoinbase(amount, idempotencyKey) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const COINBASE_PAYMENT_INSTRUMENT_ID_FOR_BREX = yield secret_manager_client_1.secretManagerClient.getSecretValue("COINBASE_PAYMENT_INSTRUMENT_ID_FOR_BREX");
|
|
49
|
-
if (!COINBASE_PAYMENT_INSTRUMENT_ID_FOR_BREX) {
|
|
50
|
-
throw new common_1.SecretManagerError();
|
|
51
|
-
}
|
|
52
|
-
const BREX_CASH_ACCOUNT_ID = yield secret_manager_client_1.secretManagerClient.getSecretValue("BREX_CASH_ACCOUNT_ID");
|
|
53
|
-
if (!BREX_CASH_ACCOUNT_ID) {
|
|
54
|
-
throw new common_1.SecretManagerError();
|
|
55
|
-
}
|
|
56
|
-
const { data } = yield axios_1.default.post(`${this.baseUrl}/v1/transfers`, {
|
|
57
|
-
counterparty: {
|
|
58
|
-
type: "VENDOR",
|
|
59
|
-
payment_instrument_id: COINBASE_PAYMENT_INSTRUMENT_ID_FOR_BREX,
|
|
60
|
-
},
|
|
61
|
-
amount: {
|
|
62
|
-
amount: amount * 100,
|
|
63
|
-
currency: "USD",
|
|
64
|
-
},
|
|
65
|
-
description: "Transfer to Coinbase for liquidity order with ID: " + idempotencyKey,
|
|
66
|
-
external_memo: "Rampa Labs Incorporated",
|
|
67
|
-
originating_account: {
|
|
68
|
-
type: "BREX_CASH",
|
|
69
|
-
id: BREX_CASH_ACCOUNT_ID,
|
|
70
|
-
},
|
|
71
|
-
}, {
|
|
72
|
-
headers: {
|
|
73
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
74
|
-
"Idempotency-Key": idempotencyKey,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
id: data.id,
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const buildBrexClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
// Retrieve secrets asynchronously
|
|
85
|
-
const BREX_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("BREX_API_KEY");
|
|
86
|
-
if (!BREX_API_KEY) {
|
|
87
|
-
throw new common_1.SecretManagerError();
|
|
88
|
-
}
|
|
89
|
-
// Create GuenoClient instance and return
|
|
90
|
-
return new BrexClient(BREX_API_KEY);
|
|
91
|
-
});
|
|
92
|
-
exports.buildBrexClient = buildBrexClient;
|