@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
47 lines (46 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.phantomWalletConfig = exports.USERNAME = exports.DEFAULT_SEED_PHRASE = exports.DEFAULT_PASSWORD = void 0;
const chains_1 = require("wagmi/chains");
const configBuilder_1 = require("../../../../src/configBuilder");
const Phantom_1 = require("../../../../src/wallets/Phantom");
exports.DEFAULT_PASSWORD = "COMPLEXPASSWORD1";
exports.DEFAULT_SEED_PHRASE = process.env.E2E_TEST_SEED_PHRASE;
exports.USERNAME = "OTKTESTUSERNAME";
// Configure the test with Phantom setup
const baseConfig = (0, configBuilder_1.configure)()
.withLocalNode({
chainId: chains_1.baseSepolia.id,
forkUrl: process.env.E2E_TEST_FORK_URL,
forkBlockNumber: BigInt(process.env.E2E_TEST_FORK_BLOCK_NUMBER ?? "0"),
hardfork: "cancun",
})
.withPhantom()
.withSeedPhrase({
seedPhrase: exports.DEFAULT_SEED_PHRASE ?? "",
password: exports.DEFAULT_PASSWORD,
username: exports.USERNAME,
})
// .withPrivateKey({
// privateKey: process.env.E2E_TEST_PRIVATE_KEY ?? "",
// password: DEFAULT_PASSWORD,
// chain: "base",
// name: "OTKTESTWALLET",
// })
.withCustomSetup(async (wallet) => {
// Small delay to ensure the main popup is fully ready after private key import
await new Promise(resolve => setTimeout(resolve, 2000));
// Enable test mode to support testnets like Base Sepolia
await wallet.handleAction(Phantom_1.PhantomSpecificActionType.ENABLE_TEST_MODE);
})
// Add the network with the actual port in a custom setup
.withNetwork({
name: "Base Sepolia",
chainId: chains_1.baseSepolia.id,
symbol: "ETH",
// placeholder for the actual rpcUrl, which is auto injected by the node fixture
rpcUrl: "http://localhost:8545",
});
// Build the config
const config = baseConfig.build();
exports.phantomWalletConfig = config;