@kasufinance/kasu-sdk 2.10.2 → 2.10.3

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.
@@ -1,9 +1,11 @@
1
- import { BigNumber, constants } from 'ethers';
1
+ import { BigNumber, constants, utils } from 'ethers';
2
+ import { IERC20MetadataAbi__factory } from '../contracts/factories/IERC20MetadataAbi__factory';
2
3
  import { ILendingPoolManagerAbi__factory } from '../contracts/factories/ILendingPoolManagerAbi__factory';
3
4
  /**
4
- * The single-call `LendingPoolManager` requests a sponsored relay may carry,
5
- * encoded by the SDK so no application hand-builds calldata or hand-maps the
6
- * relay's `kind` for them.
5
+ * The single-call requests a sponsored relay may carry — the four
6
+ * `LendingPoolManager` requests, plus the stable asset's own `transfer` (P2P
7
+ * Send) — encoded by the SDK so no application hand-builds calldata or
8
+ * hand-maps the relay's `kind` for them.
7
9
  *
8
10
  * Every function here is PURE: addresses and ids in, `{ kind, call }` out.
9
11
  * Reading the chain (the shares a withdrawal is for) is the facade's job —
@@ -31,6 +33,11 @@ export const SPONSORED_CALL_KINDS = [
31
33
  'cancel_withdrawal',
32
34
  /** `LendingPoolManager.requestFixedTermDepositWithdrawal(pool, lockId)`. */
33
35
  'withdraw_at_expiry',
36
+ /**
37
+ * `stableAsset.transfer(to, amount)` — P2P Send, to the chain's stable
38
+ * asset rather than the manager. See {@link encodeStableTransfer}.
39
+ */
40
+ 'transfer',
34
41
  ];
35
42
  /**
36
43
  * Widened to the plain `Interface`: the typechain one overloads
@@ -38,7 +45,9 @@ export const SPONSORED_CALL_KINDS = [
38
45
  * `FUNCTION_OF`.
39
46
  */
40
47
  const LENDING_POOL_MANAGER = ILendingPoolManagerAbi__factory.createInterface();
