client

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ORG_ADMIN  = crypto.Keccak256Hash([]byte("ORG_ADMIN_ROLE"))
	REPO_DEV   = crypto.Keccak256Hash([]byte("REPO_DEV_ROLE"))
	ADD_KEY    = crypto.Keccak256Hash([]byte("ADD_KEY_OPERATION"))
	REVOKE_KEY = crypto.Keccak256Hash([]byte("REVOKE_KEY_OPERATION"))
	ROTATE_KEY = crypto.Keccak256Hash([]byte("ROTATE_KEY_OPERATION"))
)

Functions

This section is empty.

Types

type Client

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

Client is a Valist SDK client.

func NewClient

func NewClient(opts Options) (*Client, error)

NewClient create a client from the given options.

func (*Client) Close

func (client *Client) Close() error

func (*Client) CreateOrganization

func (client *Client) CreateOrganization(ctx context.Context, meta *types.OrganizationMeta) (*valist.ValistOrgCreated, error)

CreateOrganization creates a new organization using the given metadata.

func (*Client) CreateRepository

func (client *Client) CreateRepository(ctx context.Context, orgID common.Hash, name string, meta *types.RepositoryMeta) (*valist.ValistRepoCreated, error)

CreateRepository creates a repository in the organization with the given orgID.

func (*Client) GetLatestRelease

func (client *Client) GetLatestRelease(ctx context.Context, orgID common.Hash, repoName string) (*types.Release, error)

GetLatestRelease returns the most recent release from the repo with the given repoName and orgID.

func (*Client) GetOrganization

func (client *Client) GetOrganization(ctx context.Context, id common.Hash) (*types.Organization, error)

GetOrganization returns the organization with the given orgID.

func (*Client) GetOrganizationID

func (client *Client) GetOrganizationID(ctx context.Context, name string) (common.Hash, error)

GetOrganizationID returns the orgID for the given orgName.

func (*Client) GetOrganizationMeta

func (client *Client) GetOrganizationMeta(ctx context.Context, p string) (*types.OrganizationMeta, error)

GetOrganizationMeta returns the organization metadata from the given path.

func (*Client) GetRelease

func (client *Client) GetRelease(ctx context.Context, orgID common.Hash, repoName, tag string) (*types.Release, error)

GetRelease returns the release from the repo with the given repoName, orgID, and tag.

func (*Client) GetReleaseMeta

func (client *Client) GetReleaseMeta(ctx context.Context, p string) (*types.ReleaseMeta, error)

GetReleaseMeta returns the release meta from the given path.

func (*Client) GetRepository

func (client *Client) GetRepository(ctx context.Context, orgID common.Hash, repoName string) (*types.Repository, error)

GetRepository returns the repository with the given orgID and repoName.

func (*Client) GetRepositoryMeta

func (client *Client) GetRepositoryMeta(ctx context.Context, p string) (*types.RepositoryMeta, error)

GetRepositoryMeta returns the repository meta from the given path.

func (*Client) LinkOrganizationName

func (client *Client) LinkOrganizationName(ctx context.Context, orgID common.Hash, name string) (*registry.ValistRegistryMappingEvent, error)

LinkOrganizationName links the given orgID to the orgName.

func (*Client) ListReleaseTags

func (client *Client) ListReleaseTags(orgID common.Hash, repoName string) types.ReleaseTagIterator

ListReleaseTags returns an iterator for retrieving all release tags from the repo with the given repoName and orgID.

func (*Client) ListReleases

func (client *Client) ListReleases(orgID common.Hash, repoName string) types.ReleaseIterator

ListReleases returns an iterator for retrieving all releases from the repo with the given repoName and orgID.

func (*Client) ReadFile added in v0.6.2

func (client *Client) ReadFile(ctx context.Context, fpath string) ([]byte, error)

func (*Client) ResolvePath

func (client *Client) ResolvePath(ctx context.Context, raw string) (types.ResolvedPath, error)

ResolvePath resolves the organization, repository, release, and node from the given path.

func (*Client) SetOrganizationMeta

func (client *Client) SetOrganizationMeta(ctx context.Context, orgID common.Hash, meta *types.OrganizationMeta) (*valist.ValistMetaUpdate, error)

SetOrganizationMeta updates the metadata of the organization with the given orgID.

func (*Client) SetRepositoryMeta

func (client *Client) SetRepositoryMeta(ctx context.Context, orgID common.Hash, name string, meta *types.RepositoryMeta) (*valist.ValistMetaUpdate, error)

