@uniswap/smart-wallet-sdk
Version:
⚒️ An SDK for building applications with smart wallets on Uniswap
95 lines • 4.44 kB
JavaScript
import { ChainId } from '@uniswap/sdk-core';
// https://eips.ethereum.org/EIPS/eip-7702
export const DELEGATION_MAGIC_PREFIX = '0xef0100';
/**
* The target address for self-calls is address(0)
*/
export const SELF_CALL_TARGET = "0x0000000000000000000000000000000000000000";
/**
* Call types for smart wallet calls
* Follows ERC-7579
*/
export var ModeType;
(function (ModeType) {
ModeType["BATCHED_CALL"] = "0x0100000000000000000000000000000000000000000000000000000000000000";
ModeType["BATCHED_CALL_CAN_REVERT"] = "0x0101000000000000000000000000000000000000000000000000000000000000";
})(ModeType || (ModeType = {}));
/**
* Supported chain ids
*/
export var SupportedChainIds;
(function (SupportedChainIds) {
SupportedChainIds[SupportedChainIds["MAINNET"] = 1] = "MAINNET";
SupportedChainIds[SupportedChainIds["UNICHAIN"] = 130] = "UNICHAIN";
SupportedChainIds[SupportedChainIds["UNICHAIN_SEPOLIA"] = 1301] = "UNICHAIN_SEPOLIA";
SupportedChainIds[SupportedChainIds["SEPOLIA"] = 11155111] = "SEPOLIA";
SupportedChainIds[SupportedChainIds["BASE"] = 8453] = "BASE";
SupportedChainIds[SupportedChainIds["OPTIMISM"] = 10] = "OPTIMISM";
SupportedChainIds[SupportedChainIds["BNB"] = 56] = "BNB";
})(SupportedChainIds || (SupportedChainIds = {}));
/**
* Supported smart wallet versions
* @dev keyed by github release tag
*/
export var SmartWalletVersion;
(function (SmartWalletVersion) {
SmartWalletVersion["LATEST"] = "latest";
SmartWalletVersion["v1_0_0"] = "v1.0.0";
SmartWalletVersion["v1_0_0_staging"] = "v1.0.0-staging";
})(SmartWalletVersion || (SmartWalletVersion = {}));
/**
* Smart wallet versions for supported chains
*/
export const SMART_WALLET_VERSIONS = {
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
},
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
},
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
},
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
},
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
},
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
},
[]: {
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x000000009B1D0aF20D8C6d0A44e162d11F9b8f00',
[]: '0x3cbad1e3b9049ecdb9588fb48dd61d80faf41bd5',
}
};
/**
* Mapping of chainId to Smart Wallet contract addresses
* @dev Used to get the latest version of the smart wallet
* See README for detailed deployment addresses along with the commit hash
*/
export const SMART_WALLET_ADDRESSES = Object.fromEntries(Object.entries(SMART_WALLET_VERSIONS).map(([chainId, versions]) => [
chainId,
versions[SmartWalletVersion.LATEST]
]));
/**
* Get all historical smart wallet versions for a given chain id
*/
export const getAllSmartWalletVersions = (chainId) => {
return Object.values(SMART_WALLET_VERSIONS[chainId]);
};
//# sourceMappingURL=constants.js.map