Canton dAppBooster
    Preparing search index...
    • Tells a local party from an external one when asked. Each readPartyType call is one ledgerApi read of the participant id, its namespace compared with the party's; nothing is cached, so hold the answer where several components need it. Reach for it before an action a local party cannot take, such as signMessage, which the reference gateway refuses.

      Returns UsePartyTypeResult

      with no CantonConnectProvider above it, and from readPartyType where nothing is connected, the wallet is locked or no party is reported, which isReady is there to check first. It throws too when the ledger's answer carries no usable participant id, and on a refused read, always as an Error: see toError.

      const { readPartyType, isReady } = usePartyType()

      if (!isReady) return <p>Connect and unlock the wallet first.</p>

      if ((await readPartyType()) === 'local') {
      toast.error('This wallet cannot sign messages for a local party')
      }