@kasufinance/kasu-sdk 2.6.0 → 2.7.1

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 (126) hide show
  1. package/README.md +167 -4
  2. package/dist/bundle.cjs.js +1389 -257
  3. package/dist/bundle.esm.js +1375 -258
  4. package/dist/domain/index.d.ts +5 -2
  5. package/dist/domain/index.js +3 -2
  6. package/dist/domain/index.js.map +1 -1
  7. package/dist/domain/requests.d.ts +42 -4
  8. package/dist/domain/requests.js +20 -4
  9. package/dist/domain/requests.js.map +1 -1
  10. package/dist/domain/revert-errors.d.ts +59 -0
  11. package/dist/domain/revert-errors.js +190 -0
  12. package/dist/domain/revert-errors.js.map +1 -0
  13. package/dist/domain/wallet-errors.d.ts +63 -8
  14. package/dist/domain/wallet-errors.js +115 -16
  15. package/dist/domain/wallet-errors.js.map +1 -1
  16. package/dist/facade/deposits.js +2 -1
  17. package/dist/facade/deposits.js.map +1 -1
  18. package/dist/facade/flows.d.ts +95 -0
  19. package/dist/facade/flows.js +116 -0
  20. package/dist/facade/flows.js.map +1 -0
  21. package/dist/facade/index.d.ts +3 -0
  22. package/dist/facade/index.js +3 -0
  23. package/dist/facade/index.js.map +1 -1
  24. package/dist/facade/kasu.d.ts +6 -2
  25. package/dist/facade/kasu.js +28 -3
  26. package/dist/facade/kasu.js.map +1 -1
  27. package/dist/facade/read-only.d.ts +12 -0
  28. package/dist/facade/read-only.js +13 -0
  29. package/dist/facade/read-only.js.map +1 -0
  30. package/dist/flows/deposit-flow.d.ts +332 -0
  31. package/dist/flows/deposit-flow.js +436 -0
  32. package/dist/flows/deposit-flow.js.map +1 -0
  33. package/dist/flows/flow.d.ts +72 -0
  34. package/dist/flows/flow.js +110 -0
  35. package/dist/flows/flow.js.map +1 -0
  36. package/dist/flows/index.d.ts +19 -0
  37. package/dist/flows/index.js +17 -0
  38. package/dist/flows/index.js.map +1 -0
  39. package/dist/flows/observable.d.ts +59 -0
  40. package/dist/flows/observable.js +81 -0
  41. package/dist/flows/observable.js.map +1 -0
  42. package/dist/flows/withdraw-flow.d.ts +99 -0
  43. package/dist/flows/withdraw-flow.js +83 -0
  44. package/dist/flows/withdraw-flow.js.map +1 -0
  45. package/dist/index.d.ts +1 -0
  46. package/dist/index.js +6 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/services/DataService/data-service.js +0 -1
  49. package/dist/services/DataService/data-service.js.map +1 -1
  50. package/package.json +8 -2
  51. package/src/domain/index.ts +10 -1
  52. package/src/domain/requests.ts +57 -4
  53. package/src/domain/revert-errors.ts +248 -0
  54. package/src/domain/wallet-errors.ts +135 -18
  55. package/src/facade/deposits.ts +2 -3
  56. package/src/facade/flows.ts +172 -0
  57. package/src/facade/index.ts +8 -0
  58. package/src/facade/kasu.ts +43 -3
  59. package/src/facade/read-only.ts +13 -0
  60. package/src/flows/deposit-flow.ts +884 -0
  61. package/src/flows/flow.ts +108 -0
  62. package/src/flows/index.ts +47 -0
  63. package/src/flows/observable.ts +97 -0
  64. package/src/flows/withdraw-flow.ts +210 -0
  65. package/src/index.ts +7 -0
  66. package/src/services/DataService/data-service.ts +0 -1
  67. package/dist/domain/au-minimum.test.d.ts +0 -1
  68. package/dist/domain/au-minimum.test.js +0 -202
  69. package/dist/domain/au-minimum.test.js.map +0 -1
  70. package/dist/domain/deposit-bounds.test.d.ts +0 -1
  71. package/dist/domain/deposit-bounds.test.js +0 -135
  72. package/dist/domain/deposit-bounds.test.js.map +0 -1
  73. package/dist/domain/loan-contract.test.d.ts +0 -1
  74. package/dist/domain/loan-contract.test.js +0 -255
  75. package/dist/domain/loan-contract.test.js.map +0 -1
  76. package/dist/domain/partners.test.d.ts +0 -1
  77. package/dist/domain/partners.test.js +0 -53
  78. package/dist/domain/partners.test.js.map +0 -1
  79. package/dist/domain/pools.test.d.ts +0 -1
  80. package/dist/domain/pools.test.js +0 -184
  81. package/dist/domain/pools.test.js.map +0 -1
  82. package/dist/domain/rates.test.d.ts +0 -1
  83. package/dist/domain/rates.test.js +0 -181
  84. package/dist/domain/rates.test.js.map +0 -1
  85. package/dist/domain/requests.test.d.ts +0 -1
  86. package/dist/domain/requests.test.js +0 -470
  87. package/dist/domain/requests.test.js.map +0 -1
  88. package/dist/domain/settlement.test.d.ts +0 -1
  89. package/dist/domain/settlement.test.js +0 -152
  90. package/dist/domain/settlement.test.js.map +0 -1
  91. package/dist/domain/tranche-display-name.test.d.ts +0 -1
  92. package/dist/domain/tranche-display-name.test.js +0 -58
  93. package/dist/domain/tranche-display-name.test.js.map +0 -1
  94. package/dist/domain/tranches.test.d.ts +0 -1
  95. package/dist/domain/tranches.test.js +0 -206
  96. package/dist/domain/tranches.test.js.map +0 -1
  97. package/dist/domain/wallet-errors.test.d.ts +0 -1
  98. package/dist/domain/wallet-errors.test.js +0 -71
  99. package/dist/domain/wallet-errors.test.js.map +0 -1
  100. package/dist/facade/config.test.d.ts +0 -1
  101. package/dist/facade/config.test.js +0 -216
  102. package/dist/facade/config.test.js.map +0 -1
  103. package/dist/facade/facade.test.d.ts +0 -1
  104. package/dist/facade/facade.test.js +0 -278
  105. package/dist/facade/facade.test.js.map +0 -1
  106. package/dist/services/Locking/calculate-apy.test.d.ts +0 -1
  107. package/dist/services/Locking/calculate-apy.test.js +0 -41
  108. package/dist/services/Locking/calculate-apy.test.js.map +0 -1
  109. package/dist/tests/sample.test.d.ts +0 -1
  110. package/dist/tests/sample.test.js +0 -59
  111. package/dist/tests/sample.test.js.map +0 -1
  112. package/src/domain/au-minimum.test.ts +0 -371
  113. package/src/domain/deposit-bounds.test.ts +0 -200
  114. package/src/domain/loan-contract.test.ts +0 -343
  115. package/src/domain/partners.test.ts +0 -83
  116. package/src/domain/pools.test.ts +0 -260
  117. package/src/domain/rates.test.ts +0 -254
  118. package/src/domain/requests.test.ts +0 -653
  119. package/src/domain/settlement.test.ts +0 -198
  120. package/src/domain/tranche-display-name.test.ts +0 -96
  121. package/src/domain/tranches.test.ts +0 -300
  122. package/src/domain/wallet-errors.test.ts +0 -100
  123. package/src/facade/config.test.ts +0 -265
  124. package/src/facade/facade.test.ts +0 -374
  125. package/src/services/Locking/calculate-apy.test.ts +0 -52
  126. package/src/tests/sample.test.ts +0 -63
