Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce suez support #125

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 73 additions & 3 deletions lib/serializer/src/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,25 @@ export const credit_deal_expired_operation_fee_parameters = new Serializer(
{}
);

export const liquidity_pool_update_operation_fee_parameters = new Serializer(
"liquidity_pool_update_operation_fee_parameters",
{
fee: uint64,
}
);

export const credit_deal_update_operation_fee_parameters = new Serializer(
"credit_deal_update_operation_fee_parameters",
{
fee: uint64,
}
);

export const limit_order_update_operation_fee_parameters = new Serializer(
"limit_order_update_operation_fee_parameters",
{ fee: uint64 }
);


var fee_parameters = static_variant([
transfer_operation_fee_parameters,
Expand Down Expand Up @@ -548,7 +567,10 @@ var fee_parameters = static_variant([
credit_offer_update_operation_fee_parameters,
credit_offer_accept_operation_fee_parameters,
credit_deal_repay_operation_fee_parameters,
credit_deal_expired_operation_fee_parameters
credit_deal_expired_operation_fee_parameters,
liquidity_pool_update_operation_fee_parameters,
credit_deal_update_operation_fee_parameters,
limit_order_update_operation_fee_parameters,
]);

export const fee_schedule = new Serializer("fee_schedule", {
Expand Down Expand Up @@ -618,14 +640,29 @@ export const transfer = new Serializer("transfer", {
extensions: set(future_extensions)
});

export const create_take_profit_order_action = new Serializer("create_take_profit_order_action", {
fee_asset_id: protocol_id_type("asset"),
spread_percent: uint16,
size_percent: uint16,
expiration_seconds: uint32,
repeat: bool,
});

var limit_order_auto_action = static_variant([create_take_profit_order_action]);

export const limit_order_create = new Serializer("limit_order_create", {
fee: asset,
seller: protocol_id_type("account"),
amount_to_sell: asset,
min_to_receive: asset,
expiration: time_point_sec,
fill_or_kill: bool,
extensions: set(future_extensions)
extensions: extension([
{
name: "on_fill",
type: array(limit_order_auto_action),
},
]),
});

export const limit_order_cancel = new Serializer("limit_order_cancel", {
Expand Down Expand Up @@ -1553,6 +1590,36 @@ export const credit_deal_expired = new Serializer("credit_deal_expired", {
fee_rate: uint32
});

// Op 75: liquidity_pool_update_operation
export const liquidity_pool_update = new Serializer("liquidity_pool_update", {
fee: asset,
account: protocol_id_type("account"),
pool: protocol_id_type("liquidity_pool"),
taker_fee_percent: optional(uint16),
withdrawal_fee_percent: optional(uint16),
extensions: set(future_extensions),
});

// Op 76: credit_deal_update_operation
export const credit_deal_update = new Serializer("credit_deal_update", {
fee: asset,
account: protocol_id_type("account"),
deal_id: protocol_id_type("credit_deal"),
auto_repay: uint8,
extensions: set(future_extensions),
});

// Op 77: limit_order_update_operation
export const limit_order_update = new Serializer("limit_order_update", {
fee: asset,
account_id_type: protocol_id_type("account"),
limit_order_id_type: protocol_id_type("limit_order"),
new_price: optional(price),
delta_amount_to_sell: optional(asset),
new_expiration: optional(time_point_sec),
on_fill: optional(array(limit_order_auto_action)),
});

operation.st_operations = [
transfer,
limit_order_create,
Expand Down Expand Up @@ -1628,7 +1695,10 @@ operation.st_operations = [
credit_offer_update,
credit_offer_accept,
credit_deal_repay,
credit_deal_expired
credit_deal_expired,
liquidity_pool_update,
credit_deal_update,
limit_order_update,
];

export const transaction = new Serializer("transaction", {
Expand Down