SetRepositoryMeta updates the metadata of the repository with the given orgID and repoName.

func (*Client) Signer

func (client *Client) Signer() *signer.Signer

func (*Client) VoteOrganizationAdmin

func (client *Client) VoteOrganizationAdmin(ctx context.Context, orgID common.Hash, operation common.Hash, address common.Address) (*valist.ValistVoteKeyEvent, error)

VoteOrganizationAdmin votes to add, revoke, or rotate an organization admin key.

func (*Client) VoteOrganizationThreshold

func (client *Client) VoteOrganizationThreshold(ctx context.Context, orgID common.Hash, threshold *big.Int) (*valist.ValistVoteThresholdEvent, error)

VoteOrganizationThreshold votes to set a multifactor voting threshold for the organization.

func (*Client) VoteRelease

func (client *Client) VoteRelease(ctx context.Context, orgID common.Hash, repoName string, release *types.Release) (*valist.ValistVoteReleaseEvent, error)

VoteRelease votes to publish a new release to the repo with the given orgID and repoName.

func (*Client) VoteRepoDev

func (client *Client) VoteRepoDev(ctx context.Context, orgID common.Hash, repoName string, operation common.Hash, address common.Address) (*valist.ValistVoteKeyEvent, error)

VoteRepoDev votes to add, revoke, or rotate a repository dev key.

func (*Client) VoteRepositoryThreshold

func (client *Client) VoteRepositoryThreshold(ctx context.Context, orgID common.Hash, name string, threshold *big.Int) (*valist.ValistVoteThresholdEvent, error)

VoteRepositoryThreshold votes to set a multifactor voting threshold for the repository.

func (*Client) WriteFile added in v0.6.2

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

type Options

type Options struct {
	Ethereum bind.DeployBackend
	IPFS     coreiface.CoreAPI

	Valist   *valist.Valist
	Registry *registry.ValistRegistry

	Signer     *signer.Signer
	Transactor TransactorAPI
}

Options is used to set client options.

type ReleaseIterator

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

ReleaseIterator is used to iterate releases.

func (*ReleaseIterator) ForEach

func (it *ReleaseIterator) ForEach(ctx context.Context, cb func(*types.Release)) error

ForEach calls the given callback for each release.

func (*ReleaseIterator) Next

func (it *ReleaseIterator) Next(ctx context.Context) (*types.Release, error)

Next returns the next release from the iterator. Returns EOF when no releases are left.

type ReleaseTagIterator

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

ReleaseTagIterator is used to iterate release tags.

func (*ReleaseTagIterator) ForEach

func (it *ReleaseTagIterator) ForEach(ctx context.Context, cb func(string)) error

ForEach calls the given callback for each release tag.

func (*ReleaseTagIterator) Next

func (it *ReleaseTagIterator) Next(ctx context.Context) (string, error)

Next returns the next tag in the iterator.

type TransactorAPI

type TransactorAPI interface {
	CreateOrganizationTx(*gasless.TransactOpts, string) (*types.Transaction, error)
	LinkOrganizationNameTx(*gasless.TransactOpts, common.Hash, string) (*types.Transaction, error)
	CreateRepositoryTx(*gasless.TransactOpts, common.Hash, string, string) (*types.Transaction, error)
	VoteKeyTx(*gasless.TransactOpts, common.Hash, string, common.Hash, common.Address) (*types.Transaction, error)
	VoteReleaseTx(*gasless.TransactOpts, common.Hash, string, string, string, string) (*types.Transaction, error)
	SetOrganizationMetaTx(*gasless.TransactOpts, common.Hash, string) (*types.Transaction, error)
	SetRepositoryMetaTx(*gasless.TransactOpts, common.Hash, string, string) (*types.Transaction, error)
	VoteOrganizationThresholdTx(*gasless.TransactOpts, common.Hash, *big.Int) (*types.Transaction, error)
	VoteRepositoryThresholdTx(*gasless.TransactOpts, common.Hash, string, *big.Int) (*types.Transaction, error)
}

TransactorAPI defines functions to abstract blockchain transactions. TODO: Maybe this can return []*types.Log instead of *types.Transaction and handle waiting and log parsing?

Directories

Path Synopsis
Package metatx defines a Transactor that uses meta transactions to pay gas fees on behalf of a user.
Package metatx defines a Transactor that uses meta transactions to pay gas fees on behalf of a user.

Jump to

Keyboard shortcuts

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