standard

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Topic_Register    = "Register"
	Topic_SetResolver = "SetResolver"
	Topic_Bind        = "Bind"
	Topic_UnBind      = "UnBind"
	Topic_ReverseBind = "ReverseBind"
)
View Source
const (
	TopicTransfer = "transfer"
	TopicApprove  = "approve"
	TopicMint     = "mint"
	TopicBurn     = "burn"
)

Event top list

View Source
const (
	Topic_SetDidDocument    = "SetDidDocument"
	Topic_SetTrustRootList  = "SetTrustRootList"
	Topic_RevokeVc          = "RevokeVc"
	Topic_AddBlackList      = "AddBlackList"
	Topic_DeleteBlackList   = "DeleteBlackList"
	Topic_AddTrustIssuer    = "AddTrustIssuer"
	Topic_DeleteTrustIssuer = "DeleteTrustIssuer"
	Topic_Delegate          = "Delegate"
	Topic_RevokeDelegate    = "RevokeDelegate"
	Topic_SetVcTemplate     = "SetVcTemplate"
	Topic_VcIssueLog        = "VcIssueLog"
)
View Source
const (
	EventPlatformRegistered      = "PlatformRegistered"
	EventPlatformModified        = "PlatformModified"
	EventUserRegistered          = "UserRegistered"
	EventUserTypeChanged         = "UserTypeChanged"
	EventUserPermissionsChanged  = "UserPermissionsChanged"
	EventUserApprovalChanged     = "UserApprovalChanged"
	EventIDACreated              = "IDACreated"
	EventIDAUpdated              = "IDAUpdated"
	EventIDADeleted              = "IDADeleted"
	EventIDACertificationApplied = "IDACertificationApplied"
	EventIDACertified            = "IDACertified"
)

事件名称

View Source
const (
	FieldIDABasic          = "IDABasic"
	FieldIDAOwnership      = "IDAOwnership"
	FieldIDASource         = "IDASource"
	FieldIDAScenarios      = "IDAScenarios"
	FieldIDASupply         = "IDASupply"
	FieldIDADetails        = "IDADetails"
	FieldIDAStatus         = "IDAStatus"
	FieldIDAColumns        = "IDAColumns"
	FieldIDAAPI            = "IDAApi"
	FieldIDACertifications = "IDACertifications"
)

资产信息子结构标识

View Source
const (
	// ContractStandardNameCMBC ChainMaker - Contract Standard - Base Contract
	ContractStandardNameCMBC = "CMBC"
	// ContractStandardNameCMDFA ChainMaker - Contract Standard - Digital Fungible Assets
	ContractStandardNameCMDFA = "CMDFA"
	// ContractStandardNameCMNFA ChainMaker - Contract Standard - Digital Non-Fungible Assets
	ContractStandardNameCMNFA = "CMNFA"
	// ContractStandardNameCMID ChainMaker - Contract Standard - Identity
	ContractStandardNameCMID = "CMID"
	// ContractStandardNameCMEVI  ChainMaker - Contract Standard - Evidence
	ContractStandardNameCMEVI = "CMEVI"
	// ContractStandardNameCMDID ChainMaker - Contract Standard - Decentralized Identifier
	ContractStandardNameCMDID = "CMDID"
	// ContractStandardNameCMBCS ChainMaker - Contract Standard - Blockchain Name Service
	ContractStandardNameCMBNS = "CMBNS"
	// ContractStandardNameCMBNSResolver ChainMaker - Contract Standard - Blockchain Name Service Resolver
	ContractStandardNameCMBNSResolver = "CMBNSResolver"
	// ContractStandardNameCMIDA ChainMaker - Contract Standard - Identifiable Data Asset
	ContractStandardNameCMIDA = "CMIDA"
	// ContractOther ChainMaker - other contract
	ContractOther = "OTHER"

	TrueString  = "true"
	FalseString = "false"
)
View Source
const (
	// ContractNFAFuncTokenMetadata ChainMaker - Contract CMNFA - TokenMetadata
	ContractNFAFuncTokenMetadata = "TokenMetadata"
	// ContractNFAFuncOwnerOf ChainMaker - Contract CMNFA - OwnerOf
	ContractNFAFuncOwnerOf = "OwnerOf"
	// ContractNFAFuncTotalSupply ChainMaker - Contract CMNFA - TotalSupply
	ContractNFAFuncTotalSupply = "TotalSupply"
	// ContractNFAFuncMint ChainMaker - Contract CMNFA - Mint
	ContractNFAFuncMint = "Mint"
	// ContractNFAFuncTransferFrom ChainMaker - Contract CMNFA - TransferFrom
	ContractNFAFuncTransferFrom = "TransferFrom"
)

CMNFA Function Name

View Source
const (
	// ContractDFAFuncSymbol ChainMaker - Contract CMDFA - Symbol
	ContractDFAFuncSymbol = "Symbol"
	// ContractDFAFuncTotalSupply ChainMaker - Contract CMDFA - TotalSupply
	ContractDFAFuncTotalSupply = "TotalSupply"
	// ContractDFAFuncMint ChainMaker - Contract CMDFA - Mint
	ContractDFAFuncMint = "Mint"
	// ContractDFAFuncBurn ChainMaker - Contract CMDFA - Burn
	ContractDFAFuncBurn = "Burn"
	// ContractDFAFuncTransfer ChainMaker - Contract CMDFA - Transfer
	ContractDFAFuncTransfer = "Transfer"
	// ContractDFAFuncTransferFrom ChainMaker - Contract CMDFA - TransferFrom
	ContractDFAFuncTransferFrom = "TransferFrom"
)

CMDFA Function Name

View Source
const (
	// ContractParamAccount ChainMaker - Contract Param - account
	ContractParamAccount = "account"
	// ContractParamAmount ChainMaker - Contract Param - amount
	ContractParamAmount = "amount"
	// ContractParamFrom ChainMaker - Contract Param - from
	ContractParamFrom = "from"
	// ContractParamTo ChainMaker - Contract Param - from
	ContractParamTo = "to"
	// ContractParamTokenId ChainMaker - Contract Param - tokenId
	ContractParamTokenId = "tokenId"
)

contract param name

View Source
const (
	// ContractBCFuncStandard ChainMaker - Contract Standard - Standards
	ContractBCFuncStandard = "Standards"
)

Common Function

