devnet

package
v0.0.0-...-4fa4744 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevNet

type DevNet struct {
	// contains filtered or unexported fields
}

func NewDevNet

func NewDevNet(baseURL ...string) *DevNet

NewDevNet creates a new DevNet instance.

It accepts an optional baseURL parameter, which is a string representing the base URL of the DevNet server. If no baseURL is provided, the default value of "http://localhost:5050" is used.

Parameters: - baseURL: a string representing the base URL of the DevNet server Returns: - *DevNet: a pointer to the newly created DevNet instance

func (*DevNet) Accounts

func (devnet *DevNet) Accounts() ([]TestAccount, error)

Accounts retrieves a list of test accounts from the DevNet API.

It does an HTTP GET request to the "/predeployed_accounts" endpoint and decodes the response body into a slice of TestAccount structs. It returns the list of accounts and any error that occurred during the process.

Parameters:

none

Returns: - []TestAccount: a slice of TestAccount structs

func (*DevNet) FeeToken

func (devnet *DevNet) FeeToken() (*FeeToken, error)

FeeToken retrieves the fee token from the DevNet API.

This function does a GET request to the "/fee_token" endpoint of the DevNet API to retrieve the fee token.

Parameters:

none

Returns:

  • *FeeToken: a pointer to a FeeToken object
  • error: an error, if any

func (*DevNet) IsAlive

func (devnet *DevNet) IsAlive() bool

IsAlive checks if the DevNet is alive.

It sends a GET request to the "/is_alive" endpoint of the DevNet API. It returns true if the response status code is 200 (http.StatusOK), and false otherwise.

Parameters:

none

Returns:

bool: true if the DevNet is alive, false otherwise

func (*DevNet) Mint

func (devnet *DevNet) Mint(address *felt.Felt, amount *big.Int) (*MintResponse, error)

Mint mints a certain amount of tokens for a given address.

Parameters: - address: is the address to mint tokens for - amount: is the amount of tokens to mint Returns: - *MintResponse: a MintResponse - error: an error if any

type FeeToken

type FeeToken struct {
	Symbol  string
	Address *felt.Felt
}

type MintResponse

type MintResponse struct {
	NewBalance      string `json:"new_balance"`
	Unit            string `json:"unit"`
	TransactionHash string `json:"tx_hash"`
}

type TestAccount

type TestAccount struct {
	PrivateKey string `json:"private_key"`
	PublicKey  string `json:"public_key"`
	Address    string `json:"address"`
}

Jump to

Keyboard shortcuts

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