Skip to content

@futureverse/signer

Common signer interface (signMessage, signTransaction, signExtrinsic) abstracting over EOA / Pass / EthersJS.

Futureverse winddown

Futureverse (the publisher of @futureverse/*) is in winddown. The hosted services this package talked to (auth.futureverse.app, pass-api.futureverse.app, signer.futureverse.app) have been re-hosted by gen3labs at futurepass.gen3labs.tech (issuer) and fpsigner.gen3labs.tech (signer). For new projects, switch to the matching @gen3labs/* package — drop-in surface, default URLs already point at the gen3labs infra. The Asset Register API has no community replacement yet; see the Migration playbook for the per-package map.

Version
1.8.0
Published
2025-05-26
License
n/a
Status
fv-winddown
npm
https://www.npmjs.com/package/@futureverse/signer
Types
./index.d.ts
Maintainers
admin-futureverse, garethdainesnpm, jcsanpedro
Depends on
viem · xrpl · xumm · blakejs · @polkadot/api · @polkadot/util · @polkadot/types · ripple-keypairs · @polkadot/keyring · ripple-binary-codec · @polkadot/util-crypto · @futureverse/signer-core
Recent versions
1.6.0 · 1.6.1 · 1.7.0 · 1.7.1 · 1.6.0-beta.0 · 1.7.0-beta.0 · 1.7.0-beta.1 · 1.8.0
## Technical notes

Why use it

You want one signer abstraction across multiple identity sources — useful inside @futureverse/transact.

When to skip it

You only have one signer and can talk to it directly.

Pairs with

Alternatives

Upstream README

Futureverse Signer

Provides a signer interface with common methods for signing messages, transactions and extrinsics.

Installation

NPM:

bash
    npm install @futureverse/signer --save

Yarn:

bash
    yarn add @futureverse/signer

Usage

Wagmi useFutureverseSigner Hook

The example below shows how to create a hook (useFutureverseSigner) to get the signer interface from wagmi wallet client.

typescript
import { clientToSigner } from '@futureverse/signer';
import { useMemo } from 'react';
import { type Connector, useWalletClient } from 'wagmi';

/** Action to convert a Viem Client to a Futureverse Signer. */
export function useFutureverseSigner({ chainId, connector }: { chainId?: number; connector?: Connector } = {}) {
  const { data: client } = useWalletClient({ chainId, connector });

  return useMemo(() => (client ? clientToSigner(client) : undefined), [client]);
}

Signing a message

typescript
import { useCallback } from 'react';
import { useFutureverseSigner } from './useFutureverseSigner';

function MessageSignerDemo() {
  const { signer } = useFutureverseSigner();

  const signExtrinsic = useCallback(async () => {
    if (!signer) return;
    const message = 'message to sign';
    return await signer.signMessage(message);
  }, [signer]);

  // Your UI code to call signExtrinsic
  return <></>;
}

Signing a Root Network extrinsic

typescript
import { userSession } from '@futureverse/auth';
import { useTrnApi } from '@futureverse/transact-react';
import { useCallback } from 'react';
import { useFutureverseSigner } from './useFutureverseSigner';

function ExtrinsicSignerDemo() {
  const { userSession } = useAuth();
  const { trnApi } = useTrnApi();
  const { signer } = useFutureverseSigner();

  const signExtrinsic = useCallback(async () => {
    if (!signer) return;
    if (!trnApi) return;
    if (!userSession?.eoa) return;
    const collectionId = '<your collection id>';
    const numberOfTokens = 1; // How many tokens to mint
    const address = 'FuturePass or address to mint to';
    const extrinsic = trnApi.tx.nft.mint(collectionId, numberOfTokens, address);
    return await signer.signExtrinsic(trnApi, extrinsic, userSession.eoa);
  }, [signer]);

  // Your UI code to call signExtrinsic
  return <></>;
}

Curated independently by Codeology. Source-attributed reference for The Root Network. Not affiliated with Futureverse / TRN Labs.