View Source
const (
	Topic_Evidence = "Evidence"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIInfo added in v1.1.0

type APIInfo struct {
	Url          string `json:"url"`                  // 接口地址
	Header       string `json:"header,omitempty"`     // 请求头
	Params       string `json:"params,omitempty"`     // 请求参数
	Response     string `json:"response,omitempty"`   // 返回参数
	ResponseType string `json:"resp_type"`            // 返回类型:JSON、XML等
	Method       string `json:"method"`               // 请求方式:GET、POST等
	CreatedAt    string `json:"created_at,omitempty"` // 创建时间
	UpdatedAt    string `json:"updated_at,omitempty"` // 更新时间
}

APIInfo 定义了API接口的结构

type AccountTokens

type AccountTokens struct {
	Account string   `json:"account"`
	Tokens  []string `json:"tokens"`
}

type Attachment added in v1.1.0

type Attachment struct {
	Hash      string     `json:"hash,omitempty"`       // 资料哈希值
	Url       string     `json:"url,omitempty"`        // 资料的URL地址
	Type      int        `json:"type,omitempty"`       // 附件类型,1: 图片, 2: 合规证明材料, 3: 估值证明材料, 4: 其他相关附件
	Size      int        `json:"size,omitempty"`       // 资料的文件大小
	CreatedAt *time.Time `json:"created_at,omitempty"` // 附件创建时间
	UpdatedAt *time.Time `json:"updated_at,omitempty"` // 附件更新时间
	DeletedAt *time.Time `json:"deleted_at,omitempty"` // 附件删除时间
	Auditor   string     `json:"auditor,omitempty"`    // 审计者的链上地址
}

Attachment 定义了附件资料的结构

type Basic added in v1.1.0

type Basic struct {
	ID              string       `json:"id"`                    // 资产的唯一登记编号
	Name            string       `json:"name"`                  // 资产的名称
	EnName          string       `json:"enName"`                // 资产英文名称
	Tags            []string     `json:"tags,omitempty"`        // 资产相关的关键词
	FileAttachments []Attachment `json:"attachments,omitempty"` // 资产相关的文件附件
	Category        int          `json:"category"`              // 资产的类型,1: 数据集, 2: API服务, 3: 数据报告, 4: 数据应用, 5: 计算模型
	Industry        Industry     `json:"industry"`              // 资产所属的行业代码
	Summary         string       `json:"summary,omitempty"`     // 资产的简介
	Creator         string       `json:"creator,omitempty"`     // 资产创建者的链上地址
	TxID            string       `json:"txID,omitempty"`        // 资产创建的交易ID
}

Basic 定义了数据资产的基本信息结构

type CMBC

type CMBC interface {
	// Standards  获取当前合约支持的标准协议列表
	// @return []string json格式字符串数组
	Standards() []string

	// SupportStandard  获取当前合约是否支持某合约标准协议
	// @return bool 存在:true,"true";不存在:false,"false"
	SupportStandard(standardName string) bool
}

CMBC 长安链基础合约go接口 https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-BC.md

type CMBNS added in v1.0.4

type CMBNS interface {
	//CMNFA 嵌入的非同质化通证接口
	CMNFA
	// Domain 获取根域名
	Domain() string
	// Register 注册域名
	Register(domain string, owner string, metadata string, expirationTime int) error
	// Renew 续期域名
	Renew(domain string, expirationTime int) error
	// GetDomainInfo 获取域名信息
	GetDomainInfo(domain string) (*DomainInfo, error)
	// GetDomainList 获取域名列表
	GetDomainList(domainSearch string, owner string, start int, count int) ([]*DomainInfo, error)
	// EmitRegisterEvent 发送注册域名事件
	EmitRegisterEvent(domain string, owner string, metadata string, expirationTime int)
	// SetResolver 设置域名解析器
	SetResolver(domain string, resolver string) error
	// ResetResolver 重置域名解析器
	ResetResolver(domain string, resourceType string) error
	// EmitSetResolverEvent 发送设置域名解析器事件
	EmitSetResolverEvent(domain string, resolver string)
	// EmitReverseBindEvent 发送反向绑定事件
	EmitReverseBindEvent(value string, domain string, resourceType string)
	//CMBNSResolver 嵌入的接口
	CMBNSResolver
}

CMBNS 长安链区块链名称服务go接口,因为CMBNS合约也会支持CMNFA标准,所以不需要再单独定义Owner查询、Transfer转移域名等接口

type CMBNSOption added in v1.0.4

type CMBNSOption interface {
	// AddBlackList 添加黑名单
	AddBlackList(domains []string) error
	// DeleteBlackList 删除黑名单
	DeleteBlackList(domains []string) error
	// GetBlackList 获取黑名单
	GetBlackList(domainSearch string, start int, count int) ([]string, error)
	// EmitAddBlackListEvent 发送添加黑名单事件
	EmitAddBlackListEvent(domains []string)
	// EmitDeleteBlackListEvent 发送删除黑名单事件
	EmitDeleteBlackListEvent(domains []string)
}

CMBNSOption 可选的CMBNS接口

type CMBNSResolver added in v1.0.4

type CMBNSResolver interface {
	// Bind 绑定域名
	Bind(domain string, resolveValue string, resourceType string) error
	// Unbind 解绑域名
	Unbind(domain string, resourceType string) error
	// Resolve 解析域名
	Resolve(domain string, resourceType string) (string, error)
	// ReverseResolve 反向解析地址
	ReverseResolve(address string, resourceType string) (string, error)
	// GetBindList 按前缀匹配的方式搜索绑定列表
	// @param domainSearch 域名搜索关键字
	GetBindList(domainSearch string, start int, count int) ([]*DomainInfo, error)
	// EmitBindEvent 发送域名绑定事件
	EmitBindEvent(domain string, resolveValue string, resourceType string)
	// EmitUnBindEvent 发送域名解绑
	EmitUnBindEvent(domain string, resourceType string)
}

CMBNSResolver 解析器合约应该满足的标准,只有满足这些接口的合约才能被设置为解析器

type CMDFA

type CMDFA interface {

	// Name 查询Token的完整名称
	// @return name
	// @return err
	Name() (name string, err error)

	// Symbol 查询Token的简写符号
	// @return symbol
	// @return err
	Symbol() (symbol string, err error)

	// Decimals 查询Token支持的小数位数
	// @return decimals 返回支持的小数位数
	Decimals() (decimals uint8, err error)

	// TotalSupply 查询Token的发行总量
	// @return totalSupply 返回发行的Token总量
	TotalSupply() (totalSupply *safemath.SafeUint256, err error)

	// BalanceOf 查询账户的Token余额
	// @param account 指定要查询余额的账户
	// @return amount 返回指定账户的余额
	BalanceOf(account string) (amount *safemath.SafeUint256, err error)

	// Transfer 转账
	// @param to 收款账户
	// @param amount 转账金额
	// @return success 转账成功或失败
	// @return err 转账失败则返回Status:ERROR,Message具体错误
	Transfer(to string, amount *safemath.SafeUint256) error

	// TransferFrom 转账from账户下的指定amount金额给to账户
	// @param from 转出账户
	// @param to 转入账户
	// @param amount 转账金额
	// @return success 转账成功或失败
	// @return err 转账失败则返回Status:ERROR,Message具体错误
	TransferFrom(from string, to string, amount *safemath.SafeUint256) error

	// Approve 当前调用者授权指定的spender账户可以动用自己名下的amount金额给使用
	// @param spender 被授权账户
	// @param amount 授权使用的金额
	// @return success 授权成功或失败
	// @return error 授权失败则返回Status:ERROR,Message具体错误
	Approve(spender string, amount *safemath.SafeUint256) error

	// Allowance 查询owner授权多少额度给spender
	// @param owner 授权人账户
	// @param spender 被授权使用的账户
	// @return amount 返回授权金额
	Allowance(owner string, spender string) (amount *safemath.SafeUint256, err error)

	// EmitTransferEvent 发送转账事件
	// @param spender 转出账户
	// @param to 转入账户
	// @param amount 转账金额
	EmitTransferEvent(spender, to string, amount *safemath.SafeUint256)

	// EmitApproveEvent 发送授权事件
	// @param owner 授权人账户
	// @param spender 被授权使用的账户
	// @param amount 转账金额
	EmitApproveEvent(owner, spender string, amount *safemath.SafeUint256)
}

CMDFA 长安链同质化资产合约go接口 https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-DFA.md

type CMDFAOption

type CMDFAOption interface {
	// Mint 铸造发行新Token
	// @param account 发行到指定账户
	// @param amount 铸造发行新Token的数量
	// @return success 发行成功或失败
	// @return err 发行失败则返回Status:ERROR,Message具体错误
	Mint(account string, amount *safemath.SafeUint256) error

	// Burn 销毁当前用户名下指定数量的Token
	// @param amount 要销毁的Token数量
	// @return success 销毁成功或失败
	// @return err 销毁失败则返回Status:ERROR,Message具体错误
	Burn(amount *safemath.SafeUint256) error

	// BurnFrom 从spender账户名下销毁指定amount数量的Token
	// @param spender 被销毁Token的所属账户
	// @param amount 要销毁的数量
	// @return success 销毁成功或失败
	// @return err 销毁失败则返回Status:ERROR,Message具体错误
	BurnFrom(spender string, amount *safemath.SafeUint256) error

	// EmitMintEvent 触发铸造事件
	// @param account
	// @param amount
	EmitMintEvent(account string, amount *safemath.SafeUint256)

	// EmitBurnEvent 触发销毁事件
	// @param spender
	// @param amount
	EmitBurnEvent(spender string, amount *safemath.SafeUint256)

	// BatchTransfer 批量转账
	// @param to 收款账户
	// @param amount 转账金额,可以是1个表示每个to的金额相同,或多个(与to的数量相同)
	BatchTransfer(to []string, amount []*safemath.SafeUint256) error

	// Metadata 查询Token的元数据,其中包含Token的名称、符号、小数位数、LogoUrl、描述等信息
	Metadata() (metadata []byte, err error)
}

CMDFAOption 可选的CMDFA接口

type CMDID added in v1.0.4

type CMDID interface {
	// DidMethod 获取DID方法
	DidMethod() string
	// IsValidDid 判断DID URL是否合法
	IsValidDid(did string) (bool, error)
	// AddDidDocument 添加DID文档
	AddDidDocument(didDocument string) error
	// GetDidDocument 根据DID URL获取DID文档
	GetDidDocument(did string) (string, error)

	// GetDidByPubkey 根据公钥获取DID URL
	GetDidByPubkey(pk string) (string, error)
	// GetDidByAddress 根据地址获取DID URL
	GetDidByAddress(address string) (string, error)
	// VerifyVc 验证vc
	VerifyVc(vcJson string) (bool, error)
	// VerifyVp 验证vp
	VerifyVp(vpJson string) (bool, error)
	// EmitSetDidDocumentEvent 发送添加DID文档事件
	EmitSetDidDocumentEvent(did string, didDocument string)

	// RevokeVc 撤销vc,撤销后的vc vp不能再被验证
	RevokeVc(vcID string) error
	// GetRevokedVcList 获取撤销vc列表
	GetRevokedVcList(vcIDSearch string, start int, count int) ([]string, error)
	// EmitRevokeVcEvent 发送撤销vc事件
	EmitRevokeVcEvent(vcID string)
}

CMDID 长安链DID https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-Identity.md

type CMDIDOption added in v1.0.4

type CMDIDOption interface {
	// UpdateDidDocument 更新DID文档
	UpdateDidDocument(didDocument string) error

	// AddBlackList 添加黑名单
	AddBlackList(dids []string) error
	// DeleteBlackList 删除黑名单
	DeleteBlackList(dids []string) error
	// GetBlackList 获取黑名单
	GetBlackList(didSearch string, start int, count int) ([]string, error)
	// EmitAddBlackListEvent 发送添加黑名单事件
	EmitAddBlackListEvent(dids []string)
	// EmitDeleteBlackListEvent 发送删除黑名单事件
	EmitDeleteBlackListEvent(dids []string)

	// SetTrustRootList 设置信任根列表
	SetTrustRootList(dids []string) error
	// GetTrustRootList 获取信任根列表
	GetTrustRootList() (dids []string, err error)
	// EmitSetTrustRootListEvent 发送设置信任根列表事件
	EmitSetTrustRootListEvent(dids []string)

	// AddTrustIssuer 添加信任的发行者
	AddTrustIssuer(dids []string) error
	// DeleteTrustIssuer 删除信任的发行者
	DeleteTrustIssuer(dids []string) error
	// GetTrustIssuer 获取信任的发行者
	GetTrustIssuer(didSearch string, start int, count int) ([]string, error)
	// EmitAddTrustIssuerEvent 发送添加信任的发行者事件
	EmitAddTrustIssuerEvent(dids []string)
	// EmitDeleteTrustIssuerEvent 发送删除信任的发行者事件
	EmitDeleteTrustIssuerEvent(dids []string)

	// Delegate 给delegateeDid授权delegatorDid的资源代理权限,在有效期内,delegateeDid可以代理delegatorDid对resource的action操作
	// @param delegateeDid 被授权者DID
	// @param resource 资源,一般是VcID
	// @param action 操作,一般是"issue"或"verify"
	// @param expiration 有效期,unix时间戳,0表示永久
	Delegate(delegateeDid string, resource string, action string, expiration int64) error
	// EmitDelegateEvent 发送授权事件
	EmitDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string, start int64, expiration int64)
	// RevokeDelegate 撤销授权
	RevokeDelegate(delegateeDid string, resource string, action string) error
	// EmitRevokeDelegateEvent 发送撤销授权事件
	EmitRevokeDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string)
	// GetDelegateList 查询授权列表
	GetDelegateList(delegatorDid, delegateeDid string, resource string, action string, start int, count int) ([]*DelegateInfo, error)

	// SetVcTemplate 设置vc模板
	SetVcTemplate(id string, name string, vcType string, version string, template string) error
	// GetVcTemplate 获取vc模板
	GetVcTemplate(id, version string) (*VcTemplate, error)
	// GetVcTemplateList 获取vc模板列表
	GetVcTemplateList(nameSearch string, start int, count int) ([]*VcTemplate, error)
	// EmitSetVcTemplateEvent 发送设置vc模板事件
	EmitSetVcTemplateEvent(templateID string, templateName string, vcType string, version string, vcTemplate string)

	// VcIssueLog 记录vc发行日志
	// @param issuer 必填,发行者DID
	// @param did 必填,vc持有者DID
	// @param templateID 选填,vc模板ID
	// @param vcID 必填,vcID或者vc hash
	VcIssueLog(issuer string, did string, templateID string, vcID string) error
	// GetVcIssueLogs 获取vc发行日志
	GetVcIssueLogs(issuer string, did string, templateID string, start int, count int) ([]*VcIssueLog, error)
	// GetVcIssuers 根据持证人DID获取vc发行者DID列表
	GetVcIssuers(did string) (issuerDid []string, err error)
	// EmitVcIssueLogEvent 发送vc发行日志事件
	EmitVcIssueLogEvent(issuer string, did string, templateID string, vcID string)
}

