@spritz-finance/service-client 0.3.74 → 0.3.76

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.
@@ -3,6 +3,12 @@ import { BridgeUser } from '../onramp/types';
3
3
  import { BridgeExternalAccount, BridgeNetwork, BridgeTransfer, BridgeTransferOffRampPaymentRail, CreateBridgeAccountParams } from './types';
4
4
  export declare function createBridgeBankAccount(userId: string, accountId: string, input: CreateBridgeAccountParams): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeExternalAccount>>;
5
5
  export declare function getBridgeUser(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeUser>>;
6
+ export declare function validateTransfer({ userId, transferId, amount, toAddress, }: {
7
+ userId: string;
8
+ transferId: string;
9
+ amount: number;
10
+ toAddress: string;
11
+ }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
6
12
  export declare function createBridgeTransfer(userId: string, input: {
7
13
  amount: number;
8
14
  token: string;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createBridgeTransfer = exports.getBridgeUser = exports.createBridgeBankAccount = exports.BridgeClient = void 0;
26
+ exports.createBridgeTransfer = exports.validateTransfer = exports.getBridgeUser = exports.createBridgeBankAccount = exports.BridgeClient = void 0;
27
27
  exports.BridgeClient = __importStar(require("./bridgeServiceClient"));
28
28
  const serviceClient_1 = require("../serviceClient");
29
29
  const ONRAMP_ENDPOINT = '/bridge';
@@ -39,6 +39,17 @@ async function getBridgeUser(userId) {
39
39
  .then((res) => res.data);
40
40
  }
41
41
  exports.getBridgeUser = getBridgeUser;
42
+ async function validateTransfer({ userId, transferId, amount, toAddress, }) {
43
+ return serviceClient_1.baseClient
44
+ .post(`${ONRAMP_ENDPOINT}/transfer/validate`, {
45
+ userId,
46
+ transferId,
47
+ amount,
48
+ toAddress,
49
+ })
50
+ .then((res) => res.data);
51
+ }
52
+ exports.validateTransfer = validateTransfer;
42
53
  async function createBridgeTransfer(userId, input) {
43
54
  return serviceClient_1.baseClient
44
55
  .post(`${ONRAMP_ENDPOINT}/user/${userId}/transfer`, input)
@@ -1,5 +1,6 @@
1
- type CryptoPayoutNetwork = 'arbitrum' | 'base' | 'polygon' | 'optimism' | 'avalanche' | 'ethereum';
2
- type CryptoPayoutType = 'BRIDGE_TRANSFER' | 'RAIN_CARD_DEPOSIT';
1
+ export type CryptoPayoutNetwork = 'arbitrum' | 'base' | 'polygon' | 'optimism' | 'avalanche' | 'ethereum';
2
+ export declare function isCryptoPayoutNetwork(network: string): network is CryptoPayoutNetwork;
3
+ export type CryptoPayoutType = 'BRIDGE_TRANSFER' | 'RAIN_CARD_DEPOSIT';
3
4
  export type CryptoPayoutInput = {
4
5
  userId: string;
5
6
  network: CryptoPayoutNetwork;
@@ -30,4 +31,3 @@ export type CryptoPayout = {
30
31
  createdAt: string;
31
32
  updatedAt: string;
32
33
  };
33
- export {};
@@ -1,2 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCryptoPayoutNetwork = void 0;
4
+ function isCryptoPayoutNetwork(network) {
5
+ return [
6
+ 'arbitrum',
7
+ 'base',
8
+ 'polygon',
9
+ 'optimism',
10
+ 'avalanche',
11
+ 'ethereum',
12
+ ].includes(network);
13
+ }
14
+ exports.isCryptoPayoutNetwork = isCryptoPayoutNetwork;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.3.74",
3
+ "version": "0.3.76",
4
4
  "description": "Service client",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",