@@ -8,36 +8,115 @@
8
8
  * enumerated once here.
9
9
  *
10
10
  * Lifted from kasu-ui's `src/lib/web3/is-user-rejected.ts` and kasu-mobile's
11
- * `src/features/lending/lib/errors.ts`.
11
+ * `src/features/lending/lib/errors.ts` — and now the UNION of the two, so
12
+ * neither app has to keep a wrapper on top of this one.
12
13
  */
13
14
  /**
14
15
  * Did the lender reject the request in their wallet?
15
16
  *
16
- * Providers surface a rejection in different shapes:
17
+ * Providers surface a rejection in different shapes, and the union of them is
18
+ * the point of this function existing once:
17
19
  * - MetaMask and most EIP-1193 wallets: `code: 4001`
20
+ * - Coinbase Wallet and ethers v5: `code: 'ACTION_REJECTED'`
21
+ * - viem: a `UserRejectedRequestError` name
18
22
  * - WalletConnect and some Privy paths: `Error('User rejected the request')`
19
- * - ethers v5 wraps it as `ACTION_REJECTED`
20
- * - Coinbase Wallet sometimes: `code: 'ACTION_REJECTED'` as a string
23
+ * - a provider error WRAPPED by another layer, carrying the real code and
24
+ * message on a nested `error` — the shape Privy's embedded wallet
25
+ * surfaces on Expo, where the outer object says nothing useful
26
+ * - ethers' own `reason` field, which is often the only place the text lands
27
+ * - a PLAIN OBJECT carrying `message`, which `String(err)` would read as
28
+ * `"[object Object]"`
21
29
  *
22
- * This is kasu-ui's implementation verbatim. kasu-mobile's copy additionally
23
- * reads a nested `error.code` / `error.message`, an ethers `reason`, and the
24
- * words "request rejected" / "declined"; a consumer that needs those shapes
25
- * should keep its own check on top rather than assume they are covered here.
30
+ * Previously kasu-ui's implementation verbatim, with kasu-mobile keeping its
31
+ * own superset on top. That is precisely the drift this layer exists to stop —
32
+ * a rejection kasu-mobile recognised and kasu-ui did not was reported to the
33
+ * same lender as a failure on one app and a cancellation on the other. The
34
+ * union lives here; the mobile wrapper goes.
35
+ *
36
+ * ## The text is read for a SUBJECT, not for a keyword
37
+ *
38
+ * The words alone are not the signal. "Declined" and "request rejected" are
39
+ * also what a rate limiter, a risk engine and a KYC decision say, and those
40
+ * arrive wrapped in exactly the same envelope a wallet error does — ethers'
41
+ * `SERVER_ERROR` around `-32603` carries the upstream body on a nested
42
+ * `error.message`, so `{ error: { message: 'request rejected: rate limit
43
+ * exceeded' } }` is an RPC refusing to serve us, not a lender refusing to
44
+ * sign. Reporting one as the other tells a lender they cancelled something
45
+ * they never saw, and DROPS the real error on the floor.
46
+ *
47
+ * So a rejection is a machine-readable wallet code, or a sentence that names
48
+ * the party who did it: "user rejected", "declined by the user", "cancelled by
49
+ * the wallet". A bare "declined" is not a rejection, whatever else is on the
50
+ * envelope.
51
+ *
52
+ * Within that rule, being generous is the safe direction: calling a genuine
53
+ * fault a cancellation costs a lender one retry, while calling a deliberate
54
+ * rejection a failure sends them to support to report a bug that does not
55
+ * exist.
26
56
  */
