@spritz-finance/service-client 0.32.0 → 0.32.2

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.
@@ -52,6 +52,7 @@ export declare enum FeatureFlag {
52
52
  BinanceBridgeEnabled = "binanceBridge.enabled",
53
53
  CheckbookAutomatedWires = "checkbook.automatedWires",
54
54
  CircleFundTransfers = "circle.fundTransfers",
55
+ SolanaOnrampPrefund = "solana.onrampPrefund",
55
56
  FalconXFundTransfers = "falconx.fundTransfers",
56
57
  CoinbaseFundTransfers = "coinbase.fundTransfers",
57
58
  RunCheckbookBatch = "checkbook.runBatch",
@@ -55,6 +55,7 @@ var FeatureFlag;
55
55
  FeatureFlag["BinanceBridgeEnabled"] = "binanceBridge.enabled";
56
56
  FeatureFlag["CheckbookAutomatedWires"] = "checkbook.automatedWires";
57
57
  FeatureFlag["CircleFundTransfers"] = "circle.fundTransfers";
58
+ FeatureFlag["SolanaOnrampPrefund"] = "solana.onrampPrefund";
58
59
  FeatureFlag["FalconXFundTransfers"] = "falconx.fundTransfers";
59
60
  FeatureFlag["CoinbaseFundTransfers"] = "coinbase.fundTransfers";
60
61
  FeatureFlag["RunCheckbookBatch"] = "checkbook.runBatch";
@@ -1,6 +1,7 @@
1
1
  export * as RainClient from "./rainServiceClient";
2
2
  import { VirtualCardStatus } from "../payableAccounts/types";
3
3
  import { ApplicationStatus, CardDetailsResponse, CardOrderStatus, CardType, CreateRainApplicationInput, OrderPhysicalCardInput, OrderPhysicalCardResponse, RainCard, RainContract, RainUser, ShippingDetails, WithdrawalSignature } from "./types";
4
+ export declare const CREATE_CARD_APPLICATION_TIMEOUT_MS = 28000;
4
5
  export declare function createCardApplication(userId: string, input: CreateRainApplicationInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RainUser>>;
5
6
  export declare function getUserDepositAddress({ userId, network, }: {
6
7
  userId: string;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.RainClient = void 0;
36
+ exports.CREATE_CARD_APPLICATION_TIMEOUT_MS = exports.RainClient = void 0;
37
37
  exports.createCardApplication = createCardApplication;
38
38
  exports.getUserDepositAddress = getUserDepositAddress;
39
39
  exports.validateContractAddress = validateContractAddress;
@@ -51,9 +51,21 @@ exports.RainClient = __importStar(require("./rainServiceClient"));
51
51
  const restClient_1 = require("../restClient");
52
52
  const baseClient = (0, restClient_1.getRestClient)(process.env.RAIN_SERVICE_API_IAM_URL, "/rain-v2/api");
53
53
  const RAIN_ENDPOINT = "/rain-v2";
54
+ // Rain's CreateRainApplication submits the application and uploads the ID
55
+ // documents, which takes 10-18s in production. The 10s DEFAULT_TIMEOUT_MS
56
+ // aborted the caller while Rain went on to create the application, so the
57
+ // user saw an error for an application that succeeded. Stay under the 30s
58
+ // Lambda timeout on both sides.
59
+ exports.CREATE_CARD_APPLICATION_TIMEOUT_MS = 28000;
54
60
  async function createCardApplication(userId, input) {
55
61
  return baseClient
56
- .post(`${RAIN_ENDPOINT}/application?userId=${userId}`, input)
62
+ .post(`${RAIN_ENDPOINT}/application?userId=${userId}`, input, {
63
+ timeout: exports.CREATE_CARD_APPLICATION_TIMEOUT_MS,
64
+ // Opt out of the shared 502 retry: a 502 can arrive after Rain already
65
+ // created the application, a repeat create fails, and a second 28s
66
+ // attempt would outlast the caller's 30s Lambda.
67
+ headers: { "x-retry-attempt": "true" },
68
+ })
57
69
  .then((res) => res.data);
58
70
  }
59
71
  async function getUserDepositAddress({ userId, network, }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",