Documentation ¶
Index ¶
- Constants
- Variables
- func Address(str string) (types.AccAddress, error)
- func Amount(amount uint64) (types.Coins, error)
- func NewMnemonic() (string, error)
- func NewRSAKeypair() (string, string, error)
- type DidDocument
- type Document
- type DocumentChecksum
- type DocumentMetadata
- type DocumentMetadataSchema
- type DocumentReceipt
- type MetadataSchema
- type MsgAddSupportedMetadataSchema
- type MsgAddTrustedMetadataSchemaProposer
- type MsgBuyMembership
- type MsgCloseCdp
- type MsgDepositIntoLiquidityPool
- type MsgIncrementsBlockRewardsPool
- type MsgInviteUser
- type MsgOpenCdp
- type MsgRequestDidPowerUp
- type MsgSend
- type MsgSendDocumentReceipt
- type MsgSetIdentity
- type MsgShareDocument
- type PowerUpParams
- type Proof
- type PubKey
- type PubKeys
- type SDK
- type SDKConfig
- type Services
- type TxMode
Constants ¶
const ( // TxModeSync represents the `sync` transaction mode. TxModeSync = "sync" // TxModeAsync represents the `async` transaction mode. TxModeAsync = "async" // TxModeBlock represents the `block` transaction mode. TxModeBlock = "block" )
Variables ¶
var ( // ErrNewSDK represents some kind of error that happened during the initialization phase of the SDK. ErrNewSDK = errors.New("could not initialize SDK") // ErrInvalidMessage represents some kind of error that happened during the adaptation of messages to the // format used for broadcasting. ErrInvalidMessage = errors.New("invalid transaction") // ErrInvalidPublicKey is used when a Bech32-encoded public key is invalid or malformed. ErrInvalidPublicKey = errors.New("invalid public key") // ErrInvalidAddress is used when a Bech32-encoded address is invalid or malformed. ErrInvalidAddress = errors.New("invalid address key") // ErrInvalidSignatureKey represents an error returned when the RSA signature key is invalid. ErrInvalidSignatureKey = errors.New("invalid signature key") // ErrInvalidTumblerKey represents an error returned when the RSA tumbler key is invalid. ErrInvalidTumblerKey = errors.New("invalid signature key") // ErrInvalidVerificationKey represents an error returned when the RSA verification key is invalid. ErrInvalidVerificationKey = errors.New("invalid verification key") // ErrProofCreation represents an error returned when the DidDocument proof creation fails. ErrProofCreation = errors.New("cannot create proof") // ErrInvalidAmount represents an error returned when the provided uint64 amount is invalid. ErrInvalidAmount = errors.New("invalid coin amount") // ErrInvalidPowerupParams represents an error returned when the provided power up params are invalid. ErrInvalidPowerupParams = errors.New("invalid powerup params") // ErrNotEnoughEntropy represents an error returned when there's not enough entropy to generate random data. ErrNotEnoughEntropy = errors.New("not enough entropy") // ErrEncryptionFailure represents an error returned when some error happens during the encryption process. ErrEncryptionFailure = errors.New("encryption failure") )
var ( MembershipTypeBronze = "bronze" MembershipTypeSilver = "silver" MembershipTypeGold = "gold" MembershipTypeBlack = "black" )
Membership types definition
var ( // DefaultSDKConfig represents the default configuration for a commercio.network SDK instance. DefaultSDKConfig = SDKConfig{ DerivationPath: derivationPath, LCDEndpoint: "http://localhost:1317", Mode: TxModeSync, // contains filtered or unexported fields } )
Functions ¶
func Address ¶
func Address(str string) (types.AccAddress, error)
Address returns str as a Cosmos-compatible address, given str as a bech32-encoded string.
func NewMnemonic ¶
NewMnemonic return a cryptographically-secure wallet mnemonic.
func NewRSAKeypair ¶
NewRSAKeypair returns a new PEM-encoded RSA 2048-bit keypair.
Types ¶
type DocumentChecksum ¶
type DocumentChecksum docs.DocumentChecksum
type DocumentMetadata ¶
type DocumentMetadata docs.DocumentMetadata
type DocumentMetadataSchema ¶
type DocumentMetadataSchema docs.DocumentMetadataSchema
type DocumentReceipt ¶
type DocumentReceipt docs.DocumentReceipt
type MetadataSchema ¶
type MetadataSchema docs.MetadataSchema
type MsgAddSupportedMetadataSchema ¶
type MsgAddSupportedMetadataSchema docs.MsgAddSupportedMetadataSchema
type MsgAddTrustedMetadataSchemaProposer ¶
type MsgAddTrustedMetadataSchemaProposer docs.MsgAddTrustedMetadataSchemaProposer
type MsgBuyMembership ¶
type MsgBuyMembership memberships.MsgBuyMembership
type MsgCloseCdp ¶
type MsgCloseCdp = commerciomint.MsgCloseCdp
type MsgDepositIntoLiquidityPool ¶
type MsgDepositIntoLiquidityPool memberships.MsgDepositIntoLiquidityPool
type MsgIncrementsBlockRewardsPool ¶
type MsgIncrementsBlockRewardsPool vbr.MsgIncrementsBlockRewardsPool
x/vbr messages
type MsgRequestDidPowerUp ¶
type MsgRequestDidPowerUp id.MsgRequestDidPowerUp
type MsgSendDocumentReceipt ¶
type MsgSendDocumentReceipt docs.MsgSendDocumentReceipt
type MsgSetIdentity ¶
type MsgSetIdentity id.MsgSetIdentity
type MsgShareDocument ¶
type MsgShareDocument docs.MsgShareDocument
type PowerUpParams ¶
type PowerUpParams struct { // PubKey is the bech32-encoded public key of the account which sends the Power-up request. PubKey string // TumblerKey is the tumbler RSA PKIX public key. TumblerKey io.Reader // SignatureKey is the user RSA PKCS8 private key, used to build the message proof. // // It must be the private part of the keypair created and associated with the account which sends // the transaction. SignatureKey io.Reader // Amount represents the amount the user signing the transaction wants to send to its Pairwise address. Amount uint64 // PairwiseAddress is the address to which the user signing the transaction wants to send Amount tokens. PairwiseAddress types.AccAddress }
PowerUpParams are parameters used by BuildPowerupRequests during its lifecycle.
type SDK ¶
SDK represents the entrypoint for the commercio.network SDK.
func (*SDK) BuildDidDocument ¶
func (sdk *SDK) BuildDidDocument(pubKeyString string, signatureKey, verificationKey io.Reader) (DidDocument, error)
BuildDidDocument creates a DidDocument for the account associated to sdk, given its publick key, signature and verification RSA public keys.
func (*SDK) BuildPowerupRequest ¶
func (sdk *SDK) BuildPowerupRequest(params PowerUpParams) (MsgRequestDidPowerUp, error)
BuildPowerupRequest creates a MsgRequestDidPowerUp based on params.
func (*SDK) SendTransaction ¶
SendTransaction sends all the messages contained in rawMsgs through the pre-defined LCD, then returns the transaction hash.
type SDKConfig ¶
type SDKConfig struct { // DerivationPath represents the derivation path used while performing crypto-related operations. DerivationPath string // LCDEndpoint is the commercio.network REST LCD server endpoint, where transaction will be broadcasted. LCDEndpoint string // Mode is the TxMode to be used while performing transaction-related operations. Mode TxMode // contains filtered or unexported fields }
SDKConfig allows callers to customize default behaviors the commercio.network SDK assumes.
type TxMode ¶
type TxMode string
TxMode represents the mode used by the SDK to broadcast the transaction. TxMode can be either:
- `sync`: the LCD will do basic validity checks on the messages, will not wait for the message to be included in a block; it'll always return no error.
- `async`: like `sync`, but no checks are performed.
- `block`: like `sync`, but it will wait for the message to be included in a block; it could return error.