27
57
  export function isUserRejected(err) {
58
+ var _a;
28
59
  if (!err)
29
60
  return false;
30
61
  if (typeof err === 'object') {
31
- const code = err.code;
32
- if (code === 4001 || code === 'ACTION_REJECTED')
62
+ const e = err;
63
+ if (isRejectionCode(e.code))
64
+ return true;
65
+ // A wrapped provider error: the outer layer's code is its own, the
66
+ // inner one is the wallet's.
67
+ if (isRejectionCode((_a = e.error) === null || _a === void 0 ? void 0 : _a.code))
33
68
  return true;
34
69
  }
35
- const msg = err instanceof Error ? err.message : String(err);
36
- const lower = msg.toLowerCase();
37
- return (lower.includes('user rejected') ||
38
- lower.includes('user denied') ||
39
- lower.includes('rejected the request') ||
40
- lower.includes('action_rejected'));
70
+ const lower = rejectionText(err).toLowerCase();
71
+ return USER_REJECTION_PATTERNS.some((pattern) => pattern.test(lower));
72
+ }
73
+ function isRejectionCode(code) {
74
+ return code === 4001 || code === 'ACTION_REJECTED';
75
+ }
76
+ /**
77
+ * The wordings that name the wallet or the person at it.
78
+ *
79
+ * Each one carries a SUBJECT — the identifier a wallet library uses, or the
80
+ * verb with the party who performed it. That is what separates a lender
81
+ * pressing Reject from a server declining to answer, and it is why none of
82
+ * these is a bare "declined" or "rejected".
83
+ */
84
+ const USER_REJECTION_PATTERNS = [
85
+ // Machine-readable markers that only a wallet layer emits, arriving as
86
+ // text because something in between stringified the error.
87
+ /action_rejected/,
88
+ /user_rejected/,
89
+ /userrejectedrequest/,
90
+ // "the user did it", in the orders the wallets write it.
91
+ /user\s+(?:has\s+)?(?:rejected|denied|declined|refused|cancell?ed)/,
92
+ /(?:rejected|denied|declined|refused|cancell?ed)\s+by\s+(?:the\s+)?(?:user|wallet|signer|owner)/,
93
+ // The wallet as the subject, which is how some embedded wallets word it.
94
+ /(?:wallet|signer)\s+(?:rejected|denied|declined|refused)/,
95
+ ];
96
+ /**
97
+ * Every place a wallet might have put the words: the message, ethers' `reason`,
98
+ * the error's `name` (viem puts the whole signal there), and a wrapped error's
99
+ * own three. Joined rather than picked, because which one carries the text
100
+ * depends on how many layers wrapped it.
101
+ *
102
+ * A separator is used rather than a bare space: two fields must not be able to
103
+ * form a phrase across the join that neither of them said.
104
+ */
105
+ function rejectionText(err) {
106
+ var _a, _b, _c;
107
+ if (typeof err !== 'object' || err === null)
108
+ return String(err);
109
+ const e = err;
110
+ return [
111
+ e.message,
112
+ e.reason,
113
+ e.name,
114
+ (_a = e.error) === null || _a === void 0 ? void 0 : _a.message,
115
+ (_b = e.error) === null || _b === void 0 ? void 0 : _b.reason,
116
+ (_c = e.error) === null || _c === void 0 ? void 0 : _c.name,
117
+ ]
118
+ .filter((part) => typeof part === 'string')
119
+ .join(' | ');
41
120
  }
