Package: kiln-connect
Kiln Connect SDKOverviewWelcome to the Python Kiln Connect SDK which provides facilities
around Staking using the Kiln API. It is composed of three parts:API layerwhich facilities usage of the Kiln API,Integration layerwhich provides facilities around the Kiln API,CLIwhich showcases the two previous parts.The SDK is typically used as follows: aKilnConnectinstance is
created from aKilnConfig, the SDK then provides access to different
parts:accountsfor Kiln Accounts facilitiesethfor Ethereum facilitiesxtzfor Tezos facilitiesOptionally, 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 aKilnConnectobject from a config
initialized from the environment. This config has a Fireblocks
integration calledfireblocks(configured with a specific vault
account and API key), we then stake on Ethereum using the fireblocks
integration.importkiln_connectconfig=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:FireblocksConfigurationThere are two ways to configure the SDK, either manually by creating aKilnConfigobject or by using the environment. For simplicity, we
recommend using the environment to start with, and then switch toKilnConfigas your usage becomes more specific.Via EnvironmentKiln Connect can be configured from the environment by using the
helperKilnConfig.from_env(), as follows:importkiln_connectdefexample():withkiln_connect.KilnConnect(kiln_connect.KilnConfig.from_env())askc:passThis helper builds aKilnConfigby looking at the following
environment variables:Variable NameDescriptionExampleMiscKILN_ENVEnvironment to usedevnet,testnet,mainnetRequiredKILN_API_URLKiln Endpoint to targethttps://api.testnet.kiln.fiRequiredKILN_API_TOKENKiln API tokenkiln_...RequiredFIREBLOCKS_API_KEYAPI key for Fireblocks Integration123e4567-e89b-12d3-a456-426614174000OptionalFIREBLOCKS_RAW_KEY_PATHPath to PEM key for Fireblocks Integration~/.fireblocks.pemOptionalFIREBLOCKS_VAULT_ACCOUNT_IDVault Account ID for Fireblocks Integration7OptionalVia KilnConfigTheKilnConfigrequired to initialize the API is defined
as follows:classKilnConfig:"""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 configsclassIntegrationConfig:"""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 dictFor example:importkiln_connectconfig=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',}})])FireblocksHere is the expected configuration for the optional Fireblocks
integration:{'api_token':'<Fireblocks API token>','raw_key_path':'<Fireblocks raw key path>','vault_account_id':<FireblocksVaultAccountID>,'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 viaKilnConnect.eth.stake)UsageThe simplest way to start using the SDK is to look at examples
implemented in theCLI; it is kept simple to showcase the SDK.API facilities:AccountsEthereumSolanaTezosIntegrations facilities:Fireblocks