type CMEVI

type CMEVI interface {
	// Evidence 存证
	// @param id 必填,流水号
	// @param hash 必填,上链哈希值
	// @param metadata 可选,其他信息;比如:哈希的类型(文字,文件)、文字描述的json格式字符串,具体参考下方 Metadata 对象。
	// @return error 返回错误信息
	Evidence(id string, hash string, metadata string) error

	// ExistsOfHash 哈希是否存在
	// @param hash 必填,上链的哈希值
	// @return exist 存在:true,"true";不存在:false,"false"
	// @return err 错误信息
	ExistsOfHash(hash string) (exist bool, err error)

	// ExistsOfId ID是否存在
	// @param id 必填,上链的ID值
	// @return exist 存在:true,"true";不存在:false,"false"
	// @return err 错误信息
	ExistsOfId(id string) (exist bool, err error)

	// FindByHash 根据哈希查找
	// @param hash 必填,上链哈希值
	// @return evidence 上链时传入的evidence信息
	// @return err 返回错误信息
	FindByHash(hash string) (evidence *Evidence, err error)

	// FindById 根据id查找
	// @param id 必填,流水号
	// @return evidence 上链时传入的evidence信息
	// @return err 返回错误信息
	FindById(id string) (evidence *Evidence, err error)

	// EmitEvidenceEvent 发送存证事件
	EmitEvidenceEvent(id string, hash string, metadata string) error
}

