CURRENT_VERSION -> WalletSync.API_VERSION

This commit is contained in:
Daniel Krol 2022-06-16 14:11:11 -04:00
parent 027e0eadf6
commit 64dfae6637

View file

@ -3,7 +3,6 @@ from collections import namedtuple
import json, uuid, requests, hashlib import json, uuid, requests, hashlib
from pprint import pprint from pprint import pprint
CURRENT_VERSION = 1
WalletState = namedtuple('WalletState', ['sequence', 'encrypted_wallet']) WalletState = namedtuple('WalletState', ['sequence', 'encrypted_wallet'])
@ -67,6 +66,8 @@ class WalletSync():
self.REGISTER_URL = BASE_URL + '/signup' self.REGISTER_URL = BASE_URL + '/signup'
self.WALLET_URL = BASE_URL + '/wallet' self.WALLET_URL = BASE_URL + '/wallet'
self.API_VERSION = 1
def register(self, email, password): def register(self, email, password):
body = json.dumps({ body = json.dumps({
'email': email, 'email': email,
@ -119,7 +120,7 @@ class WalletSync():
def update_wallet(self, wallet_state, hmac, token): def update_wallet(self, wallet_state, hmac, token):
body = json.dumps({ body = json.dumps({
'version': CURRENT_VERSION, 'version': self.API_VERSION,
'token': token, 'token': token,
"encryptedWallet": wallet_state.encrypted_wallet, "encryptedWallet": wallet_state.encrypted_wallet,
"sequence": wallet_state.sequence, "sequence": wallet_state.sequence,
@ -128,7 +129,7 @@ class WalletSync():
response = requests.post(self.WALLET_URL, body) response = requests.post(self.WALLET_URL, body)
# TODO check that response.json().version == CURRENT_VERSION # TODO check that response.json().version == self.API_VERSION
if response.status_code == 200: if response.status_code == 200:
conflict = False conflict = False