Official TypeScript/JavaScript SDK for REKT (Rescue EVM Kit Tool).
A comprehensive Web3 defensive security toolkit engineered for compromised account asset recovery, sponsored gas relaying, allowance revocation, permit protection, and EIP-7702 delegation neutralization.
npm install @rekt-protocol/sdk viem
# or
pnpm add @rekt-protocol/sdk viem
# or
yarn add @rekt-protocol/sdk viemProvide the target chainId and one or more RPC endpoints. When multiple RPCs are passed, the SDK automatically random-picks across nodes for load balancing and fails over to the next healthy RPC if an error or timeout occurs:
import { RektClient } from '@rekt-protocol/sdk';
// Initialize with chainId and multiple RPCs (random pick + auto failover on error)
const rekt = await RektClient.create({
chainId: 8453, // e.g. 1 for Ethereum, 8453 for Base, 56 for BSC, etc.
rpcUrls: [
'https://mainnet.base.org',
'https://base.drpc.org',
// 'https://base-mainnet.g.alchemy.com/v2/YOUR_KEY',
],
});
// Or synchronous constructor instantiation
const rektSync = new RektClient({
chainId: 8453,
rpcUrl: 'https://mainnet.base.org',
});// Check if REKT protocol contract is deployed & supported on current chain
const isSupported = await rekt.isSupported(); // returns boolean (true / false)
if (!isSupported) {
console.error(`Contract is not deployed on chain ${rekt.chainId}`);
}
// Inspect EIP-7702 delegation status on an account
const delegationStatus = await rekt.eip7702.inspectDelegation('0x1234...5678');
if (delegationStatus.hasDelegation) {
console.warn('Active delegation detected:', delegationStatus.delegatedTarget);
}
// Inspect token Permit (EIP-2612 / Permit2) signature state and nonce
const permitState = await rekt.permits.inspectPermit(
'0xTokenContractAddress...',
'0xCompromisedAccountAddress...'
);
console.log(`Standard: ${permitState.standard} | Nonce: ${permitState.currentNonce}`);Comprehensive end-to-end integration scripts are provided in both TypeScript (examples/typescript/) and JavaScript (examples/javascript/):
| Feature Demo | TypeScript (.ts) |
JavaScript (.js) |
Description |
|---|---|---|---|
| Token Rescue | rescue-tokens-demo.ts |
rescue-tokens-demo.js |
Sponsored ERC-20 asset recovery without requiring native gas |
| NFT Rescue (Hybrid Auto-Detect) | rescue-nfts-demo.ts |
rescue-nfts-demo.js |
Sponsored ERC-721 & ERC-1155 NFT recovery with EIP-165 auto-detection |
| Claim & Rescue | claim-rescue-demo.ts |
claim-rescue-demo.js |
Atomic airdrop claim and asset rescue in a single transaction |
| Allowance Revoke | approval-revoke-demo.ts |
approval-revoke-demo.js |
Identification and batch revocation of token allowances |
| Permit Inspection | permit-inspection-demo.ts |
permit-inspection-demo.js |
EIP-2612 & Uniswap Permit2 nonce and signature verification |
| EIP-7702 Audit & Remediate | eip7702-demo.ts |
eip7702-demo.js |
EIP-7702 malicious delegation auditing and neutralization |
The SDK provides an intelligent, unified NFT rescue method that eliminates guesswork:
- EIP-165 Auto-Detection: Automatically queries
supportsInterfaceon-chain to determine whether the collection is ERC-721 (0x80ac58cd) or ERC-1155 (0xd9b67a26). - Auto-Balance Fetching: For ERC-1155 tokens, if
amountsis omitted, the SDK automatically inspectsbalanceOf(compromisedAddress, id)on-chain so the victim's entire balance is secured. - Manual Override & Explicit Sub-Methods: Developers can optionally enforce
standard: 'erc721' | 'erc1155', or callexecuteRescueERC721/executeRescueERC1155directly.
// Unified call with smart auto-detection:
const txHash = await rekt.rescue.executeRescueNfts({
compromisedPrivateKey: '0x...',
sponsorPrivateKey: '0x...',
safeReceiver: '0xSafeReceiverAddress...',
tokens: ['0xNftContractAddress...'],
tokenIds: [42n],
// standard: 'auto', // default: auto-detected via EIP-165
// amounts: [1n], // for ERC-1155: auto-reads balanceOf if omitted
});When an on-chain transaction or simulation reverts (e.g. an airdrop is already claimed, deadline has passed, or signature is invalid), standard Viem errors return generic Execution reverted for an unknown reason.
The REKT SDK automatically simulates the call against protocol ABI to extract custom errors and throws an informative RektExecutionError:
import { RektExecutionError } from '@rekt-protocol/sdk';
try {
await rekt.rescue.executeClaimRescue({ ... });
} catch (err) {
if (err instanceof RektExecutionError) {
console.error('Revert Name:', err.revertName); // e.g. 'ClaimFailed'
console.error('Explanation:', err.friendlyMessage);
}
}- Zero-Gas Requirement: Compromised accounts never require native gas funding, eliminating the risk of gas theft by hostile drainer bots.
- Cryptographic Authorization: All actions are validated on-chain through EIP-712 structured typed data signatures.
- Deterministic Execution: Protocol contracts ensure that asset transfer, fee routing, and safety guarantees execute atomically within the same transaction.
Distributed under the MIT License. See LICENSE for details.
Copyright © 2026 REKT Protocol. All rights reserved.