CMEVI 长安链存证合约go接口 https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-Evidence.md

type CMEVIOption

type CMEVIOption interface {

	// EvidenceBatch 批量存证
	// @param evidences 必填,存证信息
	// @return error 返回错误信息
	EvidenceBatch(evidences []Evidence) error

	// UpdateEvidence 根据ID更新存证哈希和metadata
	// @param id 必填,已经在链上存证的流水号。 如果是新流水号返回错误信息不存在
	// @param hash 必填,上链哈希值。必须与链上已经存储的hash不同
	// @param metadata 可选,其他信息;具体参考下方 Metadata 对象。
	// @return error 返回错误信息
	// @desc 该方法由长安链社区志愿者@sunhuiyuan提供建议,感谢参与
	UpdateEvidence(id string, hash string, metadata string) error

	// FindHisById 根据ID流水号查找存证历史(可以使用go合约接口:sdk.Instance.NewHistoryKvIterForKey或NewIterator实现)
	// @param id 必填,流水号
	// @return string 上链时传入的evidence信息的各个版本JSON数组对象。如果之前上链没有调用过updateEvidence、效果等同于findById,数组大小为1;
	//                如果之前上链调用过updateEvidence,则结果数组长度>1。
	// @return error 返回错误信息
	// @desc 该方法由长安链社区志愿者@sunhuiyuan提供建议,感谢参与
	FindHisById(id string) (evidence Evidence, err error)
}

type CMID

type CMID interface {
	// Identities 获取该合约支持的所有认证类型
	// @return metas, 所有的认证类型编号和认证类型描述
	Identities() (metas []IdentityMeta)

	// SetIdentity 为地址设置认证类型,管理员可调用
	// @param address 必填,公钥/证书的地址。一个地址仅能绑定一个公钥和认证类型编号,重复输入则覆盖。
	// @param pkPem 选填,pem格式公钥,可用于验签
	// @param level 必填,认证类型编号
	// @param metadata 选填,其他信息,json格式字符串,比如:地址类型,上链人身份、组织信息,上链可信时间,上链批次等等
	// @return error 返回错误信息
	// @event topic: setIdentity(address, level, pkPem)
	SetIdentity(address, pkPem string, level int, metadata string) error

	// IdentityOf 获取认证信息
	// @param address 地址
	// @return int 返回当前认证类型编号
	// @return identity 认证信息
	// @return err 返回错误信息
	IdentityOf(address string) (identity Identity, err error)

	// LevelOf 获取认证编号
	// @param address 地址
	// @return level 返回当前认证类型编号
	// @return err 返回错误信息
	LevelOf(address string) (level int, err error)

	// EmitSetIdentityEvent 发送设置认证类型事件
	// @param address 地址
	// @param pkPem pem格式公钥
	// @param level 认证类型编号
	EmitSetIdentityEvent(address, pkPem string, level int)
}

CMID 长安链身份认证go接口 https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-Identity.md

type CMIDA added in v1.1.0

