did

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ERC721DIDMethod is the method for a ERC721 NFT DID.
	ERC721DIDMethod = "erc721"
	// EthrDIDMethod is the method for a Ethereum Address DID.
	EthrDIDMethod = "ethr"
	// ERC20DIDMethod is the method for a ERC20 token DID.
	ERC20DIDMethod = "erc20"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ERC20DID

type ERC20DID struct {
	ChainID         uint64         `json:"chainId"`
	ContractAddress common.Address `json:"contract"`
}

ERC20DID is a Decentralized Identifier for an ERC20 token.

func DecodeERC20DID

func DecodeERC20DID(did string) (ERC20DID, error)

DecodeERC20DID decodes a ERC20 DID string into a DID struct.

func (ERC20DID) MarshalText

func (e ERC20DID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (ERC20DID) String

func (e ERC20DID) String() string

String returns the string representation of the ERC20DID.

func (*ERC20DID) UnmarshalText

func (e *ERC20DID) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type ERC721DID

type ERC721DID struct {
	ChainID         uint64         `json:"chainId"`
	ContractAddress common.Address `json:"contract"`
	TokenID         *big.Int       `json:"tokenId"`
}

ERC721DID is a Decentralized Identifier for a ERC721 NFT.

func DecodeERC721DID

func DecodeERC721DID(did string) (ERC721DID, error)

DecodeERC721DID decodes a DID string into a DID struct.

func DecodeERC721orNFTDID

func DecodeERC721orNFTDID(did string) (ERC721DID, error)

DecodeERC721orNFTDID attempts to decode a DID string as an ERC721DID or falls back to a legacy NFT DID.

func DecodeLegacyNFTDID

func DecodeLegacyNFTDID(did string) (ERC721DID, error)

DecodeLegacyNFTDID decodes a legacy NFT DID using the format "did:nft:1:0xAddr_1". You most likely want to use DecodeERC721DID instead.

func (ERC721DID) MarshalText

func (e ERC721DID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (ERC721DID) String

func (e ERC721DID) String() string

String returns the string representation of the NFTDID.

func (*ERC721DID) UnmarshalText

func (e *ERC721DID) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type EthrDID

type EthrDID struct {
	ChainID         uint64         `json:"chainId"`
	ContractAddress common.Address `json:"contract"`
}

EthrDID is a Decentralized Identifier for an Ethereum contract.

func DecodeEthrDID

func DecodeEthrDID(did string) (EthrDID, error)

DecodeEthrDID decodes a Ethr DID string into a DID struct.

func (EthrDID) MarshalText

func (e EthrDID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (EthrDID) String

func (e EthrDID) String() string

String returns the string representation of the EthrDID.

func (*EthrDID) UnmarshalText

func (e *EthrDID) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

Jump to

Keyboard shortcuts

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