MCPcopy Create free account
hub / github.com/wevm/viem / assertConfig

Function assertConfig

src/tempo/Multisig.ts:781–804  ·  view source on GitHub ↗

Validates a config against an observed chain commitment.

(options: {
  account: `0x${string}`
  commitment: Hex.Hex
  config: MultisigConfig.Config
})

Source from the content-addressed store, hash-verified

779
780/** Validates a config against an observed chain commitment. */
781function assertConfig(options: {
782 account: `0x${string}`
783 commitment: Hex.Hex
784 config: MultisigConfig.Config
785}) {
786 const { account, commitment, config } = options
787 if (
788 config.version === 0n &&
789 MultisigConfig.getAddress(config, {
790 factory: Addresses.nativeMultisigFactory,
791 }).toLowerCase() !== account.toLowerCase()
792 )
793 throw new RpcResponse.InvalidParamsError({
794 message: 'Initial multisig config does not match the multisig account.',
795 })
796 if (config.version === 0n && Hex.toBigInt(commitment) === 0n) return
797 if (
798 commitment.toLowerCase() !==
799 MultisigConfig.getCommitment(config).toLowerCase()
800 )
801 throw new RpcResponse.InvalidParamsError({
802 message: `Multisig config does not match account ${account}.`,
803 })
804}
805
806/** Reads and validates a config commitment at one block. */
807async function validateConfig(options: {

Callers 1

validateConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected