@latchprotocol/widgets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +649 -0
- package/dist/adapters/binDistribution.d.ts +19 -0
- package/dist/adapters/binDistribution.d.ts.map +1 -0
- package/dist/adapters/protocol.d.ts +409 -0
- package/dist/adapters/protocol.d.ts.map +1 -0
- package/dist/adapters/sale.d.ts +142 -0
- package/dist/adapters/sale.d.ts.map +1 -0
- package/dist/adapters/viem.d.ts +89 -0
- package/dist/adapters/viem.d.ts.map +1 -0
- package/dist/callpath/constants.d.ts +218 -0
- package/dist/callpath/constants.d.ts.map +1 -0
- package/dist/callpath/launch.d.ts +1979 -0
- package/dist/callpath/launch.d.ts.map +1 -0
- package/dist/callpath/liquidity.d.ts +103 -0
- package/dist/callpath/liquidity.d.ts.map +1 -0
- package/dist/callpath/plan.d.ts +34 -0
- package/dist/callpath/plan.d.ts.map +1 -0
- package/dist/callpath/swap.d.ts +129 -0
- package/dist/callpath/swap.d.ts.map +1 -0
- package/dist/chunks/SwapWidget-DgyHAVc8.js +2404 -0
- package/dist/chunks/SwapWidget-DgyHAVc8.js.map +1 -0
- package/dist/chunks/scan-Dhu7f4Nl.js +2497 -0
- package/dist/chunks/scan-Dhu7f4Nl.js.map +1 -0
- package/dist/chunks/useLocker-D1c_NTk-.js +1613 -0
- package/dist/chunks/useLocker-D1c_NTk-.js.map +1 -0
- package/dist/components/LaunchWidget.d.ts +117 -0
- package/dist/components/LaunchWidget.d.ts.map +1 -0
- package/dist/components/LiquidityWidget.d.ts +33 -0
- package/dist/components/LiquidityWidget.d.ts.map +1 -0
- package/dist/components/LockerWidget.d.ts +51 -0
- package/dist/components/LockerWidget.d.ts.map +1 -0
- package/dist/components/LocksWidgets.d.ts +61 -0
- package/dist/components/LocksWidgets.d.ts.map +1 -0
- package/dist/components/SwapWidget.d.ts +165 -0
- package/dist/components/SwapWidget.d.ts.map +1 -0
- package/dist/components/TokenTrustPanel.d.ts +32 -0
- package/dist/components/TokenTrustPanel.d.ts.map +1 -0
- package/dist/components/lockCharts.d.ts +29 -0
- package/dist/components/lockCharts.d.ts.map +1 -0
- package/dist/components/portal.d.ts +10 -0
- package/dist/components/portal.d.ts.map +1 -0
- package/dist/components/primitives.d.ts +139 -0
- package/dist/components/primitives.d.ts.map +1 -0
- package/dist/components/swap/SwapSettings.d.ts +12 -0
- package/dist/components/swap/SwapSettings.d.ts.map +1 -0
- package/dist/components/swap/TokenSelect.d.ts +61 -0
- package/dist/components/swap/TokenSelect.d.ts.map +1 -0
- package/dist/components/swap/state.d.ts +208 -0
- package/dist/components/swap/state.d.ts.map +1 -0
- package/dist/config/chain.d.ts +163 -0
- package/dist/config/chain.d.ts.map +1 -0
- package/dist/config/integrator.d.ts +121 -0
- package/dist/config/integrator.d.ts.map +1 -0
- package/dist/context/WidgetProvider.d.ts +78 -0
- package/dist/context/WidgetProvider.d.ts.map +1 -0
- package/dist/core/clMath.d.ts +98 -0
- package/dist/core/clMath.d.ts.map +1 -0
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/format.d.ts +47 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/liquidityGuards.d.ts +53 -0
- package/dist/core/liquidityGuards.d.ts.map +1 -0
- package/dist/core/liquidityRefresh.d.ts +35 -0
- package/dist/core/liquidityRefresh.d.ts.map +1 -0
- package/dist/core/math.d.ts +129 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/pool.d.ts +33 -0
- package/dist/core/pool.d.ts.map +1 -0
- package/dist/core/tokenLists.d.ts +46 -0
- package/dist/core/tokenLists.d.ts.map +1 -0
- package/dist/embed/iframe.d.ts +185 -0
- package/dist/embed/iframe.d.ts.map +1 -0
- package/dist/embed/lockBadge.d.ts +55 -0
- package/dist/embed/lockBadge.d.ts.map +1 -0
- package/dist/embed/webComponent.d.ts +83 -0
- package/dist/embed/webComponent.d.ts.map +1 -0
- package/dist/embed.d.ts +25 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +543 -0
- package/dist/embed.js.map +1 -0
- package/dist/headless.d.ts +60 -0
- package/dist/headless.d.ts.map +1 -0
- package/dist/headless.js +223 -0
- package/dist/headless.js.map +1 -0
- package/dist/hooks/useAsyncResource.d.ts +38 -0
- package/dist/hooks/useAsyncResource.d.ts.map +1 -0
- package/dist/hooks/useLaunch.d.ts +140 -0
- package/dist/hooks/useLaunch.d.ts.map +1 -0
- package/dist/hooks/useLiquidity.d.ts +91 -0
- package/dist/hooks/useLiquidity.d.ts.map +1 -0
- package/dist/hooks/useLocker.d.ts +77 -0
- package/dist/hooks/useLocker.d.ts.map +1 -0
- package/dist/hooks/useLocks.d.ts +33 -0
- package/dist/hooks/useLocks.d.ts.map +1 -0
- package/dist/hooks/useSwapExecute.d.ts +46 -0
- package/dist/hooks/useSwapExecute.d.ts.map +1 -0
- package/dist/hooks/useSwapQuote.d.ts +51 -0
- package/dist/hooks/useSwapQuote.d.ts.map +1 -0
- package/dist/hooks/useTokenLists.d.ts +26 -0
- package/dist/hooks/useTokenLists.d.ts.map +1 -0
- package/dist/hooks/useTokenTrust.d.ts +40 -0
- package/dist/hooks/useTokenTrust.d.ts.map +1 -0
- package/dist/hooks/useTokens.d.ts +15 -0
- package/dist/hooks/useTokens.d.ts.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1052 -0
- package/dist/index.js.map +1 -0
- package/dist/latch-embed.d.ts +19 -0
- package/dist/latch-embed.d.ts.map +1 -0
- package/dist/latch-embed.js +950 -0
- package/dist/latch-embed.js.map +1 -0
- package/dist/latch-embed.mjs +13162 -0
- package/dist/latch-embed.mjs.map +1 -0
- package/dist/locker/model.d.ts +73 -0
- package/dist/locker/model.d.ts.map +1 -0
- package/dist/locks/embedModel.d.ts +22 -0
- package/dist/locks/embedModel.d.ts.map +1 -0
- package/dist/locks/fetch.d.ts +60 -0
- package/dist/locks/fetch.d.ts.map +1 -0
- package/dist/locks/model.d.ts +143 -0
- package/dist/locks/model.d.ts.map +1 -0
- package/dist/locks/scan.d.ts +25 -0
- package/dist/locks/scan.d.ts.map +1 -0
- package/dist/styles/css.d.ts +32 -0
- package/dist/styles/css.d.ts.map +1 -0
- package/dist/styles.css +895 -0
- package/dist/trust/model.d.ts +48 -0
- package/dist/trust/model.d.ts.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live protocol adapter, backed by viem.
|
|
3
|
+
*
|
|
4
|
+
* This is the implementation that produces **real calldata** and submits real
|
|
5
|
+
* transactions. It is the swap and liquidity call paths from `src/callpath/`
|
|
6
|
+
* wired to a viem `PublicClient` for reads and a wallet for writes.
|
|
7
|
+
*
|
|
8
|
+
* ## What it can and cannot do today
|
|
9
|
+
*
|
|
10
|
+
* Bounded honestly, feature by feature:
|
|
11
|
+
*
|
|
12
|
+
* - **Encoding** is complete and unit-tested. `buildSwap`, `buildAddLiquidity`
|
|
13
|
+
* and `buildRemoveLiquidity` produce the exact calldata the router and
|
|
14
|
+
* position managers decode, integrator fee step included.
|
|
15
|
+
* - **Launches** are read from the launch guards, keyed by pool id: CL pools
|
|
16
|
+
* from `contracts.launchGuardHook`, Bin pools from `contracts.binLaunchGuardHook`.
|
|
17
|
+
* With neither configured every launch read throws
|
|
18
|
+
* `ChainConfigError` rather than guessing an address. On a chain with no
|
|
19
|
+
* `LaunchGuardHook` deployed, that is the correct and only answer.
|
|
20
|
+
* - **Token, balance and allowance reads** are ordinary ERC-20 and Permit2
|
|
21
|
+
* calls and will work against any chain that has them.
|
|
22
|
+
* - **Pool discovery** is not on-chain: the singleton has no pool enumeration.
|
|
23
|
+
* Pass the pools you support, or wire an indexer (`@latchprotocol/sdk/indexer`
|
|
24
|
+
* describes the schema).
|
|
25
|
+
* - **Quoting** requires either a deployed quoter or a host-supplied function.
|
|
26
|
+
* Without one, `quoteSwap` throws {@link UnsupportedOperationError} rather
|
|
27
|
+
* than inventing a number - a fabricated quote is worse than no quote.
|
|
28
|
+
*/
|
|
29
|
+
import { type Address, type Hex, type PublicClient } from "viem";
|
|
30
|
+
import type { ChainConfig } from "../config/chain.js";
|
|
31
|
+
import { type SwapHop } from "../callpath/swap.js";
|
|
32
|
+
import { type AddLiquidityQuote, type AddLiquidityQuoteRequest, type PoolInfo, type PoolState, type PositionInfo, type ProtocolAdapter, type RemoveLiquidityQuote, type SwapQuoteRequest, type SwapQuoteResult, type TokenInfo } from "./protocol.js";
|
|
33
|
+
/** Minimal wallet surface. Any wallet stack that can sign satisfies this. */
|
|
34
|
+
export interface WidgetWallet {
|
|
35
|
+
/** Currently selected account, or `null`. */
|
|
36
|
+
getAccount(): Promise<Address | null>;
|
|
37
|
+
/** Submits a transaction and returns its hash. */
|
|
38
|
+
sendTransaction(request: {
|
|
39
|
+
to: Address;
|
|
40
|
+
data: Hex;
|
|
41
|
+
value: bigint;
|
|
42
|
+
}): Promise<Hex>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Host-supplied functions for the parts the protocol cannot answer on its own.
|
|
46
|
+
*
|
|
47
|
+
* Each one is optional. Omitting a function makes the corresponding widget
|
|
48
|
+
* feature fail loudly with a named error instead of degrading to invented data.
|
|
49
|
+
*/
|
|
50
|
+
export interface ViemAdapterOverrides {
|
|
51
|
+
quoteSwap?: (request: SwapQuoteRequest, pools: readonly PoolInfo[]) => Promise<SwapQuoteResult>;
|
|
52
|
+
quoteAddLiquidity?: (request: AddLiquidityQuoteRequest) => Promise<AddLiquidityQuote>;
|
|
53
|
+
quoteRemoveLiquidity?: (position: PositionInfo, percentBps: number) => Promise<RemoveLiquidityQuote>;
|
|
54
|
+
listPositions?: (owner: Address, pool?: PoolInfo) => Promise<readonly PositionInfo[]>;
|
|
55
|
+
getPoolState?: (pool: PoolInfo) => Promise<PoolState>;
|
|
56
|
+
/** Resolves a route. Defaults to a direct pool match over `pools`. */
|
|
57
|
+
findRoute?: (tokenIn: TokenInfo, tokenOut: TokenInfo, pools: readonly PoolInfo[]) => readonly SwapHop[];
|
|
58
|
+
}
|
|
59
|
+
/** Options for {@link createViemAdapter}. */
|
|
60
|
+
export interface ViemAdapterOptions {
|
|
61
|
+
readonly chain: ChainConfig;
|
|
62
|
+
readonly publicClient: PublicClient;
|
|
63
|
+
readonly wallet?: WidgetWallet;
|
|
64
|
+
/** Tokens offered in the picker. There is no on-chain token registry. */
|
|
65
|
+
readonly tokens: readonly TokenInfo[];
|
|
66
|
+
/**
|
|
67
|
+
* Pools this integrator supports. There is no on-chain pool enumeration.
|
|
68
|
+
*
|
|
69
|
+
* Launch pools live in this list too: a launch is a pool. `listLaunches`
|
|
70
|
+
* selects the ones whose key names `contracts.launchGuardHook`, so there is
|
|
71
|
+
* no separate launch list to keep in sync.
|
|
72
|
+
*/
|
|
73
|
+
readonly pools: readonly PoolInfo[];
|
|
74
|
+
/**
|
|
75
|
+
* The block the position managers were deployed at (or any earlier one).
|
|
76
|
+
*
|
|
77
|
+
* Neither position manager enumerates a holder's positions, so
|
|
78
|
+
* `listPositions` reconstructs them from `Transfer` / `TransferBatch` logs
|
|
79
|
+
* addressed to the owner and confirms each against live state. The scan
|
|
80
|
+
* starts here. Without it `listPositions` throws rather than scanning from
|
|
81
|
+
* genesis, which public endpoints refuse and which would read as "no
|
|
82
|
+
* positions" when it silently returned nothing.
|
|
83
|
+
*/
|
|
84
|
+
readonly positionsFromBlock?: bigint;
|
|
85
|
+
readonly overrides?: ViemAdapterOverrides;
|
|
86
|
+
}
|
|
87
|
+
/** Creates the live, viem-backed adapter. */
|
|
88
|
+
export declare function createViemAdapter(options: ViemAdapterOptions): ProtocolAdapter;
|
|
89
|
+
//# sourceMappingURL=viem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../src/adapters/viem.ts"],"names":[],"mappings":"AACA;;;;;;;;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SAAS,YAAY,EAAE,CAAC,CAAC;IACtF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACtD,sEAAsE;IACtE,SAAS,CAAC,EAAE,CACV,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,SAAS,QAAQ,EAAE,KACvB,SAAS,OAAO,EAAE,CAAC;CACzB;AAED,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAC3C;AA2kCD,6CAA6C;AAC7C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,eAAe,CAE9E"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command, action and sentinel constants for the LatchProtocol call path.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the on-chain libraries and must be kept in step with them:
|
|
5
|
+
*
|
|
6
|
+
* - commands: `packages/router/src/libraries/Commands.sol`
|
|
7
|
+
* - actions: `packages/periphery/src/libraries/Actions.sol`
|
|
8
|
+
* - sentinels:`packages/periphery/src/libraries/ActionConstants.sol`
|
|
9
|
+
*
|
|
10
|
+
* They are transcribed rather than imported because the Solidity is GPL-2.0 and
|
|
11
|
+
* this package is MIT. Constants carry no copyright; the encoding logic here is
|
|
12
|
+
* written against the ABI, not derived from the sources.
|
|
13
|
+
*/
|
|
14
|
+
import type { Address } from "viem";
|
|
15
|
+
/** Universal-router command ids. */
|
|
16
|
+
export declare const COMMANDS: {
|
|
17
|
+
readonly SWEEP: 4;
|
|
18
|
+
readonly TRANSFER: 5;
|
|
19
|
+
/** Pays a bps portion of the router's balance of a token to a recipient. */
|
|
20
|
+
readonly PAY_PORTION: 6;
|
|
21
|
+
readonly WRAP_ETH: 11;
|
|
22
|
+
readonly UNWRAP_WETH: 12;
|
|
23
|
+
/** Runs an encoded periphery action plan inside one vault lock. */
|
|
24
|
+
readonly INFI_SWAP: 16;
|
|
25
|
+
};
|
|
26
|
+
/** Periphery action ids. */
|
|
27
|
+
export declare const ACTIONS: {
|
|
28
|
+
readonly CL_INCREASE_LIQUIDITY: 0;
|
|
29
|
+
readonly CL_DECREASE_LIQUIDITY: 1;
|
|
30
|
+
readonly CL_MINT_POSITION: 2;
|
|
31
|
+
readonly CL_BURN_POSITION: 3;
|
|
32
|
+
readonly CL_SWAP_EXACT_IN_SINGLE: 6;
|
|
33
|
+
readonly CL_SWAP_EXACT_IN: 7;
|
|
34
|
+
readonly CL_SWAP_EXACT_OUT_SINGLE: 8;
|
|
35
|
+
readonly CL_SWAP_EXACT_OUT: 9;
|
|
36
|
+
readonly SETTLE: 11;
|
|
37
|
+
readonly SETTLE_ALL: 12;
|
|
38
|
+
readonly SETTLE_PAIR: 13;
|
|
39
|
+
readonly TAKE: 14;
|
|
40
|
+
readonly TAKE_ALL: 15;
|
|
41
|
+
/** Takes a bps portion of the open credit straight to a recipient. */
|
|
42
|
+
readonly TAKE_PORTION: 16;
|
|
43
|
+
readonly TAKE_PAIR: 17;
|
|
44
|
+
readonly CLOSE_CURRENCY: 18;
|
|
45
|
+
readonly CLEAR_OR_TAKE: 19;
|
|
46
|
+
readonly SWEEP: 20;
|
|
47
|
+
readonly BIN_ADD_LIQUIDITY: 25;
|
|
48
|
+
readonly BIN_REMOVE_LIQUIDITY: 26;
|
|
49
|
+
readonly BIN_SWAP_EXACT_IN_SINGLE: 28;
|
|
50
|
+
readonly BIN_SWAP_EXACT_IN: 29;
|
|
51
|
+
readonly BIN_SWAP_EXACT_OUT_SINGLE: 30;
|
|
52
|
+
readonly BIN_SWAP_EXACT_OUT: 31;
|
|
53
|
+
};
|
|
54
|
+
/** Recipient sentinel: the account that called the router. */
|
|
55
|
+
export declare const MSG_SENDER: Address;
|
|
56
|
+
/** Recipient sentinel: the router contract itself. */
|
|
57
|
+
export declare const ADDRESS_THIS: Address;
|
|
58
|
+
/** Amount sentinel: use the whole open delta for this currency. */
|
|
59
|
+
export declare const OPEN_DELTA = 0n;
|
|
60
|
+
/** Amount sentinel: use the contract's entire balance. */
|
|
61
|
+
export declare const CONTRACT_BALANCE: bigint;
|
|
62
|
+
/** Address used by the router's payment helpers to mean native value. */
|
|
63
|
+
export declare const NATIVE_SENTINEL: Address;
|
|
64
|
+
/** Scale used by liquidity-book distribution weights. */
|
|
65
|
+
export declare const BIN_DISTRIBUTION_SCALE: bigint;
|
|
66
|
+
/** Minimal ABI for `UniversalRouter.execute`. */
|
|
67
|
+
export declare const UNIVERSAL_ROUTER_ABI: readonly [{
|
|
68
|
+
readonly type: "function";
|
|
69
|
+
readonly name: "execute";
|
|
70
|
+
readonly stateMutability: "payable";
|
|
71
|
+
readonly inputs: readonly [{
|
|
72
|
+
readonly name: "commands";
|
|
73
|
+
readonly type: "bytes";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "inputs";
|
|
76
|
+
readonly type: "bytes[]";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "deadline";
|
|
79
|
+
readonly type: "uint256";
|
|
80
|
+
}];
|
|
81
|
+
readonly outputs: readonly [];
|
|
82
|
+
}];
|
|
83
|
+
/** Minimal ABI for the position managers' batched entry point. */
|
|
84
|
+
export declare const POSITION_MANAGER_ABI: readonly [{
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
readonly name: "modifyLiquidities";
|
|
87
|
+
readonly stateMutability: "payable";
|
|
88
|
+
readonly inputs: readonly [{
|
|
89
|
+
readonly name: "unlockData";
|
|
90
|
+
readonly type: "bytes";
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "deadline";
|
|
93
|
+
readonly type: "uint256";
|
|
94
|
+
}];
|
|
95
|
+
readonly outputs: readonly [];
|
|
96
|
+
}];
|
|
97
|
+
/** Minimal ERC-20 surface the widgets need. */
|
|
98
|
+
export declare const ERC20_ABI: readonly [{
|
|
99
|
+
readonly type: "function";
|
|
100
|
+
readonly name: "approve";
|
|
101
|
+
readonly stateMutability: "nonpayable";
|
|
102
|
+
readonly inputs: readonly [{
|
|
103
|
+
readonly name: "spender";
|
|
104
|
+
readonly type: "address";
|
|
105
|
+
}, {
|
|
106
|
+
readonly name: "amount";
|
|
107
|
+
readonly type: "uint256";
|
|
108
|
+
}];
|
|
109
|
+
readonly outputs: readonly [{
|
|
110
|
+
readonly name: "";
|
|
111
|
+
readonly type: "bool";
|
|
112
|
+
}];
|
|
113
|
+
}, {
|
|
114
|
+
readonly type: "function";
|
|
115
|
+
readonly name: "allowance";
|
|
116
|
+
readonly stateMutability: "view";
|
|
117
|
+
readonly inputs: readonly [{
|
|
118
|
+
readonly name: "owner";
|
|
119
|
+
readonly type: "address";
|
|
120
|
+
}, {
|
|
121
|
+
readonly name: "spender";
|
|
122
|
+
readonly type: "address";
|
|
123
|
+
}];
|
|
124
|
+
readonly outputs: readonly [{
|
|
125
|
+
readonly name: "";
|
|
126
|
+
readonly type: "uint256";
|
|
127
|
+
}];
|
|
128
|
+
}, {
|
|
129
|
+
readonly type: "function";
|
|
130
|
+
readonly name: "balanceOf";
|
|
131
|
+
readonly stateMutability: "view";
|
|
132
|
+
readonly inputs: readonly [{
|
|
133
|
+
readonly name: "account";
|
|
134
|
+
readonly type: "address";
|
|
135
|
+
}];
|
|
136
|
+
readonly outputs: readonly [{
|
|
137
|
+
readonly name: "";
|
|
138
|
+
readonly type: "uint256";
|
|
139
|
+
}];
|
|
140
|
+
}, {
|
|
141
|
+
readonly type: "function";
|
|
142
|
+
readonly name: "decimals";
|
|
143
|
+
readonly stateMutability: "view";
|
|
144
|
+
readonly inputs: readonly [];
|
|
145
|
+
readonly outputs: readonly [{
|
|
146
|
+
readonly name: "";
|
|
147
|
+
readonly type: "uint8";
|
|
148
|
+
}];
|
|
149
|
+
}, {
|
|
150
|
+
readonly type: "function";
|
|
151
|
+
readonly name: "symbol";
|
|
152
|
+
readonly stateMutability: "view";
|
|
153
|
+
readonly inputs: readonly [];
|
|
154
|
+
readonly outputs: readonly [{
|
|
155
|
+
readonly name: "";
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
}];
|
|
158
|
+
}, {
|
|
159
|
+
readonly type: "function";
|
|
160
|
+
readonly name: "name";
|
|
161
|
+
readonly stateMutability: "view";
|
|
162
|
+
readonly inputs: readonly [];
|
|
163
|
+
readonly outputs: readonly [{
|
|
164
|
+
readonly name: "";
|
|
165
|
+
readonly type: "string";
|
|
166
|
+
}];
|
|
167
|
+
}];
|
|
168
|
+
/** Permit2's allowance surface, used for the second half of the approval flow. */
|
|
169
|
+
export declare const PERMIT2_ABI: readonly [{
|
|
170
|
+
readonly type: "function";
|
|
171
|
+
readonly name: "allowance";
|
|
172
|
+
readonly stateMutability: "view";
|
|
173
|
+
readonly inputs: readonly [{
|
|
174
|
+
readonly name: "user";
|
|
175
|
+
readonly type: "address";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "token";
|
|
178
|
+
readonly type: "address";
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "spender";
|
|
181
|
+
readonly type: "address";
|
|
182
|
+
}];
|
|
183
|
+
readonly outputs: readonly [{
|
|
184
|
+
readonly name: "amount";
|
|
185
|
+
readonly type: "uint160";
|
|
186
|
+
}, {
|
|
187
|
+
readonly name: "expiration";
|
|
188
|
+
readonly type: "uint48";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "nonce";
|
|
191
|
+
readonly type: "uint48";
|
|
192
|
+
}];
|
|
193
|
+
}, {
|
|
194
|
+
readonly type: "function";
|
|
195
|
+
readonly name: "approve";
|
|
196
|
+
readonly stateMutability: "nonpayable";
|
|
197
|
+
readonly inputs: readonly [{
|
|
198
|
+
readonly name: "token";
|
|
199
|
+
readonly type: "address";
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "spender";
|
|
202
|
+
readonly type: "address";
|
|
203
|
+
}, {
|
|
204
|
+
readonly name: "amount";
|
|
205
|
+
readonly type: "uint160";
|
|
206
|
+
}, {
|
|
207
|
+
readonly name: "expiration";
|
|
208
|
+
readonly type: "uint48";
|
|
209
|
+
}];
|
|
210
|
+
readonly outputs: readonly [];
|
|
211
|
+
}];
|
|
212
|
+
/** Largest value Permit2 will store as an allowance amount. */
|
|
213
|
+
export declare const MAX_UINT160: bigint;
|
|
214
|
+
/** Largest value Permit2 will store as an expiration. */
|
|
215
|
+
export declare const MAX_UINT48: bigint;
|
|
216
|
+
/** Largest ERC-20 allowance. */
|
|
217
|
+
export declare const MAX_UINT256: bigint;
|
|
218
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/callpath/constants.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,oCAAoC;AACpC,eAAO,MAAM,QAAQ;;;IAGnB,4EAA4E;;;;IAI5E,mEAAmE;;CAE3D,CAAC;AAEX,4BAA4B;AAC5B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;IAclB,sEAAsE;;;;;;;;;;;;CAY9D,CAAC;AAEX,8DAA8D;AAC9D,eAAO,MAAM,UAAU,EAAE,OAAsD,CAAC;AAEhF,sDAAsD;AACtD,eAAO,MAAM,YAAY,EAAE,OAAsD,CAAC;AAElF,mEAAmE;AACnE,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,0DAA0D;A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