@huma-finance/soroban-sdk 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.
Files changed (64) hide show
  1. package/API.md +132 -0
  2. package/README.md +16 -0
  3. package/dist/cjs/helpers/CreditContractHelper.d.ts +77 -0
  4. package/dist/cjs/helpers/CreditContractHelper.js +180 -0
  5. package/dist/cjs/helpers/CreditContractHelper.js.map +1 -0
  6. package/dist/cjs/helpers/index.d.ts +1 -0
  7. package/dist/cjs/helpers/index.js +5 -0
  8. package/dist/cjs/helpers/index.js.map +1 -0
  9. package/dist/cjs/index.d.ts +3 -0
  10. package/dist/cjs/index.js +7 -0
  11. package/dist/cjs/index.js.map +1 -0
  12. package/dist/cjs/services/HumaContextStellar.d.ts +19 -0
  13. package/dist/cjs/services/HumaContextStellar.js +47 -0
  14. package/dist/cjs/services/HumaContextStellar.js.map +1 -0
  15. package/dist/cjs/services/StellarWallet.d.ts +9 -0
  16. package/dist/cjs/services/StellarWallet.js +22 -0
  17. package/dist/cjs/services/StellarWallet.js.map +1 -0
  18. package/dist/cjs/services/index.d.ts +2 -0
  19. package/dist/cjs/services/index.js +6 -0
  20. package/dist/cjs/services/index.js.map +1 -0
  21. package/dist/cjs/utils/client.d.ts +10 -0
  22. package/dist/cjs/utils/client.js +63 -0
  23. package/dist/cjs/utils/client.js.map +1 -0
  24. package/dist/cjs/utils/common.d.ts +2 -0
  25. package/dist/cjs/utils/common.js +13 -0
  26. package/dist/cjs/utils/common.js.map +1 -0
  27. package/dist/cjs/utils/index.d.ts +3 -0
  28. package/dist/cjs/utils/index.js +7 -0
  29. package/dist/cjs/utils/index.js.map +1 -0
  30. package/dist/cjs/utils/network.d.ts +48 -0
  31. package/dist/cjs/utils/network.js +101 -0
  32. package/dist/cjs/utils/network.js.map +1 -0
  33. package/dist/helpers/CreditContractHelper.d.ts +77 -0
  34. package/dist/helpers/CreditContractHelper.js +170 -0
  35. package/dist/helpers/CreditContractHelper.js.map +1 -0
  36. package/dist/helpers/index.d.ts +1 -0
  37. package/dist/helpers/index.js +2 -0
  38. package/dist/helpers/index.js.map +1 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.js +4 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/services/HumaContextStellar.d.ts +19 -0
  43. package/dist/services/HumaContextStellar.js +43 -0
  44. package/dist/services/HumaContextStellar.js.map +1 -0
  45. package/dist/services/StellarWallet.d.ts +9 -0
  46. package/dist/services/StellarWallet.js +18 -0
  47. package/dist/services/StellarWallet.js.map +1 -0
  48. package/dist/services/index.d.ts +2 -0
  49. package/dist/services/index.js +3 -0
  50. package/dist/services/index.js.map +1 -0
  51. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  52. package/dist/utils/client.d.ts +10 -0
  53. package/dist/utils/client.js +56 -0
  54. package/dist/utils/client.js.map +1 -0
  55. package/dist/utils/common.d.ts +2 -0
  56. package/dist/utils/common.js +9 -0
  57. package/dist/utils/common.js.map +1 -0
  58. package/dist/utils/index.d.ts +3 -0
  59. package/dist/utils/index.js +4 -0
  60. package/dist/utils/index.js.map +1 -0
  61. package/dist/utils/network.d.ts +48 -0
  62. package/dist/utils/network.js +98 -0
  63. package/dist/utils/network.js.map +1 -0
  64. package/package.json +107 -0
