@huma-finance/soroban-pool-credit 0.0.8-beta.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.
package/src/index.ts ADDED
@@ -0,0 +1,453 @@
1
+ import { ContractSpec, Address } from '@stellar/stellar-sdk'
2
+ import { Buffer } from 'buffer'
3
+ import {
4
+ AssembledTransaction,
5
+ ContractClient,
6
+ ContractClientOptions,
7
+ } from '@stellar/stellar-sdk/lib/contract_client/index.js'
8
+ import type {
9
+ u32,
10
+ i32,
11
+ u64,
12
+ i64,
13
+ u128,
14
+ i128,
15
+ u256,
16
+ i256,
17
+ Option,
18
+ Typepoint,
19
+ Duration,
20
+ } from '@stellar/stellar-sdk/lib/contract_client'
21
+ import { Result } from '@stellar/stellar-sdk/lib/rust_types/index.js'
22
+ export * from '@stellar/stellar-sdk'
23
+ export * from '@stellar/stellar-sdk/lib/contract_client/index.js'
24
+ export * from '@stellar/stellar-sdk/lib/rust_types/index.js'
25
+
26
+ if (typeof window !== 'undefined') {
27
+ //@ts-ignore Buffer exists
28
+ window.Buffer = window.Buffer || Buffer
29
+ }
30
+
31
+ export const networks = {
32
+ testnet: {
33
+ networkPassphrase: 'Test SDF Network ; September 2015',
34
+ contractId: 'CBI7LGEWCJFO2APREGBRTUXB5JMZHJOVD76MESEB7V6W4IJ4ZLQJILDB',
35
+ },
36
+ } as const
37
+
38
+ export type ClientDataKey =
39
+ | { tag: 'Pool'; values: void }
40
+ | { tag: 'PoolStorage'; values: void }
41
+ | { tag: 'CreditStorage'; values: void }
42
+ | { tag: 'UnderlyingToken'; values: void }
43
+
44
+ export const Errors = {
45
+ 51: { message: '' },
46
+ 55: { message: '' },
47
+ 71: { message: '' },
48
+ 222: { message: '' },
49
+ 202: { message: '' },
50
+ 203: { message: '' },
51
+ 204: { message: '' },
52
+ 215: { message: '' },
53
+ 205: { message: '' },
54
+ 206: { message: '' },
55
+ 207: { message: '' },
56
+ 219: { message: '' },
57
+ 101: { message: '' },
58
+ }
59
+
60
+ /**
61
+ * Account billing info refreshed with the updated due amount and date.
62
+ * # Fields:
63
+ * * `credit_hash` - The hash of the credit.
64
+ * * `new_due_date` - The updated due date of the bill.
65
+ * * `next_due` - The amount of next due on the bill.
66
+ * * `total_past_due` - The total amount of past due on the bill.
67
+ */
68
+ export interface BillRefreshedEvent {
69
+ credit_hash: Buffer
70
+ new_due_date: u64
71
+ next_due: u128
72
+ total_past_due: u128
73
+ }
74
+
75
+ /**
76
+ * A credit has been borrowed from.
77
+ * # Fields:
78
+ * * `borrower` - The address of the borrower.
79
+ * * `borrow_amount` - The amount the user has borrowed.
80
+ * * `net_amount_to_borrower` - The borrowing amount minus the fees that are charged upfront.
81
+ */
82
+ export interface DrawdownMadeEvent {
83
+ borrow_amount: u128
84
+ borrower: string
85
+ net_amount_to_borrower: u128
86
+ }
87
+
88
+ /**
89
+ * A payment has been made against the credit.
90
+ * # Fields:
91
+ * * `borrower` - The address of the borrower.
92
+ * * `amount` - The payback amount.
93
+ * * `next_due_date` - The due date of the next payment.
94
+ * * `yield_due` - The yield due on the credit after processing the payment.
95
+ * * `principal_due` - The principal due on the credit after processing the payment.
96
+ * * `yield_due_paid` - The amount of this payment applied to yield due in the current billing cycle.
97
+ * * `principal_due_paid` - The amount of this payment applied to principal due in the current billing cycle.
98
+ * * `unbilled_principal_paid` - The amount of this payment applied to unbilled principal.
99
+ * * `yield_past_due_paid` - The amount of this payment applied to yield past due.
100
+ * * `late_fee_paid` - The amount of this payment applied to late fee.
101
+ * * `principal_past_due_paid` - The amount of this payment applied to principal past due.
102
+ */
103
+ export interface PaymentMadeEvent {
104
+ amount: u128
105
+ borrower: string
106
+ late_fee_paid: u128
107
+ next_due_date: u64
108
+ principal_due: u128
109
+ principal_due_paid: u128
110
+ principal_past_due_paid: u128
111
+ unbilled_principal_paid: u128
112
+ yield_due: u128
113
+ yield_due_paid: u128
114
+ yield_past_due_paid: u128
115
+ }
116
+
117
+ /**
118
+ * A principal payment has been made against the credit.
119
+ * # Fields:
120
+ * * `borrower` - The address of the borrower.
121
+ * * `payer` - The address from which the money is coming.
122
+ * * `amount` - The payback amount.
123
+ * * `next_due_date` - The due date of the next payment.
124
+ * * `principal_due` - The principal due on the credit after processing the payment.
125
+ * * `unbilled_principal` - The unbilled principal on the credit after processing the payment.
126
+ * * `principal_due_paid` - The amount of this payment applied to principal due.
127
+ * * `unbilled_principal_paid` - The amount of this payment applied to unbilled principal.
128
+ */
129
+ export interface PrincipalPaymentMadeEvent {
130
+ amount: u128
131
+ borrower: string
132
+ next_due_date: u64
133
+ principal_due: u128
134
+ principal_due_paid: u128
135
+ unbilled_principal: u128
136
+ unbilled_principal_paid: u128
137
+ }
138
+
139
+ /**
140
+ * An existing credit has been closed.
141
+ * # Fields:
142
+ * * `credit_hash` - The credit hash.
143
+ */
144
+ export interface CreditClosedAfterPayOffEvent {
145
+ credit_hash: Buffer
146
+ }
147
+
148
+ export type PayPeriodDuration =
149
+ | { tag: 'Monthly'; values: void }
150
+ | { tag: 'Quarterly'; values: void }
151
+ | { tag: 'SemiAnnually'; values: void }
152
+
153
+ export type CreditState =
154
+ | { tag: 'Deleted'; values: void }
155
+ | { tag: 'Approved'; values: void }
156
+ | { tag: 'GoodStanding'; values: void }
157
+ | { tag: 'Delayed'; values: void }
158
+ | { tag: 'Defaulted'; values: void }
159
+
160
+ /**
161
+ * `CreditConfig` keeps track of the static settings of a credit.
162
+ * A `CreditConfig` is created after the approval of each credit.
163
+ * # Fields:
164
+ * * `credit_limit` - The maximum amount that can be borrowed.
165
+ * * `committed_amount` - The amount that the borrower has committed to use. If the used credit
166
+ * is less than this amount, the borrower will be charged yield using this amount.
167
+ * * `pay_period_duration` - The duration of each pay period, e.g., monthly, quarterly, or semi-annually.
168
+ * * `num_of_periods` - The number of periods before the credit expires.
169
+ * * `yield_bps` - The expected yield expressed in basis points, where 1% is 100, and 100% is 10,000. It means different things
170
+ * for different credit types:
171
+ * 1. For credit line, it is APR.
172
+ * 2. For factoring, it is factoring fee for the given period.
173
+ * 3. For dynamic yield credit, it is the estimated APY.
174
+ * * `revolving` - A flag indicating if repeated borrowing is allowed.
175
+ */
176
+ export interface CreditConfig {
177
+ committed_amount: u128
178
+ credit_limit: u128
179
+ num_periods: u32
180
+ pay_period_duration: PayPeriodDuration
181
+ revolving: boolean
182
+ yield_bps: u32
183
+ }
184
+
185
+ export interface CreditRecord {
186
+ missed_periods: u32
187
+ next_due: u128
188
+ next_due_date: u64
189
+ remaining_periods: u32
190
+ state: CreditState
191
+ total_past_due: u128
192
+ unbilled_principal: u128
193
+ yield_due: u128
194
+ }
195
+
196
+ export interface DueDetail {
197
+ accrued: u128
198
+ committed: u128
199
+ late_fee: u128
200
+ late_fee_updated_date: u64
201
+ paid: u128
202
+ principal_past_due: u128
203
+ yield_past_due: u128
204
+ }
205
+
206
+ export interface PoolSettings {
207
+ default_grace_period_days: u32
208
+ late_payment_grace_period_days: u32
209
+ max_credit_line: u128
210
+ min_deposit_amount: u128
211
+ pay_period_duration: PayPeriodDuration
212
+ principal_only_payment_allowed: boolean
213
+ }
214
+
215
+ export interface LPConfig {
216
+ fixed_senior_yield_bps: u32
217
+ liquidity_cap: u128
218
+ max_senior_junior_ratio: u32
219
+ tranches_risk_adjustment_bps: u32
220
+ withdrawal_lockout_period_days: u32
221
+ }
222
+
223
+ export interface FeeStructure {
224
+ front_loading_fee_bps: u32
225
+ front_loading_fee_flat: u128
226
+ late_fee_bps: u32
227
+ yield_bps: u32
228
+ }
229
+
230
+ export type PoolStatus =
231
+ | { tag: 'Off'; values: void }
232
+ | { tag: 'On'; values: void }
233
+ | { tag: 'Closed'; values: void }
234
+
235
+ export interface CurrentEpoch {
236
+ end_time: u64
237
+ id: u64
238
+ }
239
+
240
+ export interface AdminRnR {
241
+ liquidity_rate_bps_ea: u32
242
+ liquidity_rate_bps_pool_owner: u32
243
+ reward_rate_bps_ea: u32
244
+ reward_rate_bps_pool_owner: u32
245
+ }
246
+
247
+ export interface TrancheAddresses {
248
+ addrs: Array<Option<string>>
249
+ }
250
+
251
+ export interface TrancheAssets {
252
+ assets: Array<u128>
253
+ }
254
+
255
+ export interface Client {
256
+ /**
257
+ * Construct and simulate a initialize transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
258
+ */
259
+ initialize: (
260
+ {
261
+ pool,
262
+ pool_storage,
263
+ credit_storage,
264
+ underlying_token,
265
+ }: {
266
+ pool: string
267
+ pool_storage: string
268
+ credit_storage: string
269
+ underlying_token: string
270
+ },
271
+ options?: {
272
+ /**
273
+ * The fee to pay for the transaction. Default: BASE_FEE
274
+ */
275
+ fee?: number
276
+
277
+ /**
278
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
279
+ */
280
+ timeoutInSeconds?: number
281
+
282
+ /**
283
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
284
+ */
285
+ simulate?: boolean
286
+ },
287
+ ) => Promise<AssembledTransaction<null>>
288
+
289
+ /**
290
+ * Construct and simulate a get_due_info transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
291
+ */
292
+ get_due_info: (
293
+ { borrower }: { borrower: string },
294
+ options?: {
295
+ /**
296
+ * The fee to pay for the transaction. Default: BASE_FEE
297
+ */
298
+ fee?: number
299
+
300
+ /**
301
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
302
+ */
303
+ timeoutInSeconds?: number
304
+
305
+ /**
306
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
307
+ */
308
+ simulate?: boolean
309
+ },
310
+ ) => Promise<AssembledTransaction<readonly [CreditRecord, DueDetail]>>
311
+
312
+ /**
313
+ * Construct and simulate a get_next_bill_refresh_date transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
314
+ */
315
+ get_next_bill_refresh_date: (
316
+ { borrower }: { borrower: string },
317
+ options?: {
318
+ /**
319
+ * The fee to pay for the transaction. Default: BASE_FEE
320
+ */
321
+ fee?: number
322
+
323
+ /**
324
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
325
+ */
326
+ timeoutInSeconds?: number
327
+
328
+ /**
329
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
330
+ */
331
+ simulate?: boolean
332
+ },
333
+ ) => Promise<AssembledTransaction<u64>>
334
+
335
+ /**
336
+ * Construct and simulate a drawdown transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
337
+ */
338
+ drawdown: (
339
+ { borrower, amount }: { borrower: string; amount: u128 },
340
+ options?: {
341
+ /**
342
+ * The fee to pay for the transaction. Default: BASE_FEE
343
+ */
344
+ fee?: number
345
+
346
+ /**
347
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
348
+ */
349
+ timeoutInSeconds?: number
350
+
351
+ /**
352
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
353
+ */
354
+ simulate?: boolean
355
+ },
356
+ ) => Promise<AssembledTransaction<null>>
357
+
358
+ /**
359
+ * Construct and simulate a make_payment transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
360
+ */
361
+ make_payment: (
362
+ {
363
+ caller,
364
+ borrower,
365
+ amount,
366
+ }: { caller: string; borrower: string; amount: u128 },
367
+ options?: {
368
+ /**
369
+ * The fee to pay for the transaction. Default: BASE_FEE
370
+ */
371
+ fee?: number
372
+
373
+ /**
374
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
375
+ */
376
+ timeoutInSeconds?: number
377
+
378
+ /**
379
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
380
+ */
381
+ simulate?: boolean
382
+ },
383
+ ) => Promise<AssembledTransaction<readonly [u128, boolean]>>
384
+
385
+ /**
386
+ * Construct and simulate a make_principal_payment transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
387
+ */
388
+ make_principal_payment: (
389
+ { borrower, amount }: { borrower: string; amount: u128 },
390
+ options?: {
391
+ /**
392
+ * The fee to pay for the transaction. Default: BASE_FEE
393
+ */
394
+ fee?: number
395
+
396
+ /**
397
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
398
+ */
399
+ timeoutInSeconds?: number
400
+
401
+ /**
402
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
403
+ */
404
+ simulate?: boolean
405
+ },
406
+ ) => Promise<AssembledTransaction<readonly [u128, boolean]>>
407
+ }
408
+ export class Client extends ContractClient {
409
+ constructor(public readonly options: ContractClientOptions) {
410
+ super(
411
+ new ContractSpec([
412
+ 'AAAAAgAAAAAAAAAAAAAADUNsaWVudERhdGFLZXkAAAAAAAAEAAAAAAAAAAAAAAAEUG9vbAAAAAAAAAAAAAAAC1Bvb2xTdG9yYWdlAAAAAAAAAAAAAAAADUNyZWRpdFN0b3JhZ2UAAAAAAAAAAAAAAAAAAA9VbmRlcmx5aW5nVG9rZW4A',
413
+ 'AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABAAAAAAAAAAEcG9vbAAAABMAAAAAAAAADHBvb2xfc3RvcmFnZQAAABMAAAAAAAAADmNyZWRpdF9zdG9yYWdlAAAAAAATAAAAAAAAABB1bmRlcmx5aW5nX3Rva2VuAAAAEwAAAAA=',
414
+ 'AAAAAAAAAAAAAAAMZ2V0X2R1ZV9pbmZvAAAAAQAAAAAAAAAIYm9ycm93ZXIAAAATAAAAAQAAA+0AAAACAAAH0AAAAAxDcmVkaXRSZWNvcmQAAAfQAAAACUR1ZURldGFpbAAAAA==',
415
+ 'AAAAAAAAAAAAAAAaZ2V0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2FyZF9yYXRlX2Jwc19wb29sX293bmVyAAAAAAAE',
439
+ 'AAAAAQAAAAAAAAAAAAAAEFRyYW5jaGVBZGRyZXNzZXMAAAABAAAAAAAAAAVhZGRycwAAAAAAA+oAAAPoAAAAEw==',
440
+ 'AAAAAQAAAAAAAAAAAAAADVRyYW5jaGVBc3NldHMAAAAAAAABAAAAAAAAAAZhc3NldHMAAAAAA+oAAAAK',
441
+ ]),
442
+ options,
443
+ )
444
+ }
445
+ public readonly fromJSON = {
446
+ initialize: this.txFromJSON<null>,
447
+ get_due_info: this.txFromJSON<readonly [CreditRecord, DueDetail]>,
448
+ get_next_bill_refresh_date: this.txFromJSON<u64>,
449
+ drawdown: this.txFromJSON<null>,
450
+ make_payment: this.txFromJSON<readonly [u128, boolean]>,
451
+ make_principal_payment: this.txFromJSON<readonly [u128, boolean]>,
452
+ }
453
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "include": ["src/**/*"],
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "rootDir": "./src",
8
+ "outDir": "dist",
9
+ "moduleResolution": "node",
10
+ "declaration": true,
11
+ "strictNullChecks": true,
12
+ "skipLibCheck": true
13
+ }
14
+ }