OZBuilders
public enum OZBuilders
Builder utilities for OpenZeppelin smart account context rules.
Provides type-safe constructors and display utilities for OZContextRuleType
and related OZ-specific operations. These functions are separated from
OZSmartAccountBuilders to avoid a circular dependency between core and OZ
types.
OZBuilders is a caseless enum used as a namespace; it cannot be
instantiated.
-
Creates a default context rule type.
Default rules match any operation.
Declaration
Swift
public static func createDefaultContextType() -> OZContextRuleTypeReturn Value
defaultRulefor default authorization. -
Creates a call-contract context rule type.
Call-contract rules apply only when invoking a specific contract. Useful for restricting signers to specific dApps or operations.
Throws
InvalidAddressif the contract address format is invalid.Declaration
Swift
public static func createCallContractContextType(contractAddress: String) throws -> OZContextRuleTypeParameters
contractAddressContract address this rule applies to (
C…).Return Value
An
callContract(contractAddress:)configured for the supplied contract. -
Creates a create-contract context rule type from a hex-encoded WASM hash.
Create-contract rules apply only when deploying contracts with a specific WASM hash.
Throws
InvalidInputwhen the hex string is not exactly 64 characters after stripping any0xprefix or when it contains non-hex characters.Declaration
Swift
public static func createCreateContractContextType(wasmHashHex: String) throws -> OZContextRuleTypeParameters
wasmHashHexWASM hash as a 64-character hex string (an optional
0xprefix is accepted and stripped).Return Value
An
createContract(wasmHash:)for the supplied hash. -
Creates a create-contract context rule type from raw WASM hash bytes.
Create-contract rules apply only when deploying contracts with a specific WASM hash.
Declaration
Swift
public static func createCreateContractContextType(wasmHash: Data) throws -> OZContextRuleTypeParameters
wasmHash32-byte WASM hash.
Return Value
An
createContract(wasmHash:)for the supplied hash. -
Creates a create-contract context rule type for deployments from a CAP-0085 executable reference.
The rule applies only when deploying contracts from the WASM hash that the
ownercontract stores undertag. The hash is resolved at deployment time, so the rule trusts the owner contract to keep the reference pointing at acceptable code. An account build without this rule kind, such as stellar-accounts 0.7, rejects it during simulation.Example:
let contextType = try OZBuilders.createCreateContractExternalRefContextType( owner: "CDEF5678...", tag: "account-v1" )Declaration
Swift
public static func createCreateContractExternalRefContextType( owner: String, tag: String ) throws -> OZContextRuleTypeParameters
ownerContract address (
C…) that stores the executable reference.tagThe tag the reference is stored under.
Return Value
An
createContractExternalRef(owner:tag:)for the supplied owner and tag.
-
Collects unique signers across a list of parsed context rules.
Iterates through the supplied rules, gathers each rule’s signers, and returns a deduplicated list preserving the first occurrence of each signer. Deduplication uses
uniqueKeyand shares the implementation withcollectUniqueSigners(signers:).Declaration
Swift
public static func collectUniqueSignersFromRules( rules: [OZParsedContextRule] ) -> [any OZSmartAccountSigner]Parameters
rulesThe parsed context rules to scan.
Return Value
Unique signers across all rules, in first-occurrence order.
View on GitHub
Install in Dash