@huma-finance/soroban-sdk 0.0.15-beta.51 → 0.0.15-beta.56

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 (57) hide show
  1. package/API.md +7 -14
  2. package/dist/cjs/helpers/CreditContractHelper.d.ts +3 -5
  3. package/dist/cjs/helpers/CreditContractHelper.js +2 -4
  4. package/dist/cjs/helpers/Sep41ContractHelper.d.ts +2 -5
  5. package/dist/cjs/helpers/Sep41ContractHelper.js +25 -47
  6. package/dist/cjs/helpers/index.js +0 -1
  7. package/dist/cjs/index.js +0 -1
  8. package/dist/cjs/services/HumaContextStellar.js +16 -20
  9. package/dist/cjs/services/StellarWallet.js +5 -9
  10. package/dist/cjs/services/index.js +0 -1
  11. package/dist/cjs/utils/client.js +12 -16
  12. package/dist/cjs/utils/common.js +0 -1
  13. package/dist/cjs/utils/index.js +0 -1
  14. package/dist/cjs/utils/network.js +1 -2
  15. package/dist/cjs/utils/transaction.d.ts +2 -3
  16. package/dist/cjs/utils/transaction.js +0 -1
  17. package/dist/helpers/CreditContractHelper.d.ts +3 -5
  18. package/dist/helpers/CreditContractHelper.js +47 -38
  19. package/dist/helpers/CreditContractHelper.js.map +1 -1
  20. package/dist/helpers/Sep41ContractHelper.d.ts +2 -5
  21. package/dist/helpers/Sep41ContractHelper.js +31 -48
  22. package/dist/helpers/Sep41ContractHelper.js.map +1 -1
  23. package/dist/helpers/index.js +5 -2
  24. package/dist/helpers/index.js.map +1 -1
  25. package/dist/index.js +6 -3
  26. package/dist/index.js.map +1 -1
  27. package/dist/services/HumaContextStellar.js +21 -20
  28. package/dist/services/HumaContextStellar.js.map +1 -1
  29. package/dist/services/StellarWallet.js +12 -11
  30. package/dist/services/StellarWallet.js.map +1 -1
  31. package/dist/services/index.js +5 -2
  32. package/dist/services/index.js.map +1 -1
  33. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  34. package/dist/utils/client.js +69 -61
  35. package/dist/utils/client.js.map +1 -1
  36. package/dist/utils/common.js +25 -19
  37. package/dist/utils/common.js.map +1 -1
  38. package/dist/utils/index.js +7 -4
  39. package/dist/utils/index.js.map +1 -1
  40. package/dist/utils/network.js +15 -12
  41. package/dist/utils/network.js.map +1 -1
  42. package/dist/utils/transaction.d.ts +2 -3
  43. package/dist/utils/transaction.js +39 -31
  44. package/dist/utils/transaction.js.map +1 -1
  45. package/package.json +12 -11
  46. package/dist/cjs/helpers/CreditContractHelper.js.map +0 -1
  47. package/dist/cjs/helpers/Sep41ContractHelper.js.map +0 -1
  48. package/dist/cjs/helpers/index.js.map +0 -1
  49. package/dist/cjs/index.js.map +0 -1
  50. package/dist/cjs/services/HumaContextStellar.js.map +0 -1
  51. package/dist/cjs/services/StellarWallet.js.map +0 -1
  52. package/dist/cjs/services/index.js.map +0 -1
  53. package/dist/cjs/utils/client.js.map +0 -1
  54. package/dist/cjs/utils/common.js.map +0 -1
  55. package/dist/cjs/utils/index.js.map +0 -1
  56. package/dist/cjs/utils/network.js.map +0 -1
  57. package/dist/cjs/utils/transaction.js.map +0 -1
package/API.md CHANGED
@@ -12,14 +12,14 @@ getPoolBalance() to get the current available pool balance.</p></dd>
12
12
  <dt><a href="#getTotalDue">getTotalDue(poolName, network, wallet, borrower)</a> ⇒ <code>bigint</code> | <code>null</code></dt>
13
13
  <dd><p>Returns borrower's total due amount in bigint format
14
14
  associated with the given pool name on the current chain.</p></dd>
