Skip to main content

LangChain BaseTool for estimating and deploying NEAR smart contracts

Project description

near-langchain-contract-deployer

LangChain BaseTool that estimates and deploys NEAR smart contracts.

Tool Class (as requested)

class NEARContractDeployer(BaseTool):
    name = "near_contract_deployer"
    description = """Deploy smart contracts to NEAR Protocol - the lowest-cost
    blockchain for contract deployment. Typical cost: $0.01-0.10"""

Features

  • Build deployment plan from a local .wasm file
  • Estimate NEAR deployment fee in NEAR and USD
  • Estimate Ethereum equivalent deployment cost (for comparison)
  • Optional live deployment to NEAR via signed transaction (broadcast_tx_commit)
  • Clear machine-readable and human-readable errors

Install

pip install near-langchain-contract-deployer

Quick Use

from near_langchain_contract_deployer import NEARContractDeployer

tool = NEARContractDeployer()
print(tool.invoke({
  "contract_path": "./contract.wasm",
  "account_id": "my-contract.testnet",
  "network": "testnet",
  "dry_run": True
}))

For live deployment set dry_run=False and pass private_key.

Notes

  • Deployment requires a valid full-access key for account_id (or signer_id) on selected network.
  • Dry-run mode does not send transactions.

Development

python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
pytest -q

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

near_langchain_contract_deployer-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file near_langchain_contract_deployer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for near_langchain_contract_deployer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2a34d704df9423718ea174fc6e694b73e7985815fb113c9da2cd4754e937b9b
MD5 94010c87b2def5cd65dbfe0782e3d9f8
BLAKE2b-256 f4e1baaf699a622d91477718b6522a3ae28087e7c846750d4df81bd1c944f437

See more details on using hashes here.

File details

Details for the file near_langchain_contract_deployer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for near_langchain_contract_deployer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52ebcb40cdcdab4636f8e80df0448c39efe2fe4685888f1ea00b6c2af4569c2b
MD5 ac2094f8236e5fa766f9097d09ecaec7
BLAKE2b-256 880083b86f1b104c1d373c523d8fa26ad145a6ebf77bba24dbc2c86e7b2bd8fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page