@@ -43,6 +43,22 @@ def OwnerAsBytes(self):
4343 return memoryview (self ._tab .Bytes )[_off :_off + _len ]
4444 return None
4545
46+ def WalletAddressAsBytes (self ):
47+ o = flatbuffers .number_types .UOffsetTFlags .py_type (self ._tab .Offset (10 ))
48+ if o != 0 :
49+ _off = self ._tab .Vector (o )
50+ _len = self ._tab .VectorLen (o )
51+ return memoryview (self ._tab .Bytes )[_off :_off + _len ]
52+ return None
53+
54+ def SignatureAsBytes (self ):
55+ o = flatbuffers .number_types .UOffsetTFlags .py_type (self ._tab .Offset (12 ))
56+ if o != 0 :
57+ _off = self ._tab .Vector (o )
58+ _len = self ._tab .VectorLen (o )
59+ return memoryview (self ._tab .Bytes )[_off :_off + _len ]
60+ return None
61+
4662
4763class UserKey :
4864 """
@@ -63,11 +79,21 @@ def __init__(self, from_fbs=None):
6379 # [uint8] (uuid)
6480 self ._owner = None
6581
82+ # Wallet address of user account this key is owned by.
83+ # [uint8] (address)
84+ self ._wallet_address = None
85+
86+ # Signature which resulted in this key being saved.
87+ # [uint8] (ethsig)
88+ self ._signature = None
89+
6690 def marshal (self ):
6791 obj = {
6892 'pubkey' : bytes (self .pubkey ),
6993 'created' : int (self .created ),
7094 'owner' : self .owner .bytes ,
95+ 'wallet_address' : self .wallet_address if self .wallet_address else None ,
96+ 'signature' : bytes (self .signature ) if self .signature else None
7197 }
7298 return obj
7399
@@ -121,6 +147,36 @@ def owner(self, value: uuid.UUID):
121147 assert value is None or isinstance (value , uuid .UUID )
122148 self ._owner = value
123149
150+ @property
151+ def wallet_address (self ) -> bytes :
152+ """
153+ Wallet address of the member this key belong to.
154+ """
155+ if self ._wallet_address is None and self ._from_fbs :
156+ if self ._from_fbs .WalletAddressLength ():
157+ self ._wallet_address = self ._from_fbs .WalletAddressAsBytes ()
158+ return self ._wallet_address
159+
160+ @wallet_address .setter
161+ def wallet_address (self , value : bytes ):
162+ assert value is None or (type (value ) == bytes and len (value ) == 20 )
163+ self ._wallet_address = value
164+
165+ @property
166+ def signature (self ) -> bytes :
167+ """
168+ market maker transaction signature.
169+ """
170+ if self ._signature is None and self ._from_fbs :
171+ if self ._from_fbs .SignatureLength ():
172+ self ._signature = self ._from_fbs .SignatureAsBytes ()
173+ return self ._signature
174+
175+ @signature .setter
176+ def signature (self , value : bytes ):
177+ assert value is None or (type (value ) == bytes and len (value ) == 65 )
178+ self ._signature = value
179+
124180 @staticmethod
125181 def cast (buf ):
126182 return UserKey (_UserKeyGen .GetRootAsUserKey (buf , 0 ))
@@ -135,6 +191,14 @@ def build(self, builder):
135191 if pubkey :
136192 pubkey = builder .CreateString (pubkey )
137193
194+ wallet_address = self .wallet_address
195+ if wallet_address :
196+ wallet_address = builder .CreateString (wallet_address )
197+
198+ signature = self .signature
199+ if signature :
200+ signature = builder .CreateString (signature )
201+
138202 UserKeyGen .UserKeyStart (builder )
139203
140204 if pubkey :
@@ -146,6 +210,12 @@ def build(self, builder):
146210 if owner :
147211 UserKeyGen .UserKeyAddOwner (builder , owner )
148212
213+ if wallet_address :
214+ UserKeyGen .UserKeyAddWalletAddress (builder , wallet_address )
215+
216+ if signature :
217+ UserKeyGen .UserKeyAddSignature (builder , signature )
218+
149219 final = UserKeyGen .UserKeyEnd (builder )
150220
151221 return final
0 commit comments