@polymeshassociation/signing-manager-types
v3.8.0
Published
Types defining the Polymesh SDK signing manager interface
Readme
Polymesh Signing Manager Types
This defines the types needed to implement a Polymesh SDK signing manager, along with exporting some commonly needed utilities for implementations
A signing manager abstracts the cryptographic signing of transactions so the SDK is indifferent to where and how private keys are stored.
Ethereum signing managers
Polymesh's revive pallet lets an Ethereum key dispatch any runtime call, as the account AccountId32 = <20 byte H160> ++ [0xEE; 12]. A signing manager holding Ethereum keys implements EthSigningManager, which extends SigningManager with a single synchronous getEthSigner() method. The SDK routes on the signing address, so this capability is additive — existing signing managers are unaffected, and a hybrid manager may hold both native and Ethereum keys.
EthTransactionRequest— the Ethereum transaction the SDK builds. Every field is supplied by the SDK, including the gas limit and the chain ID; a signer must not estimate gas, substitute its own values, or sign for whichever chain the provider happens to be connected to. Fields are EIP-1193 wire format (0x-prefixed hex), so a signer built on viem or ethers must convert them, and mapgasto that library's gas limit fieldEthSigner— implementssignTransaction(returns raw signed bytes for the SDK to broadcast — preferred) and/orsendTransaction(the wallet broadcasts and returns the Ethereum transaction hash). At least one is required, and the SDK decides which to use from whichever is present rather than from a flagEthSignerCapabilities— what cannot be derived from the signer's shape. Currently justeip1559, which defaults totrueand is set tofalseby signers that can only encode legacy (type0x0) transactionsisEthSigningManager(manager)— typeguard for consumers routing between the native and Ethereum paths
A user rejecting the request should surface as an error carrying the EIP-1193 code 4001; the SDK maps that to TransactionRejectedByUser. Re-throwing the provider's own error, or preserving its code when wrapping it, is usually enough.
An EthSigningManager still implements the whole SigningManager interface: getAccounts() returns the SS58 encoded 0xEE accounts (not H160 hex), setSs58Format() is honoured when encoding them, and getExternalSigner() returns a PolkadotSigner whose signPayload and signRaw throw — an Ethereum key cannot produce a signature the chain will accept over a SCALE payload.
Implementations
- Browser Private keys are saved in a browser extension
- WalletConnect Formerly WalletConnect adaptor (rebranded to Reown)
- Local Private keys are loaded into memory for backend environments like Node.js
- Hashicorp Vault Private keys are stored in a Vault transit engine
The signing manager API allows for more specialized signers to be implemented. The linked packages are not reccomended for general use and require access to a 3rd party API. Linked for completness, and to provide examples for more advance use cases.
Custom Implementations
- Azure Keys are held in Microsoft Azure
- Fireblocks Keys are held in Fireblocks
- Approval Demonstrates a "cold wallet" type approach