15
- <dt><a href="#approveAllowanceForSentinel">approveAllowanceForSentinel(poolName, network, wallet)</a> ⇒ <code>Promise.&lt;SentTransaction&gt;</code></dt>
15
+ <dt><a href="#approveAllowanceForSentinel">approveAllowanceForSentinel(poolName, network, wallet)</a></dt>
16
16
  <dd><p>Approve allowance for sentinel if not enough allowance is approved.</p></dd>
17
17
  <dt><a href="#drawdown">drawdown(poolName, network, wallet, drawdownAmount)</a> ⇒ <code>Promise.&lt;SentTransaction&gt;</code></dt>
18
18
  <dd><p>Draws down from a pool.</p></dd>
19
19
  <dt><a href="#makePayment">makePayment(poolName, network, wallet, paymentAmount, principalOnly)</a> ⇒ <code>Promise.&lt;SentTransaction&gt;</code></dt>
20
20
  <dd><p>Makes a payment.</p></dd>
21
- <dt><a href="#approveSep41AllowanceIfInsufficient">approveSep41AllowanceIfInsufficient(poolName, network, wallet, spenderAddress, allowanceAmount)</a> ⇒ <code>Promise.&lt;(SentTransaction.&lt;null&gt;|null)&gt;</code></dt>
22
- <dd><p>Approves an Sep41 allowance for a spender address, if the current allowance is insufficient.
21
+ <dt><a href="#approveSep41Allowance">approveSep41Allowance(poolName, network, wallet, spenderAddress)</a></dt>
22
+ <dd><p>Approves an Sep41 allowance for a spender address.
23
23
  Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)</p></dd>
24
24
  </dl>
25
25
 
@@ -84,13 +84,10 @@ associated with the given pool name on the current chain.</p>
84
84
 
85
85
  <a name="approveAllowanceForSentinel"></a>
86
86
 
87
- ## approveAllowanceForSentinel(poolName, network, wallet) ⇒ <code>Promise.&lt;SentTransaction&gt;</code>
87
+ ## approveAllowanceForSentinel(poolName, network, wallet)
88
88
  <p>Approve allowance for sentinel if not enough allowance is approved.</p>
89
89
 
90
90
  **Kind**: global function
91
- **Returns**: <code>Promise.&lt;SentTransaction&gt;</code> - <ul>
92
- <li>A Promise of the SentTransaction.</li>
93
- </ul>
94
91
 
95
92
  | Param | Type | Description |
96
93
  | --- | --- | --- |
@@ -133,16 +130,13 @@ associated with the given pool name on the current chain.</p>
133
130
  | paymentAmount | <code>bigint</code> | <p>The amount to payback.</p> |
134
131
  | principalOnly | <code>boolean</code> | <p>Whether this payment should ONLY apply to the principal</p> |
135
132
 
136
- <a name="approveSep41AllowanceIfInsufficient"></a>
133
+ <a name="approveSep41Allowance"></a>
137
134
 
138
- ## approveSep41AllowanceIfInsufficient(poolName, network, wallet, spenderAddress, allowanceAmount) ⇒ <code>Promise.&lt;(SentTransaction.&lt;null&gt;\|null)&gt;</code>
139
- <p>Approves an Sep41 allowance for a spender address, if the current allowance is insufficient.
135
+ ## approveSep41Allowance(poolName, network, wallet, spenderAddress)
136
+ <p>Approves an Sep41 allowance for a spender address.
140
137
  Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)</p>
141
138
 
142
139
  **Kind**: global function
143
- **Returns**: <code>Promise.&lt;(SentTransaction.&lt;null&gt;\|null)&gt;</code> - <ul>
144
- <li>A Promise of the transaction response, or null if the allowance was already sufficient.</li>
145
- </ul>
146
140
 
147
141
  | Param | Type | Description |
148
142
  | --- | --- | --- |
