o
    ZhR
                     @   st   d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZmZ G dd de	ZG dd	 d	eZdS )
    N)OptionalTypeUnion)AsyncCallbackManagerForToolRun)	BaseModelField)AINBaseToolOperationTypec                   @   sZ   e Zd ZU dZedZeed< edddZe	ed< edddZ
eeee	eef  ed	< dS )
ValueSchemazSchema for value operations..typezBlockchain reference path)descriptionpathNzValue to be set at the pathvalue)__name__
__module____qualname____doc__r   r   r	   __annotations__r   strr   r   r   intfloatdict r   r   `/var/www/html/lang_env/lib/python3.10/site-packages/langchain_community/tools/ainetwork/value.pyr
      s   
 "r
   c                   @   sr   e Zd ZU dZdZeed< dZeed< eZ	e
e ed< 		dded	ed
eeeeeef  dee def
ddZdS )AINValueOpszTool for value operations.ZAINvalueOpsnamea  
Covers the read and write value for the AINetwork Blockchain database.

## SET
- Set a value at a given path

### Example
- type: SET
- path: /apps/langchain_test_1/object
- value: {1: 2, "34": 56}

## GET
- Retrieve a value at a given path

### Example
- type: GET
- path: /apps/langchain_test_1/DB

## Special paths
- `/accounts/<address>/balance`: Account balance
- `/accounts/<address>/nonce`: Account nonce
- `/apps`: Applications
- `/consensus`: Consensus
- `/checkin`: Check-in
- `/deposit/<service id>/<address>/<deposit id>`: Deposit
- `/deposit_accounts/<service id>/<address>/<account id>`: Deposit accounts
- `/escrow`: Escrow
- `/payments`: Payment
- `/sharding`: Sharding
- `/token/name`: Token name
- `/token/symbol`: Token symbol
- `/token/total_supply`: Token total supply
- `/transfer/<address from>/<address to>/<key>/value`: Transfer
- `/withdraw/<service id>/<address>/<withdraw id>`: Withdraw
r   args_schemaNr   r   r   run_managerreturnc              
      s   ddl m} zA|tju r'|d u rtd| jj|j||ddI d H }n|tj	u r9| jj|
 I d H }ntd| dtj|dd	W S  tyg } zt|j d
t| W  Y d }~S d }~ww )Nr   )ValueOnlyTransactionInputz&'value' is required for SET operation.)r   )ZtransactionInputzUnsupported 'type': .F)ensure_asciiz: )Z	ain.typesr   r	   ZSET
ValueError	interfacedbrefZsetValueGETZgetValuejsondumps	Exceptionbuiltinsr   r   r   )selfr   r   r   r   r   reser   r   r   _arun>   s"   

&zAINValueOps._arun)NN)r   r   r   r   r   r   r   r   r
   r   r   r   r	   r   r   r   r   r   r   r.   r   r   r   r   r      s$   
 #r   )r*   r'   typingr   r   r   Zlangchain_core.callbacksr   Zpydanticr   r   Z(langchain_community.tools.ainetwork.baser   r	   r
   r   r   r   r   r   <module>   s    