package/API.md ADDED
@@ -0,0 +1,132 @@
1
+ ## Functions
2
+
3
+ <dl>
4
+ <dt><a href="#getCreditLineClient">getCreditLineClient(poolName, network, wallet)</a> ⇒ <code>PoolCreditClient</code> | <code>undefined</code></dt>
5
+ <dd><p>Returns an soroban contract client instance for the credit line contract
6
+ associated with the given pool name on the current chain.</p></dd>
7
+ <dt><a href="#getAvailableBalanceForPool">getAvailableBalanceForPool(poolName, network, wallet)</a></dt>
8
+ <dd><p>Returns the current pool balance available for borrowing</p></dd>
9
+ <dt><a href="#getCreditRecordForPool">getCreditRecordForPool(poolName, network, wallet, borrower)</a></dt>
10
+ <dd><p>Returns the credit record of the borrower</p></dd>
11
+ <dt><a href="#getAvailableCreditForPool">getAvailableCreditForPool(poolName, network, wallet, borrower)</a></dt>
12
+ <dd><p>Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
13
+ currently available for borrowing as the credit limit might exceed the available pool balance. Use
14
+ getPoolBalance() to get the current available pool balance.</p></dd>
15
+ <dt><a href="#getTotalDue">getTotalDue(poolName, network, wallet, borrower)</a> ⇒ <code>bigint</code> | <code>null</code></dt>
16
+ <dd><p>Returns borrower's total due amount in bigint format
17
+ associated with the given pool name on the current chain.</p></dd>
18
+ <dt><a href="#drawdown">drawdown(poolName, network, wallet, drawdownAmount)</a> ⇒ <code>Promise.&lt;SentTransaction&gt;</code></dt>
19
+ <dd><p>Draws down from a pool.</p></dd>
20
+ <dt><a href="#makePayment">makePayment(poolName, network, wallet, paymentAmount, principalOnly)</a> ⇒ <code>Promise.&lt;AssembledTransaction&gt;</code></dt>
21
+ <dd><p>Makes a payment.</p></dd>
22
+ </dl>
23
+
24
+ <a name="getCreditLineClient"></a>
25
+
26
+ ## getCreditLineClient(poolName, network, wallet) ⇒ <code>PoolCreditClient</code> \| <code>undefined</code>
27
+ <p>Returns an soroban contract client instance for the credit line contract
28
+ associated with the given pool name on the current chain.</p>
29
+
30
+ **Kind**: global function
31
+ **Returns**: <code>PoolCreditClient</code> \| <code>undefined</code> - <p>A contract client instance for the CreditLine contract or undefined if it could not be found.</p>
32
+
33
+ | Param | Type | Description |
34
+ | --- | --- | --- |
35
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
36
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
37
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
38
+
39
+ <a name="getAvailableBalanceForPool"></a>
40
+
41
+ ## getAvailableBalanceForPool(poolName, network, wallet)
42
+ <p>Returns the current pool balance available for borrowing</p>
43
+
44
+ **Kind**: global function
45
+
46
+ | Param | Type | Description |
47
+ | --- | --- | --- |
48
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
49
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
50
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
51
+
52
+ <a name="getCreditRecordForPool"></a>
53
+
54
+ ## getCreditRecordForPool(poolName, network, wallet, borrower)
55
+ <p>Returns the credit record of the borrower</p>
56
+
57
+ **Kind**: global function
58
+
59
+ | Param | Type | Description |
60
+ | --- | --- | --- |
61
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
62
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
63
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
64
+ | borrower | <code>string</code> | <p>The address of the borrower to check the credit record for.</p> |
65
+
66
+ <a name="getAvailableCreditForPool"></a>
67
+
68
+ ## getAvailableCreditForPool(poolName, network, wallet, borrower)
69
+ <p>Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
70
+ currently available for borrowing as the credit limit might exceed the available pool balance. Use
71
+ getPoolBalance() to get the current available pool balance.</p>
72
+
73
+ **Kind**: global function
74
+
75
+ | Param | Type | Description |
76
+ | --- | --- | --- |
77
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
78
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
79
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
80
+ | borrower | <code>string</code> | <p>The address of the borrower to check the available credit for.</p> |
81
+
82
+ <a name="getTotalDue"></a>
83
+
84
+ ## getTotalDue(poolName, network, wallet, borrower) ⇒ <code>bigint</code> \| <code>null</code>
85
+ <p>Returns borrower's total due amount in bigint format
86
+ associated with the given pool name on the current chain.</p>
87
+
88
+ **Kind**: global function
89
+ **Returns**: <code>bigint</code> \| <code>null</code> - <p>The account's total due amount in bigint format</p>
90
+
91
+ | Param | Type | Description |
92
+ | --- | --- | --- |
93
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
94
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
95
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
96
+ | borrower | <code>string</code> | <p>The address of the borrower to check the available credit for.</p> |
97
+
98
+ <a name="drawdown"></a>
99
+
100
+ ## drawdown(poolName, network, wallet, drawdownAmount) ⇒ <code>Promise.&lt;SentTransaction&gt;</code>
101
+ <p>Draws down from a pool.</p>
102
+
103
+ **Kind**: global function
104
+ **Returns**: <code>Promise.&lt;SentTransaction&gt;</code> - <ul>
105
+ <li>A Promise of the SentTransaction.</li>
106
+ </ul>
107
+
108
+ | Param | Type | Description |
109
+ | --- | --- | --- |
110
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
111
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
112
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
113
+ | drawdownAmount | <code>BigNumberish</code> | <p>The amount to drawdown.</p> |
114
+
115
+ <a name="makePayment"></a>
116
+
117
+ ## makePayment(poolName, network, wallet, paymentAmount, principalOnly) ⇒ <code>Promise.&lt;AssembledTransaction&gt;</code>
118
+ <p>Makes a payment.</p>
119
+
120
+ **Kind**: global function
121
+ **Returns**: <code>Promise.&lt;AssembledTransaction&gt;</code> - <ul>
122
+ <li>A Promise of the AssembledTransaction.</li>
123
+ </ul>
124
+
125
+ | Param | Type | Description |
126
+ | --- | --- | --- |
127
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
128
+ | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
129
+ | wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
130
+ | paymentAmount | <code>bigint</code> | <p>The amount to payback.</p> |
131
+ | principalOnly | <code>boolean</code> | <p>Whether this payment should ONLY apply to the principal</p> |
132
+
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Huma Soroban SDK
2
+
3
+ The Huma Soroban SDK includes utilities and services for interacting with our contracts. It's currently offered just as a Javascript NPM package at https://www.npmjs.com/package/@huma-finance/soroban-sdk.
4
+
5
+ ## Getting Started
6
+
7
+ We recommend onboarding onto our SDK using the [Getting Started guide](getting-started.md)
8
+
9
+ ## Documentation
10
+
11
+ For extensive documentation on the different functions offered please refer to the [API documentation](API.md)
12
+
13
+ ## Features
14
+
15
+ - Helpers
16
+ - `CreditContractHelper` helper function for interacting with Huma's pool contracts, including drawdown and payback
@@ -0,0 +1,77 @@
1
+ import { Client as PoolCreditClient, CreditRecord, SentTransaction } from '@huma-finance/soroban-pool-credit';
2
+ import { StellarWallet } from '../services/StellarWallet';
3
+ import { POOL_NAME, StellarNetwork } from '../utils/network';
4
+ /**
5
+ * Returns an soroban contract client instance for the credit line contract
6
+ * associated with the given pool name on the current chain.
7
+ *
8
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
9
+ * @param {StellarNetwork} network - The stellar network.
10
+ * @param {StellarWallet} wallet - The stellar wallet.
11
+ * @returns {PoolCreditClient | undefined} A contract client instance for the CreditLine contract or undefined if it could not be found.
12
+ */
13
+ export declare function getCreditLineClient(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): PoolCreditClient | undefined;
14
+ /**
15
+ * Returns the current pool balance available for borrowing
16
+ *
17
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
18
+ * @param {StellarNetwork} network - The stellar network.
19
+ * @param {StellarWallet} wallet - The stellar wallet.
20
+ */
21
+ export declare function getAvailableBalanceForPool(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): Promise<bigint>;
22
+ /**
23
+ * Returns the credit record of the borrower
24
+ *
25
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
26
+ * @param {StellarNetwork} network - The stellar network.
27
+ * @param {StellarWallet} wallet - The stellar wallet.
28
+ * @param {string} borrower - The address of the borrower to check the credit record for.
29
+ */
30
+ export declare function getCreditRecordForPool(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, borrower: string): Promise<CreditRecord>;
31
+ /**
32
+ * Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
33
+ * currently available for borrowing as the credit limit might exceed the available pool balance. Use
34
+ * getPoolBalance() to get the current available pool balance.
35
+ *
36
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
37
+ * @param {StellarNetwork} network - The stellar network.
38
+ * @param {StellarWallet} wallet - The stellar wallet.
39
+ * @param {string} borrower - The address of the borrower to check the available credit for.
40
+ */
41
+ export declare function getAvailableCreditForPool(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, borrower: string): Promise<bigint>;
42
+ /**
43
+ * Returns borrower's total due amount in bigint format
44
+ * associated with the given pool name on the current chain.
45
+ *
46
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
47
+ * @param {StellarNetwork} network - The stellar network.
48
+ * @param {StellarWallet} wallet - The stellar wallet.
49
+ * @param {string} borrower - The address of the borrower to check the available credit for.
50
+ * @returns {bigint | null} The account's total due amount in bigint format
51
+ */
52
+ export declare function getTotalDue(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, borrower: string): Promise<bigint | null>;
53
+ /**
54
+ * Draws down from a pool.
55
+ *
56
+ * @async
57
+ * @function
58
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
59
+ * @param {StellarNetwork} network - The stellar network.
60
+ * @param {StellarWallet} wallet - The stellar wallet.
61
+ * @param {BigNumberish} drawdownAmount - The amount to drawdown.
62
+ * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
63
+ */
64
+ export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, drawdownAmount: bigint): Promise<SentTransaction<null>>;
65
+ /**
66
+ * Makes a payment.
67
+ *
68
+ * @async
69
+ * @function
70
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
71
+ * @param {StellarNetwork} network - The stellar network.
72
+ * @param {StellarWallet} wallet - The stellar wallet.
73
+ * @param {bigint} paymentAmount - The amount to payback.
74
+ * @param {boolean} principalOnly - Whether this payment should ONLY apply to the principal
75
+ * @returns {Promise<AssembledTransaction>} - A Promise of the AssembledTransaction.
76
+ */
77
+ export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<SentTransaction<readonly [bigint, boolean]>>;
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePayment = exports.drawdown = exports.getTotalDue = exports.getAvailableCreditForPool = exports.getCreditRecordForPool = exports.getAvailableBalanceForPool = exports.getCreditLineClient = void 0;
4
+ const client_1 = require("../utils/client");
5
+ /**
6
+ * Returns an soroban contract client instance for the credit line contract
7
+ * associated with the given pool name on the current chain.
8
+ *
9
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
10
+ * @param {StellarNetwork} network - The stellar network.
11
+ * @param {StellarWallet} wallet - The stellar wallet.
12
+ * @returns {PoolCreditClient | undefined} A contract client instance for the CreditLine contract or undefined if it could not be found.
13
+ */
14
+ function getCreditLineClient(poolName, network, wallet) {
15
+ return (0, client_1.getPoolCreditClient)(poolName, network, wallet);
16
+ }
17
+ exports.getCreditLineClient = getCreditLineClient;
18
+ /**
19
+ * Returns the current pool balance available for borrowing
20
+ *
21
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
22
+ * @param {StellarNetwork} network - The stellar network.
23
+ * @param {StellarWallet} wallet - The stellar wallet.
24
+ */
25
+ async function getAvailableBalanceForPool(poolName, network, wallet) {
26
+ const poolStorageClient = (0, client_1.getPoolStorageClient)(poolName, network, wallet);
27
+ if (!poolStorageClient) {
28
+ throw new Error('Could not find credit contract for pool');
29
+ }
30
+ const { result } = await poolStorageClient.get_available_balance();
31
+ return result;
32
+ }
33
+ exports.getAvailableBalanceForPool = getAvailableBalanceForPool;
34
+ /**
35
+ * Returns the credit record of the borrower
36
+ *
37
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
38
+ * @param {StellarNetwork} network - The stellar network.
39
+ * @param {StellarWallet} wallet - The stellar wallet.
40
+ * @param {string} borrower - The address of the borrower to check the credit record for.
41
+ */
42
+ async function getCreditRecordForPool(poolName, network, wallet, borrower) {
43
+ const creditStorageClient = (0, client_1.getCreditStorageClient)(poolName, network, wallet);
44
+ if (!creditStorageClient) {
45
+ throw new Error('Could not find credit storage contract for pool');
46
+ }
47
+ const { result: creditHash } = await creditStorageClient.get_credit_hash({
48
+ borrower,
49
+ });
50
+ if (!creditHash) {
51
+ throw new Error('Could not find credit hash');
52
+ }
53
+ const { result: creditRecord } = await creditStorageClient.get_credit_record({
54
+ credit_hash: creditHash,
55
+ });
56
+ if (!creditRecord) {
57
+ throw new Error('Could not find credit record');
58
+ }
59
+ return creditRecord;
60
+ }
61
+ exports.getCreditRecordForPool = getCreditRecordForPool;
62
+ /**
63
+ * Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
64
+ * currently available for borrowing as the credit limit might exceed the available pool balance. Use
65
+ * getPoolBalance() to get the current available pool balance.
66
+ *
67
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
68
+ * @param {StellarNetwork} network - The stellar network.
69
+ * @param {StellarWallet} wallet - The stellar wallet.
70
+ * @param {string} borrower - The address of the borrower to check the available credit for.
71
+ */
72
+ async function getAvailableCreditForPool(poolName, network, wallet, borrower) {
73
+ const creditStorageClient = (0, client_1.getCreditStorageClient)(poolName, network, wallet);
74
+ if (!creditStorageClient) {
75
+ throw new Error('Could not find credit storage contract for pool');
76
+ }
77
+ const { result: creditHash } = await creditStorageClient.get_credit_hash({
78
+ borrower,
79
+ });
80
+ if (!creditHash) {
81
+ throw new Error('Could not find credit hash');
82
+ }
83
+ const [{ result: creditConfig }, { result: creditRecord }] = await Promise.all([
84
+ creditStorageClient.get_credit_config({
85
+ credit_hash: creditHash,
86
+ }),
87
+ creditStorageClient.get_credit_record({
88
+ credit_hash: creditHash,
89
+ }),
90
+ ]);
91
+ if (!creditConfig || !creditRecord) {
92
+ throw new Error('Could not find credit config or credit record');
93
+ }
94
+ return creditConfig.credit_limit - creditRecord.unbilled_principal;
95
+ }
96
+ exports.getAvailableCreditForPool = getAvailableCreditForPool;
97
+ /**
98
+ * Returns borrower's total due amount in bigint format
99
+ * associated with the given pool name on the current chain.
100
+ *
101
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
102
+ * @param {StellarNetwork} network - The stellar network.
103
+ * @param {StellarWallet} wallet - The stellar wallet.
104
+ * @param {string} borrower - The address of the borrower to check the available credit for.
105
+ * @returns {bigint | null} The account's total due amount in bigint format
106
+ */
107
+ async function getTotalDue(poolName, network, wallet, borrower) {
108
+ const creditRecord = await getCreditRecordForPool(poolName, network, wallet, borrower);
109
+ if (!creditRecord) {
110
+ return null;
111
+ }
112
+ return creditRecord.next_due + creditRecord.total_past_due;
113
+ }
114
+ exports.getTotalDue = getTotalDue;
115
+ /**
116
+ * Draws down from a pool.
117
+ *
118
+ * @async
119
+ * @function
120
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
121
+ * @param {StellarNetwork} network - The stellar network.
122
+ * @param {StellarWallet} wallet - The stellar wallet.
123
+ * @param {BigNumberish} drawdownAmount - The amount to drawdown.
124
+ * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
125
+ */
126
+ async function drawdown(poolName, network, wallet, drawdownAmount) {
127
+ const poolCreditClient = (0, client_1.getPoolCreditClient)(poolName, network, wallet);
128
+ if (!poolCreditClient) {
129
+ throw new Error('Could not find credit contract for pool');
130
+ }
131
+ const tx = await poolCreditClient.drawdown({
132
+ borrower: wallet.userInfo.publicKey,
133
+ amount: drawdownAmount,
134
+ }, {
135
+ timeoutInSeconds: 30,
136
+ });
137
+ const result = await tx.signAndSend();
138
+ return result;
139
+ }
140
+ exports.drawdown = drawdown;
141
+ /**
142
+ * Makes a payment.
143
+ *
144
+ * @async
145
+ * @function
146
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
147
+ * @param {StellarNetwork} network - The stellar network.
148
+ * @param {StellarWallet} wallet - The stellar wallet.
149
+ * @param {bigint} paymentAmount - The amount to payback.
150
+ * @param {boolean} principalOnly - Whether this payment should ONLY apply to the principal
151
+ * @returns {Promise<AssembledTransaction>} - A Promise of the AssembledTransaction.
152
+ */
153
+ async function makePayment(poolName, network, wallet, paymentAmount, principalOnly) {
154
+ const poolCreditClient = (0, client_1.getPoolCreditClient)(poolName, network, wallet);
155
+ if (!poolCreditClient) {
156
+ throw new Error('Could not find credit contract for pool');
157
+ }
158
+ let tx;
159
+ if (principalOnly) {
160
+ tx = await poolCreditClient.make_principal_payment({
161
+ borrower: wallet.userInfo.publicKey,
162
+ amount: paymentAmount,
163
+ }, {
164
+ timeoutInSeconds: 30,
165
+ });
166
+ }
167
+ else {
168
+ tx = await poolCreditClient.make_payment({
169
+ caller: wallet.userInfo.publicKey,
170
+ borrower: wallet.userInfo.publicKey,
171
+ amount: paymentAmount,
172
+ }, {
173
+ timeoutInSeconds: 30,
174
+ });
175
+ }
176
+ const result = await tx.signAndSend();
177
+ return result;
178
+ }
179
+ exports.makePayment = makePayment;
180
+ //# sourceMappingURL=CreditContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/CreditContractHelper.ts"],"names":[],"mappings":";;;AAOA,4CAIwB;AAGxB;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CACjC,QAAmB,EACnB,OAAuB,EACvB,MAAqB;IAErB,OAAO,IAAA,4BAAmB,EAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AACvD,CAAC;AAND,kDAMC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,0BAA0B,CAC9C,QAAmB,EACnB,OAAuB,EACvB,MAAqB;IAErB,MAAM,iBAAiB,GAAG,IAAA,6BAAoB,EA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,MAAM,CAAA;AACf,CAAC;AAtCD,kCAsCC"}
@@ -0,0 +1 @@
1
+ export * from './CreditContractHelper';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./CreditContractHelper"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC"}
@@ -0,0 +1,3 @@
1
+ export * from './helpers';
2
+ export * from './services';
3
+ export * from './utils';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./helpers"), exports);
5
+ tslib_1.__exportStar(require("./services"), exports);
6
+ tslib_1.__exportStar(require("./utils"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,qDAA0B;AAC1B,kDAAuB"}
@@ -0,0 +1,19 @@
1
+ import { StellarNetwork, POOL_NAME, POOL_TYPE } from '../utils/network';
2
+ import { StellarWallet } from './StellarWallet';
3
+ export declare class HumaContextStellar {
4
+ #private;
5
+ constructor({ wallet, network, poolName, poolType, }: {
6
+ wallet: StellarWallet;
7
+ network: StellarNetwork;
8
+ poolName: POOL_NAME;
9
+ poolType: POOL_TYPE;
10
+ });
11
+ get wallet(): StellarWallet;
12
+ set wallet(value: StellarWallet);
13
+ get network(): StellarNetwork;
14
+ set network(value: StellarNetwork);
15
+ get poolName(): POOL_NAME;
16
+ set poolName(value: POOL_NAME);
17
+ get poolType(): POOL_TYPE;
18
+ set poolType(value: POOL_TYPE);
19
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var _HumaContextStellar_wallet, _HumaContextStellar_network, _HumaContextStellar_poolName, _HumaContextStellar_poolType;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HumaContextStellar = void 0;
5
+ const tslib_1 = require("tslib");
6
+ class HumaContextStellar {
7
+ constructor({ wallet, network, poolName, poolType, }) {
8
+ _HumaContextStellar_wallet.set(this, void 0);
9
+ _HumaContextStellar_network.set(this, void 0);
10
+ _HumaContextStellar_poolName.set(this, void 0);
11
+ _HumaContextStellar_poolType.set(this, void 0);
12
+ if (!wallet || !network || !poolName || !poolType) {
13
+ throw new Error('All parameters are required');
14
+ }
15
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_wallet, wallet, "f");
16
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_network, network, "f");
17
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_poolName, poolName, "f");
18
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_poolType, poolType, "f");
19
+ }
20
+ get wallet() {
21
+ return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_wallet, "f");
22
+ }
23
+ set wallet(value) {
24
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_wallet, value, "f");
25
+ }
26
+ get network() {
27
+ return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_network, "f");
28
+ }
29
+ set network(value) {
30
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_network, value, "f");
31
+ }
32
+ get poolName() {
33
+ return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_poolName, "f");
34
+ }
35
+ set poolName(value) {
36
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_poolName, value, "f");
37
+ }
38
+ get poolType() {
39
+ return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_poolType, "f");
40
+ }
41
+ set poolType(value) {
42
+ tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_poolType, value, "f");
43
+ }
44
+ }
45
+ exports.HumaContextStellar = HumaContextStellar;
46
+ _HumaContextStellar_wallet = new WeakMap(), _HumaContextStellar_network = new WeakMap(), _HumaContextStellar_poolName = new WeakMap(), _HumaContextStellar_poolType = new WeakMap();
47
+ //# sourceMappingURL=HumaContextStellar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HumaContextStellar.js","sourceRoot":"","sources":["../../../src/services/HumaContextStellar.ts"],"names":[],"mappings":";;;;;AAGA,MAAa,kBAAkB;IAS7B,YAAY,EACV,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,GAMT;QAlBD,6CAAsB;QAEtB,8CAAwB;QAExB,+CAAoB;QAEpB,+CAAoB;QAalB,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;SAC/C;QAED,+BAAA,IAAI,8BAAW,MAAM,MAAA,CAAA;QACrB,+BAAA,IAAI,+BAAY,OAAO,MAAA,CAAA;QACvB,+BAAA,IAAI,gCAAa,QAAQ,MAAA,CAAA;QACzB,+BAAA,IAAI,gCAAa,QAAQ,MAAA,CAAA;IAC3B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,+BAAA,IAAI,kCAAQ,CAAA;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,KAAoB;QAC7B,+BAAA,IAAI,8BAAW,KAAK,MAAA,CAAA;IACtB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,+BAAA,IAAI,mCAAS,CAAA;IACtB,CAAC;IAED,IAAI,OAAO,CAAC,KAAqB;QAC/B,+BAAA,IAAI,+BAAY,KAAK,MAAA,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,+BAAA,IAAI,oCAAU,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ,CAAC,KAAgB;QAC3B,+BAAA,IAAI,gCAAa,KAAK,MAAA,CAAA;IACxB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,+BAAA,IAAI,oCAAU,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ,CAAC,KAAgB;QAC3B,+BAAA,IAAI,gCAAa,KAAK,MAAA,CAAA;IACxB,CAAC;CACF;AA7DD,gDA6DC"}
@@ -0,0 +1,9 @@
1
+ import { Keypair } from '@stellar/stellar-sdk';
2
+ export declare class StellarWallet {
3
+ sourceKeypair: Keypair;
4
+ constructor(secretKey: string);
5
+ get userInfo(): {
6
+ publicKey: string;
7
+ };
8
+ signTransaction(tx: string, opts: any): Promise<string>;
9
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StellarWallet = void 0;
4
+ const stellar_sdk_1 = require("@stellar/stellar-sdk");
5
+ class StellarWallet {
6
+ constructor(secretKey) {
7
+ this.sourceKeypair = stellar_sdk_1.Keypair.fromSecret(secretKey);
8
+ }
9
+ get userInfo() {
10
+ return {
11
+ publicKey: this.sourceKeypair.publicKey(),
12
+ };
13
+ }
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ async signTransaction(tx, opts) {
16
+ const txFromXDR = new stellar_sdk_1.Transaction(tx, opts.networkPassphrase);
17
+ txFromXDR.sign(this.sourceKeypair);
18
+ return txFromXDR.toXDR();
19
+ }
20
+ }
21
+ exports.StellarWallet = StellarWallet;
22
+ //# sourceMappingURL=StellarWallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StellarWallet.js","sourceRoot":"","sources":["../../../src/services/StellarWallet.ts"],"names":[],"mappings":";;;AAAA,sDAA2D;AAE3D,MAAa,aAAa;IAGxB,YAAY,SAAiB;QAC3B,IAAI,CAAC,aAAa,GAAG,qBAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;IACpD,CAAC;IAED,IAAI,QAAQ;QACV,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;SAC1C,CAAA;IACH,CAAC;IAED,8DAA8D;IACvD,KAAK,CAAC,eAAe,CAAC,EAAU,EAAE,IAAS;QAChD,MAAM,SAAS,GAAG,IAAI,yBAAW,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAC7D,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAClC,OAAO,SAAS,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;CACF;AAnBD,sCAmBC"}
@@ -0,0 +1,2 @@
1
+ export * from './HumaContextStellar';
2
+ export * from './StellarWallet';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./HumaContextStellar"), exports);
5
+ tslib_1.__exportStar(require("./StellarWallet"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,+DAAoC;AACpC,0DAA+B"}
@@ -0,0 +1,10 @@
1
+ import { Client as CreditStorageClient } from '@huma-finance/soroban-credit-storage';
2
+ import { Client as PoolClient } from '@huma-finance/soroban-pool';
3
+ import { Client as PoolCreditClient } from '@huma-finance/soroban-pool-credit';
4
+ import { Client as PoolStorageClient } from '@huma-finance/soroban-pool-storage';
5
+ import { StellarWallet } from '../services/StellarWallet';
6
+ import { POOL_NAME, StellarNetwork } from './network';
7
+ export declare const getPoolClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolClient | undefined;
8
+ export declare const getPoolStorageClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolStorageClient | undefined;
9
+ export declare const getPoolCreditClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolCreditClient | undefined;
10
+ export declare const getCreditStorageClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => CreditStorageClient | undefined;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCreditStorageClient = exports.getPoolCreditClient = exports.getPoolStorageClient = exports.getPoolClient = void 0;
4
+ const soroban_credit_storage_1 = require("@huma-finance/soroban-credit-storage");
5
+ const soroban_pool_1 = require("@huma-finance/soroban-pool");
6
+ const soroban_pool_credit_1 = require("@huma-finance/soroban-pool-credit");
7
+ const soroban_pool_storage_1 = require("@huma-finance/soroban-pool-storage");
8
+ const common_1 = require("./common");
9
+ const network_1 = require("./network");
10
+ const getCommonProps = (network, wallet) => {
11
+ return {
12
+ publicKey: wallet.userInfo.publicKey,
13
+ networkPassphrase: network_1.StellarNetworkPassphrase[network],
14
+ rpcUrl: network_1.StellarPublicRpcUrl[network],
15
+ allowHttp: network_1.StellarPublicRpcUrl[network].startsWith('http://'),
16
+ signTransaction: wallet.signTransaction.bind(wallet),
17
+ };
18
+ };
19
+ const getPoolClient = (poolName, network, wallet) => {
20
+ const poolMetadata = (0, common_1.findPoolMetadata)(network, poolName);
21
+ if (!poolMetadata) {
22
+ return undefined;
23
+ }
24
+ return new soroban_pool_1.Client({
25
+ contractId: poolMetadata.contracts.pool,
26
+ ...getCommonProps(network, wallet),
27
+ });
28
+ };
29
+ exports.getPoolClient = getPoolClient;
30
+ const getPoolStorageClient = (poolName, network, wallet) => {
31
+ const poolMetadata = (0, common_1.findPoolMetadata)(network, poolName);
32
+ if (!poolMetadata) {
33
+ return undefined;
34
+ }
35
+ return new soroban_pool_storage_1.Client({
36
+ contractId: poolMetadata.contracts.poolStorage,
37
+ ...getCommonProps(network, wallet),
38
+ });
39
+ };
40
+ exports.getPoolStorageClient = getPoolStorageClient;
41
+ const getPoolCreditClient = (poolName, network, wallet) => {
42
+ const poolMetadata = (0, common_1.findPoolMetadata)(network, poolName);
43
+ if (!poolMetadata) {
44
+ return undefined;
45
+ }
46
+ return new soroban_pool_credit_1.Client({
47
+ contractId: poolMetadata.contracts.poolCredit,
48
+ ...getCommonProps(network, wallet),
49
+ });
50
+ };
51
+ exports.getPoolCreditClient = getPoolCreditClient;
52
+ const getCreditStorageClient = (poolName, network, wallet) => {
53
+ const poolMetadata = (0, common_1.findPoolMetadata)(network, poolName);
54
+ if (!poolMetadata) {
55
+ return undefined;
56
+ }
57
+ return new soroban_credit_storage_1.Client({
58
+ contractId: poolMetadata.contracts.creditStorage,
59
+ ...getCommonProps(network, wallet),
60
+ });
61
+ };
62
+ exports.getCreditStorageClient = getCreditStorageClient;
63
+ //# sourceMappingURL=client.js.map