{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v2.0.0-alpha+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package token\n\nCopyright IBM Corp. All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\nCopyright IBM Corp. All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\nCopyright IBM Corp. All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\nCopyright IBM Corp. All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\n## Constants\n\n```go\nconst (\n\tIssueCommand     = \"issue\"\n\tTransferCommand  = \"transfer\"\n\tListTokensCommad = \"list\"\n\tRedeemCommand    = \"redeem\"\n)\n```\n\n## Functions\n\n```go\nfunc AddCommands(cli CommandRegistrar)\n```\nAddCommands registers the discovery commands to the given CommandRegistrar\n\n```go\nfunc ExtractUnspentTokensFromOutput(output string) ([]*token.UnspentToken, error)\n```\nExtractUnspentTokensFromOutput extracts token.UnspentToken from the output produced by UnspentTokenResponseParser\n\n```go\nfunc GetSigningIdentity(mspConfigPath, mspID, mspType string) (msp.SigningIdentity, error)\n```\nGetSigningIdentity retrieves a signing identity from the passed arguments\n\n```go\nfunc LoadConfig(s string) (*client.ClientConfig, error)\n```\nLoadConfig converts tha passed string to a ClientConfig. The string can be a json string representing the ClientConfig or a path to a file containing a ClientConfig in json format\n\n```go\nfunc LoadLocalMSPAt(dir, id, mspType string) (msp.MSP, error)\n```\nLoadLocalMSPAt loads an MSP whose configuration is stored at 'dir', and whose id and type are the passed as arguments.\n\n```go\nfunc LoadLocalMspRecipient(s string) (*token.TokenOwner, error)\n```\nLoadLocalMspRecipient constructs a TokenOwner from the signing identity at the passed msp location. Expected format of the string is \\\u003cmsp\\_id\u003e:\\\u003cpath\u003e.\n\n```go\nfunc LoadSerialisedRecipient(serialisedRecipientPath string) ([]byte, error)\n```\nLoadSerialisedRecipient loads a serialised identity from file\n\n```go\nfunc LoadShares(s string) ([]*token.RecipientShare, error)\n```\nLoadShares converts the passed string to an array of Shares. The string is either a json representing the shares, or a path to a file containing the json representation.\n\n```go\nfunc LoadTokenIDs(s string) ([]*token.TokenId, error)\n```\nLoadTokenIDs converts the passed string to an array of TokenIDs. The string can be a json representing the TokenIDs, or a path to a fail containing the json representation.\n\n```go\nfunc LoadTokenIDsFromFile(s string) ([]*token.TokenId, error)\n```\nLoadTokenIDsFromFile loads TokenIDs from the passed file supposed to contain a json representation of the TokenIDs.\n\n```go\nfunc LoadTokenIDsFromJson(s string) ([]*token.TokenId, error)\n```\nLoadTokenIDsFromJson interprets the passed string as a json representation of TokenIDs\n\n```go\nfunc LoadTokenOwner(s string) (*token.TokenOwner, error)\n```\nLoadTokenOwner converts the passed string to a TokenOwner. The string can be the path of the msp configuration, in this case the expected format of the string is \\\u003cmsp\\_id\u003e:\\\u003cpath\u003e, or the path to a file that contains a serialised identity.\n\n```go\nfunc SubstituteShareRecipient(shares []*ShellRecipientShare) ([]*token.RecipientShare, error)\n```\nSubstituteShareRecipient scans the recipients to see if they need additional post-processing. For example, a recipient can contain the path of a file containing the serialised identity to be loaded.\n\n## Types\n\n```go\ntype BaseCmd struct {\n\t// contains filtered or unexported fields\n}\n```\nBaseCmd contains shared command arguments\n\n```go\nfunc (cmd *BaseCmd) GetArgs() (string, string, string)\n```\nGetArgs returns the arguments\n\n```go\nfunc (cmd *BaseCmd) SetChannel(channel *string)\n```\nSetChannel sets the channel\n\n```go\nfunc (cmd *BaseCmd) SetMSPId(mspID *string)\n```\nSetMSPId sets the mspID\n\n```go\nfunc (cmd *BaseCmd) SetMSPPath(mspPath *string)\n```\nSetMSPPath sets the mspPath\n\n```go\ntype CommandRegistrar interface {\n\t// Command adds a new top-level command to the CLI\n\tCommand(name, help string, onCommand cmdcommon.CLICommand) *kingpin.CmdClause\n}\n```\nCommandRegistrar registers commands\n\n```go\ntype IssueCmd struct {\n\t*BaseCmd\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewIssueCmd(stub Stub, loader Loader, parser ResponseParser) *IssueCmd\n```\n\n```go\nfunc (cmd *IssueCmd) Execute(conf common.Config) error\n```\n\n```go\nfunc (cmd *IssueCmd) SetClientConfigPath(clientConfigPath *string)\n```\nSetRecipient sets the recipient\n\n```go\nfunc (cmd *IssueCmd) SetQuantity(quantity *string)\n```\nSetQuantity sets the quantity\n\n```go\nfunc (cmd *IssueCmd) SetRecipient(recipient *string)\n```\nSetRecipient sets the recipient\n\n```go\nfunc (cmd *IssueCmd) SetType(ttype *string)\n```\nSetType sets the type\n\n```go\ntype JsonLoader struct {\n}\n```\nJsonLoader implements the Loader interface\n\n```go\nfunc (*JsonLoader) Shares(s string) ([]*token.RecipientShare, error)\n```\n\n```go\nfunc (*JsonLoader) TokenIDs(s string) ([]*token.TokenId, error)\n```\n\n```go\nfunc (*JsonLoader) TokenOwner(s string) (*token.TokenOwner, error)\n```\n\n```go\ntype ListTokensCmd struct {\n\t*BaseCmd\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewListTokensCmd(stub Stub, parser ResponseParser) *ListTokensCmd\n```\n\n```go\nfunc (cmd *ListTokensCmd) Execute(conf common.Config) error\n```\n\n```go\nfunc (cmd *ListTokensCmd) SetClientConfigPath(clientConfigPath *string)\n```\nSetRecipient sets the recipient\n\n```go\ntype Loader interface {\n\t// TokenOwner converts a string to a token owner\n\tTokenOwner(s string) (*token.TokenOwner, error)\n\n\t// TokenIDs converts a string to a slice of token ids\n\tTokenIDs(s string) ([]*token.TokenId, error)\n\n\t// Shares converts a string to a slice of RecipientShare\n\tShares(s string) ([]*token.RecipientShare, error)\n}\n```\nLoader converts string to token objects to be used with the Stub\n\n```go\ntype OperationResponse struct {\n\tEnvelope  *common.Envelope\n\tTxID      string\n\tStatus    *common.Status\n\tCommitted bool\n}\n```\n\n```go\ntype OperationResponseParser struct {\n\tio.Writer\n}\n```\nOperationResponseParser parses operation responses\n\n```go\nfunc (parser *OperationResponseParser) ParseResponse(response StubResponse) error\n```\nParseResponse parses the given response for the given channel\n\n```go\ntype RedeemCmd struct {\n\t*BaseCmd\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewRedeemCmd(stub Stub, loader Loader, parser ResponseParser) *RedeemCmd\n```\n\n```go\nfunc (cmd *RedeemCmd) Execute(conf common.Config) error\n```\n\n```go\nfunc (cmd *RedeemCmd) SetClientConfigPath(clientConfigPath *string)\n```\nSetClientConfigPath sets the client config path\n\n```go\nfunc (cmd *RedeemCmd) SetQuantity(quantity *string)\n```\nSetQuantity sets the quantity\n\n```go\nfunc (cmd *RedeemCmd) SetTokenIDs(tokenIDs *string)\n```\nSetTokenIDs sets the tokenIds\n\n```go\ntype ResponseParser interface {\n\t// ParseResponse parses the response and uses the given output when emitting data\n\tParseResponse(response StubResponse) error\n}\n```\nResponseParser parses responses sent from the server\n\n```go\ntype ShellRecipientShare struct {\n\tRecipient string\n\tQuantity  string\n}\n```\nRecipientShare describes how much a recipient will receive in a token transfer\n\n```go\nfunc LoadSharesFromFile(s string) ([]*ShellRecipientShare, error)\n```\nLoadSharesFromFile loads from file shares in json representation.\n\n```go\nfunc LoadSharesFromJson(s string) ([]*ShellRecipientShare, error)\n```\nLoadSharesFromJson converts the passed json string to shares\n\n```go\ntype Stub interface {\n\t// Setup the stub\n\tSetup(configFilePath, channel, mspPath, mspID string) error\n\n\t// Issue is the function that the client calls to introduce tokens into the system.\n\tIssue(tokensToIssue []*token.Token, waitTimeout time.Duration) (StubResponse, error)\n\n\t// Transfer is the function that the client calls to transfer his tokens.\n\tTransfer(tokenIDs []*token.TokenId, shares []*token.RecipientShare, waitTimeout time.Duration) (StubResponse, error)\n\n\t// Redeem allows the redemption of the tokens in the input tokenIDs\n\tRedeem(tokenIDs []*token.TokenId, quantity string, waitTimeout time.Duration) (StubResponse, error)\n\n\t// ListTokens allows the client to submit a list request to a prover peer service;\n\tListTokens() (StubResponse, error)\n}\n```\nStub is a client for the token service\n\n```go\ntype StubResponse interface {\n}\n```\n\n```go\ntype TokenClientStub struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (stub *TokenClientStub) Issue(tokensToIssue []*token.Token, waitTimeout time.Duration) (StubResponse, error)\n```\n\n```go\nfunc (stub *TokenClientStub) ListTokens() (StubResponse, error)\n```\n\n```go\nfunc (stub *TokenClientStub) Redeem(tokenIDs []*token.TokenId, quantity string, waitTimeout time.Duration) (StubResponse, error)\n```\n\n```go\nfunc (stub *TokenClientStub) Setup(configPath, channel, mspPath, mspID string) error\n```\n\n```go\nfunc (stub *TokenClientStub) Transfer(tokenIDs []*token.TokenId, shares []*token.RecipientShare, waitTimeout time.Duration) (StubResponse, error)\n```\n\n```go\ntype TransferCmd struct {\n\t*BaseCmd\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewTransferCmd(stub Stub, loader Loader, parser ResponseParser) *TransferCmd\n```\n\n```go\nfunc (cmd *TransferCmd) Execute(conf common.Config) error\n```\n\n```go\nfunc (cmd *TransferCmd) SetClientConfigPath(clientConfigPath *string)\n```\nSetClientConfigPath sets the client config path\n\n```go\nfunc (cmd *TransferCmd) SetShares(shares *string)\n```\nSetShares sets the output shares\n\n```go\nfunc (cmd *TransferCmd) SetTokenIDs(tokenIDs *string)\n```\nSetTokenIDs sets the tokenIds\n\n```go\ntype UnspentTokenResponse struct {\n\tTokens []*token.UnspentToken\n}\n```\n\n```go\ntype UnspentTokenResponseParser struct {\n\tio.Writer\n}\n```\nUnspentTokenResponseParser parses import responses\n\n```go\nfunc (parser *UnspentTokenResponseParser) ParseResponse(response StubResponse) error\n```\nParseResponse parses the given response for the given channel\n\n","path":"github.com/eric-erki/https-hyperledger.org/token/cmd","name":"token","synopsis":"","isRedistributable":true}
