Caip
The CAIP identifiers WalletConnect speaks, and the one place Canton party ids are reconciled with them.
WalletConnect names a chain as namespace:reference (CAIP-2) and an account as namespace:reference:address (CAIP-10). A Canton network id is already CAIP-2 (canton:localnet), so it doubles as the chain id. The friction is the account address: a party id is hint::1220<fingerprint>, and the :: — plus any _ in a hint — falls outside the CAIP-10 address charset ([-.%a-zA-Z0-9]). So a party is percent-encoded into the address segment, and recovered by the inverse. canton is WalletConnect's namespace for Canton (canton:<network-id>, operator-defined), and this percent-encoded account (:: ->%3A%3A) matches its published Canton chain support.
Functions
Recovers a party id from a CAIP-10 address segment.
Percent-encodes a party id into a CAIP-10 address segment: every UTF-8 byte outside [-.A-Za-z0-9] becomes %XX (upper-case), so :: → %3A%3A and _ → %5F. decodeParty is the inverse.
Extracts the party id from a CAIP-10 account. The address segment carries no literal : (they are percent-encoded), so the last : splits chain from address unambiguously.