• Creates a Viem transaction serializer which encrypts transactions prior to them being signed. This is compatible with both local wallet clients and injected wallets.

    Example

    import { defineChain } from 'viem';
    import { createSapphireSerializer } from '@oasisprotocol/sapphire-viem-v2';

    defineChain({
    serializers: {
    transaction: createSapphireSerializer(publicClient)
    },
    ...
    });

    Type Parameters

    • C extends Client
    • S extends SerializeTransactionFn

    Parameters

    • client: C

      Provides upstream access to Sapphire JSON-RPC via .request

    • Optional originalSerializer: S

      Optional serializer to wrap, otherwise will use default

    Returns Promise<S>

    Sapphire wrapped transaction encryption serializer