|
45 | 45 | Worker_initializer, |
46 | 46 | isArgsThisClass, |
47 | 47 | AssertPredicate, |
| 48 | + LimitOrderAutoAction, |
| 49 | + LimitOrderCreateExtensions, |
48 | 50 | ) |
49 | 51 | from .operationids import operations |
50 | 52 |
|
|
54 | 56 | class_namemap = {} |
55 | 57 |
|
56 | 58 |
|
57 | | -class VirtualOperationException(Exception): |
58 | | - pass |
59 | | - |
60 | | - |
61 | | -class ChainParameters(NotImplementedError): |
62 | | - pass |
63 | | - |
64 | | - |
65 | | -class CustomRestriction(NotImplementedError): |
66 | | - pass |
67 | | - |
68 | | - |
69 | | -class VestingPolicy(NotImplementedError): |
70 | | - pass |
71 | | - |
72 | | - |
73 | 59 | def fill_classmaps(): |
74 | 60 | for name, ind in operations.items(): |
75 | 61 | classname = name[0:1].upper() + name[1:] |
@@ -402,7 +388,10 @@ def __init__(self, *args, **kwargs): |
402 | 388 | ("min_to_receive", Asset(kwargs["min_to_receive"])), |
403 | 389 | ("expiration", PointInTime(kwargs["expiration"])), |
404 | 390 | ("fill_or_kill", Bool(kwargs["fill_or_kill"])), |
405 | | - ("extensions", Set([])), |
| 391 | + ( |
| 392 | + "extensions", |
| 393 | + LimitOrderCreateExtensions(kwargs["extensions"]), |
| 394 | + ), |
406 | 395 | ] |
407 | 396 | ) |
408 | 397 | ) |
@@ -1532,4 +1521,104 @@ def __init__(self, *args, **kwargs): |
1532 | 1521 | ) |
1533 | 1522 |
|
1534 | 1523 |
|
| 1524 | +class Liquidity_pool_update(GrapheneObject): |
| 1525 | + def __init__(self, *args, **kwargs): |
| 1526 | + if isArgsThisClass(self, args): |
| 1527 | + self.data = args[0].data |
| 1528 | + else: |
| 1529 | + if len(args) == 1 and len(kwargs) == 0: |
| 1530 | + kwargs = args[0] |
| 1531 | + |
| 1532 | + if kwargs.get("taker_fee_percent"): |
| 1533 | + taker_fee_percent = Optional(Uint16(kwargs["taker_fee_percent"])) |
| 1534 | + else: |
| 1535 | + taker_fee_percent = Optional(None) |
| 1536 | + |
| 1537 | + if kwargs.get("withdrawal_fee_percent"): |
| 1538 | + withdrawal_fee_percent = Optional( |
| 1539 | + Uint16(kwargs["withdrawal_fee_percent"]) |
| 1540 | + ) |
| 1541 | + else: |
| 1542 | + withdrawal_fee_percent = Optional(None) |
| 1543 | + |
| 1544 | + super().__init__( |
| 1545 | + OrderedDict( |
| 1546 | + [ |
| 1547 | + ("fee", Asset(kwargs["fee"])), |
| 1548 | + ("account", ObjectId(kwargs["account"], "account")), |
| 1549 | + ("pool", ObjectId(kwargs["pool"], "liquidity_pool")), |
| 1550 | + ("taker_fee_percent", taker_fee_percent), |
| 1551 | + ("withdrawal_fee_percent", withdrawal_fee_percent), |
| 1552 | + ("extensions", Set([])), |
| 1553 | + ] |
| 1554 | + ) |
| 1555 | + ) |
| 1556 | + |
| 1557 | + |
| 1558 | +class Credit_deal_update(GrapheneObject): |
| 1559 | + def __init__(self, *args, **kwargs): |
| 1560 | + if isArgsThisClass(self, args): |
| 1561 | + self.data = args[0].data |
| 1562 | + else: |
| 1563 | + if len(args) == 1 and len(kwargs) == 0: |
| 1564 | + kwargs = args[0] |
| 1565 | + super().__init__( |
| 1566 | + OrderedDict( |
| 1567 | + [ |
| 1568 | + ("fee", Asset(kwargs["fee"])), |
| 1569 | + ("account", ObjectId(kwargs["account"], "account")), |
| 1570 | + ("deal_id", ObjectId(kwargs["deal_id"], "credit_deal")), |
| 1571 | + ("auto_repay", Uint8(kwargs["auto_repay"])), |
| 1572 | + ("extensions", Set([])), |
| 1573 | + ] |
| 1574 | + ) |
| 1575 | + ) |
| 1576 | + |
| 1577 | + |
| 1578 | +class Limit_order_update(GrapheneObject): |
| 1579 | + def __init__(self, *args, **kwargs): |
| 1580 | + if isArgsThisClass(self, args): |
| 1581 | + self.data = args[0].data |
| 1582 | + else: |
| 1583 | + if len(args) == 1 and len(kwargs) == 0: |
| 1584 | + kwargs = args[0] |
| 1585 | + |
| 1586 | + if kwargs.get("new_price"): |
| 1587 | + new_price = Optional(Price(kwargs["new_price"])) |
| 1588 | + else: |
| 1589 | + new_price = Optional(None) |
| 1590 | + |
| 1591 | + if kwargs.get("delta_amount_to_sell"): |
| 1592 | + delta_amount_to_sell = Optional(Asset(kwargs["delta_amount_to_sell"])) |
| 1593 | + else: |
| 1594 | + delta_amount_to_sell = Optional(None) |
| 1595 | + |
| 1596 | + if kwargs.get("new_expiration"): |
| 1597 | + new_expiration = Optional(PointInTime(kwargs["new_expiration"])) |
| 1598 | + else: |
| 1599 | + new_expiration = Optional(None) |
| 1600 | + |
| 1601 | + if kwargs.get("on_fill"): |
| 1602 | + on_fill = Optional( |
| 1603 | + Array([LimitOrderAutoAction(o) for o in kwargs["on_fill"]]) |
| 1604 | + ) |
| 1605 | + else: |
| 1606 | + on_fill = Optional(None) |
| 1607 | + |
| 1608 | + super().__init__( |
| 1609 | + OrderedDict( |
| 1610 | + [ |
| 1611 | + ("fee", Asset(kwargs["fee"])), |
| 1612 | + ("seller", ObjectId(kwargs["seller"], "account")), |
| 1613 | + ("order", ObjectId(kwargs["order"], "limit_order")), |
| 1614 | + ("new_price", new_price), |
| 1615 | + ("delta_amount_to_sell", delta_amount_to_sell), |
| 1616 | + ("new_expiration", new_expiration), |
| 1617 | + ("on_fill", on_fill), |
| 1618 | + ("extensions", Set([])), |
| 1619 | + ] |
| 1620 | + ) |
| 1621 | + ) |
| 1622 | + |
| 1623 | + |
1535 | 1624 | fill_classmaps() |
0 commit comments