42
121
  /**
43
122
  * Did the wallet or RPC signal that the on-chain call would revert?
@@ -53,4 +132,24 @@ export function isUnpredictableGas(err) {
53
132
  return false;
54
133
  return err.code === 'UNPREDICTABLE_GAS_LIMIT';
55
134
  }
135
+ /**
136
+ * The `cancelled` / `failed` split, for a WALLET call on any step of any flow.
137
+ *
138
+ * A lender who pressed Reject is not a fault. Reporting one as the other is
139
+ * how a support queue fills with people who did exactly what they meant to.
140
+ *
141
+ * Generic in the step so both flows share one implementation — it was
142
+ * duplicated byte-for-byte in each of them, which is the same drift this
143
+ * layer exists to stop, one level up.
144
+ *
145
+ * Only pass it an error a WALLET produced. An HTTP port's throw is always a
146
+ * `failed`: the lender's wallet was not involved in it, so a backend that
147
+ * happens to word a refusal "declined" must never be shown to them as
148
+ * something they did.
149
+ */
150
+ export function classifyWalletFailure(step, err) {
151
+ return isUserRejected(err)
152
+ ? { step, reason: 'cancelled' }
153
+ : { step, reason: 'failed', error: err };
154
+ }
56
155
  //# sourceMappingURL=wallet-errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-errors.js","sourceRoot":"","sources":["../../src/domain/wallet-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACvC,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAI,GAA0B,CAAC,IAAI,CAAC;QAC9C,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,iBAAiB;YAAE,OAAO,IAAI,CAAC;IACjE,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAChC,OAAO,CACH,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC/B,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC7B,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACtC,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CACpC,CAAC;AACN,CAAC;AAED;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0D;CAC7D,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,GAAY;;IAC/B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAChE,MAAM,CAAC,GAAG,GAST,CAAC;IACF,OAAO;QACH,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,IAAI;QACN,MAAA,CAAC,CAAC,KAAK,0CAAE,OAAO;QAChB,MAAA,CAAC,CAAC,KAAK,0CAAE,MAAM;QACf,MAAA,CAAC,CAAC,KAAK,0CAAE,IAAI;KAChB;SACI,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;SAC1D,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC3C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClD,OAAQ,GAA0B,CAAC,IAAI,KAAK,yBAAyB,CAAC;AAC1E,CAAC;AAOD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CACjC,IAAU,EACV,GAAY;IAEZ,OAAO,cAAc,CAAC,GAAG,CAAC;QACtB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE;QAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACjD,CAAC"}
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { READ_ONLY_MESSAGE } from './read-only';
10
11
  /**
11
12
  * High-level facade for deposit and withdrawal operations.
12
13
  *
@@ -35,7 +36,7 @@ export class DepositsFacade {
35
36
  */
36
37
  assertWritable() {
37
38
  if (this._isReadOnly) {
38
- throw new Error('Kasu: this instance is read-only; call kasu.connect(signer) first');
39
+ throw new Error(READ_ONLY_MESSAGE);
39
40
  }
40
41
  }
