@aleph-sdk/monorepo
    Preparing search index...

    Function getAccountFromExternalSigner

    • Creates an ETHAccount backed by any async signing function.

      Intended for embedded or smart-wallet signers (e.g. Privy) that are not backed by a standard Web3 provider. The caller supplies:

      • address — the signer's on-chain address (use the smart wallet address)
      • provider — a JSON-RPC provider for balance and chain queries
      • signMessage — the signing function, e.g.: (msg) => smartWalletClient.signMessage({ message: msg.toString() })
      • requestedRpc — optional RPC preset (default: ETH mainnet)

      Parameters

      • address: string
      • provider: JsonRpcProvider
      • signMessage: (message: string | Buffer<ArrayBufferLike>) => Promise<string>
      • requestedRpc: ChangeRpcParam = RpcId.ETH

      Returns ETHAccount

      const account = getAccountFromExternalSigner(
      smartWalletAddress,
      new providers.JsonRpcProvider(rpcUrl),
      (msg) => smartWalletClient.signMessage({ message: msg.toString() }),
      RpcId.ETH,
      )