Documentation
¶
Overview ¶
Package privy implements Privy's OAuth device-grant wallet signing protocol.
Index ¶
- Constants
- Variables
- func HexQuantity(v uint64) string
- type Call
- type Client
- func (c *Client) Authenticate(ctx context.Context, accessToken string) (*Session, error)
- func (c *Client) PollDeviceToken(ctx context.Context, da *DeviceAuthorization, ...) (*Tokens, error)
- func (c *Client) Refresh(ctx context.Context, refreshToken string) (*Tokens, error)
- func (c *Client) RevokeGrant(ctx context.Context, accessToken string) error
- func (c *Client) StartDeviceAuthorization(ctx context.Context) (*DeviceAuthorization, error)
- type DeviceAuthorization
- type Error
- type Session
- func (s *Session) ExpiresAt() time.Time
- func (s *Session) SendCalls(ctx context.Context, walletID string, chainID uint64, calls []Call) (string, error)
- func (s *Session) SendTransaction(ctx context.Context, walletID string, tx Transaction) (string, error)
- func (s *Session) SignTypedData(ctx context.Context, walletID string, typedData TypedData) ([65]byte, error)
- func (s *Session) SignedRPC(ctx context.Context, walletID string, body any, out any) error
- func (s *Session) Wallets() []Wallet
- type Tokens
- type Transaction
- type TypedData
- type TypedField
- type Wallet
Constants ¶
const DefaultAuthURL = "https://auth.privy.io"
Variables ¶
Functions ¶
func HexQuantity ¶
HexQuantity converts a nonnegative uint64 to an Ethereum JSON-RPC quantity.
Types ¶
type Client ¶
func (*Client) Authenticate ¶
func (*Client) PollDeviceToken ¶
func (*Client) RevokeGrant ¶
func (*Client) StartDeviceAuthorization ¶
func (c *Client) StartDeviceAuthorization(ctx context.Context) (*DeviceAuthorization, error)
type DeviceAuthorization ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) SendCalls ¶
func (s *Session) SendCalls(ctx context.Context, walletID string, chainID uint64, calls []Call) (string, error)
SendCalls submits an atomic EIP-7702 batch (Privy upgrades the wallet to a Kernel account on first use). It returns Privy's transaction ID, not a chain hash. A successful response means the batch was broadcast; callers must never retry an ambiguous error.
func (*Session) SendTransaction ¶
func (*Session) SignTypedData ¶
type Transaction ¶
type Transaction struct {
To string
Value string
Data string
ChainID uint64
LegacyGasPrice string // when set, send a type-0 transaction
}
Transaction is a Privy OAuth eth_sendTransaction request. Privy signs and broadcasts the transaction; callers must never retry an ambiguous error. Shape follows Privy's published wallet RPC schema (EthereumSendTransactionRpcInput): a required top-level caip2 ("eip155:<chain>") plus params.transaction with chain_id. Verified live on Arbitrum with a funded agent wallet.
type TypedData ¶
type TypedData struct {
Domain map[string]any `json:"domain"`
Types map[string][]TypedField `json:"types"`
PrimaryType string `json:"primary_type"`
Message map[string]any `json:"message"`
}