type CMIDA interface {

	// RegisterPlatform 注册一个平台
	// 注册成功时会发出 PlatformRegistered 事件。
	// 如果注册成功,返回平台 id 以及可能的错误代码。
	RegisterPlatform(platform PlatformInfo) protogo.Response

	// ModifyPlatform 修改平台信息,只允许修改企业相关的字段
	// 只允许注册者操作,修改成功时会发出 PlatformModified 事件。
	ModifyPlatform(platform PlatformInfo) protogo.Response

	// RegisterUser 根据提供的详细信息注册一个新用户。
	// 注册成功时会发出 UserRegistered 事件。
	// 如果注册成功,返回链账户 id 以及可能的错误代码。
	RegisterUser(user UserInfo) protogo.Response

	// ChangeUserType 将现有用户的类型更改为指定的新类型。
	// 需要管理员权限,并在成功时发出 UserTypeChanged 事件。
	// 如果用户类型成功更改,返回 true 以及可能的错误代码。
	ChangeUserType(newType int, userAddress string) protogo.Response

	// ChangeUserPermissions 将现有用户的权限更改为指定的新权限。
	// 需要管理员权限,并在成功时发出 UserPermissionsChanged 事件。
	// 如果用户权限成功更改,返回 true 以及可能的错误代码。
	ChangeUserPermissions(newPermissions int, userAddress string) protogo.Response

	// Approve 授权或取消授权用户操作所有IDA。
	// 成功时发出 UserApprovalChanged 事件。
	// 如果用户授权成功更改,返回 true 以及可能的错误代码。
	Approve(userAddress string, isApproved bool) protogo.Response

	// QueryUser 根据用户地址检索用户信息。
	// 返回包含用户详细信息的 UserInfo 结构体和可能的错误代码。
	QueryUser(userAddress string) protogo.Response

	// QueryApprovedUsers 检索所有授权用户的列表。
	// 返回授权用户地址的列表和可能的错误代码。
	QueryApprovedUsers(userAddress string) protogo.Response

	// QueryUserBalance 检索用户的余额。
	// 返回用户余额数额和可能的错误代码。
	QueryUserBalance(userAddress string) protogo.Response

	// CreateIDAs 根据提供的详细信息创建一个新的IDA。
	// 需要登记权限,并在成功时发出 IDACreated 事件。
	// 如果IDA成功创建,返回 true 以及可能的错误代码。
	CreateIDAs(idaInfos []IDAInfo) protogo.Response

	// UpdateIDA 更新现有IDA的指定字段。
	// 需要持有者的权限,并在成功时发出 IDAUpdated 事件。
	// 如果IDA成功更新,返回 true 以及可能的错误代码。
	UpdateIDA(key string, field string, updates []byte, updateAt time.Time) protogo.Response

	// DeleteIDAs 根据它们的ID删除一个或多个IDA。
	// 需要持有者的权限,并在成功时发出 IDADeleted 事件。
	// 如果IDAs成功删除,返回 true 以及可能的错误代码。
	DeleteIDAs(IDs []string) protogo.Response

	// ApplyForCertification 提交数据资产的认证申请。
	// 需要认证权限,并在成功时发出 IDACertificationApplied 事件。
	// 如果认证申请成功提交,返回 true 以及任何错误。
	// `authenticatorAddress` 参数是申请认证的用户的区块链地址。
	ApplyForCertification(ID, authenticatorAddress, certificationCategory string) protogo.Response

	// CertifyIDA 根据提供的认证详情对IDA进行合规认证。
	// 需要认证权限,并在成功时发出 IDACertified 事件。
	// 如果IDA成功认证,返回 true 以及可能的错误代码。
	CertifyIDA(ID string, certification CertificationInfo) protogo.Response

	// QueryIDA 根据其ID和指定字段检索IDA的信息。
	// 如果 field 为空,则返回有关IDA的完整信息。
	// 返回请求的IDA信息和可能的错误代码。
	QueryIDA(ID string, field string) protogo.Response
}

CMIDA 长安链可认证数据资产(IDA)合约标准接口 https://git.code.tencent.com/ChainMaker/contracts/standard/blob/master/draft/CM-CS-240301-IDA.md

type CMIDOption

type CMIDOption interface {
	// PkPemOf 获取公钥
	// @param address 地址
	// @return string 返回当前地址绑定的公钥
	// @return error 返回错误信息
	PkPemOf(address string) (string, error)

	// SetIdentityBatch 设置多个认证类型,管理员可调用
	// @param identities, 入参json格式字符串
	// @event topic: setIdentity(address, level, pkPem)
	SetIdentityBatch(identities []Identity) error

	// AlterAdminAddress 修改管理员,管理员可调用
	// @param adminAddresses 管理员地址,可为空,默认为创建人地址。入参为以逗号分隔的地址字符串"addr1,addr2"
	// @return error 返回错误信息
	// @event topic: alterAdminAddress(adminAddresses)
	AlterAdminAddress(adminAddresses string) error
}

type CMNFA

