Options
All
  • Public
  • Public/Protected
  • All
Menu

@stacks/cli

Command line interface to interact with auth, storage and Stacks transactions.

Installation

npm install @stacks/cli

Usage

See documentation

Index

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

AppKeyInfoType

AppKeyInfoType: { keyInfo: { address: string; privateKey: string }; legacyKeyInfo: { address: string; privateKey: string }; ownerKeyIndex: number }

Type declaration

  • keyInfo: { address: string; privateKey: string }
    • address: string
    • privateKey: string
  • legacyKeyInfo: { address: string; privateKey: string }
    • address: string
    • privateKey: string
  • ownerKeyIndex: number

NameInfoType

NameInfoType: { address: string; blockchain?: string; did?: string; expire_block?: number; grace_period?: number; last_txid?: string; renewal_deadline?: number; resolver?: string | null; status?: string; zonefile?: string | null; zonefile_hash?: string | null }

Type declaration

  • address: string
  • Optional blockchain?: string
  • Optional did?: string
  • Optional expire_block?: number
  • Optional grace_period?: number
  • Optional last_txid?: string
  • Optional renewal_deadline?: number
  • Optional resolver?: string | null
  • Optional status?: string
  • Optional zonefile?: string | null
  • Optional zonefile_hash?: string | null

OwnerKeyInfoType

OwnerKeyInfoType: { idAddress: string; index: number; privateKey: string; version: string }

Type declaration

  • idAddress: string
  • index: number
  • privateKey: string
  • version: string

PaymentKeyInfoType

PaymentKeyInfoType: { address: { BTC: string; STACKS: string }; index: number; privateKey: string }

Type declaration

  • address: { BTC: string; STACKS: string }
    • BTC: string
    • STACKS: string
  • index: number
  • privateKey: string

StacksKeyInfoType

StacksKeyInfoType: { address: string; btcAddress: string; index: number; privateKey: string; wif: string }

Type declaration

  • address: string
  • btcAddress: string
  • index: number
  • privateKey: string
  • wif: string

Variables

Const ADDRESS_CHARS

ADDRESS_CHARS: "[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{1,35}" = '[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{1,35}'

Const ADDRESS_PATTERN

ADDRESS_PATTERN: string = ...

Const BOOLEAN_PATTERN

BOOLEAN_PATTERN: "^(0|1|true|false)$" = '^(0|1|true|false)$'

Const C32_ADDRESS_CHARS

C32_ADDRESS_CHARS: "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]+" = '[0123456789ABCDEFGHJKMNPQRSTVWXYZ]+'

Const CLI_ARGS

CLI_ARGS: { additionalProperties: boolean; properties: CLI_PROP; strict: boolean; type: string } = ...

Type declaration

  • additionalProperties: boolean
  • properties: CLI_PROP
  • strict: boolean
  • type: string

Const DEFAULT_CONFIG_PATH

DEFAULT_CONFIG_PATH: "~/.blockstack-cli.conf" = '~/.blockstack-cli.conf'

Const DEFAULT_CONFIG_REGTEST_PATH

DEFAULT_CONFIG_REGTEST_PATH: "~/.blockstack-cli-regtest.conf" = '~/.blockstack-cli-regtest.conf'

Const DEFAULT_CONFIG_TESTNET_PATH

DEFAULT_CONFIG_TESTNET_PATH: "~/.blockstack-cli-testnet.conf" = '~/.blockstack-cli-testnet.conf'

Const DEFAULT_MAX_ID_SEARCH_INDEX

DEFAULT_MAX_ID_SEARCH_INDEX: 256 = 256

Const DERIVATION_PATH

DERIVATION_PATH: "m/44'/5757'/0'/0/0" = "m/44'/5757'/0'/0/0"

Const ID_ADDRESS_PATTERN

ID_ADDRESS_PATTERN: string = ...

Const INT_PATTERN

INT_PATTERN: "^-?[0-9]+$" = '^-?[0-9]+$'

Const NAMESPACE_PATTERN

NAMESPACE_PATTERN: "^([0-9a-z_-]{1,19})$" = '^([0-9a-z_-]{1,19})$'

Const NAME_PATTERN

NAME_PATTERN: "^([0-9a-z_.+-]{3,37})$" = '^([0-9a-z_.+-]{3,37})$'

