Skip to main content

Phantasma SDK for Python

Project description

Phantasma Py

Python SimpleWallet Sample app

This is a simple wallet sample that needs to be connected to a RPC node. By default it uses the localhost:7077/rpc endpoint, but you can switch to your own URL.

To run the sample app, follow these steps:

  1. Install "requests" module (Run "pip install requests" on command line inside app folder)

  2. Run the sample app!

Python VM Samples

The VM Module implements the following classes EventDecoder, ScriptBuilder and Transaction in order to provide support to:

  • Decode TX events data. Examples: /Python/Samples/VMSamples/parsetxevents.py

  • Create Scripts, Transactions and Sign them using HEX Private Key. Examples: /Python/Samples/VMSamples/transferFungible.py /Python/Samples/VMSamples/transferNonFungible.py

    swagger-client

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

This Python package is automatically generated by the Swagger Codegen project:

  • API version: v1
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen For more information, please visit https://phantasma.io

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import swagger_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.AccountApi(swagger_client.ApiClient(configuration))
account = 'account_example' # str |  (optional)

try:
    api_response = api_instance.api_v1_get_account_get(account=account)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountApi->api_v1_get_account_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AccountApi(swagger_client.ApiClient(configuration))
account_text = 'account_text_example' # str |  (optional)

try:
    api_response = api_instance.api_v1_get_accounts_get(account_text=account_text)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountApi->api_v1_get_accounts_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AccountApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str |  (optional)
extended = false # bool |  (optional) (default to false)

try:
    api_response = api_instance.api_v1_get_addresses_by_symbol_get(symbol=symbol, extended=extended)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountApi->api_v1_get_addresses_by_symbol_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.AccountApi(swagger_client.ApiClient(configuration))
name = 'name_example' # str |  (optional)

try:
    api_response = api_instance.api_v1_look_up_name_get(name=name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountApi->api_v1_look_up_name_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
AccountApi api_v1_get_account_get GET /api/v1/GetAccount
AccountApi api_v1_get_accounts_get GET /api/v1/GetAccounts
AccountApi api_v1_get_addresses_by_symbol_get GET /api/v1/GetAddressesBySymbol
AccountApi api_v1_look_up_name_get GET /api/v1/LookUpName
AuctionApi api_v1_get_auction_get GET /api/v1/GetAuction
AuctionApi api_v1_get_auctions_count_get GET /api/v1/GetAuctionsCount
AuctionApi api_v1_get_auctions_get GET /api/v1/GetAuctions
BlockApi api_v1_get_block_by_hash_get GET /api/v1/GetBlockByHash
BlockApi api_v1_get_block_by_height_get GET /api/v1/GetBlockByHeight
BlockApi api_v1_get_block_height_get GET /api/v1/GetBlockHeight
BlockApi api_v1_get_block_transaction_count_by_hash_get GET /api/v1/GetBlockTransactionCountByHash
BlockApi api_v1_get_latest_block_get GET /api/v1/GetLatestBlock
BlockApi api_v1_get_raw_block_by_hash_get GET /api/v1/GetRawBlockByHash
BlockApi api_v1_get_raw_block_by_height_get GET /api/v1/GetRawBlockByHeight
BlockApi api_v1_get_raw_latest_block_get GET /api/v1/GetRawLatestBlock
ChainApi api_v1_get_chains_get GET /api/v1/GetChains
ConnectionApi api_v1_abci_query_get GET /api/v1/abci_query
ConnectionApi api_v1_get_validators_settings_get GET /api/v1/GetValidatorsSettings
ConnectionApi api_v1_health_get GET /api/v1/health
ConnectionApi api_v1_net_info_get GET /api/v1/net_info
ConnectionApi api_v1_request_block_get GET /api/v1/request_block
ConnectionApi api_v1_status_get GET /api/v1/status
ContractApi api_v1_get_contract_by_address_get GET /api/v1/GetContractByAddress
ContractApi api_v1_get_contract_get GET /api/v1/GetContract
LeaderboardApi api_v1_get_leaderboard_get GET /api/v1/GetLeaderboard
NexusApi api_v1_get_nexus_get GET /api/v1/GetNexus
OrganizationApi api_v1_get_organization_by_name_get GET /api/v1/GetOrganizationByName
OrganizationApi api_v1_get_organization_get GET /api/v1/GetOrganization
OrganizationApi api_v1_get_organizations_get GET /api/v1/GetOrganizations
PlatformApi api_v1_get_interop_get GET /api/v1/GetInterop
PlatformApi api_v1_get_platform_get GET /api/v1/GetPlatform
PlatformApi api_v1_get_platforms_get GET /api/v1/GetPlatforms
RpcApi rpc_post POST /rpc
SaleApi api_v1_get_latest_sale_hash_get GET /api/v1/GetLatestSaleHash
SaleApi api_v1_get_sale_get GET /api/v1/GetSale
TokenApi api_v1_get_nft_get GET /api/v1/GetNFT
TokenApi api_v1_get_nfts_get GET /api/v1/GetNFTs
TokenApi api_v1_get_token_balance_get GET /api/v1/GetTokenBalance
TokenApi api_v1_get_token_data_get GET /api/v1/GetTokenData
TokenApi api_v1_get_token_get GET /api/v1/GetToken
TokenApi api_v1_get_tokens_get GET /api/v1/GetTokens
TransactionApi api_v1_get_address_transaction_count_get GET /api/v1/GetAddressTransactionCount
TransactionApi api_v1_get_address_transactions_get GET /api/v1/GetAddressTransactions
TransactionApi api_v1_get_transaction_by_block_hash_and_index_get GET /api/v1/GetTransactionByBlockHashAndIndex
TransactionApi api_v1_get_transaction_get GET /api/v1/GetTransaction
TransactionApi api_v1_invoke_raw_script_get GET /api/v1/InvokeRawScript
TransactionApi api_v1_send_raw_transaction_get GET /api/v1/SendRawTransaction
ValidatorApi api_v1_get_validators_get GET /api/v1/GetValidators
ValidatorApi api_v1_get_validators_type_get GET /api/v1/GetValidators/{type}

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

Tests

Running the Test:

Run the test file directly in your terminal or command line. You can also use a Python IDE that supports running unittest test cases. If your project contains multiple test files, you can run all of them using a test discovery feature:

python -m unittest discover

python3 -m unittest src.phantasma_py.test

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

phantasma-py-1.0.9.tar.gz (81.0 kB view details)

Uploaded Source

Built Distribution

phantasma_py-1.0.9-py3-none-any.whl (163.6 kB view details)

Uploaded Python 3

File details

Details for the file phantasma-py-1.0.9.tar.gz.

File metadata

  • Download URL: phantasma-py-1.0.9.tar.gz
  • Upload date:
  • Size: 81.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for phantasma-py-1.0.9.tar.gz
Algorithm Hash digest
SHA256 5def9e28d0fe59f24fd60a758224fa28a31502f69bf3283ea16207fbad7c2471
MD5 962440e4cc9aaa4c5f4be592d5e8fe89
BLAKE2b-256 87379064da25bad8dd3f798c008ac932c062322b5d5424fa0d133cf15c4a666b

See more details on using hashes here.

File details

Details for the file phantasma_py-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: phantasma_py-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 163.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for phantasma_py-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 78386ab0f3f480b1fcbd23770763f1ab214d606e0850138515e7fb02e15d6ed9
MD5 a5f1ed14da3a398f39f6f40c23172de9
BLAKE2b-256 12cb09880a174959988e7a8038d1867e166568e1254198480318a5280e9c748a

See more details on using hashes here.

Supported by

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