Skip to main content

Near async rpc client


JsonProvider

Use JsonProvider to process api calls to NEAR rpc node

rpc_url varies by network:

from async_near.providers import JsonProvider
jp = JsonProvider(rpc_url)

res = jp.view_call(account_id, method_name, args, finality="optimistic")

Signer

Use Signer to sign or request to rpc node

from async_near.signer import Signer, KeyPair

key = KeyPair(private_key) # create key pair (private-publish)

signer = Signer(
        signer_account_id,
        key,
    )

signer.sign(message)

Account

Use Account to create and execute transactions

from async_near.signer import Signer, KeyPair
from async_near.providers import JsonProvider
from async_near.account import Account


acc = Account(
        JsonProvider("https://rpc.testnet.near.org"),
        Signer(
            "example.testnet",
            KeyPair("ed25519:5sn12Kwd2TZn4A3...7979"),
        ),
    )

await acc.startup()

Make contract calls

btc_amount = (await acc.view_function("btc_contract_id", "available_btc", {})).result


await acc.function_call(
        "btc_contract_id",
        "ft_transfer_call",
        {"target_btc_address": "..."},
    )

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.

Metadata

Release files for async-near 1.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-near 1.0.11
File Size Uploaded
async_near-1.0.11.tar.gz 11.7 kB Details

Release files / async_near-1.0.11.tar.gz

Download URL async_near-1.0.11.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
759c49bb3965bbdbc3d4ca5915f63253e74a269d57b0481caaf02f3648c18d5d
BLAKE2b-256 checksum
How to use checksums
e1e4b3a94b7d0ef97d9fc157e5ea32dc6871dcf36bdfbaf32843ef3e2c5cd3db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release history Release notifications | RSS feed

This release

1.0.11 This release

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2.1

1 release file

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page