Const PRIVATE_KEY_MULTISIG_PATTERN

PRIVATE_KEY_MULTISIG_PATTERN: "^([0-9]+),([0-9a-f]{64,66},)*([0-9a-f]{64,66})$" = '^([0-9]+),([0-9a-f]{64,66},)*([0-9a-f]{64,66})$'

Const PRIVATE_KEY_NOSIGN_PATTERN

PRIVATE_KEY_NOSIGN_PATTERN: string = ...

Const PRIVATE_KEY_PATTERN

PRIVATE_KEY_PATTERN: "^([0-9a-f]{64,66})$" = '^([0-9a-f]{64,66})$'

Const PRIVATE_KEY_PATTERN_ANY

PRIVATE_KEY_PATTERN_ANY: string = ...

Const PRIVATE_KEY_SEGWIT_P2SH_PATTERN

PRIVATE_KEY_SEGWIT_P2SH_PATTERN: "^segwit:p2sh:([0-9]+),([0-9a-f]{64,66},)*([0-9a-f]{64,66})$" = '^segwit:p2sh:([0-9]+),([0-9a-f]{64,66},)*([0-9a-f]{64,66})$'

Const PRIVATE_KEY_UNCOMPRESSED_PATTERN

PRIVATE_KEY_UNCOMPRESSED_PATTERN: "^([0-9a-f]{64})$" = '^([0-9a-f]{64})$'

Const PUBLIC_KEY_PATTERN

PUBLIC_KEY_PATTERN: "^([0-9a-f]{66,130})$" = '^([0-9a-f]{66,130})$'

Const SIGNIN_CSS

SIGNIN_CSS: "\nh1 { \n font-family: monospace; \n font-size: 24px; \n font-style: normal; \n font-variant: normal; \n font-weight: 700; \n line-height: 26.4px; \n} \nh3 { \n font-family: monospace; \n font-size: 14px; \n font-style: normal; \n font-variant: normal; \n font-weight: 700; \n line-height: 15.4px; \n}\np { \n font-family: monospace; \n font-size: 14px; \n font-style: normal; \n font-variant: normal; \n font-weight: 400; \n line-height: 20px; \n}\nb {\n background-color: #e8e8e8;\n}\npre { \n font-family: monospace; \n font-size: 13px; \n font-style: normal; \n font-variant: normal; \n font-weight: 400; \n line-height: 18.5714px;\n}" = ...

Const SIGNIN_DESC

SIGNIN_DESC: "<p>Sign-in request for <b>\"{appName}\"</b></p>" = '<p>Sign-in request for <b>"{appName}"</b></p>'

Const SIGNIN_FMT_ID

SIGNIN_FMT_ID: "<p><a href=\"{authRedirect}\">{idAddress}</a> (anonymous)</p>" = '<p><a href="{authRedirect}">{idAddress}</a> (anonymous)</p>'

Const SIGNIN_FMT_NAME

SIGNIN_FMT_NAME: "<p><a href=\"{authRedirect}\">{blockstackID}</a> ({idAddress})</p>" = '<p><a href="{authRedirect}">{blockstackID}</a> ({idAddress})</p>'

Const SIGNIN_FOOTER

SIGNIN_FOOTER: "</body></html>" = '</body></html>'

Const SIGNIN_HEADER

SIGNIN_HEADER: string = ...

Const SIGNIN_SCOPES

SIGNIN_SCOPES: "<p>Requested scopes: <b>\"{appScopes}\"</b></p>" = '<p>Requested scopes: <b>"{appScopes}"</b></p>'

Const STACKS_ADDRESS_PATTERN

STACKS_ADDRESS_PATTERN: string = ...

Const STRENGTH

STRENGTH: 128 = 128

Const STX_WALLET_COMPATIBLE_SEED_STRENGTH

STX_WALLET_COMPATIBLE_SEED_STRENGTH: 256 = 256

Const SUBDOMAIN_PATTERN

SUBDOMAIN_PATTERN: "^([0-9a-z_+-]{1,37}).([0-9a-z_.+-]{3,37})$" = '^([0-9a-z_+-]{1,37}).([0-9a-z_.+-]{3,37})$'

Const TXID_PATTERN

TXID_PATTERN: "^([0-9a-f]{64})$" = '^([0-9a-f]{64})$'

Const URL_PATTERN