type CMNFA interface {
	// Mint a token, Obligatory.
	// @param to, the owner address of the token. Obligatory.
	// @param tokenId, the id of the token. Obligatory.
	// @param categoryName, the name of the category. If categoryName is empty, the token's category
	// will be the default category. Optional.
	// @param metadata, the metadata of the token. Optional.
	// @return error, the error msg if some error occur.
	// @event, topic: 'mint'; data: to, tokenId, categoryName, metadata
	Mint(to, tokenId, categoryName string, metadata []byte) error

	// MintBatch mint nft tokens batch. Obligatory.
	// @param tokens, the tokens to mint. Obligatory.
	// @return error, the error msg if some error occur.
	// @event, topic: 'mintBatch'; data: tokens
	MintBatch(tokens []NFA) error

	// SetApproval approve or cancel approve token to 'to' account. Obligatory.
	// @param owner, the owner of token. Obligatory.
	// @param to, destination approve to. Obligatory.
	// @param tokenId, the token id. Obligatory.
	// @param isApproval, to approve or to cancel approve
	// @return error, the error msg if some error occur.
	// @event, topic: 'setApproval'; data: to, tokenId, isApproval
	SetApproval(owner, to, tokenId string, isApproval bool) error

	// SetApprovalForAll approve or cancel approve all token to 'to' account. Obligatory.
	// @param owner, the owner of token. Obligatory.
	// @param to, destination address approve to. Obligatory.
	// @isApprove, true means approve and false means cancel approve. Obligatory.
	// @return error, the error msg if some error occur.
	// @event, topic: 'setApprovalForAll'; data: to, isApproval
	SetApprovalForAll(owner, to string, isApproval bool) error

	// TransferFrom transfer single token after approve. Obligatory.
	// @param from, owner account of token. Obligatory.
	// @param to, destination account transferred to. Obligatory.
	// @param tokenId, the token being transferred. Obligatory.
	// @return error, the error msg if some error occur.
	// @event, topic: 'transferFrom'; data: from, to, tokenId
	TransferFrom(from, to, tokenId string) error

	// TransferFromBatch transfer tokens after approve. Obligatory.
	// @param from, owner account of token. Obligatory.
	// @param to, destination account transferred to. Obligatory.
	// @param tokenIds, the tokens being transferred. Obligatory.
	// @return error, the error msg if some error occur.
	// @event, topic: 'transferFromBatch'; data: from, to, tokenIds
	TransferFromBatch(from, to string, tokenIds []string) error

	// OwnerOf get the owner of a token. Obligatory.
	// @param tokenId, the token which will be queried. Obligatory.
	// @return account, the token's account.
	// @return err, the error msg if some error occur.
	OwnerOf(tokenId string) (account string, err error)

	// TokenURI get the URI of the token. a token's uri consists of CategoryURI and tokenId. Obligatory.
	// @param tokenId, tokenId be queried. Obligatory.
	// @return uri, the uri of the token.
	// @return err, the error msg if some error occur.
	TokenURI(tokenId string) (uri string, err error)

	// EmitMintEvent emit mint event
	// @param to  destination account transferred to
	// @param tokenId
	// @param categoryName category name
	// @param metadata other info
	EmitMintEvent(to, tokenId, categoryName, metadata string)

	// EmitSetApprovalEvent emit set approval event
	// @param owner  account of token.
	// @param to  destination account transferred to
	// @param tokenId
	// @param isApproval true means approve and false means cancel approve.
	EmitSetApprovalEvent(owner, to, tokenId string, isApproval bool)

	// EmitSetApprovalForAllEvent emit set approval for all event
	// @param owner  account of token.
	// @param to  destination account transferred to
	// @param isApproval true means approve and false means cancel approve.
	EmitSetApprovalForAllEvent(owner, to string, isApproval bool)

	// EmitTransferFromEvent emit transfer from event
	// @param from owner  account of token.
	// @param to  destination account transferred to
	// @param tokenId
	EmitTransferFromEvent(from, to, tokenId string)
}

CMNFA Chainmaker NFA standard interface https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-NFA.md

type CMNFAOption

type CMNFAOption interface {
	// SetApprovalByCategory approve or cancel approve tokens of category to 'to' account. Optional.
	// @param owner, the owner of token. Obligatory.
	// @param to, destination address approve to. Obligatory.
	// @categoryName, the category of tokens. Obligatory.
	// @isApproval, to approve or to cancel approve. Obligatory.
	// @return error, the error msg if some error occur.
	// @event, topic: 'setApprovalByCategory'; data: to, categoryName, isApproval
	SetApprovalByCategory(owner, to, categoryName string, isApproval bool) error

	// CreateOrSetCategory create a category of tokens. Optional.
	// @param categoryName, the category name. Obligatory.
	// @param categoryURI, the category uri. Obligatory.
	// @return error, the error msg if some error occur.
	// @event, topic: 'createOrSetCategory'; data: category
	CreateOrSetCategory(category *Category) error

	// Burn burn token
	// @param tokenId, tokenId
	Burn(tokenId string) error

	// GetCategoryByName get specific category by name. Optional.
	// @param categoryName, the name of the category. Obligatory.
	// @return category, the category returned.
	// @return err, the error msg if some error occur.
	GetCategoryByName(categoryName string) (category *Category, err error)

	// GetCategoryByTokenId get a specific category by tokenId. Optional.
	// @param tokenId, the names of category to be queried. Obligatory.
	// @return category, the result queried.
	// @return err, the error msg if some error occur.
	GetCategoryByTokenId(tokenId string) (category *Category, err error)

	// TotalSupply get total token supply of this contract. Optional.
	// @return totalSupply, the total token supply value returned.
	// @return err, the error msg if some error occur.
	TotalSupply() (totalSupply *safemath.SafeUint256, err error)

	// TotalSupplyOfCategory get total token supply of the category. Optional.
	// @param category, the category of tokens. Obligatory.
	// @return totalSupply, the total token supply value returned.
	// @return err, the error msg if some error occur.
	TotalSupplyOfCategory(category string) (totalSupply *safemath.SafeUint256, err error)

	// BalanceOf get total token number of the account. Optional
	// @param account, the account which will be queried. Obligatory.
	// @return balance, the token number of the account.
	// @return err, the error msg if some error occur.
	BalanceOf(account string) (balance *safemath.SafeUint256, err error)

	// AccountTokens get the token list of the account. Optional
	// @param account, the account which will be queried. Obligatory.
	// @return tokenId, the list of tokenId.
	// @return err, the error msg if some error occur.
	AccountTokens(account string) (tokenId []string, err error)

	// TokenMetadata get the metadata of a token. Optional.
	// @param tokenId, tokenId which will be queried.
	// @return metadata, the metadata of the token.
	// @return err, the error msg if some error occur.
	TokenMetadata(tokenId string) (metadata []byte, err error)

	// EmitBurnEvent emit burn event
	// @param tokenId
	EmitBurnEvent(tokenId string)

	// EmitCreateOrSetCategoryEvent emit CreateOrSetCategory event
	// @param categoryName
	// @param categoryURI
	EmitCreateOrSetCategoryEvent(categoryName, categoryURI string)

	// EmitSetApprovalByCategoryEvent emit set approval by category event
	// @param owner  account of token.
	// @param to  destination account transferred to
	// @param categoryName
	// @param isApproval true means approve and false means cancel approve.
	EmitSetApprovalByCategoryEvent(owner, to, categoryName string, isApproval bool)
}

type Category

type Category struct {
	// CategoryName, the name of the category
	CategoryName string `json:"categoryName"`
	// CategoryURI, the uri of the category
	CategoryURI string `json:"categoryURI"`
}

Category the tokens' category info

type CertificationInfo added in v1.1.0

type CertificationInfo struct {
	Category       int          `json:"category"`                 // 审批类型,1:合规,2:价值评估
	Result         int          `json:"result"`                   // 认证结果,0:待认证,1:通过,2:驳回
	Explains       string       `json:"explains,omitempty"`       // 驳回原因
	Description    string       `json:"description,omitempty"`    // 认证描述
	RequestAddress string       `json:"requestAddress"`           // 申请人地址
	RequestTime    *time.Time   `json:"requestTime,omitempty"`    // 申请时间
	ExpireTime     *time.Time   `json:"expireTime,omitempty"`     // 过期时间
	HandleTime     *time.Time   `json:"handleTime,omitempty"`     // 处理时间
	CreatedAt      *time.Time   `json:"createdAt,omitempty"`      // 创建时间
	UpdatedAt      *time.Time   `json:"updatedAt,omitempty"`      // 更新时间
	DeletedAt      *time.Time   `json:"deletedAt,omitempty"`      // 删除时间
	Certifications []Attachment `json:"certifications,omitempty"` // 资产的认证文件
}