41
- /** The `LendingPoolManager` function behind each kind. */
48
+ /** The generated ERC-20 interface — the `transfer` kind's one function. */
49
+ const ERC20 = IERC20MetadataAbi__factory.createInterface();
50
+ /** The `LendingPoolManager` function behind each manager kind. */
42
51
  const FUNCTION_OF = Object.freeze({
43
52
  withdrawal: 'requestWithdrawal',
44
53
  cancel_deposit: 'cancelDepositRequest',
@@ -47,14 +56,16 @@ const FUNCTION_OF = Object.freeze({
47
56
  });
48
57
  /**
49
58
  * The 4-byte selector of each kind's function, DERIVED from the generated
50
- * `ILendingPoolManager` ABI — never typed in by hand, so an ABI change moves
51
- * it and the cross-check spec against the relay's own pins goes red.
59
+ * ABIs (`ILendingPoolManager`, and `IERC20Metadata` for `transfer`) — never
60
+ * typed in by hand, so an ABI change moves it and the cross-check spec
61
+ * against the relay's own pins goes red.
52
62
  */
53
63
  export const SPONSORED_CALL_SELECTORS = Object.freeze({
54
64
  withdrawal: LENDING_POOL_MANAGER.getSighash(FUNCTION_OF.withdrawal),
55
65
  cancel_deposit: LENDING_POOL_MANAGER.getSighash(FUNCTION_OF.cancel_deposit),
56
66
  cancel_withdrawal: LENDING_POOL_MANAGER.getSighash(FUNCTION_OF.cancel_withdrawal),
57
67
  withdraw_at_expiry: LENDING_POOL_MANAGER.getSighash(FUNCTION_OF.withdraw_at_expiry),
68
+ transfer: ERC20.getSighash('transfer'),
58
69
  });
59
70
  /**
60
71
  * What an encoder throws for an input it will not encode. `code` names the
@@ -153,4 +164,51 @@ export function encodeWithdrawAtExpiryCall(lendingPoolManager, poolId, fixedTerm
153
164
  toUint256(fixedTermDepositId, 'lock-id'),
154
165
  ]);
155
166
  }
167
+ /**
168
+ * `stableAsset.transfer(to, amount)` — `transfer`: P2P Send of the chain's
169
+ * stable asset from the sender's own account (`msg.sender`) to `to`.
170
+ *
171
+ * `amount` is in the token's BASE units (6 decimals for USDC), and must be
172
+ * greater than zero. `to` must be a well-formed, non-zero address (a
173
+ * mixed-case one with a valid EIP-55 checksum). That is
174
+ * ALL this encoder judges, because it is all a pure function can know.
175
+ *
176
+ * The recipient POLICY is the relay's job and is deliberately not restated
177
+ * here: it refuses the sender's own account, the stable asset, the
178
+ * `LendingPoolManager`, the precompile range, any address with contract code
179
+ * (read on chain at submission), a sender our identity store does not hold
180
+ * as verified, and anything over the sender's daily count and amount caps.
181
+ * A call this encoder accepts can therefore still be refused — the app maps
182
+ * the relay's refusal codes to its own words.
183
+ *
184
+ * Pass `stableAsset` from the chain config (`CHAIN_CONFIGS[chain].stableAsset
185
+ * .address`) — the relay compares `to` against its own configured token and
186
+ * refuses any other contract.
187
+ */
188
+ export function encodeStableTransfer(input) {
189
+ assertAddress(input.stableAsset, 'stable-asset');
190
+ assertAddress(input.to, 'recipient');
191
+ // A mixed-case recipient carries an EIP-55 checksum, and one that does not
192
+ // match is a mistyped address: refuse it as `recipient` here rather than
193
+ // let the ABI coder throw its own error at the encode below.
194
+ try {
195
+ utils.getAddress(input.to);
196
+ }
197
+ catch (_a) {
198
+ throw new SponsoredCallInputError('recipient');
199
+ }
200
+ if (BigNumber.from(input.to).isZero()) {
201
+ throw new SponsoredCallInputError('zero-recipient');
202
+ }
203
+ const amount = toUint256(input.amount, 'amount');
204
+ if (amount.isZero())
205
+ throw new SponsoredCallInputError('zero-amount');
206
+ return {
207
+ kind: 'transfer',
208
+ call: {
209
+ to: input.stableAsset,
210
+ data: ERC20.encodeFunctionData('transfer', [input.to, amount]),
211
+ },
212
+ };
213
+ }
156
214
  //# sourceMappingURL=sponsored-calls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sponsored-calls.js","sourceRoot":"","sources":["../../src/domain/sponsored-calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,SAAS,EAAS,MAAM,QAAQ,CAAC;AAEnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAC;AAEzG;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,qEAAqE;IACrE,YAAY;IACZ,+DAA+D;IAC/D,gBAAgB;IAChB,kEAAkE;IAClE,mBAAmB;IACnB,4EAA4E;IAC5E,oBAAoB;CACd,CAAC;AAcX;;;;GAIG;AACH,MAAM,oBAA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;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAIpC;IACG,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACjD,aAAa,CAAC,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IACrC,2EAA2E;IAC3E,yEAAyE;IACzE,6DAA6D;IAC7D,IAAI,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,WAAM,CAAC;QACL,MAAM,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACjD,IAAI,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACtE,OAAO;QACH,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE;YACF,EAAE,EAAE,KAAK,CAAC,WAAW;YACrB,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SACjE;KACJ,CAAC;AACN,CAAC"}
@@ -191,7 +191,9 @@ export class StrategiesFacade {
191
191
  return {
192
192
  id: pool.id,
193
193
  name: pool.poolName,
194
+ subheading: nonEmptyOrUndefined(pool.subheading),
194
195
  description: pool.description,
196
+ liteDescription: nonEmptyOrUndefined(pool.liteDescription),
195
197
  isActive: pool.isActive,
196
198
  apy: pool.apy,
197
199
  tvl: pool.totalValueLocked,
@@ -206,6 +208,16 @@ export class StrategiesFacade {
206
208
  };
207
209
  }
208
210
  }
211
+ /**
212
+ * A CMS text field as a string, or `undefined` when it is absent, not a
213
+ * string, or empty (blank included) — the CMS stores an emptied field as `''`, and an empty
214
+ * subheading must read as "none", not render an empty line.
215
+ */
216
+ function nonEmptyOrUndefined(value) {
217
+ return typeof value === 'string' && value.trim().length > 0
218
+ ? value
219
+ : undefined;
220
+ }
209
221
  /**
210
222
  * A CMS "numeric" field as a finite number, or `null`. An empty or blank
211
223
  * string is UNAUTHORED, not zero.
@@ -1 +1 @@
1
- {"version":3,"file":"strategies.js","sourceRoot":"","sources":["../../src/facade/strategies.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAiBrD;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IACzB,YACY,YAAyB,EACzB,YAAyB;IACjC;;;OAGG;IACK,uBAA+C,EAAE;QANjD,iBAAY,GAAZ,YAAY,CAAa;QACzB,iBAAY,GAAZ,YAAY,CAAa;QAKzB,yBAAoB,GAApB,oBAAoB,CAA6B;IAC1D,CAAC;IAEJ;;;;;;;;;;;;OAYG;IACG,kBAAkB,CACpB,MAAc;;YAEd,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC9C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC;YAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CACvB,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,KAAK,UAAU,CACzD,CAAC;YACF,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,MAAM,WAAW,GAAG,MAAM,CAAC,eAGZ,CAAC;YAChB,OAAO;gBACH,YAAY,EAAE,YAAY,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,CAAC;gBACrD,gBAAgB,EAAE,YAAY,CAAC,WAA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AC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -87,7 +87,17 @@ export interface KasuOptions {
87
87
  export interface Strategy {
88
88
  id: string;
89
89
  name: string;
90
+ /**
91
+ * The CMS subheading (the borrower type shown under the name). Absent when
92
+ * the record has none, or an empty one.
93
+ */
94
+ subheading?: string;
90
95
  description: string;
96
+ /**
97
+ * The CMS short description (`liteDescription`) for compact surfaces.
98
+ * Absent when the record has none, or an empty one.
99
+ */
100
+ liteDescription?: string;
91
101
  isActive: boolean;
92
102
  /** Weighted-average APY across tranches (decimal, e.g. 0.08 = 8 %). */
93
103
  apy: number;
@@ -157,6 +157,22 @@ export declare function submitBatch<R extends ReceiptLike = ReceiptLike>(input:
157
157
  * means the lender is told the earlier one landed (`already-submitted`).
158
158
  */
159
159
  export declare function checkBatchOutcome<R extends ReceiptLike = ReceiptLike>(transactionId: string, expect: Omit<DepositProofExpectation, 'userOperationHash'>, ports: Pick<BatchSubmissionPorts<R>, 'getStatus' | 'getReceipt'>): Promise<'deposited' | 'not-deposited' | 'unknown'>;
160
+ /**
161
+ * `checkBatchOutcome` for ONE sponsored call — ONE status read, no polling —
162
+ * for an app's guard against sending the same request twice (a P2P transfer
163
+ * whose earlier submission ended PENDING, say):
164
+ *
165
+ * - `executed` — mined, and the receipt proves the sender's operation
166
+ * succeeded (`proveUserOperationInReceipt`);
167
+ * - `not-executed` — definitively reverted (vendor status or the operation's
168
+ * own flag);
169
+ * - `unknown` — anything else, including a read or receipt that failed, or a
170
+ * receipt that does not show the sender's operation.
171
+ *
172
+ * Only `not-executed` may let a new attempt proceed unprompted; `executed`
173
+ * means the earlier one landed and the user should be told.
174
+ */
175
+ export declare function checkSponsoredCallOutcome<R extends ReceiptLike = ReceiptLike>(transactionId: string, expect: Omit<UserOperationProofExpectation, 'userOperationHash'>, ports: Pick<BatchSubmissionPorts<R>, 'getStatus' | 'getReceipt'>): Promise<'executed' | 'not-executed' | 'unknown'>;
160
176
  /**
161
177
  * `BatchSubmissionPorts` for ONE sponsored call: the same status, receipt and
162
178
  * clock ports — a relay client written for the deposit batch serves both —
@@ -194,9 +210,9 @@ export interface SponsoredCallSubmission<R extends ReceiptLike = ReceiptLike> ex
194
210
  wait(): Promise<ExecutedCall<R>>;
195
211
  }
196
212
  /**
197
- * `submitBatch` for ONE sponsored `LendingPoolManager` call — the body of a
198
- * `WithdrawFlow` `submitCall` port, and of an app's cancel or
199
- * withdraw-at-expiry action. Same post, same polling policy, same outcome
213
+ * `submitBatch` for ONE sponsored call — the body of a `WithdrawFlow`
214
+ * `submitCall` port, of an app's cancel or withdraw-at-expiry action, and of
215
+ * a P2P transfer (`encodeStableTransfer`). Same post, same polling policy, same outcome
200
216
  * table; the proof is `proveUserOperationInReceipt` (the sender's operation
201
217
  * succeeded) instead of the deposit proof, and an unproven receipt is
202
218
  * `call_unproven:<reason>`.
@@ -212,7 +228,8 @@ export interface SponsoredCallSubmission<R extends ReceiptLike = ReceiptLike> ex
212
228
  * The call is checked against its kind before anything is posted — a known
213
229
  * kind, exactly `{ to, data }`, and `data` opening with that kind's selector —
214
230
  * and a mismatch is `BatchSubmissionError('call_mismatch', 'failed')`: nothing
215
- * was sent. Build calls with `kasu.calls`, and this never fires.
231
+ * was sent. Build calls with `kasu.calls` (or `encodeStableTransfer`), and
232
+ * this never fires.
216
233
  *
217
234
  * As on the deposit path, nothing after the post ever produces `failed`.
218
235
  */
@@ -222,7 +222,10 @@ export function checkBatchOutcome(transactionId, expect, ports) {
222
222
  }
223
223
  if (read.kind === 'reverted')
224
224
  return 'not-deposited';
225
- if (read.kind !== 'mined' || typeof read.txHash !== 'string') {
225
+ // An empty hash is not an answer — `waitForMined` reads it the same way.
226
+ if (read.kind !== 'mined' ||
227
+ typeof read.txHash !== 'string' ||
228
+ read.txHash === '') {
226
229
  return 'unknown';
227
230
  }
228
231
  try {
@@ -239,10 +242,60 @@ export function checkBatchOutcome(transactionId, expect, ports) {
239
242
  }
240
243
  });
241
244
  }
245
+ // ---------------------------------------------------------------------------
246
+ // One sponsored call — withdraw, cancel, withdraw at expiry, transfer
247
+ // ---------------------------------------------------------------------------
242
248
  /**
243
- * `submitBatch` for ONE sponsored `LendingPoolManager` call — the body of a
244
- * `WithdrawFlow` `submitCall` port, and of an app's cancel or
245
- * withdraw-at-expiry action. Same post, same polling policy, same outcome
249
+ * `checkBatchOutcome` for ONE sponsored call — ONE status read, no polling —
250
+ * for an app's guard against sending the same request twice (a P2P transfer
251
+ * whose earlier submission ended PENDING, say):
252
+ *
253
+ * - `executed` — mined, and the receipt proves the sender's operation
254
+ * succeeded (`proveUserOperationInReceipt`);
255
+ * - `not-executed` — definitively reverted (vendor status or the operation's
256
+ * own flag);
257
+ * - `unknown` — anything else, including a read or receipt that failed, or a
258
+ * receipt that does not show the sender's operation.
259
+ *
260
+ * Only `not-executed` may let a new attempt proceed unprompted; `executed`
261
+ * means the earlier one landed and the user should be told.
262
+ */
263
+ export function checkSponsoredCallOutcome(transactionId, expect, ports) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ var _a;
266
+ let read;
267
+ try {
268
+ read = yield ports.getStatus(transactionId);
269
+ }
270
+ catch (_b) {
271
+ return 'unknown';
272
+ }
273
+ if (read.kind === 'reverted')
274
+ return 'not-executed';
275
+ // An empty hash is not an answer — `waitForMined` reads it the same way.
276
+ if (read.kind !== 'mined' ||
277
+ typeof read.txHash !== 'string' ||
278
+ read.txHash === '') {
279
+ return 'unknown';
280
+ }
281
+ try {
282
+ const receipt = yield ports.getReceipt(read.txHash);
283
+ const proof = proveUserOperationInReceipt(receipt, Object.assign(Object.assign({}, expect), { userOperationHash: (_a = read.userOperationHash) !== null && _a !== void 0 ? _a : null }));
284
+ if (proof.kind === 'executed')
285
+ return 'executed';
286
+ if (proof.kind === 'reverted')
287
+ return 'not-executed';
288
+ return 'unknown';
289
+ }
290
+ catch (_c) {
291
+ return 'unknown';
292
+ }
293
+ });
294
+ }
295
+ /**
296
+ * `submitBatch` for ONE sponsored call — the body of a `WithdrawFlow`
297
+ * `submitCall` port, of an app's cancel or withdraw-at-expiry action, and of
298
+ * a P2P transfer (`encodeStableTransfer`). Same post, same polling policy, same outcome
246
299
  * table; the proof is `proveUserOperationInReceipt` (the sender's operation
247
300
  * succeeded) instead of the deposit proof, and an unproven receipt is
248
301
  * `call_unproven:<reason>`.
@@ -258,7 +311,8 @@ export function checkBatchOutcome(transactionId, expect, ports) {
258
311
  * The call is checked against its kind before anything is posted — a known
259
312
  * kind, exactly `{ to, data }`, and `data` opening with that kind's selector —
260
313
  * and a mismatch is `BatchSubmissionError('call_mismatch', 'failed')`: nothing
261
- * was sent. Build calls with `kasu.calls`, and this never fires.
314
+ * was sent. Build calls with `kasu.calls` (or `encodeStableTransfer`), and
315
+ * this never fires.
262
316
  *
263
317
  * As on the deposit path, nothing after the post ever produces `failed`.
264
318
  */
