Skip to main content

near-api-py

This is and extension of the near-api-py repository

Status: super rough, APIs are subject to change

A Python library for development of applications that are using NEAR platform.

Installation

pip install near-api-py

Usage example

Send money

near_provider = near_api.providers.JsonProvider("https://rpc.testnet.near.org")

sender_key_pair = near_api.signer.KeyPair("ed25519:[SENDER_PRIVATE_KEY]")
sender_signer = near_api.signer.Signer("sender.testnet", sender_key_pair)
sender_account = near_api.account.Account(near_provider, sender_signer)

out = sender_account.send_money("vsab.testnet", 1000)

print(out)

Smart contract call method

contract_id = "contract.testnet"
signer_id = "signer.testnet"
signer_key = "ed25519:[SIGNER_SECRET_KEY]"
args = {"counter": 1, "action": "increase"}

near_provider = near_api.providers.JsonProvider("https://rpc.testnet.near.org")
key_pair = near_api.signer.KeyPair(signer_key)
signer = near_api.signer.Signer(signer_id, key_pair)
account = near_api.account.Account(near_provider, signer)

out = account.function_call(contract_id, "counter_set", args)

print(out)

Contribution

First, install the package in development mode:

python setup.py develop

To run tests, use nose (pip install nose):

nosetests

License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE and LICENSE-APACHE for details.

Download files

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

Source Distribution

lzr-near-api-py-0.1.11.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

lzr_near_api_py-0.1.11-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file lzr-near-api-py-0.1.11.tar.gz.

File metadata

  • Download URL: lzr-near-api-py-0.1.11.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for lzr-near-api-py-0.1.11.tar.gz
Algorithm Hash digest
SHA256 f0f76bb8f14846485607dcd1c751c7e69f491c181ac4d612d643b45546409eb6
MD5 e54ed74b861e903e0733a35f66691c9e
BLAKE2b-256 f31a5a7f559d9fc02765fa7080a0475534160588de574b8ae0fe2ab1e0e29e82

See more details on using hashes here.

File details

Details for the file lzr_near_api_py-0.1.11-py3-none-any.whl.

File metadata

File hashes

Hashes for lzr_near_api_py-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 33a96fdd318fc5a062b0a7876d89954307f66407f8f7a0779852f90ebf3ac4cd
MD5 8e98a9f528145024bd07d97cc5228e6d
BLAKE2b-256 7ea0c1e8f2794213d47d79414e7fc654f165ea89268e27b32fe6728621712b5c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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