Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

Users can revoke delegation at any time, which removes the server’s ability to sign transactions on their behalf.

Revoke delegation

using DynamicSDK.Core;
using System.Collections.Generic;

// Revoke delegation for specific wallets
await DynamicSDK.Instance.Wallets.Waas.Delegation.RevokeDelegation(
    new List<DelegationWalletIdentifier>
    {
        new()
        {
            ChainName = ChainEnum.Evm,
            AccountAddress = wallet.Address,
        }
    }
);

Debug.Log("Delegation revoked successfully");

Revoke all delegations

To revoke delegation for all wallets:
var wallets = DynamicSDK.Instance.Wallets.UserWallets;

var identifiers = new List<DelegationWalletIdentifier>();

foreach (var wallet in wallets)
{
    ChainEnum chain = wallet.Chain.ToUpper() switch
    {
        "SOL" => ChainEnum.Sol,
        "EVM" => ChainEnum.Evm,
        _ => ChainEnum.Evm
    };
    
    identifiers.Add(new DelegationWalletIdentifier
    {
        ChainName = chain,
        AccountAddress = wallet.Address,
    });
}

await DynamicSDK.Instance.Wallets.Waas.Delegation.RevokeDelegation(identifiers);

Check delegation status after revocation

var status = DynamicSDK.Instance.Wallets.Waas.Delegation.GetDelegationStatusForWallet(wallet.Id);

if (status == null || status == "revoked")
{
    Debug.Log("Delegation has been revoked");
}

Complete example

using DynamicSDK.Core;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;

public class DelegationManager : MonoBehaviour
{
    public async void RevokeDelegationForWallet(BaseWallet wallet)
    {
        try
        {
            ChainEnum chain = wallet.Chain.ToUpper() switch
            {
                "SOL" => ChainEnum.Sol,
                "EVM" => ChainEnum.Evm,
                _ => ChainEnum.Evm
            };
            
            await DynamicSDK.Instance.Wallets.Waas.Delegation.RevokeDelegation(
                new List<DelegationWalletIdentifier>
                {
                    new()
                    {
                        ChainName = chain,
                        AccountAddress = wallet.Address,
                    }
                }
            );
            
            Debug.Log($"Delegation revoked for {wallet.Address}");
        }
        catch (System.Exception e)
        {
            Debug.LogError($"Failed to revoke delegation: {e.Message}");
        }
    }
    
    public async void RevokeAllDelegations()
    {
        var wallets = DynamicSDK.Instance.Wallets.UserWallets;
        
        foreach (var wallet in wallets)
        {
            await RevokeDelegationForWallet(wallet);
        }
        
        Debug.Log("All delegations revoked");
    }
}

What happens after revocation

  • The server’s encrypted key shares are invalidated
  • Any pending server-side operations will fail
  • The user can re-delegate at any time if needed

Next steps