Documentation
¶
Index ¶
- type Provider
- func (p *Provider) GetAddressFromStarkName(ctx context.Context, domain string) (string, error)
- func (p *Provider) GetExtendedUserData(ctx context.Context, idDomainOrAddr string, field string, length int) ([]*felt.Felt, error)
- func (p *Provider) GetExtendedVerifierData(ctx context.Context, idDomainOrAddr string, field string, length int, ...) ([]*felt.Felt, error)
- func (p *Provider) GetPfpVerifierData(ctx context.Context, idDomainOrAddr string, verifier *string) ([]*felt.Felt, error)
- func (p *Provider) GetProfileData(ctx context.Context, address string, useDefaultPfp bool, verifier *string, ...) (types.StarkProfile, error)
- func (p *Provider) GetStarkName(ctx context.Context, address string) (string, error)
- func (p *Provider) GetStarkNames(ctx context.Context, addresses []string, multicall *string) ([]string, error)
- func (p *Provider) GetStarkProfiles(ctx context.Context, addresses []string, useDefaultPfp bool, ...) ([]types.StarkProfile, error)
- func (p *Provider) GetStarknetId(ctx context.Context, domain string) (string, error)
- func (p *Provider) GetUnboundedUserData(ctx context.Context, idDomainOrAddr string, field string) ([]*felt.Felt, error)
- func (p *Provider) GetUnboundedVerifierData(ctx context.Context, idDomainOrAddr string, field string, verifier *string) ([]*felt.Felt, error)
- func (p *Provider) GetUserData(ctx context.Context, idDomainOrAddr string, field string) (*felt.Felt, error)
- func (p *Provider) GetVerifierData(ctx context.Context, idDomainOrAddr string, field string, verifier *string) (*felt.Felt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct { Client *rpc.Provider ChainId types.StarknetChainId StarknetIdContracts *types.StarknetIdContracts }
Provider is a Starknet ID provider.
func NewProvider ¶
func NewProvider( provider *rpc.Provider, chainId types.StarknetChainId, starknetIdContracts *types.StarknetIdContracts, ) (*Provider, error)
NewProvider creates a new Provider instance.
Parameters:
- provider: the RPC provider.
- chainId: the Starknet chain ID.
- starknetIdContracts: the Starknet ID contracts. If nil, it will try to fetch the identity and naming contracts from the chain ID.
Returns:
- *Provider: the new Provider instance.
- error: an error if the provider is nil, the chain ID is empty or the contracts are nil and the identity or naming contracts could not be fetched.
func (*Provider) GetAddressFromStarkName ¶
GetAddressFromStarknetId returns the address for a given .stark domain.
Parameters:
- ctx: the context.
- domain: the .stark domain (.stark suffix is optional).
Returns:
- string: the address.
- error: an error if the domain is invalid or the address could not be resolved.
func (*Provider) GetExtendedUserData ¶
func (p *Provider) GetExtendedUserData( ctx context.Context, idDomainOrAddr string, field string, length int, ) ([]*felt.Felt, error)
GetExtendedUserData returns the extended user data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- field: the field name.
- length: the length of the data.
Returns:
- []*felt.Felt: the extended user data.
- error: an error if the Starknet ID, domain or address is invalid or the extended user data could not be fetched.
func (*Provider) GetExtendedVerifierData ¶
func (p *Provider) GetExtendedVerifierData( ctx context.Context, idDomainOrAddr string, field string, length int, verifier *string, ) ([]*felt.Felt, error)
GetExtendedVerifierData returns the extended verifier data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- field: the field name.
- length: the length of the data.
- verifier: the verifier contract address. If nil, it will try to fetch the verifier contract from the chain ID.
Returns:
- []*felt.Felt: the extended verifier data.
- error: an error if the Starknet ID, domain or address is invalid or the extended verifier data could not be fetched.
func (*Provider) GetPfpVerifierData ¶
func (p *Provider) GetPfpVerifierData( ctx context.Context, idDomainOrAddr string, verifier *string, ) ([]*felt.Felt, error)
GetPfpVerifierData returns the profile picture verifier data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- verifier: the verifier contract address. If nil, it will try to fetch the verifier contract from the chain ID.
Returns:
- []*felt.Felt: the profile picture verifier data.
- error: an error if the Starknet ID, domain or address is invalid or the profile picture verifier data could not be fetched.
func (*Provider) GetProfileData ¶
func (p *Provider) GetProfileData( ctx context.Context, address string, useDefaultPfp bool, verifier *string, pfpVerifier *string, popVerifier *string, ) (types.StarkProfile, error)
GetProfileData returns the profile for a given address.
Parameters:
- ctx: the context.
- address: the address.
- useDefaultPfp: whether to use the default profile picture.
- verifier: the verifier contract address. If nil, it will try to fetch the verifier contract from the chain ID.
- pfpVerifier: the profile picture verifier contract address. If nil, it will try to fetch the profile picture verifier contract from the chain ID.
- popVerifier: the proof of profile verifier contract address. If nil, it will try to fetch the proof of profile verifier contract from the chain ID.
Returns:
- types.StarkProfile: the profile.
- error: an error if the profile could not be fetched.
func (*Provider) GetStarkName ¶
GetStarkName returns the .stark domain for a given address.
Parameters:
- ctx: the context.
- address: the address.
Returns:
- string: the .stark domain.
- error: an error if the address is invalid or the domain could not be resolved.
func (*Provider) GetStarkNames ¶
func (p *Provider) GetStarkNames( ctx context.Context, addresses []string, multicall *string, ) ([]string, error)
GetStarkNames returns the .stark domains for a given list of addresses.
Parameters:
- ctx: the context.
- addresses: the addresses.
- multicall: the multicall contract address. If nil, it will try to fetch the multicall contract from the chain ID.
Returns:
- []string: the .stark domains.
- error: an error if the addresses are invalid or the domains could not be resolved.
func (*Provider) GetStarkProfiles ¶
func (p *Provider) GetStarkProfiles( ctx context.Context, addresses []string, useDefaultPfp bool, pfpVerifier *string, ) ([]types.StarkProfile, error)
GetStarkProfiles returns the .stark domain and profile picture for a given list of addresses.
Parameters:
- ctx: the context.
- addresses: the addresses.
- useDefaultPfp: whether to use the default profile picture.
- pfpVerifier: the profile picture verifier contract address. If nil, it will try to fetch the profile picture verifier contract from the chain ID.
Returns:
- []types.StarkProfile: the profiles with only the .stark domain and profile picture.
- error: an error if the profiles could not be fetched.
func (*Provider) GetStarknetId ¶
GetStarknetId returns the Starknet ID for a given .stark domain.
Parameters:
- ctx: the context.
- domain: the .stark domain (.stark suffix is optional).
Returns:
- string: the Starknet ID.
- error: an error if the domain is invalid or the Starknet ID could not be resolved.
func (*Provider) GetUnboundedUserData ¶
func (p *Provider) GetUnboundedUserData( ctx context.Context, idDomainOrAddr string, field string, ) ([]*felt.Felt, error)
GetUnboundedUserData returns the unbounded user data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- field: the field name.
Returns:
- []*felt.Felt: the unbounded user data.
- error: an error if the Starknet ID, domain or address is invalid or the unbounded user data could not be fetched.
func (*Provider) GetUnboundedVerifierData ¶
func (p *Provider) GetUnboundedVerifierData( ctx context.Context, idDomainOrAddr string, field string, verifier *string, ) ([]*felt.Felt, error)
GetUnboundedVerifierData returns the unbounded verifier data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- field: the field name.
- verifier: the verifier contract address. If nil, it will try to fetch the verifier contract from the chain ID.
Returns:
- []*felt.Felt: the unbounded verifier data.
- error: an error if the Starknet ID, domain or address is invalid or the unbounded verifier data could not be fetched.
func (*Provider) GetUserData ¶
func (p *Provider) GetUserData( ctx context.Context, idDomainOrAddr string, field string, ) (*felt.Felt, error)
GetUserData returns the user data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- field: the field name.
Returns:
- *felt.Felt: the user data.
- error: an error if the Starknet ID, domain or address is invalid or the user data could not be fetched.
func (*Provider) GetVerifierData ¶
func (p *Provider) GetVerifierData( ctx context.Context, idDomainOrAddr string, field string, verifier *string, ) (*felt.Felt, error)
GetVerifierData returns the verifier data for a given Starknet ID, domain or address.
Parameters:
- ctx: the context.
- idDomainOrAddr: the Starknet ID, .stark domain (.stark suffix is optional) or address.
- field: the field name.
- verifier: the verifier contract address. If nil, it will try to fetch the verifier contract from the chain ID.
Returns:
- *felt.Felt: the verifier data.
- error: an error if the Starknet ID, domain or address is invalid or the verifier data could not be fetched.