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.info

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:

pytest

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_sdk_py-1.0.11.tar.gz (81.4 kB view details)

Uploaded Source

Built Distribution

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

phantasma_sdk_py-1.0.11-py3-none-any.whl (163.2 kB view details)

Uploaded Python 3

File details

Details for the file phantasma_sdk_py-1.0.11.tar.gz.

File metadata

  • Download URL: phantasma_sdk_py-1.0.11.tar.gz
  • Upload date:
  • Size: 81.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for phantasma_sdk_py-1.0.11.tar.gz
Algorithm Hash digest
SHA256 0f84688ce5e9b991416496df3fad49cb5df6c6c08bd1898f7d395d28cf652e4f
MD5 481bac1946397fd21530160458a9e89d
BLAKE2b-256 a14a96252090a28c09d06b3a6128b89eb1d0c13f275b65b6f48d6dee0beead7c

See more details on using hashes here.

File details

Details for the file phantasma_sdk_py-1.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for phantasma_sdk_py-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 87292c06e88fd4a4c7d11b79dce8504d38cb6dd4cbd1dee09393ee6eb5daab57
MD5 84c4bf97052dded73adf39fb4c7b4552
BLAKE2b-256 a4cc3070a8729acaf6aff71d2d02ca172c9207bafe19c67dc930b6da0f3640dd

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