CertificationInfo 定义了数据资产认证的结构

type ColumnInfo added in v1.1.0

type ColumnInfo struct {
	Name          string `json:"name"`                     // 数据项名称
	SecurityLevel int    `json:"security_level,omitempty"` // 分级分类
	DataType      string `json:"data_type"`                // 数据类型
	DataLength    int    `json:"data_length,omitempty"`    // 数据长度
	Description   string `json:"description,omitempty"`    // 字段描述
	DataExample   string `json:"data_example,omitempty"`   // 数据样例
	CustomColumn  string `json:"custom_column,omitempty"`  // 个性化字段
	CreatedAt     string `json:"created_at,omitempty"`     // 创建时间
	UpdatedAt     string `json:"updated_at,omitempty"`     // 更新时间
	IsPrimaryKey  int    `json:"is_primary_key,omitempty"` // 是否主键
	IsNotNull     int    `json:"is_not_null,omitempty"`    // 是否非空
	PrivacyQuery  int    `json:"privacy_query,omitempty"`  // 是否隐私计算
}

ColumnInfo 定义了数据项的结构

type DataScale added in v1.1.0

type DataScale struct {
	Type  int `json:"type"`  // 数据规模类型,1: 条, 2: M, 3: G
	Scale int `json:"scale"` // 数据规模数量
}

DataScale 定义了数据资产的规模

type DelegateInfo added in v1.0.4

type DelegateInfo struct {
	// DelegatorDid 授权者DID
	DelegatorDid string `json:"delegatorDid"`
	// DelegateeDid 被授权者DID
	DelegateeDid string `json:"delegateeDid"`
	// Resource 资源,一般是VcID
	Resource string `json:"resource"`
	// Action 操作,一般是"issue"或"verify"
	Action string `json:"action"`
	// StartTime 授权开始时间
	StartTime int64 `json:"startTime"`
	// Expiration 授权结束时间
	Expiration int64 `json:"expiration"`
}

DelegateInfo 授权信息

type Details added in v1.1.0

type Details struct {
	UserCategories []int      `json:"user_categories,omitempty"` // 使用对象类别,1: 政府用户, 2: 企业用户, 3: 个人用户, 4: 无限制用户
	Description    string     `json:"description,omitempty"`     // 资产的详细描述
	DataSample     string     `json:"data_sample,omitempty"`     // 数据产品的示例
	DataFormat     int        `json:"data_format,omitempty"`     // 数据的存储格式,1: 数据表格式, 2: Excel格式, 3: XML格式, 4: CSV格式, 5: JSON格式, 9: 其他格式
	TimeSpan       string     `json:"time_span,omitempty"`       // 数据的时间跨度
	CustomInfo     string     `json:"custom_info,omitempty"`     // 个性化信息汇总
	DataScale      DataScale  `json:"data_scale,omitempty"`      // 数据的规模描述
	ExpirationTime *time.Time `json:"expiration_time,omitempty"` // 资产的失效时间
}

Details 定义了数据资产的具体细节

type DomainInfo added in v1.0.4

type DomainInfo struct {
	// Domain 域名
	Domain string `json:"domain"`
	// ResolveValue 解析值
	ResolveValue string `json:"resolveValue"`
	// 绑定的类型
	ResourceType string `json:"resourceType"`
	// Owner 所有者
	Owner string `json:"owner"`
	// ExpirationTime 过期时间
	ExpirationTime int `json:"expirationTime"`
	// Resolver 解析器合约地址
	Resolver string `json:"resolver"`
	// Status 域名状态,正常,过期,禁用
	Status string `json:"status"`
	// Metadata 元数据
	Metadata string `json:"metadata"`
}

DomainInfo 域名信息

type Evidence

type Evidence struct {
	// Id 业务流水号
	Id string `json:"id"`
	// Hash 哈希值
	Hash string `json:"hash"`
	// TxId 存证时交易ID
	TxId string `json:"txId"`
	// BlockHeight 存证时区块高度
	BlockHeight int `json:"blockHeight"`
	// Timestamp 存证时区块时间
	Timestamp string `json:"timestamp"`
	// Metadata 可选,其他信息;具体参考下方 Metadata 对象。
	Metadata string `json:"metadata"`
}

Evidence 存证结构体

type IDAInfo added in v1.1.0

type IDAInfo struct {
	Basic          Basic               `json:"basic"`
	Ownership      Ownership           `json:"ownership"`
	Source         Source              `json:"source,omitempty"`
	Scenarios      Scenarios           `json:"scenarios,omitempty"`
	Supply         Supply              `json:"supply,omitempty"`
	Details        Details             `json:"details,omitempty"`
	Status         Status              `json:"status,omitempty"`
	Columns        []ColumnInfo        `json:"columns,omitempty"`
	APIs           []APIInfo           `json:"apis,omitempty"`
	Certifications []CertificationInfo `json:"certifications,omitempty"`
}

IDAInfo 定义了数据资产的主要结构体

type Identity

type Identity struct {
	// Address 公钥地址
	Address string `json:"address"`
	// PkPem 公钥详情
	PkPem string `json:"pkPem"`
	// Level 认证类型编号
	Level int `json:"level"`
	// Metadata 其他,json格式字符串,可包含地址类型,上链人身份、组织信息,上链可信时间,上链批次等等
	Metadata string `json:"metadata"`
}

Identity 认证入参

type IdentityMeta

type IdentityMeta struct {
	// Level 认证类型编号
	Level int `json:"level"`
	// Description 认证类型描述
	Description string `json:"description"`
}

IdentityMeta 认证类型基础信息

type IdentityMetadata added in v1.0.2

type IdentityMetadata struct {
	// AddressType 地址类型:0-chainmaker, 1-zxl, 2-ethereum,长安链默认是2
	AddressType string `json:"addressType"`
	// OrgId 组织ID
	OrgId string `json:"orgId"`
	// Role 上链人身份角色
	Role string `json:"role"`
	// Timestamp 可信存证时间
	Timestamp string `json:"timestamp"`
	// ProveTimestamp 可信存证时间证明
	ProveTimestamp string `json:"proveTimestamp"`
	// BatchId 批次ID
	BatchId string `json:"batchId"`
}

IdentityMetadata 可选信息建议字段,若包含以下相关信息,建议采用以下字段

type Industry added in v1.1.0

