import { AddTransactionResponse, BlockNumber, CallContractResponse, CallContractTransaction, CompiledContract, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionResponse, GetTransactionStatusResponse, Signature, Transaction, TransactionReceipt } from '../types'; import { BigNumberish } from '../utils/number'; import { ProviderInterface } from './interface'; declare type NetworkName = 'mainnet-alpha' | 'goerli-alpha'; declare type ProviderOptions = { network: NetworkName; } | { baseUrl: string; }; export declare class Provider implements ProviderInterface { baseUrl: string; feederGatewayUrl: string; gatewayUrl: string; constructor(optionsOrProvider?: ProviderOptions | Provider); protected static getNetworkFromName(name: NetworkName): "https://alpha-mainnet.starknet.io" | "https://alpha4.starknet.io"; /** * Gets the smart contract address on the goerli testnet. * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L13-L15) * @returns starknet smart contract addresses */ getContractAddresses(): Promise; /** * Calls a function on the StarkNet contract. * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L25-L39) * * @param invokeTransaction - transaction to be invoked * @param blockHash * @param blockNumber * @returns the result of the function on the smart contract. */ callContract(invokeTransaction: CallContractTransaction, blockHash?: BigNumberish, blockNumber?: BlockNumber): Promise; /** * Gets the block information * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L41-L53) * * @param blockHash * @param blockNumber * @returns the block object { block_number, previous_block_number, state_root, status, timestamp, transaction_receipts, transactions } */ getBlock(blockHash?: BigNumberish, blockNumber?: BlockNumber): Promise; /** * Gets the code of the deployed contract. * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L55-L68) * * @param contractAddress * @param blockHash * @param blockNumber * @returns Bytecode and ABI of compiled contract */ getCode(contractAddress: string, blockHash?: BigNumberish, blockNumber?: BlockNumber): Promise; /** * Gets the contract's storage variable at a specific key. * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L70-L85) * * @param contractAddress * @param key - from getStorageVarAddress('') (WIP) * @param blockHash * @param blockNumber * @returns the value of the storage variable */ getStorageAt(contractAddress: string, key: number, blockHash?: BigNumberish, blockNumber?: BlockNumber): Promise; /** * Gets the status of a transaction. * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L48-L52) * * @param txHash * @returns the transaction status object { block_number, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN } */ getTransactionStatus(txHash: BigNumberish): Promise; /** * Gets the transaction information from a tx id. * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L54-L58) * * @param txHash * @returns the transacton object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? } */ getTransaction(txHash: BigNumberish): Promise; /** * Gets the transaction receipt from a tx hash or tx id. * * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L104-L111) * * @param txHash * @param txId * @returns the transaction receipt object */ getTransactionReceipt({ txHash, txId, }: { txHash?: BigNumberish; txId?: BigNumberish; }): Promise; /** * Invoke a function on the starknet contract * * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/gateway/gateway_client.py#L13-L17) * * @param transaction - transaction to be invoked * @returns a confirmation of invoking a function on the starknet contract */ addTransaction(transaction: Transaction): Promise; /** * Deploys a given compiled contract (json) to starknet * * @param contract - a json object containing the compiled contract * @param address - (optional, defaults to a random address) the address where the contract should be deployed (alpha) * @returns a confirmation of sending a transaction on the starknet contract */ deployContract(contract: CompiledContract | string, constructorCalldata?: string[], addressSalt?: BigNumberish): Promise; /** * Invokes a function on starknet * * @param contractAddress - target contract address for invoke * @param entrypointSelector - target entrypoint selector for * @param calldata - (optional, default []) calldata * @param signature - (optional) signature to send along * @returns response from addTransaction */ invokeFunction(contractAddress: string, entrypointSelector: string, calldata?: string[], signature?: Signature): Promise; waitForTx(txHash: BigNumberish, retryInterval?: number): Promise; } export {};