Documentation
¶
Index ¶
- func BigToHex(in *big.Int) string
- func BytesToBig(bytes []byte) *big.Int
- func ComputeFact(programHash *big.Int, programOutputs []*big.Int) *big.Int
- func FmtKecBytes(in *big.Int, rolen int) (buf []byte)
- func GetSelectorFromName(funcName string) *big.Int
- func GetSelectorFromNameFelt(funcName string) *felt.Felt
- func HexToBN(hexString string) *big.Int
- func HexToBytes(hexString string) ([]byte, error)
- func HexToShortStr(hexStr string) string
- func Keccak256(data ...[]byte) []byte
- func MaskBits(mask, wordSize int, slice []byte) (ret []byte)
- func SNValToBN(str string) *big.Int
- func SplitFactStr(fact string) (fact_low, fact_high string)
- func StrToBig(str string) *big.Int
- func UTF8StrToBig(str string) *big.Int
- type AddDeclareResponse
- type AddDeployResponse
- type AddInvokeTransactionOutput
- type DeployAccountRequest
- type ExecuteDetails
- type FeeEstimate
- type FunctionCall
- type FunctionInvoke
- type KeccakState
- type NumAsHex
- type Signature
- type TransactionState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToBig ¶
func ComputeFact ¶
compute the keccack fact given the program hash and outputs
func FmtKecBytes ¶
format the bytes in Keccak hash
func GetSelectorFromName ¶
todo(): this is used by the signer. Should it return a felt?
func GetSelectorFromNameFelt ¶
func HexToBytes ¶
trim "0x" prefix(if exists) and converts hexidecimal string to byte slice
func HexToShortStr ¶
convert hex string to Starknet 'short string'
func Keccak256 ¶
Keccak256 calculates and returns the Keccak256 hash of the input data. (ref: https://github.com/ethereum/go-ethereum/blob/master/crypto/crypto.go)
func SplitFactStr ¶
split a fact into two felts
Types ¶
type AddDeclareResponse ¶
type AddDeployResponse ¶
type DeployAccountRequest ¶
type DeployAccountRequest struct { MaxFee *big.Int `json:"max_fee"` // Version of the transaction scheme, should be set to 0 or 1 Version *big.Int `json:"version"` // Signature Signature Signature `json:"signature"` // Nonce should only be set with Transaction V1 Nonce *big.Int `json:"nonce,omitempty"` Type string `json:"type"` ContractAddressSalt string `json:"contract_address_salt"` ConstructorCalldata []string `json:"constructor_calldata"` ClassHash string `json:"class_hash"` }
type ExecuteDetails ¶
ExecuteDetails provides some details about the execution.
type FeeEstimate ¶
type FeeEstimate struct { // GasConsumed the Ethereum gas cost of the transaction (see https://docs.starknet.io/docs/Fees/fee-mechanism for more info) GasConsumed NumAsHex `json:"gas_consumed"` // GasPrice the gas price (in gwei) that was used in the cost estimation GasPrice NumAsHex `json:"gas_price"` // OverallFee the estimated fee for the transaction (in gwei), product of gas_consumed and gas_price OverallFee NumAsHex `json:"overall_fee"` }
type FunctionCall ¶
type FunctionCall struct { ContractAddress *felt.Felt `json:"contract_address"` EntryPointSelector *felt.Felt `json:"entry_point_selector,omitempty"` // Calldata The parameters passed to the function Calldata []*felt.Felt `json:"calldata"` }
FunctionCall function call information
type FunctionInvoke ¶
type FunctionInvoke struct { MaxFee *big.Int `json:"max_fee"` // Version of the transaction scheme, should be set to 0 or 1 Version *big.Int `json:"version"` // Signature Signature Signature `json:"signature"` // Nonce should only be set with Transaction V1 Nonce *big.Int `json:"nonce,omitempty"` // Defines the transaction type to invoke Type string `json:"type,omitempty"` SenderAddress *felt.Felt `json:"sender_address"` EntryPointSelector string `json:"entry_point_selector,omitempty"` // Calldata The parameters passed to the function Calldata []string `json:"calldata"` }
todo(): what is this used for?
type KeccakState ¶
KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.
func NewKeccakState ¶
func NewKeccakState() KeccakState
NewKeccakState creates a new KeccakState (ref: https://github.com/ethereum/go-ethereum/blob/master/crypto/crypto.go)
type TransactionState ¶
type TransactionState string
const ( TransactionAcceptedOnL1 TransactionState = "ACCEPTED_ON_L1" TransactionAcceptedOnL2 TransactionState = "ACCEPTED_ON_L2" TransactionNotReceived TransactionState = "NOT_RECEIVED" TransactionPending TransactionState = "PENDING" TransactionReceived TransactionState = "RECEIVED" TransactionRejected TransactionState = "REJECTED" )
func (TransactionState) IsTransactionFinal ¶
func (s TransactionState) IsTransactionFinal() bool
func (TransactionState) MarshalJSON ¶
func (ts TransactionState) MarshalJSON() ([]byte, error)
func (TransactionState) String ¶
func (s TransactionState) String() string
func (*TransactionState) UnmarshalJSON ¶
func (ts *TransactionState) UnmarshalJSON(data []byte) error