@uniswap/smart-wallet-sdk
Version:
⚒️ An SDK for building applications with smart wallets on Uniswap
99 lines • 4.87 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllSmartWalletVersions = exports.SMART_WALLET_ADDRESSES = exports.SMART_WALLET_VERSIONS = exports.SmartWalletVersion = exports.SupportedChainIds = exports.ModeType = exports.SELF_CALL_TARGET = exports.DELEGATION_MAGIC_PREFIX = void 0;
const sdk_core_1 = require("@uniswap/sdk-core");
// https://eips.ethereum.org/EIPS/eip-7702
exports.DELEGATION_MAGIC_PREFIX = '0xef0100';
/**
* The target address for self-calls is address(0)
*/
exports.SELF_CALL_TARGET = "0x0000000000000000000000000000000000000000";
/**
* Call types for smart wallet calls
* Follows ERC-7579
*/
var ModeType;
(function (ModeType) {
ModeType["BATCHED_CALL"] = "0x0100000000000000000000000000000000000000000000000000000000000000";
ModeType["BATCHED_CALL_CAN_REVERT"] = "0x0101000000000000000000000000000000000000000000000000000000000000";
})(ModeType || (exports.ModeType = ModeType = {}));
/**
* Supported chain ids
*/
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 || (exports.SupportedChainIds = SupportedChainIds = {}));
/**
* Supported smart wallet versions
* @dev keyed by github release tag
*/
var SmartWalletVersion;
(function (SmartWalletVersion) {
SmartWalletVersion["LATEST"] = "latest";
SmartWalletVersion["v1_0_0"] = "v1.0.0";
SmartWalletVersion["v1_0_0_staging"] = "v1.0.0-staging";
})(SmartWalletVersion || (exports.SmartWalletVersion = SmartWalletVersion = {}));
/**
* Smart wallet versions for supported chains
*/
exports.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
*/
exports.SMART_WALLET_ADDRESSES = Object.fromEntries(Object.entries(exports.SMART_WALLET_VERSIONS).map(([chainId, versions]) => [
chainId,
versions[SmartWalletVersion.LATEST]
]));
/**
* Get all historical smart wallet versions for a given chain id
*/
const getAllSmartWalletVersions = (chainId) => {
return Object.values(exports.SMART_WALLET_VERSIONS[chainId]);
};
exports.getAllSmartWalletVersions = getAllSmartWalletVersions;
//# sourceMappingURL=constants.js.map