URL_PATTERN: "^http[s]?://.+$" = '^http[s]?://.+$'

Const USAGE

USAGE: string = ...

Const ZONEFILE_HASH_PATTERN

ZONEFILE_HASH_PATTERN: "^([0-9a-f]{40})$" = '^([0-9a-f]{40})$'

Const testables

testables: undefined | { addressConvert: (network: CLINetworkAdapter, args: string[]) => Promise<string> } = ...

Functions

CLIMain

  • CLIMain(): void

CLIOptAsBool

  • CLIOptAsBool(opts: CLI_OPTS, key: string): boolean

CLIOptAsString

  • CLIOptAsString(opts: CLI_OPTS, key: string): string | null

CLIOptAsStringArray

  • CLIOptAsStringArray(opts: CLI_OPTS, key: string): string[] | null

JSONStringify

  • JSONStringify(obj: AnyJson, stderr?: boolean): string

answerToClarityValue

argToPrompt

broadcastTransactionAndZoneFile

  • broadcastTransactionAndZoneFile(network: CLINetworkAdapter, tx: string, zonefile?: string): Promise<{ error: string; status: boolean; txid: string } | { error: undefined; status: boolean; txid: string } | { error: string; message: any; stacktrace: any; status: boolean }>
  • Parameters

    Returns Promise<{ error: string; status: boolean; txid: string } | { error: undefined; status: boolean; txid: string } | { error: string; message: any; stacktrace: any; status: boolean }>

canonicalPrivateKey

  • canonicalPrivateKey(privkey: string): string

checkArgs

checkUrl

  • checkUrl(url: string): string

decodePrivateKey

  • decodePrivateKey(serializedPrivateKey: string): string | CLITransactionSigner

decryptBackupPhrase

  • decryptBackupPhrase(dataBuffer: string | Buffer, password: string): Promise<string>

encryptBackupPhrase

  • encryptBackupPhrase(plaintextBuffer: string, password: string): Promise<Buffer>

extractAppKey

  • extractAppKey(network: CLINetworkAdapter, appKeyInfo: { keyInfo: { address: string; privateKey: string }; legacyKeyInfo: { address: string; privateKey: string } }, appAddress?: string): string
  • Parameters

    • network: CLINetworkAdapter
    • appKeyInfo: { keyInfo: { address: string; privateKey: string }; legacyKeyInfo: { address: string; privateKey: string } }
      • keyInfo: { address: string; privateKey: string }
        • address: string
        • privateKey: string
      • legacyKeyInfo: { address: string; privateKey: string }
        • address: string
        • privateKey: string
    • Optional appAddress: string

    Returns string

findIdentityIndex

  • findIdentityIndex(network: CLINetworkAdapter, mnemonic: string, idAddress: string, maxIndex?: number): Promise<number>

gaiaAuth

  • gaiaAuth(network: CLINetworkAdapter, appPrivateKey: string | null, hubUrl: string | null, ownerPrivateKey?: string): Promise<UserData>

gaiaConnect

  • gaiaConnect(network: CLINetworkAdapter, gaiaHubUrl: string, privateKey: string, ownerPrivateKey?: string): Promise<GaiaHubConfig>

gaiaUploadProfile

  • gaiaUploadProfile(network: CLINetworkAdapter, gaiaHubURL: string, gaiaData: string, privateKey: string, blockstackID?: string): Promise<string>

gaiaUploadProfileAll

  • gaiaUploadProfileAll(network: CLINetworkAdapter, gaiaUrls: string[], gaiaData: string, privateKey: string, blockstackID?: string): Promise<{ dataUrls?: string[] | null; error?: string | null }>
  • Parameters

    • network: CLINetworkAdapter
    • gaiaUrls: string[]
    • gaiaData: string
    • privateKey: string
    • Optional blockstackID: string

    Returns Promise<{ dataUrls?: string[] | null; error?: string | null }>

generateExplorerTxPageUrl

  • generateExplorerTxPageUrl(txid: string, network: StacksNetwork): string

getApplicationKeyInfo

getBackupPhrase

  • getBackupPhrase(backupPhraseOrCiphertext: string, password?: string): Promise<string>

getCLIOpts

  • getCLIOpts(argv: string[], opts?: string): CLI_OPTS