@@ -150,5 +144,4 @@ Allowance is required to do certain actions on the Huma protocol (e.g. makePayme
150
144
  | network | <code>StellarNetwork</code> | <p>The stellar network.</p> |
151
145
  | wallet | <code>StellarWallet</code> | <p>The wallet used to send the transaction.</p> |
152
146
  | spenderAddress | <code>string</code> | <p>The address of the spender to approve an allowance for.</p> |
153
- | allowanceAmount | <code>bigint</code> | <p>The amount of tokens to approve, if applicable. Denominated in the Sep41 tokens.</p> |
154
147
 
@@ -1,5 +1,4 @@
1
1
  import { CreditRecord } from '@huma-finance/soroban-pool-credit';
2
- import { SentTransaction } from '@stellar/stellar-sdk/lib/contract';
3
2
  import { StellarWallet } from '../services';
4
3
  import { POOL_NAME, StellarNetwork } from '../utils';
5
4
  /**
@@ -49,9 +48,8 @@ export declare function getTotalDue(poolName: POOL_NAME, network: StellarNetwork
49
48
  * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
50
49
  * @param {StellarNetwork} network - The stellar network.
51
50
  * @param {StellarWallet} wallet - The stellar wallet.
52
- * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
53
51
  */
54
- export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): Promise<SentTransaction<null> | null>;
52
+ export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): Promise<any>;
55
53
  /**
56
54
  * Draws down from a pool.
57
55
  *
@@ -63,7 +61,7 @@ export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network
63
61
  * @param {BigNumberish} drawdownAmount - The amount to drawdown.
64
62
  * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
65
63
  */
66
- export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, drawdownAmount: bigint): Promise<SentTransaction<null>>;
64
+ export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, drawdownAmount: bigint): Promise<any>;
67
65
  /**
68
66
  * Makes a payment.
69
67
  *
@@ -76,4 +74,4 @@ export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, w
76
74
  * @param {boolean} principalOnly - Whether this payment should ONLY apply to the principal
77
75
  * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
78
76
  */
79
- export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<SentTransaction<readonly [bigint, boolean]>>;
77
+ export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<any>;
@@ -133,7 +133,6 @@ exports.getTotalDue = getTotalDue;
133
133
  * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
134
134
  * @param {StellarNetwork} network - The stellar network.
135
135
  * @param {StellarWallet} wallet - The stellar wallet.
136
- * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
137
136
  */
138
137
  async function approveAllowanceForSentinel(poolName, network, wallet) {
139
138
  const totalDue = await getTotalDue(poolName, network, wallet, wallet.userInfo.publicKey);
@@ -145,7 +144,7 @@ async function approveAllowanceForSentinel(poolName, network, wallet) {
145
144
  context: poolStorageContext,
146
145
  method: 'get_sentinel',
147
146
  });
148
- const tx = await (0, Sep41ContractHelper_1.approveSep41AllowanceIfInsufficient)(poolName, network, wallet, sentinel, totalDue);
147
+ const tx = await (0, Sep41ContractHelper_1.approveSep41Allowance)(poolName, network, wallet, sentinel);
149
148
  return tx;
150
149
  }
151
150
  exports.approveAllowanceForSentinel = approveAllowanceForSentinel;
@@ -202,7 +201,7 @@ async function makePayment(poolName, network, wallet, paymentAmount, principalOn
202
201
  context: poolStorageContext,
203
202
  method: 'get_sentinel',
204
203
  });
205
- await (0, Sep41ContractHelper_1.approveSep41AllowanceIfInsufficient)(poolName, network, wallet, sentinel, paymentAmount);
204
+ await (0, Sep41ContractHelper_1.approveSep41Allowance)(poolName, network, wallet, sentinel);
206
205
  const poolCreditContext = new utils_1.TransactionContext(poolName, network, wallet, 'poolCredit');
207
206
  const params = [
208
207
  {
@@ -232,4 +231,3 @@ async function makePayment(poolName, network, wallet, paymentAmount, principalOn
232
231
  return result;
233
232
  }
234
233
  exports.makePayment = makePayment;
235
- //# sourceMappingURL=CreditContractHelper.js.map
@@ -1,8 +1,7 @@
1
- import { SentTransaction } from '@stellar/stellar-sdk/lib/contract';
2
1
  import { StellarWallet } from '../services';
3
2
  import { POOL_NAME, StellarNetwork } from '../utils';
4
3
  /**
5
- * Approves an Sep41 allowance for a spender address, if the current allowance is insufficient.
4
+ * Approves an Sep41 allowance for a spender address.
6
5
  * Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)
7
6
  *
8
7
  * @async
@@ -11,7 +10,5 @@ import { POOL_NAME, StellarNetwork } from '../utils';
11
10
  * @param {StellarNetwork} network - The stellar network.
12
11
  * @param {StellarWallet} wallet - The wallet used to send the transaction.
13
12
  * @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
13
  */
17
- export declare function approveSep41AllowanceIfInsufficient(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, spenderAddress: string, allowanceAmount: bigint): Promise<SentTransaction<null> | null>;
14
+ export declare function approveSep41Allowance(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, spenderAddress: string): Promise<any>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.approveSep41AllowanceIfInsufficient = void 0;
3
+ exports.approveSep41Allowance = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  /**
6
- * Approves an Sep41 allowance for a spender address, if the current allowance is insufficient.
6
+ * Approves an Sep41 allowance for a spender address.
7
7
  * Allowance is required to do certain actions on the Huma protocol (e.g. makePayment for Autopay)
8
8
  *
9
9
  * @async
@@ -12,14 +12,19 @@ const utils_1 = require("../utils");
12
12
  * @param {StellarNetwork} network - The stellar network.
13
13
  * @param {StellarWallet} wallet - The wallet used to send the transaction.
14
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
15
  */
18
- async function approveSep41AllowanceIfInsufficient(poolName, network, wallet, spenderAddress, allowanceAmount) {
16
+ async function approveSep41Allowance(poolName, network, wallet, spenderAddress) {
19
17
  const underlyingTokenContext = new utils_1.TransactionContext(poolName, network, wallet, 'underlyingToken');
20
- const { result: allowance } = await (0, utils_1.sendTransaction)({
18
+ const { result: decimals } = await (0, utils_1.sendTransaction)({
19
+ context: underlyingTokenContext,
20
+ method: 'decimals',
21
+ });
22
+ const latestLedger = await (0, utils_1.getLatestLedger)(network);
23
+ // @TODO find a better to advance the ledger number
24
+ const advanceLedgerNum = 3_000_000;
25
+ const result = await (0, utils_1.sendTransaction)({
21
26
  context: underlyingTokenContext,
22
- method: 'allowance',
27
+ method: 'approve',
23
28
  params: [
24
29
  {
25
30
  name: 'from',
@@ -31,46 +36,19 @@ async function approveSep41AllowanceIfInsufficient(poolName, network, wallet, sp
31
36
  type: utils_1.ScValType.address,
32
37
  value: spenderAddress,
33
38
  },
39
+ {
40
+ name: 'amount',
41
+ type: utils_1.ScValType.i128,
42
+ value: 1000_000_000 * Math.pow(10, Number(decimals)),
43
+ },
44
+ {
45
+ name: 'expiration_ledger',
46
+ type: utils_1.ScValType.u32,
47
+ value: latestLedger.sequence + advanceLedgerNum,
48
+ },
34
49
  ],
50
+ shouldSignTransaction: true,
35
51
  });
36
- const { result: decimals } = await (0, utils_1.sendTransaction)({
37
- context: underlyingTokenContext,
38
- method: 'decimals',
39
- });
40
- if (allowance < allowanceAmount) {
41
- const latestLedger = await (0, utils_1.getLatestLedger)(network);
42
- // @TODO find a better to advance the ledger number
43
- const advanceLedgerNum = 3000000;
44
- const result = await (0, utils_1.sendTransaction)({
45
- context: underlyingTokenContext,
46
- method: 'approve',
47
- params: [
48
- {
49
- name: 'from',
50
- type: utils_1.ScValType.address,
51
- value: wallet.userInfo.publicKey,
52
- },
53
- {
54
- name: 'spender',
55
- type: utils_1.ScValType.address,
56
- value: spenderAddress,
57
- },
58
- {
59
- name: 'amount',
60
- type: utils_1.ScValType.i128,
61
- value: 1000000000 * Math.pow(10, Number(decimals)),
62
- },
63
- {
64
- name: 'expiration_ledger',
65
- type: utils_1.ScValType.u32,
66
- value: latestLedger.sequence + advanceLedgerNum,
67
- },
68
- ],
69
- shouldSignTransaction: true,
70
- });
71
- return result;
72
- }
73
- return null;
52
+ return result;
74
53
  }
75
- exports.approveSep41AllowanceIfInsufficient = approveSep41AllowanceIfInsufficient;
76
- //# sourceMappingURL=Sep41ContractHelper.js.map
54
+ exports.approveSep41Allowance = approveSep41Allowance;
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./CreditContractHelper"), exports);
5
5
  tslib_1.__exportStar(require("./Sep41ContractHelper"), exports);
6
- //# sourceMappingURL=index.js.map
package/dist/cjs/index.js CHANGED
@@ -4,4 +4,3 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./helpers"), exports);
5
5
  tslib_1.__exportStar(require("./services"), exports);
6
6
  tslib_1.__exportStar(require("./utils"), exports);
7
- //# sourceMappingURL=index.js.map
@@ -1,47 +1,43 @@
1
1
  "use strict";
2
- var _HumaContextStellar_wallet, _HumaContextStellar_network, _HumaContextStellar_poolName, _HumaContextStellar_poolType;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.HumaContextStellar = void 0;
5
- const tslib_1 = require("tslib");
6
4
  class HumaContextStellar {
5
+ #wallet;
6
+ #network;
7
+ #poolName;
8
+ #poolType;
7
9
  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
10
  if (!wallet || !network || !poolName || !poolType) {
13
11
  throw new Error('All parameters are required');
14
12
  }
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");
13
+ this.#wallet = wallet;
14
+ this.#network = network;
15
+ this.#poolName = poolName;
16
+ this.#poolType = poolType;
19
17
  }
20
18
  get wallet() {
21
- return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_wallet, "f");
19
+ return this.#wallet;
22
20
  }
23
21
  set wallet(value) {
24
- tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_wallet, value, "f");
22
+ this.#wallet = value;
25
23
  }
26
24
  get network() {
27
- return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_network, "f");
25
+ return this.#network;
28
26
  }
29
27
  set network(value) {
30
- tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_network, value, "f");
28
+ this.#network = value;
31
29
  }
32
30
  get poolName() {
33
- return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_poolName, "f");
31
+ return this.#poolName;
34
32
  }
35
33
  set poolName(value) {
36
- tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_poolName, value, "f");
34
+ this.#poolName = value;
37
35
  }