41
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"deposits.js","sourceRoot":"","sources":["../../src/facade/deposits.ts"],"names":[],"mappings":";;;;;;;;;AAMA;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACvB,YACY,YAAyB,EACzB,QAAgB;IACxB;;;;OAIG;IACK,cAAc,KAAK;QAPnB,iBAAY,GAAZ,YAAY,CAAa;QACzB,aAAQ,GAAR,QAAQ,CAAQ;QAMhB,gBAAW,GAAX,WAAW,CAAQ;IAC5B,CAAC;IAEJ;;;;;;;OAOG;IACK,cAAc;QAClB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACX,mEAAmE,CACtE,CAAC;QACN,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO,CAAC,MAAqB;;;YAC/B,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAChD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,MAAM,EACb,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI,EACvB,MAAA,MAAM,CAAC,iBAAiB,mCAAI,CAAC,EAC7B,MAAA,MAAM,CAAC,WAAW,mCAAI,IAAI,EAC1B,MAAM,CAAC,YAAY,EACnB,MAAA,MAAM,CAAC,QAAQ,mCAAI,GAAG,CACzB,CAAC;QACN,CAAC;KAAA;IAED;;OAEG;IACG,QAAQ,CAAC,MAAsB;;YACjC,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,CACnD,MAAM,CAAC,MAAM,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
+ import type { IERC20MetadataAbi } from '../contracts';
2
+ import { DepositFlow, DepositFlowOptions, DepositPorts, WithdrawFlow, WithdrawPorts } from '../flows';
3
+ import { DepositsFacade } from './deposits';
4
+ /**
5
+ * The ports a consumer MUST supply for a deposit, plus optional overrides for
6
+ * the ones the SDK can serve itself.
7
+ *
8
+ * The three required ones all reach the application's own backend or wallet:
9
+ * the SDK has no opinion on how a lender signs, which proxy the agreements
10
+ * service sits behind, or where the KYC signature is fetched — and it must not
11
+ * learn any of them, because it is a public package.
12
+ */
13
+ export type DepositFlowPortOverrides = Pick<DepositPorts, 'signMessage' | 'generateContract' | 'getKycSignature'> & Partial<DepositPorts>;
14
+ /**
15
+ * Every withdraw port has an SDK default except `getKycSignature`, which has
16
+ * no default at all and which turns the KYC pre-check on by being supplied.
17
+ */
18
+ export type WithdrawFlowPortOverrides = Partial<WithdrawPorts>;
19
+ /**
20
+ * Builds `DepositFlow` / `WithdrawFlow` instances wired to THIS Kasu instance:
21
+ * its chain's stable token, its `LendingPoolManager`, its signer.
22
+ *
23
+ * ```ts
24
+ * const flow = kasu.connect(signer).flows.deposit({
25
+ * signMessage: (m) => signer.signMessage(m),
26
+ * generateContract: (req) => postToMyProxy(req),
27
+ * getKycSignature: (p) => postToMyBackend(p),
28
+ * });
29
+ * ```
30
+ *
31
+ * A flow built from a read-only instance constructs fine and reads fine — the
32
+ * write ports throw `READ_ONLY_MESSAGE` when the run reaches them, exactly as
33
+ * `kasu.deposits.deposit` does. Constructing is not the mistake; submitting is.
34
+ *
35
+ * It holds the `DepositsFacade` and NOTHING the facade already owns: no
36
+ * `UserLending`, no chain id, no signer. Two paths to one behaviour is how the
37
+ * KYC params a flow built came to differ from the ones `kasu.deposits`
38
+ * built — the same class of drift the flows themselves exist to end.
39
+ */
40
+ export declare class FlowsFacade {
41
+ private readonly _deposits;
42
+ /**
43
+ * The chain's stable token, bound to whatever the Kasu instance holds.
44
+ * A factory rather than a contract: it is one `new Contract`, and a
45
+ * cached binding would outlive the config it was built from.
46
+ */
47
+ private readonly _erc20;
48
+ /** The read-only flag `Kasu` already computed — never re-derived here. */
49
+ private readonly _isReadOnly;
50
+ /**
51
+ * The ERC-20 spender every deposit run approves: this chain's
52
+ * `LendingPoolManager`, which is the only contract the default deposit
53
+ * port calls. Passed to the flow so a consumer never has to hand-wire
54
+ * an address whose only wrong value grants an approval to the wrong
55
+ * contract.
56
+ */
57
+ private readonly _spender;
58
+ constructor(_deposits: DepositsFacade,
59
+ /**
60
+ * The chain's stable token, bound to whatever the Kasu instance holds.
61
+ * A factory rather than a contract: it is one `new Contract`, and a
62
+ * cached binding would outlive the config it was built from.
63
+ */
64
+ _erc20: () => IERC20MetadataAbi,
65
+ /** The read-only flag `Kasu` already computed — never re-derived here. */
66
+ _isReadOnly: boolean,
67
+ /**
68
+ * The ERC-20 spender every deposit run approves: this chain's
69
+ * `LendingPoolManager`, which is the only contract the default deposit
70
+ * port calls. Passed to the flow so a consumer never has to hand-wire
71
+ * an address whose only wrong value grants an approval to the wrong
72
+ * contract.
73
+ */
74
+ _spender: string);
75
+ /**
76
+ * A deposit pipeline. `readAllowance`, `approve`, `deposit` and
77
+ * `buildKycParams` default to the SDK's own implementations; pass any of
78
+ * them to override (kasu-ui approves through its sponsored-gas path, for
79
+ * one).
80
+ *
81
+ * Each default is applied per key with `??`, not by spreading `ports` over
82
+ * them: `{ ...defaults, ...ports }` lets an EXPLICITLY undefined value
83
+ * delete the default it was meant to keep, and
84
+ * `approve: sponsoredGas ? sponsoredApprove : undefined` is exactly how a
85
+ * consumer writes a conditional override.
86
+ */
87
+ deposit(ports: DepositFlowPortOverrides, opts?: DepositFlowOptions): DepositFlow;
88
+ /**
89
+ * A withdrawal pipeline. Both write ports and `buildKycParams` default to
90
+ * this instance; supplying `getKycSignature` turns the KYC pre-check on.
91
+ * Defaults are applied per key, for the reason `deposit()` gives.
92
+ */
93
+ withdraw(ports?: WithdrawFlowPortOverrides): WithdrawFlow;
94
+ private _assertWritable;
95
+ }
@@ -0,0 +1,116 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { DepositFlow, WithdrawFlow, } from '../flows';
11
+ import { READ_ONLY_MESSAGE } from './read-only';
12
+ /**
13
+ * Builds `DepositFlow` / `WithdrawFlow` instances wired to THIS Kasu instance:
14
+ * its chain's stable token, its `LendingPoolManager`, its signer.
15
+ *
16
+ * ```ts
17
+ * const flow = kasu.connect(signer).flows.deposit({
18
+ * signMessage: (m) => signer.signMessage(m),
19
+ * generateContract: (req) => postToMyProxy(req),
20
+ * getKycSignature: (p) => postToMyBackend(p),
21
+ * });
22
+ * ```
23
+ *
24
+ * A flow built from a read-only instance constructs fine and reads fine — the
25
+ * write ports throw `READ_ONLY_MESSAGE` when the run reaches them, exactly as
26
+ * `kasu.deposits.deposit` does. Constructing is not the mistake; submitting is.
27
+ *
28
+ * It holds the `DepositsFacade` and NOTHING the facade already owns: no
29
+ * `UserLending`, no chain id, no signer. Two paths to one behaviour is how the
30
+ * KYC params a flow built came to differ from the ones `kasu.deposits`
31
+ * built — the same class of drift the flows themselves exist to end.
32
+ */
33
+ export class FlowsFacade {
34
+ constructor(_deposits,
35
+ /**
36
+ * The chain's stable token, bound to whatever the Kasu instance holds.
37
+ * A factory rather than a contract: it is one `new Contract`, and a
38
+ * cached binding would outlive the config it was built from.
39
+ */
40
+ _erc20,
41
+ /** The read-only flag `Kasu` already computed — never re-derived here. */
42
+ _isReadOnly,
43
+ /**
44
+ * The ERC-20 spender every deposit run approves: this chain's
45
+ * `LendingPoolManager`, which is the only contract the default deposit
46
+ * port calls. Passed to the flow so a consumer never has to hand-wire
47
+ * an address whose only wrong value grants an approval to the wrong
48
+ * contract.
49
+ */
50
+ _spender) {
51
+ this._deposits = _deposits;
52
+ this._erc20 = _erc20;
53
+ this._isReadOnly = _isReadOnly;
54
+ this._spender = _spender;
55
+ }
56
+ /**
57
+ * A deposit pipeline. `readAllowance`, `approve`, `deposit` and
58
+ * `buildKycParams` default to the SDK's own implementations; pass any of
59
+ * them to override (kasu-ui approves through its sponsored-gas path, for
60
+ * one).
61
+ *
62
+ * Each default is applied per key with `??`, not by spreading `ports` over
63
+ * them: `{ ...defaults, ...ports }` lets an EXPLICITLY undefined value
64
+ * delete the default it was meant to keep, and
65
+ * `approve: sponsoredGas ? sponsoredApprove : undefined` is exactly how a
66
+ * consumer writes a conditional override.
67
+ */
68
+ deposit(ports, opts) {
69
+ var _a, _b, _c, _d, _e;
70
+ return new DepositFlow({
71
+ signMessage: ports.signMessage,
72
+ generateContract: ports.generateContract,
73
+ getKycSignature: ports.getKycSignature,
74
+ buildKycParams: (_a = ports.buildKycParams) !== null && _a !== void 0 ? _a : ((userAddress) => this._deposits.buildKycParams(userAddress)),
75
+ readAllowance: (_b = ports.readAllowance) !== null && _b !== void 0 ? _b : ((owner, spender) => this._erc20().allowance(owner, spender)),
76
+ approve: (_c = ports.approve) !== null && _c !== void 0 ? _c : ((spender, amount) => __awaiter(this, void 0, void 0, function* () {
77
+ this._assertWritable();
78
+ // The EXACT amount the flow asked for. Nothing here
79
+ // rounds it up, and nothing here substitutes
80
+ // MaxUint256.
81
+ return yield this._erc20().approve(spender, amount);
82
+ })),
83
+ deposit: (_d = ports.deposit) !== null && _d !== void 0 ? _d : ((params) => this._deposits.deposit(params)),
84
+ now: ports.now,
85
+ }, {
86
+ contractTtlMs: opts === null || opts === void 0 ? void 0 : opts.contractTtlMs,
87
+ // Per key here too, for the same reason the ports are: an
88
+ // explicit `spender: undefined` must not delete the default.
89
+ spender: (_e = opts === null || opts === void 0 ? void 0 : opts.spender) !== null && _e !== void 0 ? _e : this._spender,
90
+ });
91
+ }
92
+ /**
93
+ * A withdrawal pipeline. Both write ports and `buildKycParams` default to
94
+ * this instance; supplying `getKycSignature` turns the KYC pre-check on.
95
+ * Defaults are applied per key, for the reason `deposit()` gives.
96
+ */
97
+ withdraw(ports = {}) {
98
+ var _a, _b, _c;
99
+ return new WithdrawFlow({
100
+ buildKycParams: (_a = ports.buildKycParams) !== null && _a !== void 0 ? _a : ((userAddress) => this._deposits.buildKycParams(userAddress)),
101
+ getKycSignature: ports.getKycSignature,
102
+ withdraw: (_b = ports.withdraw) !== null && _b !== void 0 ? _b : ((params) => this._deposits.withdraw({
103
+ poolId: params.poolId,
104
+ trancheId: params.trancheId,
105
+ amount: params.amount,
106
+ })),
107
+ withdrawMax: (_c = ports.withdrawMax) !== null && _c !== void 0 ? _c : ((poolId, trancheId, userAddress) => this._deposits.withdrawMax(poolId, trancheId, userAddress)),
108
+ });
109
+ }
110
+ _assertWritable() {
111
+ if (this._isReadOnly) {
112
+ throw new Error(READ_ONLY_MESSAGE);
113
+ }
114
+ }
115
+ }
116
+ //# sourceMappingURL=flows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows.js","sourceRoot":"","sources":["../../src/facade/flows.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EACH,WAAW,EAIX,YAAY,GAEf,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwBhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IACpB,YACqB,SAAyB;IAC1C;;;;OAIG;IACc,MAA+B;IAChD,0EAA0E;IACzD,WAAoB;IACrC;;;;;;OAMG;IACc,QAAgB;QAhBhB,cAAS,GAAT,SAAS,CAAgB;QAMzB,WAAM,GAAN,MAAM,CAAyB;QAE/B,gBAAW,GAAX,WAAW,CAAS;QAQpB,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AC;IACN,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,QAAmC,EAAE;;QAC1C,OAAO,IAAI,YAAY,CAAC;YACpB,cAAc,EACV,MAAA,KAAK,CAAC,cAAc,mCACpB,CAAC,CAAC,WAA0B,EAAa,EAAE,CACvC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YACnD,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,QAAQ,EACJ,MAAA,KAAK,CAAC,QAAQ,mCACd,CAAC,CAAC,MAAM,EAAgC,EAAE,CACtC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBACpB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,SAAS,EAAE,MAAM,CAAC,SAAS;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"}
@@ -2,6 +2,9 @@ export { Kasu } from './kasu';
2
2
  export { StrategiesFacade } from './strategies';
