contract

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OrgId1 org1 id
	OrgId1 = "wx-org1.chainmaker.org"
	// OrgId2 org2 id
	OrgId2 = "wx-org2.chainmaker.org"
	// OrgId3 org3 id
	OrgId3 = "wx-org3.chainmaker.org"
	// OrgId4 org4 id
	OrgId4 = "wx-org4.chainmaker.org"
	// OrgId5 org5 id
	OrgId5 = "wx-org5.chainmaker.org"

	// UserNameOrg1Client1 user name org1 client1
	UserNameOrg1Client1 = "org1client1"
	// UserNameOrg2Client1 user name org2 client1
	UserNameOrg2Client1 = "org2client1"

	// UserNameOrg1Admin1 user name org1 admin1
	UserNameOrg1Admin1 = "org1admin1"
	// UserNameOrg2Admin1 user name org2 admin1
	UserNameOrg2Admin1 = "org2admin1"
	// UserNameOrg3Admin1 user name org3 admin1
	UserNameOrg3Admin1 = "org3admin1"
	// UserNameOrg4Admin1 user name org4 admin1
	UserNameOrg4Admin1 = "org4admin1"
	// UserNameOrg5Admin1 user name org5 admin1
	UserNameOrg5Admin1 = "org5admin1"

	// Version contract version
	Version = "1.0.0"
	// UpgradeVersion contract upgrade version
	UpgradeVersion = "2.0.0"
)

Variables

View Source
var Cli *sdk.ChainClient

Cli chainmaker sdk chain client

Functions

func Answer

func Answer(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string, err error)

Answer answer

func BalanceOf

func BalanceOf(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string,
	err error)

BalanceOf get balance from user

func BeginExchange

func BeginExchange(client *sdk.ChainClient, contractName string, params map[string][]byte) (err error)

BeginExchange begin exchange

func CalcContractName

func CalcContractName(contractName string) string

CalcContractName calc contract name

func Challeage

func Challeage(client *sdk.ChainClient, contractName string, params map[string][]byte) (err error)

Challeage user challeage

func CheckProposalRequestResp

func CheckProposalRequestResp(resp *common.TxResponse, needContractResult bool) error

CheckProposalRequestResp check proposal request response

func Commit

func Commit(client *sdk.ChainClient, contractName string, params map[string][]byte) (
	err error)

Commit commit epoch state

func CreateChainClientWithSDKConf

func CreateChainClientWithSDKConf(sdkConfPath string) (*sdk.ChainClient, error)

CreateChainClientWithSDKConf create a chain client with sdk config file path

func CreateContract

func CreateContract(client *sdk.ChainClient, contractName, contractVersion, contractFilePath string,
	withSyncResult bool, usernames ...string) (txId string, err error)

CreateContract create contract with sdk chain client

func Exit

func Exit(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string, err error)

Exit exit this channel

func Get

func Get(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string, err error)

Get get channel state

func GetChalleage

func GetChalleage(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp []string, err error)

GetChalleage leader get user challeage

func GetEndorsers

func GetEndorsers(payload *common.Payload, usernames ...string) ([]*common.EndorsementEntry, error)

GetEndorsers get endorsers

func GetEndorsersWithAuthType

func GetEndorsersWithAuthType(hashType crypto.HashType, authType sdk.AuthType, payload *common.Payload,
	usernames ...string) ([]*common.EndorsementEntry, error)

GetEndorsersWithAuthType get endorsers with auth type

func InvokeStake

func InvokeStake(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string,
	err error)

InvokeStake invoke stake contract

func MakeAddrAndSkiFromCrtFilePath

func MakeAddrAndSkiFromCrtFilePath(crtFilePath string) (string, string, string, error)

MakeAddrAndSkiFromCrtFilePath make addr and ski from crt file path

func Rollback

func Rollback(client *sdk.ChainClient, contractName string, params map[string][]byte) (err error)

Rollback rollback this epoch state

func SenderPk

func SenderPk(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string,
	err error)

SenderPk get sender pk

func Set

func Set(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string, err error)

Set set channel state

func Transfer

func Transfer(client *sdk.ChainClient, contractName string, params map[string][]byte, withSyncResult bool) (
	resp string, err error)

Transfer transfer stake from a to b

func UserInfo

func UserInfo(client *sdk.ChainClient, contractName string, params map[string][]byte) (resp string, err error)

UserInfo user info

Types

type ChannelInfoResp

type ChannelInfoResp struct {
	LeaderId        string         `json:"leader_id"`
	LeaderAddr      string         `json:"leader_address"`
	Epoch           int            `json:"epoch"`
	Status          int            `json:"status"`
	ChalleageStatus int            `json:"challeage_status"`
	BalanceSet      map[string]int `json:"balance"`
}

ChannelInfoResp channel info resp type

func ChannelInfo

func ChannelInfo(client *sdk.ChainClient, contractName string, params map[string][]byte) (
	resp *ChannelInfoResp, err error)

ChannelInfo channel info

func CreateChannel

func CreateChannel(client *sdk.ChainClient, contractName string, params map[string][]byte,
	withSyncResult bool) (resp *ChannelInfoResp, err error)

CreateChannel create channel

func JoinChannel

func JoinChannel(client *sdk.ChainClient, contractName string, params map[string][]byte) (
	resp *ChannelInfoResp, err error)

JoinChannel join channel

type JoinChannelResp

type JoinChannelResp struct {
	LeaderId   string `json:"leader_id"`
	LeaderAddr string `json:"leader_address"`
	Epoch      int    `json:"epoch"`
}

JoinChannelResp join channel resp type

type PermissionedPkUsers

type PermissionedPkUsers struct {
	SignKeyPath string
	OrgId       string
}

PermissionedPkUsers permission key user sign key path

type PkUsers

type PkUsers struct {
	SignKeyPath string
}

PkUsers pk user sign key path

type User

type User struct {
	TlsKeyPath, TlsCrtPath   string
	SignKeyPath, SignCrtPath string
}

User tls sign key crt path

func GetUser

func GetUser(username string) (*User, error)

GetUser get user by username

Jump to

Keyboard shortcuts

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