Documentation
¶
Index ¶
- Constants
- func BuildSignedEnvelopeOpReturnScript(payload []byte) (*script.Script, error)
- func EnvelopeDigest(fields []any) ([]byte, error)
- func ExtractSignedEnvelopeOpReturnPayload(lockingScript *script.Script) ([]byte, error)
- func HandleNodeCall(ctx context.Context, rt NodeRouteRuntime, meta ncall.CallContext, ...) (bool, ncall.CallResp, error)
- func MarshalQueryNameServicePayload(resp QueryNamePaidResp) ([]byte, error)
- func MarshalRegisterLockServicePayload(resp RegisterLockPaidResp) ([]byte, error)
- func MarshalResolveNameServicePayload(resp ResolveNamePaidResp) ([]byte, error)
- func MarshalSetTargetServicePayload(resp SetTargetPaidResp) ([]byte, error)
- func NormalizeName(raw string) (string, error)
- func SignEnvelope(fields []any, sign SignFunc) ([]byte, error)
- func Spec() caps.ModuleSpec
- type DomainPricingBody
- type ListOwnedReq
- type ListOwnedResp
- type NameRouteReq
- type NameTargetRouteReq
- type NodeRouteRuntime
- type OwnedNameItem
- type QueryNamePaidReq
- type QueryNamePaidResp
- type RegisterLockPaidReq
- type RegisterLockPaidResp
- type RegisterQuoteFields
- type RegisterReceiptFields
- type RegisterSubmitReq
- type RegisterSubmitResp
- type ResolutionFields
- type ResolveNamePaidReq
- type ResolveNamePaidResp
- type SetTargetPaidReq
- type SetTargetPaidResp
- type SignFunc
- type SignedEnvelope
- type VerifyFunc
Constants ¶
const ( ProtoResolveNamePaid = contractprotoid.ProtoDomainResolveNamePaid ProtoQueryNamePaid = contractprotoid.ProtoDomainQueryNamePaid ProtoRegisterLock = contractprotoid.ProtoDomainRegisterLock ProtoRegisterSubmit = contractprotoid.ProtoDomainRegisterSubmit ProtoSetTargetPaid = contractprotoid.ProtoDomainSetTargetPaid )
const ( RouteDomainV1Pricing = string(contractroute.RouteDomainV1Pricing) RouteDomainV1Resolve = string(contractroute.RouteDomainV1Resolve) RouteDomainV1Query = string(contractroute.RouteDomainV1Query) RouteDomainV1Lock = string(contractroute.RouteDomainV1Lock) RouteDomainV1ListOwned = string(contractroute.RouteDomainV1ListOwned) RouteDomainV1SetTarget = string(contractroute.RouteDomainV1SetTarget) RouteDomainV1RegisterSubmit = string(contractroute.RouteDomainV1RegisterSubmit) )
const ( ServiceTypeResolveName = RouteDomainV1Resolve ServiceTypeQueryName = RouteDomainV1Query ServiceTypeRegisterLock = RouteDomainV1Lock ServiceTypeSetTarget = RouteDomainV1SetTarget )
const ( InternalAbilityID = "bftp.domain@1" PublicCapabilityID = "domain" Version = uint32(1) )
Variables ¶
This section is empty.
Functions ¶
func BuildSignedEnvelopeOpReturnScript ¶
BuildSignedEnvelopeOpReturnScript 统一构造 domain 注册使用的完整签名原文 OP_RETURN。 设计说明: - 链上只接受完整签名原文,不做“部分字段”折中,避免验签语义被削弱; - 客户端与服务端都复用这套编码规则,防止一边能写一边读不出来。
func EnvelopeDigest ¶
func ExtractSignedEnvelopeOpReturnPayload ¶
ExtractSignedEnvelopeOpReturnPayload 提取完整签名原文 payload。 注意: - go-sdk 的 Chunks() 默认会把 OP_RETURN 后续原样塞进 RETURN chunk.Data,不适合这里; - 这里使用 ParseOps(),按真实 pushdata 逐段读取,再拼回完整原文。
func HandleNodeCall ¶
func HandleNodeCall(ctx context.Context, rt NodeRouteRuntime, meta ncall.CallContext, req ncall.CallReq) (bool, ncall.CallResp, error)
HandleNodeCall 统一处理 domain.v1.* 的 node.call 路由。 注意: - 它只做共享分发,不直接调用 ncall.Register; - 真正把入口挂到宿主上的动作,仍由角色项目在自己的 run/register 阶段显式完成。
func MarshalQueryNameServicePayload ¶
func MarshalQueryNameServicePayload(resp QueryNamePaidResp) ([]byte, error)
func MarshalRegisterLockServicePayload ¶
func MarshalRegisterLockServicePayload(resp RegisterLockPaidResp) ([]byte, error)
func MarshalResolveNameServicePayload ¶
func MarshalResolveNameServicePayload(resp ResolveNamePaidResp) ([]byte, error)
func MarshalSetTargetServicePayload ¶
func MarshalSetTargetServicePayload(resp SetTargetPaidResp) ([]byte, error)
func NormalizeName ¶
NormalizeName 按 ENSIP-15 统一名字。 设计说明: - 域名系统、客户端 locator、链上提交验证都必须共用同一规范化实现; - 这里不再保留旧 resolver 的 trim+lowercase 简化逻辑,避免未来状态键不一致; - 规范化失败直接拒绝,让错误尽早暴露,不让脏名字进入锁表和注册表。
func Spec ¶
func Spec() caps.ModuleSpec
Types ¶
type DomainPricingBody ¶
type DomainPricingBody = contractmessage.DomainPricingBody
type ListOwnedReq ¶
type ListOwnedReq = contractmessage.ListOwnedReq
type ListOwnedResp ¶
type ListOwnedResp = contractmessage.ListOwnedResp
type NameRouteReq ¶
type NameRouteReq = contractmessage.NameRouteReq
type NameTargetRouteReq ¶
type NameTargetRouteReq = contractmessage.NameTargetRouteReq
type NodeRouteRuntime ¶
type NodeRouteRuntime struct {
Pricing func(context.Context) (DomainPricingBody, error)
Resolve func(context.Context, ncall.CallContext, ncall.CallReq, NameRouteReq) (ncall.CallResp, error)
Query func(context.Context, ncall.CallContext, ncall.CallReq, NameRouteReq) (ncall.CallResp, error)
Lock func(context.Context, ncall.CallContext, ncall.CallReq, NameTargetRouteReq) (ncall.CallResp, error)
ListOwned func(context.Context, ncall.CallContext, ListOwnedReq) (ListOwnedResp, error)
SetTarget func(context.Context, ncall.CallContext, ncall.CallReq, NameTargetRouteReq) (ncall.CallResp, error)
RegisterSubmit func(context.Context, ncall.CallContext, RegisterSubmitReq) (RegisterSubmitResp, error)
}
NodeRouteRuntime 描述 domain.v1.* 公开 node.call 路由在角色侧需要注入的运行时。 设计说明: - modules.domain 只收口公开合同壳、解码和基础入参校验; - 具体业务处理、费用池扣费、持久化仍留在角色项目; - 这样后续 domain/gateway/client 若复用同一合同面,边界会更清楚。
type OwnedNameItem ¶
type OwnedNameItem = contractmessage.OwnedNameItem
type QueryNamePaidReq ¶
type QueryNamePaidReq = contractmessage.QueryNamePaidReq
type QueryNamePaidResp ¶
type QueryNamePaidResp = contractmessage.QueryNamePaidResp
type RegisterLockPaidReq ¶
type RegisterLockPaidReq = contractmessage.RegisterLockPaidReq
type RegisterLockPaidResp ¶
type RegisterLockPaidResp = contractmessage.RegisterLockPaidResp
type RegisterQuoteFields ¶
type RegisterQuoteFields struct {
QuoteID string
Name string
OwnerPubkeyHex string
TargetPubkeyHex string
PayToAddress string
RegisterPriceSatoshi uint64
RegisterSubmitFeeSatoshi uint64
TotalPaySatoshi uint64
LockExpiresAtUnix int64
TermSeconds uint64
}
func (RegisterQuoteFields) Array ¶
func (f RegisterQuoteFields) Array() []any
type RegisterReceiptFields ¶
type RegisterReceiptFields struct {
Name string
OwnerPubkeyHex string
TargetPubkeyHex string
ExpireAtUnix int64
RegisterTxID string
IssuedAtUnix int64
}
func (RegisterReceiptFields) Array ¶
func (f RegisterReceiptFields) Array() []any
type RegisterSubmitReq ¶
type RegisterSubmitReq = contractmessage.RegisterSubmitReq
type RegisterSubmitResp ¶
type RegisterSubmitResp = contractmessage.RegisterSubmitResp
type ResolutionFields ¶
type ResolutionFields struct {
Name string
OwnerPubkeyHex string
TargetPubkeyHex string
ExpireAtUnix int64
IssuedAtUnix int64
}
func (ResolutionFields) Array ¶
func (f ResolutionFields) Array() []any
type ResolveNamePaidReq ¶
type ResolveNamePaidReq = contractmessage.ResolveNamePaidReq
type ResolveNamePaidResp ¶
type ResolveNamePaidResp = contractmessage.ResolveNamePaidResp
type SetTargetPaidReq ¶
type SetTargetPaidReq = contractmessage.SetTargetPaidReq
type SetTargetPaidResp ¶
type SetTargetPaidResp = contractmessage.SetTargetPaidResp
type SignedEnvelope ¶
SignedEnvelope 是链上 OP_RETURN 与链下 RPC 共用的完整签名原文。 JSON 线格式固定为:[[字段...], "signature_hex"]。
func VerifyEnvelope ¶
func VerifyEnvelope(raw []byte, verify VerifyFunc) (SignedEnvelope, error)
func (SignedEnvelope) MarshalJSON ¶
func (e SignedEnvelope) MarshalJSON() ([]byte, error)
func (*SignedEnvelope) UnmarshalJSON ¶
func (e *SignedEnvelope) UnmarshalJSON(raw []byte) error