@bananapus/nana-sdk-core 3.3.0 → 3.5.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.
- package/dist/cjs/review/heldWrite.js +1 -1
- package/dist/cjs/review/heldWrite.js.map +1 -1
- package/dist/cjs/review/messages.d.ts +3 -1
- package/dist/cjs/review/messages.d.ts.map +1 -1
- package/dist/cjs/review/messages.js +4 -2
- package/dist/cjs/review/messages.js.map +1 -1
- package/dist/cjs/review/writeHold.d.ts +9 -6
- package/dist/cjs/review/writeHold.d.ts.map +1 -1
- package/dist/cjs/review/writeHold.js +12 -4
- package/dist/cjs/review/writeHold.js.map +1 -1
- package/dist/cjs/review/writeRecovery.d.ts +3 -2
- package/dist/cjs/review/writeRecovery.d.ts.map +1 -1
- package/dist/cjs/review/writeRecovery.js +3 -2
- package/dist/cjs/review/writeRecovery.js.map +1 -1
- package/dist/cjs/v6/defifa.d.ts +4 -2
- package/dist/cjs/v6/defifa.d.ts.map +1 -1
- package/dist/cjs/v6/defifa.js +10 -6
- package/dist/cjs/v6/defifa.js.map +1 -1
- package/dist/cjs/v6/executionErrors.d.ts +69 -11
- package/dist/cjs/v6/executionErrors.d.ts.map +1 -1
- package/dist/cjs/v6/executionErrors.js +160 -75
- package/dist/cjs/v6/executionErrors.js.map +1 -1
- package/dist/cjs/v6/index.d.ts +2 -1
- package/dist/cjs/v6/index.d.ts.map +1 -1
- package/dist/cjs/v6/index.js +4 -1
- package/dist/cjs/v6/index.js.map +1 -1
- package/dist/cjs/v6/pay.d.ts +35 -8
- package/dist/cjs/v6/pay.d.ts.map +1 -1
- package/dist/cjs/v6/pay.js +487 -48
- package/dist/cjs/v6/pay.js.map +1 -1
- package/dist/cjs/v6/uniswapV3.d.ts +21 -0
- package/dist/cjs/v6/uniswapV3.d.ts.map +1 -0
- package/dist/cjs/v6/uniswapV3.js +72 -0
- package/dist/cjs/v6/uniswapV3.js.map +1 -0
- package/dist/esm/review/heldWrite.js +2 -2
- package/dist/esm/review/heldWrite.js.map +1 -1
- package/dist/esm/review/messages.d.ts +3 -1
- package/dist/esm/review/messages.d.ts.map +1 -1
- package/dist/esm/review/messages.js +3 -1
- package/dist/esm/review/messages.js.map +1 -1
- package/dist/esm/review/writeHold.d.ts +9 -6
- package/dist/esm/review/writeHold.d.ts.map +1 -1
- package/dist/esm/review/writeHold.js +12 -4
- package/dist/esm/review/writeHold.js.map +1 -1
- package/dist/esm/review/writeRecovery.d.ts +3 -2
- package/dist/esm/review/writeRecovery.d.ts.map +1 -1
- package/dist/esm/review/writeRecovery.js +3 -2
- package/dist/esm/review/writeRecovery.js.map +1 -1
- package/dist/esm/v6/defifa.d.ts +4 -2
- package/dist/esm/v6/defifa.d.ts.map +1 -1
- package/dist/esm/v6/defifa.js +10 -6
- package/dist/esm/v6/defifa.js.map +1 -1
- package/dist/esm/v6/executionErrors.d.ts +69 -11
- package/dist/esm/v6/executionErrors.d.ts.map +1 -1
- package/dist/esm/v6/executionErrors.js +159 -76
- package/dist/esm/v6/executionErrors.js.map +1 -1
- package/dist/esm/v6/index.d.ts +2 -1
- package/dist/esm/v6/index.d.ts.map +1 -1
- package/dist/esm/v6/index.js +2 -1
- package/dist/esm/v6/index.js.map +1 -1
- package/dist/esm/v6/pay.d.ts +35 -8
- package/dist/esm/v6/pay.d.ts.map +1 -1
- package/dist/esm/v6/pay.js +487 -49
- package/dist/esm/v6/pay.js.map +1 -1
- package/dist/esm/v6/uniswapV3.d.ts +21 -0
- package/dist/esm/v6/uniswapV3.d.ts.map +1 -0
- package/dist/esm/v6/uniswapV3.js +68 -0
- package/dist/esm/v6/uniswapV3.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/v6/pay.d.ts
CHANGED
|
@@ -121,14 +121,24 @@ export interface PreparedUserPay {
|
|
|
121
121
|
metadata: Hex;
|
|
122
122
|
preview: PayPreview;
|
|
123
123
|
minReturnedTokens: bigint;
|
|
124
|
+
/**
|
|
125
|
+
* True when a pool quote could not be read, even on a retry, so the minimum
|
|
126
|
+
* is only the mint-based fallback. Show the payer
|
|
127
|
+
* {@link PAY_QUOTE_FAILED_MESSAGE} and a way to quote again.
|
|
128
|
+
*/
|
|
129
|
+
quoteFailed?: boolean;
|
|
124
130
|
}
|
|
131
|
+
/** What to tell the payer when {@link PreparedUserPay.quoteFailed} is set. */
|
|
132
|
+
export declare const PAY_QUOTE_FAILED_MESSAGE = "Couldn't read the pool's price, so this payment's minimum is only the mint rate.";
|
|
133
|
+
/** `prepareUserPay`'s tolerance on its quote and fallback minimum: 1%. */
|
|
134
|
+
export declare const PAY_DEFAULT_SLIPPAGE_BPS = 100n;
|
|
125
135
|
/**
|
|
126
136
|
* Prepare a person's payment with {@link buildUserPayMetadata}: preview it,
|
|
127
137
|
* and set the minimum the terminal enforces on the beneficiary's balance.
|
|
128
138
|
*
|
|
129
|
-
* When the project's buyback hook
|
|
130
|
-
*
|
|
131
|
-
*
|
|
139
|
+
* When the project's buyback hook would swap, this quotes its pool (fee and
|
|
140
|
+
* price impact included) and sends the slippage-floored quote as an explicit
|
|
141
|
+
* minimum, so the payer gets the pool's rate whenever it
|
|
132
142
|
* beats minting. The hook compares that minimum to the swap output plus the
|
|
133
143
|
* leftover mint: the whole leftover mint when the swapped tokens go through
|
|
134
144
|
* the reserved split (`skipSplits` false, and always on hook 1.1.1, which
|
|
@@ -140,17 +150,34 @@ export interface PreparedUserPay {
|
|
|
140
150
|
* which reaches zero on large buys against a thin pool and sends them to
|
|
141
151
|
* minting even when the pool pays far more.
|
|
142
152
|
*
|
|
143
|
-
*
|
|
144
|
-
* the
|
|
145
|
-
*
|
|
146
|
-
*
|
|
153
|
+
* Behind a router terminal, its registry or its gateway, when the router
|
|
154
|
+
* converts the paid token first with one swap, the pool is the one in the
|
|
155
|
+
* token it converts to, quoted on what that swap is quoted to return. If the
|
|
156
|
+
* conversion returns noticeably less, the hook's minimum reverts the payment.
|
|
157
|
+
* If it returns more, the hook mints once minting reaches the minimum, which
|
|
158
|
+
* happens only when the pool beats minting by less than `slippageBps` plus
|
|
159
|
+
* that gain. The payer still receives at least the minimum, and no fixed
|
|
160
|
+
* minimum avoids this when the pool's edge is inside the conversion's
|
|
161
|
+
* uncertainty. Other routes, such as cashing a project token out first, keep
|
|
162
|
+
* the fallback. When the project has no buyback hook and accepts one token,
|
|
163
|
+
* the minimum is what minting the quoted conversion issues, instead of the
|
|
164
|
+
* router's floor.
|
|
165
|
+
*
|
|
166
|
+
* Otherwise (no pool, or a failed quote) the minimum is the payer's mint
|
|
167
|
+
* entitlement when the hook would swap, since the hook never settles below it,
|
|
168
|
+
* and the terminal's own issuance when it would not. A quote whose reads fail
|
|
169
|
+
* twice returns `quoteFailed`, so the app can say the pool's rate is not
|
|
170
|
+
* protected. If the payment then
|
|
171
|
+
* reverts, {@link decodePayFailure} says why. To let the payer accept less,
|
|
172
|
+
* prepare again with a larger `slippageBps`: the hook's minimum is in the
|
|
173
|
+
* metadata, so lowering `minReturnedTokens` alone does not relax it.
|
|
147
174
|
*
|
|
148
175
|
* When the ruleset calls buyback hook 1.4 directly (or through the omnichain
|
|
149
176
|
* deployer) instead of through the registry, the metadata is keyed to the hook,
|
|
150
177
|
* which reads nothing else.
|
|
151
178
|
*
|
|
152
179
|
* @param args.slippageBps Tolerance on the pool quote and on the fallback
|
|
153
|
-
* minimum. Defaults to
|
|
180
|
+
* minimum. Defaults to {@link PAY_DEFAULT_SLIPPAGE_BPS}.
|
|
154
181
|
* @param args.skipSplits Whether the beneficiary keeps the swapped tokens
|
|
155
182
|
* without the reserved split. Defaults to true, as a person's pay card does;
|
|
156
183
|
* pass false for payments that should honor the project's splits, such as
|
package/dist/cjs/v6/pay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../../../src/v6/pay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,GAAG,EACH,YAAY,EAIb,MAAM,MAAM,CAAC;AAMd,OA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