3
3
  export { DepositsFacade } from './deposits';
4
4
  export { PortfolioFacade } from './user-portfolio';
5
+ export { FlowsFacade } from './flows';
6
+ export type { DepositFlowPortOverrides, WithdrawFlowPortOverrides, } from './flows';
7
+ export { READ_ONLY_MESSAGE } from './read-only';
5
8
  export { CHAIN_CONFIGS } from './chain-configs';
6
9
  export { fetchUnusedPoolIds } from './unused-pool-ids';
7
10
  export type { SupportedChain, ChainConfigEntry, StableAsset, KasuOptions, Strategy, StrategyTranche, FixedTermOption, DepositParams, WithdrawParams, DepositLimits, KycParams, UserPositions, PlatformStats, } from './types';
@@ -4,6 +4,9 @@ export { Kasu } from './kasu';
4
4
  export { StrategiesFacade } from './strategies';
5
5
  export { DepositsFacade } from './deposits';
6
6
  export { PortfolioFacade } from './user-portfolio';
7
+ export { FlowsFacade } from './flows';
8
+ // The one refusal every write path shares
9
+ export { READ_ONLY_MESSAGE } from './read-only';
7
10
  // Chain configurations
8
11
  export { CHAIN_CONFIGS } from './chain-configs';
9
12
  // Directus-backed helpers (I/O — not part of `domain/`)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/facade/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,uBAAuB;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wDAAwD;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/facade/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMtC,0CAA0C;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,uBAAuB;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wDAAwD;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -2,14 +2,16 @@ import { Provider } from '@ethersproject/providers';
