@riocrypto/common-server 1.0.1652 → 1.0.1653

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.
@@ -9,6 +9,9 @@ declare class BrexClient {
9
9
  paymentType: "INTERNATIONAL_WIRE" | "DOMESTIC_WIRE";
10
10
  accountNumber: string;
11
11
  }>;
12
+ createTransferToCoinbase(amount: number, idempotencyKey: string): Promise<{
13
+ id: string;
14
+ }>;
12
15
  }
13
16
  export declare const buildBrexClient: () => Promise<BrexClient>;
14
17
  export {};
@@ -43,6 +43,43 @@ class BrexClient {
43
43
  };
44
44
  });
45
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
+ approval_type: "MANUAL",
67
+ external_memo: "Rampa Labs Incorporated",
68
+ originating_account: {
69
+ type: "BREX_CASH",
70
+ id: BREX_CASH_ACCOUNT_ID,
71
+ },
72
+ }, {
73
+ headers: {
74
+ Authorization: `Bearer ${this.apiKey}`,
75
+ "Idempotency-Key": idempotencyKey,
76
+ },
77
+ });
78
+ return {
79
+ id: data.id,
80
+ };
81
+ });
82
+ }
46
83
  }
47
84
  const buildBrexClient = () => __awaiter(void 0, void 0, void 0, function* () {
48
85
  // Retrieve secrets asynchronously
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1652",
3
+ "version": "1.0.1653",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",