1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
// Fireblocks API
//
// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain. - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
//
// The version of the OpenAPI document: 1.8.0
// Contact: developers@fireblocks.com
// Generated by: https://openapi-generator.tech
use {
crate::models,
serde::{Deserialize, Serialize},
};
/// PolicyRule : Policy rule which is enforced on transactions
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PolicyRule {
/// (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
#[serde(rename = "operator", skip_serializing_if = "Option::is_none")]
pub operator: Option<String>,
#[serde(rename = "operators", skip_serializing_if = "Option::is_none")]
pub operators: Option<models::PolicyRuleOperators>,
/// 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.
#[serde(rename = "transactionType", skip_serializing_if = "Option::is_none")]
pub transaction_type: Option<TransactionType>,
/// (deprecated - replaced by \"designatedSigners\") Id representing the
/// user who signs transactions that match a specific rule
#[serde(rename = "designatedSigner", skip_serializing_if = "Option::is_none")]
pub designated_signer: Option<String>,
#[serde(rename = "designatedSigners", skip_serializing_if = "Option::is_none")]
pub designated_signers: Option<models::PolicyRuleDesignatedSigners>,
/// Policy rule type
#[serde(rename = "type")]
pub r#type: Type,
/// 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
#[serde(rename = "action")]
pub action: Action,
/// Defines the type of asset being transacted, options are * \"*\" - All
/// assets * Specific asset
#[serde(rename = "asset")]
pub asset: String,
/// (deprecated - replaced by \"src\") source account type
#[serde(rename = "srcType", skip_serializing_if = "Option::is_none")]
pub src_type: Option<models::PolicySrcOrDestType>,
/// (deprecated - replaced by \"src\") source sub account type
#[serde(rename = "srcSubType", skip_serializing_if = "Option::is_none")]
pub src_sub_type: Option<models::PolicySrcOrDestSubType>,
/// (deprecated - replaced by \"src\") source account id
#[serde(rename = "srcId", skip_serializing_if = "Option::is_none")]
pub src_id: Option<String>,
#[serde(rename = "src", skip_serializing_if = "Option::is_none")]
pub src: Option<models::PolicyRuleSrc>,
/// (deprecated - replaced by \"dst\") destination account type
#[serde(rename = "dstType", skip_serializing_if = "Option::is_none")]
pub dst_type: Option<models::PolicySrcOrDestType>,
/// (deprecated - replaced by \"dst\") destination sub account type
#[serde(rename = "dstSubType", skip_serializing_if = "Option::is_none")]
pub dst_sub_type: Option<models::PolicySrcOrDestSubType>,
/// (deprecated - replaced by \"dst\") destination account id
#[serde(rename = "dstId", skip_serializing_if = "Option::is_none")]
pub dst_id: Option<String>,
#[serde(rename = "dst", skip_serializing_if = "Option::is_none")]
pub dst: Option<models::PolicyRuleDst>,
/// 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
#[serde(rename = "dstAddressType", skip_serializing_if = "Option::is_none")]
pub dst_address_type: Option<DstAddressType>,
/// * 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.
#[serde(rename = "amountCurrency")]
pub amount_currency: AmountCurrency,
/// * SINGLE_TX - limit applies to a single transaction * TIMEFRAME - limit
/// applies to all transactions within the defined time period
#[serde(rename = "amountScope")]
pub amount_scope: AmountScope,
#[serde(rename = "amount")]
pub amount: models::PolicyRuleAmount,
/// 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.
#[serde(rename = "periodSec")]
pub period_sec: f64,
/// (deprecated - replaced by \"authorizationGroups\") Allowed entities
/// which can approves a transaction
#[serde(rename = "authorizers", skip_serializing_if = "Option::is_none")]
pub authorizers: Option<Vec<String>>,
/// (deprecated - replaced by \"authorizationGroups\") Min amount of
/// entities which are needed to approve a transaction
#[serde(rename = "authorizersCount", skip_serializing_if = "Option::is_none")]
pub authorizers_count: Option<f64>,
#[serde(
rename = "authorizationGroups",
skip_serializing_if = "Option::is_none"
)]
pub authorization_groups: Option<models::PolicyRuleAuthorizationGroups>,
#[serde(rename = "amountAggregation", skip_serializing_if = "Option::is_none")]
pub amount_aggregation: Option<models::PolicyRuleAmountAggregation>,
#[serde(rename = "rawMessageSigning", skip_serializing_if = "Option::is_none")]
pub raw_message_signing: Option<models::PolicyRuleRawMessageSigning>,
/// Applying this rule over APPROVE type transactions (can only be enabled
/// when rule's transaction type is TRANSFER)
#[serde(rename = "applyForApprove", skip_serializing_if = "Option::is_none")]
pub apply_for_approve: Option<bool>,
/// Applying this rule over TYPED_MESSAGE type transactions (can only be
/// enabled when rule's transaction type is CONTRACT_CALL)
#[serde(
rename = "applyForTypedMessage",
skip_serializing_if = "Option::is_none"
)]
pub apply_for_typed_message: Option<bool>,
/// A unique id identifying the rule
#[serde(rename = "externalDescriptor", skip_serializing_if = "Option::is_none")]
pub external_descriptor: Option<String>,
}
impl PolicyRule {
/// Policy rule which is enforced on transactions
pub fn new(
r#type: Type,
action: Action,
asset: String,
amount_currency: AmountCurrency,
amount_scope: AmountScope,
amount: models::PolicyRuleAmount,
period_sec: f64,
) -> PolicyRule {
PolicyRule {
operator: None,
operators: None,
transaction_type: None,
designated_signer: None,
designated_signers: None,
r#type,
action,
asset,
src_type: None,
src_sub_type: None,
src_id: None,
src: None,
dst_type: None,
dst_sub_type: None,
dst_id: None,
dst: None,
dst_address_type: None,
amount_currency,
amount_scope,
amount,
period_sec,
authorizers: None,
authorizers_count: None,
authorization_groups: None,
amount_aggregation: None,
raw_message_signing: None,
apply_for_approve: None,
apply_for_typed_message: None,
external_descriptor: None,
}
}
}
/// 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.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TransactionType {
#[serde(rename = "TRANSFER")]
Transfer,
#[serde(rename = "CONTRACT_CALL")]
ContractCall,
#[serde(rename = "PROGRAM_CALL")]
ProgramCall,
#[serde(rename = "APPROVE")]
Approve,
#[serde(rename = "MINT")]
Mint,
#[serde(rename = "BURN")]
Burn,
#[serde(rename = "SUPPLY")]
Supply,
#[serde(rename = "REDEEM")]
Redeem,
#[serde(rename = "STAKE")]
Stake,
#[serde(rename = "RAW")]
Raw,
#[serde(rename = "TYPED_MESSAGE")]
TypedMessage,
}
impl Default for TransactionType {
fn default() -> TransactionType {
Self::Transfer
}
}
/// Policy rule type
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "TRANSFER")]
Transfer,
}
impl Default for Type {
fn default() -> Type {
Self::Transfer
}
}
/// 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
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Action {
#[serde(rename = "ALLOW")]
Allow,
#[serde(rename = "BLOCK")]
Block,
#[serde(rename = "2-TIER")]
Variant2Tier,
}
impl Default for Action {
fn default() -> Action {
Self::Allow
}
}
/// 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
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DstAddressType {
#[serde(rename = "WHITELISTED")]
Whitelisted,
#[serde(rename = "ONE_TIME")]
OneTime,
#[serde(rename = "*")]
Star,
}
impl Default for DstAddressType {
fn default() -> DstAddressType {
Self::Whitelisted
}
}
/// * 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.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AmountCurrency {
#[serde(rename = "USD")]
Usd,
#[serde(rename = "EUR")]
Eur,
#[serde(rename = "NATIVE")]
Native,
}
impl Default for AmountCurrency {
fn default() -> AmountCurrency {
Self::Usd
}
}
/// * SINGLE_TX - limit applies to a single transaction * TIMEFRAME - limit
/// applies to all transactions within the defined time period
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AmountScope {
#[serde(rename = "SINGLE_TX")]
SingleTx,
#[serde(rename = "TIMEFRAME")]
Timeframe,
}
impl Default for AmountScope {
fn default() -> AmountScope {
Self::SingleTx
}
}