@@ -1 +1 @@
1
- {"version":3,"file":"batch-submission.js","sourceRoot":"","sources":["../../src/flows/batch-submission.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAGH,qBAAqB,EACrB,2BAA2B,GAI9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,oBAAoB,EACpB,wBAAwB,GAE3B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACvB,MAAM,gBAAgB,CAAC;AA0ExB;;;;GAIG;AACH,MAAM,CAA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I,KAAyB,CAAC;QAC9B,IAAI,CAAC;YACD,KAAK,GAAG,2BAA2B,CAAC,KAAK,CAAC,OAAO,kCAC1C,MAAM,KACT,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAC5C,CAAC;QACP,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,iBAAiB,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5B,MAAM,IAAI,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5B,MAAM,IAAI,iBAAiB,CAAC,iBAAiB,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACnE,CAAC;CAAA"}
@@ -12,7 +12,7 @@
12
12
  */
13
13
  export { BatchPendingError, BatchRevertedError, batchOutcomeOf, BatchSubmissionError, isDefinitivelyNotSubmitted, } from './batch-errors';
14
14
  export type { BatchSubmissionOutcome } from './batch-errors';
15
- export { checkBatchOutcome, DEFAULT_BATCH_POLLING_POLICY, submitBatch, submitSponsoredCall, } from './batch-submission';
15
+ export { checkBatchOutcome, checkSponsoredCallOutcome, DEFAULT_BATCH_POLLING_POLICY, submitBatch, submitSponsoredCall, } from './batch-submission';
16
16
  export type { BatchPollingPolicy, BatchStatusRead, BatchSubmission, BatchSubmissionPorts, ExecutedCall, ProvenBatch, SponsoredCallSubmission, SponsoredCallSubmissionPorts, SubmitBatchCall, } from './batch-submission';
17
17
  export { Flow } from './flow';
18
18
  export { FlowStore } from './observable';
@@ -11,7 +11,7 @@
11
11
  * the copies had already started to differ.
12
12
  */
13
13
  export { BatchPendingError, BatchRevertedError, batchOutcomeOf, BatchSubmissionError, isDefinitivelyNotSubmitted, } from './batch-errors';
14
- export { checkBatchOutcome, DEFAULT_BATCH_POLLING_POLICY, submitBatch, submitSponsoredCall, } from './batch-submission';
14
+ export { checkBatchOutcome, checkSponsoredCallOutcome, DEFAULT_BATCH_POLLING_POLICY, submitBatch, submitSponsoredCall, } from './batch-submission';
15
15
  export { Flow } from './flow';
16
16
  export { FlowStore } from './observable';
17
17
  export { CONTRACT_TTL_MS, DepositFlow, INVALID_ACCEPTANCE_SIGNATURE_MESSAGE, INVALID_AUTH_SIGNATURE_MESSAGE, NO_SPENDER_MESSAGE, } from './deposit-flow';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACH,iBAAiB,EACjB,4BAA4B,EAC5B,WAAW,EACX,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAa5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EACH,eAAe,EACf,WAAW,EACX,oCAAoC,EACpC,8BAA8B,EAC9B,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AAiBxB,OAAO,EACH,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,EAC7B,YAAY,GACf,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACH,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,WAAW,EACX,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAa5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EACH,eAAe,EACf,WAAW,EACX,oCAAoC,EACpC,8BAA8B,EAC9B,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AAiBxB,OAAO,EACH,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,EAC7B,YAAY,GACf,MAAM,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kasufinance/kasu-sdk",
3
- "version": "2.10.2",
3
+ "version": "2.10.3",
4
4
  "description": "TypeScript SDK for the Kasu Finance protocol — pool data, portfolio analytics, and KYC-gated deposits and withdrawals on Base and XDC",
5
5
  "keywords": [
6
6
  "kasu",
@@ -155,6 +155,7 @@ export {
155
155
  encodeCancelDepositCall,
156
156
  encodeCancelWithdrawalCall,
157
157
  encodeRequestWithdrawalCall,
158
+ encodeStableTransfer,
158
159
  encodeWithdrawAtExpiryCall,
159
160
  SPONSORED_CALL_KINDS,
160
161
  SPONSORED_CALL_SELECTORS,
@@ -1,11 +1,13 @@
1
1
  import { BigNumber, BigNumberish, constants, utils } from 'ethers';
2
2
 
3
+ import { IERC20MetadataAbi__factory } from '../contracts/factories/IERC20MetadataAbi__factory';
3
4
  import { ILendingPoolManagerAbi__factory } from '../contracts/factories/ILendingPoolManagerAbi__factory';
4
5
 
5
6
  /**
6
- * The single-call `LendingPoolManager` requests a sponsored relay may carry,
7
- * encoded by the SDK so no application hand-builds calldata or hand-maps the
8
- * relay's `kind` for them.
7
+ * The single-call requests a sponsored relay may carry — the four
8
+ * `LendingPoolManager` requests, plus the stable asset's own `transfer` (P2P
9
+ * Send) — encoded by the SDK so no application hand-builds calldata or
10
+ * hand-maps the relay's `kind` for them.
9
11
  *
10
12
  * Every function here is PURE: addresses and ids in, `{ kind, call }` out.
11
13
  * Reading the chain (the shares a withdrawal is for) is the facade's job —
@@ -34,6 +36,11 @@ export const SPONSORED_CALL_KINDS = [
34
36
  'cancel_withdrawal',
35
37
  /** `LendingPoolManager.requestFixedTermDepositWithdrawal(pool, lockId)`. */
36
38
  'withdraw_at_expiry',
39
+ /**
40
+ * `stableAsset.transfer(to, amount)` — P2P Send, to the chain's stable
41
+ * asset rather than the manager. See {@link encodeStableTransfer}.
42
+ */
43
+ 'transfer',
37
44
  ] as const;
38
45
 
39
46
  export type SponsoredCallKind = (typeof SPONSORED_CALL_KINDS)[number];
@@ -56,18 +63,26 @@ export interface SponsoredCall {
56
63
  const LENDING_POOL_MANAGER: utils.Interface =
57
64
  ILendingPoolManagerAbi__factory.createInterface();
58
65
 
59
- /** The `LendingPoolManager` function behind each kind. */
60
- const FUNCTION_OF: Readonly<Record<SponsoredCallKind, string>> = Object.freeze({
61
- withdrawal: 'requestWithdrawal',
62
- cancel_deposit: 'cancelDepositRequest',
63
- cancel_withdrawal: 'cancelWithdrawalRequest',
64
- withdraw_at_expiry: 'requestFixedTermDepositWithdrawal',
65
- });
66
+ /** The generated ERC-20 interface — the `transfer` kind's one function. */
67
+ const ERC20: utils.Interface = IERC20MetadataAbi__factory.createInterface();
68
+
69
+ /** The kinds whose call goes to the `LendingPoolManager`. */
70
+ type LendingPoolManagerKind = Exclude<SponsoredCallKind, 'transfer'>;
71
+
72
+ /** The `LendingPoolManager` function behind each manager kind. */
73
+ const FUNCTION_OF: Readonly<Record<LendingPoolManagerKind, string>> =
74
+ Object.freeze({
75
+ withdrawal: 'requestWithdrawal',
76
+ cancel_deposit: 'cancelDepositRequest',
77
+ cancel_withdrawal: 'cancelWithdrawalRequest',
78
+ withdraw_at_expiry: 'requestFixedTermDepositWithdrawal',
79
+ });
66
80
 
67
81
  /**
68
82
  * The 4-byte selector of each kind's function, DERIVED from the generated
69
- * `ILendingPoolManager` ABI — never typed in by hand, so an ABI change moves
70
- * it and the cross-check spec against the relay's own pins goes red.
83
+ * ABIs (`ILendingPoolManager`, and `IERC20Metadata` for `transfer`) — never
84
+ * typed in by hand, so an ABI change moves it and the cross-check spec
85
+ * against the relay's own pins goes red.
71
86
  */
72
87
  export const SPONSORED_CALL_SELECTORS: Readonly<
73
88
  Record<SponsoredCallKind, string>
@@ -80,6 +95,7 @@ export const SPONSORED_CALL_SELECTORS: Readonly<
80
95
  withdraw_at_expiry: LENDING_POOL_MANAGER.getSighash(
81
96
  FUNCTION_OF.withdraw_at_expiry,
82
97
  ),
98
+ transfer: ERC20.getSighash('transfer'),
83
99
  });
84
100
 
85
101
  /**
@@ -122,7 +138,7 @@ function toUint256(value: BigNumberish, code: string): BigNumber {
122
138
  }
123
139
 
124
140
  function encode(
125
- kind: SponsoredCallKind,
141
+ kind: LendingPoolManagerKind,
126
142
  lendingPoolManager: string,
127
143
  args: readonly unknown[],
128
144
  ): SponsoredCall {
@@ -211,3 +227,53 @@ export function encodeWithdrawAtExpiryCall(
211
227
  toUint256(fixedTermDepositId, 'lock-id'),
212
228
  ]);
213
229
  }
230
+
231
+ /**
232
+ * `stableAsset.transfer(to, amount)` — `transfer`: P2P Send of the chain's
233
+ * stable asset from the sender's own account (`msg.sender`) to `to`.
234
+ *
235
+ * `amount` is in the token's BASE units (6 decimals for USDC), and must be
236
+ * greater than zero. `to` must be a well-formed, non-zero address (a
237
+ * mixed-case one with a valid EIP-55 checksum). That is
238
+ * ALL this encoder judges, because it is all a pure function can know.
239
+ *
240
+ * The recipient POLICY is the relay's job and is deliberately not restated
241
+ * here: it refuses the sender's own account, the stable asset, the
242
+ * `LendingPoolManager`, the precompile range, any address with contract code
243
+ * (read on chain at submission), a sender our identity store does not hold
244
+ * as verified, and anything over the sender's daily count and amount caps.
245
+ * A call this encoder accepts can therefore still be refused — the app maps
246
+ * the relay's refusal codes to its own words.
247
+ *
248
+ * Pass `stableAsset` from the chain config (`CHAIN_CONFIGS[chain].stableAsset
249
+ * .address`) — the relay compares `to` against its own configured token and
250
+ * refuses any other contract.
251
+ */
252
+ export function encodeStableTransfer(input: {
253
+ stableAsset: string;
254
+ to: string;
255
+ amount: BigNumberish;
256
+ }): SponsoredCall {
257
+ assertAddress(input.stableAsset, 'stable-asset');
258
+ assertAddress(input.to, 'recipient');
259
+ // A mixed-case recipient carries an EIP-55 checksum, and one that does not
260
+ // match is a mistyped address: refuse it as `recipient` here rather than
261
+ // let the ABI coder throw its own error at the encode below.
262
+ try {
263
+ utils.getAddress(input.to);
264
+ } catch {
265
+ throw new SponsoredCallInputError('recipient');
266
+ }
267
+ if (BigNumber.from(input.to).isZero()) {
268
+ throw new SponsoredCallInputError('zero-recipient');
269
+ }
270
+ const amount = toUint256(input.amount, 'amount');
271
+ if (amount.isZero()) throw new SponsoredCallInputError('zero-amount');
272
+ return {
273
+ kind: 'transfer',
274
+ call: {
275
+ to: input.stableAsset,
276
+ data: ERC20.encodeFunctionData('transfer', [input.to, amount]),
277
+ },
278
+ };
279
+ }
@@ -215,7 +215,9 @@ export class StrategiesFacade {
215
215
  return {
216
216
  id: pool.id,
217
217
  name: pool.poolName,
218
+ subheading: nonEmptyOrUndefined(pool.subheading),
218
219
  description: pool.description,
220
+ liteDescription: nonEmptyOrUndefined(pool.liteDescription),
219
221
  isActive: pool.isActive,
220
222
  apy: pool.apy,
221
223
  tvl: pool.totalValueLocked,
@@ -231,6 +233,17 @@ export class StrategiesFacade {
231
233
  }
232
234
  }
233
235
 
236
+ /**
237
+ * A CMS text field as a string, or `undefined` when it is absent, not a
238
+ * string, or empty (blank included) — the CMS stores an emptied field as `''`, and an empty
239
+ * subheading must read as "none", not render an empty line.
240
+ */
241
+ function nonEmptyOrUndefined(value: unknown): string | undefined {
242
+ return typeof value === 'string' && value.trim().length > 0
243
+ ? value
244
+ : undefined;
245
+ }
246
+
234
247
  /**
235
248
  * A CMS "numeric" field as a finite number, or `null`. An empty or blank
236
249
  * string is UNAUTHORED, not zero.
@@ -1,7 +1,11 @@
1
1
  import { BigNumberish, BytesLike } from 'ethers';
2
2
 
3
3
  import { ContractAddresses, SdkConfigOptions } from '../sdk-config';
4
- import { LendingTotals, PoolOverview, TrancheData } from '../services/DataService/types';
4
+ import {
5
+ LendingTotals,
6
+ PoolOverview,
7
+ TrancheData,
8
+ } from '../services/DataService/types';
5
9
  import {
6
10
  PortfolioLendingPool,
7
11
  PortfolioSummary,
@@ -106,7 +110,17 @@ export interface KasuOptions {
106
110
  export interface Strategy {
107
111
  id: string;
108
112
  name: string;
113
+ /**
114
+ * The CMS subheading (the borrower type shown under the name). Absent when
115
+ * the record has none, or an empty one.
116
+ */
117
+ subheading?: string;
109
118
  description: string;
119
+ /**
120
+ * The CMS short description (`liteDescription`) for compact surfaces.
121
+ * Absent when the record has none, or an empty one.
122
+ */
123
+ liteDescription?: string;
110
124
  isActive: boolean;
111
125
  /** Weighted-average APY across tranches (decimal, e.g. 0.08 = 8 %). */
112
126
  apy: number;