@huma-finance/soroban-sdk 0.0.11-beta.17 → 0.0.11-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/helpers/CreditContractHelper.d.ts +88 -0
  3. package/dist/cjs/helpers/CreditContractHelper.js +219 -0
  4. package/dist/cjs/helpers/CreditContractHelper.js.map +1 -0
  5. package/dist/cjs/helpers/Sep41ContractHelper.d.ts +17 -0
  6. package/dist/cjs/helpers/Sep41ContractHelper.js +45 -0
  7. package/dist/cjs/helpers/Sep41ContractHelper.js.map +1 -0
  8. package/dist/cjs/helpers/index.d.ts +2 -0
  9. package/dist/cjs/helpers/index.js +6 -0
  10. package/dist/cjs/helpers/index.js.map +1 -0
  11. package/dist/cjs/index.d.ts +3 -0
  12. package/dist/cjs/index.js +7 -0
  13. package/dist/cjs/index.js.map +1 -0
  14. package/dist/cjs/services/HumaContextStellar.d.ts +19 -0
  15. package/dist/cjs/services/HumaContextStellar.js +47 -0
  16. package/dist/cjs/services/HumaContextStellar.js.map +1 -0
  17. package/dist/cjs/services/StellarWallet.d.ts +8 -0
  18. package/dist/cjs/services/StellarWallet.js +22 -0
  19. package/dist/cjs/services/StellarWallet.js.map +1 -0
  20. package/dist/cjs/services/index.d.ts +2 -0
  21. package/dist/cjs/services/index.js +6 -0
  22. package/dist/cjs/services/index.js.map +1 -0
  23. package/dist/cjs/utils/client.d.ts +16 -0
  24. package/dist/cjs/utils/client.js +95 -0
  25. package/dist/cjs/utils/client.js.map +1 -0
  26. package/dist/cjs/utils/common.d.ts +4 -0
  27. package/dist/cjs/utils/common.js +21 -0
  28. package/dist/cjs/utils/common.js.map +1 -0
  29. package/dist/cjs/utils/index.d.ts +3 -0
  30. package/dist/cjs/utils/index.js +7 -0
  31. package/dist/cjs/utils/index.js.map +1 -0
  32. package/dist/cjs/utils/network.d.ts +49 -0
  33. package/dist/cjs/utils/network.js +104 -0
  34. package/dist/cjs/utils/network.js.map +1 -0
  35. package/dist/helpers/CreditContractHelper.d.ts +88 -0
  36. package/dist/helpers/CreditContractHelper.js +208 -0
  37. package/dist/helpers/CreditContractHelper.js.map +1 -0
  38. package/dist/helpers/Sep41ContractHelper.d.ts +17 -0
  39. package/dist/helpers/Sep41ContractHelper.js +41 -0
  40. package/dist/helpers/Sep41ContractHelper.js.map +1 -0
  41. package/dist/helpers/index.d.ts +2 -0
  42. package/dist/helpers/index.js +3 -0
  43. package/dist/helpers/index.js.map +1 -0
  44. package/dist/index.d.ts +3 -0
  45. package/dist/index.js +4 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/services/HumaContextStellar.d.ts +19 -0
  48. package/dist/services/HumaContextStellar.js +43 -0
  49. package/dist/services/HumaContextStellar.js.map +1 -0
  50. package/dist/services/StellarWallet.d.ts +8 -0
  51. package/dist/services/StellarWallet.js +18 -0
  52. package/dist/services/StellarWallet.js.map +1 -0
  53. package/dist/services/index.d.ts +2 -0
  54. package/dist/services/index.js +3 -0
  55. package/dist/services/index.js.map +1 -0
  56. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  57. package/dist/utils/client.d.ts +16 -0
  58. package/dist/utils/client.js +85 -0
  59. package/dist/utils/client.js.map +1 -0
  60. package/dist/utils/common.d.ts +4 -0
  61. package/dist/utils/common.js +16 -0
  62. package/dist/utils/common.js.map +1 -0
  63. package/dist/utils/index.d.ts +3 -0
  64. package/dist/utils/index.js +4 -0
  65. package/dist/utils/index.js.map +1 -0
  66. package/dist/utils/network.d.ts +49 -0
  67. package/dist/utils/network.js +101 -0
  68. package/dist/utils/network.js.map +1 -0
  69. package/package.json +11 -11
