@continuumdao/ctm-mpc-defi 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +20 -78
  2. package/dist/agent/catalog.cjs +563 -5
  3. package/dist/agent/catalog.cjs.map +1 -1
  4. package/dist/agent/catalog.d.ts +166 -20
  5. package/dist/agent/catalog.js +551 -7
  6. package/dist/agent/catalog.js.map +1 -1
  7. package/dist/agent/skills/aave-v4/SKILL.md +43 -0
  8. package/dist/agent/skills/curve-dao/SKILL.md +13 -0
  9. package/dist/agent/skills/ethena/SKILL.md +10 -0
  10. package/dist/agent/skills/euler-v2/SKILL.md +10 -0
  11. package/dist/agent/skills/lido/SKILL.md +22 -0
  12. package/dist/agent/skills/maple-syrup/SKILL.md +10 -0
  13. package/dist/agent/skills/sky/SKILL.md +10 -0
  14. package/dist/agent/skills/uniswap-v4/SKILL.md +22 -0
  15. package/dist/chains/evm/index.cjs +79 -224
  16. package/dist/chains/evm/index.cjs.map +1 -1
  17. package/dist/chains/evm/index.d.ts +26 -26
  18. package/dist/chains/evm/index.js +69 -209
  19. package/dist/chains/evm/index.js.map +1 -1
  20. package/dist/chains/near/index.d.ts +1 -1
  21. package/dist/chains/solana/index.d.ts +1 -1
  22. package/dist/core/index.cjs +68 -106
  23. package/dist/core/index.cjs.map +1 -1
  24. package/dist/core/index.d.ts +21 -36
  25. package/dist/core/index.js +57 -96
  26. package/dist/core/index.js.map +1 -1
  27. package/dist/{envelope-CcE5Cz_q.d.ts → envelope-CpBUh9eP.d.ts} +1 -1
  28. package/dist/index.cjs +356 -1855
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.ts +7 -11
  31. package/dist/index.js +332 -1826
  32. package/dist/index.js.map +1 -1
  33. package/dist/protocols/evm/aave-v4/index.cjs +1152 -669
  34. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  35. package/dist/protocols/evm/aave-v4/index.d.ts +418 -3
  36. package/dist/protocols/evm/aave-v4/index.js +1126 -670
  37. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  38. package/dist/protocols/evm/curve-dao/index.cjs +257 -131
  39. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  40. package/dist/protocols/evm/curve-dao/index.d.ts +69 -5
  41. package/dist/protocols/evm/curve-dao/index.js +242 -124
  42. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  43. package/dist/protocols/evm/ethena/index.cjs +394 -402
  44. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  45. package/dist/protocols/evm/ethena/index.d.ts +47 -3
  46. package/dist/protocols/evm/ethena/index.js +390 -404
  47. package/dist/protocols/evm/ethena/index.js.map +1 -1
  48. package/dist/protocols/evm/euler-v2/index.cjs +2810 -1191
  49. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  50. package/dist/protocols/evm/euler-v2/index.d.ts +465 -3
  51. package/dist/protocols/evm/euler-v2/index.js +2761 -1192
  52. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  53. package/dist/protocols/evm/lido/index.cjs +351 -236
  54. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  55. package/dist/protocols/evm/lido/index.d.ts +34 -4
  56. package/dist/protocols/evm/lido/index.js +348 -238
  57. package/dist/protocols/evm/lido/index.js.map +1 -1
  58. package/dist/protocols/evm/maple/index.cjs +390 -395
  59. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  60. package/dist/protocols/evm/maple/index.d.ts +23 -3
  61. package/dist/protocols/evm/maple/index.js +390 -397
  62. package/dist/protocols/evm/maple/index.js.map +1 -1
  63. package/dist/protocols/evm/sky/index.cjs +454 -232
  64. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  65. package/dist/protocols/evm/sky/index.d.ts +57 -3
  66. package/dist/protocols/evm/sky/index.js +444 -231
  67. package/dist/protocols/evm/sky/index.js.map +1 -1
  68. package/dist/protocols/evm/uniswap-v4/index.cjs +423 -658
  69. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  70. package/dist/protocols/evm/uniswap-v4/index.d.ts +3 -4
  71. package/dist/protocols/evm/uniswap-v4/index.js +422 -657
  72. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  73. package/dist/{registry-oMKlO_5z.d.ts → registry-Bv5o37_w.d.ts} +1 -1
  74. package/dist/{types-Ce2qNHai.d.cts → types-BfjWdw1j.d.ts} +3 -1
  75. package/dist/{types-5u863Fd9.d.ts → types-DUeNJLr9.d.ts} +1 -1
  76. package/package.json +7 -6
  77. package/dist/agent/catalog.d.cts +0 -939
  78. package/dist/chains/evm/index.d.cts +0 -64
  79. package/dist/chains/near/index.d.cts +0 -37
  80. package/dist/chains/solana/index.d.cts +0 -40
  81. package/dist/core/index.d.cts +0 -43
  82. package/dist/envelope-DYDPnrHZ.d.cts +0 -35
  83. package/dist/index.d.cts +0 -16
  84. package/dist/keygen-CfNp8yKJ.d.cts +0 -9
  85. package/dist/keygen-DsINazx8.d.ts +0 -9
  86. package/dist/nodeRead-BnmSaMGO.d.cts +0 -8
  87. package/dist/nodeRead-BnmSaMGO.d.ts +0 -8
  88. package/dist/protocols/evm/aave-v4/index.d.cts +0 -500
  89. package/dist/protocols/evm/curve-dao/index.d.cts +0 -147
  90. package/dist/protocols/evm/ethena/index.d.cts +0 -161
  91. package/dist/protocols/evm/euler-v2/index.d.cts +0 -317
  92. package/dist/protocols/evm/lido/index.d.cts +0 -120
  93. package/dist/protocols/evm/maple/index.d.cts +0 -109
  94. package/dist/protocols/evm/sky/index.d.cts +0 -218
  95. package/dist/protocols/evm/uniswap-v4/index.d.cts +0 -324
  96. package/dist/registry-BwZoE668.d.cts +0 -8
  97. package/dist/txParams-BC7ogvdR.d.cts +0 -19
  98. package/dist/txParams-BC7ogvdR.d.ts +0 -19
  99. package/dist/types-B8idm_gu.d.cts +0 -34
  100. package/dist/types-Ce2qNHai.d.ts +0 -57
