Struct PolicyRule

Source
pub struct PolicyRule {
Show 29 fields pub operator: Option<String>, pub operators: Option<PolicyRuleOperators>, pub transaction_type: Option<TransactionType>, pub designated_signer: Option<String>, pub designated_signers: Option<PolicyRuleDesignatedSigners>, pub type: Type, pub action: Action, pub asset: String, pub src_type: Option<PolicySrcOrDestType>, pub src_sub_type: Option<PolicySrcOrDestSubType>, pub src_id: Option<String>, pub src: Option<PolicyRuleSrc>, pub dst_type: Option<PolicySrcOrDestType>, pub dst_sub_type: Option<PolicySrcOrDestSubType>, pub dst_id: Option<String>, pub dst: Option<PolicyRuleDst>, pub dst_address_type: Option<DstAddressType>, pub amount_currency: AmountCurrency, pub amount_scope: AmountScope, pub amount: PolicyRuleAmount, pub period_sec: f64, pub authorizers: Option<Vec<String>>, pub authorizers_count: Option<f64>, pub authorization_groups: Option<PolicyRuleAuthorizationGroups>, pub amount_aggregation: Option<PolicyRuleAmountAggregation>, pub raw_message_signing: Option<PolicyRuleRawMessageSigning>, pub apply_for_approve: Option<bool>, pub apply_for_typed_message: Option<bool>, pub external_descriptor: Option<String>,
}
Expand description

PolicyRule : Policy rule which is enforced on transactions

Fields§

§operator: Option<String>

(deprecated - replaced by "operators") | Defines users who can initiate the type of transaction to which the rule applies. options are

  • "*" - All users are allowed * Specific User id
§operators: Option<PolicyRuleOperators>§transaction_type: Option<TransactionType>

Defines the type of transaction to which the rule applies. * TRANSFER

  • Default. Transfers funds from one account to another * CONTRACT_CALL
  • Calls a smart contract, mainly for DeFi operations. * PROGRAM_CALL - Calls a smart contract for web3 operations on the Solana blockchain.
  • APPROVE - Allows a smart contract to withdraw from a designated wallet. * MINT - Perform a mint operation (increase supply) on a supported token * BURN - Perform a burn operation (reduce supply) on a supported token * SUPPLY - Use for DeFi to lend assets * REDEEM - Use for DeFi to get lending back * STAKE - Allows you to allocate and lock certain assets for earning staking rewards. * RAW - An off-chain message with no predefined format, use it to sign any message with your private key. * TYPED_MESSAGE - An off-chain message type that follows a predefined format, used to sign specific messages that are not actual transactions.
§designated_signer: Option<String>

(deprecated - replaced by "designatedSigners") Id representing the user who signs transactions that match a specific rule

§designated_signers: Option<PolicyRuleDesignatedSigners>§type: Type

Policy rule type

§action: Action

Defines what occurs when a transaction meets the rule’s criteria * ALLOW

  • The transaction goes through and can be signed without requiring additional approvals * BLOCK - The transaction is automatically blocked
  • 2-TIER - Only these users or user groups can approve If any of them reject the transaction before the required approval threshold is met, the transaction doesn’t go through The list of entities are set is "authorizationGroups" field
§asset: String

Defines the type of asset being transacted, options are * "*" - All assets * Specific asset

§src_type: Option<PolicySrcOrDestType>

(deprecated - replaced by "src") source account type

§src_sub_type: Option<PolicySrcOrDestSubType>

(deprecated - replaced by "src") source sub account type

§src_id: Option<String>

(deprecated - replaced by "src") source account id

§src: Option<PolicyRuleSrc>§dst_type: Option<PolicySrcOrDestType>

(deprecated - replaced by "dst") destination account type

§dst_sub_type: Option<PolicySrcOrDestSubType>

(deprecated - replaced by "dst") destination sub account type

§dst_id: Option<String>

(deprecated - replaced by "dst") destination account id

§dst: Option<PolicyRuleDst>§dst_address_type: Option<DstAddressType>

Defines whether the destination to which you are sending funds must be whitelisted, to allow one-time transfers to non-whitelisted external addresses, or both. By default, you can only transfer to an external address after it’s whitelisted. * WHITELISTED - Can only be sent to whitelisted addresses. * ONE_TIME - Can only be sent to non-whitelisted external addresses. * "*" - can be sent to whitelisted addresses or non-whitelisted external

§amount_currency: AmountCurrency
  • USD - Limits the amount of any asset users can transfer based on the USD equivalent of the asset. * EUR - Limits the amount of any asset users can transfer based on the EURO equivalent of the asset. * NATIVE
    • Limits the amount of an asset a user can transfer when using a specific asset.
§amount_scope: AmountScope
  • SINGLE_TX - limit applies to a single transaction * TIMEFRAME - limit applies to all transactions within the defined time period
§amount: PolicyRuleAmount§period_sec: f64

Time period in seconds applied by the amountScope field to accumulate transferred amounts in transactions that match the rule, until the total exceeds the value you specify under Minimum. When the specified amount is reached within that period, whether by one or many transactions, further transactions in that period either fail or require more approvals.

§authorizers: Option<Vec<String>>

(deprecated - replaced by "authorizationGroups") Allowed entities which can approves a transaction

§authorizers_count: Option<f64>

(deprecated - replaced by "authorizationGroups") Min amount of entities which are needed to approve a transaction

§authorization_groups: Option<PolicyRuleAuthorizationGroups>§amount_aggregation: Option<PolicyRuleAmountAggregation>§raw_message_signing: Option<PolicyRuleRawMessageSigning>§apply_for_approve: Option<bool>

Applying this rule over APPROVE type transactions (can only be enabled when rule’s transaction type is TRANSFER)

§apply_for_typed_message: Option<bool>

Applying this rule over TYPED_MESSAGE type transactions (can only be enabled when rule’s transaction type is CONTRACT_CALL)

§external_descriptor: Option<String>

A unique id identifying the rule

Implementations§

Source§

impl PolicyRule

Source

pub fn new( type: Type, action: Action, asset: String, amount_currency: AmountCurrency, amount_scope: AmountScope, amount: PolicyRuleAmount, period_sec: f64, ) -> PolicyRule

Policy rule which is enforced on transactions

Trait Implementations§

Source§

impl Clone for PolicyRule

Source§

fn clone(&self) -> PolicyRule

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PolicyRule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PolicyRule

Source§

fn default() -> PolicyRule

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PolicyRule

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PolicyRule

Source§

fn eq(&self, other: &PolicyRule) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PolicyRule

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PolicyRule

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,