// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"log"
	"reflect"

	"github.com/google/uuid"
	"github.com/lightsparkdev/spark/so/ent/migrate"

	"entgo.io/ent"
	"entgo.io/ent/dialect"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/lightsparkdev/spark/so/ent/blockheight"
	"github.com/lightsparkdev/spark/so/ent/cooperativeexit"
	"github.com/lightsparkdev/spark/so/ent/depositaddress"
	"github.com/lightsparkdev/spark/so/ent/entitydkgkey"
	"github.com/lightsparkdev/spark/so/ent/gossip"
	"github.com/lightsparkdev/spark/so/ent/l1tokencreate"
	"github.com/lightsparkdev/spark/so/ent/paymentintent"
	"github.com/lightsparkdev/spark/so/ent/pendingsendtransfer"
	"github.com/lightsparkdev/spark/so/ent/preimagerequest"
	"github.com/lightsparkdev/spark/so/ent/preimageshare"
	"github.com/lightsparkdev/spark/so/ent/signingcommitment"
	"github.com/lightsparkdev/spark/so/ent/signingkeyshare"
	"github.com/lightsparkdev/spark/so/ent/signingnonce"
	"github.com/lightsparkdev/spark/so/ent/sparkinvoice"
	"github.com/lightsparkdev/spark/so/ent/tokencreate"
	"github.com/lightsparkdev/spark/so/ent/tokenfreeze"
	"github.com/lightsparkdev/spark/so/ent/tokenmint"
	"github.com/lightsparkdev/spark/so/ent/tokenoutput"
	"github.com/lightsparkdev/spark/so/ent/tokenpartialrevocationsecretshare"
	"github.com/lightsparkdev/spark/so/ent/tokentransaction"
	"github.com/lightsparkdev/spark/so/ent/tokentransactionpeersignature"
	"github.com/lightsparkdev/spark/so/ent/transfer"
	"github.com/lightsparkdev/spark/so/ent/transferleaf"
	"github.com/lightsparkdev/spark/so/ent/tree"
	"github.com/lightsparkdev/spark/so/ent/treenode"
	"github.com/lightsparkdev/spark/so/ent/usersignedtransaction"
	"github.com/lightsparkdev/spark/so/ent/utxo"
	"github.com/lightsparkdev/spark/so/ent/utxoswap"

	stdsql "database/sql"
)

// Client is the client that holds all ent builders.
type Client struct {
	config
	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// BlockHeight is the client for interacting with the BlockHeight builders.
	BlockHeight *BlockHeightClient
	// CooperativeExit is the client for interacting with the CooperativeExit builders.
	CooperativeExit *CooperativeExitClient
	// DepositAddress is the client for interacting with the DepositAddress builders.
	DepositAddress *DepositAddressClient
	// EntityDkgKey is the client for interacting with the EntityDkgKey builders.
	EntityDkgKey *EntityDkgKeyClient
	// Gossip is the client for interacting with the Gossip builders.
	Gossip *GossipClient
	// L1TokenCreate is the client for interacting with the L1TokenCreate builders.
	L1TokenCreate *L1TokenCreateClient
	// PaymentIntent is the client for interacting with the PaymentIntent builders.
	PaymentIntent *PaymentIntentClient
	// PendingSendTransfer is the client for interacting with the PendingSendTransfer builders.
	PendingSendTransfer *PendingSendTransferClient
	// PreimageRequest is the client for interacting with the PreimageRequest builders.
	PreimageRequest *PreimageRequestClient
	// PreimageShare is the client for interacting with the PreimageShare builders.
	PreimageShare *PreimageShareClient
	// SigningCommitment is the client for interacting with the SigningCommitment builders.
	SigningCommitment *SigningCommitmentClient
	// SigningKeyshare is the client for interacting with the SigningKeyshare builders.
	SigningKeyshare *SigningKeyshareClient
	// SigningNonce is the client for interacting with the SigningNonce builders.
	SigningNonce *SigningNonceClient
	// SparkInvoice is the client for interacting with the SparkInvoice builders.
	SparkInvoice *SparkInvoiceClient
	// TokenCreate is the client for interacting with the TokenCreate builders.
	TokenCreate *TokenCreateClient
	// TokenFreeze is the client for interacting with the TokenFreeze builders.
	TokenFreeze *TokenFreezeClient
	// TokenMint is the client for interacting with the TokenMint builders.
	TokenMint *TokenMintClient
	// TokenOutput is the client for interacting with the TokenOutput builders.
	TokenOutput *TokenOutputClient
	// TokenPartialRevocationSecretShare is the client for interacting with the TokenPartialRevocationSecretShare builders.
	TokenPartialRevocationSecretShare *TokenPartialRevocationSecretShareClient
	// TokenTransaction is the client for interacting with the TokenTransaction builders.
	TokenTransaction *TokenTransactionClient
	// TokenTransactionPeerSignature is the client for interacting with the TokenTransactionPeerSignature builders.
	TokenTransactionPeerSignature *TokenTransactionPeerSignatureClient
	// Transfer is the client for interacting with the Transfer builders.
	Transfer *TransferClient
	// TransferLeaf is the client for interacting with the TransferLeaf builders.
	TransferLeaf *TransferLeafClient
	// Tree is the client for interacting with the Tree builders.
	Tree *TreeClient
	// TreeNode is the client for interacting with the TreeNode builders.
	TreeNode *TreeNodeClient
	// UserSignedTransaction is the client for interacting with the UserSignedTransaction builders.
	UserSignedTransaction *UserSignedTransactionClient
	// Utxo is the client for interacting with the Utxo builders.
	Utxo *UtxoClient
	// UtxoSwap is the client for interacting with the UtxoSwap builders.
	UtxoSwap *UtxoSwapClient
}

// NewClient creates a new client configured with the given options.
func NewClient(opts ...Option) *Client {
	client := &Client{config: newConfig(opts...)}
	client.init()
	return client
}

func (c *Client) init() {
	c.Schema = migrate.NewSchema(c.driver)
	c.BlockHeight = NewBlockHeightClient(c.config)
	c.CooperativeExit = NewCooperativeExitClient(c.config)
	c.DepositAddress = NewDepositAddressClient(c.config)
	c.EntityDkgKey = NewEntityDkgKeyClient(c.config)
	c.Gossip = NewGossipClient(c.config)
	c.L1TokenCreate = NewL1TokenCreateClient(c.config)
	c.PaymentIntent = NewPaymentIntentClient(c.config)
	c.PendingSendTransfer = NewPendingSendTransferClient(c.config)
	c.PreimageRequest = NewPreimageRequestClient(c.config)
	c.PreimageShare = NewPreimageShareClient(c.config)
	c.SigningCommitment = NewSigningCommitmentClient(c.config)
	c.SigningKeyshare = NewSigningKeyshareClient(c.config)
	c.SigningNonce = NewSigningNonceClient(c.config)
	c.SparkInvoice = NewSparkInvoiceClient(c.config)
	c.TokenCreate = NewTokenCreateClient(c.config)
	c.TokenFreeze = NewTokenFreezeClient(c.config)
	c.TokenMint = NewTokenMintClient(c.config)
	c.TokenOutput = NewTokenOutputClient(c.config)
	c.TokenPartialRevocationSecretShare = NewTokenPartialRevocationSecretShareClient(c.config)
	c.TokenTransaction = NewTokenTransactionClient(c.config)
	c.TokenTransactionPeerSignature = NewTokenTransactionPeerSignatureClient(c.config)
	c.Transfer = NewTransferClient(c.config)
	c.TransferLeaf = NewTransferLeafClient(c.config)
	c.Tree = NewTreeClient(c.config)
	c.TreeNode = NewTreeNodeClient(c.config)
	c.UserSignedTransaction = NewUserSignedTransactionClient(c.config)
	c.Utxo = NewUtxoClient(c.config)
	c.UtxoSwap = NewUtxoSwapClient(c.config)
}

type (
	// config is the configuration for the client and its builder.
	config struct {
		// driver used for executing database requests.
		driver dialect.Driver
		// debug enable a debug logging.
		debug bool
		// log used for logging on debug mode.
		log func(...any)
		// hooks to execute on mutations.
		hooks *hooks
		// interceptors to execute on queries.
		inters *inters
	}
	// Option function to configure the client.
	Option func(*config)
)

// newConfig creates a new config for the client.
func newConfig(opts ...Option) config {
	cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
	cfg.options(opts...)
	return cfg
}

// options applies the options on the config object.
func (c *config) options(opts ...Option) {
	for _, opt := range opts {
		opt(c)
	}
	if c.debug {
		c.driver = dialect.Debug(c.driver, c.log)
	}
}

// Debug enables debug logging on the ent.Driver.
func Debug() Option {
	return func(c *config) {
		c.debug = true
	}
}

// Log sets the logging function for debug mode.
func Log(fn func(...any)) Option {
	return func(c *config) {
		c.log = fn
	}
}

// Driver configures the client driver.
func Driver(driver dialect.Driver) Option {
	return func(c *config) {
		c.driver = driver
	}
}

// Open opens a database/sql.DB specified by the driver name and
// the data source name, and returns a new client attached to it.
// Optional parameters can be added for configuring the client.
func Open(driverName, dataSourceName string, options ...Option) (*Client, error) {
	switch driverName {
	case dialect.MySQL, dialect.Postgres, dialect.SQLite:
		drv, err := sql.Open(driverName, dataSourceName)
		if err != nil {
			return nil, err
		}
		return NewClient(append(options, Driver(drv))...), nil
	default:
		return nil, fmt.Errorf("unsupported driver: %q", driverName)
	}
}

// ErrTxStarted is returned when trying to start a new transaction from a transactional client.
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

// Tx returns a new transactional client. The provided context
// is used until the transaction is committed or rolled back.
func (c *Client) Tx(ctx context.Context) (*Tx, error) {
	if _, ok := c.driver.(*txDriver); ok {
		return nil, ErrTxStarted
	}
	tx, err := newTx(ctx, c.driver)
	if err != nil {
		return nil, fmt.Errorf("ent: starting a transaction: %w", err)
	}
	cfg := c.config
	cfg.driver = tx
	return &Tx{
		ctx:                               ctx,
		config:                            cfg,
		BlockHeight:                       NewBlockHeightClient(cfg),
		CooperativeExit:                   NewCooperativeExitClient(cfg),
		DepositAddress:                    NewDepositAddressClient(cfg),
		EntityDkgKey:                      NewEntityDkgKeyClient(cfg),
		Gossip:                            NewGossipClient(cfg),
		L1TokenCreate:                     NewL1TokenCreateClient(cfg),
		PaymentIntent:                     NewPaymentIntentClient(cfg),
		PendingSendTransfer:               NewPendingSendTransferClient(cfg),
		PreimageRequest:                   NewPreimageRequestClient(cfg),
		PreimageShare:                     NewPreimageShareClient(cfg),
		SigningCommitment:                 NewSigningCommitmentClient(cfg),
		SigningKeyshare:                   NewSigningKeyshareClient(cfg),
		SigningNonce:                      NewSigningNonceClient(cfg),
		SparkInvoice:                      NewSparkInvoiceClient(cfg),
		TokenCreate:                       NewTokenCreateClient(cfg),
		TokenFreeze:                       NewTokenFreezeClient(cfg),
		TokenMint:                         NewTokenMintClient(cfg),
		TokenOutput:                       NewTokenOutputClient(cfg),
		TokenPartialRevocationSecretShare: NewTokenPartialRevocationSecretShareClient(cfg),
		TokenTransaction:                  NewTokenTransactionClient(cfg),
		TokenTransactionPeerSignature:     NewTokenTransactionPeerSignatureClient(cfg),
		Transfer:                          NewTransferClient(cfg),
		TransferLeaf:                      NewTransferLeafClient(cfg),
		Tree:                              NewTreeClient(cfg),
		TreeNode:                          NewTreeNodeClient(cfg),
		UserSignedTransaction:             NewUserSignedTransactionClient(cfg),
		Utxo:                              NewUtxoClient(cfg),
		UtxoSwap:                          NewUtxoSwapClient(cfg),
	}, nil
}

// BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
	if _, ok := c.driver.(*txDriver); ok {
		return nil, errors.New("ent: cannot start a transaction within a transaction")
	}
	tx, err := c.driver.(interface {
		BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
	}).BeginTx(ctx, opts)
	if err != nil {
		return nil, fmt.Errorf("ent: starting a transaction: %w", err)
	}
	cfg := c.config
	cfg.driver = &txDriver{tx: tx, drv: c.driver}
	return &Tx{
		ctx:                               ctx,
		config:                            cfg,
		BlockHeight:                       NewBlockHeightClient(cfg),
		CooperativeExit:                   NewCooperativeExitClient(cfg),
		DepositAddress:                    NewDepositAddressClient(cfg),
		EntityDkgKey:                      NewEntityDkgKeyClient(cfg),
		Gossip:                            NewGossipClient(cfg),
		L1TokenCreate:                     NewL1TokenCreateClient(cfg),
		PaymentIntent:                     NewPaymentIntentClient(cfg),
		PendingSendTransfer:               NewPendingSendTransferClient(cfg),
		PreimageRequest:                   NewPreimageRequestClient(cfg),
		PreimageShare:                     NewPreimageShareClient(cfg),
		SigningCommitment:                 NewSigningCommitmentClient(cfg),
		SigningKeyshare:                   NewSigningKeyshareClient(cfg),
		SigningNonce:                      NewSigningNonceClient(cfg),
		SparkInvoice:                      NewSparkInvoiceClient(cfg),
		TokenCreate:                       NewTokenCreateClient(cfg),
		TokenFreeze:                       NewTokenFreezeClient(cfg),
		TokenMint:                         NewTokenMintClient(cfg),
		TokenOutput:                       NewTokenOutputClient(cfg),
		TokenPartialRevocationSecretShare: NewTokenPartialRevocationSecretShareClient(cfg),
		TokenTransaction:                  NewTokenTransactionClient(cfg),
		TokenTransactionPeerSignature:     NewTokenTransactionPeerSignatureClient(cfg),
		Transfer:                          NewTransferClient(cfg),
		TransferLeaf:                      NewTransferLeafClient(cfg),
		Tree:                              NewTreeClient(cfg),
		TreeNode:                          NewTreeNodeClient(cfg),
		UserSignedTransaction:             NewUserSignedTransactionClient(cfg),
		Utxo:                              NewUtxoClient(cfg),
		UtxoSwap:                          NewUtxoSwapClient(cfg),
	}, nil
}

// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
//
//	client.Debug().
//		BlockHeight.
//		Query().
//		Count(ctx)
func (c *Client) Debug() *Client {
	if c.debug {
		return c
	}
	cfg := c.config
	cfg.driver = dialect.Debug(c.driver, c.log)
	client := &Client{config: cfg}
	client.init()
	return client
}

// Close closes the database connection and prevents new queries from starting.
func (c *Client) Close() error {
	return c.driver.Close()
}

// Use adds the mutation hooks to all the entity clients.
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
func (c *Client) Use(hooks ...Hook) {
	for _, n := range []interface{ Use(...Hook) }{
		c.BlockHeight, c.CooperativeExit, c.DepositAddress, c.EntityDkgKey, c.Gossip,
		c.L1TokenCreate, c.PaymentIntent, c.PendingSendTransfer, c.PreimageRequest,
		c.PreimageShare, c.SigningCommitment, c.SigningKeyshare, c.SigningNonce,
		c.SparkInvoice, c.TokenCreate, c.TokenFreeze, c.TokenMint, c.TokenOutput,
		c.TokenPartialRevocationSecretShare, c.TokenTransaction,
		c.TokenTransactionPeerSignature, c.Transfer, c.TransferLeaf, c.Tree,
		c.TreeNode, c.UserSignedTransaction, c.Utxo, c.UtxoSwap,
	} {
		n.Use(hooks...)
	}
}

// Intercept adds the query interceptors to all the entity clients.
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
func (c *Client) Intercept(interceptors ...Interceptor) {
	for _, n := range []interface{ Intercept(...Interceptor) }{
		c.BlockHeight, c.CooperativeExit, c.DepositAddress, c.EntityDkgKey, c.Gossip,
		c.L1TokenCreate, c.PaymentIntent, c.PendingSendTransfer, c.PreimageRequest,
		c.PreimageShare, c.SigningCommitment, c.SigningKeyshare, c.SigningNonce,
		c.SparkInvoice, c.TokenCreate, c.TokenFreeze, c.TokenMint, c.TokenOutput,
		c.TokenPartialRevocationSecretShare, c.TokenTransaction,
		c.TokenTransactionPeerSignature, c.Transfer, c.TransferLeaf, c.Tree,
		c.TreeNode, c.UserSignedTransaction, c.Utxo, c.UtxoSwap,
	} {
		n.Intercept(interceptors...)
	}
}

// Mutate implements the ent.Mutator interface.
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
	switch m := m.(type) {
	case *BlockHeightMutation:
		return c.BlockHeight.mutate(ctx, m)
	case *CooperativeExitMutation:
		return c.CooperativeExit.mutate(ctx, m)
	case *DepositAddressMutation:
		return c.DepositAddress.mutate(ctx, m)
	case *EntityDkgKeyMutation:
		return c.EntityDkgKey.mutate(ctx, m)
	case *GossipMutation:
		return c.Gossip.mutate(ctx, m)
	case *L1TokenCreateMutation:
		return c.L1TokenCreate.mutate(ctx, m)
	case *PaymentIntentMutation:
		return c.PaymentIntent.mutate(ctx, m)
	case *PendingSendTransferMutation:
		return c.PendingSendTransfer.mutate(ctx, m)
	case *PreimageRequestMutation:
		return c.PreimageRequest.mutate(ctx, m)
	case *PreimageShareMutation:
		return c.PreimageShare.mutate(ctx, m)
	case *SigningCommitmentMutation:
		return c.SigningCommitment.mutate(ctx, m)
	case *SigningKeyshareMutation:
		return c.SigningKeyshare.mutate(ctx, m)
	case *SigningNonceMutation:
		return c.SigningNonce.mutate(ctx, m)
	case *SparkInvoiceMutation:
		return c.SparkInvoice.mutate(ctx, m)
	case *TokenCreateMutation:
		return c.TokenCreate.mutate(ctx, m)
	case *TokenFreezeMutation:
		return c.TokenFreeze.mutate(ctx, m)
	case *TokenMintMutation:
		return c.TokenMint.mutate(ctx, m)
	case *TokenOutputMutation:
		return c.TokenOutput.mutate(ctx, m)
	case *TokenPartialRevocationSecretShareMutation:
		return c.TokenPartialRevocationSecretShare.mutate(ctx, m)
	case *TokenTransactionMutation:
		return c.TokenTransaction.mutate(ctx, m)
	case *TokenTransactionPeerSignatureMutation:
		return c.TokenTransactionPeerSignature.mutate(ctx, m)
	case *TransferMutation:
		return c.Transfer.mutate(ctx, m)
	case *TransferLeafMutation:
		return c.TransferLeaf.mutate(ctx, m)
	case *TreeMutation:
		return c.Tree.mutate(ctx, m)
	case *TreeNodeMutation:
		return c.TreeNode.mutate(ctx, m)
	case *UserSignedTransactionMutation:
		return c.UserSignedTransaction.mutate(ctx, m)
	case *UtxoMutation:
		return c.Utxo.mutate(ctx, m)
	case *UtxoSwapMutation:
		return c.UtxoSwap.mutate(ctx, m)
	default:
		return nil, fmt.Errorf("ent: unknown mutation type %T", m)
	}
}

