@huma-finance/soroban-sdk 0.0.32-beta.180 → 0.0.32
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/API.md +72 -72
- package/package.json +11 -11
package/API.md
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
## Functions
|
|
2
2
|
|
|
3
3
|
<dl>
|
|
4
|
-
<dt><a href="#getYieldToWithdraw">getYieldToWithdraw(poolName, network, wallet)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
5
|
-
<dd><p>Get yield available to withdraw from the pool for a lender account</p></dd>
|
|
6
|
-
<dt><a href="#deposit">deposit(poolName, network, wallet, assets, trancheType)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
7
|
-
<dd><p>Deposit assets into a tranche of the pool</p></dd>
|
|
8
|
-
<dt><a href="#withdrawYields">withdrawYields(poolName, network, wallet)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
9
|
-
<dd><p>Withdraw yield from the pool for a lender account</p></dd>
|
|
10
|
-
<dt><a href="#approveSep41Allowance">approveSep41Allowance(poolName, network, wallet, spenderAddress)</a></dt>
|
|
11
|
-
<dd><p>Approves an Sep41 allowance for a spender address.
|
|
12
|
-
Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)</p></dd>
|
|
13
4
|
<dt><a href="#getAvailableBalanceForPool">getAvailableBalanceForPool(poolName, network, wallet)</a></dt>
|
|
14
5
|
<dd><p>Returns the current pool balance available for borrowing</p></dd>
|
|
15
6
|
<dt><a href="#getCreditRecordForPool">getCreditRecordForPool(poolName, network, wallet, borrower)</a></dt>
|
|
@@ -29,17 +20,23 @@ Note: To ensure that allowance is always available for autopay, please call appr
|
|
|
29
20
|
<dt><a href="#makePayment">makePayment(poolName, network, wallet, paymentAmount, principalOnly)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
30
21
|
<dd><p>Makes a payment.
|
|
31
22
|
Note: To ensure that allowance is always available for autopay, please call approveAllowanceForSentinel() before calling this function.</p></dd>
|
|
23
|
+
<dt><a href="#approveSep41Allowance">approveSep41Allowance(poolName, network, wallet, spenderAddress)</a></dt>
|
|
24
|
+
<dd><p>Approves an Sep41 allowance for a spender address.
|
|
25
|
+
Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)</p></dd>
|
|
26
|
+
<dt><a href="#getYieldToWithdraw">getYieldToWithdraw(poolName, network, wallet)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
27
|
+
<dd><p>Get yield available to withdraw from the pool for a lender account</p></dd>
|
|
28
|
+
<dt><a href="#deposit">deposit(poolName, network, wallet, assets, trancheType)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
29
|
+
<dd><p>Deposit assets into a tranche of the pool</p></dd>
|
|
30
|
+
<dt><a href="#withdrawYields">withdrawYields(poolName, network, wallet)</a> ⇒ <code>Promise.<SentTransaction></code></dt>
|
|
31
|
+
<dd><p>Withdraw yield from the pool for a lender account</p></dd>
|
|
32
32
|
</dl>
|
|
33
33
|
|
|
34
|
-
<a name="
|
|
34
|
+
<a name="getAvailableBalanceForPool"></a>
|
|
35
35
|
|
|
36
|
-
##
|
|
37
|
-
<p>
|
|
36
|
+
## getAvailableBalanceForPool(poolName, network, wallet)
|
|
37
|
+
<p>Returns the current pool balance available for borrowing</p>
|
|
38
38
|
|
|
39
39
|
**Kind**: global function
|
|
40
|
-
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
41
|
-
<li>A Promise of the SentTransaction.</li>
|
|
42
|
-
</ul>
|
|
43
40
|
|
|
44
41
|
| Param | Type | Description |
|
|
45
42
|
| --- | --- | --- |
|
|
@@ -47,59 +44,56 @@ Note: To ensure that allowance is always available for autopay, please call appr
|
|
|
47
44
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
48
45
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
49
46
|
|
|
50
|
-
<a name="
|
|
47
|
+
<a name="getCreditRecordForPool"></a>
|
|
51
48
|
|
|
52
|
-
##
|
|
53
|
-
<p>
|
|
49
|
+
## getCreditRecordForPool(poolName, network, wallet, borrower)
|
|
50
|
+
<p>Returns the credit record of the borrower</p>
|
|
54
51
|
|
|
55
52
|
**Kind**: global function
|
|
56
|
-
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
57
|
-
<li>A Promise of the SentTransaction containing the shares minted.</li>
|
|
58
|
-
</ul>
|
|
59
53
|
|
|
60
54
|
| Param | Type | Description |
|
|
61
55
|
| --- | --- | --- |
|
|
62
|
-
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to
|
|
56
|
+
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
63
57
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
64
58
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
65
|
-
|
|
|
66
|
-
| trancheType | <code>'juniorTranche'</code> \| <code>'seniorTranche'</code> | <p>The tranche to deposit into.</p> |
|
|
59
|
+
| borrower | <code>string</code> | <p>The address of the borrower to check the credit record for.</p> |
|
|
67
60
|
|
|
68
|
-
<a name="
|
|
61
|
+
<a name="getAvailableCreditForPool"></a>
|
|
69
62
|
|
|
70
|
-
##
|
|
71
|
-
<p>
|
|
63
|
+
## getAvailableCreditForPool(poolName, network, wallet, borrower)
|
|
64
|
+
<p>Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
|
|
65
|
+
currently available for borrowing as the credit limit might exceed the available pool balance. Use
|
|
66
|
+
getPoolBalance() to get the current available pool balance.</p>
|
|
72
67
|
|
|
73
68
|
**Kind**: global function
|
|
74
|
-
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
75
|
-
<li>A Promise of the SentTransaction.</li>
|
|
76
|
-
</ul>
|
|
77
69
|
|
|
78
70
|
| Param | Type | Description |
|
|
79
71
|
| --- | --- | --- |
|
|
80
72
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
81
73
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
82
74
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
75
|
+
| borrower | <code>string</code> | <p>The address of the borrower to check the available credit for.</p> |
|
|
83
76
|
|
|
84
|
-
<a name="
|
|
77
|
+
<a name="getTotalDue"></a>
|
|
85
78
|
|
|
86
|
-
##
|
|
87
|
-
<p>
|
|
88
|
-
|
|
79
|
+
## getTotalDue(poolName, network, wallet, borrower) ⇒ <code>bigint</code> \| <code>null</code>
|
|
80
|
+
<p>Returns borrower's total due amount in bigint format
|
|
81
|
+
associated with the given pool name on the current chain.</p>
|
|
89
82
|
|
|
90
83
|
**Kind**: global function
|
|
84
|
+
**Returns**: <code>bigint</code> \| <code>null</code> - <p>The account's total due amount in bigint format</p>
|
|
91
85
|
|
|
92
86
|
| Param | Type | Description |
|
|
93
87
|
| --- | --- | --- |
|
|
94
88
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
95
89
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
96
|
-
| wallet | <code>StellarWallet</code> | <p>The wallet
|
|
97
|
-
|
|
|
90
|
+
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
91
|
+
| borrower | <code>string</code> | <p>The address of the borrower to check the available credit for.</p> |
|
|
98
92
|
|
|
99
|
-
<a name="
|
|
93
|
+
<a name="approveAllowanceForSentinel"></a>
|
|
100
94
|
|
|
101
|
-
##
|
|
102
|
-
<p>
|
|
95
|
+
## approveAllowanceForSentinel(poolName, network, wallet)
|
|
96
|
+
<p>Approve allowance for sentinel if not enough allowance is approved.</p>
|
|
103
97
|
|
|
104
98
|
**Kind**: global function
|
|
105
99
|
|
|
@@ -109,58 +103,67 @@ Allowance is required to do certain actions on the Huma protocol (e.g. makePayme
|
|
|
109
103
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
110
104
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
111
105
|
|
|
112
|
-
<a name="
|
|
106
|
+
<a name="drawdown"></a>
|
|
113
107
|
|
|
114
|
-
##
|
|
115
|
-
<p>
|
|
108
|
+
## drawdown(poolName, network, wallet, drawdownAmount) ⇒ <code>Promise.<SentTransaction></code>
|
|
109
|
+
<p>Draws down from a pool.
|
|
110
|
+
Note: To ensure that allowance is always available for autopay, please call approveAllowanceForSentinel() before calling this function.</p>
|
|
116
111
|
|
|
117
112
|
**Kind**: global function
|
|
113
|
+
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
114
|
+
<li>A Promise of the SentTransaction.</li>
|
|
115
|
+
</ul>
|
|
118
116
|
|
|
119
117
|
| Param | Type | Description |
|
|
120
118
|
| --- | --- | --- |
|
|
121
119
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
122
120
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
123
121
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
124
|
-
|
|
|
122
|
+
| drawdownAmount | <code>BigNumberish</code> | <p>The amount to drawdown.</p> |
|
|
125
123
|
|
|
126
|
-
<a name="
|
|
124
|
+
<a name="makePayment"></a>
|
|
127
125
|
|
|
128
|
-
##
|
|
129
|
-
<p>
|
|
130
|
-
|
|
131
|
-
getPoolBalance() to get the current available pool balance.</p>
|
|
126
|
+
## makePayment(poolName, network, wallet, paymentAmount, principalOnly) ⇒ <code>Promise.<SentTransaction></code>
|
|
127
|
+
<p>Makes a payment.
|
|
128
|
+
Note: To ensure that allowance is always available for autopay, please call approveAllowanceForSentinel() before calling this function.</p>
|
|
132
129
|
|
|
133
130
|
**Kind**: global function
|
|
131
|
+
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
132
|
+
<li>A Promise of the SentTransaction.</li>
|
|
133
|
+
</ul>
|
|
134
134
|
|
|
135
135
|
| Param | Type | Description |
|
|
136
136
|
| --- | --- | --- |
|
|
137
137
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
138
138
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
139
139
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
140
|
-
|
|
|
140
|
+
| paymentAmount | <code>bigint</code> | <p>The amount to payback.</p> |
|
|
141
|
+
| principalOnly | <code>boolean</code> | <p>Whether this payment should ONLY apply to the principal</p> |
|
|
141
142
|
|
|
142
|
-
<a name="
|
|
143
|
+
<a name="approveSep41Allowance"></a>
|
|
143
144
|
|
|
144
|
-
##
|
|
145
|
-
<p>
|
|
146
|
-
|
|
145
|
+
## approveSep41Allowance(poolName, network, wallet, spenderAddress)
|
|
146
|
+
<p>Approves an Sep41 allowance for a spender address.
|
|
147
|
+
Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)</p>
|
|
147
148
|
|
|
148
149
|
**Kind**: global function
|
|
149
|
-
**Returns**: <code>bigint</code> \| <code>null</code> - <p>The account's total due amount in bigint format</p>
|
|
150
150
|
|
|
151
151
|
| Param | Type | Description |
|
|
152
152
|
| --- | --- | --- |
|
|
153
153
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
154
154
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
155
|
-
| wallet | <code>StellarWallet</code> | <p>The
|
|
156
|
-
|
|
|
155
|
+
| wallet | <code>StellarWallet</code> | <p>The wallet used to send the transaction.</p> |
|
|
156
|
+
| spenderAddress | <code>string</code> | <p>The address of the spender to approve an allowance for.</p> |
|
|
157
157
|
|
|
158
|
-
<a name="
|
|
158
|
+
<a name="getYieldToWithdraw"></a>
|
|
159
159
|
|
|
160
|
-
##
|
|
161
|
-
<p>
|
|
160
|
+
## getYieldToWithdraw(poolName, network, wallet) ⇒ <code>Promise.<SentTransaction></code>
|
|
161
|
+
<p>Get yield available to withdraw from the pool for a lender account</p>
|
|
162
162
|
|
|
163
163
|
**Kind**: global function
|
|
164
|
+
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
165
|
+
<li>A Promise of the SentTransaction.</li>
|
|
166
|
+
</ul>
|
|
164
167
|
|
|
165
168
|
| Param | Type | Description |
|
|
166
169
|
| --- | --- | --- |
|
|
@@ -168,29 +171,28 @@ associated with the given pool name on the current chain.</p>
|
|
|
168
171
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
169
172
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
170
173
|
|
|
171
|
-
<a name="
|
|
174
|
+
<a name="deposit"></a>
|
|
172
175
|
|
|
173
|
-
##
|
|
174
|
-
<p>
|
|
175
|
-
Note: To ensure that allowance is always available for autopay, please call approveAllowanceForSentinel() before calling this function.</p>
|
|
176
|
+
## deposit(poolName, network, wallet, assets, trancheType) ⇒ <code>Promise.<SentTransaction></code>
|
|
177
|
+
<p>Deposit assets into a tranche of the pool</p>
|
|
176
178
|
|
|
177
179
|
**Kind**: global function
|
|
178
180
|
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
179
|
-
<li>A Promise of the SentTransaction.</li>
|
|
181
|
+
<li>A Promise of the SentTransaction containing the shares minted.</li>
|
|
180
182
|
</ul>
|
|
181
183
|
|
|
182
184
|
| Param | Type | Description |
|
|
183
185
|
| --- | --- | --- |
|
|
184
|
-
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to
|
|
186
|
+
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to deposit into.</p> |
|
|
185
187
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
186
188
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
187
|
-
|
|
|
189
|
+
| assets | <code>bigint</code> | <p>The amount of underlying assets to deposit.</p> |
|
|
190
|
+
| trancheType | <code>'juniorTranche'</code> \| <code>'seniorTranche'</code> | <p>The tranche to deposit into.</p> |
|
|
188
191
|
|
|
189
|
-
<a name="
|
|
192
|
+
<a name="withdrawYields"></a>
|
|
190
193
|
|
|
191
|
-
##
|
|
192
|
-
<p>
|
|
193
|
-
Note: To ensure that allowance is always available for autopay, please call approveAllowanceForSentinel() before calling this function.</p>
|
|
194
|
+
## withdrawYields(poolName, network, wallet) ⇒ <code>Promise.<SentTransaction></code>
|
|
195
|
+
<p>Withdraw yield from the pool for a lender account</p>
|
|
194
196
|
|
|
195
197
|
**Kind**: global function
|
|
196
198
|
**Returns**: <code>Promise.<SentTransaction></code> - <ul>
|
|
@@ -202,6 +204,4 @@ Note: To ensure that allowance is always available for autopay, please call appr
|
|
|
202
204
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
|
|
203
205
|
| network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
|
|
204
206
|
| wallet | <code>StellarWallet</code> | <p>The stellar wallet.</p> |
|
|
205
|
-
| paymentAmount | <code>bigint</code> | <p>The amount to payback.</p> |
|
|
206
|
-
| principalOnly | <code>boolean</code> | <p>Whether this payment should ONLY apply to the principal</p> |
|
|
207
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/soroban-sdk",
|
|
3
|
-
"version": "0.0.32
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/00labs/huma-soroban-sdk"
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"test:badges": "yarn run test:coverage && yarn jest-coverage-badges"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@huma-finance/soroban-credit-manager": "^0.0.32
|
|
39
|
-
"@huma-finance/soroban-credit-storage": "^0.0.32
|
|
40
|
-
"@huma-finance/soroban-huma-config": "^0.0.32
|
|
41
|
-
"@huma-finance/soroban-pool": "^0.0.32
|
|
42
|
-
"@huma-finance/soroban-pool-credit": "^0.0.32
|
|
43
|
-
"@huma-finance/soroban-pool-manager": "^0.0.32
|
|
44
|
-
"@huma-finance/soroban-pool-storage": "^0.0.32
|
|
45
|
-
"@huma-finance/soroban-sep41": "^0.0.32
|
|
46
|
-
"@huma-finance/soroban-tranche-vault": "^0.0.32
|
|
38
|
+
"@huma-finance/soroban-credit-manager": "^0.0.32",
|
|
39
|
+
"@huma-finance/soroban-credit-storage": "^0.0.32",
|
|
40
|
+
"@huma-finance/soroban-huma-config": "^0.0.32",
|
|
41
|
+
"@huma-finance/soroban-pool": "^0.0.32",
|
|
42
|
+
"@huma-finance/soroban-pool-credit": "^0.0.32",
|
|
43
|
+
"@huma-finance/soroban-pool-manager": "^0.0.32",
|
|
44
|
+
"@huma-finance/soroban-pool-storage": "^0.0.32",
|
|
45
|
+
"@huma-finance/soroban-sep41": "^0.0.32",
|
|
46
|
+
"@huma-finance/soroban-tranche-vault": "^0.0.32",
|
|
47
47
|
"@stellar/stellar-sdk": "16.0.1",
|
|
48
48
|
"dotenv": "^16.0.3",
|
|
49
49
|
"ts-node": "^10.9.1",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"prettier": "^2.7.1",
|
|
114
114
|
"ts-jest": "^29.1.1"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "4cd3aa05fd5865daca698d20ad65e2788fd1e010"
|
|
117
117
|
}
|