2
2
  import { Signer } from 'ethers';
3
3
  import { KasuSdk } from '../kasu-sdk';
4
4
  import { DepositsFacade } from './deposits';
5
+ import { FlowsFacade } from './flows';
5
6
  import { StrategiesFacade } from './strategies';
6
7
  import { ChainConfigEntry, KasuOptions } from './types';
7
8
  import { PortfolioFacade } from './user-portfolio';
8
9
  /**
9
10
  * High-level entry point for external integrators.
10
11
  *
11
- * Provides three domain facades — `strategies`, `deposits`, `portfolio` — and
12
- * exposes the underlying `KasuSdk` services via `.services` for power-users.
12
+ * Provides four domain facades — `strategies`, `deposits`, `portfolio`,
13
+ * `flows` — and exposes the underlying `KasuSdk` services via `.services` for
14
+ * power-users.
13
15
  *
14
16
  * ```ts
15
17
  * import { Kasu } from '@kasufinance/kasu-sdk';
@@ -33,6 +35,8 @@ export declare class Kasu {
33
35
  readonly deposits: DepositsFacade;
34
36
  /** User positions, yields, transaction history. */
35
37
  readonly portfolio: PortfolioFacade;
38
+ /** Headless deposit / withdraw state machines. */
39
+ readonly flows: FlowsFacade;
36
40
  private readonly _sdk;
37
41
  private readonly _chainConfig;
38
42
  private readonly _signerOrProvider;
@@ -1,15 +1,18 @@
1
1
  import { providers, Signer } from 'ethers';
2
+ import { IERC20MetadataAbi__factory } from '../contracts';
2
3
  import { KasuSdk } from '../kasu-sdk';
3
4
  import { SdkConfig } from '../sdk-config';
4
5
  import { CHAIN_CONFIGS } from './chain-configs';
5
6
  import { DepositsFacade } from './deposits';
7
+ import { FlowsFacade } from './flows';
6
8
  import { StrategiesFacade } from './strategies';
7
9
  import { PortfolioFacade } from './user-portfolio';
