Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LocalRegtest

Hierarchy

Index

Constructors

constructor

Properties

DUST_MINIMUM

DUST_MINIMUM: number

MAGIC_BYTES

MAGIC_BYTES: string

blockstackAPIUrl

blockstackAPIUrl: string

broadcastServiceUrl

broadcastServiceUrl: string

btc

excludeUtxoSet

excludeUtxoSet: Array<UTXO>

includeUtxoMap

includeUtxoMap: object

Type declaration

  • [address: string]: UTXO[]

layer1

layer1: any

Methods

Private broadcastNameRegistration

  • broadcastNameRegistration(preorderTransaction: string, registerTransaction: string, zoneFile: string): Promise<any>
  • Sends the preorder and registration transactions and zone file for a Blockstack name registration along with the to the transaction broadcast service.

    The transaction broadcast:

    • immediately broadcasts the preorder transaction
    • broadcasts the register transactions after the preorder transaction has an appropriate number of confirmations
    • broadcasts the zone file to the Atlas network after the register transaction has an appropriate number of confirmations

    Parameters

    • preorderTransaction: string

      the hex-encoded, signed preorder transaction generated using the makePreorder function

    • registerTransaction: string

      the hex-encoded, signed register transaction generated using the makeRegister function

    • zoneFile: string

      the zone file to be broadcast to the Atlas network

    Returns Promise<any>

    Returns a Promise that resolves to an object with a transaction_hash key containing the transaction hash of the broadcasted transaction.

    In the event of an error, it rejects with:

    • a RemoteServiceError if there is a problem with the transaction broadcast service
    • MissingParameterError if you call the function without a required parameter

Private broadcastServiceFetchHelper

  • broadcastServiceFetchHelper(endpoint: string, body: any): Promise<any | Error>
  • Performs a POST request to the given URL

    Parameters

    • endpoint: string

      the name of

    • body: any

    Returns Promise<any | Error>

    Returns a Promise that resolves to the object requested. In the event of an error, it rejects with:

    • a RemoteServiceError if there is a problem with the transaction broadcast service
    • MissingParameterError if you call the function without a required parameter

Private broadcastTransaction

  • broadcastTransaction(transaction: string, transactionToWatch?: string, confirmations?: number): Promise<any>
  • Broadcasts a signed bitcoin transaction to the network optionally waiting to broadcast the transaction until a second transaction has a certain number of confirmations.

    Parameters

    • transaction: string

      the hex-encoded transaction to broadcast

    • Default value transactionToWatch: string = null

      the hex transaction id of the transaction to watch for the specified number of confirmations before broadcasting the transaction

    • Default value confirmations: number = 6

      the number of confirmations transactionToWatch must have before broadcasting transaction.

    Returns Promise<any>

    Returns a Promise that resolves to an object with a transaction_hash key containing the transaction hash of the broadcasted transaction.

    In the event of an error, it rejects with:

    • a RemoteServiceError if there is a problem with the transaction broadcast service
    • MissingParameterError if you call the function without a required parameter

Private broadcastZoneFile

  • broadcastZoneFile(zoneFile?: string, transactionToWatch?: string): Promise<any>
  • Broadcasts a zone file to the Atlas network via the transaction broadcast service.

    Parameters

    • Optional zoneFile: string

      the zone file to be broadcast to the Atlas network

    • Default value transactionToWatch: string = null

      the hex transaction id of the transaction to watch for confirmation before broadcasting the zone file to the Atlas network

    Returns Promise<any>

    Returns a Promise that resolves to an object with a transaction_hash key containing the transaction hash of the broadcasted transaction.

    In the event of an error, it rejects with:

    • a RemoteServiceError if there is a problem with the transaction broadcast service
    • MissingParameterError if you call the function without a required parameter

coerceAddress

  • coerceAddress(address: string): string

countDustOutputs

  • countDustOutputs(): void

getAccountAt

  • getAccountAt(address: string, blockHeight: number): Promise<any[]>
  • Get the state(s) of an account at a particular block height. This includes the state of the account beginning with this block's transactions, as well as all of the states the account passed through when this block was processed (if any).

    Parameters

    • address: string

      the account's address

    • blockHeight: number

      the block to query

    Returns Promise<any[]>

    a promise that resolves to an Array of Objects, where each Object encodes states of the account at this block.

getAccountBalance

  • getAccountBalance(address: string, tokenType: string): Promise<BN>
  • Get the number of tokens owned by an account. If the account does not exist or has no tokens of this type, then 0 will be returned.

    Parameters

    • address: string

      the account's address

    • tokenType: string

      the type of token to query.

    Returns Promise<BN>

    a promise that resolves to a BigInteger that encodes the number of tokens held by this account.

getAccountHistoryPage

  • getAccountHistoryPage(address: string, page: number): Promise<any[]>
  • Get a page of an account's transaction history.

    Parameters

    • address: string

      the account's address

    • page: number

      the page number. Page 0 is the most recent transactions

    Returns Promise<any[]>

    a promise that resolves to an Array of Objects, where each Object encodes states of the account at various block heights (e.g. prior balances, txids, etc)

getAccountStatus

  • getAccountStatus(address: string, tokenType: string): Promise<any>
  • Get the status of an account for a particular token holding. This includes its total number of expenditures and credits, lockup times, last txid, and so on.

    Parameters

    • address: string

      the account

    • tokenType: string

      the token type to query

    Returns Promise<any>

    a promise that resolves to an object representing the state of the account for this token

