compat

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package compat provides compatibility layers for external dependencies

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToHex

func BytesToHex(bytes []byte) string

BytesToHex converts bytes to hex string

func CreateAccountWithLabel

func CreateAccountWithLabel(w *wallet.Wallet, password, label string) error

CreateAccountWithLabel creates an account with a password and label This adapts to different neo-go API versions

func NeoGoVersion

func NeoGoVersion() string

NeoGoVersion returns the detected version of neo-go

func StringToUint160

func StringToUint160(hexString string) (util.Uint160, error)

StringToUint160 converts a hex string to Uint160 for neo-go

func StringToUint256

func StringToUint256(hexString string) (util.Uint256, error)

StringToUint256 converts a hex string to Uint256 for neo-go

func Uint160FromBytes

func Uint160FromBytes(bytes []byte) (util.Uint160, error)

Uint160FromBytes creates a Uint160 from bytes using reflection to handle different neo-go versions

func Uint256FromBytes

func Uint256FromBytes(bytes []byte) (util.Uint256, error)

Uint256FromBytes creates a Uint256 from bytes using reflection to handle different neo-go versions

Types

type AccountHelper

type AccountHelper struct {
	Account *wallet.Account
}

AccountHelper provides compatibility functions for wallet.Account

func NewAccountHelper

func NewAccountHelper(account *wallet.Account) *AccountHelper

NewAccountHelper creates a new helper for a wallet account

func (*AccountHelper) GetAddress

func (h *AccountHelper) GetAddress() string

GetAddress returns the account address

func (*AccountHelper) GetPrivateKeyHex

func (h *AccountHelper) GetPrivateKeyHex() string

GetPrivateKeyHex returns the account private key as a hex string This handles different neo-go versions by using safe fallbacks

func (*AccountHelper) GetPublicKeyHex

func (h *AccountHelper) GetPublicKeyHex() string

GetPublicKeyHex returns the account public key as a hex string This handles different neo-go versions by using safe fallbacks

type PrivateKeyHelper

type PrivateKeyHelper struct{}

PrivateKeyHelper provides utilities for private key operations

func NewPrivateKeyHelper

func NewPrivateKeyHelper() *PrivateKeyHelper

NewPrivateKeyHelper creates a new private key helper

func (*PrivateKeyHelper) FromBytes

func (h *PrivateKeyHelper) FromBytes(data []byte) (*keys.PrivateKey, error)

FromBytes creates a private key from bytes

type TransactionHelper

type TransactionHelper struct {
}

TransactionHelper provides compatibility functions for transactions

func NewTransactionHelper

func NewTransactionHelper() *TransactionHelper

NewTransactionHelper creates a new transaction helper

func (*TransactionHelper) CreateDeploymentScript

func (h *TransactionHelper) CreateDeploymentScript(
	nef []byte,
	manifest []byte,
) ([]byte, error)

CreateDeploymentScript creates a deployment script for different neo-go versions

func (*TransactionHelper) CreateInvocationTx

func (h *TransactionHelper) CreateInvocationTx(
	script []byte,
	account *wallet.Account,
	sysFee int64,
	netFee int64,
	additionalAttributes ...transaction.Attribute,
) (*transaction.Transaction, error)

CreateInvocationTx creates an invocation transaction for different neo-go versions

func (*TransactionHelper) CreateSmartContractScript

func (h *TransactionHelper) CreateSmartContractScript(
	scriptHash util.Uint160,
	method string,
	params []interface{},
) ([]byte, error)

CreateSmartContractScript creates a smart contract script for different neo-go versions

Jump to

Keyboard shortcuts

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