Documentation
¶
Index ¶
- func HexToBytes(hexStr string) ([]byte, error)
- func ValidateNEARTransferRequest(signerID, receiverID string, nonce uint64, blockHash, amount []byte) error
- type NEARChain
- func (n *NEARChain) BuildSigningInputFromTransferRequest(request *NEARTransferRequest) (*near.SigningInput, error)
- func (n *NEARChain) CompileTransaction(input *chain_abstraction.TransactionInput, signatures [][]byte, ...) ([]byte, error)
- func (n *NEARChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)
- func (n *NEARChain) GetPreimageHash(input *chain_abstraction.TransactionInput) ([]byte, []byte, error)
- func (n *NEARChain) GetTransactionHash(encodedTx []byte) (string, error)
- func (n *NEARChain) GetTransactionHashFromPreimage(preimageData []byte) (string, error)
- func (n *NEARChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)
- func (n *NEARChain) Sign(preimage []byte, privateKey []byte) ([]byte, error)
- func (n *NEARChain) ValidateTransactionInput(input interface{}) error
- type NEARTransferRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HexToBytes ¶
Helper function to convert hex string to bytes
Types ¶
type NEARChain ¶
type NEARChain struct {
*chain_abstraction.BaseChain
}
NEARChain implements the Chain interface for NEAR Protocol
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 ¶
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 ¶
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 ¶
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) ValidateTransactionInput ¶
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