import type { AddTransactionResponse, BlockNumber, CallContractResponse, CallContractTransaction, CompiledContract, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionResponse, GetTransactionStatusResponse, Signature, Transaction, TransactionReceipt } from '../types'; import type { BigNumberish } from '../utils/number'; export declare abstract class ProviderInterface { abstract baseUrl: string; abstract feederGatewayUrl: string; abstract gatewayUrl: string; /** * 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 */ abstract 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. */ abstract 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 } */ abstract 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 */ abstract 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 */ abstract 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 } */ abstract 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? } */ abstract getTransaction(txHash: BigNumberish): Promise; abstract 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 */ abstract 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 */ abstract 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 */ abstract invokeFunction(contractAddress: string, entrypointSelector: string, calldata?: string[], signature?: Signature): Promise; abstract waitForTx(txHash: BigNumberish, retryInterval?: number): Promise; }