@spritz-finance/service-client 0.3.85 → 0.3.87

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.
@@ -1,3 +1,12 @@
1
1
  export * as RainClient from './rainServiceClient';
2
- import { CreateRainApplicationInput, RainUser } from './types';
2
+ import { CreateRainApplicationInput, RainContract, RainUser } from './types';
3
3
  export declare function createCardApplication(userId: string, input: CreateRainApplicationInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RainUser>>;
4
+ export declare function getUserDepositAddress({ userId, network, }: {
5
+ userId: string;
6
+ network: string;
7
+ }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RainContract>>;
8
+ export declare function validateContractAddress(input: {
9
+ userId: string;
10
+ network: string;
11
+ contractAddress: string;
12
+ }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
@@ -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.createCardApplication = exports.RainClient = void 0;
26
+ exports.validateContractAddress = exports.getUserDepositAddress = exports.createCardApplication = exports.RainClient = void 0;
27
27
  exports.RainClient = __importStar(require("./rainServiceClient"));
28
28
  const serviceClient_1 = require("../serviceClient");
29
29
  const RAIN_ENDPOINT = '/rain-v2';
@@ -33,3 +33,15 @@ async function createCardApplication(userId, input) {
33
33
  .then((res) => res.data);
34
34
  }
35
35
  exports.createCardApplication = createCardApplication;
36
+ async function getUserDepositAddress({ userId, network, }) {
37
+ return serviceClient_1.baseClient
38
+ .get(`${RAIN_ENDPOINT}/user/${userId}/deposit-address?network=${network}`)
39
+ .then((res) => res.data);
40
+ }
41
+ exports.getUserDepositAddress = getUserDepositAddress;
42
+ async function validateContractAddress(input) {
43
+ return serviceClient_1.baseClient
44
+ .post(`${RAIN_ENDPOINT}/contract/validate`, input)
45
+ .then((res) => res.data);
46
+ }
47
+ exports.validateContractAddress = validateContractAddress;
@@ -15,3 +15,20 @@ export type RainUser = {
15
15
  createdAt: string;
16
16
  updatedAt: string;
17
17
  };
18
+ export type RainContract = {
19
+ id: string;
20
+ externalId: string;
21
+ userId: string;
22
+ chainId: string;
23
+ network: string;
24
+ controllerAddress: string;
25
+ proxyAddress: string;
26
+ depositAddress: string;
27
+ contractVersion: number;
28
+ tokens: {
29
+ address: string;
30
+ balance: string;
31
+ exchangeRate: number;
32
+ advanceRate: string;
33
+ }[];
34
+ };
@@ -6,6 +6,9 @@ export declare function getUserOpsSigner(input: {
6
6
  userId: string;
7
7
  signerType: OpsSignerType;
8
8
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<UserOpsSigner>>;
9
+ export declare function getUserOpsSignerByAddress(input: {
10
+ address: `0x${string}`;
11
+ }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<UserOpsSigner>>;
9
12
  export declare function getSmartAccountAddress(input: {
10
13
  userId: string;
11
14
  usageType: SignerUsageType;
@@ -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.createUserOpsSigner = exports.getSmartAccountAddress = exports.getUserOpsSigner = exports.getTokenBalances = exports.getExactInQuote = exports.Web3Client = void 0;
26
+ exports.createUserOpsSigner = exports.getSmartAccountAddress = exports.getUserOpsSignerByAddress = exports.getUserOpsSigner = exports.getTokenBalances = exports.getExactInQuote = exports.Web3Client = void 0;
27
27
  exports.Web3Client = __importStar(require("./web3ServiceClient"));
28
28
  const serviceClient_1 = require("../serviceClient");
29
29
  const WEB3_ENDPOINT = '/web3';
@@ -45,6 +45,12 @@ async function getUserOpsSigner(input) {
45
45
  .then((res) => res.data);
46
46
  }
47
47
  exports.getUserOpsSigner = getUserOpsSigner;
48
+ async function getUserOpsSignerByAddress(input) {
49
+ return serviceClient_1.baseClient
50
+ .get(`${WEB3_ENDPOINT}/ops-signer/address?address=${input.address}`)
51
+ .then((res) => res.data);
52
+ }
53
+ exports.getUserOpsSignerByAddress = getUserOpsSignerByAddress;
48
54
  async function getSmartAccountAddress(input) {
49
55
  return serviceClient_1.baseClient
50
56
  .get(`${WEB3_ENDPOINT}/ops-signer/smart-account/${input.userId}?usageType=${input.usageType}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.3.85",
3
+ "version": "0.3.87",
4
4
  "description": "Service client",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",