getAccountTokens

  • getAccountTokens(address: string): Promise<string[]>
  • Get the set of token types that this account owns

    Parameters

    • address: string

      the account's address

    Returns Promise<string[]>

    a promise that resolves to an Array of Strings, where each item encodes the type of token this account holds (excluding the underlying blockchain's tokens)

getBlockHeight

  • getBlockHeight(): Promise<number>

getConsensusHash

  • getConsensusHash(): Promise<any>

getDefaultBurnAddress

  • getDefaultBurnAddress(): string

getFeeRate

  • getFeeRate(): Promise<number>

getGracePeriod

  • getGracePeriod(fullyQualifiedName?: string): Promise<number>
  • How many blocks can pass between a name expiring and the name being able to be re-registered by a different owner?

    Parameters

    • Optional fullyQualifiedName: string

      unused

    Returns Promise<number>

    a promise to the number of blocks

getNameInfo

  • getNameInfo(fullyQualifiedName: string): Promise<any>
  • Get WHOIS-like information for a name, including the address that owns it, the block at which it expires, and the zone file anchored to it (if available).

    Parameters

    • fullyQualifiedName: string

      the name to query. Can be on-chain of off-chain.

    Returns Promise<any>

    a promise that resolves to the WHOIS-like information

getNamePrice

  • getNamePrice(fullyQualifiedName: string): Promise<object>
  • Get the price of a name.

    Parameters

    • fullyQualifiedName: string

      the name to query

    Returns Promise<object>

    a promise to an Object with { units: String, amount: BigInteger }, where .units encodes the cryptocurrency units to pay (e.g. BTC, STACKS), and .amount encodes the number of units, in the smallest denominiated amount (e.g. if .units is BTC, .amount will be satoshis; if .units is STACKS, .amount will be microStacks)

Private getNamePriceV1

  • getNamePriceV1(fullyQualifiedName: string): Promise<object>
  • Get the price of a name via the legacy /v1/prices API endpoint.

    Parameters

    • fullyQualifiedName: string

      the name to query

    Returns Promise<object>

    a promise to an Object with { units: String, amount: BigInteger }

Private getNamePriceV2

  • getNamePriceV2(fullyQualifiedName: string): Promise<object>
  • Get the price of a name via the /v2/prices API endpoint.

    Parameters

    • fullyQualifiedName: string

      the name to query

    Returns Promise<object>

    a promise to an Object with { units: String, amount: BigInteger }

getNamesOwned

  • getNamesOwned(address: string): Promise<string[]>
  • Get the names -- both on-chain and off-chain -- owned by an address.

    Parameters

    • address: string

      the blockchain address (the hash of the owner public key)

    Returns Promise<string[]>

    a promise that resolves to a list of names (Strings)

getNamespaceBurnAddress

  • getNamespaceBurnAddress(namespace: string): Promise<string>
  • Get the blockchain address to which a name's registration fee must be sent (the address will depend on the namespace in which it is registered.)

    Parameters

    • namespace: string

      the namespace ID

    Returns Promise<string>

    a promise that resolves to an address (String)

getNamespaceInfo

  • getNamespaceInfo(namespaceID: string): Promise<any>
  • Get the pricing parameters and creation history of a namespace.

    Parameters

    • namespaceID: string

      the namespace to query

    Returns Promise<any>

    a promise that resolves to the namespace information.

getNamespacePrice

  • getNamespacePrice(namespaceID: string): Promise<object>
  • Get the price of a namespace

    Parameters

    • namespaceID: string

      the namespace to query

    Returns Promise<object>

    a promise to an Object with { units: String, amount: BigInteger }, where .units encodes the cryptocurrency units to pay (e.g. BTC, STACKS), and .amount encodes the number of units, in the smallest denominiated amount (e.g. if .units is BTC, .amount will be satoshis; if .units is STACKS, .amount will be microStacks)

Private getNamespacePriceV1

  • getNamespacePriceV1(namespaceID: string): Promise<object>
  • Get the price of a namespace via the legacy /v1/prices API endpoint.

    Parameters

    • namespaceID: string

      the namespace to query

    Returns Promise<object>

    a promise to an Object with { units: String, amount: BigInteger }

Private getNamespacePriceV2

  • getNamespacePriceV2(namespaceID: string): Promise<object>
  • Get the price of a namespace via the /v2/prices API endpoint.

    Parameters

    • namespaceID: string

      the namespace to query

    Returns Promise<object>

    a promise to an Object with { units: String, amount: BigInteger }

getNetworkedUTXOs

  • getNetworkedUTXOs(address: string): Promise<Array<UTXO>>

getTransactionInfo

  • getTransactionInfo(txHash: string): Promise<object>

getUTXOs

  • getUTXOs(address: string): Promise<Array<UTXO>>

getZonefile

  • getZonefile(zonefileHash: string): Promise<string>
  • Get a zone file, given its hash. Throws an exception if the zone file obtained does not match the hash.

    Parameters

    • zonefileHash: string

      the ripemd160(sha256) hash of the zone file

    Returns Promise<string>

    a promise that resolves to the zone file's text

Private modifyUTXOSetFrom

  • modifyUTXOSetFrom(txHex: string): void
  • This will modify the network's utxo set to include UTXOs from the given transaction and exclude UTXOs spent in that transaction

    Parameters

    • txHex: string

      the hex-encoded transaction to use

    Returns void

    no return value, this modifies the UTXO config state

resetUTXOs

  • resetUTXOs(address: string): void

Generated using TypeDoc