@huma-finance/soroban-credit-manager 0.0.11-beta.17

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/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # tb-creditManager JS
2
+
3
+ JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `tb-creditManager` via Soroban RPC.
4
+
5
+ This library was automatically generated by Soroban CLI using a command similar to:
6
+
7
+ ```bash
8
+ soroban contract bindings ts \
9
+ --rpc-url https://soroban-testnet.stellar.org:443 \
10
+ --network-passphrase "Test SDF Network ; September 2015" \
11
+ --contract-id CASGH7RO7Q4H3JOMACIFKIVZDIL7AFHYELXB5JQ6VWTMQ7IMO6GEBRQ5 \
12
+ --output-dir ./path/to/tb-creditManager
13
+ ```
14
+
15
+ The network passphrase and contract ID are exported from [index.ts](./src/index.ts) in the `networks` constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update `networks` with other valid options. This will help your contract consumers use this library more easily.
16
+
17
+ # To publish or not to publish
18
+
19
+ This library is suitable for publishing to NPM. You can publish it to NPM using the `npm publish` command.
20
+
21
+ But you don't need to publish this library to NPM to use it. You can add it to your project's `package.json` using a file path:
22
+
23
+ ```json
24
+ "dependencies": {
25
+ "tb-creditManager": "./path/to/this/folder"
26
+ }
27
+ ```
28
+
29
+ However, we've actually encountered [frustration](https://github.com/stellar/soroban-example-dapp/pull/117#discussion_r1232873560) using local libraries with NPM in this way. Though it seems a bit messy, we suggest generating the library directly to your `node_modules` folder automatically after each install by using a `postinstall` script. We've had the least trouble with this approach. NPM will automatically remove what it sees as erroneous directories during the `install` step, and then regenerate them when it gets to your `postinstall` step, which will keep the library up-to-date with your contract.
30
+
31
+ ```json
32
+ "scripts": {
33
+ "postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org:443 --network-passphrase \"Test SDF Network ; September 2015\" --id CASGH7RO7Q4H3JOMACIFKIVZDIL7AFHYELXB5JQ6VWTMQ7IMO6GEBRQ5 --name tb-creditManager"
34
+ }
35
+ ```
36
+
37
+ Obviously you need to adjust the above command based on the actual command you used to generate the library.
38
+
39
+ # Use it
40
+
41
+ Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods:
42
+
43
+ ```js
44
+ import { Contract, networks } from "tb-creditManager"
45
+
46
+ const contract = new Contract({
47
+ ...networks.futurenet, // for example; check which networks this library exports
48
+ rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers
49
+ })
50
+
51
+ contract.|
52
+ ```
53
+
54
+ As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that `|` to get a list of all exports and inline-documentation for each. It exports a separate [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code.
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": "0.0.11-beta.17+b42c649",
3
+ "name": "@huma-finance/soroban-credit-manager",
4
+ "dependencies": {
5
+ "@stellar/freighter-api": "2.0.0",
6
+ "@stellar/stellar-sdk": "11.3.0",
7
+ "buffer": "6.0.3"
8
+ },
9
+ "types": "./dist/types/index.d.ts",
10
+ "main": "./dist/cjs/index.js",
11
+ "module": "./dist/esm/index.js",
12
+ "scripts": {
13
+ "build": "node ./scripts/build.mjs"
14
+ },
15
+ "exports": {
16
+ "require": "./dist/cjs/index.js",
17
+ "import": "./dist/esm/index.js"
18
+ },
19
+ "typings": "dist/types/index.d.ts",
20
+ "devDependencies": {
21
+ "typescript": "5.3.3"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "registry": "https://registry.npmjs.org/"
26
+ },
27
+ "gitHead": "b42c649f26b5207b2f5e12767d63cc9e5ead0faa"
28
+ }
@@ -0,0 +1,37 @@
1
+ import { spawnSync } from "node:child_process"
2
+ import fs from "node:fs"
3
+ import path from "node:path"
4
+
5
+ const buildDir = "./dist"
6
+
7
+ const { error, stderr } = spawnSync("tsc", ["-b", "./scripts/tsconfig.cjs.json", "./scripts/tsconfig.esm.json", "./scripts/tsconfig.types.json"], { stdio: "inherit" })
8
+
9
+ if (error) {
10
+ console.error(stderr)
11
+ console.error(error)
12
+ throw error
13
+ }
14
+
15
+ function createEsmModulePackageJson() {
16
+ fs.readdir(buildDir, function (err, dirs) {
17
+ if (err) {
18
+ throw err
19
+ }
20
+ dirs.forEach(function (dir) {
21
+ if (dir === "esm") {
22
+ // 1. add package.json file with "type": "module"
23
+ var packageJsonFile = path.join(buildDir, dir, "/package.json")
24
+ if (!fs.existsSync(packageJsonFile)) {
25
+ fs.writeFileSync(
26
+ packageJsonFile,
27
+ '{"type": "module"}',
28
+ 'utf8',
29
+ err => { if (err) throw err }
30
+ )
31
+ }
32
+ }
33
+ })
34
+ })
35
+ }
36
+
37
+ createEsmModulePackageJson()
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../dist/cjs",
5
+ "module": "commonjs"
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../dist/esm",
5
+ "module": "esnext"
6
+ }
7
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../dist/types",
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true
7
+ }
8
+ }
package/src/index.ts ADDED
@@ -0,0 +1,731 @@
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: "CASGH7RO7Q4H3JOMACIFKIVZDIL7AFHYELXB5JQ6VWTMQ7IMO6GEBRQ5",
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
+
43
+ export interface CreditManagerAddressesChangedEvent {
44
+ credit_storage: string;
45
+ pool: string;
46
+ pool_storage: string;
47
+ }
48
+
49
+ export interface CreditStorageAddressesChangedEvent {
50
+ credit: string;
51
+ credit_manager: string;
52
+ }
53
+
54
+ /**
55
+ * A credit has been approved.
56
+ * # Fields:
57
+ * * `borrower` - The address of the borrower.
58
+ * * `credit_hash` - The hash of the credit.
59
+ * * `credit_limit` - The maximum amount that can be borrowed.
60
+ * * `period_duration` - The duration of each pay period, e.g., monthly, quarterly, or semi-annually.
61
+ * * `remaining_periods` - The number of periods before the credit expires.
62
+ * * `yield_bps` - The expected yield expressed in basis points, where 1% is 100, and 100% is 10,000.
63
+ * * `committed_amount` - The amount that the borrower has committed to use. If the used credit
64
+ * is less than this amount, the borrower will be charged yield using this amount.
65
+ * * `designated_start_date` - The date after which the credit can start.
66
+ * * `revolving` - A flag indicating if repeated borrowing is allowed.
67
+ */
68
+ export interface CreditApprovedEvent {
69
+ borrower: string;
70
+ committed_amount: u128;
71
+ credit_hash: Buffer;
72
+ credit_limit: u128;
73
+ designated_start_date: u64;
74
+ period_duration: PayPeriodDuration;
75
+ remaining_periods: u32;
76
+ revolving: boolean;
77
+ yield_bps: u32;
78
+ }
79
+
80
+ /**
81
+ * A credit with a committed amount has started.
82
+ * # Fields:
83
+ * * `credit_hash` - The hash of the credit.
84
+ */
85
+ export interface CommittedCreditStartedEvent {
86
+ credit_hash: Buffer;
87
+ }
88
+
89
+ /**
90
+ * An existing credit has been closed by an admin.
91
+ * # Fields:
92
+ * * `credit_hash` - The hash of the credit.
93
+ */
94
+ export interface CreditClosedByAdminEvent {
95
+ credit_hash: Buffer;
96
+ }
97
+
98
+ /**
99
+ * The credit has been marked as Defaulted.
100
+ * # Fields:
101
+ * * `credit_hash` - The hash of the credit.
102
+ * * `principal_loss` - The principal losses to be written off because of the default.
103
+ * * `yield_loss` - The unpaid yield due to be written off.
104
+ * * `fees_loss` - The unpaid fees to be written off.
105
+ */
106
+ export interface DefaultTriggeredEvent {
107
+ credit_hash: Buffer;
108
+ fees_loss: u128;
109
+ principal_loss: u128;
110
+ yield_loss: u128;
111
+ }
112
+
113
+ /**
114
+ * The expiration (maturity) date of a credit has been extended.
115
+ * # Fields:
116
+ * * `credit_hash` - The hash of the credit.
117
+ * * `old_remaining_periods` - The number of remaining pay periods before the extension.
118
+ * * `new_remaining_periods` - The number of remaining pay periods after the extension.
119
+ */
120
+ export interface RemainingPeriodsExtendedEvent {
121
+ credit_hash: Buffer;
122
+ new_remaining_periods: u32;
123
+ old_remaining_periods: u32;
124
+ }
125
+
126
+ /**
127
+ * The yield of a credit has been updated.
128
+ * # Fields:
129
+ * * `credit_hash` - The credit hash.
130
+ * * `old_yield_bps` - The old yield in basis points before the update.
131
+ * * `new_yield_bps` - The new yield in basis points after the update.
132
+ */
133
+ export interface YieldUpdatedEvent {
134
+ credit_hash: Buffer;
135
+ new_yield_bps: u32;
136
+ old_yield_bps: u32;
137
+ }
138
+
139
+ /**
140
+ * The credit limit and committed amount of a credit have been updated.
141
+ * # Fields:
142
+ * * `credit_hash` - The credit hash.
143
+ * * `old_credit_limit` - The old credit limit before the update.
144
+ * * `new_credit_limit` - The new credit limit after the update.
145
+ * * `old_committed_amount` - The old committed amount before the update.
146
+ * * `new_committed_amount` - The new committed amount after the update.
147
+ */
148
+ export interface LimitAndCommitmentUpdatedEvent {
149
+ credit_hash: Buffer;
150
+ new_committed_amount: u128;
151
+ new_credit_limit: u128;
152
+ old_committed_amount: u128;
153
+ old_credit_limit: u128;
154
+ }
155
+
156
+ /**
157
+ * Part or all of the late fee due of a credit has been waived.
158
+ * # Fields:
159
+ * * `credit_hash` - The credit hash.
160
+ * * `old_late_fee` - The amount of late fee before the update.
161
+ * * `new_late_fee` - The amount of late fee after the update.
162
+ */
163
+ export interface LateFeeWaivedEvent {
164
+ credit_hash: Buffer;
165
+ new_late_fee: u128;
166
+ old_late_fee: u128;
167
+ }
168
+
169
+ export const Errors = {
170
+ 701: { message: "" },
171
+ 702: { message: "" },
172
+ 703: { message: "" },
173
+ 704: { message: "" },
174
+ 705: { message: "" },
175
+ 706: { message: "" },
176
+ 707: { message: "" },
177
+ 708: { message: "" },
178
+ 709: { message: "" },
179
+ 710: { message: "" },
180
+ 711: { message: "" },
181
+ 712: { message: "" },
182
+ 713: { message: "" },
183
+ 714: { message: "" },
184
+ 715: { message: "" },
185
+ };
186
+ export type PayPeriodDuration =
187
+ | { tag: "Monthly"; values: void }
188
+ | { tag: "Quarterly"; values: void }
189
+ | { tag: "SemiAnnually"; values: void };
190
+
191
+ /**
192
+ * Account billing info refreshed with the updated due amount and date.
193
+ * # Fields:
194
+ * * `credit_hash` - The hash of the credit.
195
+ * * `new_due_date` - The updated due date of the bill.
196
+ * * `next_due` - The amount of next due on the bill.
197
+ * * `total_past_due` - The total amount of past due on the bill.
198
+ */
199
+ export interface BillRefreshedEvent {
200
+ credit_hash: Buffer;
201
+ new_due_date: u64;
202
+ next_due: u128;
203
+ total_past_due: u128;
204
+ }
205
+
206
+ export type CreditState =
207
+ | { tag: "Deleted"; values: void }
208
+ | { tag: "Approved"; values: void }
209
+ | { tag: "GoodStanding"; values: void }
210
+ | { tag: "Delayed"; values: void }
211
+ | { tag: "Defaulted"; values: void };
212
+
213
+ /**
214
+ * `CreditConfig` keeps track of the static settings of a credit.
215
+ * A `CreditConfig` is created after the approval of each credit.
216
+ * # Fields:
217
+ * * `credit_limit` - The maximum amount that can be borrowed.
218
+ * * `committed_amount` - The amount that the borrower has committed to use. If the used credit
219
+ * is less than this amount, the borrower will be charged yield using this amount.
220
+ * * `pay_period_duration` - The duration of each pay period, e.g., monthly, quarterly, or semi-annually.
221
+ * * `num_of_periods` - The number of periods before the credit expires.
222
+ * * `yield_bps` - The expected yield expressed in basis points, where 1% is 100, and 100% is 10,000. It means different things
223
+ * for different credit types:
224
+ * 1. For credit line, it is APR.
225
+ * 2. For factoring, it is factoring fee for the given period.
226
+ * 3. For dynamic yield credit, it is the estimated APY.
227
+ * * `revolving` - A flag indicating if repeated borrowing is allowed.
228
+ */
229
+ export interface CreditConfig {
230
+ committed_amount: u128;
231
+ credit_limit: u128;
232
+ num_periods: u32;
233
+ pay_period_duration: PayPeriodDuration;
234
+ revolving: boolean;
235
+ yield_bps: u32;
236
+ }
237
+
238
+ export interface CreditRecord {
239
+ missed_periods: u32;
240
+ next_due: u128;
241
+ next_due_date: u64;
242
+ remaining_periods: u32;
243
+ state: CreditState;
244
+ total_past_due: u128;
245
+ unbilled_principal: u128;
246
+ yield_due: u128;
247
+ }
248
+
249
+ export interface DueDetail {
250
+ accrued: u128;
251
+ committed: u128;
252
+ late_fee: u128;
253
+ late_fee_updated_date: u64;
254
+ paid: u128;
255
+ principal_past_due: u128;
256
+ yield_past_due: u128;
257
+ }
258
+
259
+ export type TranchesPolicyType =
260
+ | { tag: "FixedSeniorYield"; values: void }
261
+ | { tag: "RiskAdjusted"; values: void };
262
+
263
+ export interface PoolSettings {
264
+ default_grace_period_days: u32;
265
+ late_payment_grace_period_days: u32;
266
+ max_credit_line: u128;
267
+ min_deposit_amount: u128;
268
+ pay_period_duration: PayPeriodDuration;
269
+ principal_only_payment_allowed: boolean;
270
+ }
271
+
272
+ export interface LPConfig {
273
+ fixed_senior_yield_bps: u32;
274
+ liquidity_cap: u128;
275
+ max_senior_junior_ratio: u32;
276
+ tranches_risk_adjustment_bps: u32;
277
+ withdrawal_lockout_period_days: u32;
278
+ }
279
+
280
+ export interface FeeStructure {
281
+ front_loading_fee_bps: u32;
282
+ front_loading_fee_flat: u128;
283
+ late_fee_bps: u32;
284
+ yield_bps: u32;
285
+ }
286
+
287
+ export type PoolStatus =
288
+ | { tag: "Off"; values: void }
289
+ | { tag: "On"; values: void }
290
+ | { tag: "Closed"; values: void };
291
+
292
+ export interface Epoch {
293
+ end_time: u64;
294
+ id: u64;
295
+ }
296
+
297
+ export interface AdminRnR {
298
+ liquidity_rate_bps_ea: u32;
299
+ liquidity_rate_bps_pool_owner: u32;
300
+ reward_rate_bps_ea: u32;
301
+ reward_rate_bps_pool_owner: u32;
302
+ }
303
+
304
+ export interface TrancheAddresses {
305
+ addrs: Array<Option<string>>;
306
+ }
307
+
308
+ export interface TrancheAssets {
309
+ assets: Array<u128>;
310
+ }
311
+
312
+ export interface Client {
313
+ /**
314
+ * 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.
315
+ */
316
+ initialize: (
317
+ {
318
+ pool,
319
+ pool_storage,
320
+ credit_storage,
321
+ }: { pool: string; pool_storage: string; credit_storage: string },
322
+ options?: {
323
+ /**
324
+ * The fee to pay for the transaction. Default: BASE_FEE
325
+ */
326
+ fee?: number;
327
+
328
+ /**
329
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
330
+ */
331
+ timeoutInSeconds?: number;
332
+
333
+ /**
334
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
335
+ */
336
+ simulate?: boolean;
337
+ }
338
+ ) => Promise<AssembledTransaction<null>>;
339
+
340
+ /**
341
+ * Construct and simulate a set_contract_addrs 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.
342
+ */
343
+ set_contract_addrs: (
344
+ {
345
+ pool_storage,
346
+ pool,
347
+ credit_storage,
348
+ }: { pool_storage: string; pool: string; credit_storage: string },
349
+ options?: {
350
+ /**
351
+ * The fee to pay for the transaction. Default: BASE_FEE
352
+ */
353
+ fee?: number;
354
+
355
+ /**
356
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
357
+ */
358
+ timeoutInSeconds?: number;
359
+
360
+ /**
361
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
362
+ */
363
+ simulate?: boolean;
364
+ }
365
+ ) => Promise<AssembledTransaction<null>>;
366
+
367
+ /**
368
+ * Construct and simulate a set_storage_contract_addrs 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.
369
+ */
370
+ set_storage_contract_addrs: (
371
+ { credit, credit_manager }: { credit: string; credit_manager: string },
372
+ options?: {
373
+ /**
374
+ * The fee to pay for the transaction. Default: BASE_FEE
375
+ */
376
+ fee?: number;
377
+
378
+ /**
379
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
380
+ */
381
+ timeoutInSeconds?: number;
382
+
383
+ /**
384
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
385
+ */
386
+ simulate?: boolean;
387
+ }
388
+ ) => Promise<AssembledTransaction<null>>;
389
+
390
+ /**
391
+ * Construct and simulate a approve_borrower 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.
392
+ */
393
+ approve_borrower: (
394
+ {
395
+ borrower,
396
+ credit_limit,
397
+ num_periods,
398
+ yield_bps,
399
+ committed_amount,
400
+ designated_start_date,
401
+ revolving,
402
+ }: {
403
+ borrower: string;
404
+ credit_limit: u128;
405
+ num_periods: u32;
406
+ yield_bps: u32;
407
+ committed_amount: u128;
408
+ designated_start_date: u64;
409
+ revolving: boolean;
410
+ },
411
+ options?: {
412
+ /**
413
+ * The fee to pay for the transaction. Default: BASE_FEE
414
+ */
415
+ fee?: number;
416
+
417
+ /**
418
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
419
+ */
420
+ timeoutInSeconds?: number;
421
+
422
+ /**
423
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
424
+ */
425
+ simulate?: boolean;
426
+ }
427
+ ) => Promise<AssembledTransaction<null>>;
428
+
429
+ /**
430
+ * Construct and simulate a start_committed_credit 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.
431
+ */
432
+ start_committed_credit: (
433
+ { caller, borrower }: { caller: string; borrower: string },
434
+ options?: {
435
+ /**
436
+ * The fee to pay for the transaction. Default: BASE_FEE
437
+ */
438
+ fee?: number;
439
+
440
+ /**
441
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
442
+ */
443
+ timeoutInSeconds?: number;
444
+
445
+ /**
446
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
447
+ */
448
+ simulate?: boolean;
449
+ }
450
+ ) => Promise<AssembledTransaction<null>>;
451
+
452
+ /**
453
+ * Construct and simulate a refresh_credit 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.
454
+ */
455
+ refresh_credit: (
456
+ { borrower }: { borrower: string },
457
+ options?: {
458
+ /**
459
+ * The fee to pay for the transaction. Default: BASE_FEE
460
+ */
461
+ fee?: number;
462
+
463
+ /**
464
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
465
+ */
466
+ timeoutInSeconds?: number;
467
+
468
+ /**
469
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
470
+ */
471
+ simulate?: boolean;
472
+ }
473
+ ) => Promise<AssembledTransaction<null>>;
474
+
475
+ /**
476
+ * Construct and simulate a is_default_ready 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.
477
+ */
478
+ is_default_ready: (
479
+ { borrower }: { borrower: string },
480
+ options?: {
481
+ /**
482
+ * The fee to pay for the transaction. Default: BASE_FEE
483
+ */
484
+ fee?: number;
485
+
486
+ /**
487
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
488
+ */
489
+ timeoutInSeconds?: number;
490
+
491
+ /**
492
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
493
+ */
494
+ simulate?: boolean;
495
+ }
496
+ ) => Promise<AssembledTransaction<boolean>>;
497
+
498
+ /**
499
+ * Construct and simulate a trigger_default 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.
500
+ */
501
+ trigger_default: (
502
+ { borrower }: { borrower: string },
503
+ options?: {
504
+ /**
505
+ * The fee to pay for the transaction. Default: BASE_FEE
506
+ */
507
+ fee?: number;
508
+
509
+ /**
510
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
511
+ */
512
+ timeoutInSeconds?: number;
513
+
514
+ /**
515
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
516
+ */
517
+ simulate?: boolean;
518
+ }
519
+ ) => Promise<AssembledTransaction<readonly [u128, u128, u128]>>;
520
+
521
+ /**
522
+ * Construct and simulate a update_yield 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.
523
+ */
524
+ update_yield: (
525
+ { borrower, new_yield_bps }: { borrower: string; new_yield_bps: u32 },
526
+ options?: {
527
+ /**
528
+ * The fee to pay for the transaction. Default: BASE_FEE
529
+ */
530
+ fee?: number;
531
+
532
+ /**
533
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
534
+ */
535
+ timeoutInSeconds?: number;
536
+
537
+ /**
538
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
539
+ */
540
+ simulate?: boolean;
541
+ }
542
+ ) => Promise<AssembledTransaction<null>>;
543
+
544
+ /**
545
+ * Construct and simulate a extend_remaining_period 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.
546
+ */
547
+ extend_remaining_period: (
548
+ { borrower, num_of_periods }: { borrower: string; num_of_periods: u32 },
549
+ options?: {
550
+ /**
551
+ * The fee to pay for the transaction. Default: BASE_FEE
552
+ */
553
+ fee?: number;
554
+
555
+ /**
556
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
557
+ */
558
+ timeoutInSeconds?: number;
559
+
560
+ /**
561
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
562
+ */
563
+ simulate?: boolean;
564
+ }
565
+ ) => Promise<AssembledTransaction<null>>;
566
+
567
+ /**
568
+ * Construct and simulate a update_limit_and_commitment 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.
569
+ */
570
+ update_limit_and_commitment: (
571
+ {
572
+ borrower,
573
+ new_credit_limit,
574
+ new_committed_amount,
575
+ }: { borrower: string; new_credit_limit: u128; new_committed_amount: u128 },
576
+ options?: {
577
+ /**
578
+ * The fee to pay for the transaction. Default: BASE_FEE
579
+ */
580
+ fee?: number;
581
+
582
+ /**
583
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
584
+ */
585
+ timeoutInSeconds?: number;
586
+
587
+ /**
588
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
589
+ */
590
+ simulate?: boolean;
591
+ }
592
+ ) => Promise<AssembledTransaction<null>>;
593
+
594
+ /**
595
+ * Construct and simulate a waive_late_fee 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.
596
+ */
597
+ waive_late_fee: (
598
+ { borrower, amount }: { borrower: string; amount: u128 },
599
+ options?: {
600
+ /**
601
+ * The fee to pay for the transaction. Default: BASE_FEE
602
+ */
603
+ fee?: number;
604
+
605
+ /**
606
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
607
+ */
608
+ timeoutInSeconds?: number;
609
+
610
+ /**
611
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
612
+ */
613
+ simulate?: boolean;
614
+ }
615
+ ) => Promise<AssembledTransaction<u128>>;
616
+
617
+ /**
618
+ * Construct and simulate a close_credit 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.
619
+ */
620
+ close_credit: (
621
+ { caller, borrower }: { caller: string; borrower: string },
622
+ options?: {
623
+ /**
624
+ * The fee to pay for the transaction. Default: BASE_FEE
625
+ */
626
+ fee?: number;
627
+
628
+ /**
629
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
630
+ */
631
+ timeoutInSeconds?: number;
632
+
633
+ /**
634
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
635
+ */
636
+ simulate?: boolean;
637
+ }
638
+ ) => Promise<AssembledTransaction<null>>;
639
+
640
+ /**
641
+ * Construct and simulate a upgrade 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.
642
+ */
643
+ upgrade: (
644
+ { new_wasm_hash }: { new_wasm_hash: Buffer },
645
+ options?: {
646
+ /**
647
+ * The fee to pay for the transaction. Default: BASE_FEE
648
+ */
649
+ fee?: number;
650
+
651
+ /**
652
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
653
+ */
654
+ timeoutInSeconds?: number;
655
+
656
+ /**
657
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
658
+ */
659
+ simulate?: boolean;
660
+ }
661
+ ) => Promise<AssembledTransaction<null>>;
662
+ }
663
+ export class Client extends ContractClient {
664
+ constructor(public readonly options: ContractClientOptions) {
665
+ super(
666
+ new ContractSpec([
667
+ "AAAAAgAAAAAAAAAAAAAADUNsaWVudERhdGFLZXkAAAAAAAADAAAAAAAAAAAAAAAEUG9vbAAAAAAAAAAAAAAAC1Bvb2xTdG9yYWdlAAAAAAAAAAAAAAAADUNyZWRpdFN0b3JhZ2UAAAA=",
668
+ "AAAAAQAAAAAAAAAAAAAAIkNyZWRpdE1hbmFnZXJBZGRyZXNzZXNDaGFuZ2VkRXZlbnQAAAAAAAMAAAAAAAAADmNyZWRpdF9zdG9yYWdlAAAAAAATAAAAAAAAAARwb29sAAAAEwAAAAAAAAAMcG9vbF9zdG9yYWdlAAAAEw==",
669
+ "AAAAAQAAAAAAAAAAAAAAIkNyZWRpdFN0b3JhZ2VBZGRyZXNzZXNDaGFuZ2VkRXZlbnQAAAAAAAIAAAAAAAAABmNyZWRpdAAAAAAAEwAAAAAAAAAOY3JlZGl0X21hbmFnZXIAAAAAABM=",
670
+ "AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAAAwAAAAAAAAAEcG9vbAAAABMAAAAAAAAADHBvb2xfc3RvcmFnZQAAABMAAAAAAAAADmNyZWRpdF9zdG9yYWdlAAAAAAATAAAAAA==",
671
+ "AAAAAAAAAAAAAAASc2V0X2NvbnRyYWN0X2FkZHJzAAAAAAADAAAAAAAAAAxwb29sX3N0b3JhZ2UAAAATAAAAAAAAAARwb29sAAAAEwAAAAAAAAAOY3JlZGl0X3N0b3JhZ2UAAAAAABMAAAAA",
672
+ "AAAAAAAAAAAAAAAac2V0X3N0b3JhZ2VfY29udHJhY3RfYWRkcnMAAAAAAAIAAAAAAAAABmNyZWRpdAAAAAAAEwAAA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+ "AAAAAQAAAAAAAAAAAAAADEZlZVN0cnVjdHVyZQAAAAQAAAAAAAAAFWZyb250X2xvYWRpbmdfZmVlX2JwcwAAAAAAAAQAAAAAAAAAFmZyb250X2xvYWRpbmdfZmVlX2ZsYXQAAAAAAAoAAAAAAAAADGxhdGVfZmVlX2JwcwAAAAQAAAAAAAAACXlpZWxkX2JwcwAAAAAAAAQ=",
706
+ "AAAAAgAAAAAAAAAAAAAAClBvb2xTdGF0dXMAAAAAAAMAAAAAAAAAAAAAAANPZmYAAAAAAAAAAAAAAAACT24AAAAAAAAAAAAAAAAABkNsb3NlZAAA",
707
+ "AAAAAQAAAAAAAAAAAAAABUVwb2NoAAAAAAAAAgAAAAAAAAAIZW5kX3RpbWUAAAAGAAAAAAAAAAJpZAAAAAAABg==",
708
+ "AAAAAQAAAAAAAAAAAAAACEFkbWluUm5SAAAABAAAAAAAAAAVbGlxdWlkaXR5X3JhdGVfYnBzX2VhAAAAAAAABAAAAAAAAAAdbGlxdWlkaXR5X3JhdGVfYnBzX3Bvb2xfb3duZXIAAAAAAAAEAAAAAAAAABJyZXdhcmRfcmF0ZV9icHNfZWEAAAAAAAQAAAAAAAAAGnJld2FyZF9yYXRlX2Jwc19wb29sX293bmVyAAAAAAAE",
709
+ "AAAAAQAAAAAAAAAAAAAAEFRyYW5jaGVBZGRyZXNzZXMAAAABAAAAAAAAAAVhZGRycwAAAAAAA+oAAAPoAAAAEw==",
710
+ "AAAAAQAAAAAAAAAAAAAADVRyYW5jaGVBc3NldHMAAAAAAAABAAAAAAAAAAZhc3NldHMAAAAAA+oAAAAK",
711
+ ]),
712
+ options
713
+ );
714
+ }
715
+ public readonly fromJSON = {
716
+ initialize: this.txFromJSON<null>,
717
+ set_contract_addrs: this.txFromJSON<null>,
718
+ set_storage_contract_addrs: this.txFromJSON<null>,
719
+ approve_borrower: this.txFromJSON<null>,
720
+ start_committed_credit: this.txFromJSON<null>,
721
+ refresh_credit: this.txFromJSON<null>,
722
+ is_default_ready: this.txFromJSON<boolean>,
723
+ trigger_default: this.txFromJSON<readonly [u128, u128, u128]>,
724
+ update_yield: this.txFromJSON<null>,
725
+ extend_remaining_period: this.txFromJSON<null>,
726
+ update_limit_and_commitment: this.txFromJSON<null>,
727
+ waive_late_fee: this.txFromJSON<u128>,
728
+ close_credit: this.txFromJSON<null>,
729
+ upgrade: this.txFromJSON<null>,
730
+ };
731
+ }
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
+ }