token

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	IssueCommand     = "issue"
	TransferCommand  = "transfer"
	ListTokensCommad = "list"
	RedeemCommand    = "redeem"
)

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(cli CommandRegistrar)

func ExtractUnspentTokensFromOutput

func ExtractUnspentTokensFromOutput(output string) ([]*token.UnspentToken, error)

func GetSigningIdentity

func GetSigningIdentity(mspConfigPath, mspID, mspType string) (msp.SigningIdentity, error)

func LoadConfig

func LoadConfig(s string) (*client.ClientConfig, error)

func LoadLocalMSPAt

func LoadLocalMSPAt(dir, id, mspType string) (msp.MSP, error)

func LoadLocalMspRecipient

func LoadLocalMspRecipient(s string) (*token.TokenOwner, error)

func LoadSerialisedRecipient

func LoadSerialisedRecipient(serialisedRecipientPath string) ([]byte, error)

func LoadShares

func LoadShares(s string) ([]*token.RecipientShare, error)

func LoadTokenIDs

func LoadTokenIDs(s string) ([]*token.TokenId, error)

func LoadTokenIDsFromFile

func LoadTokenIDsFromFile(s string) ([]*token.TokenId, error)

func LoadTokenIDsFromJson

func LoadTokenIDsFromJson(s string) ([]*token.TokenId, error)

func LoadTokenOwner

func LoadTokenOwner(s string) (*token.TokenOwner, error)

func SubstituteShareRecipient

func SubstituteShareRecipient(shares []*ShellRecipientShare) ([]*token.RecipientShare, error)

Types

type BaseCmd

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

func (*BaseCmd) GetArgs

func (cmd *BaseCmd) GetArgs() (string, string, string)

func (*BaseCmd) SetChannel

func (cmd *BaseCmd) SetChannel(channel *string)

func (*BaseCmd) SetMSPId

func (cmd *BaseCmd) SetMSPId(mspID *string)

func (*BaseCmd) SetMSPPath

func (cmd *BaseCmd) SetMSPPath(mspPath *string)

type CommandRegistrar

type CommandRegistrar interface {
	Command(name, help string, onCommand cmdcommon.CLICommand) *kingpin.CmdClause
}

type IssueCmd

type IssueCmd struct {
	*BaseCmd
	// contains filtered or unexported fields
}

func NewIssueCmd

func NewIssueCmd(stub Stub, loader Loader, parser ResponseParser) *IssueCmd

func (*IssueCmd) Execute

func (cmd *IssueCmd) Execute(conf common.Config) error

func (*IssueCmd) SetClientConfigPath

func (cmd *IssueCmd) SetClientConfigPath(clientConfigPath *string)

func (*IssueCmd) SetQuantity

func (cmd *IssueCmd) SetQuantity(quantity *string)

func (*IssueCmd) SetRecipient

func (cmd *IssueCmd) SetRecipient(recipient *string)

func (*IssueCmd) SetType

func (cmd *IssueCmd) SetType(ttype *string)

type JsonLoader

type JsonLoader struct {
}

func (*JsonLoader) Shares

func (*JsonLoader) Shares(s string) ([]*token.RecipientShare, error)

func (*JsonLoader) TokenIDs

func (*JsonLoader) TokenIDs(s string) ([]*token.TokenId, error)

func (*JsonLoader) TokenOwner

func (*JsonLoader) TokenOwner(s string) (*token.TokenOwner, error)

type ListTokensCmd

type ListTokensCmd struct {
	*BaseCmd
	// contains filtered or unexported fields
}

func NewListTokensCmd

func NewListTokensCmd(stub Stub, parser ResponseParser) *ListTokensCmd

func (*ListTokensCmd) Execute

func (cmd *ListTokensCmd) Execute(conf common.Config) error

func (*ListTokensCmd) SetClientConfigPath

func (cmd *ListTokensCmd) SetClientConfigPath(clientConfigPath *string)

type Loader

type Loader interface {
	TokenOwner(s string) (*token.TokenOwner, error)

	TokenIDs(s string) ([]*token.TokenId, error)

	Shares(s string) ([]*token.RecipientShare, error)
}

