contracts

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PREFIX_CONTRACT_ADDRESS = new(felt.Felt).SetBytes([]byte("STARKNET_CONTRACT_ADDRESS"))

Functions

func PrecomputeAddress added in v0.7.1

func PrecomputeAddress(deployerAddress *felt.Felt, salt *felt.Felt, classHash *felt.Felt, constructorCalldata []*felt.Felt) *felt.Felt

PrecomputeAddress calculates the precomputed address for a contract instance. ref: https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/core/os/contract_address/contract_address.py

Parameters: - deployerAddress: the deployer address - salt: the salt - classHash: the class hash - constructorCalldata: the constructor calldata Returns: - *felt.Felt: the precomputed address as a *felt.Felt

Types

type CasmClass added in v0.4.6

type CasmClass struct {
	Prime            string                     `json:"prime"`
	Version          string                     `json:"compiler_version"`
	ByteCode         []*felt.Felt               `json:"bytecode"`
	EntryPointByType CasmClassEntryPointsByType `json:"entry_points_by_type"`
}

func UnmarshalCasmClass added in v0.4.6

func UnmarshalCasmClass(filePath string) (*CasmClass, error)

UnmarshalCasmClass is a function that unmarshals a CasmClass object from a file. CASM = Cairo instructions

It takes a file path as a parameter and returns a pointer to the unmarshaled CasmClass object and an error.

type CasmClassEntryPoint added in v0.4.6

type CasmClassEntryPoint struct {
	Selector *felt.Felt `json:"selector"`
	Offset   int        `json:"offset"`
	Builtins []string   `json:"builtins"`
}

type CasmClassEntryPointsByType added in v0.4.6

type CasmClassEntryPointsByType struct {
	Constructor []CasmClassEntryPoint `json:"CONSTRUCTOR"`
	External    []CasmClassEntryPoint `json:"EXTERNAL"`
	L1Handler   []CasmClassEntryPoint `json:"L1_HANDLER"`
}

Jump to

Keyboard shortcuts

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