client

package
v0.0.0-...-38749d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2022 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	EthereumRpc: "https://rpc.valist.io",
	IpfsHost:    "https://pin.valist.io",
	IpfsGateway: "https://gateway.valist.io",
}

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, opts *Options) (*Client, error)

NewClient returns a client using the given contract and storage providers.

func (*Client) AccountExists

func (c *Client) AccountExists(ctx context.Context, accountID *big.Int) (bool, error)

AccountExists returns true if the account with the given ID exists.

func (*Client) AddAccountMember

func (c *Client) AddAccountMember(ctx context.Context, accountID *big.Int, address string) (*types.Transaction, error)

AddAccountMember adds a member to the account. Requires the sender to be a member of the account.

func (*Client) AddProjectMember

func (c *Client) AddProjectMember(ctx context.Context, projectID *big.Int, address string) (*types.Transaction, error)

AddProjectMemeber adds a member to the project. Requires the sender to be a member of the account.

func (*Client) ApproveRelease

func (c *Client) ApproveRelease(ctx context.Context, releaseID *big.Int) (*types.Transaction, error)

ApproveRelease adds the senders address to the signers list.

func (*Client) CreateAccount

func (c *Client) CreateAccount(ctx context.Context, name string, account *valist.AccountMeta, members []string) (*types.Transaction, error)

CreateAccount creates an account with the given name, metadata, and members.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, accountID *big.Int, name string, project *valist.ProjectMeta, members []string) (*types.Transaction, error)

CreateProject creates a project under the account with the given id, metadata, and members.

func (*Client) CreateRelease

func (c *Client) CreateRelease(ctx context.Context, projectID *big.Int, name string, release *valist.ReleaseMeta) (*types.Transaction, error)

CreateRelease creates a release under the project with the given name and metadata.

func (*Client) GenerateID

func (c *Client) GenerateID(parentID *big.Int, name string) *big.Int

GenerateID returns the ID of the object with the given parentID and name.

func (*Client) GetAccountMembers

func (c *Client) GetAccountMembers(ctx context.Context, accountID *big.Int) ([]common.Address, error)

GetAccountMembers returns a list of account members.

func (*Client) GetAccountMeta

func (c *Client) GetAccountMeta(ctx context.Context, accountID *big.Int) (*valist.AccountMeta, error)

GetAccountMeta returns the metadata of the account with the given ID.

func (*Client) GetLatestReleaseID

func (c *Client) GetLatestReleaseID(ctx context.Context, projectID *big.Int) (*big.Int, error)

GetLatestReleaseID returns the ID of the latest release for the given project.

func (*Client) GetLatestReleaseMeta

func (c *Client) GetLatestReleaseMeta(ctx context.Context, projectID *big.Int) (*valist.ReleaseMeta, error)

GetLatestReleaseMeta returns the latest release.

func (*Client) GetPreviousReleaseID

func (c *Client) GetPreviousReleaseID(ctx context.Context, releaseID *big.Int) (*big.Int, error)

GetPreviousReleaseID returns the ID of the previous release for the given release.

func (*Client) GetProductBalance

func (c *Client) GetProductBalance(ctx context.Context, projectID *big.Int) (*big.Int, error)

GetProductBalance returns the current balance of the product for the given project.

func (*Client) GetProductLimit

func (c *Client) GetProductLimit(ctx context.Context, projectID *big.Int) (*big.Int, error)

GetProductLimit returns the limit of supply for the product in the given project.

func (*Client) GetProductPrice

func (c *Client) GetProductPrice(ctx context.Context, projectID *big.Int) (*big.Int, error)

GetProductPrice returns the price of the product for the given project.

func (*Client) GetProductSupply

func (c *Client) GetProductSupply(ctx context.Context, projectID *big.Int) (*big.Int, error)

GetProductSupply returns the total supply of the product in the given project.

func (*Client) GetProductTokenBalance

func (c *Client) GetProductTokenBalance(ctx context.Context, token string, projectID *big.Int) (*big.Int, error)

GetProductTokenBalance returns the current balance of the product for the given project.

func (*Client) GetProductTokenPrice

func (c *Client) GetProductTokenPrice(ctx context.Context, token string, projectID *big.Int) (*big.Int, error)

GetProductTokenPrice returns the token price of the product for the given project.

func (*Client) GetProjectAccountID

func (c *Client) GetProjectAccountID(ctx context.Context, projectID *big.Int) (*big.Int, error)

GetProjectAccountID returns the ID of the account for the given project.

func (*Client) GetProjectMembers

func (c *Client) GetProjectMembers(ctx context.Context, projectID *big.Int) ([]common.Address, error)

GetProjectMembers returns a list of project members.

func (*Client) GetProjectMeta

func (c *Client) GetProjectMeta(ctx context.Context, projectID *big.Int) (*valist.ProjectMeta, error)

GetProjectMeta returns the metadata of the project with the given ID.

func (*Client) GetReleaseMeta

func (c *Client) GetReleaseMeta(ctx context.Context, releaseID *big.Int) (*valist.ReleaseMeta, error)

