chains

package
v0.0.1-gowrapper-test Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexToBytes

func HexToBytes(hexStr string) ([]byte, error)

Helper function to convert hex string to bytes

func ValidateNEARTransferRequest

func ValidateNEARTransferRequest(signerID, receiverID string, nonce uint64, blockHash, amount []byte) error

ValidateNEARTransferRequest validates NEAR transfer request fields

Types

type NEARChain

type NEARChain struct {
	*chain_abstraction.BaseChain
}

NEARChain implements the Chain interface for NEAR Protocol

func NewNEARChain

func NewNEARChain() *NEARChain

NewNEARChain creates a new NEAR chain instance

func (*NEARChain) BuildSigningInputFromTransferRequest

func (n *NEARChain) BuildSigningInputFromTransferRequest(request *NEARTransferRequest) (*near.SigningInput, error)

BuildSigningInputFromTransferRequest creates a NEAR signing input from a transfer request

func (*NEARChain) CompileTransaction

func (n *NEARChain) CompileTransaction(input *chain_abstraction.TransactionInput, signatures [][]byte, publicKeys [][]byte) ([]byte, error)

CompileTransaction compiles the transaction with signatures

func (*NEARChain) CreateAndSignTransaction

func (n *NEARChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)

CreateAndSignTransaction creates and signs a NEAR transaction

func (*NEARChain) GetPreimageHash

func (n *NEARChain) GetPreimageHash(input *chain_abstraction.TransactionInput) ([]byte, []byte, error)

GetPreimageHash gets the preimage hash for external signing

func (*NEARChain) GetTransactionHash

func (n *NEARChain) GetTransactionHash(encodedTx []byte) (string, error)

GetTransactionHash gets the transaction hash from encoded transaction For NEAR, the transaction hash is SHA256(transactionData) where transactionData is the unsigned transaction

func (*NEARChain) GetTransactionHashFromPreimage

func (n *NEARChain) GetTransactionHashFromPreimage(preimageData []byte) (string, error)

GetTransactionHashFromPreimage calculates the transaction hash directly from preimage data This is useful for testing and validation when you have the unsigned transaction data

func (*NEARChain) PrepareTransaction

func (n *NEARChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)

PrepareTransaction prepares a NEAR transaction for external signing

func (*NEARChain) Sign

func (n *NEARChain) Sign(preimage []byte, privateKey []byte) ([]byte, error)

Sign signs the preimage hash with the private key

func (*NEARChain) ValidateTransactionInput

func (n *NEARChain) ValidateTransactionInput(input interface{}) error

ValidateTransactionInput validates NEAR transaction input

type NEARTransferRequest

type NEARTransferRequest struct {
	SignerID   string
	ReceiverID string
	Nonce      uint64
	BlockHash  []byte
	Amount     []byte // Deposit amount in yoctoNEAR
}

NEARTransferRequest represents a transfer operation request

func NewNEARTransferRequest

func NewNEARTransferRequest(signerID, receiverID string, amount []byte) *NEARTransferRequest

NewNEARTransferRequest creates a new transfer request

func (*NEARTransferRequest) WithBlockHash

func (r *NEARTransferRequest) WithBlockHash(blockHash []byte) *NEARTransferRequest

WithBlockHash sets the block hash

func (*NEARTransferRequest) WithNonce

func (r *NEARTransferRequest) WithNonce(nonce uint64) *NEARTransferRequest

WithNonce sets the nonce

Jump to

Keyboard shortcuts

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