package/README.md CHANGED
@@ -14,3 +14,4 @@ For extensive documentation on the different functions offered please refer to t
14
14
 
15
15
  - Helpers
16
16
  - `CreditContractHelper` helper function for interacting with Huma's pool contracts, including drawdown and payback
17
+ - `Sep41ContractHelper` helper function for interacting with Sep41 token contract (ERC20 equivalent)
@@ -0,0 +1,88 @@
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
+ * Approve allowance for sentinel if not enough allowance is approved.
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
+ * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
62
+ */
63
+ export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): Promise<SentTransaction<null> | null>;
64
+ /**
65
+ * Draws down from a pool.
66
+ *
67
+ * @async
68
+ * @function
69
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
70
+ * @param {StellarNetwork} network - The stellar network.
71
+ * @param {StellarWallet} wallet - The stellar wallet.
72
+ * @param {BigNumberish} drawdownAmount - The amount to drawdown.
73
+ * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
74
+ */
75
+ export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, drawdownAmount: bigint): Promise<SentTransaction<null>>;
76
+ /**
77
+ * Makes a payment.
78
+ *
79
+ * @async
80
+ * @function
81
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
82
+ * @param {StellarNetwork} network - The stellar network.
83
+ * @param {StellarWallet} wallet - The stellar wallet.
84
+ * @param {bigint} paymentAmount - The amount to payback.
85
+ * @param {boolean} principalOnly - Whether this payment should ONLY apply to the principal
86
+ * @returns {Promise<AssembledTransaction>} - A Promise of the AssembledTransaction.
87
+ */
88
+ export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<SentTransaction<readonly [bigint, boolean]>>;
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePayment = exports.drawdown = exports.approveAllowanceForSentinel = exports.getTotalDue = exports.getAvailableCreditForPool = exports.getCreditRecordForPool = exports.getAvailableBalanceForPool = exports.getCreditLineClient = void 0;
4
+ const client_1 = require("../utils/client");
5
+ const Sep41ContractHelper_1 = require("./Sep41ContractHelper");
6
+ /**
7
+ * Returns an soroban contract client instance for the credit line contract
8
+ * associated with the given pool name on the current chain.
9
+ *
10
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
11
+ * @param {StellarNetwork} network - The stellar network.
12
+ * @param {StellarWallet} wallet - The stellar wallet.
13
+ * @returns {PoolCreditClient | undefined} A contract client instance for the CreditLine contract or undefined if it could not be found.
14
+ */
15
+ function getCreditLineClient(poolName, network, wallet) {
16
+ return (0, client_1.getPoolCreditClient)(poolName, network, wallet);
17
+ }
18
+ exports.getCreditLineClient = getCreditLineClient;
19
+ /**
20
+ * Returns the current pool balance available for borrowing
21
+ *
22
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
23
+ * @param {StellarNetwork} network - The stellar network.
24
+ * @param {StellarWallet} wallet - The stellar wallet.
25
+ */
26
+ async function getAvailableBalanceForPool(poolName, network, wallet) {
27
+ const poolStorageClient = (0, client_1.getPoolStorageClient)(poolName, network, wallet);
28
+ if (!poolStorageClient) {
29
+ throw new Error('Could not find credit contract for pool');
30
+ }
31
+ const { result } = await poolStorageClient.get_available_balance();
32
+ return result;
33
+ }
34
+ exports.getAvailableBalanceForPool = getAvailableBalanceForPool;
35
+ /**
36
+ * Returns the credit record of the borrower
37
+ *
38
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
39
+ * @param {StellarNetwork} network - The stellar network.
40
+ * @param {StellarWallet} wallet - The stellar wallet.
41
+ * @param {string} borrower - The address of the borrower to check the credit record for.
42
+ */
43
+ async function getCreditRecordForPool(poolName, network, wallet, borrower) {
44
+ const creditStorageClient = (0, client_1.getCreditStorageClient)(poolName, network, wallet);
45
+ if (!creditStorageClient) {
46
+ throw new Error('Could not find credit storage contract for pool');
47
+ }
48
+ const { result: creditHash } = await creditStorageClient.get_credit_hash({
49
+ borrower,
50
+ });
51
+ if (!creditHash) {
52
+ throw new Error('Could not find credit hash');
53
+ }
54
+ const { result: creditRecord } = await creditStorageClient.get_credit_record({
55
+ credit_hash: creditHash,
56
+ });
57
+ if (!creditRecord) {
58
+ throw new Error('Could not find credit record');
59
+ }
60
+ return creditRecord;
61
+ }
62
+ exports.getCreditRecordForPool = getCreditRecordForPool;
63
+ /**
64
+ * 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.
67
+ *
68
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
69
+ * @param {StellarNetwork} network - The stellar network.
70
+ * @param {StellarWallet} wallet - The stellar wallet.
71
+ * @param {string} borrower - The address of the borrower to check the available credit for.
72
+ */
73
+ async function getAvailableCreditForPool(poolName, network, wallet, borrower) {
74
+ const creditStorageClient = (0, client_1.getCreditStorageClient)(poolName, network, wallet);
75
+ if (!creditStorageClient) {
76
+ throw new Error('Could not find credit storage contract for pool');
77
+ }
78
+ const { result: creditHash } = await creditStorageClient.get_credit_hash({
79
+ borrower,
80
+ });
81
+ if (!creditHash) {
82
+ throw new Error('Could not find credit hash');
83
+ }
84
+ const [{ result: creditConfig }, { result: creditRecord }] = await Promise.all([
85
+ creditStorageClient.get_credit_config({
86
+ credit_hash: creditHash,
87
+ }),
88
+ creditStorageClient.get_credit_record({
89
+ credit_hash: creditHash,
90
+ }),
91
+ ]);
92
+ if (!creditConfig || !creditRecord) {
93
+ throw new Error('Could not find credit config or credit record');
94
+ }
95
+ return creditConfig.credit_limit - creditRecord.unbilled_principal;
96
+ }
97
+ exports.getAvailableCreditForPool = getAvailableCreditForPool;
98
+ /**
99
+ * Returns borrower's total due amount in bigint format
100
+ * associated with the given pool name on the current chain.
101
+ *
102
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
103
+ * @param {StellarNetwork} network - The stellar network.
104
+ * @param {StellarWallet} wallet - The stellar wallet.
105
+ * @param {string} borrower - The address of the borrower to check the available credit for.
106
+ * @returns {bigint | null} The account's total due amount in bigint format
107
+ */
108
+ async function getTotalDue(poolName, network, wallet, borrower) {
109
+ const creditRecord = await getCreditRecordForPool(poolName, network, wallet, borrower);
110
+ if (!creditRecord) {
111
+ return null;
112
+ }
113
+ return creditRecord.next_due + creditRecord.total_past_due;
114
+ }
115
+ exports.getTotalDue = getTotalDue;
116
+ /**
117
+ * Approve allowance for sentinel if not enough allowance is approved.
118
+ *
119
+ * @async
120
+ * @function
121
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
122
+ * @param {StellarNetwork} network - The stellar network.
123
+ * @param {StellarWallet} wallet - The stellar wallet.
124
+ * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
125
+ */
126
+ async function approveAllowanceForSentinel(poolName, network, wallet) {
127
+ const totalDue = await getTotalDue(poolName, network, wallet, wallet.userInfo.publicKey);
128
+ if (totalDue === null) {
129
+ throw new Error('Could not find total due');
130
+ }
131
+ const poolStorageClient = (0, client_1.getPoolStorageClient)(poolName, network, wallet);
132
+ if (!poolStorageClient) {
133
+ throw new Error('Could not find pool storage contract for pool');
134
+ }
135
+ const [{ result: underlyingToken }, { result: sentinel }] = await Promise.all([
136
+ poolStorageClient.get_underlying_token(),
137
+ poolStorageClient.get_sentinel(),
138
+ ]);
139
+ const tx = await (0, Sep41ContractHelper_1.approveSep41AllowanceIfInsufficient)(network, wallet, underlyingToken, sentinel, totalDue);
140
+ return tx;
141
+ }
142
+ exports.approveAllowanceForSentinel = approveAllowanceForSentinel;
143
+ /**
144
+ * Draws down from a pool.
145
+ *
146
+ * @async
147
+ * @function
148
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
149
+ * @param {StellarNetwork} network - The stellar network.
150
+ * @param {StellarWallet} wallet - The stellar wallet.
151
+ * @param {BigNumberish} drawdownAmount - The amount to drawdown.
152
+ * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
153
+ */
154
+ async function drawdown(poolName, network, wallet, drawdownAmount) {
155
+ const poolCreditClient = (0, client_1.getPoolCreditClient)(poolName, network, wallet);
156
+ if (!poolCreditClient) {
157
+ throw new Error('Could not find credit contract for pool');
158
+ }
159
+ await approveAllowanceForSentinel(poolName, network, wallet);
160
+ const tx = await poolCreditClient.drawdown({
161
+ borrower: wallet.userInfo.publicKey,
162
+ amount: drawdownAmount,
163
+ }, {
164
+ timeoutInSeconds: 30,
165
+ });
166
+ const result = await tx.signAndSend();
167
+ return result;
168
+ }
169
+ exports.drawdown = drawdown;
170
+ /**
171
+ * Makes a payment.
172
+ *
173
+ * @async
174
+ * @function
175
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
176
+ * @param {StellarNetwork} network - The stellar network.
177
+ * @param {StellarWallet} wallet - The stellar wallet.
178
+ * @param {bigint} paymentAmount - The amount to payback.
179
+ * @param {boolean} principalOnly - Whether this payment should ONLY apply to the principal
180
+ * @returns {Promise<AssembledTransaction>} - A Promise of the AssembledTransaction.
181
+ */
182
+ async function makePayment(poolName, network, wallet, paymentAmount, principalOnly) {
183
+ const poolCreditClient = (0, client_1.getPoolCreditClient)(poolName, network, wallet);
184
+ if (!poolCreditClient) {
185
+ throw new Error('Could not find credit contract for pool');
186
+ }
187
+ const poolStorageClient = (0, client_1.getPoolStorageClient)(poolName, network, wallet);
188
+ if (!poolStorageClient) {
189
+ throw new Error('Could not find pool storage contract for pool');
190
+ }
191
+ await approveAllowanceForSentinel(poolName, network, wallet);
192
+ const [{ result: underlyingToken }, { result: sentinel }] = await Promise.all([
193
+ poolStorageClient.get_underlying_token(),
194
+ poolStorageClient.get_sentinel(),
195
+ ]);
196
+ let tx;
197
+ tx = await (0, Sep41ContractHelper_1.approveSep41AllowanceIfInsufficient)(network, wallet, underlyingToken, sentinel, paymentAmount);
198
+ if (principalOnly) {
199
+ tx = await poolCreditClient.make_principal_payment({
200
+ borrower: wallet.userInfo.publicKey,
201
+ amount: paymentAmount,
202
+ }, {
203
+ timeoutInSeconds: 30,
204
+ });
205
+ }
206
+ else {
207
+ tx = await poolCreditClient.make_payment({
208
+ caller: wallet.userInfo.publicKey,
209
+ borrower: wallet.userInfo.publicKey,
210
+ amount: paymentAmount,
211
+ }, {
212
+ timeoutInSeconds: 30,
213
+ });
214
+ }
215
+ const result = await tx.signAndSend();
216
+ return result;
217
+ }
218
+ exports.makePayment = makePayment;
219
+ //# sourceMappingURL=CreditContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/CreditContractHelper.ts"],"names":[],"mappings":";;;AAOA,4CAIwB;AAExB,+DAA2E;AAE3E;;;;;;;;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,EAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACzE,IAAI,CAAC,iBAAiB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MAAM,CAAC,QAAQ,CAAC,SAAS;YACnC,MAAM,EAAE,aAAa;SACtB,EACD;YACE,gBAAgB,EAAE,EAAE;SACrB,CACF,CAAA;KACF;IAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,WAAW,EAAE,CAAA;IACrC,OAAO,MAAM,CAAA;AACf,CAAC;AA1DD,kCA0DC"}
@@ -0,0 +1,17 @@
1
+ import { SentTransaction } from '@huma-finance/soroban-pool-credit';
2
+ import { StellarWallet } from '../services';
3
+ import { StellarNetwork } from '../utils';
4
+ /**
5
+ * Approves an Sep41 allowance for a spender address, if the current allowance is insufficient.
6
+ * Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)
7
+ *
8
+ * @async
9
+ * @function
10
+ * @param {StellarNetwork} network - The stellar network.
11
+ * @param {StellarWallet} wallet - The wallet used to send the transaction.
12
+ * @param {string} tokenAddress - The address of the Sep41 token to approve.
13
+ * @param {string} spenderAddress - The address of the spender to approve an allowance for.
14
+ * @param {bigint} allowanceAmount - The amount of tokens to approve, if applicable. Denominated in the Sep41 tokens.
15
+ * @returns {Promise<SentTransaction<null> | null>} - A Promise of the transaction response, or null if the allowance was already sufficient.
16
+ */
17
+ export declare function approveSep41AllowanceIfInsufficient(network: StellarNetwork, wallet: StellarWallet, tokenAddress: string, spenderAddress: string, allowanceAmount: bigint): Promise<SentTransaction<null> | null>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.approveSep41AllowanceIfInsufficient = void 0;
4
+ const utils_1 = require("../utils");
5
+ /**
6
+ * Approves an Sep41 allowance for a spender address, if the current allowance is insufficient.
7
+ * Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)
8
+ *
9
+ * @async
10
+ * @function
11
+ * @param {StellarNetwork} network - The stellar network.
12
+ * @param {StellarWallet} wallet - The wallet used to send the transaction.
13
+ * @param {string} tokenAddress - The address of the Sep41 token to approve.
14
+ * @param {string} spenderAddress - The address of the spender to approve an allowance for.
15
+ * @param {bigint} allowanceAmount - The amount of tokens to approve, if applicable. Denominated in the Sep41 tokens.
16
+ * @returns {Promise<SentTransaction<null> | null>} - A Promise of the transaction response, or null if the allowance was already sufficient.
17
+ */
18
+ async function approveSep41AllowanceIfInsufficient(network, wallet, tokenAddress, spenderAddress, allowanceAmount) {
19
+ const tokenClient = (0, utils_1.getUnderlyingTokenClient)(tokenAddress, network, wallet);
20
+ const [{ result: allowance }, { result: decimals }] = await Promise.all([
21
+ tokenClient.allowance({
22
+ from: wallet.userInfo.publicKey,
23
+ spender: spenderAddress,
24
+ }),
25
+ tokenClient.decimals(),
26
+ ]);
27
+ if (allowance < allowanceAmount) {
28
+ const latestLedger = await (0, utils_1.getLatestLedger)(network);
29
+ // @TODO find a better to advance the ledger number
30
+ const advanceLedgerNum = 3000000;
31
+ const tx = await tokenClient.approve({
32
+ from: wallet.userInfo.publicKey,
33
+ spender: spenderAddress,
34
+ amount: BigInt(1000000000 * Math.pow(10, Number(decimals))),
35
+ expiration_ledger: latestLedger.sequence + advanceLedgerNum,
36
+ }, {
37
+ timeoutInSeconds: 30,
38
+ });
39
+ const result = await tx.signAndSend();
40
+ return result;
41
+ }
42
+ return null;
43
+ }
44
+ exports.approveSep41AllowanceIfInsufficient = approveSep41AllowanceIfInsufficient;
45
+ //# sourceMappingURL=Sep41ContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sep41ContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/Sep41ContractHelper.ts"],"names":[],"mappings":";;;AAGA,oCAIiB;AAEjB;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,mCAAmC,CACvD,OAAuB,EACvB,MAAqB,EACrB,YAAoB,EACpB,cAAsB,EACtB,eAAuB;IAEvB,MAAM,WAAW,GAAG,IAAA,gCAAwB,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAE3E,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACtE,WAAW,CAAC,SAAS,CAAC;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS;YAC/B,OAAO,EAAE,cAAc;SACxB,CAAC;QACF,WAAW,CAAC,QAAQ,EAAE;KACvB,CAAC,CAAA;IAEF,IAAI,SAAS,GAAG,eAAe,EAAE;QAC/B,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,EAAC,OAAO,CAAC,CAAA;QACnD,mDAAmD;QACnD,MAAM,gBAAgB,GAAG,OAAS,CAAA;QAClC,MAAM,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,CAClC;YACE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS;YAC/B,OAAO,EAAE,cAAc;YACvB,MAAM,EAAE,MAAM,CAAC,UAAY,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC7D,iBAAiB,EAAE,YAAY,CAAC,QAAQ,GAAG,gBAAgB;SAC5D,EACD;YACE,gBAAgB,EAAE,EAAE;SACrB,CACF,CAAA;QACD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,WAAW,EAAE,CAAA;QACrC,OAAO,MAAM,CAAA;KACd;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AArCD,kFAqCC"}
@@ -0,0 +1,2 @@
1
+ export * from './CreditContractHelper';
2
+ export * from './Sep41ContractHelper';
@@ -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("./CreditContractHelper"), exports);
5
+ tslib_1.__exportStar(require("./Sep41ContractHelper"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC;AACtC,gEAAqC"}
@@ -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,8 @@
1
+ export declare class StellarWallet {
2
+ private sourceKeypair;
3
+ constructor(secretKey: string);
4
+ get userInfo(): {
5
+ publicKey: string;
6
+ };
7
+ signTransaction(tx: string, opts: any): Promise<string>;
8
+ }
@@ -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,16 @@
1
+ import { Client as CreditStorageClient } from '@huma-finance/soroban-credit-storage';
2
+ import { Client as CreditManagerClient } from '@huma-finance/soroban-credit-manager';
3
+ import { Client as PoolClient } from '@huma-finance/soroban-pool';
4
+ import { Client as PoolCreditClient } from '@huma-finance/soroban-pool-credit';
5
+ import { Client as PoolStorageClient } from '@huma-finance/soroban-pool-storage';
6
+ import { Client as TrancheVaultClient } from '@huma-finance/soroban-tranche-vault';
7
+ import { Client as Sep41Client } from '@huma-finance/soroban-sep41';
8
+ import { StellarWallet } from '../services/StellarWallet';
9
+ import { POOL_NAME, StellarNetwork } from './network';
10
+ export declare const getPoolClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolClient | undefined;
11
+ export declare const getPoolStorageClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolStorageClient | undefined;
12
+ export declare const getPoolCreditClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolCreditClient | undefined;
13
+ export declare const getCreditStorageClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => CreditStorageClient | undefined;
14
+ export declare const getCreditManagerClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => CreditManagerClient | undefined;
15
+ export declare const getTrancheVaultClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, tranche: 'senior' | 'junior') => TrancheVaultClient | undefined;
16
+ export declare const getUnderlyingTokenClient: (tokenAddress: string, network: StellarNetwork, wallet: StellarWallet) => Sep41Client;