@@ -1,109 +0,0 @@
1
- import { d as ProtocolModule } from '../../../types-Ce2qNHai.cjs';
2
- import { Address } from 'viem';
3
- import { K as KeyGenSubsetForPermit } from '../../../keygen-CfNp8yKJ.cjs';
4
-
5
- /** Public Maple Syrup (PoolV2 + SyrupRouter) integration constants. */
6
- /** Attributed deposits per Maple partner guidance (`bytes32` string label). */
7
- declare const MAPLE_SYRUP_DEPOSIT_DATA_ASCII = "0:continuumdao";
8
- declare const MAPLE_INTEGRATION_DOCS_URL = "https://docs.maple.finance/integrate/ethereum-mainnet/frontend-integration";
9
- declare function mapleGraphqlEndpointForChain(chainId: number): string | null;
10
- declare function isMapleSyrupSupportedChain(chainId: number): boolean;
11
-
12
- /**
13
- * Maple Syrup: stake underlying into PoolV2 via `SyrupRouter.deposit`, exit with `PoolV2.requestRedeem`.
14
- * Chains: Ethereum mainnet and Sepolia (router + pool addresses from Maple GraphQL).
15
- */
16
-
17
- declare const MAPLE_SYRUP_DEPOSIT_GAS_FALLBACK = 1500000n;
18
- type ChainRow = {
19
- legacy?: boolean;
20
- gasLimit?: number;
21
- gasMultiplier?: number;
22
- gasPrice?: number;
23
- baseFee?: number;
24
- priorityFee?: number;
25
- baseFeeMultiplier?: number;
26
- };
27
- declare function readMaplePoolShareDecimals(args: {
28
- rpcUrl: string;
29
- chainId: number;
30
- pool: Address;
31
- }): Promise<number>;
32
- declare function readMapleStakePreviewShares(args: {
33
- rpcUrl: string;
34
- chainId: number;
35
- pool: Address;
36
- assetAmountWei: bigint;
37
- }): Promise<bigint>;
38
- declare function readMapleUnstakeExitSharesForAssets(args: {
39
- rpcUrl: string;
40
- chainId: number;
41
- pool: Address;
42
- assetAmountWei: bigint;
43
- }): Promise<bigint>;
44
- /** ECDSA v/r/s + bitmap + deadline from Maple for `SyrupRouter.authorizeAndDeposit`. */
45
- type MapleSyrupAuthorizeSig = {
46
- bitmap: bigint;
47
- deadline: bigint;
48
- v: number;
49
- r: `0x${string}`;
50
- s: `0x${string}`;
51
- };
52
- /** Parse UI fields for first-time Syrup deposit (`authorizeAndDeposit`). */
53
- declare function parseMapleStakeAuthInputs(args: {
54
- bitmap: string;
55
- deadline: string;
56
- v: string;
57
- r: string;
58
- s: string;
59
- }): {
60
- ok: true;
61
- sig: MapleSyrupAuthorizeSig;
62
- } | {
63
- ok: false;
64
- message: string;
65
- };
66
- declare function buildEvmMultisignBodyMapleSyrupDeposit(args: {
67
- keyGen: KeyGenSubsetForPermit;
68
- chainId: number;
69
- rpcUrl: string;
70
- chainDetail: ChainRow;
71
- useCustomGas: boolean;
72
- customGasChainDetails?: Record<string, unknown> | null;
73
- /** Underlying USDC / USDT (must match the pool’s asset). */
74
- asset: Address;
75
- syrupRouter: Address;
76
- pool: Address;
77
- amountHuman: string;
78
- assetDecimals: number;
79
- executorAddress: Address;
80
- purposeText: string;
81
- /** Default `deposit`. Use `authorizeAndDeposit` with Maple-issued {@link authorizeSig} for first-time lenders. */
82
- stakeMethod?: 'deposit' | 'authorizeAndDeposit';
83
- authorizeSig?: MapleSyrupAuthorizeSig;
84
- }): Promise<{
85
- bodyForSign: Record<string, unknown>;
86
- messageToSign: string;
87
- }>;
88
- declare function buildEvmMultisignBodyMaplePoolRequestRedeem(args: {
89
- keyGen: KeyGenSubsetForPermit;
90
- chainId: number;
91
- rpcUrl: string;
92
- chainDetail: ChainRow;
93
- useCustomGas: boolean;
94
- customGasChainDetails?: Record<string, unknown> | null;
95
- pool: Address;
96
- /** Human amount in **underlying** units (e.g. USDC). */
97
- underlyingAmountHuman: string;
98
- underlyingDecimals: number;
99
- executorAddress: Address;
100
- purposeText: string;
101
- }): Promise<{
102
- bodyForSign: Record<string, unknown>;
103
- messageToSign: string;
104
- }>;
105
-
106
- declare const MAPLE_PROTOCOL_ID = "maple-syrup";
107
- declare const mapleProtocolModule: ProtocolModule;
108
-
109
- export { MAPLE_INTEGRATION_DOCS_URL, MAPLE_PROTOCOL_ID, MAPLE_SYRUP_DEPOSIT_DATA_ASCII, MAPLE_SYRUP_DEPOSIT_GAS_FALLBACK, type MapleSyrupAuthorizeSig, buildEvmMultisignBodyMaplePoolRequestRedeem, buildEvmMultisignBodyMapleSyrupDeposit, isMapleSyrupSupportedChain, mapleGraphqlEndpointForChain, mapleProtocolModule, parseMapleStakeAuthInputs, readMaplePoolShareDecimals, readMapleStakePreviewShares, readMapleUnstakeExitSharesForAssets };
@@ -1,218 +0,0 @@
1
- import { d as ProtocolModule } from '../../../types-Ce2qNHai.cjs';
2
- import { Address, createPublicClient } from 'viem';
3
- import { K as KeyGenSubsetForPermit } from '../../../keygen-CfNp8yKJ.cjs';
4
-
5
- /**
6
- * Sky LockStake on Ethereum mainnet.
7
- * @see https://developers.skyeco.com/protocol/rewards/staking-engine/
8
- * @see https://developers.skyeco.com/guides/sky/token-governance-upgrade/key-info/ (contract list)
9
- */
10
- /** Sky (SKY token) on Ethereum mainnet. */
11
- declare const SKY_ETHEREUM_MAINNET = "0x56072C95FAA701256059aa122697B133aDEd9279";
12
- declare const SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
13
- declare const USDS_ETHEREUM_MAINNET = "0xdC035D45d973E3EC169d2276DDab16f1e407384F";
14
- /** sUSDS ERC-4626 vault (share token); deposit USDS → mint shares, redeem shares → USDS. @see https://developers.skyeco.com/protocol/tokens/susds/ */
15
- declare const SUSDS_VAULT_ERC4626_MAINNET = "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD";
16
- /**
17
- * Staking Engine (LockStake) — **Chief V3 / SKY** (active; `LSEV2-SKY-A` ilk). This is the contract users should call.
18
- * Do not use Seal Engine V1 (`0x2b16C07D…`, MKR / Chief V2 legacy); it has little traffic and is not the current SKY engine.
19
- * Dual entrypoints: legacy `lock`/`free` (MKR path) vs **`lockSky`/`freeSky`** for SKY collateral via `mkrSky`.
20
- */
21
- declare const SKY_LOCKSTAKE_ENGINE_MAINNET = "0xCe01C90dE7FD1bcFa39e237FE6D8D9F569e8A6a3";
22
- /**
23
- * Wrapped SKY used inside the urn after `lockSky`; StakingRewards farms must list this ERC-20 as `stakingToken()`.
24
- * @see Symbol `lsSKY`.
25
- */
26
- declare const SKY_LS_SKY_ERC20_MAINNET = "0xf9A9cfD3229E985B91F99Bc866d42938044FFa1C";
27
- /**
28
- * Default staking rewards farm on {@link SKY_LOCKSTAKE_ENGINE_MAINNET} — must be ACTIVE and `stakingToken() === lsSKY`.
29
- * (Older Seal-engine farm addresses are not whitelisted on the current engine.)
30
- */
31
- declare const SKY_LOCKSTAKE_DEFAULT_FARM_MAINNET = "0xB44C2Fb4181D7Cb06bdFf34A46FdFe4a259B40Fc";
32
- declare const SKY_LOCKSTAKE_DEFAULT_FARM_REF = 1;
33
- /**
34
- * Rough UI collateral factor for “remaining borrow (USD)” estimate in the LockStake dialog only.
35
- * Not protocol liquidation collateralization; see `SkyLockstakeDialog` disclosures.
36
- */
37
- declare const SKY_LOCKSTAKE_UI_COLLATERAL_FACTOR = 0.65;
38
- declare const SKY_TOKEN_DECIMALS = 18;
39
- declare const USDS_DECIMALS = 18;
40
-
41
- /**
42
- * Sky LockStake Engine (Ethereum): multisign batches for stake/open position, borrow, repay, close.
43
- * Pattern mirrors `ethenaStakeMultisign.ts` (sequential txs, `proposalTxParams`, `batchMeta`).
44
- */
45
-
46
- declare const SKY_LOCKSTAKE_MULTICALL_FALLBACK_GAS = 5000000n;
47
- type SkyMultisignBatchStep = {
48
- to: Address;
49
- data: `0x${string}`;
50
- value: bigint;
51
- meta: Record<string, unknown>;
52
- };
53
- type SkyMultisignChainDetailRow = {
54
- legacy?: boolean;
55
- gasLimit?: number;
56
- gasMultiplier?: number;
57
- gasPrice?: number;
58
- baseFee?: number;
59
- priorityFee?: number;
60
- baseFeeMultiplier?: number;
61
- };
62
- type ChainRow = SkyMultisignChainDetailRow;
63
- declare function appendSerializedSkyBatch(args: {
64
- steps: SkyMultisignBatchStep[];
65
- publicClient: ReturnType<typeof createPublicClient>;
66
- executor: Address;
67
- chainId: number;
68
- rpcUrl: string;
69
- chainDetail: ChainRow;
70
- useCustomGas: boolean;
71
- customGasChainDetails?: Record<string, unknown> | null;
72
- purposePrefix: string;
73
- keyGen: KeyGenSubsetForPermit;
74
- destinationChainID: string;
75
- }): Promise<{
76
- bodyForSign: Record<string, unknown>;
77
- messageToSign: string;
78
- }>;
79
- declare function buildSkyLockstakeStakePositionBatch(args: {
80
- keyGen: KeyGenSubsetForPermit;
81
- chainId: number;
82
- rpcUrl: string;
83
- chainDetail: ChainRow;
84
- useCustomGas: boolean;
85
- customGasChainDetails?: Record<string, unknown> | null;
86
- executorAddress: Address;
87
- purposeText: string;
88
- /** Human SKY amount */
89
- amountHuman: string;
90
- farm?: Address;
91
- farmRef?: number;
92
- /**
93
- * Add SKY to this urn (multicall omits `open`). Must be `< ownerUrnsCount`.
94
- * If omitted and `ownerUrnsCount > 0`, defaults to urn `0` (single-position UX). If omitted and count is 0, opens urn `0`.
95
- */
96
- existingUrnIndex?: bigint;
97
- }): Promise<{
98
- bodyForSign: Record<string, unknown>;
99
- messageToSign: string;
100
- }>;
101
- declare function buildSkyLockstakeDrawBatch(args: {
102
- keyGen: KeyGenSubsetForPermit;
103
- chainId: number;
104
- rpcUrl: string;
105
- chainDetail: ChainRow;
106
- useCustomGas: boolean;
107
- customGasChainDetails?: Record<string, unknown> | null;
108
- executorAddress: Address;
109
- purposeText: string;
110
- urnIndex: bigint;
111
- /** Human USDS */
112
- amountHuman: string;
113
- to?: Address;
114
- }): Promise<{
115
- bodyForSign: Record<string, unknown>;
116
- messageToSign: string;
117
- }>;
118
- declare function buildSkyLockstakeGetRewardBatch(args: {
119
- keyGen: KeyGenSubsetForPermit;
120
- chainId: number;
121
- rpcUrl: string;
122
- chainDetail: ChainRow;
123
- useCustomGas: boolean;
124
- customGasChainDetails?: Record<string, unknown> | null;
125
- executorAddress: Address;
126
- purposeText: string;
127
- urnIndex: bigint;
128
- /** Urn’s selected staking rewards farm (must be non-zero). */
129
- farmAddress: Address;
130
- /** Recipient of claimed ERC-20 rewards; defaults to executor. */
131
- rewardRecipient?: Address;
132
- }): Promise<{
133
- bodyForSign: Record<string, unknown>;
134
- messageToSign: string;
135
- rewardToken: Address;
136
- }>;
137
- declare function buildSkyLockstakeWipeBatch(args: {
138
- keyGen: KeyGenSubsetForPermit;
139
- chainId: number;
140
- rpcUrl: string;
141
- chainDetail: ChainRow;
142
- useCustomGas: boolean;
143
- customGasChainDetails?: Record<string, unknown> | null;
144
- executorAddress: Address;
145
- purposeText: string;
146
- urnIndex: bigint;
147
- wipeAll: boolean;
148
- amountHuman?: string;
149
- }): Promise<{
150
- bodyForSign: Record<string, unknown>;
151
- messageToSign: string;
152
- }>;
153
- declare function buildSkyLockstakeCloseBatch(args: {
154
- keyGen: KeyGenSubsetForPermit;
155
- chainId: number;
156
- rpcUrl: string;
157
- chainDetail: ChainRow;
158
- useCustomGas: boolean;
159
- customGasChainDetails?: Record<string, unknown> | null;
160
- executorAddress: Address;
161
- purposeText: string;
162
- urnIndex: bigint;
163
- inkWei: bigint;
164
- skyRecipient?: Address;
165
- }): Promise<{
166
- bodyForSign: Record<string, unknown>;
167
- messageToSign: string;
168
- }>;
169
- /**
170
- * True when `extraJSON.batchMeta[i].evm.type` pulls ERC-20 inside the same batched approve flow,
171
- * so `eth_estimateGas` on this step alone skips prior approvals (similar to Ethena sUSDe deposit).
172
- */
173
- declare function isSkyLockstakeIsolationEstimateGasFragileBatchStep(detail: Record<string, unknown> | null | undefined, batchIndex: number): boolean;
174
- /** Prefer `proposalTxParams[i].gasLimit` from proposal time — isolated RPC estimate often reverts. */
175
- declare function resolveSkyLockstakeBatchStepGasFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex: number): bigint | null;
176
-
177
- /**
178
- * Sky sUSDS — ERC-4626 deposit (USDS → mint shares) and redeem (burn shares → USDS).
179
- * Serialization matches {@link appendSerializedSkyBatch} from `skyLockstakeMultisign.ts`.
180
- */
181
-
182
- declare function buildSkySusdsRedeemToUsdsBatch(args: {
183
- keyGen: KeyGenSubsetForPermit;
184
- chainId: number;
185
- rpcUrl: string;
186
- chainDetail: SkyMultisignChainDetailRow;
187
- useCustomGas: boolean;
188
- customGasChainDetails?: Record<string, unknown> | null;
189
- executorAddress: Address;
190
- purposeText: string;
191
- /** Human sUSDS (vault share) amount to redeem */
192
- sharesHuman: string;
193
- /** Address receiving USDS from redeem (defaults to executor). */
194
- receiver?: Address;
195
- }): Promise<{
196
- bodyForSign: Record<string, unknown>;
197
- messageToSign: string;
198
- }>;
199
- declare function buildSkySusdsDepositFromUsdsBatch(args: {
200
- keyGen: KeyGenSubsetForPermit;
201
- chainId: number;
202
- rpcUrl: string;
203
- chainDetail: SkyMultisignChainDetailRow;
204
- useCustomGas: boolean;
205
- customGasChainDetails?: Record<string, unknown> | null;
206
- executorAddress: Address;
207
- purposeText: string;
208
- /** Human USDS amount to deposit into the vault. */
209
- assetsHuman: string;
210
- }): Promise<{
211
- bodyForSign: Record<string, unknown>;
212
- messageToSign: string;
213
- }>;
214
-
215
- declare const SKY_PROTOCOL_ID = "sky";
216
- declare const skyProtocolModule: ProtocolModule;
217
-
218
- export { SKY_ETHEREUM_MAINNET, SKY_ETHEREUM_MAINNET_CHAIN_ID, SKY_LOCKSTAKE_DEFAULT_FARM_MAINNET, SKY_LOCKSTAKE_DEFAULT_FARM_REF, SKY_LOCKSTAKE_ENGINE_MAINNET, SKY_LOCKSTAKE_MULTICALL_FALLBACK_GAS, SKY_LOCKSTAKE_UI_COLLATERAL_FACTOR, SKY_LS_SKY_ERC20_MAINNET, SKY_PROTOCOL_ID, SKY_TOKEN_DECIMALS, SUSDS_VAULT_ERC4626_MAINNET, type SkyMultisignBatchStep, type SkyMultisignChainDetailRow, USDS_DECIMALS, USDS_ETHEREUM_MAINNET, appendSerializedSkyBatch, buildSkyLockstakeCloseBatch, buildSkyLockstakeDrawBatch, buildSkyLockstakeGetRewardBatch, buildSkyLockstakeStakePositionBatch, buildSkyLockstakeWipeBatch, buildSkySusdsDepositFromUsdsBatch, buildSkySusdsRedeemToUsdsBatch, isSkyLockstakeIsolationEstimateGasFragileBatchStep, resolveSkyLockstakeBatchStepGasFromSignRequest, skyProtocolModule };
@@ -1,324 +0,0 @@
1
- import { d as ProtocolModule } from '../../../types-Ce2qNHai.cjs';
2
- import { Address } from 'viem';
3
- import { N as NodeReadAuth } from '../../../nodeRead-BnmSaMGO.cjs';
4
- import { K as KeyGenSubsetForPermit } from '../../../keygen-CfNp8yKJ.cjs';
5
- import { E as EvmChainDetail } from '../../../types-B8idm_gu.cjs';
6
-
7
- /** Canonical Uniswap token-allowance contract on most EVM chains. */
8
- declare const PERMIT2_ADDRESS: Address;
9
- declare function isUniswapV4ChainSupported(chainId: string | number | bigint | null | undefined): boolean;
10
- declare function getUniswapUniversalRouterSpenderOrThrow(chainId: number): Address;
11
- declare const MAX_UINT160: bigint;
12
- declare const MAX_UINT48: bigint;
13
- declare const UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS = 1500000n;
14
- declare const UNISWAP_TRADE_BASE_DEFAULT = "https://trade-api.gateway.uniswap.org/v1";
15
- declare const UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT = "2.0";
16
- declare const UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES = 30;
17
- declare const UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET: number;
18
-
19
- /** POST /v1/quote `type` (same as `uniswap_trade_quote.py` `--type`). */
20
- type UniswapQuoteTradeType = 'EXACT_INPUT' | 'EXACT_OUTPUT';
21
- /** Parse chain id like Python: decimal or 0x hex. */
22
- declare function parseUniswapChainId(value: string | number): number;
23
- /** `tokenIn` is the EVM address `0x0` used by the Trade API for the chain’s native (gas) token. */
24
- declare function isUniswapTokenInAddressNative(tokenIn: string | undefined | null): boolean;
25
- /** `fullQuote` / stored quote response: top-level or nested has `quote.input` with a native or ERC-20 address. */
26
- declare function isUniswapFullQuoteResponseNativeIn(stored: Record<string, unknown> | null | undefined): boolean;
27
- /**
28
- * GET /getKeyGenResultById and return `ethereumaddress` (swapper), same as
29
- * `uniswap_mpc_helpers.resolve_owner_from_keygen` in mpc-config.
30
- */
31
- declare function fetchEthereumAddressForKeyGen(managementNodeUrl: string, keyGenId: string, readAuth?: NodeReadAuth, init?: RequestInit): Promise<string>;
32
- interface UniswapTradeQuoteParams {
33
- amount: string;
34
- tokenIn: string;
35
- tokenOut: string;
36
- uniswapApiKey: string;
37
- /**
38
- * KeyGen id — used to resolve `swapper` from GET /getKeyGenResultById unless `swapper` is set.
39
- * Required unless `swapper` is set.
40
- */
41
- keyGen?: string;
42
- type: UniswapQuoteTradeType;
43
- /**
44
- * Slippage as percent, e.g. `0.5` for 0.5%. If omitted, the body uses
45
- * `autoSlippage: "DEFAULT"` (same as the Python script when `--slippage` is not set).
46
- */
47
- slippage?: number | string;
48
- /**
49
- * Chain id for the input side (`tokenInChainId` in the HTTP body; Python `--chain-id`).
50
- * You may set **`chainId` or `tokenInChainId`** (same meaning); if both are set, `chainId` wins.
51
- * Same-chain quote: set one chain here and omit `tokenOutChainId` (or set both to the same id).
52
- */
53
- chainId?: string | number;
54
- /**
55
- * Same as `chainId` (input chain). If `chainId` is omitted, this must be set.
56
- */
57
- tokenInChainId?: string | number;
58
- /**
59
- * Output chain id; defaults to the input chain when omitted (Python: empty `--token-out-chain-id`).
60
- */
61
- tokenOutChainId?: string | number;
62
- /**
63
- * When `true`, sends `x-permit2-disabled: true` (Uniswap’s header for classic ERC-20 allowance; no permitData in the response).
64
- * Omit or set `false` for the default Trade API routing (default).
65
- */
66
- permit2Disabled?: boolean;
67
- /**
68
- * MPC wallet (swapper) address. If omitted, `managementNodeUrl` is used with `keyGen`
69
- * to call GET /getKeyGenResultById.
70
- */
71
- swapper?: `0x${string}` | string;
72
- /**
73
- * Management node base URL (MPC), required when `swapper` is not provided.
74
- */
75
- managementNodeUrl?: string;
76
- /** For Browser HTTPS: Bearer on GET to /getKeyGenResultById. */
77
- nodeReadAuth?: NodeReadAuth;
78
- /** Trade API base without `/quote` (default: Uniswap gateway v1). */
79
- baseUrl?: string;
80
- /** `x-universal-router-version` (default `2.0`, aligned with Python / v4). */
81
- universalRouterVersion?: string;
82
- signal?: AbortSignal;
83
- /** Override for tests. */
84
- fetchImpl?: typeof fetch;
85
- }
86
- declare function buildUniswapQuoteRequestBody(args: Pick<UniswapTradeQuoteParams, 'type' | 'amount' | 'tokenIn' | 'tokenOut' | 'slippage' | 'chainId' | 'tokenInChainId' | 'tokenOutChainId'> & {
87
- swapper: string;
88
- }): Record<string, unknown>;
89
- /**
90
- * Pull a user-facing string from Uniswap / generic JSON error bodies.
91
- */
92
- declare function errorMessageFromUniswapJsonBody(value: unknown): string | null;
93
- /**
94
- * User-facing string from an HTTP body: JSON `message` / `error` / `detail` first,
95
- * else a short plain-text / HTML page title, not the raw document (avoids huge HTML in UI).
96
- */
97
- declare function messageFromUniswapHttpResponseBody(text: string, status: number, statusText?: string): string;
98
- /**
99
- * `POST` Uniswap Trade API `/v1/quote` — TypeScript version of
100
- * `mpc-config/recipes/uniswapV4/uniswap_trade_quote.py` (core HTTP call + KeyGen → swapper).
101
- *
102
- * CORS: calling the Trade API from a browser may be blocked. Prefer a server / route
103
- * handler, or use this in Node. KeyGen resolution uses a GET to your management node
104
- * and follows the same read-auth pattern as the app.
105
- */
106
- declare function uniswapTradeQuote(args: UniswapTradeQuoteParams): Promise<Record<string, unknown>>;
107
- /**
108
- * Single-line JSON for mpc-config `uniswap_trade_swap.py --quote-json` (compact quote body).
109
- */
110
- declare function uniswapQuoteToJsonQuoteOneLine(quote: Record<string, unknown>): string;
111
- /**
112
- * `quote.input.amount` / `quote.output.amount` as bigints, if present (classic response).
113
- */
114
- declare function parseUniswapQuoteClassicInOut(res: Record<string, unknown>): {
115
- inputWei: bigint;
116
- outputWei: bigint;
117
- } | null;
118
- /**
119
- * Fields from Uniswap Trade API `200` `quote` (e.g. {@link https://api-docs.uniswap.org/api-reference/swapping/quote} `ClassicQuote`):
120
- * - `slippage` — slippage tolerance (percent) used for the quote
121
- * - `priceImpact` — “impact the trade has on the market price of the pool, between 0-100 percent”
122
- */
123
- declare function parseUniswapQuoteSlippageInfo(res: Record<string, unknown>): {
124
- slippageTolerancePercent: number | null;
125
- priceImpactPercent: number | null;
126
- };
127
- /** Compact percent for UI (e.g. 0.5, 1.2345). */
128
- declare function formatUniswapPercentForUi(n: number): string;
129
- /** Human string for a modal amount field, trimmed of trailing fraction zeros. */
130
- declare function formatUniswapAmountFieldFromWei(wei: bigint, decimals: number): string;
131
- /**
132
- * One-line prefill for multi-sign "purpose" (user may append context below in the same field).
133
- */
134
- declare function buildUniswapV4PurposePrefill(args: {
135
- tradeType: UniswapQuoteTradeType;
136
- tokenInSymbol: string;
137
- tokenOutSymbol: string;
138
- tokenInDecimals: number;
139
- tokenOutDecimals: number;
140
- amountInput: string;
141
- quote: Record<string, unknown> | null;
142
- slippageInput: string;
143
- chainName: string;
144
- chainId: number;
145
- }): string;
146
- /**
147
- * Human-readable lines from a Trade API `/quote` 200 JSON body.
148
- * Classic quotes expose `quote.input` / `quote.output` with `amount` (base units as string).
149
- */
150
- declare function formatUniswapQuoteForDisplay(res: Record<string, unknown>, args: {
151
- tradeType: UniswapQuoteTradeType;
152
- tokenInDecimals: number;
153
- tokenOutDecimals: number;
154
- tokenInSymbol: string;
155
- tokenOutSymbol: string;
156
- }): {
157
- title: string;
158
- lines: string[];
159
- rawJson: string;
160
- };
161
-
162
- /**
163
- * When `batchIndex` is set, check `batchMeta[i].evm`. Without `batchIndex`, also check `batchMeta[0]`
164
- * (native ETH-in single-tx requests store evm only under batchMeta, not top-level extraJSON.evm).
165
- */
166
- declare function isUniswapV4SwapEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
167
- /**
168
- * Gas units for Get Sig without `eth_estimateGas` (same calldata often reverts on estimate).
169
- * Order: proposal row[i] (or [0] / single `txParams`) / ExtraJSON uniswapV4 (audit, quote).
170
- * Pass `batchIndex` when the sign request is a multi-tx batch.
171
- */
172
- declare function resolveRouterSwapGasUnitsFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): bigint | null;
173
-
174
- /** `deadline` = `now` + `expiryMinutes * 60` (seconds). */
175
- declare function swapTransactionDeadlineUnixFromExpiryMinutes(expiryMinutes: number, nowSec?: number): number;
176
- /** The stored `uniswapTradeQuote` is the full `POST /quote` JSON; `/swap` wants the **inner** classic quote. */
177
- declare function getClassicQuoteFromStoredUniswapResponse(stored: Record<string, unknown> | null | undefined): unknown;
178
- type TransactionRequest = {
179
- to: string;
180
- from?: string;
181
- data: string;
182
- value: string;
183
- /** Trade API or eth-style field name */
184
- gasLimit?: string;
185
- gas?: string;
186
- chainId?: number;
187
- };
188
- type CreateSwapResponse = {
189
- requestId?: string;
190
- swap: TransactionRequest;
191
- gasFee?: string;
192
- };
193
- /**
194
- * `POST /v1/swap` — builds swap calldata (Universal Router) from a quote fetched with classic-allowance header `x-permit2-disabled: true`.
195
- * @see https://api-docs.uniswap.org/api-reference/swapping/swap
196
- */
197
- declare function uniswapCreateSwap(args: {
198
- uniswapApiKey: string;
199
- baseUrl?: string;
200
- /** Full `POST /quote` JSON (must include classic `quote`). */
201
- fullQuoteFromPermit: Record<string, unknown>;
202
- universalRouterVersion?: string;
203
- fetchImpl?: typeof fetch;
204
- /**
205
- * In the browser, direct `POST` to `trade-api.gateway.uniswap.org` is blocked by CORS.
206
- * When true (default in browser), the request goes to same-origin `POST /api/uniswap/swap` which proxies server-side. Set `false` to force a direct call (e.g. tests, Node scripts).
207
- */
208
- useServerProxy?: boolean;
209
- /**
210
- * Universal Router swap deadline (unix seconds). Defaults to now + {@link UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET}.
211
- * Omitting this caused short API defaults and `TransactionDeadlinePassed` after MPC delay.
212
- */
213
- swapTransactionDeadlineUnix?: number;
214
- }): Promise<CreateSwapResponse>;
215
- type ChainRow = {
216
- legacy?: boolean;
217
- gasLimit?: number;
218
- gasMultiplier?: number;
219
- gasPrice?: number;
220
- baseFee?: number;
221
- priorityFee?: number;
222
- baseFeeMultiplier?: number;
223
- };
224
- /**
225
- * Apply UI slippage % on top of the base approve amount (EXACT_OUTPUT only at call sites; basis points, ceil wei).
226
- * Example: 0.5% → multiply by 1.005 (10050/10000). `undefined` / non‑positive leaves `baseWei` unchanged.
227
- */
228
- declare function applySlippagePercentToApproveWei(baseWei: bigint, slippagePercent: number | undefined): bigint;
229
- type UniswapV4SkipPermit2BatchArg = {
230
- keyGen: KeyGenSubsetForPermit;
231
- chainId: number;
232
- rpcUrl: string;
233
- chainDetail: ChainRow;
234
- useCustomGas: boolean;
235
- customGasChainDetails?: Record<string, unknown> | null;
236
- /** `0x0` = native (ETH) in; otherwise ERC-20. */
237
- tokenIn: Address;
238
- executorAddress: Address;
239
- swap: TransactionRequest;
240
- createSwapResponse: {
241
- requestId?: string;
242
- gasFee?: string;
243
- swap: TransactionRequest;
244
- };
245
- fullQuoteSnapshot: Record<string, unknown>;
246
- purposeText: string;
247
- swapDeadlineUnix: number;
248
- slippagePercent?: number;
249
- };
250
- /**
251
- * **Classic ERC-20 allowance** batch (on-chain approvals only), two shapes:
252
- *
253
- * - **`swap.to` == inner `router` (calldata arg)** — Universal Router is the tx target; tokens move via the **allowance hub**:
254
- * `ERC20→hub`, hub `approve(router)`, swap (3 txs).
255
- *
256
- * - **`swap.to` ≠ inner `router`** — Trade uses a **dispatcher** that calls `ERC20.transferFrom` with **`msg.sender` = `swap.to`**.
257
- * Approving only the hub is insufficient (`cast run` shows `transfer amount exceeds allowance`). Path:
258
- * `ERC20.approve(swap.to)`, swap (2 txs).
259
- *
260
- * Approved amount: `max(quote.input, calldata amount)`; with **EXACT_OUTPUT** trades, multiply by `(1 + slippage%)` from the quote modal (input can grow vs the quoted figure).
261
- */
262
- declare function buildEvmMultisignBodyUniswapV4SkipPermit2Batch(args: UniswapV4SkipPermit2BatchArg): Promise<{
263
- bodyForSign: Record<string, unknown>;
264
- messageToSign: string;
265
- }>;
266
-
267
- type UniswapV4SessionPayload = {
268
- chainId: number;
269
- rpcUrl: string;
270
- chainSupported: boolean;
271
- universalRouter?: string;
272
- };
273
- declare function computeUniswapV4Session(args: {
274
- assetsChainId: string | number;
275
- rpcUrl: string | undefined;
276
- protocolEnabled: boolean;
277
- }): UniswapV4SessionPayload;
278
-
279
- type SwapExactInputArgs = {
280
- keyGen: KeyGenSubsetForPermit;
281
- purposeText: string;
282
- chainId: number;
283
- rpcUrl: string;
284
- executorAddress: Address;
285
- chainDetail: EvmChainDetail;
286
- useCustomGas: boolean;
287
- customGasChainDetails?: Record<string, unknown> | null;
288
- tokenIn: Address;
289
- uniswapApiKey: string;
290
- fullQuote: Record<string, unknown>;
291
- slippagePercent?: number;
292
- swapTransactionDeadlineUnix?: number;
293
- baseUrl?: string;
294
- };
295
- /** Quote then build swap multisign body for EXACT_INPUT (caller must have fetched quote first for EXACT_OUTPUT). */
296
- declare function swapFromQuote(args: SwapExactInputArgs & {
297
- swap: Awaited<ReturnType<typeof uniswapCreateSwap>>;
298
- }): Promise<{
299
- bodyForSign: Record<string, unknown>;
300
- messageToSign: string;
301
- }>;
302
- declare function quoteSwap(args: Parameters<typeof uniswapTradeQuote>[0]): Promise<Record<string, unknown>>;
303
- declare function createSwap(args: Parameters<typeof uniswapCreateSwap>[0]): Promise<Awaited<ReturnType<typeof uniswapCreateSwap>>>;
304
- declare function swapExactInput(args: SwapExactInputArgs & {
305
- tradeType?: UniswapQuoteTradeType;
306
- }): Promise<{
307
- bodyForSign: Record<string, unknown>;
308
- messageToSign: string;
309
- }>;
310
-
311
- declare const UNISWAP_V4_PROTOCOL_ID = "uniswap-v4";
312
- declare const uniswapV4ProtocolModule: ProtocolModule;
313
-
314
- declare const uniswapV4: {
315
- quoteSwap: typeof quoteSwap;
316
- createSwap: typeof createSwap;
317
- swapExactInput: typeof swapExactInput;
318
- swapFromQuote: typeof swapFromQuote;
319
- buildSwapMultisignBody: typeof buildEvmMultisignBodyUniswapV4SkipPermit2Batch;
320
- quote: typeof uniswapTradeQuote;
321
- isChainSupported: typeof isUniswapV4ChainSupported;
322
- };
323
-
324
- export { MAX_UINT160, MAX_UINT48, PERMIT2_ADDRESS, type SwapExactInputArgs, UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET, UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES, UNISWAP_TRADE_BASE_DEFAULT, UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS, UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT, UNISWAP_V4_PROTOCOL_ID, type UniswapQuoteTradeType, type UniswapTradeQuoteParams, type UniswapV4SessionPayload, applySlippagePercentToApproveWei, buildEvmMultisignBodyUniswapV4SkipPermit2Batch, buildUniswapQuoteRequestBody, buildUniswapV4PurposePrefill, computeUniswapV4Session, createSwap, errorMessageFromUniswapJsonBody, fetchEthereumAddressForKeyGen, formatUniswapAmountFieldFromWei, formatUniswapPercentForUi, formatUniswapQuoteForDisplay, getClassicQuoteFromStoredUniswapResponse, getUniswapUniversalRouterSpenderOrThrow, isUniswapFullQuoteResponseNativeIn, isUniswapTokenInAddressNative, isUniswapV4ChainSupported, isUniswapV4SwapEvmSignRequest, messageFromUniswapHttpResponseBody, parseUniswapChainId, parseUniswapQuoteClassicInOut, parseUniswapQuoteSlippageInfo, quoteSwap, resolveRouterSwapGasUnitsFromSignRequest, swapExactInput, swapFromQuote, swapTransactionDeadlineUnixFromExpiryMinutes, uniswapCreateSwap, uniswapQuoteToJsonQuoteOneLine, uniswapTradeQuote, uniswapV4, uniswapV4ProtocolModule };
@@ -1,8 +0,0 @@
1
- import { d as ProtocolModule } from './types-Ce2qNHai.cjs';
2
-
3
- declare function registerProtocolModule(mod: ProtocolModule): void;
4
- declare function getProtocolModules(): readonly ProtocolModule[];
5
- declare function getProtocolModule(id: string): ProtocolModule | undefined;
6
- declare function getActionsByChainCategory(category: string): ProtocolModule['actions'];
7
-
8
- export { getProtocolModule as a, getProtocolModules as b, getActionsByChainCategory as g, registerProtocolModule as r };
@@ -1,19 +0,0 @@
1
- /**
2
- * Proposal-time EVM fields for POST /multiSignRequest (mpc-auth).
3
- * Same shape as trigger txParams and GET /getSignRequestById?tx_params=1.
4
- */
5
- type ProposalTxParams = {
6
- nonce: number;
7
- gasLimit: string;
8
- txType: 'eip1559' | 'legacy';
9
- maxFeePerGas?: string;
10
- maxPriorityFeePerGas?: string;
11
- gasPrice?: string;
12
- };
13
- declare function gasLimitFromEstimateAndChainConfig(estimatedGas: bigint, chainGasLimit?: number): bigint;
14
- declare function routerSwapGasLimitFromEstimate(estimatedGas: bigint, chainGasLimit?: number | null): bigint;
15
- declare function composeFeePayloadToTxParams(p: Record<string, unknown>, legacy: boolean): ProposalTxParams | undefined;
16
- declare function triggerTxParamsFromComposeBody(body: Record<string, unknown>): ProposalTxParams;
17
- declare function proposalTxParamsToFeeSnapshot(params: ProposalTxParams): Record<string, unknown>;
18
-
19
- export { type ProposalTxParams as P, composeFeePayloadToTxParams as c, gasLimitFromEstimateAndChainConfig as g, proposalTxParamsToFeeSnapshot as p, routerSwapGasLimitFromEstimate as r, triggerTxParamsFromComposeBody as t };