File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,11 +34,11 @@ def invoke(
3434 )
3535
3636 soroban_server = stellar_sdk .SorobanServer (network .rpc_url )
37- source_account = soroban_server .load_account (identity .public_key )
37+ source_account_ = soroban_server .load_account (identity .public_key )
3838
3939 tx = (
4040 stellar_sdk .TransactionBuilder (
41- source_account , network .network_passphrase , base_fee = network .base_fee
41+ source_account_ , network .network_passphrase , base_fee = network .base_fee
4242 )
4343 .add_time_bounds (0 , 0 )
4444 .append_invoke_contract_function_op (
Original file line number Diff line number Diff line change @@ -36,7 +36,10 @@ class Identity(BaseSettings):
3636 @model_validator (mode = "after" )
3737 def load_keys (self ) -> "Identity" :
3838 if self .keypair is None and self .secret_key is None :
39- raise ValueError ("Either provide a secret key or a Keypair object." )
39+ raise ValueError (
40+ "Either provide a secret key or a Keypair object. Also look"
41+ "in 'identity.toml'"
42+ )
4043 if self .keypair is not None :
4144 self .secret_key = self .keypair .secret
4245 else :
@@ -50,7 +53,9 @@ def from_source_account(
5053 ) -> "Identity" :
5154 if account is None :
5255 identity = Identity ()
53- if isinstance (account , str ) and account .startswith ("S" ) and len (account ) == 56 :
56+ elif (
57+ isinstance (account , str ) and account .startswith ("S" ) and len (account ) == 56
58+ ):
5459 identity = Identity (secret_key = account )
5560 elif isinstance (account , (str , pathlib .Path )):
5661 fname = _load_configuration (account , "identity" )
Original file line number Diff line number Diff line change 1+ secret_key = " SDTZV5HD6WBU2LZKVUGFCUUR3JTOJHDHEXO2TSYVITMSH6RCY433HEYB"
Original file line number Diff line number Diff line change 11import json
2+ import os
23import pathlib
34
45import pytest
@@ -17,6 +18,9 @@ def test_from_pk(self):
1718 soroban .Identity (keypair = keypair )
1819
1920 def test_from_source_account (self ):
21+ # identity.toml exists
22+ os .chdir (pathlib .Path (__file__ ).parent )
23+ soroban .Identity .from_source_account ()
2024 alice_fname = pathlib .Path (__file__ ).parent / "alice.toml"
2125 soroban .Identity .from_source_account (account = alice_fname )
2226
@@ -26,6 +30,7 @@ def test_from_source_account(self):
2630 soroban .Identity .from_source_account (account = keypair .secret )
2731
2832 def test_raises (self ):
33+ os .chdir (pathlib .Path (__file__ ).parent .parent )
2934 with pytest .raises (ValueError , match = "provide a secret key or a Keypair" ):
3035 soroban .Identity ()
3136
You can’t perform that action at this time.
0 commit comments