Skip to main content

No project description provided

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Kiln Connect SDK

Overview

Welcome to the Python Kiln Connect SDK which provides facilities around Staking using the Kiln API. It is composed of three parts:

  • API layer which facilities usage of the Kiln API,
  • Integration layer which provides facilities around the Kiln API,
  • CLI which showcases the two previous parts.

The SDK is typically used as follows: a KilnConnect instance is created from a KilnConfig, the SDK then provides access to different parts:

  • accounts for Kiln Accounts facilities
  • eth for Ethereum facilities
  • xtz for Tezos facilities

Optionally, the SDK can be configured with multiple integrations (similar to the concept of modules), which can be referred later via their name.

For example, here we create a KilnConnect object from a config initialized from the environment. This config has a Fireblocks integration called fireblocks (configured with a specific vault account and API key), we then stake on Ethereum using the fireblocks integration.

import kiln_connect

config = kiln_connect.KilnConfig.from_env()
kc = kiln_connect.KilnConnect(config)

kc.eth.stake(integration='fireblocks', account_id='...', wallet='...', amount_wei=32000000000000000000)

The following integrations are currently supported:

Configuration

There are two ways to configure the SDK, either manually by creating a KilnConfig object or by using the environment. For simplicity, we recommend using the environment to start with, and then switch to KilnConfig as your usage becomes more specific.

Via Environment

Kiln Connect can be configured from the environment by using the helper KilnConfig.from_env(), as follows:

import kiln_connect

def example():
    with kiln_connect.KilnConnect(kiln_connect.KilnConfig.from_env()) as kc:
       pass

This helper builds a KilnConfig by looking at the following environment variables:

Variable Name Description Example Misc
KILN_ENV Environment to use devnet, testnet, mainnet Required
KILN_API_URL Kiln Endpoint to target https://api.testnet.kiln.fi Required
KILN_API_TOKEN Kiln API token kiln_... Required
FIREBLOCKS_API_KEY API key for Fireblocks Integration 123e4567-e89b-12d3-a456-426614174000 Optional
FIREBLOCKS_RAW_KEY_PATH Path to PEM key for Fireblocks Integration ~/.fireblocks.pem Optional
FIREBLOCKS_VAULT_ACCOUNT_ID Vault Account ID for Fireblocks Integration 7 Optional

Via KilnConfig

The KilnConfig required to initialize the API is defined as follows:

class KilnConfig:
    """Configuration of the Kiln Connect SDK.
    """
    kiln_base_url: str                     # https://api.testnet.kiln.fi/
    kiln_api_token: str                    # kiln_...
    integrations: list[IntegrationConfig]  # optional list of integration configs

class IntegrationConfig:
    """Configuration of a Kiln integration.
    """
    name: str                              # user-defined name of the integration (i.e: "")
    provider: str                          # type of the integration (i.e: "fireblocks")
    parameters: dict                       # python dict

For example:

import kiln_connect

config = kiln_connect.KilnConfig(
    kiln_base_url='https://api.testnet.kiln.fi',
    kiln_api_token='kiln_...',

    integrations=[
       # Fireblocks Integration to stake on ETH_TEST3 (goerli)
       # from vault account 7 using raw key present in file
       # ~/.fireblocks.pem.
       kiln_connect.IntegrationConfig(
         name='fireblocks-testnet',
         provider='fireblocks',
         parameters={
           'api_token': '...',
           'raw_key_path': '~/.fireblocks.pem',
           'vault_account_id': 7,
           'assets': {
              'eth': 'ETH_TEST3',
           }
         }
       )
    ]
)

Fireblocks

Here is the expected configuration for the optional Fireblocks integration:

{
   'api_token': '<Fireblocks API token>',
   'raw_key_path': '<Fireblocks raw key path>',
   'vault_account_id': <Fireblocks Vault Account ID>,
   'assets': {
      'eth': 'ETH_TEST3',
   },
}

Where assets is a dictionnary used to know which asset to use whenever staking on a given protocol. The following protocols are supported:

  • eth (available via KilnConnect.eth.stake)

Usage

The simplest way to start using the SDK is to look at examples implemented in the CLI; it is kept simple to showcase the SDK.

API facilities:

Integrations facilities:

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

kiln_connect-1.0.0.dev8.tar.gz (207.0 kB view details)

Uploaded Source

Built Distribution

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

kiln_connect-1.0.0.dev8-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file kiln_connect-1.0.0.dev8.tar.gz.

File metadata

  • Download URL: kiln_connect-1.0.0.dev8.tar.gz
  • Upload date:
  • Size: 207.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/6.1.34-1-lts

File hashes

Hashes for kiln_connect-1.0.0.dev8.tar.gz
Algorithm Hash digest
SHA256 cf2cc920a2c433b84fa863ba78bf744c759303fbd59ed8dded8be9f9a8432863
MD5 fbe68dd2f4f91c7a2d31395100c2e0ac
BLAKE2b-256 7620cec533d0dcc1e6535d2f7ccdf11d8f7a8c8e39b757c56575c87d00d61d8e

See more details on using hashes here.

File details

Details for the file kiln_connect-1.0.0.dev8-py3-none-any.whl.

File metadata

  • Download URL: kiln_connect-1.0.0.dev8-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/6.1.34-1-lts

File hashes

Hashes for kiln_connect-1.0.0.dev8-py3-none-any.whl
Algorithm Hash digest
SHA256 ed7a12b17dddbc3c6fc2852f2d821467559558cd42c0483a7ca6ceab554c8309
MD5 d53811bd2f91091a6a93828fe8e625e4
BLAKE2b-256 3133cdd259a63b2356f36359eef3231f4c38e7ea69cae425e8d2e4dc6fa053ac

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