11import asyncio
2+ import os
23
4+ import dotenv
35from grpc import RpcError
46
57from pyinjective .async_client import AsyncClient
1012
1113
1214async def main () -> None :
15+ dotenv .load_dotenv ()
16+ configured_private_key = os .getenv ("INJECTIVE_PRIVATE_KEY" )
17+ grantee_public_address = os .getenv ("INJECTIVE_GRANTEE_PUBLIC_ADDRESS" )
18+
1319 # select network: local, testnet, mainnet
1420 network = Network .testnet ()
1521
@@ -19,7 +25,7 @@ async def main() -> None:
1925 await client .sync_timeout_height ()
2026
2127 # load account
22- priv_key = PrivateKey .from_hex ("f9db9bf330e23cb7839039e944adef6e9df447b90b503d5b4464c90bea9022f3" )
28+ priv_key = PrivateKey .from_hex (configured_private_key )
2329 pub_key = priv_key .to_public_key ()
2430 address = pub_key .to_address ()
2531 await client .fetch_account (address .to_acc_bech32 ())
@@ -30,8 +36,8 @@ async def main() -> None:
3036
3137 # GENERIC AUTHZ
3238 msg = composer .MsgGrantGeneric (
33- granter = "inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r" ,
34- grantee = "inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku" ,
39+ granter = address . to_acc_bech32 () ,
40+ grantee = grantee_public_address ,
3541 msg_type = "/injective.exchange.v1beta1.MsgCreateSpotLimitOrder" ,
3642 expire_in = 31536000 , # 1 year
3743 )
0 commit comments