@compass-labs/api-sdk 2.2.100 → 2.2.102
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/commonjs/funcs/creditCreditBorrow.d.ts +1 -1
- package/dist/commonjs/funcs/creditCreditBorrow.js +1 -1
- package/dist/commonjs/funcs/creditCreditLoop.d.ts +8 -22
- package/dist/commonjs/funcs/creditCreditLoop.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditLoop.js +8 -22
- package/dist/commonjs/funcs/creditCreditLoop.js.map +1 -1
- package/dist/commonjs/funcs/creditCreditLoopedPositions.d.ts +8 -7
- package/dist/commonjs/funcs/creditCreditLoopedPositions.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditLoopedPositions.js +8 -7
- package/dist/commonjs/funcs/creditCreditLoopedPositions.js.map +1 -1
- package/dist/commonjs/funcs/creditCreditRebalance.d.ts +11 -34
- package/dist/commonjs/funcs/creditCreditRebalance.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditRebalance.js +11 -34
- package/dist/commonjs/funcs/creditCreditRebalance.js.map +1 -1
- package/dist/commonjs/funcs/creditCreditRepay.d.ts +1 -1
- package/dist/commonjs/funcs/creditCreditRepay.js +1 -1
- package/dist/commonjs/funcs/creditCreditUnloop.d.ts +7 -38
- package/dist/commonjs/funcs/creditCreditUnloop.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditUnloop.js +7 -38
- package/dist/commonjs/funcs/creditCreditUnloop.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/accountsummary.d.ts +18 -5
- package/dist/commonjs/models/components/accountsummary.d.ts.map +1 -1
- package/dist/commonjs/models/components/accountsummary.js.map +1 -1
- package/dist/commonjs/models/components/collateralposition.d.ts +18 -5
- package/dist/commonjs/models/components/collateralposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/collateralposition.js.map +1 -1
- package/dist/commonjs/models/components/creditborrowparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditborrowparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditborrowparams.js.map +1 -1
- package/dist/commonjs/models/components/creditborrowrequest.d.ts +18 -5
- package/dist/commonjs/models/components/creditborrowrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditborrowrequest.js.map +1 -1
- package/dist/commonjs/models/components/creditenablecollateralparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditenablecollateralparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditenablecollateralparams.js.map +1 -1
- package/dist/commonjs/models/components/creditlooprequest.d.ts +31 -18
- package/dist/commonjs/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditlooprequest.js +5 -6
- package/dist/commonjs/models/components/creditlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditloopresponse.d.ts +5 -5
- package/dist/commonjs/models/components/creditloopresponse.js +1 -1
- package/dist/commonjs/models/components/creditprotocol.d.ts +36 -10
- package/dist/commonjs/models/components/creditprotocol.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditprotocol.js +18 -5
- package/dist/commonjs/models/components/creditprotocol.js.map +1 -1
- package/dist/commonjs/models/components/creditrepayparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditrepayparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditrepayparams.js.map +1 -1
- package/dist/commonjs/models/components/creditrepayrequest.d.ts +18 -5
- package/dist/commonjs/models/components/creditrepayrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditrepayrequest.js.map +1 -1
- package/dist/commonjs/models/components/creditsupplyparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditsupplyparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditsupplyparams.js.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.d.ts +42 -10
- package/dist/commonjs/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.js +13 -2
- package/dist/commonjs/models/components/creditunlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditunloopresponse.d.ts +8 -8
- package/dist/commonjs/models/components/creditunloopresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunloopresponse.js +2 -2
- package/dist/commonjs/models/components/creditunloopresponse.js.map +1 -1
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditwithdrawparams.js.map +1 -1
- package/dist/commonjs/models/components/debtposition.d.ts +18 -5
- package/dist/commonjs/models/components/debtposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/debtposition.js.map +1 -1
- package/dist/commonjs/models/components/loopedposition.d.ts +18 -5
- package/dist/commonjs/models/components/loopedposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/loopedposition.js.map +1 -1
- package/dist/commonjs/models/components/rebalancetarget.d.ts +18 -5
- package/dist/commonjs/models/components/rebalancetarget.d.ts.map +1 -1
- package/dist/commonjs/models/components/rebalancetarget.js.map +1 -1
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts +18 -5
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts.map +1 -1
- package/dist/commonjs/models/components/rebalancetargetpreview.js.map +1 -1
- package/dist/commonjs/models/components/swapinfo.d.ts +2 -2
- package/dist/commonjs/sdk/credit.d.ts +44 -111
- package/dist/commonjs/sdk/credit.d.ts.map +1 -1
- package/dist/commonjs/sdk/credit.js +44 -111
- package/dist/commonjs/sdk/credit.js.map +1 -1
- package/dist/esm/funcs/creditCreditBorrow.d.ts +1 -1
- package/dist/esm/funcs/creditCreditBorrow.js +1 -1
- package/dist/esm/funcs/creditCreditLoop.d.ts +8 -22
- package/dist/esm/funcs/creditCreditLoop.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditLoop.js +8 -22
- package/dist/esm/funcs/creditCreditLoop.js.map +1 -1
- package/dist/esm/funcs/creditCreditLoopedPositions.d.ts +8 -7
- package/dist/esm/funcs/creditCreditLoopedPositions.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditLoopedPositions.js +8 -7
- package/dist/esm/funcs/creditCreditLoopedPositions.js.map +1 -1
- package/dist/esm/funcs/creditCreditRebalance.d.ts +11 -34
- package/dist/esm/funcs/creditCreditRebalance.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditRebalance.js +11 -34
- package/dist/esm/funcs/creditCreditRebalance.js.map +1 -1
- package/dist/esm/funcs/creditCreditRepay.d.ts +1 -1
- package/dist/esm/funcs/creditCreditRepay.js +1 -1
- package/dist/esm/funcs/creditCreditUnloop.d.ts +7 -38
- package/dist/esm/funcs/creditCreditUnloop.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditUnloop.js +7 -38
- package/dist/esm/funcs/creditCreditUnloop.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/accountsummary.d.ts +18 -5
- package/dist/esm/models/components/accountsummary.d.ts.map +1 -1
- package/dist/esm/models/components/accountsummary.js.map +1 -1
- package/dist/esm/models/components/collateralposition.d.ts +18 -5
- package/dist/esm/models/components/collateralposition.d.ts.map +1 -1
- package/dist/esm/models/components/collateralposition.js.map +1 -1
- package/dist/esm/models/components/creditborrowparams.d.ts +18 -5
- package/dist/esm/models/components/creditborrowparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditborrowparams.js.map +1 -1
- package/dist/esm/models/components/creditborrowrequest.d.ts +18 -5
- package/dist/esm/models/components/creditborrowrequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditborrowrequest.js.map +1 -1
- package/dist/esm/models/components/creditenablecollateralparams.d.ts +18 -5
- package/dist/esm/models/components/creditenablecollateralparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditenablecollateralparams.js.map +1 -1
- package/dist/esm/models/components/creditlooprequest.d.ts +31 -18
- package/dist/esm/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditlooprequest.js +4 -5
- package/dist/esm/models/components/creditlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditloopresponse.d.ts +5 -5
- package/dist/esm/models/components/creditloopresponse.js +1 -1
- package/dist/esm/models/components/creditprotocol.d.ts +36 -10
- package/dist/esm/models/components/creditprotocol.d.ts.map +1 -1
- package/dist/esm/models/components/creditprotocol.js +18 -5
- package/dist/esm/models/components/creditprotocol.js.map +1 -1
- package/dist/esm/models/components/creditrepayparams.d.ts +18 -5
- package/dist/esm/models/components/creditrepayparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditrepayparams.js.map +1 -1
- package/dist/esm/models/components/creditrepayrequest.d.ts +18 -5
- package/dist/esm/models/components/creditrepayrequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditrepayrequest.js.map +1 -1
- package/dist/esm/models/components/creditsupplyparams.d.ts +18 -5
- package/dist/esm/models/components/creditsupplyparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditsupplyparams.js.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.d.ts +42 -10
- package/dist/esm/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.js +12 -1
- package/dist/esm/models/components/creditunlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditunloopresponse.d.ts +8 -8
- package/dist/esm/models/components/creditunloopresponse.d.ts.map +1 -1
- package/dist/esm/models/components/creditunloopresponse.js +2 -2
- package/dist/esm/models/components/creditunloopresponse.js.map +1 -1
- package/dist/esm/models/components/creditwithdrawparams.d.ts +18 -5
- package/dist/esm/models/components/creditwithdrawparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditwithdrawparams.js.map +1 -1
- package/dist/esm/models/components/debtposition.d.ts +18 -5
- package/dist/esm/models/components/debtposition.d.ts.map +1 -1
- package/dist/esm/models/components/debtposition.js.map +1 -1
- package/dist/esm/models/components/loopedposition.d.ts +18 -5
- package/dist/esm/models/components/loopedposition.d.ts.map +1 -1
- package/dist/esm/models/components/loopedposition.js.map +1 -1
- package/dist/esm/models/components/rebalancetarget.d.ts +18 -5
- package/dist/esm/models/components/rebalancetarget.d.ts.map +1 -1
- package/dist/esm/models/components/rebalancetarget.js.map +1 -1
- package/dist/esm/models/components/rebalancetargetpreview.d.ts +18 -5
- package/dist/esm/models/components/rebalancetargetpreview.d.ts.map +1 -1
- package/dist/esm/models/components/rebalancetargetpreview.js.map +1 -1
- package/dist/esm/models/components/swapinfo.d.ts +2 -2
- package/dist/esm/sdk/credit.d.ts +44 -111
- package/dist/esm/sdk/credit.d.ts.map +1 -1
- package/dist/esm/sdk/credit.js +44 -111
- package/dist/esm/sdk/credit.js.map +1 -1
- package/docs/models/components/accountsummary.md +11 -11
- package/docs/models/components/collateralposition.md +17 -17
- package/docs/models/components/creditborrowparams.md +11 -11
- package/docs/models/components/creditborrowrequest.md +21 -21
- package/docs/models/components/creditenablecollateralparams.md +7 -7
- package/docs/models/components/creditlooprequest.md +19 -19
- package/docs/models/components/creditlooprequestchain.md +1 -1
- package/docs/models/components/creditlooprequestinitialcollateralamount.md +1 -1
- package/docs/models/components/creditlooprequestloantovalue.md +1 -1
- package/docs/models/components/{pricing.md → creditlooprequestpricing.md} +3 -3
- package/docs/models/components/creditloopresponse.md +8 -8
- package/docs/models/components/creditloopresponseswapprovider.md +1 -1
- package/docs/models/components/creditprotocol.md +18 -5
- package/docs/models/components/creditrepayparams.md +10 -10
- package/docs/models/components/creditrepayrequest.md +20 -20
- package/docs/models/components/creditsupplyparams.md +9 -9
- package/docs/models/components/creditunlooprequest.md +17 -16
- package/docs/models/components/creditunlooprequestchain.md +1 -1
- package/docs/models/components/creditunlooprequestpricing.md +17 -0
- package/docs/models/components/creditunloopresponse.md +10 -10
- package/docs/models/components/creditunloopresponseswapprovider.md +1 -1
- package/docs/models/components/creditwithdrawparams.md +9 -9
- package/docs/models/components/debtposition.md +16 -16
- package/docs/models/components/loopedposition.md +14 -14
- package/docs/models/components/rebalancetarget.md +10 -10
- package/docs/models/components/rebalancetargetpreview.md +16 -16
- package/docs/models/components/swapinfo.md +10 -10
- package/docs/sdks/credit/README.md +40 -107
- package/openapi_prepped_for_speakeasy.json +47 -29
- package/package.json +1 -1
- package/src/funcs/creditCreditBorrow.ts +1 -1
- package/src/funcs/creditCreditLoop.ts +8 -22
- package/src/funcs/creditCreditLoopedPositions.ts +8 -7
- package/src/funcs/creditCreditRebalance.ts +11 -34
- package/src/funcs/creditCreditRepay.ts +1 -1
- package/src/funcs/creditCreditUnloop.ts +7 -38
- package/src/lib/config.ts +2 -2
- package/src/models/components/accountsummary.ts +18 -5
- package/src/models/components/collateralposition.ts +18 -5
- package/src/models/components/creditborrowparams.ts +18 -5
- package/src/models/components/creditborrowrequest.ts +18 -5
- package/src/models/components/creditenablecollateralparams.ts +18 -5
- package/src/models/components/creditlooprequest.ts +36 -20
- package/src/models/components/creditloopresponse.ts +5 -5
- package/src/models/components/creditprotocol.ts +36 -10
- package/src/models/components/creditrepayparams.ts +18 -5
- package/src/models/components/creditrepayrequest.ts +18 -5
- package/src/models/components/creditsupplyparams.ts +18 -5
- package/src/models/components/creditunlooprequest.ts +49 -10
- package/src/models/components/creditunloopresponse.ts +9 -9
- package/src/models/components/creditwithdrawparams.ts +18 -5
- package/src/models/components/debtposition.ts +18 -5
- package/src/models/components/loopedposition.ts +18 -5
- package/src/models/components/rebalancetarget.ts +18 -5
- package/src/models/components/rebalancetargetpreview.ts +18 -5
- package/src/models/components/swapinfo.ts +2 -2
- package/src/sdk/credit.ts +44 -111
|
@@ -54,11 +54,24 @@ export type CreditBorrowParams = {
|
|
|
54
54
|
* @remarks
|
|
55
55
|
*
|
|
56
56
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
57
|
-
* field) keep hitting the unchanged Aave code path
|
|
58
|
-
* Blue lending markets by their bytes32
|
|
59
|
-
* V2 markets by their EVK
|
|
60
|
-
*
|
|
61
|
-
*
|
|
57
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
58
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
59
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
60
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
61
|
+
* per-sub-account positions (``sub_account_id``).
|
|
62
|
+
*
|
|
63
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
64
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
65
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
66
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
67
|
+
*
|
|
68
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
69
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
70
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
71
|
+
* silently absent there rather than an error, so read it from
|
|
72
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
73
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
74
|
+
* emitted.)
|
|
62
75
|
*/
|
|
63
76
|
protocol?: CreditProtocol | undefined;
|
|
64
77
|
/**
|
|
@@ -67,11 +67,24 @@ export type CreditBorrowRequest = {
|
|
|
67
67
|
* @remarks
|
|
68
68
|
*
|
|
69
69
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
70
|
-
* field) keep hitting the unchanged Aave code path
|
|
71
|
-
* Blue lending markets by their bytes32
|
|
72
|
-
* V2 markets by their EVK
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
71
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
72
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
73
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
74
|
+
* per-sub-account positions (``sub_account_id``).
|
|
75
|
+
*
|
|
76
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
77
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
78
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
79
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
80
|
+
*
|
|
81
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
82
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
83
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
84
|
+
* silently absent there rather than an error, so read it from
|
|
85
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
86
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
87
|
+
* emitted.)
|
|
75
88
|
*/
|
|
76
89
|
protocol?: CreditProtocol | undefined;
|
|
77
90
|
/**
|
|
@@ -29,11 +29,24 @@ export type CreditEnableCollateralParams = {
|
|
|
29
29
|
* @remarks
|
|
30
30
|
*
|
|
31
31
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
32
|
-
* field) keep hitting the unchanged Aave code path
|
|
33
|
-
* Blue lending markets by their bytes32
|
|
34
|
-
* V2 markets by their EVK
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
33
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
34
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
35
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
36
|
+
* per-sub-account positions (``sub_account_id``).
|
|
37
|
+
*
|
|
38
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
39
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
40
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
41
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
42
|
+
*
|
|
43
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
44
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
45
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
46
|
+
* silently absent there rather than an error, so read it from
|
|
47
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
48
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
49
|
+
* emitted.)
|
|
37
50
|
*/
|
|
38
51
|
protocol?: CreditProtocol | undefined;
|
|
39
52
|
/**
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./creditprotocol.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Blockchain network.
|
|
14
|
+
* Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
|
|
15
15
|
*/
|
|
16
16
|
export const CreditLoopRequestChain = {
|
|
17
17
|
Arbitrum: "arbitrum",
|
|
@@ -22,12 +22,12 @@ export const CreditLoopRequestChain = {
|
|
|
22
22
|
Tempo: "tempo",
|
|
23
23
|
} as const;
|
|
24
24
|
/**
|
|
25
|
-
* Blockchain network.
|
|
25
|
+
* Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
|
|
26
26
|
*/
|
|
27
27
|
export type CreditLoopRequestChain = ClosedEnum<typeof CreditLoopRequestChain>;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Collateral (in token units)
|
|
30
|
+
* Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).
|
|
31
31
|
*/
|
|
32
32
|
export type CreditLoopRequestInitialCollateralAmount = number | string;
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ export type CreditLoopRequestInitialCollateralAmount = number | string;
|
|
|
37
37
|
export type CreditLoopRequestMultiplier = number | string;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.
|
|
40
|
+
* Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.
|
|
41
41
|
*/
|
|
42
42
|
export type CreditLoopRequestLoanToValue = number | string;
|
|
43
43
|
|
|
@@ -49,7 +49,7 @@ export type CreditLoopRequestMaxSlippagePercent = number | string;
|
|
|
49
49
|
/**
|
|
50
50
|
* Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).
|
|
51
51
|
*/
|
|
52
|
-
export const
|
|
52
|
+
export const CreditLoopRequestPricing = {
|
|
53
53
|
Auto: "auto",
|
|
54
54
|
Firm: "firm",
|
|
55
55
|
Market: "market",
|
|
@@ -57,7 +57,9 @@ export const Pricing = {
|
|
|
57
57
|
/**
|
|
58
58
|
* Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).
|
|
59
59
|
*/
|
|
60
|
-
export type
|
|
60
|
+
export type CreditLoopRequestPricing = ClosedEnum<
|
|
61
|
+
typeof CreditLoopRequestPricing
|
|
62
|
+
>;
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
65
|
* Open a leveraged loop: repeatedly supply collateral, borrow, and swap the
|
|
@@ -72,7 +74,7 @@ export type CreditLoopRequest = {
|
|
|
72
74
|
*/
|
|
73
75
|
owner: string;
|
|
74
76
|
/**
|
|
75
|
-
* Blockchain network.
|
|
77
|
+
* Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
|
|
76
78
|
*/
|
|
77
79
|
chain: CreditLoopRequestChain;
|
|
78
80
|
/**
|
|
@@ -81,11 +83,24 @@ export type CreditLoopRequest = {
|
|
|
81
83
|
* @remarks
|
|
82
84
|
*
|
|
83
85
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
84
|
-
* field) keep hitting the unchanged Aave code path
|
|
85
|
-
* Blue lending markets by their bytes32
|
|
86
|
-
* V2 markets by their EVK
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
87
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
88
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
89
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
90
|
+
* per-sub-account positions (``sub_account_id``).
|
|
91
|
+
*
|
|
92
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
93
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
94
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
95
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
96
|
+
*
|
|
97
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
98
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
99
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
100
|
+
* silently absent there rather than an error, so read it from
|
|
101
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
102
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
103
|
+
* emitted.)
|
|
89
104
|
*/
|
|
90
105
|
protocol?: CreditProtocol | undefined;
|
|
91
106
|
/**
|
|
@@ -113,7 +128,7 @@ export type CreditLoopRequest = {
|
|
|
113
128
|
*/
|
|
114
129
|
borrowToken: string;
|
|
115
130
|
/**
|
|
116
|
-
* Collateral (in token units)
|
|
131
|
+
* Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).
|
|
117
132
|
*/
|
|
118
133
|
initialCollateralAmount: number | string;
|
|
119
134
|
/**
|
|
@@ -121,7 +136,7 @@ export type CreditLoopRequest = {
|
|
|
121
136
|
*/
|
|
122
137
|
multiplier: number | string;
|
|
123
138
|
/**
|
|
124
|
-
* Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.
|
|
139
|
+
* Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.
|
|
125
140
|
*/
|
|
126
141
|
loanToValue: number | string;
|
|
127
142
|
/**
|
|
@@ -129,7 +144,7 @@ export type CreditLoopRequest = {
|
|
|
129
144
|
*/
|
|
130
145
|
maxSlippagePercent?: number | string | undefined;
|
|
131
146
|
/**
|
|
132
|
-
* Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated).
|
|
147
|
+
* Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated). Both tokens must belong to the category or the build returns a 422. On Hyperlend (chain=hyperevm) category 1 is the HYPE-correlated set covering wstHYPE and WHYPE.
|
|
133
148
|
*/
|
|
134
149
|
emodeCategory?: number | null | undefined;
|
|
135
150
|
/**
|
|
@@ -137,13 +152,13 @@ export type CreditLoopRequest = {
|
|
|
137
152
|
*/
|
|
138
153
|
gasSponsorship?: boolean | undefined;
|
|
139
154
|
/**
|
|
140
|
-
* If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null)
|
|
155
|
+
* If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null). NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent transaction: on a pair no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. How the estimate is priced follows `pricing`: on a firm-covered pair under 'auto' or 'firm' it is computed from the firm provider's live price levels (indicative); otherwise swap legs are priced by the default aggregator. Set it on every call made while a user is exploring parameters, and leave it false only for the build they actually intend to sign — firm quotes are single-use maker commitments, and requesting them for displays that are never executed degrades the pricing this API is offered.
|
|
141
156
|
*/
|
|
142
157
|
preview?: boolean | undefined;
|
|
143
158
|
/**
|
|
144
159
|
* Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).
|
|
145
160
|
*/
|
|
146
|
-
pricing?:
|
|
161
|
+
pricing?: CreditLoopRequestPricing | undefined;
|
|
147
162
|
};
|
|
148
163
|
|
|
149
164
|
/** @internal */
|
|
@@ -233,8 +248,9 @@ export function creditLoopRequestMaxSlippagePercentToJSON(
|
|
|
233
248
|
}
|
|
234
249
|
|
|
235
250
|
/** @internal */
|
|
236
|
-
export const
|
|
237
|
-
|
|
251
|
+
export const CreditLoopRequestPricing$outboundSchema: z.ZodNativeEnum<
|
|
252
|
+
typeof CreditLoopRequestPricing
|
|
253
|
+
> = z.nativeEnum(CreditLoopRequestPricing);
|
|
238
254
|
|
|
239
255
|
/** @internal */
|
|
240
256
|
export type CreditLoopRequest$Outbound = {
|
|
@@ -279,7 +295,7 @@ export const CreditLoopRequest$outboundSchema: z.ZodType<
|
|
|
279
295
|
emodeCategory: z.nullable(z.number().int()).optional(),
|
|
280
296
|
gasSponsorship: z.boolean().optional(),
|
|
281
297
|
preview: z.boolean().optional(),
|
|
282
|
-
pricing:
|
|
298
|
+
pricing: CreditLoopRequestPricing$outboundSchema.optional(),
|
|
283
299
|
}).transform((v) => {
|
|
284
300
|
return remap$(v, {
|
|
285
301
|
marketId: "market_id",
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
} from "./unsignedtransaction.js";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Identifies which route priced the swap leg(s): a DEX AGGREGATOR (iterative loop across pool liquidity, slippage-bounded floors) or a FIRM provider (zero-slippage quotes, one per swap leg, each partially filled at the leg's size — exact fills, zero dust). On preview=true responses a firm value means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.
|
|
26
26
|
*/
|
|
27
27
|
export const CreditLoopResponseSwapProvider = {
|
|
28
28
|
OneInch: "one_inch",
|
|
29
29
|
Bebop: "bebop",
|
|
30
30
|
} as const;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Identifies which route priced the swap leg(s): a DEX AGGREGATOR (iterative loop across pool liquidity, slippage-bounded floors) or a FIRM provider (zero-slippage quotes, one per swap leg, each partially filled at the leg's size — exact fills, zero dust). On preview=true responses a firm value means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.
|
|
33
33
|
*/
|
|
34
34
|
export type CreditLoopResponseSwapProvider = ClosedEnum<
|
|
35
35
|
typeof CreditLoopResponseSwapProvider
|
|
@@ -40,7 +40,7 @@ export type CreditLoopResponseSwapProvider = ClosedEnum<
|
|
|
40
40
|
*/
|
|
41
41
|
export type CreditLoopResponse = {
|
|
42
42
|
/**
|
|
43
|
-
* Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true
|
|
43
|
+
* Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet.
|
|
44
44
|
*/
|
|
45
45
|
transaction?: UnsignedTransaction | null | undefined;
|
|
46
46
|
/**
|
|
@@ -52,11 +52,11 @@ export type CreditLoopResponse = {
|
|
|
52
52
|
*/
|
|
53
53
|
preview: CreditLoopPreview | null;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Identifies which route priced the swap leg(s): a DEX AGGREGATOR (iterative loop across pool liquidity, slippage-bounded floors) or a FIRM provider (zero-slippage quotes, one per swap leg, each partially filled at the leg's size — exact fills, zero dust). On preview=true responses a firm value means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.
|
|
56
56
|
*/
|
|
57
57
|
swapProvider?: CreditLoopResponseSwapProvider | undefined;
|
|
58
58
|
/**
|
|
59
|
-
* Deadline of the firm swap quotes (the earliest across the loop's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable
|
|
59
|
+
* Deadline of the firm swap quotes (the earliest across the loop's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview).
|
|
60
60
|
*/
|
|
61
61
|
quoteExpiresAt?: Date | null | undefined;
|
|
62
62
|
/**
|
|
@@ -11,11 +11,24 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
11
11
|
* @remarks
|
|
12
12
|
*
|
|
13
13
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
14
|
-
* field) keep hitting the unchanged Aave code path
|
|
15
|
-
* Blue lending markets by their bytes32
|
|
16
|
-
* V2 markets by their EVK
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
15
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
16
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
17
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
18
|
+
* per-sub-account positions (``sub_account_id``).
|
|
19
|
+
*
|
|
20
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
21
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
22
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
23
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
24
|
+
*
|
|
25
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
26
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
27
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
28
|
+
* silently absent there rather than an error, so read it from
|
|
29
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
30
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
31
|
+
* emitted.)
|
|
19
32
|
*/
|
|
20
33
|
export const CreditProtocol = {
|
|
21
34
|
Aave: "AAVE",
|
|
@@ -28,11 +41,24 @@ export const CreditProtocol = {
|
|
|
28
41
|
* @remarks
|
|
29
42
|
*
|
|
30
43
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
31
|
-
* field) keep hitting the unchanged Aave code path
|
|
32
|
-
* Blue lending markets by their bytes32
|
|
33
|
-
* V2 markets by their EVK
|
|
34
|
-
*
|
|
35
|
-
*
|
|
44
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
45
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
46
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
47
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
48
|
+
* per-sub-account positions (``sub_account_id``).
|
|
49
|
+
*
|
|
50
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
51
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
52
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
53
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
54
|
+
*
|
|
55
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
56
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
57
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
58
|
+
* silently absent there rather than an error, so read it from
|
|
59
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
60
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
61
|
+
* emitted.)
|
|
36
62
|
*/
|
|
37
63
|
export type CreditProtocol = ClosedEnum<typeof CreditProtocol>;
|
|
38
64
|
|
|
@@ -45,11 +45,24 @@ export type CreditRepayParams = {
|
|
|
45
45
|
* @remarks
|
|
46
46
|
*
|
|
47
47
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
48
|
-
* field) keep hitting the unchanged Aave code path
|
|
49
|
-
* Blue lending markets by their bytes32
|
|
50
|
-
* V2 markets by their EVK
|
|
51
|
-
*
|
|
52
|
-
*
|
|
48
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
49
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
50
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
51
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
52
|
+
* per-sub-account positions (``sub_account_id``).
|
|
53
|
+
*
|
|
54
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
55
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
56
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
57
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
58
|
+
*
|
|
59
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
60
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
61
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
62
|
+
* silently absent there rather than an error, so read it from
|
|
63
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
64
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
65
|
+
* emitted.)
|
|
53
66
|
*/
|
|
54
67
|
protocol?: CreditProtocol | undefined;
|
|
55
68
|
/**
|
|
@@ -62,11 +62,24 @@ export type CreditRepayRequest = {
|
|
|
62
62
|
* @remarks
|
|
63
63
|
*
|
|
64
64
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
65
|
-
* field) keep hitting the unchanged Aave code path
|
|
66
|
-
* Blue lending markets by their bytes32
|
|
67
|
-
* V2 markets by their EVK
|
|
68
|
-
*
|
|
69
|
-
*
|
|
65
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
66
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
67
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
68
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
69
|
+
* per-sub-account positions (``sub_account_id``).
|
|
70
|
+
*
|
|
71
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
72
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
73
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
74
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
75
|
+
*
|
|
76
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
77
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
78
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
79
|
+
* silently absent there rather than an error, so read it from
|
|
80
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
81
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
82
|
+
* emitted.)
|
|
70
83
|
*/
|
|
71
84
|
protocol?: CreditProtocol | undefined;
|
|
72
85
|
/**
|
|
@@ -33,11 +33,24 @@ export type CreditSupplyParams = {
|
|
|
33
33
|
* @remarks
|
|
34
34
|
*
|
|
35
35
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
36
|
-
* field) keep hitting the unchanged Aave code path
|
|
37
|
-
* Blue lending markets by their bytes32
|
|
38
|
-
* V2 markets by their EVK
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
37
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
38
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
39
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
40
|
+
* per-sub-account positions (``sub_account_id``).
|
|
41
|
+
*
|
|
42
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
43
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
44
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
45
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
46
|
+
*
|
|
47
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
48
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
49
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
50
|
+
* silently absent there rather than an error, so read it from
|
|
51
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
52
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
53
|
+
* emitted.)
|
|
41
54
|
*/
|
|
42
55
|
protocol?: CreditProtocol | undefined;
|
|
43
56
|
/**
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./creditprotocol.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Blockchain network.
|
|
14
|
+
* Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
|
|
15
15
|
*/
|
|
16
16
|
export const CreditUnloopRequestChain = {
|
|
17
17
|
Arbitrum: "arbitrum",
|
|
@@ -22,7 +22,7 @@ export const CreditUnloopRequestChain = {
|
|
|
22
22
|
Tempo: "tempo",
|
|
23
23
|
} as const;
|
|
24
24
|
/**
|
|
25
|
-
* Blockchain network.
|
|
25
|
+
* Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
|
|
26
26
|
*/
|
|
27
27
|
export type CreditUnloopRequestChain = ClosedEnum<
|
|
28
28
|
typeof CreditUnloopRequestChain
|
|
@@ -38,6 +38,21 @@ export type CreditUnloopRequestTargetMultiplier = number | string;
|
|
|
38
38
|
*/
|
|
39
39
|
export type CreditUnloopRequestMaxSlippagePercent = number | string;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews the firm venue cannot serve return the firm_available advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator. max_slippage_percent applies on EVERY policy — unlike the loop, firm unwinds consume it to size the guaranteed withdraw/repay floors (the fills themselves are exact). 'firm' is incompatible with gas_sponsorship (sponsored unwinds force market routing).
|
|
43
|
+
*/
|
|
44
|
+
export const CreditUnloopRequestPricing = {
|
|
45
|
+
Auto: "auto",
|
|
46
|
+
Firm: "firm",
|
|
47
|
+
Market: "market",
|
|
48
|
+
} as const;
|
|
49
|
+
/**
|
|
50
|
+
* Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews the firm venue cannot serve return the firm_available advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator. max_slippage_percent applies on EVERY policy — unlike the loop, firm unwinds consume it to size the guaranteed withdraw/repay floors (the fills themselves are exact). 'firm' is incompatible with gas_sponsorship (sponsored unwinds force market routing).
|
|
51
|
+
*/
|
|
52
|
+
export type CreditUnloopRequestPricing = ClosedEnum<
|
|
53
|
+
typeof CreditUnloopRequestPricing
|
|
54
|
+
>;
|
|
55
|
+
|
|
41
56
|
/**
|
|
42
57
|
* Unwind a leveraged loop: repeatedly withdraw collateral, swap it back to
|
|
43
58
|
*
|
|
@@ -51,7 +66,7 @@ export type CreditUnloopRequest = {
|
|
|
51
66
|
*/
|
|
52
67
|
owner: string;
|
|
53
68
|
/**
|
|
54
|
-
* Blockchain network.
|
|
69
|
+
* Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
|
|
55
70
|
*/
|
|
56
71
|
chain: CreditUnloopRequestChain;
|
|
57
72
|
/**
|
|
@@ -60,11 +75,24 @@ export type CreditUnloopRequest = {
|
|
|
60
75
|
* @remarks
|
|
61
76
|
*
|
|
62
77
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
63
|
-
* field) keep hitting the unchanged Aave code path
|
|
64
|
-
* Blue lending markets by their bytes32
|
|
65
|
-
* V2 markets by their EVK
|
|
66
|
-
*
|
|
67
|
-
*
|
|
78
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
79
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
80
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
81
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
82
|
+
* per-sub-account positions (``sub_account_id``).
|
|
83
|
+
*
|
|
84
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
85
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
86
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
87
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
88
|
+
*
|
|
89
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
90
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
91
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
92
|
+
* silently absent there rather than an error, so read it from
|
|
93
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
94
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
95
|
+
* emitted.)
|
|
68
96
|
*/
|
|
69
97
|
protocol?: CreditProtocol | undefined;
|
|
70
98
|
/**
|
|
@@ -100,7 +128,7 @@ export type CreditUnloopRequest = {
|
|
|
100
128
|
*/
|
|
101
129
|
maxSlippagePercent?: number | string | undefined;
|
|
102
130
|
/**
|
|
103
|
-
* If the target cannot be reached in one transaction (
|
|
131
|
+
* If the target cannot be reached in one transaction, return the maximum-progress plan (preview.fully_unwound=false) instead of a 400. This can happen because every withdrawal is sized to keep the health factor at or above 1.02 at that step, so a position opened very close to its liquidation threshold runs out of headroom before the target is met. A second unloop call, now from a much lower leverage, finishes the job.
|
|
104
132
|
*/
|
|
105
133
|
allowPartial?: boolean | undefined;
|
|
106
134
|
/**
|
|
@@ -108,9 +136,13 @@ export type CreditUnloopRequest = {
|
|
|
108
136
|
*/
|
|
109
137
|
gasSponsorship?: boolean | undefined;
|
|
110
138
|
/**
|
|
111
|
-
* If true, build a display estimate only: the
|
|
139
|
+
* If true, build a display estimate only — no single-use firm quote is ever spent. NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent transaction: on an unwind no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. On a firm-covered unwind (pricing 'auto' or 'firm') the numbers are firm-INDICATIVE, priced off the firm provider's live maker levels; otherwise they are market-priced with slippage-bounded floors. Under pricing='firm' a preview no firm provider can serve returns the advisory alone (preview=null + firm_available). Set it on every parameter-exploration call and omit it only on the build the user is about to sign.
|
|
112
140
|
*/
|
|
113
141
|
preview?: boolean | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews the firm venue cannot serve return the firm_available advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator. max_slippage_percent applies on EVERY policy — unlike the loop, firm unwinds consume it to size the guaranteed withdraw/repay floors (the fills themselves are exact). 'firm' is incompatible with gas_sponsorship (sponsored unwinds force market routing).
|
|
144
|
+
*/
|
|
145
|
+
pricing?: CreditUnloopRequestPricing | undefined;
|
|
114
146
|
};
|
|
115
147
|
|
|
116
148
|
/** @internal */
|
|
@@ -158,6 +190,11 @@ export function creditUnloopRequestMaxSlippagePercentToJSON(
|
|
|
158
190
|
);
|
|
159
191
|
}
|
|
160
192
|
|
|
193
|
+
/** @internal */
|
|
194
|
+
export const CreditUnloopRequestPricing$outboundSchema: z.ZodNativeEnum<
|
|
195
|
+
typeof CreditUnloopRequestPricing
|
|
196
|
+
> = z.nativeEnum(CreditUnloopRequestPricing);
|
|
197
|
+
|
|
161
198
|
/** @internal */
|
|
162
199
|
export type CreditUnloopRequest$Outbound = {
|
|
163
200
|
owner: string;
|
|
@@ -174,6 +211,7 @@ export type CreditUnloopRequest$Outbound = {
|
|
|
174
211
|
allow_partial?: boolean | undefined;
|
|
175
212
|
gas_sponsorship?: boolean | undefined;
|
|
176
213
|
preview?: boolean | undefined;
|
|
214
|
+
pricing?: string | undefined;
|
|
177
215
|
};
|
|
178
216
|
|
|
179
217
|
/** @internal */
|
|
@@ -196,6 +234,7 @@ export const CreditUnloopRequest$outboundSchema: z.ZodType<
|
|
|
196
234
|
allowPartial: z.boolean().optional(),
|
|
197
235
|
gasSponsorship: z.boolean().optional(),
|
|
198
236
|
preview: z.boolean().optional(),
|
|
237
|
+
pricing: CreditUnloopRequestPricing$outboundSchema.optional(),
|
|
199
238
|
}).transform((v) => {
|
|
200
239
|
return remap$(v, {
|
|
201
240
|
marketId: "market_id",
|