@huma-finance/shared 0.0.18 → 0.0.19

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.
@@ -72,7 +72,7 @@ export type ApprovalResult = {
72
72
  * Object representing the receivable in an underwriting request.
73
73
  * @typedef {Object} ReceivableRequest
74
74
  * @property {string} [address] The address of the receivable asset contract.
75
- * @property {string} [param] The parameter for the receivable asset.
75
+ * @property {string} [param] The parameter for the receivable asset. E.g. Token ID.
76
76
  */
77
77
  type ReceivableRequest = {
78
78
  address: string;
@@ -84,7 +84,7 @@ type ReceivableRequest = {
84
84
  * @property {ReceivableRequest} receivable The receivable information.
85
85
  */
86
86
  type EARequestContextReceivable = {
87
- receivable: ReceivableRequest;
87
+ requestId: string;
88
88
  };
89
89
  /**
90
90
  * Object representing the additional data required for a stream factoring underwriting request.
@@ -98,16 +98,48 @@ type EARequestContextStream = {
98
98
  payerWalletAddress: string;
99
99
  superToken: string;
100
100
  };
101
+ /**
102
+ * Object that represents the payload for an underwriting request.
103
+ * @typedef {Object} EAContextStream
104
+ * @property {ReceivableRequest} receivable The receivable information.
105
+ * @property {string} payerWalletAddress The address of the payer.
106
+ * @property {string} superToken The address of the SuperToken contract.
107
+ */
101
108
  export type EAPayload = {
102
109
  poolAddress: string;
103
110
  borrowerWalletAddress: string;
104
111
  context?: EARequestContextReceivable | EARequestContextStream;
105
112
  };
113
+ /**
114
+ * Object representing the response to the underwriting approval request.
115
+ * @typedef {Object} ApprovalResult
116
+ * @property {Approval | Rejection} result the EA decision, either an approval or rejection.
117
+ */
118
+ export type PreapprovalResult = {
119
+ approved: boolean;
120
+ rejectionReasons?: string[];
121
+ };
122
+ type EAPreapproveContextReceivable = {
123
+ payerWalletAddress: string;
124
+ };
125
+ /**
126
+ * Object that represents the payload for a preapprove check.
127
+ * @typedef {Object} EAContextStream
128
+ * @property {ReceivableRequest} receivable The receivable information.
129
+ * @property {string} payerWalletAddress The address of the payer.
130
+ * @property {string} superToken The address of the SuperToken contract.
131
+ */
132
+ export type EAPreapprovalPayload = {
133
+ poolAddress: string;
134
+ borrowerWalletAddress: string;
135
+ context?: EAPreapproveContextReceivable;
136
+ };
106
137
  export declare const EAService: {
107
138
  approve: (payload: EAPayload, chainId: number, isDev?: boolean) => Promise<Approval>;
108
139
  approveLender: (payload: {
109
140
  poolAddress: string;
110
141
  lenderWalletAddress: string;
111
142
  }, chainId: number) => Promise<ApprovalResult>;
143
+ preapprove: (payload: EAPreapprovalPayload, chainId: number, isDev?: boolean) => Promise<PreapprovalResult>;
112
144
  };
113
145
  export {};
@@ -8,7 +8,9 @@ const request_1 = require("../utils/request");
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
9
  const isRejection = (obj) => obj !== null && typeof obj === 'object' && Array.isArray(obj.reasons);
10
10
  /**
11
- * Submits a credit underwriting request to Huma's EAVerse.
11
+ * Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
12
+ * in Huma's pools that can be drawn down by the borrower.
13
+ *
12
14
  * @param {EAPayload} payload The payload for the underwrite approval.
13
15
  * @param {number} chainId The chain ID.
14
16
  * @param {boolean} isDev Is dev environment or not.
@@ -37,6 +39,16 @@ const approve = async (payload, chainId, isDev = false) => {
37
39
  }
38
40
  return result;
39
41
  };
42
+ /**
43
+ * Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
44
+ * Note that this does not approve a creditline in Huma's pools and an approve call is still required.
45
+ *
46
+ * @param {EAPreapprovalPayload} payload The payload for the underwrite approval.
47
+ * @param {number} chainId The chain ID.
48
+ * @param {boolean} isDev Is dev environment or not.
49
+ * @returns {Promise<Approval>} Promise that returns the approval on success.
50
+ */
51
+ const preapprove = async (payload, chainId, isDev = true) => (0, request_1.requestPost)(`${config_1.configUtil.getEAVerseUrl(chainId, isDev)}/underwriter/pre-approve`, payload);
40
52
  const approveLender = async (payload, chainId) => {
41
53
  var _a, _b;
42
54
  const generalErrorMessage = 'Sorry, there was an error approving your wallet as a lender.';
@@ -64,5 +76,6 @@ const approveLender = async (payload, chainId) => {
64
76
  exports.EAService = {
65
77
  approve,
66
78
  approveLender,
79
+ preapprove,
67
80
  };
68
81
  //# sourceMappingURL=EAService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EAService.js","sourceRoot":"","sources":["../../../src/services/EAService.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,4CAAkD;AAClD,4CAA2C;AAC3C,8CAA8C;AAqH9C,8DAA8D;AAC9D,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAoB,EAAE,CACjD,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AAEvE;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG,KAAK,EAAE,OAAkB,EAAE,OAAe,EAAE,KAAK,GAAG,KAAK,EAAE,EAAE;IAC3E,MAAM,cAAc,GAAmB,MAAM,IAAA,qBAAW,EACtD,GAAG,mBAAU,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,yBAAyB,EACpE,OAAO,CACR,CAAA;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAA;IACjC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,MAAM,IAAI,yBAAgB,EAAE,CAAA;KAC7B;IACD,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,iDAAiD,EAAE;YACjE,KAAK,EAAE,cAAc;SACtB,CAAC,CAAA;KACH;IAED,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAC3C,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;QACtB,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACpD,KAAK,CAAC,oBAAoB,GAAG,IAAA,kBAAS,EACpC,MAAM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M,IAAI,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;SACzC;QACD,OAAO,IAAsB,CAAA;QAC7B,8DAA8D;KAC/D;IAAC,OAAO,KAAU,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,mBAAmB,EAAE;YACpD,KAAK,EAAE,cAAc;SACtB,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAEY,QAAA,SAAS,GAAG;IACvB,OAAO;IACP,aAAa;IACb,UAAU;CACX,CAAA"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requestPost = exports.requestGet = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const axios_1 = tslib_1.__importDefault(require("axios"));
4
6
  const requestGet = async (url) => {
5
7
  const config = {
6
8
  method: 'GET',
@@ -9,7 +11,7 @@ const requestGet = async (url) => {
9
11
  },
10
12
  };
11
13
  // @ts-ignore
12
- return window.fetch(url, config).then((response) => response.json());
14
+ return axios_1.default.get(url, {}, config).then((response) => response.json());
13
15
  };
14
16
  exports.requestGet = requestGet;
15
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -19,10 +21,11 @@ const requestPost = async (url, payload) => {
19
21
  headers: {
20
22
  'Content-Type': 'application/json',
21
23
  },
22
- body: JSON.stringify(payload),
23
24
  };
24
- // @ts-ignore
25
- return window.fetch(url, config).then((response) => response.json());
25
+ return (axios_1.default
26
+ .post(url, payload, config)
27
+ // @ts-ignore
28
+ .then((response) => response.json()));
26
29
  };
27
30
  exports.requestPost = requestPost;
28
31
  //# sourceMappingURL=request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/utils/request.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,KAAK,EAAK,GAAW,EAAE,EAAE;IACjD,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,KAAK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AAE,EAAE;IAChE,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAA;IAED,OAAO,CACL,eAAK;SACF,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC;QAC3B,aAAa;SACZ,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAO,CAAC,CAC5C,CAAA;AACH,CAAC,CAAA;AAdY,QAAA,WAAW,eAcvB"}
@@ -72,7 +72,7 @@ export type ApprovalResult = {
72
72
  * Object representing the receivable in an underwriting request.
73
73
  * @typedef {Object} ReceivableRequest
74
74
  * @property {string} [address] The address of the receivable asset contract.
75
- * @property {string} [param] The parameter for the receivable asset.
75
+ * @property {string} [param] The parameter for the receivable asset. E.g. Token ID.
76
76
  */
77
77
  type ReceivableRequest = {
78
78
  address: string;
@@ -84,7 +84,7 @@ type ReceivableRequest = {
84
84
  * @property {ReceivableRequest} receivable The receivable information.
85
85
  */
86
86
  type EARequestContextReceivable = {
87
- receivable: ReceivableRequest;
87
+ requestId: string;
88
88
  };
89
89
  /**
90
90
  * Object representing the additional data required for a stream factoring underwriting request.
@@ -98,16 +98,48 @@ type EARequestContextStream = {
98
98
  payerWalletAddress: string;
99
99
  superToken: string;
100
100
  };
101
+ /**
102
+ * Object that represents the payload for an underwriting request.
103
+ * @typedef {Object} EAContextStream
104
+ * @property {ReceivableRequest} receivable The receivable information.
105
+ * @property {string} payerWalletAddress The address of the payer.
106
+ * @property {string} superToken The address of the SuperToken contract.
107
+ */
101
108
  export type EAPayload = {
102
109
  poolAddress: string;
103
110
  borrowerWalletAddress: string;
104
111
  context?: EARequestContextReceivable | EARequestContextStream;
105
112
  };
113
+ /**
114
+ * Object representing the response to the underwriting approval request.
115
+ * @typedef {Object} ApprovalResult
116
+ * @property {Approval | Rejection} result the EA decision, either an approval or rejection.
117
+ */
118
+ export type PreapprovalResult = {
119
+ approved: boolean;
120
+ rejectionReasons?: string[];
121
+ };
122
+ type EAPreapproveContextReceivable = {
123
+ payerWalletAddress: string;
124
+ };
125
+ /**
126
+ * Object that represents the payload for a preapprove check.
127
+ * @typedef {Object} EAContextStream
128
+ * @property {ReceivableRequest} receivable The receivable information.
129
+ * @property {string} payerWalletAddress The address of the payer.
130
+ * @property {string} superToken The address of the SuperToken contract.
131
+ */
132
+ export type EAPreapprovalPayload = {
133
+ poolAddress: string;
134
+ borrowerWalletAddress: string;
135
+ context?: EAPreapproveContextReceivable;
136
+ };
106
137
  export declare const EAService: {
107
138
  approve: (payload: EAPayload, chainId: number, isDev?: boolean) => Promise<Approval>;
108
139
  approveLender: (payload: {
109
140
  poolAddress: string;
110
141
  lenderWalletAddress: string;
111
142
  }, chainId: number) => Promise<ApprovalResult>;
143
+ preapprove: (payload: EAPreapprovalPayload, chainId: number, isDev?: boolean) => Promise<PreapprovalResult>;
112
144
  };
113
145
  export {};
@@ -5,7 +5,9 @@ import { requestPost } from '../utils/request';
5
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
6
  const isRejection = (obj) => obj !== null && typeof obj === 'object' && Array.isArray(obj.reasons);
7
7
  /**
8
- * Submits a credit underwriting request to Huma's EAVerse.
8
+ * Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
9
+ * in Huma's pools that can be drawn down by the borrower.
10
+ *
9
11
  * @param {EAPayload} payload The payload for the underwrite approval.
10
12
  * @param {number} chainId The chain ID.
11
13
  * @param {boolean} isDev Is dev environment or not.
@@ -34,6 +36,16 @@ const approve = async (payload, chainId, isDev = false) => {
34
36
  }
35
37
  return result;
36
38
  };
39
+ /**
40
+ * Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
41
+ * Note that this does not approve a creditline in Huma's pools and an approve call is still required.
42
+ *
43
+ * @param {EAPreapprovalPayload} payload The payload for the underwrite approval.
44
+ * @param {number} chainId The chain ID.
45
+ * @param {boolean} isDev Is dev environment or not.
46
+ * @returns {Promise<Approval>} Promise that returns the approval on success.
47
+ */
48
+ const preapprove = async (payload, chainId, isDev = true) => requestPost(`${configUtil.getEAVerseUrl(chainId, isDev)}/underwriter/pre-approve`, payload);
37
49
  const approveLender = async (payload, chainId) => {
38
50
  var _a, _b;
39
51
  const generalErrorMessage = 'Sorry, there was an error approving your wallet as a lender.';
@@ -61,5 +73,6 @@ const approveLender = async (payload, chainId) => {
61
73
  export const EAService = {
62
74
  approve,
63
75
  approveLender,
76
+ preapprove,
64
77
  };
65
78
  //# sourceMappingURL=EAService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EAService.js","sourceRoot":"","sources":["../../src/services/EAService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAqH9C,8DAA8D;AAC9D,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAoB,EAAE,CACjD,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AAEvE;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG,KAAK,EAAE,OAAkB,EAAE,OAAe,EAAE,KAAK,GAAG,KAAK,EAAE,EAAE;IAC3E,MAAM,cAAc,GAAmB,MAAM,WAAW,CACtD,GAAG,UAAU,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,yBAAyB,EACpE,OAAO,CACR,CAAA;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAA;IACjC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,MAAM,IAAI,gBAAgB,EAAE,CAAA;KAC7B;IACD,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IA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