// BlockHeightClient is a client for the BlockHeight schema.
type BlockHeightClient struct {
	config
}

// NewBlockHeightClient returns a client for the BlockHeight from the given config.
func NewBlockHeightClient(c config) *BlockHeightClient {
	return &BlockHeightClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `blockheight.Hooks(f(g(h())))`.
func (c *BlockHeightClient) Use(hooks ...Hook) {
	c.hooks.BlockHeight = append(c.hooks.BlockHeight, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `blockheight.Intercept(f(g(h())))`.
func (c *BlockHeightClient) Intercept(interceptors ...Interceptor) {
	c.inters.BlockHeight = append(c.inters.BlockHeight, interceptors...)
}

// Create returns a builder for creating a BlockHeight entity.
func (c *BlockHeightClient) Create() *BlockHeightCreate {
	mutation := newBlockHeightMutation(c.config, OpCreate)
	return &BlockHeightCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of BlockHeight entities.
func (c *BlockHeightClient) CreateBulk(builders ...*BlockHeightCreate) *BlockHeightCreateBulk {
	return &BlockHeightCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *BlockHeightClient) MapCreateBulk(slice any, setFunc func(*BlockHeightCreate, int)) *BlockHeightCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &BlockHeightCreateBulk{err: fmt.Errorf("calling to BlockHeightClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*BlockHeightCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &BlockHeightCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for BlockHeight.
func (c *BlockHeightClient) Update() *BlockHeightUpdate {
	mutation := newBlockHeightMutation(c.config, OpUpdate)
	return &BlockHeightUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *BlockHeightClient) UpdateOne(bh *BlockHeight) *BlockHeightUpdateOne {
	mutation := newBlockHeightMutation(c.config, OpUpdateOne, withBlockHeight(bh))
	return &BlockHeightUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *BlockHeightClient) UpdateOneID(id uuid.UUID) *BlockHeightUpdateOne {
	mutation := newBlockHeightMutation(c.config, OpUpdateOne, withBlockHeightID(id))
	return &BlockHeightUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for BlockHeight.
func (c *BlockHeightClient) Delete() *BlockHeightDelete {
	mutation := newBlockHeightMutation(c.config, OpDelete)
	return &BlockHeightDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *BlockHeightClient) DeleteOne(bh *BlockHeight) *BlockHeightDeleteOne {
	return c.DeleteOneID(bh.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *BlockHeightClient) DeleteOneID(id uuid.UUID) *BlockHeightDeleteOne {
	builder := c.Delete().Where(blockheight.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &BlockHeightDeleteOne{builder}
}

// Query returns a query builder for BlockHeight.
func (c *BlockHeightClient) Query() *BlockHeightQuery {
	return &BlockHeightQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeBlockHeight},
		inters: c.Interceptors(),
	}
}

// Get returns a BlockHeight entity by its id.
func (c *BlockHeightClient) Get(ctx context.Context, id uuid.UUID) (*BlockHeight, error) {
	return c.Query().Where(blockheight.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *BlockHeightClient) GetX(ctx context.Context, id uuid.UUID) *BlockHeight {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *BlockHeightClient) Hooks() []Hook {
	return c.hooks.BlockHeight
}

// Interceptors returns the client interceptors.
func (c *BlockHeightClient) Interceptors() []Interceptor {
	return c.inters.BlockHeight
}

func (c *BlockHeightClient) mutate(ctx context.Context, m *BlockHeightMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&BlockHeightCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&BlockHeightUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&BlockHeightUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&BlockHeightDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown BlockHeight mutation op: %q", m.Op())
	}
}

// CooperativeExitClient is a client for the CooperativeExit schema.
type CooperativeExitClient struct {
	config
}

// NewCooperativeExitClient returns a client for the CooperativeExit from the given config.
func NewCooperativeExitClient(c config) *CooperativeExitClient {
	return &CooperativeExitClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `cooperativeexit.Hooks(f(g(h())))`.
func (c *CooperativeExitClient) Use(hooks ...Hook) {
	c.hooks.CooperativeExit = append(c.hooks.CooperativeExit, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `cooperativeexit.Intercept(f(g(h())))`.
func (c *CooperativeExitClient) Intercept(interceptors ...Interceptor) {
	c.inters.CooperativeExit = append(c.inters.CooperativeExit, interceptors...)
}

// Create returns a builder for creating a CooperativeExit entity.
func (c *CooperativeExitClient) Create() *CooperativeExitCreate {
	mutation := newCooperativeExitMutation(c.config, OpCreate)
	return &CooperativeExitCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of CooperativeExit entities.
func (c *CooperativeExitClient) CreateBulk(builders ...*CooperativeExitCreate) *CooperativeExitCreateBulk {
	return &CooperativeExitCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *CooperativeExitClient) MapCreateBulk(slice any, setFunc func(*CooperativeExitCreate, int)) *CooperativeExitCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &CooperativeExitCreateBulk{err: fmt.Errorf("calling to CooperativeExitClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*CooperativeExitCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &CooperativeExitCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for CooperativeExit.
func (c *CooperativeExitClient) Update() *CooperativeExitUpdate {
	mutation := newCooperativeExitMutation(c.config, OpUpdate)
	return &CooperativeExitUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *CooperativeExitClient) UpdateOne(ce *CooperativeExit) *CooperativeExitUpdateOne {
	mutation := newCooperativeExitMutation(c.config, OpUpdateOne, withCooperativeExit(ce))
	return &CooperativeExitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *CooperativeExitClient) UpdateOneID(id uuid.UUID) *CooperativeExitUpdateOne {
	mutation := newCooperativeExitMutation(c.config, OpUpdateOne, withCooperativeExitID(id))
	return &CooperativeExitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for CooperativeExit.
func (c *CooperativeExitClient) Delete() *CooperativeExitDelete {
	mutation := newCooperativeExitMutation(c.config, OpDelete)
	return &CooperativeExitDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *CooperativeExitClient) DeleteOne(ce *CooperativeExit) *CooperativeExitDeleteOne {
	return c.DeleteOneID(ce.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *CooperativeExitClient) DeleteOneID(id uuid.UUID) *CooperativeExitDeleteOne {
	builder := c.Delete().Where(cooperativeexit.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &CooperativeExitDeleteOne{builder}
}

// Query returns a query builder for CooperativeExit.
func (c *CooperativeExitClient) Query() *CooperativeExitQuery {
	return &CooperativeExitQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeCooperativeExit},
		inters: c.Interceptors(),
	}
}

// Get returns a CooperativeExit entity by its id.
func (c *CooperativeExitClient) Get(ctx context.Context, id uuid.UUID) (*CooperativeExit, error) {
	return c.Query().Where(cooperativeexit.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *CooperativeExitClient) GetX(ctx context.Context, id uuid.UUID) *CooperativeExit {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTransfer queries the transfer edge of a CooperativeExit.
func (c *CooperativeExitClient) QueryTransfer(ce *CooperativeExit) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := ce.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(cooperativeexit.Table, cooperativeexit.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, cooperativeexit.TransferTable, cooperativeexit.TransferColumn),
		)
		fromV = sqlgraph.Neighbors(ce.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *CooperativeExitClient) Hooks() []Hook {
	return c.hooks.CooperativeExit
}

// Interceptors returns the client interceptors.
func (c *CooperativeExitClient) Interceptors() []Interceptor {
	return c.inters.CooperativeExit
}

func (c *CooperativeExitClient) mutate(ctx context.Context, m *CooperativeExitMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&CooperativeExitCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&CooperativeExitUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&CooperativeExitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&CooperativeExitDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown CooperativeExit mutation op: %q", m.Op())
	}
}

// DepositAddressClient is a client for the DepositAddress schema.
type DepositAddressClient struct {
	config
}

// NewDepositAddressClient returns a client for the DepositAddress from the given config.
func NewDepositAddressClient(c config) *DepositAddressClient {
	return &DepositAddressClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `depositaddress.Hooks(f(g(h())))`.
func (c *DepositAddressClient) Use(hooks ...Hook) {
	c.hooks.DepositAddress = append(c.hooks.DepositAddress, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `depositaddress.Intercept(f(g(h())))`.
func (c *DepositAddressClient) Intercept(interceptors ...Interceptor) {
	c.inters.DepositAddress = append(c.inters.DepositAddress, interceptors...)
}

// Create returns a builder for creating a DepositAddress entity.
func (c *DepositAddressClient) Create() *DepositAddressCreate {
	mutation := newDepositAddressMutation(c.config, OpCreate)
	return &DepositAddressCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of DepositAddress entities.
func (c *DepositAddressClient) CreateBulk(builders ...*DepositAddressCreate) *DepositAddressCreateBulk {
	return &DepositAddressCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *DepositAddressClient) MapCreateBulk(slice any, setFunc func(*DepositAddressCreate, int)) *DepositAddressCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &DepositAddressCreateBulk{err: fmt.Errorf("calling to DepositAddressClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*DepositAddressCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &DepositAddressCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for DepositAddress.
func (c *DepositAddressClient) Update() *DepositAddressUpdate {
	mutation := newDepositAddressMutation(c.config, OpUpdate)
	return &DepositAddressUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *DepositAddressClient) UpdateOne(da *DepositAddress) *DepositAddressUpdateOne {
	mutation := newDepositAddressMutation(c.config, OpUpdateOne, withDepositAddress(da))
	return &DepositAddressUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *DepositAddressClient) UpdateOneID(id uuid.UUID) *DepositAddressUpdateOne {
	mutation := newDepositAddressMutation(c.config, OpUpdateOne, withDepositAddressID(id))
	return &DepositAddressUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for DepositAddress.
func (c *DepositAddressClient) Delete() *DepositAddressDelete {
	mutation := newDepositAddressMutation(c.config, OpDelete)
	return &DepositAddressDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *DepositAddressClient) DeleteOne(da *DepositAddress) *DepositAddressDeleteOne {
	return c.DeleteOneID(da.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *DepositAddressClient) DeleteOneID(id uuid.UUID) *DepositAddressDeleteOne {
	builder := c.Delete().Where(depositaddress.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &DepositAddressDeleteOne{builder}
}

// Query returns a query builder for DepositAddress.
func (c *DepositAddressClient) Query() *DepositAddressQuery {
	return &DepositAddressQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeDepositAddress},
		inters: c.Interceptors(),
	}
}

// Get returns a DepositAddress entity by its id.
func (c *DepositAddressClient) Get(ctx context.Context, id uuid.UUID) (*DepositAddress, error) {
	return c.Query().Where(depositaddress.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *DepositAddressClient) GetX(ctx context.Context, id uuid.UUID) *DepositAddress {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySigningKeyshare queries the signing_keyshare edge of a DepositAddress.
func (c *DepositAddressClient) QuerySigningKeyshare(da *DepositAddress) *SigningKeyshareQuery {
	query := (&SigningKeyshareClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := da.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(depositaddress.Table, depositaddress.FieldID, id),
			sqlgraph.To(signingkeyshare.Table, signingkeyshare.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, depositaddress.SigningKeyshareTable, depositaddress.SigningKeyshareColumn),
		)
		fromV = sqlgraph.Neighbors(da.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryUtxo queries the utxo edge of a DepositAddress.
func (c *DepositAddressClient) QueryUtxo(da *DepositAddress) *UtxoQuery {
	query := (&UtxoClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := da.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(depositaddress.Table, depositaddress.FieldID, id),
			sqlgraph.To(utxo.Table, utxo.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, depositaddress.UtxoTable, depositaddress.UtxoColumn),
		)
		fromV = sqlgraph.Neighbors(da.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryUtxoswaps queries the utxoswaps edge of a DepositAddress.
func (c *DepositAddressClient) QueryUtxoswaps(da *DepositAddress) *UtxoSwapQuery {
	query := (&UtxoSwapClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := da.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(depositaddress.Table, depositaddress.FieldID, id),
			sqlgraph.To(utxoswap.Table, utxoswap.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, depositaddress.UtxoswapsTable, depositaddress.UtxoswapsColumn),
		)
		fromV = sqlgraph.Neighbors(da.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTree queries the tree edge of a DepositAddress.
func (c *DepositAddressClient) QueryTree(da *DepositAddress) *TreeQuery {
	query := (&TreeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := da.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(depositaddress.Table, depositaddress.FieldID, id),
			sqlgraph.To(tree.Table, tree.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, depositaddress.TreeTable, depositaddress.TreeColumn),
		)
		fromV = sqlgraph.Neighbors(da.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *DepositAddressClient) Hooks() []Hook {
	hooks := c.hooks.DepositAddress
	return append(hooks[:len(hooks):len(hooks)], depositaddress.Hooks[:]...)
}

// Interceptors returns the client interceptors.
func (c *DepositAddressClient) Interceptors() []Interceptor {
	return c.inters.DepositAddress
}

func (c *DepositAddressClient) mutate(ctx context.Context, m *DepositAddressMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&DepositAddressCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&DepositAddressUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&DepositAddressUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&DepositAddressDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown DepositAddress mutation op: %q", m.Op())
	}
}

// EntityDkgKeyClient is a client for the EntityDkgKey schema.
type EntityDkgKeyClient struct {
	config
}

// NewEntityDkgKeyClient returns a client for the EntityDkgKey from the given config.
func NewEntityDkgKeyClient(c config) *EntityDkgKeyClient {
	return &EntityDkgKeyClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `entitydkgkey.Hooks(f(g(h())))`.
func (c *EntityDkgKeyClient) Use(hooks ...Hook) {
	c.hooks.EntityDkgKey = append(c.hooks.EntityDkgKey, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `entitydkgkey.Intercept(f(g(h())))`.
func (c *EntityDkgKeyClient) Intercept(interceptors ...Interceptor) {
	c.inters.EntityDkgKey = append(c.inters.EntityDkgKey, interceptors...)
}

// Create returns a builder for creating a EntityDkgKey entity.
func (c *EntityDkgKeyClient) Create() *EntityDkgKeyCreate {
	mutation := newEntityDkgKeyMutation(c.config, OpCreate)
	return &EntityDkgKeyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of EntityDkgKey entities.
func (c *EntityDkgKeyClient) CreateBulk(builders ...*EntityDkgKeyCreate) *EntityDkgKeyCreateBulk {
	return &EntityDkgKeyCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EntityDkgKeyClient) MapCreateBulk(slice any, setFunc func(*EntityDkgKeyCreate, int)) *EntityDkgKeyCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &EntityDkgKeyCreateBulk{err: fmt.Errorf("calling to EntityDkgKeyClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*EntityDkgKeyCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &EntityDkgKeyCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for EntityDkgKey.
func (c *EntityDkgKeyClient) Update() *EntityDkgKeyUpdate {
	mutation := newEntityDkgKeyMutation(c.config, OpUpdate)
	return &EntityDkgKeyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *EntityDkgKeyClient) UpdateOne(edk *EntityDkgKey) *EntityDkgKeyUpdateOne {
	mutation := newEntityDkgKeyMutation(c.config, OpUpdateOne, withEntityDkgKey(edk))
	return &EntityDkgKeyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *EntityDkgKeyClient) UpdateOneID(id uuid.UUID) *EntityDkgKeyUpdateOne {
	mutation := newEntityDkgKeyMutation(c.config, OpUpdateOne, withEntityDkgKeyID(id))
	return &EntityDkgKeyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for EntityDkgKey.
func (c *EntityDkgKeyClient) Delete() *EntityDkgKeyDelete {
	mutation := newEntityDkgKeyMutation(c.config, OpDelete)
	return &EntityDkgKeyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *EntityDkgKeyClient) DeleteOne(edk *EntityDkgKey) *EntityDkgKeyDeleteOne {
	return c.DeleteOneID(edk.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EntityDkgKeyClient) DeleteOneID(id uuid.UUID) *EntityDkgKeyDeleteOne {
	builder := c.Delete().Where(entitydkgkey.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &EntityDkgKeyDeleteOne{builder}
}

// Query returns a query builder for EntityDkgKey.
func (c *EntityDkgKeyClient) Query() *EntityDkgKeyQuery {
	return &EntityDkgKeyQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeEntityDkgKey},
		inters: c.Interceptors(),
	}
}

// Get returns a EntityDkgKey entity by its id.
func (c *EntityDkgKeyClient) Get(ctx context.Context, id uuid.UUID) (*EntityDkgKey, error) {
	return c.Query().Where(entitydkgkey.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *EntityDkgKeyClient) GetX(ctx context.Context, id uuid.UUID) *EntityDkgKey {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySigningKeyshare queries the signing_keyshare edge of a EntityDkgKey.
func (c *EntityDkgKeyClient) QuerySigningKeyshare(edk *EntityDkgKey) *SigningKeyshareQuery {
	query := (&SigningKeyshareClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := edk.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(entitydkgkey.Table, entitydkgkey.FieldID, id),
			sqlgraph.To(signingkeyshare.Table, signingkeyshare.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, entitydkgkey.SigningKeyshareTable, entitydkgkey.SigningKeyshareColumn),
		)
		fromV = sqlgraph.Neighbors(edk.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *EntityDkgKeyClient) Hooks() []Hook {
	return c.hooks.EntityDkgKey
}

// Interceptors returns the client interceptors.
func (c *EntityDkgKeyClient) Interceptors() []Interceptor {
	return c.inters.EntityDkgKey
}

func (c *EntityDkgKeyClient) mutate(ctx context.Context, m *EntityDkgKeyMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&EntityDkgKeyCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&EntityDkgKeyUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&EntityDkgKeyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&EntityDkgKeyDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown EntityDkgKey mutation op: %q", m.Op())
	}
}

// GossipClient is a client for the Gossip schema.
type GossipClient struct {
	config
}

// NewGossipClient returns a client for the Gossip from the given config.
func NewGossipClient(c config) *GossipClient {
	return &GossipClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `gossip.Hooks(f(g(h())))`.
func (c *GossipClient) Use(hooks ...Hook) {
	c.hooks.Gossip = append(c.hooks.Gossip, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `gossip.Intercept(f(g(h())))`.
func (c *GossipClient) Intercept(interceptors ...Interceptor) {
	c.inters.Gossip = append(c.inters.Gossip, interceptors...)
}

// Create returns a builder for creating a Gossip entity.
func (c *GossipClient) Create() *GossipCreate {
	mutation := newGossipMutation(c.config, OpCreate)
	return &GossipCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Gossip entities.
func (c *GossipClient) CreateBulk(builders ...*GossipCreate) *GossipCreateBulk {
	return &GossipCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *GossipClient) MapCreateBulk(slice any, setFunc func(*GossipCreate, int)) *GossipCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &GossipCreateBulk{err: fmt.Errorf("calling to GossipClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*GossipCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &GossipCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Gossip.
func (c *GossipClient) Update() *GossipUpdate {
	mutation := newGossipMutation(c.config, OpUpdate)
	return &GossipUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *GossipClient) UpdateOne(_go *Gossip) *GossipUpdateOne {
	mutation := newGossipMutation(c.config, OpUpdateOne, withGossip(_go))
	return &GossipUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *GossipClient) UpdateOneID(id uuid.UUID) *GossipUpdateOne {
	mutation := newGossipMutation(c.config, OpUpdateOne, withGossipID(id))
	return &GossipUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Gossip.
func (c *GossipClient) Delete() *GossipDelete {
	mutation := newGossipMutation(c.config, OpDelete)
	return &GossipDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *GossipClient) DeleteOne(_go *Gossip) *GossipDeleteOne {
	return c.DeleteOneID(_go.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *GossipClient) DeleteOneID(id uuid.UUID) *GossipDeleteOne {
	builder := c.Delete().Where(gossip.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &GossipDeleteOne{builder}
}

// Query returns a query builder for Gossip.
func (c *GossipClient) Query() *GossipQuery {
	return &GossipQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeGossip},
		inters: c.Interceptors(),
	}
}

// Get returns a Gossip entity by its id.
func (c *GossipClient) Get(ctx context.Context, id uuid.UUID) (*Gossip, error) {
	return c.Query().Where(gossip.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *GossipClient) GetX(ctx context.Context, id uuid.UUID) *Gossip {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *GossipClient) Hooks() []Hook {
	return c.hooks.Gossip
}

// Interceptors returns the client interceptors.
func (c *GossipClient) Interceptors() []Interceptor {
	return c.inters.Gossip
}

func (c *GossipClient) mutate(ctx context.Context, m *GossipMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&GossipCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&GossipUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&GossipUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&GossipDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Gossip mutation op: %q", m.Op())
	}
}

// L1TokenCreateClient is a client for the L1TokenCreate schema.
type L1TokenCreateClient struct {
	config
}

// NewL1TokenCreateClient returns a client for the L1TokenCreate from the given config.
func NewL1TokenCreateClient(c config) *L1TokenCreateClient {
	return &L1TokenCreateClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `l1tokencreate.Hooks(f(g(h())))`.
func (c *L1TokenCreateClient) Use(hooks ...Hook) {
	c.hooks.L1TokenCreate = append(c.hooks.L1TokenCreate, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `l1tokencreate.Intercept(f(g(h())))`.
func (c *L1TokenCreateClient) Intercept(interceptors ...Interceptor) {
	c.inters.L1TokenCreate = append(c.inters.L1TokenCreate, interceptors...)
}

// Create returns a builder for creating a L1TokenCreate entity.
func (c *L1TokenCreateClient) Create() *L1TokenCreateCreate {
	mutation := newL1TokenCreateMutation(c.config, OpCreate)
	return &L1TokenCreateCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of L1TokenCreate entities.
func (c *L1TokenCreateClient) CreateBulk(builders ...*L1TokenCreateCreate) *L1TokenCreateCreateBulk {
	return &L1TokenCreateCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *L1TokenCreateClient) MapCreateBulk(slice any, setFunc func(*L1TokenCreateCreate, int)) *L1TokenCreateCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &L1TokenCreateCreateBulk{err: fmt.Errorf("calling to L1TokenCreateClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*L1TokenCreateCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &L1TokenCreateCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for L1TokenCreate.
func (c *L1TokenCreateClient) Update() *L1TokenCreateUpdate {
	mutation := newL1TokenCreateMutation(c.config, OpUpdate)
	return &L1TokenCreateUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *L1TokenCreateClient) UpdateOne(lc *L1TokenCreate) *L1TokenCreateUpdateOne {
	mutation := newL1TokenCreateMutation(c.config, OpUpdateOne, withL1TokenCreate(lc))
	return &L1TokenCreateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *L1TokenCreateClient) UpdateOneID(id uuid.UUID) *L1TokenCreateUpdateOne {
	mutation := newL1TokenCreateMutation(c.config, OpUpdateOne, withL1TokenCreateID(id))
	return &L1TokenCreateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for L1TokenCreate.
func (c *L1TokenCreateClient) Delete() *L1TokenCreateDelete {
	mutation := newL1TokenCreateMutation(c.config, OpDelete)
	return &L1TokenCreateDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *L1TokenCreateClient) DeleteOne(lc *L1TokenCreate) *L1TokenCreateDeleteOne {
	return c.DeleteOneID(lc.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *L1TokenCreateClient) DeleteOneID(id uuid.UUID) *L1TokenCreateDeleteOne {
	builder := c.Delete().Where(l1tokencreate.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &L1TokenCreateDeleteOne{builder}
}

// Query returns a query builder for L1TokenCreate.
func (c *L1TokenCreateClient) Query() *L1TokenCreateQuery {
	return &L1TokenCreateQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeL1TokenCreate},
		inters: c.Interceptors(),
	}
}

// Get returns a L1TokenCreate entity by its id.
func (c *L1TokenCreateClient) Get(ctx context.Context, id uuid.UUID) (*L1TokenCreate, error) {
	return c.Query().Where(l1tokencreate.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *L1TokenCreateClient) GetX(ctx context.Context, id uuid.UUID) *L1TokenCreate {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *L1TokenCreateClient) Hooks() []Hook {
	return c.hooks.L1TokenCreate
}

// Interceptors returns the client interceptors.
func (c *L1TokenCreateClient) Interceptors() []Interceptor {
	return c.inters.L1TokenCreate
}

func (c *L1TokenCreateClient) mutate(ctx context.Context, m *L1TokenCreateMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&L1TokenCreateCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&L1TokenCreateUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&L1TokenCreateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&L1TokenCreateDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown L1TokenCreate mutation op: %q", m.Op())
	}
}

// PaymentIntentClient is a client for the PaymentIntent schema.
type PaymentIntentClient struct {
	config
}

// NewPaymentIntentClient returns a client for the PaymentIntent from the given config.
func NewPaymentIntentClient(c config) *PaymentIntentClient {
	return &PaymentIntentClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `paymentintent.Hooks(f(g(h())))`.
func (c *PaymentIntentClient) Use(hooks ...Hook) {
	c.hooks.PaymentIntent = append(c.hooks.PaymentIntent, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `paymentintent.Intercept(f(g(h())))`.
func (c *PaymentIntentClient) Intercept(interceptors ...Interceptor) {
	c.inters.PaymentIntent = append(c.inters.PaymentIntent, interceptors...)
}

// Create returns a builder for creating a PaymentIntent entity.
func (c *PaymentIntentClient) Create() *PaymentIntentCreate {
	mutation := newPaymentIntentMutation(c.config, OpCreate)
	return &PaymentIntentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of PaymentIntent entities.
func (c *PaymentIntentClient) CreateBulk(builders ...*PaymentIntentCreate) *PaymentIntentCreateBulk {
	return &PaymentIntentCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *PaymentIntentClient) MapCreateBulk(slice any, setFunc func(*PaymentIntentCreate, int)) *PaymentIntentCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &PaymentIntentCreateBulk{err: fmt.Errorf("calling to PaymentIntentClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*PaymentIntentCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &PaymentIntentCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for PaymentIntent.
func (c *PaymentIntentClient) Update() *PaymentIntentUpdate {
	mutation := newPaymentIntentMutation(c.config, OpUpdate)
	return &PaymentIntentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *PaymentIntentClient) UpdateOne(pi *PaymentIntent) *PaymentIntentUpdateOne {
	mutation := newPaymentIntentMutation(c.config, OpUpdateOne, withPaymentIntent(pi))
	return &PaymentIntentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *PaymentIntentClient) UpdateOneID(id uuid.UUID) *PaymentIntentUpdateOne {
	mutation := newPaymentIntentMutation(c.config, OpUpdateOne, withPaymentIntentID(id))
	return &PaymentIntentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for PaymentIntent.
func (c *PaymentIntentClient) Delete() *PaymentIntentDelete {
	mutation := newPaymentIntentMutation(c.config, OpDelete)
	return &PaymentIntentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *PaymentIntentClient) DeleteOne(pi *PaymentIntent) *PaymentIntentDeleteOne {
	return c.DeleteOneID(pi.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *PaymentIntentClient) DeleteOneID(id uuid.UUID) *PaymentIntentDeleteOne {
	builder := c.Delete().Where(paymentintent.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &PaymentIntentDeleteOne{builder}
}

// Query returns a query builder for PaymentIntent.
func (c *PaymentIntentClient) Query() *PaymentIntentQuery {
	return &PaymentIntentQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypePaymentIntent},
		inters: c.Interceptors(),
	}
}

// Get returns a PaymentIntent entity by its id.
func (c *PaymentIntentClient) Get(ctx context.Context, id uuid.UUID) (*PaymentIntent, error) {
	return c.Query().Where(paymentintent.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *PaymentIntentClient) GetX(ctx context.Context, id uuid.UUID) *PaymentIntent {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTransfer queries the transfer edge of a PaymentIntent.
func (c *PaymentIntentClient) QueryTransfer(pi *PaymentIntent) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := pi.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(paymentintent.Table, paymentintent.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, paymentintent.TransferTable, paymentintent.TransferColumn),
		)
		fromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTokenTransaction queries the token_transaction edge of a PaymentIntent.
func (c *PaymentIntentClient) QueryTokenTransaction(pi *PaymentIntent) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := pi.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(paymentintent.Table, paymentintent.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, paymentintent.TokenTransactionTable, paymentintent.TokenTransactionColumn),
		)
		fromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *PaymentIntentClient) Hooks() []Hook {
	hooks := c.hooks.PaymentIntent
	return append(hooks[:len(hooks):len(hooks)], paymentintent.Hooks[:]...)
}

// Interceptors returns the client interceptors.
func (c *PaymentIntentClient) Interceptors() []Interceptor {
	return c.inters.PaymentIntent
}

func (c *PaymentIntentClient) mutate(ctx context.Context, m *PaymentIntentMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&PaymentIntentCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&PaymentIntentUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&PaymentIntentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&PaymentIntentDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown PaymentIntent mutation op: %q", m.Op())
	}
}

// PendingSendTransferClient is a client for the PendingSendTransfer schema.
type PendingSendTransferClient struct {
	config
}

// NewPendingSendTransferClient returns a client for the PendingSendTransfer from the given config.
func NewPendingSendTransferClient(c config) *PendingSendTransferClient {
	return &PendingSendTransferClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `pendingsendtransfer.Hooks(f(g(h())))`.
func (c *PendingSendTransferClient) Use(hooks ...Hook) {
	c.hooks.PendingSendTransfer = append(c.hooks.PendingSendTransfer, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `pendingsendtransfer.Intercept(f(g(h())))`.
func (c *PendingSendTransferClient) Intercept(interceptors ...Interceptor) {
	c.inters.PendingSendTransfer = append(c.inters.PendingSendTransfer, interceptors...)
}

// Create returns a builder for creating a PendingSendTransfer entity.
func (c *PendingSendTransferClient) Create() *PendingSendTransferCreate {
	mutation := newPendingSendTransferMutation(c.config, OpCreate)
	return &PendingSendTransferCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of PendingSendTransfer entities.
func (c *PendingSendTransferClient) CreateBulk(builders ...*PendingSendTransferCreate) *PendingSendTransferCreateBulk {
	return &PendingSendTransferCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *PendingSendTransferClient) MapCreateBulk(slice any, setFunc func(*PendingSendTransferCreate, int)) *PendingSendTransferCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &PendingSendTransferCreateBulk{err: fmt.Errorf("calling to PendingSendTransferClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*PendingSendTransferCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &PendingSendTransferCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for PendingSendTransfer.
func (c *PendingSendTransferClient) Update() *PendingSendTransferUpdate {
	mutation := newPendingSendTransferMutation(c.config, OpUpdate)
	return &PendingSendTransferUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *PendingSendTransferClient) UpdateOne(pst *PendingSendTransfer) *PendingSendTransferUpdateOne {
	mutation := newPendingSendTransferMutation(c.config, OpUpdateOne, withPendingSendTransfer(pst))
	return &PendingSendTransferUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *PendingSendTransferClient) UpdateOneID(id uuid.UUID) *PendingSendTransferUpdateOne {
	mutation := newPendingSendTransferMutation(c.config, OpUpdateOne, withPendingSendTransferID(id))
	return &PendingSendTransferUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for PendingSendTransfer.
func (c *PendingSendTransferClient) Delete() *PendingSendTransferDelete {
	mutation := newPendingSendTransferMutation(c.config, OpDelete)
	return &PendingSendTransferDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *PendingSendTransferClient) DeleteOne(pst *PendingSendTransfer) *PendingSendTransferDeleteOne {
	return c.DeleteOneID(pst.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *PendingSendTransferClient) DeleteOneID(id uuid.UUID) *PendingSendTransferDeleteOne {
	builder := c.Delete().Where(pendingsendtransfer.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &PendingSendTransferDeleteOne{builder}
}

// Query returns a query builder for PendingSendTransfer.
func (c *PendingSendTransferClient) Query() *PendingSendTransferQuery {
	return &PendingSendTransferQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypePendingSendTransfer},
		inters: c.Interceptors(),
	}
}

// Get returns a PendingSendTransfer entity by its id.
func (c *PendingSendTransferClient) Get(ctx context.Context, id uuid.UUID) (*PendingSendTransfer, error) {
	return c.Query().Where(pendingsendtransfer.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *PendingSendTransferClient) GetX(ctx context.Context, id uuid.UUID) *PendingSendTransfer {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *PendingSendTransferClient) Hooks() []Hook {
	return c.hooks.PendingSendTransfer
}

// Interceptors returns the client interceptors.
func (c *PendingSendTransferClient) Interceptors() []Interceptor {
	return c.inters.PendingSendTransfer
}

func (c *PendingSendTransferClient) mutate(ctx context.Context, m *PendingSendTransferMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&PendingSendTransferCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&PendingSendTransferUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&PendingSendTransferUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&PendingSendTransferDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown PendingSendTransfer mutation op: %q", m.Op())
	}
}

// PreimageRequestClient is a client for the PreimageRequest schema.
type PreimageRequestClient struct {
	config
}

// NewPreimageRequestClient returns a client for the PreimageRequest from the given config.
func NewPreimageRequestClient(c config) *PreimageRequestClient {
	return &PreimageRequestClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `preimagerequest.Hooks(f(g(h())))`.
func (c *PreimageRequestClient) Use(hooks ...Hook) {
	c.hooks.PreimageRequest = append(c.hooks.PreimageRequest, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `preimagerequest.Intercept(f(g(h())))`.
func (c *PreimageRequestClient) Intercept(interceptors ...Interceptor) {
	c.inters.PreimageRequest = append(c.inters.PreimageRequest, interceptors...)
}

// Create returns a builder for creating a PreimageRequest entity.
func (c *PreimageRequestClient) Create() *PreimageRequestCreate {
	mutation := newPreimageRequestMutation(c.config, OpCreate)
	return &PreimageRequestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of PreimageRequest entities.
func (c *PreimageRequestClient) CreateBulk(builders ...*PreimageRequestCreate) *PreimageRequestCreateBulk {
	return &PreimageRequestCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *PreimageRequestClient) MapCreateBulk(slice any, setFunc func(*PreimageRequestCreate, int)) *PreimageRequestCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &PreimageRequestCreateBulk{err: fmt.Errorf("calling to PreimageRequestClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*PreimageRequestCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &PreimageRequestCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for PreimageRequest.
func (c *PreimageRequestClient) Update() *PreimageRequestUpdate {
	mutation := newPreimageRequestMutation(c.config, OpUpdate)
	return &PreimageRequestUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *PreimageRequestClient) UpdateOne(pr *PreimageRequest) *PreimageRequestUpdateOne {
	mutation := newPreimageRequestMutation(c.config, OpUpdateOne, withPreimageRequest(pr))
	return &PreimageRequestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *PreimageRequestClient) UpdateOneID(id uuid.UUID) *PreimageRequestUpdateOne {
	mutation := newPreimageRequestMutation(c.config, OpUpdateOne, withPreimageRequestID(id))
	return &PreimageRequestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for PreimageRequest.
func (c *PreimageRequestClient) Delete() *PreimageRequestDelete {
	mutation := newPreimageRequestMutation(c.config, OpDelete)
	return &PreimageRequestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *PreimageRequestClient) DeleteOne(pr *PreimageRequest) *PreimageRequestDeleteOne {
	return c.DeleteOneID(pr.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *PreimageRequestClient) DeleteOneID(id uuid.UUID) *PreimageRequestDeleteOne {
	builder := c.Delete().Where(preimagerequest.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &PreimageRequestDeleteOne{builder}
}

// Query returns a query builder for PreimageRequest.
func (c *PreimageRequestClient) Query() *PreimageRequestQuery {
	return &PreimageRequestQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypePreimageRequest},
		inters: c.Interceptors(),
	}
}

// Get returns a PreimageRequest entity by its id.
func (c *PreimageRequestClient) Get(ctx context.Context, id uuid.UUID) (*PreimageRequest, error) {
	return c.Query().Where(preimagerequest.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *PreimageRequestClient) GetX(ctx context.Context, id uuid.UUID) *PreimageRequest {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTransactions queries the transactions edge of a PreimageRequest.
func (c *PreimageRequestClient) QueryTransactions(pr *PreimageRequest) *UserSignedTransactionQuery {
	query := (&UserSignedTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := pr.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(preimagerequest.Table, preimagerequest.FieldID, id),
			sqlgraph.To(usersignedtransaction.Table, usersignedtransaction.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, preimagerequest.TransactionsTable, preimagerequest.TransactionsColumn),
		)
		fromV = sqlgraph.Neighbors(pr.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPreimageShares queries the preimage_shares edge of a PreimageRequest.
func (c *PreimageRequestClient) QueryPreimageShares(pr *PreimageRequest) *PreimageShareQuery {
	query := (&PreimageShareClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := pr.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(preimagerequest.Table, preimagerequest.FieldID, id),
			sqlgraph.To(preimageshare.Table, preimageshare.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, preimagerequest.PreimageSharesTable, preimagerequest.PreimageSharesColumn),
		)
		fromV = sqlgraph.Neighbors(pr.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTransfers queries the transfers edge of a PreimageRequest.
func (c *PreimageRequestClient) QueryTransfers(pr *PreimageRequest) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := pr.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(preimagerequest.Table, preimagerequest.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, preimagerequest.TransfersTable, preimagerequest.TransfersColumn),
		)
		fromV = sqlgraph.Neighbors(pr.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *PreimageRequestClient) Hooks() []Hook {
	return c.hooks.PreimageRequest
}

// Interceptors returns the client interceptors.
func (c *PreimageRequestClient) Interceptors() []Interceptor {
	return c.inters.PreimageRequest
}

func (c *PreimageRequestClient) mutate(ctx context.Context, m *PreimageRequestMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&PreimageRequestCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&PreimageRequestUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&PreimageRequestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&PreimageRequestDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown PreimageRequest mutation op: %q", m.Op())
	}
}

// PreimageShareClient is a client for the PreimageShare schema.
type PreimageShareClient struct {
	config
}

// NewPreimageShareClient returns a client for the PreimageShare from the given config.
func NewPreimageShareClient(c config) *PreimageShareClient {
	return &PreimageShareClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `preimageshare.Hooks(f(g(h())))`.
func (c *PreimageShareClient) Use(hooks ...Hook) {
	c.hooks.PreimageShare = append(c.hooks.PreimageShare, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `preimageshare.Intercept(f(g(h())))`.
func (c *PreimageShareClient) Intercept(interceptors ...Interceptor) {
	c.inters.PreimageShare = append(c.inters.PreimageShare, interceptors...)
}

// Create returns a builder for creating a PreimageShare entity.
func (c *PreimageShareClient) Create() *PreimageShareCreate {
	mutation := newPreimageShareMutation(c.config, OpCreate)
	return &PreimageShareCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of PreimageShare entities.
func (c *PreimageShareClient) CreateBulk(builders ...*PreimageShareCreate) *PreimageShareCreateBulk {
	return &PreimageShareCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *PreimageShareClient) MapCreateBulk(slice any, setFunc func(*PreimageShareCreate, int)) *PreimageShareCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &PreimageShareCreateBulk{err: fmt.Errorf("calling to PreimageShareClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*PreimageShareCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &PreimageShareCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for PreimageShare.
func (c *PreimageShareClient) Update() *PreimageShareUpdate {
	mutation := newPreimageShareMutation(c.config, OpUpdate)
	return &PreimageShareUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *PreimageShareClient) UpdateOne(ps *PreimageShare) *PreimageShareUpdateOne {
	mutation := newPreimageShareMutation(c.config, OpUpdateOne, withPreimageShare(ps))
	return &PreimageShareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *PreimageShareClient) UpdateOneID(id uuid.UUID) *PreimageShareUpdateOne {
	mutation := newPreimageShareMutation(c.config, OpUpdateOne, withPreimageShareID(id))
	return &PreimageShareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for PreimageShare.
func (c *PreimageShareClient) Delete() *PreimageShareDelete {
	mutation := newPreimageShareMutation(c.config, OpDelete)
	return &PreimageShareDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *PreimageShareClient) DeleteOne(ps *PreimageShare) *PreimageShareDeleteOne {
	return c.DeleteOneID(ps.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *PreimageShareClient) DeleteOneID(id uuid.UUID) *PreimageShareDeleteOne {
	builder := c.Delete().Where(preimageshare.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &PreimageShareDeleteOne{builder}
}

// Query returns a query builder for PreimageShare.
func (c *PreimageShareClient) Query() *PreimageShareQuery {
	return &PreimageShareQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypePreimageShare},
		inters: c.Interceptors(),
	}
}

// Get returns a PreimageShare entity by its id.
func (c *PreimageShareClient) Get(ctx context.Context, id uuid.UUID) (*PreimageShare, error) {
	return c.Query().Where(preimageshare.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *PreimageShareClient) GetX(ctx context.Context, id uuid.UUID) *PreimageShare {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryPreimageRequest queries the preimage_request edge of a PreimageShare.
func (c *PreimageShareClient) QueryPreimageRequest(ps *PreimageShare) *PreimageRequestQuery {
	query := (&PreimageRequestClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := ps.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(preimageshare.Table, preimageshare.FieldID, id),
			sqlgraph.To(preimagerequest.Table, preimagerequest.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, true, preimageshare.PreimageRequestTable, preimageshare.PreimageRequestColumn),
		)
		fromV = sqlgraph.Neighbors(ps.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *PreimageShareClient) Hooks() []Hook {
	return c.hooks.PreimageShare
}

// Interceptors returns the client interceptors.
func (c *PreimageShareClient) Interceptors() []Interceptor {
	return c.inters.PreimageShare
}

func (c *PreimageShareClient) mutate(ctx context.Context, m *PreimageShareMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&PreimageShareCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&PreimageShareUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&PreimageShareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&PreimageShareDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown PreimageShare mutation op: %q", m.Op())
	}
}

// SigningCommitmentClient is a client for the SigningCommitment schema.
type SigningCommitmentClient struct {
	config
}

// NewSigningCommitmentClient returns a client for the SigningCommitment from the given config.
func NewSigningCommitmentClient(c config) *SigningCommitmentClient {
	return &SigningCommitmentClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `signingcommitment.Hooks(f(g(h())))`.
func (c *SigningCommitmentClient) Use(hooks ...Hook) {
	c.hooks.SigningCommitment = append(c.hooks.SigningCommitment, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `signingcommitment.Intercept(f(g(h())))`.
func (c *SigningCommitmentClient) Intercept(interceptors ...Interceptor) {
	c.inters.SigningCommitment = append(c.inters.SigningCommitment, interceptors...)
}

// Create returns a builder for creating a SigningCommitment entity.
func (c *SigningCommitmentClient) Create() *SigningCommitmentCreate {
	mutation := newSigningCommitmentMutation(c.config, OpCreate)
	return &SigningCommitmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of SigningCommitment entities.
func (c *SigningCommitmentClient) CreateBulk(builders ...*SigningCommitmentCreate) *SigningCommitmentCreateBulk {
	return &SigningCommitmentCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SigningCommitmentClient) MapCreateBulk(slice any, setFunc func(*SigningCommitmentCreate, int)) *SigningCommitmentCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SigningCommitmentCreateBulk{err: fmt.Errorf("calling to SigningCommitmentClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SigningCommitmentCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SigningCommitmentCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for SigningCommitment.
func (c *SigningCommitmentClient) Update() *SigningCommitmentUpdate {
	mutation := newSigningCommitmentMutation(c.config, OpUpdate)
	return &SigningCommitmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SigningCommitmentClient) UpdateOne(sc *SigningCommitment) *SigningCommitmentUpdateOne {
	mutation := newSigningCommitmentMutation(c.config, OpUpdateOne, withSigningCommitment(sc))
	return &SigningCommitmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SigningCommitmentClient) UpdateOneID(id uuid.UUID) *SigningCommitmentUpdateOne {
	mutation := newSigningCommitmentMutation(c.config, OpUpdateOne, withSigningCommitmentID(id))
	return &SigningCommitmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for SigningCommitment.
func (c *SigningCommitmentClient) Delete() *SigningCommitmentDelete {
	mutation := newSigningCommitmentMutation(c.config, OpDelete)
	return &SigningCommitmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SigningCommitmentClient) DeleteOne(sc *SigningCommitment) *SigningCommitmentDeleteOne {
	return c.DeleteOneID(sc.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SigningCommitmentClient) DeleteOneID(id uuid.UUID) *SigningCommitmentDeleteOne {
	builder := c.Delete().Where(signingcommitment.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SigningCommitmentDeleteOne{builder}
}

// Query returns a query builder for SigningCommitment.
func (c *SigningCommitmentClient) Query() *SigningCommitmentQuery {
	return &SigningCommitmentQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSigningCommitment},
		inters: c.Interceptors(),
	}
}

// Get returns a SigningCommitment entity by its id.
func (c *SigningCommitmentClient) Get(ctx context.Context, id uuid.UUID) (*SigningCommitment, error) {
	return c.Query().Where(signingcommitment.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SigningCommitmentClient) GetX(ctx context.Context, id uuid.UUID) *SigningCommitment {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *SigningCommitmentClient) Hooks() []Hook {
	return c.hooks.SigningCommitment
}

// Interceptors returns the client interceptors.
func (c *SigningCommitmentClient) Interceptors() []Interceptor {
	return c.inters.SigningCommitment
}

func (c *SigningCommitmentClient) mutate(ctx context.Context, m *SigningCommitmentMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SigningCommitmentCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SigningCommitmentUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SigningCommitmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SigningCommitmentDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown SigningCommitment mutation op: %q", m.Op())
	}
}

// SigningKeyshareClient is a client for the SigningKeyshare schema.
type SigningKeyshareClient struct {
	config
}

// NewSigningKeyshareClient returns a client for the SigningKeyshare from the given config.
func NewSigningKeyshareClient(c config) *SigningKeyshareClient {
	return &SigningKeyshareClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `signingkeyshare.Hooks(f(g(h())))`.
func (c *SigningKeyshareClient) Use(hooks ...Hook) {
	c.hooks.SigningKeyshare = append(c.hooks.SigningKeyshare, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `signingkeyshare.Intercept(f(g(h())))`.
func (c *SigningKeyshareClient) Intercept(interceptors ...Interceptor) {
	c.inters.SigningKeyshare = append(c.inters.SigningKeyshare, interceptors...)
}

// Create returns a builder for creating a SigningKeyshare entity.
func (c *SigningKeyshareClient) Create() *SigningKeyshareCreate {
	mutation := newSigningKeyshareMutation(c.config, OpCreate)
	return &SigningKeyshareCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of SigningKeyshare entities.
func (c *SigningKeyshareClient) CreateBulk(builders ...*SigningKeyshareCreate) *SigningKeyshareCreateBulk {
	return &SigningKeyshareCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SigningKeyshareClient) MapCreateBulk(slice any, setFunc func(*SigningKeyshareCreate, int)) *SigningKeyshareCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SigningKeyshareCreateBulk{err: fmt.Errorf("calling to SigningKeyshareClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SigningKeyshareCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SigningKeyshareCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for SigningKeyshare.
func (c *SigningKeyshareClient) Update() *SigningKeyshareUpdate {
	mutation := newSigningKeyshareMutation(c.config, OpUpdate)
	return &SigningKeyshareUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SigningKeyshareClient) UpdateOne(sk *SigningKeyshare) *SigningKeyshareUpdateOne {
	mutation := newSigningKeyshareMutation(c.config, OpUpdateOne, withSigningKeyshare(sk))
	return &SigningKeyshareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SigningKeyshareClient) UpdateOneID(id uuid.UUID) *SigningKeyshareUpdateOne {
	mutation := newSigningKeyshareMutation(c.config, OpUpdateOne, withSigningKeyshareID(id))
	return &SigningKeyshareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for SigningKeyshare.
func (c *SigningKeyshareClient) Delete() *SigningKeyshareDelete {
	mutation := newSigningKeyshareMutation(c.config, OpDelete)
	return &SigningKeyshareDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SigningKeyshareClient) DeleteOne(sk *SigningKeyshare) *SigningKeyshareDeleteOne {
	return c.DeleteOneID(sk.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SigningKeyshareClient) DeleteOneID(id uuid.UUID) *SigningKeyshareDeleteOne {
	builder := c.Delete().Where(signingkeyshare.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SigningKeyshareDeleteOne{builder}
}

// Query returns a query builder for SigningKeyshare.
func (c *SigningKeyshareClient) Query() *SigningKeyshareQuery {
	return &SigningKeyshareQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSigningKeyshare},
		inters: c.Interceptors(),
	}
}

// Get returns a SigningKeyshare entity by its id.
func (c *SigningKeyshareClient) Get(ctx context.Context, id uuid.UUID) (*SigningKeyshare, error) {
	return c.Query().Where(signingkeyshare.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SigningKeyshareClient) GetX(ctx context.Context, id uuid.UUID) *SigningKeyshare {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *SigningKeyshareClient) Hooks() []Hook {
	return c.hooks.SigningKeyshare
}

// Interceptors returns the client interceptors.
func (c *SigningKeyshareClient) Interceptors() []Interceptor {
	return c.inters.SigningKeyshare
}

func (c *SigningKeyshareClient) mutate(ctx context.Context, m *SigningKeyshareMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SigningKeyshareCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SigningKeyshareUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SigningKeyshareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SigningKeyshareDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown SigningKeyshare mutation op: %q", m.Op())
	}
}

// SigningNonceClient is a client for the SigningNonce schema.
type SigningNonceClient struct {
	config
}

// NewSigningNonceClient returns a client for the SigningNonce from the given config.
func NewSigningNonceClient(c config) *SigningNonceClient {
	return &SigningNonceClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `signingnonce.Hooks(f(g(h())))`.
func (c *SigningNonceClient) Use(hooks ...Hook) {
	c.hooks.SigningNonce = append(c.hooks.SigningNonce, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `signingnonce.Intercept(f(g(h())))`.
func (c *SigningNonceClient) Intercept(interceptors ...Interceptor) {
	c.inters.SigningNonce = append(c.inters.SigningNonce, interceptors...)
}

// Create returns a builder for creating a SigningNonce entity.
func (c *SigningNonceClient) Create() *SigningNonceCreate {
	mutation := newSigningNonceMutation(c.config, OpCreate)
	return &SigningNonceCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of SigningNonce entities.
func (c *SigningNonceClient) CreateBulk(builders ...*SigningNonceCreate) *SigningNonceCreateBulk {
	return &SigningNonceCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SigningNonceClient) MapCreateBulk(slice any, setFunc func(*SigningNonceCreate, int)) *SigningNonceCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SigningNonceCreateBulk{err: fmt.Errorf("calling to SigningNonceClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SigningNonceCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SigningNonceCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for SigningNonce.
func (c *SigningNonceClient) Update() *SigningNonceUpdate {
	mutation := newSigningNonceMutation(c.config, OpUpdate)
	return &SigningNonceUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SigningNonceClient) UpdateOne(sn *SigningNonce) *SigningNonceUpdateOne {
	mutation := newSigningNonceMutation(c.config, OpUpdateOne, withSigningNonce(sn))
	return &SigningNonceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SigningNonceClient) UpdateOneID(id uuid.UUID) *SigningNonceUpdateOne {
	mutation := newSigningNonceMutation(c.config, OpUpdateOne, withSigningNonceID(id))
	return &SigningNonceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for SigningNonce.
func (c *SigningNonceClient) Delete() *SigningNonceDelete {
	mutation := newSigningNonceMutation(c.config, OpDelete)
	return &SigningNonceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SigningNonceClient) DeleteOne(sn *SigningNonce) *SigningNonceDeleteOne {
	return c.DeleteOneID(sn.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SigningNonceClient) DeleteOneID(id uuid.UUID) *SigningNonceDeleteOne {
	builder := c.Delete().Where(signingnonce.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SigningNonceDeleteOne{builder}
}

// Query returns a query builder for SigningNonce.
func (c *SigningNonceClient) Query() *SigningNonceQuery {
	return &SigningNonceQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSigningNonce},
		inters: c.Interceptors(),
	}
}

// Get returns a SigningNonce entity by its id.
func (c *SigningNonceClient) Get(ctx context.Context, id uuid.UUID) (*SigningNonce, error) {
	return c.Query().Where(signingnonce.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SigningNonceClient) GetX(ctx context.Context, id uuid.UUID) *SigningNonce {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// Hooks returns the client hooks.
func (c *SigningNonceClient) Hooks() []Hook {
	return c.hooks.SigningNonce
}

// Interceptors returns the client interceptors.
func (c *SigningNonceClient) Interceptors() []Interceptor {
	return c.inters.SigningNonce
}

func (c *SigningNonceClient) mutate(ctx context.Context, m *SigningNonceMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SigningNonceCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SigningNonceUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SigningNonceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SigningNonceDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown SigningNonce mutation op: %q", m.Op())
	}
}

// SparkInvoiceClient is a client for the SparkInvoice schema.
type SparkInvoiceClient struct {
	config
}

// NewSparkInvoiceClient returns a client for the SparkInvoice from the given config.
func NewSparkInvoiceClient(c config) *SparkInvoiceClient {
	return &SparkInvoiceClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `sparkinvoice.Hooks(f(g(h())))`.
func (c *SparkInvoiceClient) Use(hooks ...Hook) {
	c.hooks.SparkInvoice = append(c.hooks.SparkInvoice, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `sparkinvoice.Intercept(f(g(h())))`.
func (c *SparkInvoiceClient) Intercept(interceptors ...Interceptor) {
	c.inters.SparkInvoice = append(c.inters.SparkInvoice, interceptors...)
}

// Create returns a builder for creating a SparkInvoice entity.
func (c *SparkInvoiceClient) Create() *SparkInvoiceCreate {
	mutation := newSparkInvoiceMutation(c.config, OpCreate)
	return &SparkInvoiceCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of SparkInvoice entities.
func (c *SparkInvoiceClient) CreateBulk(builders ...*SparkInvoiceCreate) *SparkInvoiceCreateBulk {
	return &SparkInvoiceCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *SparkInvoiceClient) MapCreateBulk(slice any, setFunc func(*SparkInvoiceCreate, int)) *SparkInvoiceCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &SparkInvoiceCreateBulk{err: fmt.Errorf("calling to SparkInvoiceClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*SparkInvoiceCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &SparkInvoiceCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for SparkInvoice.
func (c *SparkInvoiceClient) Update() *SparkInvoiceUpdate {
	mutation := newSparkInvoiceMutation(c.config, OpUpdate)
	return &SparkInvoiceUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *SparkInvoiceClient) UpdateOne(si *SparkInvoice) *SparkInvoiceUpdateOne {
	mutation := newSparkInvoiceMutation(c.config, OpUpdateOne, withSparkInvoice(si))
	return &SparkInvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *SparkInvoiceClient) UpdateOneID(id uuid.UUID) *SparkInvoiceUpdateOne {
	mutation := newSparkInvoiceMutation(c.config, OpUpdateOne, withSparkInvoiceID(id))
	return &SparkInvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for SparkInvoice.
func (c *SparkInvoiceClient) Delete() *SparkInvoiceDelete {
	mutation := newSparkInvoiceMutation(c.config, OpDelete)
	return &SparkInvoiceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *SparkInvoiceClient) DeleteOne(si *SparkInvoice) *SparkInvoiceDeleteOne {
	return c.DeleteOneID(si.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *SparkInvoiceClient) DeleteOneID(id uuid.UUID) *SparkInvoiceDeleteOne {
	builder := c.Delete().Where(sparkinvoice.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &SparkInvoiceDeleteOne{builder}
}

// Query returns a query builder for SparkInvoice.
func (c *SparkInvoiceClient) Query() *SparkInvoiceQuery {
	return &SparkInvoiceQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeSparkInvoice},
		inters: c.Interceptors(),
	}
}

// Get returns a SparkInvoice entity by its id.
func (c *SparkInvoiceClient) Get(ctx context.Context, id uuid.UUID) (*SparkInvoice, error) {
	return c.Query().Where(sparkinvoice.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *SparkInvoiceClient) GetX(ctx context.Context, id uuid.UUID) *SparkInvoice {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTokenTransaction queries the token_transaction edge of a SparkInvoice.
func (c *SparkInvoiceClient) QueryTokenTransaction(si *SparkInvoice) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := si.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(sparkinvoice.Table, sparkinvoice.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.M2M, true, sparkinvoice.TokenTransactionTable, sparkinvoice.TokenTransactionPrimaryKey...),
		)
		fromV = sqlgraph.Neighbors(si.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTransfer queries the transfer edge of a SparkInvoice.
func (c *SparkInvoiceClient) QueryTransfer(si *SparkInvoice) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := si.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(sparkinvoice.Table, sparkinvoice.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, sparkinvoice.TransferTable, sparkinvoice.TransferColumn),
		)
		fromV = sqlgraph.Neighbors(si.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *SparkInvoiceClient) Hooks() []Hook {
	return c.hooks.SparkInvoice
}

// Interceptors returns the client interceptors.
func (c *SparkInvoiceClient) Interceptors() []Interceptor {
	return c.inters.SparkInvoice
}

func (c *SparkInvoiceClient) mutate(ctx context.Context, m *SparkInvoiceMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&SparkInvoiceCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&SparkInvoiceUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&SparkInvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&SparkInvoiceDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown SparkInvoice mutation op: %q", m.Op())
	}
}

// TokenCreateClient is a client for the TokenCreate schema.
type TokenCreateClient struct {
	config
}

// NewTokenCreateClient returns a client for the TokenCreate from the given config.
func NewTokenCreateClient(c config) *TokenCreateClient {
	return &TokenCreateClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokencreate.Hooks(f(g(h())))`.
func (c *TokenCreateClient) Use(hooks ...Hook) {
	c.hooks.TokenCreate = append(c.hooks.TokenCreate, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokencreate.Intercept(f(g(h())))`.
func (c *TokenCreateClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenCreate = append(c.inters.TokenCreate, interceptors...)
}

// Create returns a builder for creating a TokenCreate entity.
func (c *TokenCreateClient) Create() *TokenCreateCreate {
	mutation := newTokenCreateMutation(c.config, OpCreate)
	return &TokenCreateCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenCreate entities.
func (c *TokenCreateClient) CreateBulk(builders ...*TokenCreateCreate) *TokenCreateCreateBulk {
	return &TokenCreateCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenCreateClient) MapCreateBulk(slice any, setFunc func(*TokenCreateCreate, int)) *TokenCreateCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenCreateCreateBulk{err: fmt.Errorf("calling to TokenCreateClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenCreateCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenCreateCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenCreate.
func (c *TokenCreateClient) Update() *TokenCreateUpdate {
	mutation := newTokenCreateMutation(c.config, OpUpdate)
	return &TokenCreateUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenCreateClient) UpdateOne(tc *TokenCreate) *TokenCreateUpdateOne {
	mutation := newTokenCreateMutation(c.config, OpUpdateOne, withTokenCreate(tc))
	return &TokenCreateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenCreateClient) UpdateOneID(id uuid.UUID) *TokenCreateUpdateOne {
	mutation := newTokenCreateMutation(c.config, OpUpdateOne, withTokenCreateID(id))
	return &TokenCreateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenCreate.
func (c *TokenCreateClient) Delete() *TokenCreateDelete {
	mutation := newTokenCreateMutation(c.config, OpDelete)
	return &TokenCreateDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenCreateClient) DeleteOne(tc *TokenCreate) *TokenCreateDeleteOne {
	return c.DeleteOneID(tc.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenCreateClient) DeleteOneID(id uuid.UUID) *TokenCreateDeleteOne {
	builder := c.Delete().Where(tokencreate.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenCreateDeleteOne{builder}
}

// Query returns a query builder for TokenCreate.
func (c *TokenCreateClient) Query() *TokenCreateQuery {
	return &TokenCreateQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenCreate},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenCreate entity by its id.
func (c *TokenCreateClient) Get(ctx context.Context, id uuid.UUID) (*TokenCreate, error) {
	return c.Query().Where(tokencreate.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenCreateClient) GetX(ctx context.Context, id uuid.UUID) *TokenCreate {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTokenTransaction queries the token_transaction edge of a TokenCreate.
func (c *TokenCreateClient) QueryTokenTransaction(tc *TokenCreate) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tc.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokencreate.Table, tokencreate.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, tokencreate.TokenTransactionTable, tokencreate.TokenTransactionColumn),
		)
		fromV = sqlgraph.Neighbors(tc.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryL1TokenCreate queries the l1_token_create edge of a TokenCreate.
func (c *TokenCreateClient) QueryL1TokenCreate(tc *TokenCreate) *L1TokenCreateQuery {
	query := (&L1TokenCreateClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tc.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokencreate.Table, tokencreate.FieldID, id),
			sqlgraph.To(l1tokencreate.Table, l1tokencreate.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokencreate.L1TokenCreateTable, tokencreate.L1TokenCreateColumn),
		)
		fromV = sqlgraph.Neighbors(tc.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTokenOutput queries the token_output edge of a TokenCreate.
func (c *TokenCreateClient) QueryTokenOutput(tc *TokenCreate) *TokenOutputQuery {
	query := (&TokenOutputClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tc.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokencreate.Table, tokencreate.FieldID, id),
			sqlgraph.To(tokenoutput.Table, tokenoutput.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, tokencreate.TokenOutputTable, tokencreate.TokenOutputColumn),
		)
		fromV = sqlgraph.Neighbors(tc.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTokenFreeze queries the token_freeze edge of a TokenCreate.
func (c *TokenCreateClient) QueryTokenFreeze(tc *TokenCreate) *TokenFreezeQuery {
	query := (&TokenFreezeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tc.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokencreate.Table, tokencreate.FieldID, id),
			sqlgraph.To(tokenfreeze.Table, tokenfreeze.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, tokencreate.TokenFreezeTable, tokencreate.TokenFreezeColumn),
		)
		fromV = sqlgraph.Neighbors(tc.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenCreateClient) Hooks() []Hook {
	return c.hooks.TokenCreate
}

// Interceptors returns the client interceptors.
func (c *TokenCreateClient) Interceptors() []Interceptor {
	return c.inters.TokenCreate
}

func (c *TokenCreateClient) mutate(ctx context.Context, m *TokenCreateMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenCreateCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenCreateUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenCreateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenCreateDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenCreate mutation op: %q", m.Op())
	}
}

// TokenFreezeClient is a client for the TokenFreeze schema.
type TokenFreezeClient struct {
	config
}

// NewTokenFreezeClient returns a client for the TokenFreeze from the given config.
func NewTokenFreezeClient(c config) *TokenFreezeClient {
	return &TokenFreezeClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokenfreeze.Hooks(f(g(h())))`.
func (c *TokenFreezeClient) Use(hooks ...Hook) {
	c.hooks.TokenFreeze = append(c.hooks.TokenFreeze, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokenfreeze.Intercept(f(g(h())))`.
func (c *TokenFreezeClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenFreeze = append(c.inters.TokenFreeze, interceptors...)
}

// Create returns a builder for creating a TokenFreeze entity.
func (c *TokenFreezeClient) Create() *TokenFreezeCreate {
	mutation := newTokenFreezeMutation(c.config, OpCreate)
	return &TokenFreezeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenFreeze entities.
func (c *TokenFreezeClient) CreateBulk(builders ...*TokenFreezeCreate) *TokenFreezeCreateBulk {
	return &TokenFreezeCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenFreezeClient) MapCreateBulk(slice any, setFunc func(*TokenFreezeCreate, int)) *TokenFreezeCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenFreezeCreateBulk{err: fmt.Errorf("calling to TokenFreezeClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenFreezeCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenFreezeCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenFreeze.
func (c *TokenFreezeClient) Update() *TokenFreezeUpdate {
	mutation := newTokenFreezeMutation(c.config, OpUpdate)
	return &TokenFreezeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenFreezeClient) UpdateOne(tf *TokenFreeze) *TokenFreezeUpdateOne {
	mutation := newTokenFreezeMutation(c.config, OpUpdateOne, withTokenFreeze(tf))
	return &TokenFreezeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenFreezeClient) UpdateOneID(id uuid.UUID) *TokenFreezeUpdateOne {
	mutation := newTokenFreezeMutation(c.config, OpUpdateOne, withTokenFreezeID(id))
	return &TokenFreezeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenFreeze.
func (c *TokenFreezeClient) Delete() *TokenFreezeDelete {
	mutation := newTokenFreezeMutation(c.config, OpDelete)
	return &TokenFreezeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenFreezeClient) DeleteOne(tf *TokenFreeze) *TokenFreezeDeleteOne {
	return c.DeleteOneID(tf.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenFreezeClient) DeleteOneID(id uuid.UUID) *TokenFreezeDeleteOne {
	builder := c.Delete().Where(tokenfreeze.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenFreezeDeleteOne{builder}
}

// Query returns a query builder for TokenFreeze.
func (c *TokenFreezeClient) Query() *TokenFreezeQuery {
	return &TokenFreezeQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenFreeze},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenFreeze entity by its id.
func (c *TokenFreezeClient) Get(ctx context.Context, id uuid.UUID) (*TokenFreeze, error) {
	return c.Query().Where(tokenfreeze.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenFreezeClient) GetX(ctx context.Context, id uuid.UUID) *TokenFreeze {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTokenCreate queries the token_create edge of a TokenFreeze.
func (c *TokenFreezeClient) QueryTokenCreate(tf *TokenFreeze) *TokenCreateQuery {
	query := (&TokenCreateClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tf.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenfreeze.Table, tokenfreeze.FieldID, id),
			sqlgraph.To(tokencreate.Table, tokencreate.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, tokenfreeze.TokenCreateTable, tokenfreeze.TokenCreateColumn),
		)
		fromV = sqlgraph.Neighbors(tf.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenFreezeClient) Hooks() []Hook {
	return c.hooks.TokenFreeze
}

// Interceptors returns the client interceptors.
func (c *TokenFreezeClient) Interceptors() []Interceptor {
	return c.inters.TokenFreeze
}

func (c *TokenFreezeClient) mutate(ctx context.Context, m *TokenFreezeMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenFreezeCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenFreezeUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenFreezeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenFreezeDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenFreeze mutation op: %q", m.Op())
	}
}

// TokenMintClient is a client for the TokenMint schema.
type TokenMintClient struct {
	config
}

// NewTokenMintClient returns a client for the TokenMint from the given config.
func NewTokenMintClient(c config) *TokenMintClient {
	return &TokenMintClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokenmint.Hooks(f(g(h())))`.
func (c *TokenMintClient) Use(hooks ...Hook) {
	c.hooks.TokenMint = append(c.hooks.TokenMint, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokenmint.Intercept(f(g(h())))`.
func (c *TokenMintClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenMint = append(c.inters.TokenMint, interceptors...)
}

// Create returns a builder for creating a TokenMint entity.
func (c *TokenMintClient) Create() *TokenMintCreate {
	mutation := newTokenMintMutation(c.config, OpCreate)
	return &TokenMintCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenMint entities.
func (c *TokenMintClient) CreateBulk(builders ...*TokenMintCreate) *TokenMintCreateBulk {
	return &TokenMintCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenMintClient) MapCreateBulk(slice any, setFunc func(*TokenMintCreate, int)) *TokenMintCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenMintCreateBulk{err: fmt.Errorf("calling to TokenMintClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenMintCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenMintCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenMint.
func (c *TokenMintClient) Update() *TokenMintUpdate {
	mutation := newTokenMintMutation(c.config, OpUpdate)
	return &TokenMintUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenMintClient) UpdateOne(tm *TokenMint) *TokenMintUpdateOne {
	mutation := newTokenMintMutation(c.config, OpUpdateOne, withTokenMint(tm))
	return &TokenMintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenMintClient) UpdateOneID(id uuid.UUID) *TokenMintUpdateOne {
	mutation := newTokenMintMutation(c.config, OpUpdateOne, withTokenMintID(id))
	return &TokenMintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenMint.
func (c *TokenMintClient) Delete() *TokenMintDelete {
	mutation := newTokenMintMutation(c.config, OpDelete)
	return &TokenMintDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenMintClient) DeleteOne(tm *TokenMint) *TokenMintDeleteOne {
	return c.DeleteOneID(tm.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenMintClient) DeleteOneID(id uuid.UUID) *TokenMintDeleteOne {
	builder := c.Delete().Where(tokenmint.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenMintDeleteOne{builder}
}

// Query returns a query builder for TokenMint.
func (c *TokenMintClient) Query() *TokenMintQuery {
	return &TokenMintQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenMint},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenMint entity by its id.
func (c *TokenMintClient) Get(ctx context.Context, id uuid.UUID) (*TokenMint, error) {
	return c.Query().Where(tokenmint.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenMintClient) GetX(ctx context.Context, id uuid.UUID) *TokenMint {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTokenTransaction queries the token_transaction edge of a TokenMint.
func (c *TokenMintClient) QueryTokenTransaction(tm *TokenMint) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tm.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenmint.Table, tokenmint.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, tokenmint.TokenTransactionTable, tokenmint.TokenTransactionColumn),
		)
		fromV = sqlgraph.Neighbors(tm.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenMintClient) Hooks() []Hook {
	return c.hooks.TokenMint
}

// Interceptors returns the client interceptors.
func (c *TokenMintClient) Interceptors() []Interceptor {
	return c.inters.TokenMint
}

func (c *TokenMintClient) mutate(ctx context.Context, m *TokenMintMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenMintCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenMintUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenMintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenMintDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenMint mutation op: %q", m.Op())
	}
}

// TokenOutputClient is a client for the TokenOutput schema.
type TokenOutputClient struct {
	config
}

// NewTokenOutputClient returns a client for the TokenOutput from the given config.
func NewTokenOutputClient(c config) *TokenOutputClient {
	return &TokenOutputClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokenoutput.Hooks(f(g(h())))`.
func (c *TokenOutputClient) Use(hooks ...Hook) {
	c.hooks.TokenOutput = append(c.hooks.TokenOutput, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokenoutput.Intercept(f(g(h())))`.
func (c *TokenOutputClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenOutput = append(c.inters.TokenOutput, interceptors...)
}

// Create returns a builder for creating a TokenOutput entity.
func (c *TokenOutputClient) Create() *TokenOutputCreate {
	mutation := newTokenOutputMutation(c.config, OpCreate)
	return &TokenOutputCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenOutput entities.
func (c *TokenOutputClient) CreateBulk(builders ...*TokenOutputCreate) *TokenOutputCreateBulk {
	return &TokenOutputCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenOutputClient) MapCreateBulk(slice any, setFunc func(*TokenOutputCreate, int)) *TokenOutputCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenOutputCreateBulk{err: fmt.Errorf("calling to TokenOutputClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenOutputCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenOutputCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenOutput.
func (c *TokenOutputClient) Update() *TokenOutputUpdate {
	mutation := newTokenOutputMutation(c.config, OpUpdate)
	return &TokenOutputUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenOutputClient) UpdateOne(to *TokenOutput) *TokenOutputUpdateOne {
	mutation := newTokenOutputMutation(c.config, OpUpdateOne, withTokenOutput(to))
	return &TokenOutputUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenOutputClient) UpdateOneID(id uuid.UUID) *TokenOutputUpdateOne {
	mutation := newTokenOutputMutation(c.config, OpUpdateOne, withTokenOutputID(id))
	return &TokenOutputUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenOutput.
func (c *TokenOutputClient) Delete() *TokenOutputDelete {
	mutation := newTokenOutputMutation(c.config, OpDelete)
	return &TokenOutputDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenOutputClient) DeleteOne(to *TokenOutput) *TokenOutputDeleteOne {
	return c.DeleteOneID(to.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenOutputClient) DeleteOneID(id uuid.UUID) *TokenOutputDeleteOne {
	builder := c.Delete().Where(tokenoutput.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenOutputDeleteOne{builder}
}

// Query returns a query builder for TokenOutput.
func (c *TokenOutputClient) Query() *TokenOutputQuery {
	return &TokenOutputQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenOutput},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenOutput entity by its id.
func (c *TokenOutputClient) Get(ctx context.Context, id uuid.UUID) (*TokenOutput, error) {
	return c.Query().Where(tokenoutput.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenOutputClient) GetX(ctx context.Context, id uuid.UUID) *TokenOutput {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryRevocationKeyshare queries the revocation_keyshare edge of a TokenOutput.
func (c *TokenOutputClient) QueryRevocationKeyshare(to *TokenOutput) *SigningKeyshareQuery {
	query := (&SigningKeyshareClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := to.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenoutput.Table, tokenoutput.FieldID, id),
			sqlgraph.To(signingkeyshare.Table, signingkeyshare.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokenoutput.RevocationKeyshareTable, tokenoutput.RevocationKeyshareColumn),
		)
		fromV = sqlgraph.Neighbors(to.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryOutputCreatedTokenTransaction queries the output_created_token_transaction edge of a TokenOutput.
func (c *TokenOutputClient) QueryOutputCreatedTokenTransaction(to *TokenOutput) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := to.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenoutput.Table, tokenoutput.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokenoutput.OutputCreatedTokenTransactionTable, tokenoutput.OutputCreatedTokenTransactionColumn),
		)
		fromV = sqlgraph.Neighbors(to.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryOutputSpentTokenTransaction queries the output_spent_token_transaction edge of a TokenOutput.
func (c *TokenOutputClient) QueryOutputSpentTokenTransaction(to *TokenOutput) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := to.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenoutput.Table, tokenoutput.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokenoutput.OutputSpentTokenTransactionTable, tokenoutput.OutputSpentTokenTransactionColumn),
		)
		fromV = sqlgraph.Neighbors(to.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryOutputSpentStartedTokenTransactions queries the output_spent_started_token_transactions edge of a TokenOutput.
func (c *TokenOutputClient) QueryOutputSpentStartedTokenTransactions(to *TokenOutput) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := to.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenoutput.Table, tokenoutput.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.M2M, false, tokenoutput.OutputSpentStartedTokenTransactionsTable, tokenoutput.OutputSpentStartedTokenTransactionsPrimaryKey...),
		)
		fromV = sqlgraph.Neighbors(to.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTokenPartialRevocationSecretShares queries the token_partial_revocation_secret_shares edge of a TokenOutput.
func (c *TokenOutputClient) QueryTokenPartialRevocationSecretShares(to *TokenOutput) *TokenPartialRevocationSecretShareQuery {
	query := (&TokenPartialRevocationSecretShareClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := to.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenoutput.Table, tokenoutput.FieldID, id),
			sqlgraph.To(tokenpartialrevocationsecretshare.Table, tokenpartialrevocationsecretshare.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, tokenoutput.TokenPartialRevocationSecretSharesTable, tokenoutput.TokenPartialRevocationSecretSharesColumn),
		)
		fromV = sqlgraph.Neighbors(to.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTokenCreate queries the token_create edge of a TokenOutput.
func (c *TokenOutputClient) QueryTokenCreate(to *TokenOutput) *TokenCreateQuery {
	query := (&TokenCreateClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := to.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenoutput.Table, tokenoutput.FieldID, id),
			sqlgraph.To(tokencreate.Table, tokencreate.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, tokenoutput.TokenCreateTable, tokenoutput.TokenCreateColumn),
		)
		fromV = sqlgraph.Neighbors(to.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenOutputClient) Hooks() []Hook {
	hooks := c.hooks.TokenOutput
	return append(hooks[:len(hooks):len(hooks)], tokenoutput.Hooks[:]...)
}

// Interceptors returns the client interceptors.
func (c *TokenOutputClient) Interceptors() []Interceptor {
	return c.inters.TokenOutput
}

func (c *TokenOutputClient) mutate(ctx context.Context, m *TokenOutputMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenOutputCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenOutputUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenOutputUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenOutputDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenOutput mutation op: %q", m.Op())
	}
}

// TokenPartialRevocationSecretShareClient is a client for the TokenPartialRevocationSecretShare schema.
type TokenPartialRevocationSecretShareClient struct {
	config
}

// NewTokenPartialRevocationSecretShareClient returns a client for the TokenPartialRevocationSecretShare from the given config.
func NewTokenPartialRevocationSecretShareClient(c config) *TokenPartialRevocationSecretShareClient {
	return &TokenPartialRevocationSecretShareClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokenpartialrevocationsecretshare.Hooks(f(g(h())))`.
func (c *TokenPartialRevocationSecretShareClient) Use(hooks ...Hook) {
	c.hooks.TokenPartialRevocationSecretShare = append(c.hooks.TokenPartialRevocationSecretShare, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokenpartialrevocationsecretshare.Intercept(f(g(h())))`.
func (c *TokenPartialRevocationSecretShareClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenPartialRevocationSecretShare = append(c.inters.TokenPartialRevocationSecretShare, interceptors...)
}

// Create returns a builder for creating a TokenPartialRevocationSecretShare entity.
func (c *TokenPartialRevocationSecretShareClient) Create() *TokenPartialRevocationSecretShareCreate {
	mutation := newTokenPartialRevocationSecretShareMutation(c.config, OpCreate)
	return &TokenPartialRevocationSecretShareCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenPartialRevocationSecretShare entities.
func (c *TokenPartialRevocationSecretShareClient) CreateBulk(builders ...*TokenPartialRevocationSecretShareCreate) *TokenPartialRevocationSecretShareCreateBulk {
	return &TokenPartialRevocationSecretShareCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenPartialRevocationSecretShareClient) MapCreateBulk(slice any, setFunc func(*TokenPartialRevocationSecretShareCreate, int)) *TokenPartialRevocationSecretShareCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenPartialRevocationSecretShareCreateBulk{err: fmt.Errorf("calling to TokenPartialRevocationSecretShareClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenPartialRevocationSecretShareCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenPartialRevocationSecretShareCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenPartialRevocationSecretShare.
func (c *TokenPartialRevocationSecretShareClient) Update() *TokenPartialRevocationSecretShareUpdate {
	mutation := newTokenPartialRevocationSecretShareMutation(c.config, OpUpdate)
	return &TokenPartialRevocationSecretShareUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenPartialRevocationSecretShareClient) UpdateOne(tprss *TokenPartialRevocationSecretShare) *TokenPartialRevocationSecretShareUpdateOne {
	mutation := newTokenPartialRevocationSecretShareMutation(c.config, OpUpdateOne, withTokenPartialRevocationSecretShare(tprss))
	return &TokenPartialRevocationSecretShareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenPartialRevocationSecretShareClient) UpdateOneID(id uuid.UUID) *TokenPartialRevocationSecretShareUpdateOne {
	mutation := newTokenPartialRevocationSecretShareMutation(c.config, OpUpdateOne, withTokenPartialRevocationSecretShareID(id))
	return &TokenPartialRevocationSecretShareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenPartialRevocationSecretShare.
func (c *TokenPartialRevocationSecretShareClient) Delete() *TokenPartialRevocationSecretShareDelete {
	mutation := newTokenPartialRevocationSecretShareMutation(c.config, OpDelete)
	return &TokenPartialRevocationSecretShareDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenPartialRevocationSecretShareClient) DeleteOne(tprss *TokenPartialRevocationSecretShare) *TokenPartialRevocationSecretShareDeleteOne {
	return c.DeleteOneID(tprss.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenPartialRevocationSecretShareClient) DeleteOneID(id uuid.UUID) *TokenPartialRevocationSecretShareDeleteOne {
	builder := c.Delete().Where(tokenpartialrevocationsecretshare.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenPartialRevocationSecretShareDeleteOne{builder}
}

// Query returns a query builder for TokenPartialRevocationSecretShare.
func (c *TokenPartialRevocationSecretShareClient) Query() *TokenPartialRevocationSecretShareQuery {
	return &TokenPartialRevocationSecretShareQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenPartialRevocationSecretShare},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenPartialRevocationSecretShare entity by its id.
func (c *TokenPartialRevocationSecretShareClient) Get(ctx context.Context, id uuid.UUID) (*TokenPartialRevocationSecretShare, error) {
	return c.Query().Where(tokenpartialrevocationsecretshare.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenPartialRevocationSecretShareClient) GetX(ctx context.Context, id uuid.UUID) *TokenPartialRevocationSecretShare {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTokenOutput queries the token_output edge of a TokenPartialRevocationSecretShare.
func (c *TokenPartialRevocationSecretShareClient) QueryTokenOutput(tprss *TokenPartialRevocationSecretShare) *TokenOutputQuery {
	query := (&TokenOutputClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tprss.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokenpartialrevocationsecretshare.Table, tokenpartialrevocationsecretshare.FieldID, id),
			sqlgraph.To(tokenoutput.Table, tokenoutput.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, tokenpartialrevocationsecretshare.TokenOutputTable, tokenpartialrevocationsecretshare.TokenOutputColumn),
		)
		fromV = sqlgraph.Neighbors(tprss.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenPartialRevocationSecretShareClient) Hooks() []Hook {
	return c.hooks.TokenPartialRevocationSecretShare
}

// Interceptors returns the client interceptors.
func (c *TokenPartialRevocationSecretShareClient) Interceptors() []Interceptor {
	return c.inters.TokenPartialRevocationSecretShare
}

func (c *TokenPartialRevocationSecretShareClient) mutate(ctx context.Context, m *TokenPartialRevocationSecretShareMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenPartialRevocationSecretShareCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenPartialRevocationSecretShareUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenPartialRevocationSecretShareUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenPartialRevocationSecretShareDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenPartialRevocationSecretShare mutation op: %q", m.Op())
	}
}

// TokenTransactionClient is a client for the TokenTransaction schema.
type TokenTransactionClient struct {
	config
}

// NewTokenTransactionClient returns a client for the TokenTransaction from the given config.
func NewTokenTransactionClient(c config) *TokenTransactionClient {
	return &TokenTransactionClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokentransaction.Hooks(f(g(h())))`.
func (c *TokenTransactionClient) Use(hooks ...Hook) {
	c.hooks.TokenTransaction = append(c.hooks.TokenTransaction, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokentransaction.Intercept(f(g(h())))`.
func (c *TokenTransactionClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenTransaction = append(c.inters.TokenTransaction, interceptors...)
}

// Create returns a builder for creating a TokenTransaction entity.
func (c *TokenTransactionClient) Create() *TokenTransactionCreate {
	mutation := newTokenTransactionMutation(c.config, OpCreate)
	return &TokenTransactionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenTransaction entities.
func (c *TokenTransactionClient) CreateBulk(builders ...*TokenTransactionCreate) *TokenTransactionCreateBulk {
	return &TokenTransactionCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenTransactionClient) MapCreateBulk(slice any, setFunc func(*TokenTransactionCreate, int)) *TokenTransactionCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenTransactionCreateBulk{err: fmt.Errorf("calling to TokenTransactionClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenTransactionCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenTransactionCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenTransaction.
func (c *TokenTransactionClient) Update() *TokenTransactionUpdate {
	mutation := newTokenTransactionMutation(c.config, OpUpdate)
	return &TokenTransactionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenTransactionClient) UpdateOne(tt *TokenTransaction) *TokenTransactionUpdateOne {
	mutation := newTokenTransactionMutation(c.config, OpUpdateOne, withTokenTransaction(tt))
	return &TokenTransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenTransactionClient) UpdateOneID(id uuid.UUID) *TokenTransactionUpdateOne {
	mutation := newTokenTransactionMutation(c.config, OpUpdateOne, withTokenTransactionID(id))
	return &TokenTransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenTransaction.
func (c *TokenTransactionClient) Delete() *TokenTransactionDelete {
	mutation := newTokenTransactionMutation(c.config, OpDelete)
	return &TokenTransactionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenTransactionClient) DeleteOne(tt *TokenTransaction) *TokenTransactionDeleteOne {
	return c.DeleteOneID(tt.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenTransactionClient) DeleteOneID(id uuid.UUID) *TokenTransactionDeleteOne {
	builder := c.Delete().Where(tokentransaction.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenTransactionDeleteOne{builder}
}

// Query returns a query builder for TokenTransaction.
func (c *TokenTransactionClient) Query() *TokenTransactionQuery {
	return &TokenTransactionQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenTransaction},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenTransaction entity by its id.
func (c *TokenTransactionClient) Get(ctx context.Context, id uuid.UUID) (*TokenTransaction, error) {
	return c.Query().Where(tokentransaction.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenTransactionClient) GetX(ctx context.Context, id uuid.UUID) *TokenTransaction {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QuerySpentOutput queries the spent_output edge of a TokenTransaction.
func (c *TokenTransactionClient) QuerySpentOutput(tt *TokenTransaction) *TokenOutputQuery {
	query := (&TokenOutputClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(tokenoutput.Table, tokenoutput.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, tokentransaction.SpentOutputTable, tokentransaction.SpentOutputColumn),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QuerySpentOutputV2 queries the spent_output_v2 edge of a TokenTransaction.
func (c *TokenTransactionClient) QuerySpentOutputV2(tt *TokenTransaction) *TokenOutputQuery {
	query := (&TokenOutputClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(tokenoutput.Table, tokenoutput.FieldID),
			sqlgraph.Edge(sqlgraph.M2M, true, tokentransaction.SpentOutputV2Table, tokentransaction.SpentOutputV2PrimaryKey...),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryCreatedOutput queries the created_output edge of a TokenTransaction.
func (c *TokenTransactionClient) QueryCreatedOutput(tt *TokenTransaction) *TokenOutputQuery {
	query := (&TokenOutputClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(tokenoutput.Table, tokenoutput.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, tokentransaction.CreatedOutputTable, tokentransaction.CreatedOutputColumn),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryMint queries the mint edge of a TokenTransaction.
func (c *TokenTransactionClient) QueryMint(tt *TokenTransaction) *TokenMintQuery {
	query := (&TokenMintClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(tokenmint.Table, tokenmint.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokentransaction.MintTable, tokentransaction.MintColumn),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryCreate queries the create edge of a TokenTransaction.
func (c *TokenTransactionClient) QueryCreate(tt *TokenTransaction) *TokenCreateQuery {
	query := (&TokenCreateClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(tokencreate.Table, tokencreate.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokentransaction.CreateTable, tokentransaction.CreateColumn),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPaymentIntent queries the payment_intent edge of a TokenTransaction.
func (c *TokenTransactionClient) QueryPaymentIntent(tt *TokenTransaction) *PaymentIntentQuery {
	query := (&PaymentIntentClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(paymentintent.Table, paymentintent.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tokentransaction.PaymentIntentTable, tokentransaction.PaymentIntentColumn),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPeerSignatures queries the peer_signatures edge of a TokenTransaction.
func (c *TokenTransactionClient) QueryPeerSignatures(tt *TokenTransaction) *TokenTransactionPeerSignatureQuery {
	query := (&TokenTransactionPeerSignatureClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(tokentransactionpeersignature.Table, tokentransactionpeersignature.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, tokentransaction.PeerSignaturesTable, tokentransaction.PeerSignaturesColumn),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QuerySparkInvoice queries the spark_invoice edge of a TokenTransaction.
func (c *TokenTransactionClient) QuerySparkInvoice(tt *TokenTransaction) *SparkInvoiceQuery {
	query := (&SparkInvoiceClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tt.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransaction.Table, tokentransaction.FieldID, id),
			sqlgraph.To(sparkinvoice.Table, sparkinvoice.FieldID),
			sqlgraph.Edge(sqlgraph.M2M, false, tokentransaction.SparkInvoiceTable, tokentransaction.SparkInvoicePrimaryKey...),
		)
		fromV = sqlgraph.Neighbors(tt.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenTransactionClient) Hooks() []Hook {
	hooks := c.hooks.TokenTransaction
	return append(hooks[:len(hooks):len(hooks)], tokentransaction.Hooks[:]...)
}

// Interceptors returns the client interceptors.
func (c *TokenTransactionClient) Interceptors() []Interceptor {
	return c.inters.TokenTransaction
}

func (c *TokenTransactionClient) mutate(ctx context.Context, m *TokenTransactionMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenTransactionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenTransactionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenTransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenTransactionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenTransaction mutation op: %q", m.Op())
	}
}

// TokenTransactionPeerSignatureClient is a client for the TokenTransactionPeerSignature schema.
type TokenTransactionPeerSignatureClient struct {
	config
}

// NewTokenTransactionPeerSignatureClient returns a client for the TokenTransactionPeerSignature from the given config.
func NewTokenTransactionPeerSignatureClient(c config) *TokenTransactionPeerSignatureClient {
	return &TokenTransactionPeerSignatureClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tokentransactionpeersignature.Hooks(f(g(h())))`.
func (c *TokenTransactionPeerSignatureClient) Use(hooks ...Hook) {
	c.hooks.TokenTransactionPeerSignature = append(c.hooks.TokenTransactionPeerSignature, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tokentransactionpeersignature.Intercept(f(g(h())))`.
func (c *TokenTransactionPeerSignatureClient) Intercept(interceptors ...Interceptor) {
	c.inters.TokenTransactionPeerSignature = append(c.inters.TokenTransactionPeerSignature, interceptors...)
}

// Create returns a builder for creating a TokenTransactionPeerSignature entity.
func (c *TokenTransactionPeerSignatureClient) Create() *TokenTransactionPeerSignatureCreate {
	mutation := newTokenTransactionPeerSignatureMutation(c.config, OpCreate)
	return &TokenTransactionPeerSignatureCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TokenTransactionPeerSignature entities.
func (c *TokenTransactionPeerSignatureClient) CreateBulk(builders ...*TokenTransactionPeerSignatureCreate) *TokenTransactionPeerSignatureCreateBulk {
	return &TokenTransactionPeerSignatureCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TokenTransactionPeerSignatureClient) MapCreateBulk(slice any, setFunc func(*TokenTransactionPeerSignatureCreate, int)) *TokenTransactionPeerSignatureCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TokenTransactionPeerSignatureCreateBulk{err: fmt.Errorf("calling to TokenTransactionPeerSignatureClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TokenTransactionPeerSignatureCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TokenTransactionPeerSignatureCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TokenTransactionPeerSignature.
func (c *TokenTransactionPeerSignatureClient) Update() *TokenTransactionPeerSignatureUpdate {
	mutation := newTokenTransactionPeerSignatureMutation(c.config, OpUpdate)
	return &TokenTransactionPeerSignatureUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TokenTransactionPeerSignatureClient) UpdateOne(ttps *TokenTransactionPeerSignature) *TokenTransactionPeerSignatureUpdateOne {
	mutation := newTokenTransactionPeerSignatureMutation(c.config, OpUpdateOne, withTokenTransactionPeerSignature(ttps))
	return &TokenTransactionPeerSignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TokenTransactionPeerSignatureClient) UpdateOneID(id uuid.UUID) *TokenTransactionPeerSignatureUpdateOne {
	mutation := newTokenTransactionPeerSignatureMutation(c.config, OpUpdateOne, withTokenTransactionPeerSignatureID(id))
	return &TokenTransactionPeerSignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TokenTransactionPeerSignature.
func (c *TokenTransactionPeerSignatureClient) Delete() *TokenTransactionPeerSignatureDelete {
	mutation := newTokenTransactionPeerSignatureMutation(c.config, OpDelete)
	return &TokenTransactionPeerSignatureDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TokenTransactionPeerSignatureClient) DeleteOne(ttps *TokenTransactionPeerSignature) *TokenTransactionPeerSignatureDeleteOne {
	return c.DeleteOneID(ttps.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TokenTransactionPeerSignatureClient) DeleteOneID(id uuid.UUID) *TokenTransactionPeerSignatureDeleteOne {
	builder := c.Delete().Where(tokentransactionpeersignature.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TokenTransactionPeerSignatureDeleteOne{builder}
}

// Query returns a query builder for TokenTransactionPeerSignature.
func (c *TokenTransactionPeerSignatureClient) Query() *TokenTransactionPeerSignatureQuery {
	return &TokenTransactionPeerSignatureQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTokenTransactionPeerSignature},
		inters: c.Interceptors(),
	}
}

// Get returns a TokenTransactionPeerSignature entity by its id.
func (c *TokenTransactionPeerSignatureClient) Get(ctx context.Context, id uuid.UUID) (*TokenTransactionPeerSignature, error) {
	return c.Query().Where(tokentransactionpeersignature.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TokenTransactionPeerSignatureClient) GetX(ctx context.Context, id uuid.UUID) *TokenTransactionPeerSignature {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTokenTransaction queries the token_transaction edge of a TokenTransactionPeerSignature.
func (c *TokenTransactionPeerSignatureClient) QueryTokenTransaction(ttps *TokenTransactionPeerSignature) *TokenTransactionQuery {
	query := (&TokenTransactionClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := ttps.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tokentransactionpeersignature.Table, tokentransactionpeersignature.FieldID, id),
			sqlgraph.To(tokentransaction.Table, tokentransaction.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, tokentransactionpeersignature.TokenTransactionTable, tokentransactionpeersignature.TokenTransactionColumn),
		)
		fromV = sqlgraph.Neighbors(ttps.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TokenTransactionPeerSignatureClient) Hooks() []Hook {
	return c.hooks.TokenTransactionPeerSignature
}

// Interceptors returns the client interceptors.
func (c *TokenTransactionPeerSignatureClient) Interceptors() []Interceptor {
	return c.inters.TokenTransactionPeerSignature
}

func (c *TokenTransactionPeerSignatureClient) mutate(ctx context.Context, m *TokenTransactionPeerSignatureMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TokenTransactionPeerSignatureCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TokenTransactionPeerSignatureUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TokenTransactionPeerSignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TokenTransactionPeerSignatureDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TokenTransactionPeerSignature mutation op: %q", m.Op())
	}
}

// TransferClient is a client for the Transfer schema.
type TransferClient struct {
	config
}

// NewTransferClient returns a client for the Transfer from the given config.
func NewTransferClient(c config) *TransferClient {
	return &TransferClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `transfer.Hooks(f(g(h())))`.
func (c *TransferClient) Use(hooks ...Hook) {
	c.hooks.Transfer = append(c.hooks.Transfer, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `transfer.Intercept(f(g(h())))`.
func (c *TransferClient) Intercept(interceptors ...Interceptor) {
	c.inters.Transfer = append(c.inters.Transfer, interceptors...)
}

// Create returns a builder for creating a Transfer entity.
func (c *TransferClient) Create() *TransferCreate {
	mutation := newTransferMutation(c.config, OpCreate)
	return &TransferCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Transfer entities.
func (c *TransferClient) CreateBulk(builders ...*TransferCreate) *TransferCreateBulk {
	return &TransferCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TransferClient) MapCreateBulk(slice any, setFunc func(*TransferCreate, int)) *TransferCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TransferCreateBulk{err: fmt.Errorf("calling to TransferClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TransferCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TransferCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Transfer.
func (c *TransferClient) Update() *TransferUpdate {
	mutation := newTransferMutation(c.config, OpUpdate)
	return &TransferUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TransferClient) UpdateOne(t *Transfer) *TransferUpdateOne {
	mutation := newTransferMutation(c.config, OpUpdateOne, withTransfer(t))
	return &TransferUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TransferClient) UpdateOneID(id uuid.UUID) *TransferUpdateOne {
	mutation := newTransferMutation(c.config, OpUpdateOne, withTransferID(id))
	return &TransferUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Transfer.
func (c *TransferClient) Delete() *TransferDelete {
	mutation := newTransferMutation(c.config, OpDelete)
	return &TransferDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TransferClient) DeleteOne(t *Transfer) *TransferDeleteOne {
	return c.DeleteOneID(t.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TransferClient) DeleteOneID(id uuid.UUID) *TransferDeleteOne {
	builder := c.Delete().Where(transfer.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TransferDeleteOne{builder}
}

// Query returns a query builder for Transfer.
func (c *TransferClient) Query() *TransferQuery {
	return &TransferQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTransfer},
		inters: c.Interceptors(),
	}
}

// Get returns a Transfer entity by its id.
func (c *TransferClient) Get(ctx context.Context, id uuid.UUID) (*Transfer, error) {
	return c.Query().Where(transfer.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TransferClient) GetX(ctx context.Context, id uuid.UUID) *Transfer {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTransferLeaves queries the transfer_leaves edge of a Transfer.
func (c *TransferClient) QueryTransferLeaves(t *Transfer) *TransferLeafQuery {
	query := (&TransferLeafClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transfer.Table, transfer.FieldID, id),
			sqlgraph.To(transferleaf.Table, transferleaf.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, transfer.TransferLeavesTable, transfer.TransferLeavesColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPaymentIntent queries the payment_intent edge of a Transfer.
func (c *TransferClient) QueryPaymentIntent(t *Transfer) *PaymentIntentQuery {
	query := (&PaymentIntentClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transfer.Table, transfer.FieldID, id),
			sqlgraph.To(paymentintent.Table, paymentintent.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, transfer.PaymentIntentTable, transfer.PaymentIntentColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QuerySparkInvoice queries the spark_invoice edge of a Transfer.
func (c *TransferClient) QuerySparkInvoice(t *Transfer) *SparkInvoiceQuery {
	query := (&SparkInvoiceClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transfer.Table, transfer.FieldID, id),
			sqlgraph.To(sparkinvoice.Table, sparkinvoice.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, transfer.SparkInvoiceTable, transfer.SparkInvoiceColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryCounterSwapTransfer queries the counter_swap_transfer edge of a Transfer.
func (c *TransferClient) QueryCounterSwapTransfer(t *Transfer) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transfer.Table, transfer.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, transfer.CounterSwapTransferTable, transfer.CounterSwapTransferColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPrimarySwapTransfer queries the primary_swap_transfer edge of a Transfer.
func (c *TransferClient) QueryPrimarySwapTransfer(t *Transfer) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transfer.Table, transfer.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, transfer.PrimarySwapTransferTable, transfer.PrimarySwapTransferColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TransferClient) Hooks() []Hook {
	hooks := c.hooks.Transfer
	return append(hooks[:len(hooks):len(hooks)], transfer.Hooks[:]...)
}

// Interceptors returns the client interceptors.
func (c *TransferClient) Interceptors() []Interceptor {
	return c.inters.Transfer
}

func (c *TransferClient) mutate(ctx context.Context, m *TransferMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TransferCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TransferUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TransferUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TransferDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Transfer mutation op: %q", m.Op())
	}
}

// TransferLeafClient is a client for the TransferLeaf schema.
type TransferLeafClient struct {
	config
}

// NewTransferLeafClient returns a client for the TransferLeaf from the given config.
func NewTransferLeafClient(c config) *TransferLeafClient {
	return &TransferLeafClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `transferleaf.Hooks(f(g(h())))`.
func (c *TransferLeafClient) Use(hooks ...Hook) {
	c.hooks.TransferLeaf = append(c.hooks.TransferLeaf, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `transferleaf.Intercept(f(g(h())))`.
func (c *TransferLeafClient) Intercept(interceptors ...Interceptor) {
	c.inters.TransferLeaf = append(c.inters.TransferLeaf, interceptors...)
}

// Create returns a builder for creating a TransferLeaf entity.
func (c *TransferLeafClient) Create() *TransferLeafCreate {
	mutation := newTransferLeafMutation(c.config, OpCreate)
	return &TransferLeafCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TransferLeaf entities.
func (c *TransferLeafClient) CreateBulk(builders ...*TransferLeafCreate) *TransferLeafCreateBulk {
	return &TransferLeafCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TransferLeafClient) MapCreateBulk(slice any, setFunc func(*TransferLeafCreate, int)) *TransferLeafCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TransferLeafCreateBulk{err: fmt.Errorf("calling to TransferLeafClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TransferLeafCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TransferLeafCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TransferLeaf.
func (c *TransferLeafClient) Update() *TransferLeafUpdate {
	mutation := newTransferLeafMutation(c.config, OpUpdate)
	return &TransferLeafUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TransferLeafClient) UpdateOne(tl *TransferLeaf) *TransferLeafUpdateOne {
	mutation := newTransferLeafMutation(c.config, OpUpdateOne, withTransferLeaf(tl))
	return &TransferLeafUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TransferLeafClient) UpdateOneID(id uuid.UUID) *TransferLeafUpdateOne {
	mutation := newTransferLeafMutation(c.config, OpUpdateOne, withTransferLeafID(id))
	return &TransferLeafUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TransferLeaf.
func (c *TransferLeafClient) Delete() *TransferLeafDelete {
	mutation := newTransferLeafMutation(c.config, OpDelete)
	return &TransferLeafDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TransferLeafClient) DeleteOne(tl *TransferLeaf) *TransferLeafDeleteOne {
	return c.DeleteOneID(tl.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TransferLeafClient) DeleteOneID(id uuid.UUID) *TransferLeafDeleteOne {
	builder := c.Delete().Where(transferleaf.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TransferLeafDeleteOne{builder}
}

// Query returns a query builder for TransferLeaf.
func (c *TransferLeafClient) Query() *TransferLeafQuery {
	return &TransferLeafQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTransferLeaf},
		inters: c.Interceptors(),
	}
}

// Get returns a TransferLeaf entity by its id.
func (c *TransferLeafClient) Get(ctx context.Context, id uuid.UUID) (*TransferLeaf, error) {
	return c.Query().Where(transferleaf.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TransferLeafClient) GetX(ctx context.Context, id uuid.UUID) *TransferLeaf {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTransfer queries the transfer edge of a TransferLeaf.
func (c *TransferLeafClient) QueryTransfer(tl *TransferLeaf) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tl.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transferleaf.Table, transferleaf.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, transferleaf.TransferTable, transferleaf.TransferColumn),
		)
		fromV = sqlgraph.Neighbors(tl.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryLeaf queries the leaf edge of a TransferLeaf.
func (c *TransferLeafClient) QueryLeaf(tl *TransferLeaf) *TreeNodeQuery {
	query := (&TreeNodeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tl.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(transferleaf.Table, transferleaf.FieldID, id),
			sqlgraph.To(treenode.Table, treenode.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, transferleaf.LeafTable, transferleaf.LeafColumn),
		)
		fromV = sqlgraph.Neighbors(tl.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TransferLeafClient) Hooks() []Hook {
	return c.hooks.TransferLeaf
}

// Interceptors returns the client interceptors.
func (c *TransferLeafClient) Interceptors() []Interceptor {
	return c.inters.TransferLeaf
}

func (c *TransferLeafClient) mutate(ctx context.Context, m *TransferLeafMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TransferLeafCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TransferLeafUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TransferLeafUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TransferLeafDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TransferLeaf mutation op: %q", m.Op())
	}
}

// TreeClient is a client for the Tree schema.
type TreeClient struct {
	config
}

// NewTreeClient returns a client for the Tree from the given config.
func NewTreeClient(c config) *TreeClient {
	return &TreeClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tree.Hooks(f(g(h())))`.
func (c *TreeClient) Use(hooks ...Hook) {
	c.hooks.Tree = append(c.hooks.Tree, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tree.Intercept(f(g(h())))`.
func (c *TreeClient) Intercept(interceptors ...Interceptor) {
	c.inters.Tree = append(c.inters.Tree, interceptors...)
}

// Create returns a builder for creating a Tree entity.
func (c *TreeClient) Create() *TreeCreate {
	mutation := newTreeMutation(c.config, OpCreate)
	return &TreeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Tree entities.
func (c *TreeClient) CreateBulk(builders ...*TreeCreate) *TreeCreateBulk {
	return &TreeCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TreeClient) MapCreateBulk(slice any, setFunc func(*TreeCreate, int)) *TreeCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TreeCreateBulk{err: fmt.Errorf("calling to TreeClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TreeCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TreeCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Tree.
func (c *TreeClient) Update() *TreeUpdate {
	mutation := newTreeMutation(c.config, OpUpdate)
	return &TreeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TreeClient) UpdateOne(t *Tree) *TreeUpdateOne {
	mutation := newTreeMutation(c.config, OpUpdateOne, withTree(t))
	return &TreeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TreeClient) UpdateOneID(id uuid.UUID) *TreeUpdateOne {
	mutation := newTreeMutation(c.config, OpUpdateOne, withTreeID(id))
	return &TreeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Tree.
func (c *TreeClient) Delete() *TreeDelete {
	mutation := newTreeMutation(c.config, OpDelete)
	return &TreeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TreeClient) DeleteOne(t *Tree) *TreeDeleteOne {
	return c.DeleteOneID(t.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TreeClient) DeleteOneID(id uuid.UUID) *TreeDeleteOne {
	builder := c.Delete().Where(tree.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TreeDeleteOne{builder}
}

// Query returns a query builder for Tree.
func (c *TreeClient) Query() *TreeQuery {
	return &TreeQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTree},
		inters: c.Interceptors(),
	}
}

// Get returns a Tree entity by its id.
func (c *TreeClient) Get(ctx context.Context, id uuid.UUID) (*Tree, error) {
	return c.Query().Where(tree.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TreeClient) GetX(ctx context.Context, id uuid.UUID) *Tree {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryRoot queries the root edge of a Tree.
func (c *TreeClient) QueryRoot(t *Tree) *TreeNodeQuery {
	query := (&TreeNodeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tree.Table, tree.FieldID, id),
			sqlgraph.To(treenode.Table, treenode.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, tree.RootTable, tree.RootColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryNodes queries the nodes edge of a Tree.
func (c *TreeClient) QueryNodes(t *Tree) *TreeNodeQuery {
	query := (&TreeNodeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tree.Table, tree.FieldID, id),
			sqlgraph.To(treenode.Table, treenode.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, tree.NodesTable, tree.NodesColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryDepositAddress queries the deposit_address edge of a Tree.
func (c *TreeClient) QueryDepositAddress(t *Tree) *DepositAddressQuery {
	query := (&DepositAddressClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := t.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(tree.Table, tree.FieldID, id),
			sqlgraph.To(depositaddress.Table, depositaddress.FieldID),
			sqlgraph.Edge(sqlgraph.O2O, true, tree.DepositAddressTable, tree.DepositAddressColumn),
		)
		fromV = sqlgraph.Neighbors(t.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TreeClient) Hooks() []Hook {
	return c.hooks.Tree
}

// Interceptors returns the client interceptors.
func (c *TreeClient) Interceptors() []Interceptor {
	return c.inters.Tree
}

func (c *TreeClient) mutate(ctx context.Context, m *TreeMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TreeCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TreeUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TreeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TreeDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Tree mutation op: %q", m.Op())
	}
}

// TreeNodeClient is a client for the TreeNode schema.
type TreeNodeClient struct {
	config
}

// NewTreeNodeClient returns a client for the TreeNode from the given config.
func NewTreeNodeClient(c config) *TreeNodeClient {
	return &TreeNodeClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `treenode.Hooks(f(g(h())))`.
func (c *TreeNodeClient) Use(hooks ...Hook) {
	c.hooks.TreeNode = append(c.hooks.TreeNode, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `treenode.Intercept(f(g(h())))`.
func (c *TreeNodeClient) Intercept(interceptors ...Interceptor) {
	c.inters.TreeNode = append(c.inters.TreeNode, interceptors...)
}

// Create returns a builder for creating a TreeNode entity.
func (c *TreeNodeClient) Create() *TreeNodeCreate {
	mutation := newTreeNodeMutation(c.config, OpCreate)
	return &TreeNodeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of TreeNode entities.
func (c *TreeNodeClient) CreateBulk(builders ...*TreeNodeCreate) *TreeNodeCreateBulk {
	return &TreeNodeCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *TreeNodeClient) MapCreateBulk(slice any, setFunc func(*TreeNodeCreate, int)) *TreeNodeCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &TreeNodeCreateBulk{err: fmt.Errorf("calling to TreeNodeClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*TreeNodeCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &TreeNodeCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for TreeNode.
func (c *TreeNodeClient) Update() *TreeNodeUpdate {
	mutation := newTreeNodeMutation(c.config, OpUpdate)
	return &TreeNodeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *TreeNodeClient) UpdateOne(tn *TreeNode) *TreeNodeUpdateOne {
	mutation := newTreeNodeMutation(c.config, OpUpdateOne, withTreeNode(tn))
	return &TreeNodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *TreeNodeClient) UpdateOneID(id uuid.UUID) *TreeNodeUpdateOne {
	mutation := newTreeNodeMutation(c.config, OpUpdateOne, withTreeNodeID(id))
	return &TreeNodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for TreeNode.
func (c *TreeNodeClient) Delete() *TreeNodeDelete {
	mutation := newTreeNodeMutation(c.config, OpDelete)
	return &TreeNodeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *TreeNodeClient) DeleteOne(tn *TreeNode) *TreeNodeDeleteOne {
	return c.DeleteOneID(tn.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *TreeNodeClient) DeleteOneID(id uuid.UUID) *TreeNodeDeleteOne {
	builder := c.Delete().Where(treenode.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &TreeNodeDeleteOne{builder}
}

// Query returns a query builder for TreeNode.
func (c *TreeNodeClient) Query() *TreeNodeQuery {
	return &TreeNodeQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeTreeNode},
		inters: c.Interceptors(),
	}
}

// Get returns a TreeNode entity by its id.
func (c *TreeNodeClient) Get(ctx context.Context, id uuid.UUID) (*TreeNode, error) {
	return c.Query().Where(treenode.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *TreeNodeClient) GetX(ctx context.Context, id uuid.UUID) *TreeNode {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTree queries the tree edge of a TreeNode.
func (c *TreeNodeClient) QueryTree(tn *TreeNode) *TreeQuery {
	query := (&TreeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tn.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(treenode.Table, treenode.FieldID, id),
			sqlgraph.To(tree.Table, tree.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, treenode.TreeTable, treenode.TreeColumn),
		)
		fromV = sqlgraph.Neighbors(tn.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryParent queries the parent edge of a TreeNode.
func (c *TreeNodeClient) QueryParent(tn *TreeNode) *TreeNodeQuery {
	query := (&TreeNodeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tn.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(treenode.Table, treenode.FieldID, id),
			sqlgraph.To(treenode.Table, treenode.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, treenode.ParentTable, treenode.ParentColumn),
		)
		fromV = sqlgraph.Neighbors(tn.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QuerySigningKeyshare queries the signing_keyshare edge of a TreeNode.
func (c *TreeNodeClient) QuerySigningKeyshare(tn *TreeNode) *SigningKeyshareQuery {
	query := (&SigningKeyshareClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tn.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(treenode.Table, treenode.FieldID, id),
			sqlgraph.To(signingkeyshare.Table, signingkeyshare.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, treenode.SigningKeyshareTable, treenode.SigningKeyshareColumn),
		)
		fromV = sqlgraph.Neighbors(tn.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryChildren queries the children edge of a TreeNode.
func (c *TreeNodeClient) QueryChildren(tn *TreeNode) *TreeNodeQuery {
	query := (&TreeNodeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := tn.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(treenode.Table, treenode.FieldID, id),
			sqlgraph.To(treenode.Table, treenode.FieldID),
			sqlgraph.Edge(sqlgraph.O2M, true, treenode.ChildrenTable, treenode.ChildrenColumn),
		)
		fromV = sqlgraph.Neighbors(tn.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *TreeNodeClient) Hooks() []Hook {
	hooks := c.hooks.TreeNode
	return append(hooks[:len(hooks):len(hooks)], treenode.Hooks[:]...)
}

// Interceptors returns the client interceptors.
func (c *TreeNodeClient) Interceptors() []Interceptor {
	return c.inters.TreeNode
}

func (c *TreeNodeClient) mutate(ctx context.Context, m *TreeNodeMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&TreeNodeCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&TreeNodeUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&TreeNodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&TreeNodeDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown TreeNode mutation op: %q", m.Op())
	}
}

// UserSignedTransactionClient is a client for the UserSignedTransaction schema.
type UserSignedTransactionClient struct {
	config
}

// NewUserSignedTransactionClient returns a client for the UserSignedTransaction from the given config.
func NewUserSignedTransactionClient(c config) *UserSignedTransactionClient {
	return &UserSignedTransactionClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `usersignedtransaction.Hooks(f(g(h())))`.
func (c *UserSignedTransactionClient) Use(hooks ...Hook) {
	c.hooks.UserSignedTransaction = append(c.hooks.UserSignedTransaction, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `usersignedtransaction.Intercept(f(g(h())))`.
func (c *UserSignedTransactionClient) Intercept(interceptors ...Interceptor) {
	c.inters.UserSignedTransaction = append(c.inters.UserSignedTransaction, interceptors...)
}

// Create returns a builder for creating a UserSignedTransaction entity.
func (c *UserSignedTransactionClient) Create() *UserSignedTransactionCreate {
	mutation := newUserSignedTransactionMutation(c.config, OpCreate)
	return &UserSignedTransactionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of UserSignedTransaction entities.
func (c *UserSignedTransactionClient) CreateBulk(builders ...*UserSignedTransactionCreate) *UserSignedTransactionCreateBulk {
	return &UserSignedTransactionCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *UserSignedTransactionClient) MapCreateBulk(slice any, setFunc func(*UserSignedTransactionCreate, int)) *UserSignedTransactionCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &UserSignedTransactionCreateBulk{err: fmt.Errorf("calling to UserSignedTransactionClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*UserSignedTransactionCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &UserSignedTransactionCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for UserSignedTransaction.
func (c *UserSignedTransactionClient) Update() *UserSignedTransactionUpdate {
	mutation := newUserSignedTransactionMutation(c.config, OpUpdate)
	return &UserSignedTransactionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *UserSignedTransactionClient) UpdateOne(ust *UserSignedTransaction) *UserSignedTransactionUpdateOne {
	mutation := newUserSignedTransactionMutation(c.config, OpUpdateOne, withUserSignedTransaction(ust))
	return &UserSignedTransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *UserSignedTransactionClient) UpdateOneID(id uuid.UUID) *UserSignedTransactionUpdateOne {
	mutation := newUserSignedTransactionMutation(c.config, OpUpdateOne, withUserSignedTransactionID(id))
	return &UserSignedTransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for UserSignedTransaction.
func (c *UserSignedTransactionClient) Delete() *UserSignedTransactionDelete {
	mutation := newUserSignedTransactionMutation(c.config, OpDelete)
	return &UserSignedTransactionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *UserSignedTransactionClient) DeleteOne(ust *UserSignedTransaction) *UserSignedTransactionDeleteOne {
	return c.DeleteOneID(ust.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *UserSignedTransactionClient) DeleteOneID(id uuid.UUID) *UserSignedTransactionDeleteOne {
	builder := c.Delete().Where(usersignedtransaction.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &UserSignedTransactionDeleteOne{builder}
}

// Query returns a query builder for UserSignedTransaction.
func (c *UserSignedTransactionClient) Query() *UserSignedTransactionQuery {
	return &UserSignedTransactionQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeUserSignedTransaction},
		inters: c.Interceptors(),
	}
}

// Get returns a UserSignedTransaction entity by its id.
func (c *UserSignedTransactionClient) Get(ctx context.Context, id uuid.UUID) (*UserSignedTransaction, error) {
	return c.Query().Where(usersignedtransaction.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *UserSignedTransactionClient) GetX(ctx context.Context, id uuid.UUID) *UserSignedTransaction {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryTreeNode queries the tree_node edge of a UserSignedTransaction.
func (c *UserSignedTransactionClient) QueryTreeNode(ust *UserSignedTransaction) *TreeNodeQuery {
	query := (&TreeNodeClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := ust.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(usersignedtransaction.Table, usersignedtransaction.FieldID, id),
			sqlgraph.To(treenode.Table, treenode.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, usersignedtransaction.TreeNodeTable, usersignedtransaction.TreeNodeColumn),
		)
		fromV = sqlgraph.Neighbors(ust.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryPreimageRequest queries the preimage_request edge of a UserSignedTransaction.
func (c *UserSignedTransactionClient) QueryPreimageRequest(ust *UserSignedTransaction) *PreimageRequestQuery {
	query := (&PreimageRequestClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := ust.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(usersignedtransaction.Table, usersignedtransaction.FieldID, id),
			sqlgraph.To(preimagerequest.Table, preimagerequest.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, usersignedtransaction.PreimageRequestTable, usersignedtransaction.PreimageRequestColumn),
		)
		fromV = sqlgraph.Neighbors(ust.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *UserSignedTransactionClient) Hooks() []Hook {
	return c.hooks.UserSignedTransaction
}

// Interceptors returns the client interceptors.
func (c *UserSignedTransactionClient) Interceptors() []Interceptor {
	return c.inters.UserSignedTransaction
}

func (c *UserSignedTransactionClient) mutate(ctx context.Context, m *UserSignedTransactionMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&UserSignedTransactionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&UserSignedTransactionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&UserSignedTransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&UserSignedTransactionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown UserSignedTransaction mutation op: %q", m.Op())
	}
}

// UtxoClient is a client for the Utxo schema.
type UtxoClient struct {
	config
}

// NewUtxoClient returns a client for the Utxo from the given config.
func NewUtxoClient(c config) *UtxoClient {
	return &UtxoClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `utxo.Hooks(f(g(h())))`.
func (c *UtxoClient) Use(hooks ...Hook) {
	c.hooks.Utxo = append(c.hooks.Utxo, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `utxo.Intercept(f(g(h())))`.
func (c *UtxoClient) Intercept(interceptors ...Interceptor) {
	c.inters.Utxo = append(c.inters.Utxo, interceptors...)
}

// Create returns a builder for creating a Utxo entity.
func (c *UtxoClient) Create() *UtxoCreate {
	mutation := newUtxoMutation(c.config, OpCreate)
	return &UtxoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of Utxo entities.
func (c *UtxoClient) CreateBulk(builders ...*UtxoCreate) *UtxoCreateBulk {
	return &UtxoCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *UtxoClient) MapCreateBulk(slice any, setFunc func(*UtxoCreate, int)) *UtxoCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &UtxoCreateBulk{err: fmt.Errorf("calling to UtxoClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*UtxoCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &UtxoCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for Utxo.
func (c *UtxoClient) Update() *UtxoUpdate {
	mutation := newUtxoMutation(c.config, OpUpdate)
	return &UtxoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *UtxoClient) UpdateOne(u *Utxo) *UtxoUpdateOne {
	mutation := newUtxoMutation(c.config, OpUpdateOne, withUtxo(u))
	return &UtxoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *UtxoClient) UpdateOneID(id uuid.UUID) *UtxoUpdateOne {
	mutation := newUtxoMutation(c.config, OpUpdateOne, withUtxoID(id))
	return &UtxoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for Utxo.
func (c *UtxoClient) Delete() *UtxoDelete {
	mutation := newUtxoMutation(c.config, OpDelete)
	return &UtxoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *UtxoClient) DeleteOne(u *Utxo) *UtxoDeleteOne {
	return c.DeleteOneID(u.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *UtxoClient) DeleteOneID(id uuid.UUID) *UtxoDeleteOne {
	builder := c.Delete().Where(utxo.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &UtxoDeleteOne{builder}
}

// Query returns a query builder for Utxo.
func (c *UtxoClient) Query() *UtxoQuery {
	return &UtxoQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeUtxo},
		inters: c.Interceptors(),
	}
}

// Get returns a Utxo entity by its id.
func (c *UtxoClient) Get(ctx context.Context, id uuid.UUID) (*Utxo, error) {
	return c.Query().Where(utxo.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *UtxoClient) GetX(ctx context.Context, id uuid.UUID) *Utxo {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryDepositAddress queries the deposit_address edge of a Utxo.
func (c *UtxoClient) QueryDepositAddress(u *Utxo) *DepositAddressQuery {
	query := (&DepositAddressClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := u.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(utxo.Table, utxo.FieldID, id),
			sqlgraph.To(depositaddress.Table, depositaddress.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, utxo.DepositAddressTable, utxo.DepositAddressColumn),
		)
		fromV = sqlgraph.Neighbors(u.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *UtxoClient) Hooks() []Hook {
	return c.hooks.Utxo
}

// Interceptors returns the client interceptors.
func (c *UtxoClient) Interceptors() []Interceptor {
	return c.inters.Utxo
}

func (c *UtxoClient) mutate(ctx context.Context, m *UtxoMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&UtxoCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&UtxoUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&UtxoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&UtxoDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown Utxo mutation op: %q", m.Op())
	}
}

// UtxoSwapClient is a client for the UtxoSwap schema.
type UtxoSwapClient struct {
	config
}

// NewUtxoSwapClient returns a client for the UtxoSwap from the given config.
func NewUtxoSwapClient(c config) *UtxoSwapClient {
	return &UtxoSwapClient{config: c}
}

// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `utxoswap.Hooks(f(g(h())))`.
func (c *UtxoSwapClient) Use(hooks ...Hook) {
	c.hooks.UtxoSwap = append(c.hooks.UtxoSwap, hooks...)
}

// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `utxoswap.Intercept(f(g(h())))`.
func (c *UtxoSwapClient) Intercept(interceptors ...Interceptor) {
	c.inters.UtxoSwap = append(c.inters.UtxoSwap, interceptors...)
}

// Create returns a builder for creating a UtxoSwap entity.
func (c *UtxoSwapClient) Create() *UtxoSwapCreate {
	mutation := newUtxoSwapMutation(c.config, OpCreate)
	return &UtxoSwapCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// CreateBulk returns a builder for creating a bulk of UtxoSwap entities.
func (c *UtxoSwapClient) CreateBulk(builders ...*UtxoSwapCreate) *UtxoSwapCreateBulk {
	return &UtxoSwapCreateBulk{config: c.config, builders: builders}
}

// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *UtxoSwapClient) MapCreateBulk(slice any, setFunc func(*UtxoSwapCreate, int)) *UtxoSwapCreateBulk {
	rv := reflect.ValueOf(slice)
	if rv.Kind() != reflect.Slice {
		return &UtxoSwapCreateBulk{err: fmt.Errorf("calling to UtxoSwapClient.MapCreateBulk with wrong type %T, need slice", slice)}
	}
	builders := make([]*UtxoSwapCreate, rv.Len())
	for i := 0; i < rv.Len(); i++ {
		builders[i] = c.Create()
		setFunc(builders[i], i)
	}
	return &UtxoSwapCreateBulk{config: c.config, builders: builders}
}

// Update returns an update builder for UtxoSwap.
func (c *UtxoSwapClient) Update() *UtxoSwapUpdate {
	mutation := newUtxoSwapMutation(c.config, OpUpdate)
	return &UtxoSwapUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOne returns an update builder for the given entity.
func (c *UtxoSwapClient) UpdateOne(us *UtxoSwap) *UtxoSwapUpdateOne {
	mutation := newUtxoSwapMutation(c.config, OpUpdateOne, withUtxoSwap(us))
	return &UtxoSwapUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// UpdateOneID returns an update builder for the given id.
func (c *UtxoSwapClient) UpdateOneID(id uuid.UUID) *UtxoSwapUpdateOne {
	mutation := newUtxoSwapMutation(c.config, OpUpdateOne, withUtxoSwapID(id))
	return &UtxoSwapUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// Delete returns a delete builder for UtxoSwap.
func (c *UtxoSwapClient) Delete() *UtxoSwapDelete {
	mutation := newUtxoSwapMutation(c.config, OpDelete)
	return &UtxoSwapDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}

// DeleteOne returns a builder for deleting the given entity.
func (c *UtxoSwapClient) DeleteOne(us *UtxoSwap) *UtxoSwapDeleteOne {
	return c.DeleteOneID(us.ID)
}

// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *UtxoSwapClient) DeleteOneID(id uuid.UUID) *UtxoSwapDeleteOne {
	builder := c.Delete().Where(utxoswap.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &UtxoSwapDeleteOne{builder}
}

// Query returns a query builder for UtxoSwap.
func (c *UtxoSwapClient) Query() *UtxoSwapQuery {
	return &UtxoSwapQuery{
		config: c.config,
		ctx:    &QueryContext{Type: TypeUtxoSwap},
		inters: c.Interceptors(),
	}
}

// Get returns a UtxoSwap entity by its id.
func (c *UtxoSwapClient) Get(ctx context.Context, id uuid.UUID) (*UtxoSwap, error) {
	return c.Query().Where(utxoswap.ID(id)).Only(ctx)
}

// GetX is like Get, but panics if an error occurs.
func (c *UtxoSwapClient) GetX(ctx context.Context, id uuid.UUID) *UtxoSwap {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}

// QueryUtxo queries the utxo edge of a UtxoSwap.
func (c *UtxoSwapClient) QueryUtxo(us *UtxoSwap) *UtxoQuery {
	query := (&UtxoClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := us.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(utxoswap.Table, utxoswap.FieldID, id),
			sqlgraph.To(utxo.Table, utxo.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, utxoswap.UtxoTable, utxoswap.UtxoColumn),
		)
		fromV = sqlgraph.Neighbors(us.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// QueryTransfer queries the transfer edge of a UtxoSwap.
func (c *UtxoSwapClient) QueryTransfer(us *UtxoSwap) *TransferQuery {
	query := (&TransferClient{config: c.config}).Query()
	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
		id := us.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(utxoswap.Table, utxoswap.FieldID, id),
			sqlgraph.To(transfer.Table, transfer.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, utxoswap.TransferTable, utxoswap.TransferColumn),
		)
		fromV = sqlgraph.Neighbors(us.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}

// Hooks returns the client hooks.
func (c *UtxoSwapClient) Hooks() []Hook {
	return c.hooks.UtxoSwap
}

// Interceptors returns the client interceptors.
func (c *UtxoSwapClient) Interceptors() []Interceptor {
	return c.inters.UtxoSwap
}

func (c *UtxoSwapClient) mutate(ctx context.Context, m *UtxoSwapMutation) (Value, error) {
	switch m.Op() {
	case OpCreate:
		return (&UtxoSwapCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdate:
		return (&UtxoSwapUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpUpdateOne:
		return (&UtxoSwapUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
	case OpDelete, OpDeleteOne:
		return (&UtxoSwapDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
	default:
		return nil, fmt.Errorf("ent: unknown UtxoSwap mutation op: %q", m.Op())
	}
}

// hooks and interceptors per client, for fast access.
type (
	hooks struct {
		BlockHeight, CooperativeExit, DepositAddress, EntityDkgKey, Gossip,
		L1TokenCreate, PaymentIntent, PendingSendTransfer, PreimageRequest,
		PreimageShare, SigningCommitment, SigningKeyshare, SigningNonce, SparkInvoice,
		TokenCreate, TokenFreeze, TokenMint, TokenOutput,
		TokenPartialRevocationSecretShare, TokenTransaction,
		TokenTransactionPeerSignature, Transfer, TransferLeaf, Tree, TreeNode,
		UserSignedTransaction, Utxo, UtxoSwap []ent.Hook
	}
	inters struct {
		BlockHeight, CooperativeExit, DepositAddress, EntityDkgKey, Gossip,
		L1TokenCreate, PaymentIntent, PendingSendTransfer, PreimageRequest,
		PreimageShare, SigningCommitment, SigningKeyshare, SigningNonce, SparkInvoice,
		TokenCreate, TokenFreeze, TokenMint, TokenOutput,
		TokenPartialRevocationSecretShare, TokenTransaction,
		TokenTransactionPeerSignature, Transfer, TransferLeaf, Tree, TreeNode,
		UserSignedTransaction, Utxo, UtxoSwap []ent.Interceptor
	}
)

// ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it.
// See, database/sql#DB.ExecContext for more information.
func (c *config) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) {
	ex, ok := c.driver.(interface {
		ExecContext(context.Context, string, ...any) (stdsql.Result, error)
	})
	if !ok {
		return nil, fmt.Errorf("Driver.ExecContext is not supported")
	}
	return ex.ExecContext(ctx, query, args...)
}

// QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it.
// See, database/sql#DB.QueryContext for more information.
func (c *config) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) {
	q, ok := c.driver.(interface {
		QueryContext(context.Context, string, ...any) (*stdsql.Rows, error)
	})
	if !ok {
		return nil, fmt.Errorf("Driver.QueryContext is not supported")
	}
	return q.QueryContext(ctx, query, args...)
}
