@bananapus/nana-sdk-core 3.3.0 → 3.4.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.
- 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 +23 -8
- package/dist/cjs/v6/pay.d.ts.map +1 -1
- package/dist/cjs/v6/pay.js +313 -32
- 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 +23 -8
- package/dist/esm/v6/pay.d.ts.map +1 -1
- package/dist/esm/v6/pay.js +313 -33
- 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
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { Hex } from "viem";
|
|
2
2
|
/** Why a payment reverted, as a stable code apps and agents branch on. */
|
|
3
3
|
export type PayFailureReason = "TERMINAL_UNDER_MIN" | "BUYBACK_SLIPPAGE_EXCEEDED" | "BUYBACK_DERIVED_FLOOR_NOT_MET" | "BUYBACK_SWAP_AMOUNT_TOO_HIGH" | "ROUTER_SLIPPAGE_EXCEEDED" | "ROUTER_NO_ROUTE" | "TOKEN_NOT_ACCEPTED" | "PAYMENTS_PAUSED" | "NO_RULESET" | "ALLOWANCE_TOO_LOW" | "ALLOWANCE_EXPIRED" | "BALANCE_TOO_LOW" | "UNEXPECTED_ETH" | "NFT_SOLD_OUT" | "NFT_UNAVAILABLE" | "NFT_PRICE_ABOVE_PAYMENT" | "NFT_OVERSPENDING";
|
|
4
|
+
/**
|
|
5
|
+
* The setting a payer can relax so a retry clears the failing check.
|
|
6
|
+
* `minimum` is the payer's token minimum: the terminal's `minReturnedTokens`
|
|
7
|
+
* (`TERMINAL_UNDER_MIN`) or the buyback hook's explicit minimum in the pay
|
|
8
|
+
* metadata (`BUYBACK_SLIPPAGE_EXCEEDED`). `prepareUserPay` floors both by its
|
|
9
|
+
* `slippageBps`, so the fix is preparing again with the larger tolerance
|
|
10
|
+
* {@link payRetrySlippageBps} gives; lowering only `minReturnedTokens` leaves
|
|
11
|
+
* the hook's minimum where it was. Buyback hooks before 1.4 raise the same
|
|
12
|
+
* error for a floor they derive from their own price oracle, which no
|
|
13
|
+
* tolerance moves: the fresh preparation's simulation shows that. The
|
|
14
|
+
* router's conversion minimum is never adjustable: the router can derive it
|
|
15
|
+
* itself.
|
|
16
|
+
*/
|
|
17
|
+
export type PayFailureAdjustable = "minimum";
|
|
4
18
|
/**
|
|
5
19
|
* A decoded payment revert. `received` and `minimum` are set when the
|
|
6
|
-
* payment fell short of a minimum
|
|
7
|
-
*
|
|
20
|
+
* payment fell short of a minimum, in that check's units (for the router,
|
|
21
|
+
* the token it converts into), and `adjustable` names the setting a retry
|
|
22
|
+
* can relax, if any.
|
|
8
23
|
*/
|
|
9
24
|
export interface PayFailure {
|
|
10
25
|
reason: PayFailureReason;
|
|
@@ -12,6 +27,19 @@ export interface PayFailure {
|
|
|
12
27
|
received?: bigint;
|
|
13
28
|
/** The minimum it fell short of. */
|
|
14
29
|
minimum?: bigint;
|
|
30
|
+
/**
|
|
31
|
+
* Set with `received`: true when the failing check settled nothing, so a
|
|
32
|
+
* lower minimum is no fix and `message` does not suggest one. For the
|
|
33
|
+
* buyback hook that is the part it checked, not always the whole payment.
|
|
34
|
+
* Absent means unknown, not a fill.
|
|
35
|
+
*/
|
|
36
|
+
zeroFill?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Set only with a nonzero `received` below `minimum`: the setting the payer
|
|
39
|
+
* can relax so a retry clears the failing check. Absent when no setting
|
|
40
|
+
* the payer controls would help; never relax anything without it.
|
|
41
|
+
*/
|
|
42
|
+
adjustable?: PayFailureAdjustable;
|
|
15
43
|
/** One plain sentence to show the payer. */
|
|
16
44
|
message: string;
|
|
17
45
|
}
|
|
@@ -20,17 +48,21 @@ interface KnownRevert {
|
|
|
20
48
|
name: string;
|
|
21
49
|
selector: Hex;
|
|
22
50
|
params: readonly ("uint256" | "address")[];
|
|
23
|
-
/** Argument positions of the settled amount and the minimum it missed. */
|
|
51
|
+
/** Argument positions of the settled amount and the minimum it missed, which every such revert has below the minimum. */
|
|
24
52
|
shortfall?: readonly [number, number];
|
|
25
53
|
message: string;
|
|
54
|
+
/** The setting the payer can relax, which `message` suggests. */
|
|
55
|
+
adjustable?: PayFailureAdjustable;
|
|
56
|
+
/** The message when the shortfall settled nothing, since relaxing `adjustable` would not help. */
|
|
57
|
+
zeroMessage?: string;
|
|
26
58
|
}
|
|
27
59
|
/**
|
|
28
|
-
* The first known revert in an error
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
60
|
+
* The first known revert in an error: revert data that is a known selector
|
|
61
|
+
* and exactly its canonically encoded arguments, or the router gateway's
|
|
62
|
+
* `RouteFailed` naming a known selector (with no arguments), or, when the error carries
|
|
63
|
+
* no revert data, an error viem typed against the known ABI item (same name
|
|
64
|
+
* and input types) with arguments of those types. Either way a shortfall
|
|
65
|
+
* must settle below its minimum. Text never counts.
|
|
34
66
|
*/
|
|
35
67
|
export declare function matchKnownRevert(error: unknown, reasons?: readonly PayFailureReason[]): {
|
|
36
68
|
known: KnownRevert;
|
|
@@ -41,9 +73,35 @@ export declare function matchKnownRevert(error: unknown, reasons?: readonly PayF
|
|
|
41
73
|
* (viem or wallet, however nested) or raw revert data. Covers the terminal's
|
|
42
74
|
* minimum, the buyback hook's minimum and floor, the router's conversion,
|
|
43
75
|
* paused or unready projects, token approvals and balances, and NFT tiers.
|
|
44
|
-
* A shortfall carries `received` and `minimum`,
|
|
45
|
-
*
|
|
76
|
+
* A shortfall carries `received` and `minimum`, and `adjustable` when the
|
|
77
|
+
* payer can relax a setting and retry; `zeroFill` says the failing check
|
|
78
|
+
* settled nothing, which no setting fixes. Unknown reverts return null.
|
|
46
79
|
*/
|
|
47
80
|
export declare function decodePayFailure(error: unknown): PayFailure | null;
|
|
81
|
+
/**
|
|
82
|
+
* The most tolerance {@link payRetrySlippageBps} offers: 49.5%, so a
|
|
83
|
+
* loosened minimum stays at a nominal 50.5% of the quote (less integer
|
|
84
|
+
* rounding on tiny quotes) and never nears zero. Only
|
|
85
|
+
* that helper applies it; `prepareUserPay`
|
|
86
|
+
* takes any tolerance it is given.
|
|
87
|
+
*/
|
|
88
|
+
export declare const PAY_MAX_SLIPPAGE_BPS = 4950n;
|
|
89
|
+
/**
|
|
90
|
+
* A candidate slippage tolerance, in basis points, for retrying a payment
|
|
91
|
+
* that `prepareUserPay` prepared with `currentBps` and that fell short of its
|
|
92
|
+
* minimum: the current tolerance plus the shortfall, rounded up to a half
|
|
93
|
+
* percent and capped at {@link PAY_MAX_SLIPPAGE_BPS}. Below the cap, a
|
|
94
|
+
* terminal minimum that is one slippage floor of a quote (the fallback
|
|
95
|
+
* minimum) would have been floored at or below what settled. A terminal
|
|
96
|
+
* minimum that adds issuance to a floored quote, and any candidate at the
|
|
97
|
+
* cap, may still fall short. Null unless the failure is `adjustable` by the
|
|
98
|
+
* minimum with a nonzero shortfall, or when the cap leaves nothing looser.
|
|
99
|
+
*
|
|
100
|
+
* It is a candidate, not permission: pass the tolerance of the attempt that
|
|
101
|
+
* failed (never reapply one failure to the last result, which ratchets to the
|
|
102
|
+
* cap), offer it only within what the payer agreed to, show the new minimum,
|
|
103
|
+
* and prepare and simulate the payment again before sending it.
|
|
104
|
+
*/
|
|
105
|
+
export declare function payRetrySlippageBps(failure: PayFailure | null, currentBps: bigint): bigint | null;
|
|
48
106
|
export {};
|
|
49
107
|
//# sourceMappingURL=executionErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executionErrors.d.ts","sourceRoot":"","sources":["../../../src/v6/executionErrors.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"executionErrors.d.ts","sourceRoot":"","sources":["../../../src/v6/executionErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EAMJ,MAAM,MAAM,CAAC;AA2Cd,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GACxB,oBAAoB,GACpB,2BAA2B,GAC3B,+BAA+B,GAC/B,8BAA8B,GAC9B,0BAA0B,GAC1B,iBAAiB,GACjB,oBAAoB,GACpB,iBAAiB,GACjB,YAAY,GACZ,mBAAmB,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,iBAAiB,GACjB,yBAAyB,GACzB,kBAAkB,CAAC;AAEvB;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,WAAW;IACnB,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IAC3C,yHAAyH;IACzH,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,kGAAkG;IAClG,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAmOD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,GACpC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,GAAG,IAAI,CAmD1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAsBlE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,UAAU,GAAG,IAAI,EAC1B,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAgBf"}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PAY_MAX_SLIPPAGE_BPS = void 0;
|
|
3
4
|
exports.matchKnownRevert = matchKnownRevert;
|
|
4
5
|
exports.decodePayFailure = decodePayFailure;
|
|
6
|
+
exports.payRetrySlippageBps = payRetrySlippageBps;
|
|
5
7
|
const viem_1 = require("viem");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
/** Nonempty hex: revert data, well formed or not, even short of a selector. */
|
|
9
|
+
const REVERT_DATA = /^0x[0-9a-f]+$/i;
|
|
10
|
+
/**
|
|
11
|
+
* What a viem or wallet error carries about a revert, however deeply nested:
|
|
12
|
+
* revert data in its own fields, and errors a decoder such as viem typed.
|
|
13
|
+
* Text is never read: an `Error(string)` reason, a request or a call's
|
|
14
|
+
* arguments can spell any error name or revert data.
|
|
15
|
+
*/
|
|
16
|
+
function collectEvidence(value, evidence = { payloads: [], decoded: [] }, seen = new Set(), depth = 0) {
|
|
8
17
|
if (depth > 8 || value === null || value === undefined || seen.has(value)) {
|
|
9
18
|
return evidence;
|
|
10
19
|
}
|
|
11
20
|
if (typeof value === "string") {
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
: evidence.messages).push(value);
|
|
21
|
+
if (REVERT_DATA.test(value))
|
|
22
|
+
evidence.payloads.push(value);
|
|
15
23
|
return evidence;
|
|
16
24
|
}
|
|
17
25
|
if (typeof value !== "object")
|
|
@@ -20,26 +28,22 @@ function collectEvidence(value, evidence, asMessage = false, seen = new Set(), d
|
|
|
20
28
|
const record = value;
|
|
21
29
|
if (typeof record.errorName === "string") {
|
|
22
30
|
evidence.decoded.push({
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
errorName: record.errorName,
|
|
32
|
+
abiItem: record.abiItem,
|
|
33
|
+
args: record.args,
|
|
25
34
|
});
|
|
26
35
|
}
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
next(item, false);
|
|
30
|
-
}
|
|
31
|
-
// A viem error's full message repeats the call it made, arguments and all;
|
|
32
|
-
// its short message and details are the error itself.
|
|
33
|
-
const message = typeof record.shortMessage === "string" ? undefined : record.message;
|
|
34
|
-
for (const item of [record.shortMessage, message, record.details]) {
|
|
35
|
-
next(item, true);
|
|
36
|
+
for (const item of [record.raw, record.data, record.cause, record.error]) {
|
|
37
|
+
collectEvidence(item, evidence, seen, depth + 1);
|
|
36
38
|
}
|
|
37
|
-
next(record.cause, false);
|
|
38
|
-
next(record.error, false);
|
|
39
39
|
return evidence;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const PERMIT_MESSAGE = "The signed token permit covers less than the payment, so sign it again for the full amount.";
|
|
42
|
+
/** A shortfall known only by its selector: no amounts to say a lower minimum helps. */
|
|
43
|
+
const SHORTFALL_MESSAGE = "This payment would get fewer tokens than its minimum, so try again.";
|
|
44
|
+
/** `JBRouterTerminalGateway_RouteFailed(bytes32 errorHash)`: the hash is the inner revert's selector's. */
|
|
45
|
+
const ROUTE_FAILED = "0xa4ceb15e";
|
|
46
|
+
const NO_TOKENS_MESSAGE = "This payment would return no tokens.";
|
|
43
47
|
const UNEXPECTED_ETH_MESSAGE = "A payment in this token cannot also send ETH.";
|
|
44
48
|
const KNOWN_REVERTS = [
|
|
45
49
|
{
|
|
@@ -48,7 +52,10 @@ const KNOWN_REVERTS = [
|
|
|
48
52
|
selector: "0xe2d708a9",
|
|
49
53
|
params: ["uint256", "uint256"],
|
|
50
54
|
shortfall: [0, 1],
|
|
51
|
-
|
|
55
|
+
adjustable: "minimum",
|
|
56
|
+
message: "The price moved and this payment would get fewer tokens than your minimum, so lower your minimum or try again.",
|
|
57
|
+
// The hook checks only the part it buys with; the rest can still mint.
|
|
58
|
+
zeroMessage: "The price moved and the part of this payment that buys tokens would get none, so try again.",
|
|
52
59
|
},
|
|
53
60
|
{
|
|
54
61
|
reason: "TERMINAL_UNDER_MIN",
|
|
@@ -56,7 +63,9 @@ const KNOWN_REVERTS = [
|
|
|
56
63
|
selector: "0x6b2bb382",
|
|
57
64
|
params: ["uint256", "uint256"],
|
|
58
65
|
shortfall: [0, 1],
|
|
59
|
-
|
|
66
|
+
adjustable: "minimum",
|
|
67
|
+
message: "This payment would get fewer tokens than your minimum, so lower your minimum or try again.",
|
|
68
|
+
zeroMessage: NO_TOKENS_MESSAGE,
|
|
60
69
|
},
|
|
61
70
|
{
|
|
62
71
|
reason: "BUYBACK_DERIVED_FLOOR_NOT_MET",
|
|
@@ -72,7 +81,8 @@ const KNOWN_REVERTS = [
|
|
|
72
81
|
selector: "0x1dbd2ab5",
|
|
73
82
|
params: ["uint256", "uint256"],
|
|
74
83
|
shortfall: [0, 1],
|
|
75
|
-
message: "The price moved while converting your payment, so
|
|
84
|
+
message: "The price moved while converting your payment, so try again.",
|
|
85
|
+
zeroMessage: "Converting this payment would return nothing.",
|
|
76
86
|
},
|
|
77
87
|
{
|
|
78
88
|
reason: "BUYBACK_SWAP_AMOUNT_TOO_HIGH",
|
|
@@ -121,14 +131,14 @@ const KNOWN_REVERTS = [
|
|
|
121
131
|
name: "JBMultiTerminal_PermitAllowanceNotEnough",
|
|
122
132
|
selector: "0xc7e994ba",
|
|
123
133
|
params: ["uint256", "uint256"],
|
|
124
|
-
message:
|
|
134
|
+
message: PERMIT_MESSAGE,
|
|
125
135
|
},
|
|
126
136
|
{
|
|
127
137
|
reason: "ALLOWANCE_TOO_LOW",
|
|
128
138
|
name: "ERC20InsufficientAllowance",
|
|
129
139
|
selector: "0xfb8f41b2",
|
|
130
140
|
params: ["address", "uint256", "uint256"],
|
|
131
|
-
message:
|
|
141
|
+
message: "The token approval is less than the payment, so approve the full amount and try again.",
|
|
132
142
|
},
|
|
133
143
|
...[
|
|
134
144
|
["JBRouterTerminal_PermitAllowanceNotEnough", "0x7686b38a"],
|
|
@@ -139,21 +149,21 @@ const KNOWN_REVERTS = [
|
|
|
139
149
|
name,
|
|
140
150
|
selector,
|
|
141
151
|
params: ["uint256", "uint256"],
|
|
142
|
-
message:
|
|
152
|
+
message: PERMIT_MESSAGE,
|
|
143
153
|
})),
|
|
144
154
|
{
|
|
145
155
|
reason: "ALLOWANCE_TOO_LOW",
|
|
146
156
|
name: "InsufficientAllowance",
|
|
147
157
|
selector: "0xf96fb071",
|
|
148
158
|
params: ["uint256"],
|
|
149
|
-
message:
|
|
159
|
+
message: "The Permit2 allowance is less than the payment, so approve the full amount again.",
|
|
150
160
|
},
|
|
151
161
|
{
|
|
152
162
|
reason: "ALLOWANCE_EXPIRED",
|
|
153
163
|
name: "AllowanceExpired",
|
|
154
164
|
selector: "0xd81b2f2e",
|
|
155
165
|
params: ["uint256"],
|
|
156
|
-
message: "The
|
|
166
|
+
message: "The Permit2 approval has expired, so approve it again and retry.",
|
|
157
167
|
},
|
|
158
168
|
{
|
|
159
169
|
reason: "BALANCE_TOO_LOW",
|
|
@@ -213,76 +223,151 @@ const KNOWN_REVERTS = [
|
|
|
213
223
|
name: "JB721TiersHook_Overspending",
|
|
214
224
|
selector: "0x42b9988e",
|
|
215
225
|
params: ["uint256"],
|
|
216
|
-
message: "This
|
|
226
|
+
message: "This payment, with any NFT credits you hold, is more than the NFTs you picked cost, and the extra is not allowed.",
|
|
217
227
|
},
|
|
218
228
|
];
|
|
219
229
|
/**
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
230
|
+
* Arguments that have exactly the known revert's ABI types, and for a
|
|
231
|
+
* shortfall a settled amount below its minimum, or undefined.
|
|
232
|
+
*/
|
|
233
|
+
function validArgs(known, args) {
|
|
234
|
+
if (!Array.isArray(args) || args.length !== known.params.length)
|
|
235
|
+
return;
|
|
236
|
+
const typed = known.params.every((type, i) => type === "address"
|
|
237
|
+
? typeof args[i] === "string" && (0, viem_1.isAddress)(args[i], { strict: false })
|
|
238
|
+
: typeof args[i] === "bigint" && args[i] >= 0n && args[i] <= viem_1.maxUint256);
|
|
239
|
+
if (!typed)
|
|
240
|
+
return;
|
|
241
|
+
if (known.shortfall && args[known.shortfall[0]] >= args[known.shortfall[1]]) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
return args;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The first known revert in an error: revert data that is a known selector
|
|
248
|
+
* and exactly its canonically encoded arguments, or the router gateway's
|
|
249
|
+
* `RouteFailed` naming a known selector (with no arguments), or, when the error carries
|
|
250
|
+
* no revert data, an error viem typed against the known ABI item (same name
|
|
251
|
+
* and input types) with arguments of those types. Either way a shortfall
|
|
252
|
+
* must settle below its minimum. Text never counts.
|
|
226
253
|
*/
|
|
227
254
|
function matchKnownRevert(error, reasons) {
|
|
228
255
|
const known = reasons
|
|
229
256
|
? KNOWN_REVERTS.filter((k) => reasons.includes(k.reason))
|
|
230
257
|
: KNOWN_REVERTS;
|
|
231
|
-
const { payloads, decoded
|
|
232
|
-
|
|
233
|
-
decoded: [],
|
|
234
|
-
messages: [],
|
|
235
|
-
});
|
|
236
|
-
// A revert is its selector alone, or its selector and exactly its arguments.
|
|
237
|
-
const exact = (hex) => {
|
|
258
|
+
const { payloads, decoded } = collectEvidence(error);
|
|
259
|
+
for (const hex of payloads) {
|
|
238
260
|
const lower = hex.toLowerCase();
|
|
239
|
-
|
|
261
|
+
// The router gateway wraps a failed route, keeping only its selector.
|
|
262
|
+
if (lower.startsWith(ROUTE_FAILED) && lower.length === 10 + 64) {
|
|
263
|
+
const errorHash = `0x${lower.slice(10)}`;
|
|
264
|
+
const wrapped = known.find((k) => (0, viem_1.keccak256)(k.selector) === errorHash);
|
|
265
|
+
if (wrapped)
|
|
266
|
+
return { known: wrapped };
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const match = known.find((k) => lower.startsWith(k.selector) &&
|
|
270
|
+
lower.length === 10 + 64 * k.params.length);
|
|
240
271
|
if (!match)
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
272
|
+
continue;
|
|
273
|
+
const params = match.params.map((type) => ({ type }));
|
|
274
|
+
const data = `0x${lower.slice(10)}`;
|
|
275
|
+
const args = validArgs(match, (0, viem_1.decodeAbiParameters)(params, data));
|
|
276
|
+
// Canonical encoding only: an address word with nonzero padding is not one.
|
|
277
|
+
if (args && (0, viem_1.encodeAbiParameters)(params, args) === data) {
|
|
278
|
+
return { known: match, args };
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Revert data, when the error carries any, is the evidence: viem types an
|
|
282
|
+
// error from data with padding or trailing bytes this table rejects, even
|
|
283
|
+
// bytes short of a word.
|
|
284
|
+
if (payloads.length)
|
|
285
|
+
return null;
|
|
286
|
+
for (const { errorName, abiItem, args } of decoded) {
|
|
287
|
+
const item = abiItem;
|
|
288
|
+
const match = known.find((k) => errorName === k.name &&
|
|
289
|
+
item?.type === "error" &&
|
|
290
|
+
item.name === k.name &&
|
|
291
|
+
Array.isArray(item.inputs) &&
|
|
292
|
+
item.inputs.length === k.params.length &&
|
|
293
|
+
k.params.every((type, i) => item.inputs?.[i]?.type === type));
|
|
294
|
+
const valid = match && validArgs(match, args);
|
|
295
|
+
if (match && valid)
|
|
296
|
+
return { known: match, args: valid };
|
|
262
297
|
}
|
|
263
|
-
|
|
264
|
-
return found[0];
|
|
265
|
-
const match = known.find((k) => new RegExp(`\\b${k.name}\\b`, "i").test(text));
|
|
266
|
-
return match ? { known: match } : null;
|
|
298
|
+
return null;
|
|
267
299
|
}
|
|
268
300
|
/**
|
|
269
301
|
* Decode why a payment reverted, from a simulation or transaction error
|
|
270
302
|
* (viem or wallet, however nested) or raw revert data. Covers the terminal's
|
|
271
303
|
* minimum, the buyback hook's minimum and floor, the router's conversion,
|
|
272
304
|
* paused or unready projects, token approvals and balances, and NFT tiers.
|
|
273
|
-
* A shortfall carries `received` and `minimum`,
|
|
274
|
-
*
|
|
305
|
+
* A shortfall carries `received` and `minimum`, and `adjustable` when the
|
|
306
|
+
* payer can relax a setting and retry; `zeroFill` says the failing check
|
|
307
|
+
* settled nothing, which no setting fixes. Unknown reverts return null.
|
|
275
308
|
*/
|
|
276
309
|
function decodePayFailure(error) {
|
|
277
310
|
const matched = matchKnownRevert(error);
|
|
278
311
|
if (!matched)
|
|
279
312
|
return null;
|
|
280
313
|
const { known, args } = matched;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
314
|
+
if (!known.shortfall)
|
|
315
|
+
return { reason: known.reason, message: known.message };
|
|
316
|
+
if (!args) {
|
|
317
|
+
return {
|
|
318
|
+
reason: known.reason,
|
|
319
|
+
message: known.adjustable ? SHORTFALL_MESSAGE : known.message,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
const received = args[known.shortfall[0]];
|
|
323
|
+
const minimum = args[known.shortfall[1]];
|
|
324
|
+
const zeroFill = received === 0n;
|
|
325
|
+
return {
|
|
326
|
+
reason: known.reason,
|
|
327
|
+
received,
|
|
328
|
+
minimum,
|
|
329
|
+
zeroFill,
|
|
330
|
+
...(!zeroFill && known.adjustable ? { adjustable: known.adjustable } : {}),
|
|
331
|
+
message: (zeroFill && known.zeroMessage) || known.message,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* The most tolerance {@link payRetrySlippageBps} offers: 49.5%, so a
|
|
336
|
+
* loosened minimum stays at a nominal 50.5% of the quote (less integer
|
|
337
|
+
* rounding on tiny quotes) and never nears zero. Only
|
|
338
|
+
* that helper applies it; `prepareUserPay`
|
|
339
|
+
* takes any tolerance it is given.
|
|
340
|
+
*/
|
|
341
|
+
exports.PAY_MAX_SLIPPAGE_BPS = 4950n;
|
|
342
|
+
/**
|
|
343
|
+
* A candidate slippage tolerance, in basis points, for retrying a payment
|
|
344
|
+
* that `prepareUserPay` prepared with `currentBps` and that fell short of its
|
|
345
|
+
* minimum: the current tolerance plus the shortfall, rounded up to a half
|
|
346
|
+
* percent and capped at {@link PAY_MAX_SLIPPAGE_BPS}. Below the cap, a
|
|
347
|
+
* terminal minimum that is one slippage floor of a quote (the fallback
|
|
348
|
+
* minimum) would have been floored at or below what settled. A terminal
|
|
349
|
+
* minimum that adds issuance to a floored quote, and any candidate at the
|
|
350
|
+
* cap, may still fall short. Null unless the failure is `adjustable` by the
|
|
351
|
+
* minimum with a nonzero shortfall, or when the cap leaves nothing looser.
|
|
352
|
+
*
|
|
353
|
+
* It is a candidate, not permission: pass the tolerance of the attempt that
|
|
354
|
+
* failed (never reapply one failure to the last result, which ratchets to the
|
|
355
|
+
* cap), offer it only within what the payer agreed to, show the new minimum,
|
|
356
|
+
* and prepare and simulate the payment again before sending it.
|
|
357
|
+
*/
|
|
358
|
+
function payRetrySlippageBps(failure, currentBps) {
|
|
359
|
+
if (failure?.adjustable !== "minimum" || currentBps < 0n)
|
|
360
|
+
return null;
|
|
361
|
+
const { received, minimum } = failure;
|
|
362
|
+
if (typeof received !== "bigint" ||
|
|
363
|
+
typeof minimum !== "bigint" ||
|
|
364
|
+
received <= 0n ||
|
|
365
|
+
received >= minimum) {
|
|
366
|
+
return null;
|
|
285
367
|
}
|
|
286
|
-
|
|
368
|
+
const shortfallBps = ((minimum - received) * 10000n + minimum - 1n) / minimum;
|
|
369
|
+
const stepped = ((currentBps + shortfallBps + 49n) / 50n) * 50n;
|
|
370
|
+
const next = stepped < exports.PAY_MAX_SLIPPAGE_BPS ? stepped : exports.PAY_MAX_SLIPPAGE_BPS;
|
|
371
|
+
return next > currentBps ? next : null;
|
|
287
372
|
}
|
|
288
373
|
//# sourceMappingURL=executionErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executionErrors.js","sourceRoot":"","sources":["../../../src/v6/executionErrors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executionErrors.js","sourceRoot":"","sources":["../../../src/v6/executionErrors.ts"],"names":[],"mappings":";;;AAyWA,4CAsDC;AAWD,4CAsBC;AA2BD,kDAmBC;AA9eD,+BAOc;AAEd,+EAA+E;AAC/E,MAAM,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AG,GAAG,CAAC,GAAG,GAAG,CAAC;IAChE,MAAM,IAAI,GAAG,OAAO,GAAG,4BAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,4BAAoB,CAAC;IAC7E,OAAO,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC"}
|
package/dist/cjs/v6/index.d.ts
CHANGED
|
@@ -13,12 +13,13 @@ export * from "./priceFeeds.js";
|
|
|
13
13
|
export * from "./permit2.js";
|
|
14
14
|
export * from "./projectPayers.js";
|
|
15
15
|
export * from "./cashOut.js";
|
|
16
|
-
export { decodePayFailure, type PayFailure, type PayFailureReason, } from "./executionErrors.js";
|
|
16
|
+
export { decodePayFailure, PAY_MAX_SLIPPAGE_BPS, payRetrySlippageBps, type PayFailure, type PayFailureAdjustable, type PayFailureReason, } from "./executionErrors.js";
|
|
17
17
|
export * from "./nft.js";
|
|
18
18
|
export * from "./nftInventory.js";
|
|
19
19
|
export * from "./defifa.js";
|
|
20
20
|
export { getDefifaHoldings, type DefifaHoldingsArgs, type DefifaHolding, } from "./defifaHoldings.js";
|
|
21
21
|
export * from "./tokens.js";
|
|
22
|
+
export * from "./uniswapV3.js";
|
|
22
23
|
export * from "./uniswapV4.js";
|
|
23
24
|
export * from "./uniswapV4Fees.js";
|
|
24
25
|
export * from "./permissions.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v6/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc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AsB,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
|
package/dist/cjs/v6/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getDefifaHoldings = exports.decodePayFailure = void 0;
|
|
17
|
+
exports.getDefifaHoldings = exports.payRetrySlippageBps = exports.PAY_MAX_SLIPPAGE_BPS = exports.decodePayFailure = void 0;
|
|
18
18
|
__exportStar(require("./types.js"), exports);
|
|
19
19
|
__exportStar(require("./currency.js"), exports);
|
|
20
20
|
__exportStar(require("./fees.js"), exports);
|
|
@@ -32,12 +32,15 @@ __exportStar(require("./projectPayers.js"), exports);
|
|
|
32
32
|
__exportStar(require("./cashOut.js"), exports);
|
|
33
33
|
var executionErrors_js_1 = require("./executionErrors.js");
|
|
34
34
|
Object.defineProperty(exports, "decodePayFailure", { enumerable: true, get: function () { return executionErrors_js_1.decodePayFailure; } });
|
|
35
|
+
Object.defineProperty(exports, "PAY_MAX_SLIPPAGE_BPS", { enumerable: true, get: function () { return executionErrors_js_1.PAY_MAX_SLIPPAGE_BPS; } });
|
|
36
|
+
Object.defineProperty(exports, "payRetrySlippageBps", { enumerable: true, get: function () { return executionErrors_js_1.payRetrySlippageBps; } });
|
|
35
37
|
__exportStar(require("./nft.js"), exports);
|
|
36
38
|
__exportStar(require("./nftInventory.js"), exports);
|
|
37
39
|
__exportStar(require("./defifa.js"), exports);
|
|
38
40
|
var defifaHoldings_js_1 = require("./defifaHoldings.js");
|
|
39
41
|
Object.defineProperty(exports, "getDefifaHoldings", { enumerable: true, get: function () { return defifaHoldings_js_1.getDefifaHoldings; } });
|
|
40
42
|
__exportStar(require("./tokens.js"), exports);
|
|
43
|
+
__exportStar(require("./uniswapV3.js"), exports);
|
|
41
44
|
__exportStar(require("./uniswapV4.js"), exports);
|
|
42
45
|
__exportStar(require("./uniswapV4Fees.js"), exports);
|
|
43
46
|
__exportStar(require("./permissions.js"), exports);
|
package/dist/cjs/v6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v6/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,iDAA+B;AAC/B,gDAA8B;AAC9B,8CAA4B;AAC5B,qDAAmC;AACnC,+CAA6B;AAC7B,iDAA+B;AAC/B,2CAAyB;AACzB,kDAAgC;AAChC,+CAA6B;AAC7B,qDAAmC;AACnC,+CAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v6/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,iDAA+B;AAC/B,gDAA8B;AAC9B,8CAA4B;AAC5B,qDAAmC;AACnC,+CAA6B;AAC7B,iDAA+B;AAC/B,2CAAyB;AACzB,kDAAgC;AAChC,+CAA6B;AAC7B,qDAAmC;AACnC,+CAA6B;AAC7B,2DAO8B;AAN5B,sHAAA,gBAAgB,OAAA;AAChB,0HAAA,oBAAoB,OAAA;AACpB,yHAAA,mBAAmB,OAAA;AAKrB,2CAAyB;AACzB,oDAAkC;AAClC,8CAA4B;AAC5B,yDAI6B;AAH3B,sHAAA,iBAAiB,OAAA;AAInB,8CAA4B;AAC5B,iDAA+B;AAC/B,iDAA+B;AAC/B,qDAAmC;AACnC,mDAAiC;AACjC,+CAA6B;AAC7B,6CAA2B;AAC3B,8CAA4B;AAC5B,iDAA+B;AAC/B,6DAA2C;AAC3C,qDAAmC"}
|