@kasufinance/kasu-sdk 2.7.0 → 2.8.0

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.
@@ -32,6 +32,8 @@ export { maxNetRateCeiling, pickHighestYieldTranche, poolMaxApy, selectVisiblePo
32
32
  export type { BestTranche } from './pools';
33
33
  export { countSubmissions, deriveRequestState, firstSubmissionTimestamp, isCycleClosed, lastEventTimestamp, submissionEvents, } from './requests';
34
34
  export type { RequestKind, RequestState, RequestStatusCode, } from './requests';
35
+ export { decodeRevert, extractRevertData } from './revert-errors';
36
+ export type { DecodedRevert, RevertFamily } from './revert-errors';
35
37
  export { CLEARING_WINDOW_SECONDS, computeSettlementWindow, deriveCycleDates, nextCycleBoundary, } from './settlement';
36
38
  export type { CycleDates, SettlementWindowInput, SettlementWindowState, } from './settlement';
37
39
  export { getTrancheDisplayName, UPPER_MEZZANINE } from './tranche-display-name';
@@ -26,6 +26,7 @@ export { APXIUM, getCreditOriginator, getInstitutionalLender, INVOICEMATE, RIXON
26
26
  export { asContractType, buildContractVersionType, buildFullNameRequestMessage, buildLegacyContractRequestMessage, buildLoanAgreementSignMessage, encodeDepositData, formatSignTimestampUtc, parseFormattedMessage, } from './loan-contract';
27
27
  export { maxNetRateCeiling, pickHighestYieldTranche, poolMaxApy, selectVisiblePools, } from './pools';
28
28
  export { countSubmissions, deriveRequestState, firstSubmissionTimestamp, isCycleClosed, lastEventTimestamp, submissionEvents, } from './requests';
29
+ export { decodeRevert, extractRevertData } from './revert-errors';
29
30
  export { CLEARING_WINDOW_SECONDS, computeSettlementWindow, deriveCycleDates, nextCycleBoundary, } from './settlement';
30
31
  export { getTrancheDisplayName, UPPER_MEZZANINE } from './tranche-display-name';
31
32
  export { compareTrancheSeniority, derivePoolStatus, MIN_TRANCHE_CAPACITY, netTrancheApyBounds, pickDefaultTrancheId, poolAllTranchesFull, trancheApyBounds, trancheHasCapacity, trancheRiskRank, } from './tranches';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACH,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACH,SAAS,EACT,2BAA2B,EAC3B,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACH,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACH,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,aAAa,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACH,cAAc,EACd,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACxB,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,YAAY,CAAC;AAOpB,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EACH,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAClB,MAAM,YAAY,CAAC;AAOpB,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,GACjB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACH,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACH,SAAS,EACT,2BAA2B,EAC3B,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACH,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACH,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,aAAa,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACH,cAAc,EACd,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACxB,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EACH,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAClB,MAAM,YAAY,CAAC;AAOpB,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,GACjB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Revert decoding — turn the bytes a failed call came back with into the name
3
+ * the contract actually reverted with.
4
+ *
5
+ * `isUnpredictableGas` says only THAT the call would revert. That was enough
6
+ * while the answer was always the same one: a `transferFrom` failing on a
7
+ * balance that cannot cover the deposit. It is not enough any more, because
8
+ * `requestDepositWithKyc` reverts for a whole family of reasons the ABI
9
+ * declares and the lender can do nothing about — the pool is stopped, the pool
10
+ * is mid-clearing, their KYC lapsed, they are not on the allow list, the
11
+ * allow-list signature's block window closed. Every one of those was reported
12
+ * as "insufficient balance", so a fully funded lender was told to top up a
13
+ * wallet that was never short.
14
+ *
15
+ * The revert data carries the answer. This module extracts it from whatever
16
+ * envelope the provider wrapped it in and matches the 4-byte selector against
17
+ * the custom errors the protocol declares.
18
+ *
19
+ * Pure, like everything else in `domain/`: bytes in, a name out. It never
20
+ * decides what a lender is shown — `DepositFlow` maps the name to a code and
21
+ * the application maps the code to its own words.
22
+ */
23
+ /**
24
+ * Which family a recognised revert belongs to, because the two are acted on
25
+ * differently.
26
+ *
27
+ * `erc20` is the case `insufficient-balance` was named for and still means:
28
+ * the token transfer itself failed, so the lender genuinely has to fund or
29
+ * re-approve. `protocol` is everything else the protocol declares — a
30
+ * condition of the pool or the lender's standing, which topping up cannot fix.
31
+ */
32
+ export type RevertFamily = 'protocol' | 'erc20';
33
+ export interface DecodedRevert {
34
+ /** The custom error's name, exactly as the ABI declares it. */
35
+ name: string;
36
+ family: RevertFamily;
37
+ /** The reason of a `require(..., "…")` revert, when it was one. */
38
+ reason?: string;
39
+ }
40
+ /**
41
+ * Find the revert data on an error, wherever the provider left it.
42
+ *
43
+ * ethers v5 raises `UNPREDICTABLE_GAS_LIMIT` with the provider's own error
44
+ * attached, and each provider nests the bytes one layer differently:
45
+ * `error.data`, `error.error.data`, `error.data.originalError.data`, or only
46
+ * inside the JSON `body` of a `SERVER_ERROR`. Rather than enumerate the
47
+ * products, walk a fixed set of keys to a fixed depth and take the first value
48
+ * that is shaped like revert data.
49
+ */
50
+ export declare function extractRevertData(err: unknown): string | null;
51
+ /**
52
+ * Decode a failed call's revert into the error the contract named, or `null`
53
+ * when there is nothing recognisable to name.
54
+ *
55
+ * `null` is the honest answer for an unknown selector, an unrelated `require`
56
+ * string, or an error with no revert data at all — the caller keeps whatever
57
+ * it did before rather than inventing a diagnosis from bytes it cannot read.
58
+ */
59
+ export declare function decodeRevert(err: unknown): DecodedRevert | null;
@@ -0,0 +1,190 @@
1
+ import { ethers } from 'ethers';
2
+ import { IKasuAllowListAbi__factory } from '../contracts/factories/IKasuAllowListAbi__factory';
3
+ import { ILendingPoolManagerAbi__factory } from '../contracts/factories/ILendingPoolManagerAbi__factory';
4
+ // ---------------------------------------------------------------------------
5
+ // The selector tables
6
+ // ---------------------------------------------------------------------------
7
+ /**
8
+ * OpenZeppelin v5's ERC-20 errors. They are not in either Kasu ABI because no
9
+ * Kasu contract declares them — they arrive from the TOKEN, through the
10
+ * manager's `transferFrom`, and they are the modern spelling of the string
11
+ * reverts below.
12
+ */
13
+ const ERC20_ERROR_ABI = [
14
+ 'error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed)',
15
+ 'error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed)',
16
+ ];
17
+ /**
18
+ * The protocol errors that mean the ERC-20 transfer failed rather than the
19
+ * protocol refusing.
20
+ *
21
+ * `SafeERC20FailedOperation` is OpenZeppelin's wrapper around a token call
22
+ * that returned false or reverted, which on this path IS the `transferFrom`;
23
+ * `AddressInsufficientBalance` is its native-value sibling. Both belong with
24
+ * the balance case, not with the pool conditions — a lender who sees one of
25
+ * them really does need to fund or re-approve.
26
+ */
27
+ const ERC20_FAMILY_NAMES = new Set([
28
+ 'AddressInsufficientBalance',
29
+ 'ERC20InsufficientAllowance',
30
+ 'ERC20InsufficientBalance',
31
+ 'SafeERC20FailedOperation',
32
+ ]);
33
+ /** Solidity's `Error(string)`, the selector every `require` reason arrives under. */
34
+ const STRING_REVERT_SELECTOR = '0x08c379a0';
35
+ /**
36
+ * The `require` reasons that are a balance or an allowance, across the token
37
+ * implementations in circulation: OpenZeppelin v4's sentences, and the
38
+ * shorthand the minimal implementations use.
39
+ */
40
+ const ERC20_REASON_PATTERNS = [
41
+ /exceeds\s+balance/,
42
+ /exceeds\s+allowance/,
43
+ /insufficient\s+balance/,
44
+ /insufficient\s+allowance/,
45
+ /transfer_from_failed/,
46
+ /transferfrom\s+failed/,
47
+ /low-level\s+call\s+failed/,
48
+ ];
49
+ /**
50
+ * selector → error name, built once on first use.
51
+ *
52
+ * Lazily, because a consumer that never sees a revert should not pay for three
53
+ * `Interface` constructions at import. The two Kasu tables are the GENERATED
54
+ * typechain ABIs, so this cannot drift from the contracts: regenerate the ABIs
55
+ * and the new errors are recognised with no edit here.
56
+ */
57
+ let selectorTable = null;
58
+ function selectors() {
59
+ if (selectorTable)
60
+ return selectorTable;
61
+ const table = new Map();
62
+ const interfaces = [
63
+ // The manager the deposit is called against, and the allow list it
64
+ // delegates the KYC and block-window checks to.
65
+ ILendingPoolManagerAbi__factory.createInterface(),
66
+ IKasuAllowListAbi__factory.createInterface(),
67
+ new ethers.utils.Interface(ERC20_ERROR_ABI),
68
+ ];
69
+ for (const iface of interfaces) {
70
+ for (const fragment of Object.values(iface.errors)) {
71
+ // First writer wins: the same name declared by both ABIs is the
72
+ // same selector, so the duplicate would be a no-op anyway.
73
+ const sighash = iface.getSighash(fragment);
74
+ if (!table.has(sighash))
75
+ table.set(sighash, fragment.name);
76
+ }
77
+ }
78
+ selectorTable = table;
79
+ return table;
80
+ }
81
+ // ---------------------------------------------------------------------------
82
+ // Getting the bytes out of the envelope
83
+ // ---------------------------------------------------------------------------
84
+ /**
85
+ * How deep to look for the revert data. Providers nest it differently —
86
+ * ethers' own error wraps the provider's, which wraps the RPC body — and a
87
+ * bound is what keeps a self-referencing error object from being walked
88
+ * forever.
89
+ */
90
+ const MAX_DEPTH = 6;
91
+ /** The keys ethers and the providers under it put a wrapped error on. */
92
+ const NESTED_KEYS = [
93
+ 'data',
94
+ 'error',
95
+ 'originalError',
96
+ 'info',
97
+ 'cause',
98
+ 'body',
99
+ ];
100
+ /** At least a 4-byte selector, and a whole number of bytes. */
101
+ function isRevertData(value) {
102
+ return (value.length >= 10 &&
103
+ value.length % 2 === 0 &&
104
+ /^0x[0-9a-fA-F]+$/.test(value));
105
+ }
106
+ /**
107
+ * Find the revert data on an error, wherever the provider left it.
108
+ *
109
+ * ethers v5 raises `UNPREDICTABLE_GAS_LIMIT` with the provider's own error
110
+ * attached, and each provider nests the bytes one layer differently:
111
+ * `error.data`, `error.error.data`, `error.data.originalError.data`, or only
112
+ * inside the JSON `body` of a `SERVER_ERROR`. Rather than enumerate the
113
+ * products, walk a fixed set of keys to a fixed depth and take the first value
114
+ * that is shaped like revert data.
115
+ */
116
+ export function extractRevertData(err) {
117
+ return walk(err, 0);
118
+ }
119
+ function walk(node, depth) {
120
+ if (node == null || depth > MAX_DEPTH)
121
+ return null;
122
+ if (typeof node === 'string') {
123
+ if (isRevertData(node))
124
+ return node;
125
+ // A `SERVER_ERROR`'s body: the RPC's JSON reply, verbatim.
126
+ if (!node.startsWith('{'))
127
+ return null;
128
+ try {
129
+ return walk(JSON.parse(node), depth + 1);
130
+ }
131
+ catch (_a) {
132
+ return null;
133
+ }
134
+ }
135
+ if (typeof node !== 'object')
136
+ return null;
137
+ const record = node;
138
+ for (const key of NESTED_KEYS) {
139
+ const found = walk(record[key], depth + 1);
140
+ if (found)
141
+ return found;
142
+ }
143
+ return null;
144
+ }
145
+ // ---------------------------------------------------------------------------
146
+ // Decoding
147
+ // ---------------------------------------------------------------------------
148
+ /**
149
+ * Decode a failed call's revert into the error the contract named, or `null`
150
+ * when there is nothing recognisable to name.
151
+ *
152
+ * `null` is the honest answer for an unknown selector, an unrelated `require`
153
+ * string, or an error with no revert data at all — the caller keeps whatever
154
+ * it did before rather than inventing a diagnosis from bytes it cannot read.
155
+ */
156
+ export function decodeRevert(err) {
157
+ const data = extractRevertData(err);
158
+ if (!data)
159
+ return null;
160
+ const selector = data.slice(0, 10).toLowerCase();
161
+ if (selector === STRING_REVERT_SELECTOR) {
162
+ const reason = decodeStringRevert(data);
163
+ if (reason === null)
164
+ return null;
165
+ return isErc20Reason(reason)
166
+ ? { name: 'Error', family: 'erc20', reason }
167
+ : null;
168
+ }
169
+ const name = selectors().get(selector);
170
+ if (!name)
171
+ return null;
172
+ return {
173
+ name,
174
+ family: ERC20_FAMILY_NAMES.has(name) ? 'erc20' : 'protocol',
175
+ };
176
+ }
177
+ function decodeStringRevert(data) {
178
+ try {
179
+ const [reason] = ethers.utils.defaultAbiCoder.decode(['string'], `0x${data.slice(10)}`);
180
+ return reason;
181
+ }
182
+ catch (_a) {
183
+ return null;
184
+ }
185
+ }
186
+ function isErc20Reason(reason) {
187
+ const lower = reason.toLowerCase();
188
+ return ERC20_REASON_PATTERNS.some((pattern) => pattern.test(lower));
189
+ }
190
+ //# sourceMappingURL=revert-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revert-errors.js","sourceRoot":"","sources":["../../src/domain/revert-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC;AAC/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAC;AAgDzG,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,eAAe,GAAG;IACpB,iFAAiF;IACjF,sFAAsF;CACz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,CAAC;IAClB,CAAC;IAAC,WAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACjC,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC"}
@@ -55,6 +55,12 @@ export declare class FlowsFacade {
55
55
  * contract.
56
56
  */
57
57
  private readonly _spender;
58
+ /**
59
+ * This chain's stable token address — the target of the batch path's
60
+ * approve. `undefined` for a hand-built config without `stableAsset`,
61
+ * in which case a run never batches: it does not guess a token.
62
+ */
63
+ private readonly _stableAsset?;
58
64
  constructor(_deposits: DepositsFacade,
59
65
  /**
60
66
  * The chain's stable token, bound to whatever the Kasu instance holds.
@@ -71,7 +77,13 @@ export declare class FlowsFacade {
71
77
  * an address whose only wrong value grants an approval to the wrong
72
78
  * contract.
73
79
  */
74
- _spender: string);
80
+ _spender: string,
81
+ /**
82
+ * This chain's stable token address — the target of the batch path's
83
+ * approve. `undefined` for a hand-built config without `stableAsset`,
84
+ * in which case a run never batches: it does not guess a token.
85
+ */
86
+ _stableAsset?: string | undefined);
75
87
  /**
76
88
  * A deposit pipeline. `readAllowance`, `approve`, `deposit` and
77
89
  * `buildKycParams` default to the SDK's own implementations; pass any of
@@ -83,6 +95,10 @@ export declare class FlowsFacade {
83
95
  * delete the default it was meant to keep, and
84
96
  * `approve: sponsoredGas ? sponsoredApprove : undefined` is exactly how a
85
97
  * consumer writes a conditional override.
98
+ *
99
+ * `depositBatch` has NO default: how several calls become one atomic
100
+ * transaction is the application's business. Supplying it lets a run
101
+ * whose allowance is short approve and deposit in one batch.
86
102
  */
87
103
  deposit(ports: DepositFlowPortOverrides, opts?: DepositFlowOptions): DepositFlow;
88
104
  /**
@@ -47,11 +47,18 @@ export class FlowsFacade {
47
47
  * an address whose only wrong value grants an approval to the wrong
48
48
  * contract.
49
49
  */
50
- _spender) {
50
+ _spender,
51
+ /**
52
+ * This chain's stable token address — the target of the batch path's
53
+ * approve. `undefined` for a hand-built config without `stableAsset`,
54
+ * in which case a run never batches: it does not guess a token.
55
+ */
56
+ _stableAsset) {
51
57
  this._deposits = _deposits;
52
58
  this._erc20 = _erc20;
53
59
  this._isReadOnly = _isReadOnly;
54
60
  this._spender = _spender;
61
+ this._stableAsset = _stableAsset;
55
62
  }
56
63
  /**
57
64
  * A deposit pipeline. `readAllowance`, `approve`, `deposit` and
@@ -64,9 +71,13 @@ export class FlowsFacade {
64
71
  * delete the default it was meant to keep, and
65
72
  * `approve: sponsoredGas ? sponsoredApprove : undefined` is exactly how a
66
73
  * consumer writes a conditional override.
74
+ *
75
+ * `depositBatch` has NO default: how several calls become one atomic
76
+ * transaction is the application's business. Supplying it lets a run
77
+ * whose allowance is short approve and deposit in one batch.
67
78
  */
68
79
  deposit(ports, opts) {
69
- var _a, _b, _c, _d, _e;
80
+ var _a, _b, _c, _d, _e, _f;
70
81
  return new DepositFlow({
71
82
  signMessage: ports.signMessage,
72
83
  generateContract: ports.generateContract,
@@ -81,12 +92,14 @@ export class FlowsFacade {
81
92
  return yield this._erc20().approve(spender, amount);
82
93
  })),
83
94
  deposit: (_d = ports.deposit) !== null && _d !== void 0 ? _d : ((params) => this._deposits.deposit(params)),
95
+ depositBatch: ports.depositBatch,
84
96
  now: ports.now,
85
97
  }, {
86
98
  contractTtlMs: opts === null || opts === void 0 ? void 0 : opts.contractTtlMs,
87
99
  // Per key here too, for the same reason the ports are: an
88
100
  // explicit `spender: undefined` must not delete the default.
89
101
  spender: (_e = opts === null || opts === void 0 ? void 0 : opts.spender) !== null && _e !== void 0 ? _e : this._spender,
102
+ stableAsset: (_f = opts === null || opts === void 0 ? void 0 : opts.stableAsset) !== null && _f !== void 0 ? _f : this._stableAsset,
90
103
  });