type Industry struct {
	Id    int    `json:"id"`              // id
	Code  string `json:"code,omitempty"`  // 行业编号
	Title string `json:"title,omitempty"` // 行业名称
}

Industry 定义了行业分类的结构

type Metadata

type Metadata struct {
	// HashType 哈希的类型,文字、文件、视频、音频等
	HashType string `json:"hashType"`
	// HashAlgorithm 哈希算法,sha256、sm3等
	HashAlgorithm string `json:"hashAlgorithm"`
	// Username 存证人,用于标注存证的身份
	Username string `json:"username"`
	// Timestamp 可信存证时间
	Timestamp string `json:"timestamp"`
	// ProveTimestamp 可信存证时间证明
	ProveTimestamp string `json:"proveTimestamp"`
	// 存证内容
	Content string `json:"content"`
}

Metadata 可选信息建议字段,若包含以下相关信息存证,请采用以下字段

type NFA

type NFA struct {
	// TokenId, the id of the token
	TokenId string `json:"tokenId"`
	// CategoryName, the name of the category
	CategoryName string `json:"categoryName"`
	// To, the address which the token minted to
	To string `json:"to"`
	// Metadata, the metadata of the token
	Metadata []byte `json:"metadata"`
}

NFA a Digital Non-Fungible Assets

type Ownership added in v1.1.0

type Ownership struct {
	Holder    string          `json:"holder"`              // 资产持有者的链上地址
	Users     map[string]bool `json:"users,omitempty"`     // 资产加工使用者的链上地址列表
	Operators map[string]bool `json:"operators,omitempty"` // 资产经营者的链上地址列表
}

Ownership 定义了数据资产的所有权和使用情况

type PlatformInfo added in v1.1.0

type PlatformInfo struct {
	Name            string    `json:"name"`            // 平台名称
	Pubkey          string    `json:"pubkey"`          // 平台公钥,base64 编码字符串
	CreatedAt       time.Time `json:"created_at"`      // 创建时间
	Address         string    `json:"address"`         // 平台对应的链账户地址
	EnterpriseName  string    `json:"enterpriseName"`  // 企业名称
	EnterpriseTypes []int     `json:"enterpriseTypes"` // 使用平台的机构或者企业类型
	CreditCode      string    `json:"creditCode"`      // 企业信用编码
}

PlatformInfo 平台信息

type Scenarios added in v1.1.0

type Scenarios struct {
	ApplicableScenarios string `json:"applicable_scenarios,omitempty"` // 适用场景描述
	ProhibitedScenarios string `json:"prohibited_scenarios,omitempty"` // 禁用场景描述
}

Scenarios 定义了数据资产适用的场景

type Source added in v1.1.0

type Source struct {
	Name             string       `json:"name,omitempty"`         // 源数据的名称
	Type             int          `json:"type,omitempty"`         // 数据的取得方式,1: 原始取得, 2: 收集取得, 3: 交易取得, 4: 其他方式
	Channel          string       `json:"channel,omitempty"`      // 数据的来源渠道
	ProofAttachments []Attachment `json:"attachments,omitempty"`  // 取得方式的证明文件
	UpdateCycle      UpdateCycle  `json:"update_cycle,omitempty"` // 数据的更新周期
}

Source 定义了数据资产来源的结构

type Status added in v1.1.0

type Status struct {
	Status              int        `json:"status"`                         // 资产的当前状态,1: 已创建, -1: 已删除
	CertificationStatus int        `json:"certification_status,omitempty"` // 认证状态,0: 待认证, 1: 认证中, 2: 认证完成
	CreatedAt           *time.Time `json:"created_at,omitempty"`           // 资产的创建时间
	UpdatedAt           *time.Time `json:"updated_at,omitempty"`           // 资产的更新时间
	DeletedAt           *time.Time `json:"deleted_at,omitempty"`           // 资产的删除时间
}

Status 定义了数据资产的当前状态

type Supply added in v1.1.0

type Supply struct {
	ImmediatelySupply bool       `json:"immediately_supply,omitempty"`  // 是否即时供应
	DelayedSupplyTime *time.Time `json:"delayed_supply_time,omitempty"` // 延迟供应时间
}

Supply 定义了数据资产供应的结构

type UpdateCycle added in v1.1.0

type UpdateCycle struct {
	UpdateCycleType int    `json:"update_cycle_type"`           // 更新周期类型,1: 静态, 2: 实时, 3: 周期, 4:其他
	Cycle           int    `json:"cycle,omitempty"`             // 更新周期的具体数值
	UpdateCycleUnit int    `json:"update_cycle_unit,omitempty"` // 更新周期的单位,1: 分钟, 2: 小时, 3: 天
	Cron            string `json:"cron,omitempty"`              // 可扩展更新字段,可以使用cron表达式
}

UpdateCycle 定义了数据资产的更新周期结构

type UserInfo added in v1.1.0

type UserInfo struct {
	CreatedAt      *time.Time      `json:"created_at"`          // 创建时间
	Address        string          `json:"address"`             // 用户地址
	UserType       int             `json:"userType"`            // 用户类型,0: 管理员用户, 1: 普通用户
	UserPermission int             `json:"userPermission"`      // 用户权限
	IDAAmount      int             `json:"ida_amount"`          // 用户持有的IDA数量
	Approvals      map[string]bool `json:"approvals,omitempty"` // 授权方的链上地址列表
	PlatformPubkey string          `json:"platformPubkey"`      // 关联的平台公钥,base64 编码字符串
}

UserInfo 定义了用户结构

type VcIssueLog added in v1.0.4

type VcIssueLog struct {
	// Issuer 发行者DID
	Issuer string `json:"issuer"`
	// Did vc持有者DID
	Did string `json:"did"`
	// TemplateId vc模板ID
	TemplateId string `json:"templateID"`
	// VcID vcID或者vc hash
	VcID string `json:"vcID"`
	// IssueTime 发行上链时间
	IssueTime int64 `json:"issueTime"`
}

VcIssueLog 记录vc发行日志

type VcTemplate added in v1.0.4

type VcTemplate struct {
	// Id 模板ID
	Id string `json:"id"`
	// Name 模板名称
	Name string `json:"name"`
	// Version 模板版本
	Version string `json:"version"`
	// VcType vc类型
	VcType string `json:"vcType"`
	// Template 模板内容
	Template string `json:"template"`
}

VcTemplate vc模板

Source Files

  • CMBC.go
  • CMBNS.go
  • CMDFA.go
  • CMDID.go
  • CMEVI.go
  • CMID.go
  • CMIDA.go
  • CMNFA.go
  • common.go

Jump to

Keyboard shortcuts

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