8
10
  /**
9
11
  * High-level entry point for external integrators.
10
12
  *
11
- * Provides three domain facades — `strategies`, `deposits`, `portfolio` — and
12
- * exposes the underlying `KasuSdk` services via `.services` for power-users.
13
+ * Provides four domain facades — `strategies`, `deposits`, `portfolio`,
14
+ * `flows` — and exposes the underlying `KasuSdk` services via `.services` for
15
+ * power-users.
13
16
  *
14
17
  * ```ts
15
18
  * import { Kasu } from '@kasufinance/kasu-sdk';
@@ -33,8 +36,13 @@ export class Kasu {
33
36
  this._signerOrProvider = signerOrProvider;
34
37
  this._configOverrides = configOverrides;
35
38
  this.strategies = new StrategiesFacade(sdk.DataService, sdk.UserLending);
36
- this.deposits = new DepositsFacade(sdk.UserLending, chainConfig.chainId.toString(), !Signer.isSigner(signerOrProvider));
39
+ // Derived ONCE and handed to every facade that needs it. Each of them
40
+ // re-deriving `Signer.isSigner` is how two facades come to disagree
41
+ // about whether the same instance can write.
42
+ const isReadOnly = !Signer.isSigner(signerOrProvider);
43
+ this.deposits = new DepositsFacade(sdk.UserLending, chainConfig.chainId.toString(), isReadOnly);
37
44
  this.portfolio = new PortfolioFacade(sdk.DataService, sdk.UserLending, sdk.Portfolio);
45
+ this.flows = new FlowsFacade(this.deposits, () => erc20Of(chainConfig, signerOrProvider), isReadOnly, chainConfig.contracts.LendingPoolManager);
38
46
  }
39
47
  /**
40
48
  * Create a Kasu instance with built-in chain config.
@@ -166,6 +174,23 @@ function rpcUrlsOf(chainConfig) {
166
174
  var _a;
167
175
  return (_a = chainConfig.rpcUrls) !== null && _a !== void 0 ? _a : [];
168
176
  }
177
+ /**
178
+ * The chain's stable token, bound to whatever this instance holds.
179
+ *
180
+ * Built per call rather than cached: it is one `new Contract`, and a cached
181
+ * binding would outlive the signer a `connect()` replaced. A config with no
182
+ * `stableAsset` (a hand-written entry from before 2.5.0) throws here rather
183
+ * than inside ethers, naming the two ports that make the flow work without
184
+ * one.
185
+ */
186
+ function erc20Of(chainConfig, signerOrProvider) {
187
+ var _a;
188
+ const address = (_a = stableAssetOf(chainConfig)) === null || _a === void 0 ? void 0 : _a.address;
189
+ if (!address) {
190
+ throw new Error('Kasu: this chain config has no stableAsset; pass readAllowance and approve ports explicitly');
191
+ }
192
+ return IERC20MetadataAbi__factory.connect(address, signerOrProvider);
193
+ }
169
194
  /**
170
195
  * The read-only provider used when the caller passes no `signerOrProvider`.
171
196
  *
@@ -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,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,IAAI;IAkBb,YACI,GAAY,EACZ,WAA6B,EAC7B,gBAAmC,EACnC,eAA0C;QAE1C,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QAExC,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAClC,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,WAAW,CAClB,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAC9B,GAAG,CAAC,WAAW,EACf,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,EAC9B,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CACrC,CAAC;QAEF,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAChC,GAAG,CAAC,WAAW,EACf,GAA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,CACX,6FAA6F,CAChG,CAAC;IACN,CAAC;IACD,OAAO,0BAA0B,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,eAAe,CACpB,WAA6B,EAC7B,UAAkB;IAElB,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,MAAM,IAAI,KAAK,CACX,uBAAuB,UAAU,uDAAuD,CAC3F,CAAC;IACN,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,kBAAkB,CACvB,KAAwC;IAExC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The refusal every write path shares when the instance holds a Provider
3
+ * rather than a Signer.
4
+ *
5
+ * One constant, because the message's job is to name the fix — `kasu.connect`
6
+ * — and three near-identical wordings across the facades would be three
7
+ * different pieces of advice for one problem. ethers' own
8
+ * "sending a transaction requires a signer" arrives several frames deeper,
9
+ * after the params have been encoded, and says nothing about how to get a
10
+ * signer onto THIS object.
11
+ */
12
+ export declare const READ_ONLY_MESSAGE = "Kasu: this instance is read-only; call kasu.connect(signer) first";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The refusal every write path shares when the instance holds a Provider
3
+ * rather than a Signer.
4
+ *
5
+ * One constant, because the message's job is to name the fix — `kasu.connect`
6
+ * — and three near-identical wordings across the facades would be three
7
+ * different pieces of advice for one problem. ethers' own
8
+ * "sending a transaction requires a signer" arrives several frames deeper,
9
+ * after the params have been encoded, and says nothing about how to get a
10
+ * signer onto THIS object.
11
+ */
12
+ export const READ_ONLY_MESSAGE = 'Kasu: this instance is read-only; call kasu.connect(signer) first';
13
+ //# sourceMappingURL=read-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-only.js","sourceRoot":"","sources":["../../src/facade/read-only.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC1B,mEAAmE,CAAC"}