GetReleaseMeta returns the metadata of the release with the given ID.

func (*Client) GetReleaseProjectID

func (c *Client) GetReleaseProjectID(ctx context.Context, releaseID *big.Int) (*big.Int, error)

GetReleaseProjectID returns the ID of the project for the given release.

func (*Client) GetReleaseSigners

func (c *Client) GetReleaseSigners(ctx context.Context, releaseID *big.Int) ([]common.Address, error)

GetReleaseSigners returns a list of release signers.

func (*Client) IsAccountMember

func (c *Client) IsAccountMember(ctx context.Context, accountID *big.Int, address string) (bool, error)

IsAccountMember returns true if the given address is an account member.

func (*Client) IsProjectMember

func (c *Client) IsProjectMember(ctx context.Context, projectID *big.Int, address string) (bool, error)

IsProjectMember returns true if the given address is a project member.

func (*Client) IsReleaseSigner

func (c *Client) IsReleaseSigner(ctx context.Context, releaseID *big.Int, address string) (bool, error)

IsReleaseSigner returns true if the given address is a release signer.

func (*Client) ProductBalanceOf

func (c *Client) ProductBalanceOf(ctx context.Context, address string, projectID *big.Int) (*big.Int, error)

ProductBalanceOf returns the product balance of the address for the given project.

func (*Client) ProductRoyaltyInfo

func (c *Client) ProductRoyaltyInfo(ctx context.Context, projectID, price *big.Int) (common.Address, *big.Int, error)

ProductRoyaltyInfo returns the royalty recipient and amount owed for product.

func (*Client) ProjectExists

func (c *Client) ProjectExists(ctx context.Context, projectID *big.Int) (bool, error)

ProjectExists returns true if the project with the given ID exists.

func (*Client) PurchaseProduct

func (c *Client) PurchaseProduct(ctx context.Context, projectID *big.Int, recipient string) (*types.Transaction, error)

PurchaseProduct purchases the product for the given project on behalf of the recipient.

func (*Client) PurchaseProductToken

func (c *Client) PurchaseProductToken(ctx context.Context, token string, projectID *big.Int, recipient string) (*types.Transaction, error)

PurchaseProductToken purchases the product for the given project on behalf of the recipient.

func (*Client) ReleaseExists

func (c *Client) ReleaseExists(ctx context.Context, releaseID *big.Int) (bool, error)

ReleaseExists returns true if the release with the given ID exists.

func (*Client) RemoveAccountMember

func (c *Client) RemoveAccountMember(ctx context.Context, accountID *big.Int, address string) (*types.Transaction, error)

RemoveAccountMember removes a member from the account. Requires the sender to be a member of the account.

func (*Client) RemoveProjectMember

func (c *Client) RemoveProjectMember(ctx context.Context, projectID *big.Int, address string) (*types.Transaction, error)

RemoveProjectMember removes a member from the project. Requires the sender to be a member of the account.

func (*Client) RevokeRelease

func (c *Client) RevokeRelease(ctx context.Context, releaseID *big.Int) (*types.Transaction, error)

RevokeRelease removes the senders address from the signers list.

func (*Client) SetAccountMetaURI

func (c *Client) SetAccountMetaURI(ctx context.Context, accountID *big.Int, account *valist.AccountMeta) (*types.Transaction, error)

SetAccountMetaURI sets the account metadata. Requires the sender to be a member of the account.

func (*Client) SetProductLimit

func (c *Client) SetProductLimit(ctx context.Context, projectID, limit *big.Int) (*types.Transaction, error)

SetProductLimit sets the limit on the total supply of products in the given project.

func (*Client) SetProductPrice

func (c *Client) SetProductPrice(ctx context.Context, projectID, price *big.Int) (*types.Transaction, error)

SetProductPrice sets the price of the product for the given project.

func (*Client) SetProductRoyalty

func (c *Client) SetProductRoyalty(ctx context.Context, projectID *big.Int, recipient string, amount *big.Int) (*types.Transaction, error)

SetProductRoyalty sets the royalty recipient and amount in basis points for the given project.

func (*Client) SetProductTokenPrice

func (c *Client) SetProductTokenPrice(ctx context.Context, token string, projectID, price *big.Int) (*types.Transaction, error)

SetProductTokenPrice sets the token price of the product for the given project.

func (*Client) SetProjectMetaURI

func (c *Client) SetProjectMetaURI(ctx context.Context, projectID *big.Int, project *valist.ProjectMeta) (*types.Transaction, error)

SetProjectMetaURI sets the project metadata content ID. Requires the sender to be a member of the account.

func (*Client) WriteJSON

func (c *Client) WriteJSON(ctx context.Context, data []byte) (string, error)

WriteJSON writes JSON data to storage.

type Options

type Options struct {
	// EthereumRpc is the URL of the ethereum RPC.
	EthereumRpc string
	// IpfsHost is the URL of the IPFS host.
	IpfsHost string
	// IpfsGateway is the URL of the IPFS gateway.
	IpfsGateway string
	// PrivateKey is the key to use for signing transactions.
	PrivateKey *ecdsa.PrivateKey
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL