@huma-finance/soroban-sdk 0.0.15-beta.50 → 0.0.15-beta.53
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 +2 -5
- package/dist/cjs/helpers/CreditContractHelper.d.ts +5 -5
- package/dist/cjs/helpers/CreditContractHelper.js +0 -2
- package/dist/cjs/helpers/Sep41ContractHelper.d.ts +1 -2
- package/dist/cjs/helpers/Sep41ContractHelper.js +2 -3
- package/dist/cjs/helpers/index.js +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/services/HumaContextStellar.js +16 -20
- package/dist/cjs/services/StellarWallet.js +5 -9
- package/dist/cjs/services/index.js +0 -1
- package/dist/cjs/utils/client.d.ts +3 -1
- package/dist/cjs/utils/client.js +19 -19
- package/dist/cjs/utils/common.js +0 -1
- package/dist/cjs/utils/index.js +0 -1
- package/dist/cjs/utils/network.js +1 -2
- package/dist/cjs/utils/transaction.d.ts +2 -3
- package/dist/cjs/utils/transaction.js +0 -1
- package/dist/helpers/CreditContractHelper.d.ts +5 -5
- package/dist/helpers/CreditContractHelper.js +47 -38
- package/dist/helpers/CreditContractHelper.js.map +1 -1
- package/dist/helpers/Sep41ContractHelper.d.ts +1 -2
- package/dist/helpers/Sep41ContractHelper.js +19 -15
- package/dist/helpers/Sep41ContractHelper.js.map +1 -1
- package/dist/helpers/index.js +5 -2
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/services/HumaContextStellar.js +21 -20
- package/dist/services/HumaContextStellar.js.map +1 -1
- package/dist/services/StellarWallet.js +12 -11
- package/dist/services/StellarWallet.js.map +1 -1
- package/dist/services/index.js +5 -2
- package/dist/services/index.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils/client.d.ts +3 -1
- package/dist/utils/client.js +69 -57
- package/dist/utils/client.js.map +1 -1
- package/dist/utils/common.js +25 -19
- package/dist/utils/common.js.map +1 -1
- package/dist/utils/index.js +7 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/network.js +15 -12
- package/dist/utils/network.js.map +1 -1
- package/dist/utils/transaction.d.ts +2 -3
- package/dist/utils/transaction.js +39 -31
- package/dist/utils/transaction.js.map +1 -1
- package/package.json +12 -11
- package/dist/cjs/helpers/CreditContractHelper.js.map +0 -1
- package/dist/cjs/helpers/Sep41ContractHelper.js.map +0 -1
- package/dist/cjs/helpers/index.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/services/HumaContextStellar.js.map +0 -1
- package/dist/cjs/services/StellarWallet.js.map +0 -1
- package/dist/cjs/services/index.js.map +0 -1
- package/dist/cjs/utils/client.js.map +0 -1
- package/dist/cjs/utils/common.js.map +0 -1
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/network.js.map +0 -1
- package/dist/cjs/utils/transaction.js.map +0 -1
package/API.md
CHANGED
|
@@ -12,7 +12,7 @@ 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
|
|
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.<SentTransaction></code></dt>
|
|
18
18
|
<dd><p>Draws down from a pool.</p></dd>
|
|
@@ -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)
|
|
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.<SentTransaction></code> - <ul>
|
|
92
|
-
<li>A Promise of the SentTransaction.</li>
|
|
93
|
-
</ul>
|
|
94
91
|
|
|
95
92
|
| Param | Type | Description |
|
|
96
93
|
| --- | --- | --- |
|
|
@@ -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<
|
|
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<
|
|
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,6 @@ 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<
|
|
77
|
+
export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<{
|
|
78
|
+
result: readonly [bigint, boolean];
|
|
79
|
+
}>;
|
|
@@ -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);
|
|
@@ -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,4 +1,3 @@
|
|
|
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
|
/**
|
|
@@ -14,4 +13,4 @@ import { POOL_NAME, StellarNetwork } from '../utils';
|
|
|
14
13
|
* @param {bigint} allowanceAmount - The amount of tokens to approve, if applicable. Denominated in the Sep41 tokens.
|
|
15
14
|
* @returns {Promise<SentTransaction<null> | null>} - A Promise of the transaction response, or null if the allowance was already sufficient.
|
|
16
15
|
*/
|
|
17
|
-
export declare function approveSep41AllowanceIfInsufficient(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, spenderAddress: string, allowanceAmount: bigint): Promise<
|
|
16
|
+
export declare function approveSep41AllowanceIfInsufficient(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, spenderAddress: string, allowanceAmount: bigint): Promise<any>;
|
|
@@ -40,7 +40,7 @@ async function approveSep41AllowanceIfInsufficient(poolName, network, wallet, sp
|
|
|
40
40
|
if (allowance < allowanceAmount) {
|
|
41
41
|
const latestLedger = await (0, utils_1.getLatestLedger)(network);
|
|
42
42
|
// @TODO find a better to advance the ledger number
|
|
43
|
-
const advanceLedgerNum =
|
|
43
|
+
const advanceLedgerNum = 3_000_000;
|
|
44
44
|
const result = await (0, utils_1.sendTransaction)({
|
|
45
45
|
context: underlyingTokenContext,
|
|
46
46
|
method: 'approve',
|
|
@@ -58,7 +58,7 @@ async function approveSep41AllowanceIfInsufficient(poolName, network, wallet, sp
|
|
|
58
58
|
{
|
|
59
59
|
name: 'amount',
|
|
60
60
|
type: utils_1.ScValType.i128,
|
|
61
|
-
value:
|
|
61
|
+
value: 1000_000_000 * Math.pow(10, Number(decimals)),
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
name: 'expiration_ledger',
|
|
@@ -73,4 +73,3 @@ async function approveSep41AllowanceIfInsufficient(poolName, network, wallet, sp
|
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
75
|
exports.approveSep41AllowanceIfInsufficient = approveSep41AllowanceIfInsufficient;
|
|
76
|
-
//# sourceMappingURL=Sep41ContractHelper.js.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
this.#wallet = wallet;
|
|
14
|
+
this.#network = network;
|
|
15
|
+
this.#poolName = poolName;
|
|
16
|
+
this.#poolType = poolType;
|
|
19
17
|
}
|
|
20
18
|
get wallet() {
|
|
21
|
-
return
|
|
19
|
+
return this.#wallet;
|
|
22
20
|
}
|
|
23
21
|
set wallet(value) {
|
|
24
|
-
|
|
22
|
+
this.#wallet = value;
|
|
25
23
|
}
|
|
26
24
|
get network() {
|
|
27
|
-
return
|
|
25
|
+
return this.#network;
|
|
28
26
|
}
|
|
29
27
|
set network(value) {
|
|
30
|
-
|
|
28
|
+
this.#network = value;
|
|
31
29
|
}
|
|
32
30
|
get poolName() {
|
|
33
|
-
return
|
|
31
|
+
return this.#poolName;
|
|
34
32
|
}
|
|
35
33
|
set poolName(value) {
|
|
36
|
-
|
|
34
|
+
this.#poolName = value;
|
|
37
35
|
}
|
|
38
36
|
get poolType() {
|
|
39
|
-
return
|
|
37
|
+
return this.#poolType;
|
|
40
38
|
}
|
|
41
39
|
set poolType(value) {
|
|
42
|
-
|
|
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
|
-
|
|
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
|
|
11
|
+
return this.#sourceKeypair;
|
|
14
12
|
}
|
|
15
13
|
get userInfo() {
|
|
16
14
|
return {
|
|
17
|
-
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(
|
|
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
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Client as CreditManagerClient } from '@huma-finance/soroban-credit-manager';
|
|
2
2
|
import { Client as CreditStorageClient } from '@huma-finance/soroban-credit-storage';
|
|
3
|
+
import { Client as HumaConfigClient } from '@huma-finance/soroban-huma-config';
|
|
3
4
|
import { Client as PoolClient } from '@huma-finance/soroban-pool';
|
|
5
|
+
import { Client as PoolManagerClient } from '@huma-finance/soroban-pool-manager';
|
|
4
6
|
import { Client as PoolCreditClient } from '@huma-finance/soroban-pool-credit';
|
|
5
7
|
import { Client as PoolStorageClient } from '@huma-finance/soroban-pool-storage';
|
|
6
8
|
import { Client as Sep41Client } from '@huma-finance/soroban-sep41';
|
|
7
9
|
import { Client as TrancheVaultClient } from '@huma-finance/soroban-tranche-vault';
|
|
8
10
|
import { StellarWallet } from '../services/StellarWallet';
|
|
9
11
|
import { ContractType, POOL_NAME, StellarNetwork } from './network';
|
|
10
|
-
export type Client =
|
|
12
|
+
export type Client = CreditManagerClient | CreditStorageClient | HumaConfigClient | PoolClient | PoolCreditClient | PoolManagerClient | PoolStorageClient | Sep41Client | TrancheVaultClient;
|
|
11
13
|
export declare const getPoolClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolClient | undefined;
|
|
12
14
|
export declare const getPoolStorageClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolStorageClient | undefined;
|
|
13
15
|
export declare const getPoolCreditClient: (poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet) => PoolCreditClient | undefined;
|
package/dist/cjs/utils/client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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");
|
|
6
|
+
const soroban_huma_config_1 = require("@huma-finance/soroban-huma-config");
|
|
8
7
|
const soroban_pool_1 = require("@huma-finance/soroban-pool");
|
|
8
|
+
const soroban_pool_manager_1 = require("@huma-finance/soroban-pool-manager");
|
|
9
9
|
const soroban_pool_credit_1 = require("@huma-finance/soroban-pool-credit");
|
|
10
10
|
const soroban_pool_storage_1 = require("@huma-finance/soroban-pool-storage");
|
|
11
11
|
const soroban_sep41_1 = require("@huma-finance/soroban-sep41");
|
|
@@ -13,14 +13,16 @@ const soroban_tranche_vault_1 = require("@huma-finance/soroban-tranche-vault");
|
|
|
13
13
|
const common_1 = require("./common");
|
|
14
14
|
const network_1 = require("./network");
|
|
15
15
|
const ClientMap = {
|
|
16
|
-
poolCredit: soroban_pool_credit_1.Client,
|
|
17
|
-
creditStorage: soroban_credit_storage_1.Client,
|
|
18
16
|
creditManager: soroban_credit_manager_1.Client,
|
|
17
|
+
creditStorage: soroban_credit_storage_1.Client,
|
|
18
|
+
humaConfig: soroban_huma_config_1.Client,
|
|
19
19
|
pool: soroban_pool_1.Client,
|
|
20
|
+
poolCredit: soroban_pool_credit_1.Client,
|
|
21
|
+
poolManager: soroban_pool_manager_1.Client,
|
|
20
22
|
poolStorage: soroban_pool_storage_1.Client,
|
|
23
|
+
underlyingToken: soroban_sep41_1.Client,
|
|
21
24
|
juniorTranche: soroban_tranche_vault_1.Client,
|
|
22
25
|
seniorTranche: soroban_tranche_vault_1.Client,
|
|
23
|
-
underlyingToken: soroban_sep41_1.Client,
|
|
24
26
|
};
|
|
25
27
|
const getCommonProps = (network, wallet) => {
|
|
26
28
|
return {
|
|
@@ -105,11 +107,11 @@ const getUnderlyingTokenClient = (tokenAddress, network, wallet) => {
|
|
|
105
107
|
};
|
|
106
108
|
exports.getUnderlyingTokenClient = getUnderlyingTokenClient;
|
|
107
109
|
class TransactionContext {
|
|
110
|
+
#client;
|
|
111
|
+
#wallet;
|
|
112
|
+
#network;
|
|
113
|
+
#contractId;
|
|
108
114
|
constructor(poolName, network, wallet, contractType) {
|
|
109
|
-
_TransactionContext_client.set(this, void 0);
|
|
110
|
-
_TransactionContext_wallet.set(this, void 0);
|
|
111
|
-
_TransactionContext_network.set(this, void 0);
|
|
112
|
-
_TransactionContext_contractId.set(this, void 0);
|
|
113
115
|
const poolMetadata = (0, common_1.findPoolMetadata)(network, poolName);
|
|
114
116
|
if (!poolMetadata) {
|
|
115
117
|
throw new Error(`Could not find pool metadata by pool name: ${poolName}`);
|
|
@@ -126,24 +128,22 @@ class TransactionContext {
|
|
|
126
128
|
contractId: poolMetadata.contracts[contractType],
|
|
127
129
|
...getCommonProps(network, wallet),
|
|
128
130
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
this.#client = client;
|
|
132
|
+
this.#wallet = wallet;
|
|
133
|
+
this.#network = network;
|
|
134
|
+
this.#contractId = client.options.contractId;
|
|
133
135
|
}
|
|
134
136
|
get client() {
|
|
135
|
-
return
|
|
137
|
+
return this.#client;
|
|
136
138
|
}
|
|
137
139
|
get wallet() {
|
|
138
|
-
return
|
|
140
|
+
return this.#wallet;
|
|
139
141
|
}
|
|
140
142
|
get network() {
|
|
141
|
-
return
|
|
143
|
+
return this.#network;
|
|
142
144
|
}
|
|
143
145
|
get contractId() {
|
|
144
|
-
return
|
|
146
|
+
return this.#contractId;
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
exports.TransactionContext = TransactionContext;
|
|
148
|
-
_TransactionContext_client = new WeakMap(), _TransactionContext_wallet = new WeakMap(), _TransactionContext_network = new WeakMap(), _TransactionContext_contractId = new WeakMap();
|
|
149
|
-
//# sourceMappingURL=client.js.map
|
package/dist/cjs/utils/common.js
CHANGED
package/dist/cjs/utils/index.js
CHANGED
|
@@ -55,7 +55,7 @@ exports.NetworkMetadatas = [
|
|
|
55
55
|
seniorTranche: 'CAEVE6BJIXQV54DGNFZ5GRIMIIITAHXSOWTGKTDZCQZA4FXK4ZNDZYFX',
|
|
56
56
|
underlyingToken: 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75',
|
|
57
57
|
},
|
|
58
|
-
borrowers: ['GBQ4MIGKASCJG4GNEOQ3G6Z6YDUXCAKYARB3MNJ7QOF54MNMYW7HP62V'],
|
|
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:
|
|
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<
|
|
25
|
+
}) => Promise<any>;
|
|
@@ -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<
|
|
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<
|
|
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,6 @@ 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<
|
|
77
|
+
export declare function makePayment(poolName: POOL_NAME, network: StellarNetwork, wallet: StellarWallet, paymentAmount: bigint, principalOnly: boolean): Promise<{
|
|
78
|
+
result: readonly [bigint, boolean];
|
|
79
|
+
}>;
|