91
104
  }
92
105
  /**
@@ -1 +1 @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gBAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC,CAAC;YACX,WAAW,EACP,MAAA,KAAK,CAAC,WAAW,mCACjB,CAAC,CACG,MAAc,EACd,SAAiB,EACjB,WAAmB,EACS,EAAE,CAC9B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;SACtE,CAAC,CAAC;IACP,CAAC;IAEO,eAAe;QACnB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;CACJ"}
@@ -31,6 +31,7 @@ import { PortfolioFacade } from './user-portfolio';
31
31
  */
32
32
  export class Kasu {
33
33
  constructor(sdk, chainConfig, signerOrProvider, configOverrides) {
34
+ var _a;
34
35
  this._sdk = sdk;
35
36
  this._chainConfig = chainConfig;
36
37
  this._signerOrProvider = signerOrProvider;
@@ -42,7 +43,7 @@ export class Kasu {
42
43
  const isReadOnly = !Signer.isSigner(signerOrProvider);
43
44
  this.deposits = new DepositsFacade(sdk.UserLending, chainConfig.chainId.toString(), isReadOnly);
44
45
  this.portfolio = new PortfolioFacade(sdk.DataService, sdk.UserLending, sdk.Portfolio);
45
- this.flows = new FlowsFacade(this.deposits, () => erc20Of(chainConfig, signerOrProvider), isReadOnly, chainConfig.contracts.LendingPoolManager);
46
+ this.flows = new FlowsFacade(this.deposits, () => erc20Of(chainConfig, signerOrProvider), isReadOnly, chainConfig.contracts.LendingPoolManager, (_a = stableAssetOf(chainConfig)) === null || _a === void 0 ? void 0 : _a.address);
46
47
  }
47
48
  /**
48
49
  * Create a Kasu instance with built-in chain config.
@@ -1 +1 @@
1
- {"version":3,"file":"kasu.js","sourceRoot":"","sources":["../../src/facade/kasu.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,0BAA0B,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