type OperationResponse

type OperationResponse struct {
	Envelope  *common.Envelope
	TxID      string
	Status    *common.Status
	Committed bool
}

type OperationResponseParser

type OperationResponseParser struct {
	io.Writer
}

func (*OperationResponseParser) ParseResponse

func (parser *OperationResponseParser) ParseResponse(response StubResponse) error

type RedeemCmd

type RedeemCmd struct {
	*BaseCmd
	// contains filtered or unexported fields
}

func NewRedeemCmd

func NewRedeemCmd(stub Stub, loader Loader, parser ResponseParser) *RedeemCmd

func (*RedeemCmd) Execute

func (cmd *RedeemCmd) Execute(conf common.Config) error

func (*RedeemCmd) SetClientConfigPath

func (cmd *RedeemCmd) SetClientConfigPath(clientConfigPath *string)

func (*RedeemCmd) SetQuantity

func (cmd *RedeemCmd) SetQuantity(quantity *string)

func (*RedeemCmd) SetTokenIDs

func (cmd *RedeemCmd) SetTokenIDs(tokenIDs *string)

type ResponseParser

type ResponseParser interface {
	ParseResponse(response StubResponse) error
}

type ShellRecipientShare

type ShellRecipientShare struct {
	Recipient string
	Quantity  string
}

func LoadSharesFromFile

func LoadSharesFromFile(s string) ([]*ShellRecipientShare, error)

func LoadSharesFromJson

func LoadSharesFromJson(s string) ([]*ShellRecipientShare, error)

type Stub

type Stub interface {
	Setup(configFilePath, channel, mspPath, mspID string) error

	Issue(tokensToIssue []*token.Token, waitTimeout time.Duration) (StubResponse, error)

	Transfer(tokenIDs []*token.TokenId, shares []*token.RecipientShare, waitTimeout time.Duration) (StubResponse, error)

	Redeem(tokenIDs []*token.TokenId, quantity string, waitTimeout time.Duration) (StubResponse, error)

	ListTokens() (StubResponse, error)
}

type StubResponse

type StubResponse interface {
}

type TokenClientStub

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

func (*TokenClientStub) Issue

func (stub *TokenClientStub) Issue(tokensToIssue []*token.Token, waitTimeout time.Duration) (StubResponse, error)

func (*TokenClientStub) ListTokens

func (stub *TokenClientStub) ListTokens() (StubResponse, error)

func (*TokenClientStub) Redeem

func (stub *TokenClientStub) Redeem(tokenIDs []*token.TokenId, quantity string, waitTimeout time.Duration) (StubResponse, error)

func (*TokenClientStub) Setup

func (stub *TokenClientStub) Setup(configPath, channel, mspPath, mspID string) error

func (*TokenClientStub) Transfer

func (stub *TokenClientStub) Transfer(tokenIDs []*token.TokenId, shares []*token.RecipientShare, waitTimeout time.Duration) (StubResponse, error)

type TransferCmd

type TransferCmd struct {
	*BaseCmd
	// contains filtered or unexported fields
}

func NewTransferCmd

func NewTransferCmd(stub Stub, loader Loader, parser ResponseParser) *TransferCmd

func (*TransferCmd) Execute

func (cmd *TransferCmd) Execute(conf common.Config) error

func (*TransferCmd) SetClientConfigPath

func (cmd *TransferCmd) SetClientConfigPath(clientConfigPath *string)

func (*TransferCmd) SetShares

func (cmd *TransferCmd) SetShares(shares *string)

func (*TransferCmd) SetTokenIDs

func (cmd *TransferCmd) SetTokenIDs(tokenIDs *string)

type UnspentTokenResponse

type UnspentTokenResponse struct {
	Tokens []*token.UnspentToken
}

type UnspentTokenResponseParser

type UnspentTokenResponseParser struct {
	io.Writer
}

func (*UnspentTokenResponseParser) ParseResponse

func (parser *UnspentTokenResponseParser) ParseResponse(response StubResponse) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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