38
36
  get poolType() {
39
- return tslib_1.__classPrivateFieldGet(this, _HumaContextStellar_poolType, "f");
37
+ return this.#poolType;
40
38
  }
41
39
  set poolType(value) {
42
- tslib_1.__classPrivateFieldSet(this, _HumaContextStellar_poolType, value, "f");
40
+ this.#poolType = value;
43
41
  }
44
42
  }
45
43
  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
@@ -1,29 +1,25 @@
1
1
  "use strict";
2
- var _StellarWallet_sourceKeypair;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.StellarWallet = void 0;
5
- const tslib_1 = require("tslib");
6
4
  const stellar_sdk_1 = require("@stellar/stellar-sdk");
7
5
  class StellarWallet {
6
+ #sourceKeypair;
8
7
  constructor(secretKey) {
9
- _StellarWallet_sourceKeypair.set(this, void 0);
10
- tslib_1.__classPrivateFieldSet(this, _StellarWallet_sourceKeypair, stellar_sdk_1.Keypair.fromSecret(secretKey), "f");
8
+ this.#sourceKeypair = stellar_sdk_1.Keypair.fromSecret(secretKey);
11
9
  }
12
10
  get keypair() {
13
- return tslib_1.__classPrivateFieldGet(this, _StellarWallet_sourceKeypair, "f");
11
+ return this.#sourceKeypair;
14
12
  }
15
13
  get userInfo() {
16
14
  return {
17
- publicKey: tslib_1.__classPrivateFieldGet(this, _StellarWallet_sourceKeypair, "f").publicKey(),
15
+ publicKey: this.#sourceKeypair.publicKey(),
18
16
  };
19
17
  }
20
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
19
  async signTransaction(tx, opts) {
22
20
  const txFromXDR = new stellar_sdk_1.Transaction(tx, opts.networkPassphrase);
23
- txFromXDR.sign(tslib_1.__classPrivateFieldGet(this, _StellarWallet_sourceKeypair, "f"));
21
+ txFromXDR.sign(this.#sourceKeypair);
24
22
  return txFromXDR.toXDR();
25
23
  }
26
24
  }
27
25
  exports.StellarWallet = StellarWallet;
28
- _StellarWallet_sourceKeypair = new WeakMap();
29
- //# sourceMappingURL=StellarWallet.js.map
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./HumaContextStellar"), exports);
5
5
  tslib_1.__exportStar(require("./StellarWallet"), exports);
6
- //# sourceMappingURL=index.js.map
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
- var _TransactionContext_client, _TransactionContext_wallet, _TransactionContext_network, _TransactionContext_contractId;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.TransactionContext = exports.getUnderlyingTokenClient = exports.getTrancheVaultClient = exports.getCreditManagerClient = exports.getCreditStorageClient = exports.getPoolCreditClient = exports.getPoolStorageClient = exports.getPoolClient = void 0;
5
- const tslib_1 = require("tslib");
6
4
  const soroban_credit_manager_1 = require("@huma-finance/soroban-credit-manager");
7
5
  const soroban_credit_storage_1 = require("@huma-finance/soroban-credit-storage");
8
6
  const soroban_huma_config_1 = require("@huma-finance/soroban-huma-config");
@@ -109,11 +107,11 @@ const getUnderlyingTokenClient = (tokenAddress, network, wallet) => {
109
107
  };
110
108
  exports.getUnderlyingTokenClient = getUnderlyingTokenClient;
111
109
  class TransactionContext {
110
+ #client;
111
+ #wallet;
112
+ #network;
113
+ #contractId;
112
114
  constructor(poolName, network, wallet, contractType) {
113
- _TransactionContext_client.set(this, void 0);
114
- _TransactionContext_wallet.set(this, void 0);
115
- _TransactionContext_network.set(this, void 0);
116
- _TransactionContext_contractId.set(this, void 0);
117
115
  const poolMetadata = (0, common_1.findPoolMetadata)(network, poolName);
118
116
  if (!poolMetadata) {
119
117
  throw new Error(`Could not find pool metadata by pool name: ${poolName}`);
@@ -130,24 +128,22 @@ class TransactionContext {
130
128
  contractId: poolMetadata.contracts[contractType],
131
129
  ...getCommonProps(network, wallet),
132
130
  });
133
- tslib_1.__classPrivateFieldSet(this, _TransactionContext_client, client, "f");
134
- tslib_1.__classPrivateFieldSet(this, _TransactionContext_wallet, wallet, "f");
135
- tslib_1.__classPrivateFieldSet(this, _TransactionContext_network, network, "f");
136
- tslib_1.__classPrivateFieldSet(this, _TransactionContext_contractId, client.options.contractId, "f");
131
+ this.#client = client;
132
+ this.#wallet = wallet;
133
+ this.#network = network;
134
+ this.#contractId = client.options.contractId;
137
135
  }
138
136
  get client() {
139
- return tslib_1.__classPrivateFieldGet(this, _TransactionContext_client, "f");
137
+ return this.#client;
140
138
  }
141
139
  get wallet() {
142
- return tslib_1.__classPrivateFieldGet(this, _TransactionContext_wallet, "f");
140
+ return this.#wallet;
143
141
  }
144
142
  get network() {
145
- return tslib_1.__classPrivateFieldGet(this, _TransactionContext_network, "f");
143
+ return this.#network;
146
144
  }
147
145
  get contractId() {
148
- return tslib_1.__classPrivateFieldGet(this, _TransactionContext_contractId, "f");
146
+ return this.#contractId;
149
147
  }
150
148
  }
151
149
  exports.TransactionContext = TransactionContext;
152
- _TransactionContext_client = new WeakMap(), _TransactionContext_wallet = new WeakMap(), _TransactionContext_network = new WeakMap(), _TransactionContext_contractId = new WeakMap();
153
- //# sourceMappingURL=client.js.map
@@ -58,4 +58,3 @@ const getLatestLedger = async (network) => {
58
58
  return server.getLatestLedger();
59
59
  };
60
60
  exports.getLatestLedger = getLatestLedger;
61
- //# sourceMappingURL=common.js.map
@@ -5,4 +5,3 @@ tslib_1.__exportStar(require("./client"), exports);
5
5
  tslib_1.__exportStar(require("./common"), exports);
6
6
  tslib_1.__exportStar(require("./network"), exports);
7
7
  tslib_1.__exportStar(require("./transaction"), exports);
8
- //# sourceMappingURL=index.js.map
@@ -55,7 +55,7 @@ exports.NetworkMetadatas = [
55
55
  seniorTranche: 'CAEVE6BJIXQV54DGNFZ5GRIMIIITAHXSOWTGKTDZCQZA4FXK4ZNDZYFX',
56
56
  underlyingToken: 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75',
57
57
  },
58
- borrowers: ['GBQ4MIGKASCJG4GNEOQ3G6Z6YDUXCAKYARB3MNJ7QOF54MNMYW7HP62V'], // TODO: Replace with Arf
58
+ borrowers: ['GBQ4MIGKASCJG4GNEOQ3G6Z6YDUXCAKYARB3MNJ7QOF54MNMYW7HP62V'],
59
59
  },
