UNPKG

starknet-devnet

Version:
44 lines (43 loc) 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cheats = void 0; class Cheats { constructor(rpcProvider) { this.rpcProvider = rpcProvider; } /** * Deactivate using `stopImpersonateAccount`. * * https://0xspaceshard.github.io/starknet-devnet/docs/account-impersonation * @param address the address of a locally non-present account that you want to impersonate */ async impersonateAccount(address) { await this.rpcProvider.sendRequest("devnet_impersonateAccount", { account_address: address, }); } /** * https://0xspaceshard.github.io/starknet-devnet/docs/account-impersonation * @param address the address of a locally non-present account that you want to stop impersonating */ async stopImpersonateAccount(address) { await this.rpcProvider.sendRequest("devnet_stopImpersonateAccount", { account_address: address, }); } /** * Enables automatic account impersonation. Every account that does not exist in the local state will be impersonated. Deactivate using `stopAutoImpersonate`. * * https://0xspaceshard.github.io/starknet-devnet/docs/account-impersonation */ async autoImpersonate() { await this.rpcProvider.sendRequest("devnet_autoImpersonate"); } /** * https://0xspaceshard.github.io/starknet-devnet/docs/account-impersonation */ async stopAutoImpersonate() { await this.rpcProvider.sendRequest("devnet_stopAutoImpersonate"); } } exports.Cheats = Cheats;