Skip to content

Commit 12a196c

Browse files
committed
move from parse_obj to model_validate
1 parent fe580ec commit 12a196c

10 files changed

+27
-10
lines changed

convex_api/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
class API:
5050

5151
def __init__(self, url: str):
52-
self._url = url
52+
self._url = str(url)
5353
self._registry = Registry(self)
5454

5555
def create_account(self, key_pair: KeyPair, sequence_retry_count: int = 20) -> Account:

convex_api/tool/command/account_balance_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def create_parser(self, sub_parser: SubParsersAction):
4949
return parser
5050

5151
def execute(self, args: Namespace, output: Output):
52-
typed_args = AccountBalanceArgs.parse_obj(vars(args))
52+
typed_args = AccountBalanceArgs.model_validate(vars(args))
5353
convex = self.load_convex(typed_args.url)
5454
info = self.resolve_to_name_address(typed_args.name_address, output)
5555
if not info:

convex_api/tool/command/account_create_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def create_parser(self, sub_parser: SubParsersAction):
5959
return parser
6060

6161
def execute(self, args: Namespace, output: Output):
62-
typed_args = AccountCreateArgs.parse_obj(vars(args))
62+
typed_args = AccountCreateArgs.model_validate(vars(args))
6363
convex = self.load_convex(typed_args.url)
6464

6565
key_pair = self.import_key_pair(typed_args)

convex_api/tool/command/account_fund_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def create_parser(self, sub_parser: SubParsersAction):
5454
return parser
5555

5656
def execute(self, args: Namespace, output: Output):
57-
typed_args = AccountFundArgs.parse_obj(vars(args))
57+
typed_args = AccountFundArgs.model_validate(vars(args))
5858
convex = self.load_convex(typed_args.url)
5959

6060
account = self.load_account(typed_args, typed_args.name_address, output)

convex_api/tool/command/account_info_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create_parser(self, sub_parser: SubParsersAction):
4848
return parser
4949

5050
def execute(self, args: Namespace, output: Output):
51-
typed_args = AccountInfoArgs.parse_obj(vars(args))
51+
typed_args = AccountInfoArgs.model_validate(vars(args))
5252
convex = self.load_convex(typed_args.url)
5353
info = self.resolve_to_name_address(typed_args.name_address, output)
5454
if not info:

convex_api/tool/command/account_name_register_command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
class AccountNameRegisterArgs(BaseArgs):
2323
command: Literal['account']
2424
account_command: Literal['register']
25-
name_address: str
25+
name_address: str | int
2626
name: str
27-
address: str
27+
address: str | int
2828

2929

3030
class AccountNameRegisterCommand(CommandBase):
@@ -59,7 +59,7 @@ def create_parser(self, sub_parser: SubParsersAction):
5959
return parser
6060

6161
def execute(self, args: Namespace, output: Output):
62-
typed_args = AccountNameRegisterArgs.parse_obj(vars(args))
62+
typed_args = AccountNameRegisterArgs.model_validate(vars(args))
6363
convex = self.load_convex(typed_args.url)
6464

6565
account = self.load_account(typed_args, typed_args.name_address, output)

convex_api/tool/command/account_name_resolve_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create_parser(self, sub_parser: SubParsersAction):
4747
return parser
4848

4949
def execute(self, args: Namespace, output: Output):
50-
typed_args = AccountNameResolveArgs.parse_obj(vars(args))
50+
typed_args = AccountNameResolveArgs.model_validate(vars(args))
5151
convex = self.load_convex(typed_args.url)
5252
address = convex.resolve_account_name(typed_args.name)
5353
if address:

convex_api/tool/command/account_topup_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create_parser(self, sub_parser: SubParsersAction):
4747
return parser
4848

4949
def execute(self, args: Namespace, output: Output):
50-
typed_args = AccountTopupArgs.parse_obj(vars(args))
50+
typed_args = AccountTopupArgs.model_validate(vars(args))
5151
convex = self.load_convex(typed_args.url)
5252
account = self.load_account(typed_args, typed_args.name_address, output)
5353
if not account:

tests/intergration/tool/test_account_command.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def test_account_balance_command(convex_url: str, test_account: Account):
4747
args.account_command = 'balance'
4848
args.url = convex_url
4949
args.name_address = test_account.address
50+
args.keyfile = None
51+
args.keytext = None
52+
args.password = None
53+
args.keywords = None
5054

5155
command = AccountBalanceCommand()
5256
output = Output()
@@ -71,6 +75,10 @@ def test_account_info_command(convex_url: str, test_account: Account):
7175
args.account_command = 'info'
7276
args.url = convex_url
7377
args.name_address = test_account.address
78+
args.keyfile = None
79+
args.keytext = None
80+
args.password = None
81+
args.keywords = None
7482

7583
command = AccountInfoCommand()
7684
output = Output()
@@ -102,6 +110,11 @@ def test_account_name_resolve_command(convex_url: str, test_account: Account):
102110
args.account_command = 'resolve'
103111
args.url = convex_url
104112
args.name = test_account.name
113+
args.keyfile = None
114+
args.keytext = None
115+
args.password = None
116+
args.keywords = None
117+
105118

106119
command = AccountNameResolveCommand()
107120
output = Output()

tests/intergration/tool/test_query_command.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ def test_query_command(convex_url: str):
1717
args.url = convex_url
1818
args.query = '(address *registry*)'
1919
args.name_address = None
20+
args.keyfile = None
21+
args.keytext = None
22+
args.password = None
23+
args.keywords = None
2024

2125
command = QueryCommand()
2226
output = Output()

0 commit comments

Comments
 (0)