60
60
  ],
61
61
  },
@@ -131,4 +131,3 @@ exports.NetworkMetadatas = [
131
131
  ],
132
132
  },
133
133
  ];
134
- //# sourceMappingURL=network.js.map
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  import { SorobanRpc, xdr } from '@stellar/stellar-sdk';
4
- import { SentTransaction } from '@stellar/stellar-sdk/lib/contract';
5
4
  import { StellarWallet } from 'services';
6
5
  import { TransactionContext } from './client';
7
6
  import { ScValType } from './common';
@@ -14,7 +13,7 @@ export declare const restoreAndExtendTTL: (network: StellarNetwork, wallet: Stel
14
13
  type: ScValType;
15
14
  value: string | number | bigint;
16
15
  }[]) => Promise<void>;
17
- export declare const sendTransaction: <T = null>({ context, method, params, shouldSignTransaction, }: {
16
+ export declare const sendTransaction: ({ context, method, params, shouldSignTransaction, }: {
18
17
  context: TransactionContext;
19
18
  method: string;
20
19
  params?: {
@@ -23,4 +22,4 @@ export declare const sendTransaction: <T = null>({ context, method, params, shou
23
22
  value: string | number | bigint | Buffer;
24
23
  }[] | undefined;
25
24
  shouldSignTransaction?: boolean | undefined;
26
- }) => Promise<SentTransaction<T>>;
25
+ }) => Promise<any>;
@@ -122,4 +122,3 @@ const sendTransaction = async ({ context, method, params = [], shouldSignTransac
122
122
  return tx.signAndSend();
123
123
  };
124
124
  exports.sendTransaction = sendTransaction;
125
- //# sourceMappingURL=transaction.js.map
@@ -1,5 +1,4 @@
1
1
  import { CreditRecord } from '@huma-finance/soroban-pool-credit';
2
- import { SentTransaction } from '@stellar/stellar-sdk/lib/contract';
3
2
  import { StellarWallet } from '../services';
4
3
  import { POOL_NAME, StellarNetwork } from '../utils';
5
4
  /**
@@ -49,9 +48,8 @@ export declare function getTotalDue(poolName: POOL_NAME, network: StellarNetwork
49
48
  * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
50
49
  * @param {StellarNetwork} network - The stellar network.
51
50
  * @param {StellarWallet} wallet - The stellar wallet.
52
- * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
53
51
  */
54
- export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): Promise<SentTransaction<null> | null>;
52
+ export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet): Promise<any>;
55
53
  /**
56
54
  * Draws down from a pool.
57
55
  *
@@ -63,7 +61,7 @@ export declare function approveAllowanceForSentinel(poolName: POOL_NAME, network
63
61
  * @param {BigNumberish} drawdownAmount - The amount to drawdown.
64
62
  * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
65
63
  */
66
- export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, drawdownAmount: bigint): Promise<SentTransaction<null>>;
64
+ export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, drawdownAmount: bigint): Promise<any>;
67
65
  /**
68
66
  * Makes a payment.
69
67
  *
@@ -76,4 +74,4 @@ export declare function drawdown(poolName: POOL_NAME, network: StellarNetwork, w
76
74
  * @param {boolean} principalOnly - Whether this payment should ONLY apply to the principal
77
75
  * @returns {Promise<SentTransaction>} - A Promise of the SentTransaction.
78
76
  */
79
- export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<SentTransaction<readonly [bigint, boolean]>>;
77
+ export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<any>;