bittensor.core.extrinsics.pallets.proxy#

Classes#

Proxy

Factory class for creating GenericCall objects for Proxy pallet functions.

Module Contents#

class bittensor.core.extrinsics.pallets.proxy.Proxy#

Bases: bittensor.core.extrinsics.pallets.base.CallBuilder

Factory class for creating GenericCall objects for Proxy pallet functions.

This class provides methods to create GenericCall instances for all Proxy pallet extrinsics.

Works with both sync (Subtensor) and async (AsyncSubtensor) instances. For async operations, pass an AsyncSubtensor instance and await the result.

Example

# Sync usage

call = Proxy(subtensor).add_proxy(delegate=”5DE..”, proxy_type=”Any”, delay=0)

response = subtensor.sign_and_send_extrinsic(call=call, …)

# Async usage

call = await Proxy(async_subtensor).add_proxy(delegate=”5DE..”, proxy_type=”Any”, delay=0)

response = await async_subtensor.sign_and_send_extrinsic(call=call, …)

add_proxy(delegate, proxy_type, delay)#

Add a proxy relationship between existing wallets.

Parameters:
  • delegate (str) – The SS58 address of the delegate proxy account.

  • proxy_type (str) – The type of proxy permissions (e.g., Any, NonTransfer, Staking). For available proxy types and their permissions, see the documentation link in the Notes section below.

  • delay (int) – Optionally, include a delay in blocks. The time-lock period for proxy announcements. A delay of 0 means immediate execution without announcements.

Returns:

GenericCall instance for the Proxy.addProxy extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

announce(real, call_hash)#

Create a call to announce a future proxied operation.

Parameters:
  • real (str) – The SS58 address of the real account on whose behalf the call will be made.

  • call_hash (str) – The hash of the call that will be executed in the future (hex string with 0x prefix).

Returns:

GenericCall instance for the Proxy.announce extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

  • A deposit is required when making an announcement. The deposit is returned when the announcement is executed, rejected, or removed. The announcement can be executed after the delay period has passed.

  • See Working with Proxies: <https://docs.learnbittensor.org/keys/proxies/create-proxy>

create_pure(proxy_type, delay, index)#

Create a pure proxy account.

Parameters:
  • proxy_type (str) – The type of proxy permissions for the pure proxy (e.g., Any, NonTransfer, Staking). For available proxy types and their permissions, see the documentation link in the Notes section below.

  • delay (int) – Optionally, include a delay in blocks. The time-lock period for proxy announcements. A delay of 0 means immediate execution without announcements.

  • index (int) – A salt value (u16, range 0-65535) used to generate unique pure proxy addresses. This should generally be left as 0 unless you are creating batches of proxies. Must be preserved for kill_pure.

Returns:

GenericCall instance for the Proxy.createPure extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

kill_pure(spawner, proxy_type, index, height, ext_index)#

Destroy a pure proxy account.

Parameters:
  • spawner (str) – The SS58 address of the account that spawned the pure proxy (the account that called create_pure).

  • proxy_type (str) – The type of proxy permissions that were used when creating the pure proxy. Must match the value used in create_pure.

  • index (int) – The salt value (u16, range 0-65535) originally used in create_pure to generate this pure proxy’s address. Must match exactly the index used during creation.

  • height (int) – The block number at which the pure proxy was created. This is returned in the PureCreated event from create_pure.

  • ext_index (int) – The extrinsic index within the block at which the pure proxy was created. This is returned in the PureCreated event from create_pure.

Returns:

GenericCall instance for the Proxy.killPure extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Warning

All access to this account will be lost. Any funds remaining in the pure proxy account will become permanently inaccessible after this operation.

poke_deposit()#

Adjust proxy and announcement deposits based on current runtime values.

Returns:

GenericCall instance for the Proxy.pokeDeposit extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

  • This can be used by accounts to possibly lower their locked amount. The function automatically recalculates deposits for both proxy relationships and announcements for the signing account. The transaction fee is waived if the deposit amount has changed.

  • See Working with Proxies: <https://docs.learnbittensor.org/keys/proxies/create-proxy>

proxy(real, force_proxy_type, call)#

Create a call to execute an operation through a proxy relationship.

Parameters:
  • real (str) – The SS58 address of the real account on whose behalf the call is being made.

  • force_proxy_type (Optional[str]) – The type of proxy to use for the call. If None, any proxy type can be used. Otherwise, must match one of the allowed proxy types that the signing account has for the real account.

  • call (scalecodec.GenericCall) – The inner call to be executed on behalf of the real account.

Returns:

GenericCall instance for the Proxy.proxy extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

proxy_announced(delegate, real, force_proxy_type, call)#

Create a call to execute a previously announced proxied operation.

Parameters:
  • delegate (str) – The SS58 address of the delegate proxy account that made the announcement.

  • real (str) – The SS58 address of the real account on whose behalf the call will be made.

  • force_proxy_type (Optional[str]) – The type of proxy to use for the call. If None, any proxy type can be used. Otherwise, must match one of the allowed proxy types.

  • call (scalecodec.GenericCall) – The inner call to be executed on behalf of the real account. The hash of this call must match the call_hash that was announced.

Returns:

GenericCall instance for the Proxy.proxyAnnounced extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

reject_announcement(delegate, call_hash)#

Reject a proxy announcement.

Parameters:
  • delegate (str) – The SS58 address of the delegate proxy account whose announcement is being rejected.

  • call_hash (str) – The hash of the call that was announced and is now being rejected (hex string with 0x prefix).

Returns:

GenericCall instance for the Proxy.rejectAnnouncement extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

remove_announcement(real, call_hash)#

Remove an announcement made by the signing proxy account.

Parameters:
  • real (str) – The SS58 address of the real account on whose behalf the call was announced.

  • call_hash (str) – The hash of the call that was announced and is now being removed (hex string with 0x prefix).

Returns:

GenericCall instance for the Proxy.removeAnnouncement extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

remove_proxies()#

Remove all proxy relationships for the signing account.

Returns:

GenericCall instance for the Proxy.removeProxies extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call

Notes

remove_proxy(delegate, proxy_type, delay)#

Remove a specific proxy relationship.

Parameters:
  • delegate (str) – The SS58 address of the delegate proxy account to remove.

  • proxy_type (str) – The type of proxy permissions to remove. Must match the value used when the proxy was added.

  • delay (int) – The announcement delay value (in blocks) for the proxy being removed. Must exactly match the delay value that was set when the proxy was originally added. This is a required identifier for the specific proxy relationship.

Returns:

GenericCall instance for the Proxy.removeProxy extrinsic.

Return type:

bittensor.core.extrinsics.pallets.base.Call