Skip to content

Commit

Permalink
update idl / postOnlyParams
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbigz committed Mar 24, 2023
1 parent 8ccac22 commit 5be709f
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 11 deletions.
202 changes: 194 additions & 8 deletions src/driftpy/idl/drift.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.19.0",
"version": "2.22.0",
"name": "drift",
"instructions": [
{
Expand Down Expand Up @@ -90,6 +90,54 @@
],
"args": []
},
{
"name": "initializeReferrerName",
"accounts": [
{
"name": "referrerName",
"isMut": true,
"isSigner": false
},
{
"name": "user",
"isMut": true,
"isSigner": false
},
{
"name": "userStats",
"isMut": true,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": true
},
{
"name": "payer",
"isMut": true,
"isSigner": true
},
{
"name": "rent",
"isMut": false,
"isSigner": false
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false
}
],
"args": [
{
"name": "name",
"type": {
"array": ["u8", 32]
}
}
]
},
{
"name": "deposit",
"accounts": [
Expand Down Expand Up @@ -852,6 +900,32 @@
}
]
},
{
"name": "revertFill",
"accounts": [
{
"name": "state",
"isMut": false,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": true
},
{
"name": "filler",
"isMut": true,
"isSigner": false
},
{
"name": "fillerStats",
"isMut": true,
"isSigner": false
}
],
"args": []
},
{
"name": "fillSpotOrder",
"accounts": [
Expand Down Expand Up @@ -966,6 +1040,32 @@
],
"args": []
},
{
"name": "updateUserIdle",
"accounts": [
{
"name": "state",
"isMut": false,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": true
},
{
"name": "filler",
"isMut": true,
"isSigner": false
},
{
"name": "user",
"isMut": true,
"isSigner": false
}
],
"args": []
},
{
"name": "settlePnl",
"accounts": [
Expand Down Expand Up @@ -4447,7 +4547,7 @@
"type": "u64"
},
{
"name": "liquidationStartSlot",
"name": "lastActiveSlot",
"type": "u64"
},
{
Expand Down Expand Up @@ -4476,10 +4576,14 @@
"name": "isMarginTradingEnabled",
"type": "bool"
},
{
"name": "idle",
"type": "bool"
},
{
"name": "padding",
"type": {
"array": ["u8", 26]
"array": ["u8", 25]
}
}
]
Expand Down Expand Up @@ -4556,6 +4660,32 @@
}
]
}
},
{
"name": "ReferrerName",
"type": {
"kind": "struct",
"fields": [
{
"name": "authority",
"type": "publicKey"
},
{
"name": "user",
"type": "publicKey"
},
{
"name": "userStats",
"type": "publicKey"
},
{
"name": "name",
"type": {
"array": ["u8", 32]
}
}
]
}
}
],
"types": [
Expand Down Expand Up @@ -6140,11 +6270,7 @@
},
{
"name": "Match",
"fields": [
{
"defined": "usize"
}
]
"fields": ["publicKey", "u16"]
}
]
}
Expand Down Expand Up @@ -8535,6 +8661,66 @@
"code": 6227,
"name": "TierViolationLiquidatingPerpPnl",
"msg": "TierViolationLiquidatingPerpPnl"
},
{
"code": 6228,
"name": "CouldNotLoadUserData",
"msg": "CouldNotLoadUserData"
},
{
"code": 6229,
"name": "UserWrongMutability",
"msg": "UserWrongMutability"
},
{
"code": 6230,
"name": "InvalidUserAccount",
"msg": "InvalidUserAccount"
},
{
"code": 6231,
"name": "CouldNotLoadUserStatsData",
"msg": "CouldNotLoadUserData"
},
{
"code": 6232,
"name": "UserStatsWrongMutability",
"msg": "UserWrongMutability"
},
{
"code": 6233,
"name": "InvalidUserStatsAccount",
"msg": "InvalidUserAccount"
},
{
"code": 6234,
"name": "UserNotFound",
"msg": "UserNotFound"
},
{
"code": 6235,
"name": "UnableToLoadUserAccount",
"msg": "UnableToLoadUserAccount"
},
{
"code": 6236,
"name": "UserStatsNotFound",
"msg": "UserStatsNotFound"
},
{
"code": 6237,
"name": "UnableToLoadUserStatsAccount",
"msg": "UnableToLoadUserStatsAccount"
},
{
"code": 6238,
"name": "UserNotInactive",
"msg": "User Not Inactive"
},
{
"code": 6239,
"name": "RevertFill",
"msg": "RevertFill"
}
]
}
12 changes: 9 additions & 3 deletions src/driftpy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ class OrderTriggerCondition:
class MarketType:
SPOT = constructor()
PERP = constructor()


@_rust_enum
class PostOnlyParams:
NONE = constructor()
TRY_POST_ONLY = constructor()
MUST_POST_ONLY = constructor()

@dataclass
class OrderParams:
order_type: OrderType
Expand All @@ -247,7 +253,7 @@ class OrderParams:
price: int
market_index: int
reduce_only: bool
post_only: bool
post_only: PostOnlyParams
immediate_or_cancel: bool
max_ts: Optional[int]
trigger_price: Optional[int]
Expand Down Expand Up @@ -424,7 +430,7 @@ class Order:
existing_position_direction: PositionDirection
direction: PositionDirection
reduce_only: bool
post_only: bool
post_only: PostOnlyParams
immediate_or_cancel: bool
trigger_condition: OrderTriggerCondition
auction_duration: int
Expand Down

0 comments on commit 5be709f

Please sign in to comment.