getCommandArgs

  • getCommandArgs(command: string, argsList: string[]): { arguments: undefined; error: string; status: boolean } | { arguments: string[]; error: undefined; status: boolean }
  • Parameters

    • command: string
    • argsList: string[]

    Returns { arguments: undefined; error: string; status: boolean } | { arguments: string[]; error: undefined; status: boolean }

getGaiaAddressFromProfile

  • getGaiaAddressFromProfile(network: CLINetworkAdapter, profile: any, appOrigin: string): string

getGaiaAddressFromURL

  • getGaiaAddressFromURL(appUrl: string): string

getIDAddress

getIDAppKeys

  • getIDAppKeys(network: CLINetworkAdapter, nameOrIDAddress: string, appOrigin: string, mnemonicOrCiphertext: string): Promise<IDAppKeys>

getMaxIDSearchIndex

  • getMaxIDSearchIndex(): number

getNameInfoEasy

getNetwork

  • getNetwork(configData: CLI_CONFIG_TYPE, regTest: boolean): BlockstackNetwork

getOwnerKeyFromIDAddress

  • getOwnerKeyFromIDAddress(network: CLINetworkAdapter, mnemonic: string, idAddress: string): Promise<string>

getOwnerKeyInfo

getPaymentKeyInfo

getPrivateKeyAddress

  • getPrivateKeyAddress(network: CLINetworkAdapter, privateKey: string | CLITransactionSigner): string

getPublicKeyFromPrivateKey

  • getPublicKeyFromPrivateKey(privateKey: string): string

getStacksWalletKeyInfo

getpass

  • getpass(promptStr: string, cb: (passwd: string) => void): void
  • Parameters

    • promptStr: string
    • cb: (passwd: string) => void
        • (passwd: string): void
        • Parameters

          • passwd: string

          Returns void

    Returns void

handleAuth

  • handleAuth(network: CLINetworkAdapter, mnemonic: string, gaiaHubUrl: string, profileGaiaHub: string, port: number, req: express.Request, res: express.Response): Promise<any>

handleSignIn

  • handleSignIn(network: CLINetworkAdapter, mnemonic: string, appGaiaHub: string, profileGaiaHub: string, req: express.Request, res: express.Response): Promise<any>

hasKeys

  • hasKeys(signer: string | CLITransactionSigner): boolean

hash160

  • hash160(buff: Buffer): Buffer

isSubdomain

  • isSubdomain(name: string): boolean

isTestnetAddress

  • isTestnetAddress(address: string): boolean

loadConfig

  • Load the config file and return a config dict. If no config file exists, then return the default config.

    configpath

    (string) the path to the config file.

    networktype

    (sring) 'mainnet', 'regtest', or 'testnet'

    Parameters

    • configFile: string
    • networkType: string

    Returns CLI_CONFIG_TYPE

loadNamedIdentities

makeAllCommandsHelp

  • makeAllCommandsHelp(): string

makeAllCommandsList

  • makeAllCommandsList(): string

makeAssociationToken

  • makeAssociationToken(appPrivateKey: string, identityKey: string): string

makeCommandUsageString

  • makeCommandUsageString(command?: string): string

makeDIDConfiguration

  • makeDIDConfiguration(network: CLINetworkAdapter, blockstackID: string, domain: string, privateKey: string): Promise<{ entries: { did: string; jwt: string }[] }>

makeProfileJWT

  • makeProfileJWT(profileData: Object, privateKey: string): string

makePromptsFromArgList

makeUsageString

  • makeUsageString(): string

makeZoneFileFromGaiaUrl

  • makeZoneFileFromGaiaUrl(network: CLINetworkAdapter, name: string, gaiaHubUrl: string, ownerKey: string): Promise<any>

mkdirs

  • mkdirs(path: string): void

nameLookup

  • nameLookup(network: CLINetworkAdapter, name: string, includeProfile?: boolean): Promise<{ profile: any; profileUrl?: string; zonefile?: string }>

parseClarityFunctionArgAnswers

  • parseClarityFunctionArgAnswers(answers: any, expectedArgs: ClarityFunctionArg[]): ClarityValue[]

parseMultiSigKeys

parseNullSigner

parseSegwitP2SHKeys

printUsage

  • printUsage(): void

sumUTXOs

  • sumUTXOs(utxos: UTXO[]): number

Generated using TypeDoc