@etherspot/remote-signer
Version:
Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler
312 lines (307 loc) • 8.42 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/sdk/network/utils/prepare-network-name.ts
var prepare_network_name_exports = {};
__export(prepare_network_name_exports, {
prepareNetworkName: () => prepareNetworkName
});
module.exports = __toCommonJS(prepare_network_name_exports);
// node_modules/viem/_esm/utils/chain/defineChain.js
function defineChain(chain) {
return {
formatters: void 0,
fees: void 0,
serializers: void 0,
...chain
};
}
// src/sdk/network/ViemChainConfig.ts
var sourceId = 1;
var optimism = /* @__PURE__ */ defineChain({
id: 10,
name: "OP Mainnet",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: {
http: ["https://mainnet.optimism.io"]
}
},
blockExplorers: {
default: {
name: "Optimism Explorer",
url: "https://optimistic.etherscan.io",
apiUrl: "https://api-optimistic.etherscan.io/api"
}
},
contracts: {
disputeGameFactory: {
[sourceId]: {
address: "0xe5965Ab5962eDc7477C8520243A95517CD252fA9"
}
},
l2OutputOracle: {
[sourceId]: {
address: "0xdfe97868233d1aa22e815a266982f2cf17685a27"
}
},
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
blockCreated: 4286263
},
portal: {
[sourceId]: {
address: "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"
}
},
l1StandardBridge: {
[sourceId]: {
address: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"
}
}
},
sourceId
});
var base = /* @__PURE__ */ defineChain({
id: 8453,
name: "Base",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: {
http: ["https://mainnet.base.org"]
}
},
blockExplorers: {
default: {
name: "Basescan",
url: "https://basescan.org",
apiUrl: "https://api.basescan.org/api"
}
},
contracts: {
l2OutputOracle: {
[sourceId]: {
address: "0x56315b90c40730925ec5485cf004d835058518A0"
}
},
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
blockCreated: 5022
},
portal: {
[sourceId]: {
address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
blockCreated: 17482143
}
},
l1StandardBridge: {
[sourceId]: {
address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
blockCreated: 17482143
}
}
},
sourceId
});
var ancient8 = /* @__PURE__ */ defineChain({
id: 888888888,
name: "Ancient8",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: {
http: ["https://rpc.ancient8.gg"]
}
},
blockExplorers: {
default: {
name: "Ancient8 explorer",
url: "https://scan.ancient8.gg",
apiUrl: "https://scan.ancient8.gg/api"
}
},
contracts: {
l2OutputOracle: {
[sourceId]: {
address: "0xB09DC08428C8b4EFB4ff9C0827386CDF34277996"
}
},
portal: {
[sourceId]: {
address: "0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68",
blockCreated: 19070571
}
},
l1StandardBridge: {
[sourceId]: {
address: "0xd5e3eDf5b68135D559D572E26bF863FBC1950033",
blockCreated: 19070571
}
}
},
sourceId
});
sourceId = 11155111;
var optimismSepolia = /* @__PURE__ */ defineChain({
id: 11155420,
name: "OP Sepolia",
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: {
http: ["https://sepolia.optimism.io"]
}
},
blockExplorers: {
default: {
name: "Blockscout",
url: "https://optimism-sepolia.blockscout.com",
apiUrl: "https://optimism-sepolia.blockscout.com/api"
}
},
contracts: {
disputeGameFactory: {
[sourceId]: {
address: "0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"
}
},
l2OutputOracle: {
[sourceId]: {
address: "0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"
}
},
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
blockCreated: 1620204
},
portal: {
[sourceId]: {
address: "0x16Fc5058F25648194471939df75CF27A2fdC48BC"
}
},
l1StandardBridge: {
[sourceId]: {
address: "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"
}
}
},
testnet: true,
sourceId
});
var ancient8Sepolia = /* @__PURE__ */ defineChain({
id: 28122024,
name: "Ancient8 Testnet",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: {
http: ["https://rpcv2-testnet.ancient8.gg"]
}
},
blockExplorers: {
default: {
name: "Ancient8 Celestia Testnet explorer",
url: "https://scanv2-testnet.ancient8.gg",
apiUrl: "https://scanv2-testnet.ancient8.gg/api"
}
},
contracts: {
l2OutputOracle: {
[sourceId]: {
address: "0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB"
}
},
portal: {
[sourceId]: {
address: "0xfa1d9E26A6aCD7b22115D27572c1221B9803c960",
blockCreated: 4972908
}
},
l1StandardBridge: {
[sourceId]: {
address: "0xF6Bc0146d3c74D48306e79Ae134A260E418C9335",
blockCreated: 4972908
}
}
},
sourceId
});
// src/sdk/network/constants.ts
var NETWORK_NAME_TO_CHAIN_ID = {
["baseSepolia" /* BaseSepolia */]: 84532,
["sepolia" /* Sepolia */]: 11155111,
["optimism" /* Optimism */]: 10,
["polygon" /* Polygon */]: 137,
["arbitrum" /* Arbitrum */]: 42161,
["arbitrumSepolia" /* ArbitrumSepolia */]: 421614,
["chiado" /* Chiado */]: 10200,
["fuse" /* Fuse */]: 122,
["fuseSparknet" /* FuseSparknet */]: 123,
["gnosis" /* Gnosis */]: 100,
["kromaTestnet" /* KromaTestnet */]: 2357,
["mainnet" /* Mainnet */]: 1,
["optimismSepolia" /* OptimismSepolia */]: 11155420,
["rootstock" /* Rootstock */]: 30,
["rootstockTestnet" /* RootstockTestnet */]: 31,
["Mantle" /* Mantle */]: 5e3,
["MantleSepolia" /* MantleSepolia */]: 5003,
["avalanche" /* Avalanche */]: 43114,
["base" /* Base */]: 8453,
["bsc" /* Bsc */]: 56,
["bscTestnet" /* BscTestnet */]: 97,
["fuji" /* Fuji */]: 43113,
["linea" /* Linea */]: 59144,
["lineaTestnet" /* LineaTestnet */]: 59140,
["flareTestnet" /* FlareTestnet */]: 114,
["flare" /* Flare */]: 14,
["scrollSepolia" /* ScrollSepolia */]: 534351,
["scroll" /* Scroll */]: 534352,
["ancient8Testnet" /* Ancient8Testnet */]: 28122024,
["ancient8" /* Ancient8 */]: 888888888,
["amoy" /* Amoy */]: 80002,
["xdcTestnet" /* XDCTestnet */]: 51,
["xdcMainnet" /* XDCMainnet */]: 50
};
var CHAIN_ID_TO_NETWORK_NAME = Object.entries(
NETWORK_NAME_TO_CHAIN_ID
).reduce(
(result, [networkName, chainId]) => ({
...result,
[chainId]: networkName
}),
{}
);
// src/sdk/network/utils/prepare-network-name.ts
function prepareNetworkName(networkNameOrChainId) {
let result = null;
if (networkNameOrChainId) {
if (typeof networkNameOrChainId === "string") {
if (networkNameOrChainId.startsWith("0x")) {
networkNameOrChainId = parseInt(networkNameOrChainId.slice(2), 16) || 0;
} else {
const chainId = NETWORK_NAME_TO_CHAIN_ID[networkNameOrChainId];
networkNameOrChainId = chainId ? chainId : parseInt(networkNameOrChainId, 10) || 0;
}
}
if (typeof networkNameOrChainId === "number") {
result = CHAIN_ID_TO_NETWORK_NAME[networkNameOrChainId] || null;
}
}
return result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
prepareNetworkName
});
//# sourceMappingURL=prepare-network-name.js.map