Skip to main content

Connect Resource

The connect resource provides methods for managing ERC-4337 smart accounts, passkeys, session keys, UserOperation relay, social recovery, and analytics.

const urblock = new Urblock("sk_test_...");
urblock.connect; // ConnectResource

Account Management

createAccount(params)

Create or retrieve a connect smart account.

const account = await urblock.connect.createAccount({
signer_id: "user_001",
signer_type: 0,
key_data: "0xpublickey...",
salt: "0",
chain_id: 11155111,
});

listAccounts(params?)

List all smart accounts for the tenant.

const accounts = await urblock.connect.listAccounts({ limit: 10 });

getAccount(address, chainId?)

Get a specific account by address.

const account = await urblock.connect.getAccount("0x...", 11155111);

SIWE

verifySiwe(params)

Verify a Sign In With Ethereum message.

const session = await urblock.connect.verifySiwe({
message: siweMessage,
signature: "0x...",
address: "0x...",
});
console.log(session.session_token);

Session Keys

createSessionKey(params)

Create a time-limited session key.

const key = await urblock.connect.createSessionKey({
account_address: "0x...",
key: sessionKeyAddress,
valid_after: now,
valid_until: now + 3600,
allowed_targets: ["0xTokenContract..."],
spend_limit: "1000000000000000000",
chain_id: 11155111,
});

listSessionKeys(address)

const keys = await urblock.connect.listSessionKeys("0x...");

Relay

relay(params)

Relay a signed UserOperation.

const result = await urblock.connect.relay({
user_op: { sender, nonce, init_code, call_data, ... },
chain_id: 11155111,
});

getRelayStatus(userOpHash)

const status = await urblock.connect.getRelayStatus("0x...");

listRelayOps(address)

const ops = await urblock.connect.listRelayOps("0x...");

Passkeys

registerPasskey(params)

Register a WebAuthn credential.

const passkey = await urblock.connect.registerPasskey({
account_address: "0x...",
credential: {
credential_id: "base64...",
public_key: { x: "0x...", y: "0x..." },
algorithm: "ES256",
},
chain_id: 11155111,
});

listPasskeys(address)

const passkeys = await urblock.connect.listPasskeys("0x...");

Pending Operations

listPendingOps()

List operations awaiting client-side signature (connect mode).

const pending = await urblock.connect.listPendingOps();

submitSignedOp(userOpHash, params)

Submit a client-side signature for a pending operation. Optionally include the full user_op and chain_id to forward directly to the bundler.

// Basic — just submit signature (client relays manually)
await urblock.connect.submitSignedOp("0xhash...", {
signature: "0xsig...",
});

// With bundler forwarding — auto-relays to bundler
await urblock.connect.submitSignedOp("0xhash...", {
signature: "0xsig...",
nonce: "0x01",
user_op: { sender, nonce, initCode, callData, ... },
chain_id: 11155111,
});

cancelPendingOp(userOpHash)

await urblock.connect.cancelPendingOp("0xhash...");

Recovery

getRecoveryConfig(address, chainId)

const config = await urblock.connect.getRecoveryConfig("0x...", 11155111);
console.log(config.guardians);
console.log(config.threshold);
console.log(config.active_requests);

configureRecovery(params)

const result = await urblock.connect.configureRecovery({
account_address: "0x...",
chain_id: 11155111,
recovery_action_address: "0xAction...",
guardians: [
{ address: "0xG1...", label: "Phone" },
{ address: "0xG2...", label: "Hardware" },
],
threshold: 2,
timelock_delay: 172800,
});
// Server-side save — result.guardians, result.threshold, result.timelock_delay

initiateRecovery(params)

const result = await urblock.connect.initiateRecovery({
account_address: "0x...",
chain_id: 11155111,
guardian_address: "0xG1...",
new_signer_id: "new_pk",
new_key_data: "0xnewkey...",
});

confirmRecovery(requestId, guardianAddress)

await urblock.connect.confirmRecovery("crr_abc", "0xG2...");

executeRecovery(requestId)

await urblock.connect.executeRecovery("crr_abc");

cancelRecovery(requestId)

await urblock.connect.cancelRecovery("crr_abc");

Migration

Legacy migration helpers are not part of the active SDK surface.

For current integrations, create or recover Connect accounts directly through the account and recovery methods documented above.


Network Config

getNetworkConfig(chainId)

const config = await urblock.connect.getNetworkConfig(11155111);
console.log(config.factory_address);
console.log(config.bundler_url);

Analytics

analyticsOverview(period?)

const stats = await urblock.connect.analyticsOverview("30d");
console.log(stats.total_accounts);
console.log(stats.total_relay_ops);
console.log(stats.recovery.configured);

analyticsTimeseries(period?)

const ts = await urblock.connect.analyticsTimeseries("7d");
ts.accounts_by_day.forEach((d) => console.log(`${d.date}: ${d.count}`));

Supported periods: 7d, 30d, 90d, 1y.