LeoYeAI/agent-master-skills / skills/auto-respawn
auto-respawn
VerifiedYour agent always comes back. Anchor identity and memory on-chain so any new instance can resurrect from just an address — no local state, no single point of failure. Permanent identity and recovery on the Autonomys Network.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.4 KB |
| _meta.json | config | 281 B |
| auto-respawn.ts | script | 14.4 KB |
| eslint.config.js | script | 468 B |
| lib/address.ts | script | 2.2 KB |
| lib/balance.ts | script | 1.1 KB |
| lib/cli.ts | script | 1.6 KB |
| lib/evm-balance.ts | script | 925 B |
| lib/evm-transfer.ts | script | 2.4 KB |
| lib/evm.ts | script | 3.4 KB |
| lib/memory-chain.ts | script | 3.5 KB |
| lib/network.ts | script | 1.4 KB |
| lib/remark.ts | script | 1.3 KB |
| lib/transfer.ts | script | 1.7 KB |
| lib/wallet.ts | script | 8.8 KB |
| lib/xdm.ts | script | 3.3 KB |
| package.json | manifest | 647 B |
| references/auto-respawn-commands.md | markdown | 9.6 KB |
| references/autonomys-network.md | markdown | 6.2 KB |
| setup.shexecutable | script | 2.2 KB |
| tests/address.test.ts | script | 3.4 KB |
| tests/balance.test.ts | script | 4.3 KB |
| tests/cli.test.ts | script | 3.5 KB |
| tests/evm-balance.test.ts | script | 3.1 KB |
| tests/evm-transfer.test.ts | script | 5.2 KB |
| tests/evm.test.ts | script | 2.4 KB |
| tests/network.test.ts | script | 1.8 KB |
| tests/wallet-roundtrip.test.ts | script | 6.3 KB |
| tests/wallet.test.ts | script | 1.1 KB |
| tsconfig.json | config | 366 B |
lib/evm.ts
View on GitHubimport { ethers } from 'ethers'
import { getNetworkDomainRpcUrls } from '@autonomys/auto-utils'
import type { NetworkId } from './network.js'
/** Auto-EVM domain ID on Autonomys */
export const AUTO_EVM_DOMAIN_ID = 0
/**
* Default MemoryChain contract addresses per network.
* Override with AUTO_RESPAWN_CONTRACT_ADDRESS env var if your deployment differs.
*/
const MEMORY_CHAIN_ADDRESSES: Record<NetworkId, string> = {
mainnet: '0x51DAedAFfFf631820a4650a773096A69cB199A3c',
chronos: '0x5fa47C8F3B519deF692BD9C87179d69a6f4EBf11',
}
export function getMemoryChainAddress(network: NetworkId): string {
return process.env.AUTO_RESPAWN_CONTRACT_ADDRESS || MEMORY_CHAIN_ADDRESSES[network]
}
/**
* MemoryChain contract ABI — matches the OpenClaw MemoryChain contract.
* Source: https://github.com/autojeremy/openclaw-memory-chain
*
* The contract stores CID strings directly (no hashing).
* updateHead(string cid) writes, getHead(address) reads.
*/
export const MEMORY_CHAIN_ABI = [
{
inputs: [{ internalType: 'string', name: 'cid', type: 'string' }],
name: 'updateHead',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'address', name: 'agent', type: 'address' }],
name: 'getHead',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
type: 'function',
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: 'address', name: 'agent', type: 'address' },
{ indexed: false, internalType: 'string', name: 'cid', type: 'string' },
{ indexed: false, internalType: 'uint256', name: 'timestamp', type: 'uint256' },
],
name: 'HeadUpdated',
type: 'event',
},
] as const
/**
* Get the Auto-EVM WebSocket RPC URL for a given network.
*/
export function getEvmRpcUrl(network: NetworkId): string {
const urls = getNetworkDomainRpcUrls({ networkId: network, domainId: String(AUTO_EVM_DOMAIN_ID) })
if (!urls || urls.length === 0) {
throw new Error(`No Auto-EVM RPC URL found for network "${network}"`)
}
return urls[0]
}
/**
* Connect to Auto-EVM and return an ethers provider.
*/
export function connectEvmProvider(network: NetworkId): ethers.WebSocketProvider {
const url = getEvmRpcUrl(network)
return new ethers.WebSocketProvider(url)
}
/**
* Derive an EVM private key + address from a BIP39 mnemonic.
* Uses standard BIP44 derivation path m/44'/60'/0'/0/0 (MetaMask-compatible).
*/
export function deriveEvmKey(mnemonic: string): { privateKey: string; address: string } {
const mnemonicObj = ethers.Mnemonic.fromPhrase(mnemonic)
const hdWallet = ethers.HDNodeWallet.fromMnemonic(mnemonicObj, "m/44'/60'/0'/0/0")
return {
privateKey: hdWallet.privateKey,
address: hdWallet.address,
}
}
/**
* Create an ethers Wallet (signer) from an EVM private key + provider.
*/
export function createEvmSigner(privateKey: string, provider: ethers.Provider): ethers.Wallet {
return new ethers.Wallet(privateKey, provider)
}
/**
* Get a MemoryChain contract instance.
* Pass a signer for write operations (anchor), or a provider for read-only (gethead).
*/
export function getMemoryChainContract(
signerOrProvider: ethers.Wallet | ethers.Provider,
network: NetworkId,
): ethers.Contract {
const address = getMemoryChainAddress(network)
return new ethers.Contract(address, MEMORY_CHAIN_ABI, signerOrProvider)
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |