Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DragonchainClient

HTTP Client that interfaces with the dragonchain api

Hierarchy

  • DragonchainClient

Index

Methods

createApiKey

  • Generate a new HMAC API key

    Parameters

    • Default value options: { nickname?: undefined | string; permissionsDocument?: PermissionsDocument } = {}
      • Optional nickname?: undefined | string

        nickname for the newly created key

      • Optional permissionsDocument?: PermissionsDocument

        Permissions document to use with this key

    Returns Promise<Response<CreateAPIKeyResponse>>

createBinanceInterchain

  • createBinanceInterchain(options: { apiPort?: undefined | number; name: string; nodeURL?: undefined | string; privateKey?: undefined | string; rpcPort?: undefined | number; testnet?: undefined | false | true }): Promise<Response<BinanceInterchainNetwork>>
  • Create (or overwrite) a binance wallet/network for interchain use

    Parameters

    • options: { apiPort?: undefined | number; name: string; nodeURL?: undefined | string; privateKey?: undefined | string; rpcPort?: undefined | number; testnet?: undefined | false | true }
      • Optional apiPort?: undefined | number

        The port being used to hit the API endpoints (i.e. 1169)

      • name: string

        The name of the network to update

      • Optional nodeURL?: undefined | string

        The endpoint of the binance node to use (i.e. http://my.node.address)

      • Optional privateKey?: undefined | string

        The base64 or hex encoded private key (or mnemonic) to use. Will automatically generate a random one if not provided

      • Optional rpcPort?: undefined | number

        The port being used to hit the RPC endpoints (i.e. 27147)

      • Optional testnet?: undefined | false | true

        Whether or not this is a testnet wallet/address. Defaults to True.

    Returns Promise<Response<BinanceInterchainNetwork>>

createBitcoinInterchain

  • createBitcoinInterchain(options: { name: string; privateKey?: undefined | string; rpcAddress?: undefined | string; rpcAuthorization?: undefined | string; testnet?: undefined | false | true; utxoScan?: undefined | false | true }): Promise<Response<BitcoinInterchainNetwork>>
  • Create (or overwrite) a bitcoin wallet/network for interchain use

    Parameters

    • options: { name: string; privateKey?: undefined | string; rpcAddress?: undefined | string; rpcAuthorization?: undefined | string; testnet?: undefined | false | true; utxoScan?: undefined | false | true }
      • name: string

        The name of the network to update

      • Optional privateKey?: undefined | string

        The base64 encoded private key, or WIF for the desired wallet

      • Optional rpcAddress?: undefined | string

        The endpoint of the bitcoin core RPC node to use (i.e. http://my-node:8332)

      • Optional rpcAuthorization?: undefined | string

        The base64-encoded username:password for the rpc node. For example, user: a pass: b would be 'YTpi' (base64("a:b"))

      • Optional testnet?: undefined | false | true

        Whether or not this is a testnet wallet/address (not required if providing privateKey as WIF)

      • Optional utxoScan?: undefined | false | true

        Whether or not to force a utxo-rescan for the address. If using a new private key for an existing wallet with funds, this must be true to use its existing funds

    Returns Promise<Response<BitcoinInterchainNetwork>>

createBitcoinTransaction

  • !This method is deprecated and should not be used! Backwards compatibility will exist for legacy chains, but will not work on new chains. signBitcoinTransaction should be used instead

    Sign a transaction for a bitcoin network

    Parameters

    • options: { changeAddress?: undefined | string; data?: undefined | string; network: "BTC_MAINNET" | "BTC_TESTNET3"; outputs?: BitcoinTransactionOutputs[]; satoshisPerByte?: undefined | number }
      • Optional changeAddress?: undefined | string

        Change address to use for this transaction. If not supplied, this will be the source address

      • Optional data?: undefined | string

        String data to embed in the transaction as null-data output type

      • network: "BTC_MAINNET" | "BTC_TESTNET3"

        The bitcoin network that the transaction is for (mainnet or testnet)

      • Optional outputs?: BitcoinTransactionOutputs[]

        The desired bitcoin outputs to create for this transaction

      • Optional satoshisPerByte?: undefined | number

        The desired fee in satoshis/byte. Must be an integer

        If not supplied, an estimate will be automatically generated

    Returns Promise<Response<PublicBlockchainTransactionResponse>>

createBulkTransaction

createEthereumInterchain

  • createEthereumInterchain(options: { chainId?: undefined | number; name: string; privateKey?: undefined | string; rpcAddress?: undefined | string }): Promise<Response<EthereumInterchainNetwork>>
  • Create (or overwrite) an ethereum wallet/network for interchain use

    Parameters

    • options: { chainId?: undefined | number; name: string; privateKey?: undefined | string; rpcAddress?: undefined | string }
      • Optional chainId?: undefined | number

        The ethereum chain id to use. Will automatically derive this if providing a custom rpcAddress. This should be an integer. Without providing a custom rpcAddress, Dragonchain manages and supports: 1=ETH Mainnet|3=ETH Ropsten|61=ETC Mainnet

      • name: string

        The name of the network to update

      • Optional privateKey?: undefined | string

        The base64 or hex encoded private key to use. Will automatically generate a random one if not provided

      • Optional rpcAddress?: undefined | string

        The endpoint of the ethereum RPC node to use (i.e. http://my-node:8545)

    Returns Promise<Response<EthereumInterchainNetwork>>

createEthereumTransaction

  • createEthereumTransaction(options: { data?: undefined | string; gas?: undefined | string; gasPrice?: undefined | string; network: "ETH_MAINNET" | "ETH_ROPSTEN" | "ETC_MAINNET"; to: string; value: string }): Promise<Response<PublicBlockchainTransactionResponse>>
  • !This method is deprecated and should not be used! Backwards compatibility will exist for legacy chains, but will not work on new chains. signEthereumTransaction should be used instead

    Sign a transaction for an ethereum network

    Parameters

    • options: { data?: undefined | string; gas?: undefined | string; gasPrice?: undefined | string; network: "ETH_MAINNET" | "ETH_ROPSTEN" | "ETC_MAINNET"; to: string; value: string }
      • Optional data?: undefined | string

        The (hex-encoded) string of extra data to include with this transaction

      • Optional gas?: undefined | string

        The (hex-encoded) gas limit for this transaction. If not supplied, this will be estimated automatically

      • Optional gasPrice?: undefined | string

        The (hex-encoded) gas price in gwei to pay. If not supplied, this will be estimated automatically

      • network: "ETH_MAINNET" | "ETH_ROPSTEN" | "ETC_MAINNET"

        The ethereum network that the transaction is for (ETH/ETC mainnet or testnet)

      • to: string

        The (hex-encoded) address to send the transaction to

      • value: string

        The (hex-encoded) number of wei to send with this transaction

    Returns Promise<Response<PublicBlockchainTransactionResponse>>

createSmartContract

  • createSmartContract(options: { args?: string[]; cmd: string; cronExpression?: undefined | string; customIndexFields?: TransactionTypeCustomIndex[]; environmentVariables?: undefined | object; executionOrder?: SmartContractExecutionOrder; image: string; registryCredentials?: undefined | string; scheduleIntervalInSeconds?: undefined | number; secrets?: undefined | object; transactionType: string }): Promise<Response<SmartContractAtRest>>
  • Create a new Smart Contract on your Dragonchain

    Parameters

    • options: { args?: string[]; cmd: string; cronExpression?: undefined | string; customIndexFields?: TransactionTypeCustomIndex[]; environmentVariables?: undefined | object; executionOrder?: SmartContractExecutionOrder; image: string; registryCredentials?: undefined | string; scheduleIntervalInSeconds?: undefined | number; secrets?: undefined | object; transactionType: string }
      • Optional args?: string[]

        The list of arguments to use in conjunction with cmd

        example

        ['input', 'that', 'will', 'be', 'passed', 'in', 'as', 'args', 'to', 'cmd']

      • cmd: string

        The command to run in your docker container for your application

        example

        echo

      • Optional cronExpression?: undefined | string

        Schedule a smart contract to be automatically executed on a cadence via a cron expression

        Note: This is a mutually exclusive parameter with scheduleIntervalInSeconds

        example

        * * * * * This will invoke the contract automatically every minute, on the minute

      • Optional customIndexFields?: TransactionTypeCustomIndex[]

        The custom indexes that should be associated with the transaction type for this smart contract

      • Optional environmentVariables?: undefined | object

        JSON object key-value pairs of strings for environments variables provided to the smart contract on execution

        example
        
        { MY_CUSTOM_ENV_VAR: "my_custom_env_value" }
      • Optional executionOrder?: SmartContractExecutionOrder

        The execution of the smart contract, can be serial or parallel. Will default to parallel

        If running in serial, the contract will be queued and executed in order, only one at a time

        If running in parallel, the contract will be executed as soon as possible after invocation, potentially out of order, and many at a time

      • image: string

        Docker image to use with the smart contract. Should be in the form registry/image:tag (or just image:tag if it's a docker hub image)

        example

        quay.io/coreos/awscli:latest

        example

        alpine:3.9

      • Optional registryCredentials?: undefined | string

        The basic-auth credentials necessary to pull the docker container.

        This should be a base64-encoded string of username:password for the docker registry

        example

        ZXhhbXBsZVVzZXI6ZXhhbXBsZVBhc3N3b3JkCg==

      • Optional scheduleIntervalInSeconds?: undefined | number

        Schedule a smart contract to be automatically executed every x seconds

        For example: if 10 is supplied, then this contract will be automatically invoked and create a transaction once every 10 seconds

        This value should be a whole integer, and not a decimal

        Note: This is a mutually exclusive parameter with cronExpression

      • Optional secrets?: undefined | object

        JSON object key-value pairs of strings for secrets provided to the smart contract on execution

        These are more securely stored than environment variables, and can be accessed during execution the smart contract by using the getSmartContractSecret method of the sdk

        example
        
        { MY_SECRET: "some secret special data" }
      • transactionType: string

        Transaction type to assign to this new smart contract

        Must not already exist as a transaction type on the chain

    Returns Promise<Response<SmartContractAtRest>>

createTransaction

  • Create a new Transaction on your Dragonchain.

    This transaction, if properly structured, will be received by your dragonchain, hashed, and put into a queue for processing into a block.

    A POST request is made to the callback URL when the transaction has settled into a block on the Blockchain.

    The transaction_id returned from this function can be used for checking the status of this transaction, including the block in which it was included.

    Parameters

    • options: { callbackURL?: undefined | string; payload?: string | object; tag?: undefined | string; transactionType: string }
      • Optional callbackURL?: undefined | string

        URL to callback when this transaction is processed

      • Optional payload?: string | object

        Payload of the transaction. Must be a utf-8 encodable string, or any json object

      • Optional tag?: undefined | string

        Tag of the transaction which gets indexed and can be searched on for queries

      • transactionType: string

        The transaction type to use for this new transaction. This transaction type must already exist on the chain (via createTransactionType)

    Returns Promise<Response<DragonchainTransactionCreateResponse>>

createTransactionType

  • Create a new transaction type for ledgering transactions

    Parameters

    • options: { customIndexFields?: TransactionTypeCustomIndex[]; transactionType: string }
      • Optional customIndexFields?: TransactionTypeCustomIndex[]

        The custom indexes that should be associated with this transaction type

      • transactionType: string

        The string of the transaction type to create

        example

        cust1

    Returns Promise<Response<SimpleResponse>>

deleteApiKey

  • Delete an existing HMAC API key

    Parameters

    • options: { keyId: string }
      • keyId: string

        the key id of the key to delete

    Returns Promise<Response<DeleteAPIKeyResponse>>

deleteInterchainNetwork

  • Delete an interchain network/wallet from the chain

    Parameters

    • options: { blockchain: SupportedInterchains; name: string }
      • blockchain: SupportedInterchains

        The blockchain type to delete (i.e. 'bitcoin', 'ethereum')

      • name: string

        The name of that blockchain's network (set when creating the network)

    Returns Promise<Response<SimpleResponse>>

deleteSmartContract

  • deleteSmartContract(options: { smartContractId?: undefined | string; transactionType?: undefined | string }): Promise<Response<SimpleResponse>>
  • Deletes a deployed smart contract

    Parameters

    • options: { smartContractId?: undefined | string; transactionType?: undefined | string }
      • Optional smartContractId?: undefined | string

        The id of the smart contract to delete. Should be a guid

      • Optional transactionType?: undefined | string

        Transaction type of the smart contract, mutually exclusive with smartContractId

    Returns Promise<Response<SimpleResponse>>

deleteTransactionType

  • Deletes an existing registered transaction type

    Parameters

    • options: { transactionType: string }
      • transactionType: string

        The name of the transaction type to delete

    Returns Promise<Response<SimpleResponse>>

getApiKey

  • Get metadata about an existing HMAC API key

    Parameters

    • options: { keyId: string }
      • keyId: string

        the key id of the key to get

    Returns Promise<Response<GetAPIKeyResponse>>

getBlock

getDefaultInterchainNetwork

getInterchainNetwork

getPendingVerifications

  • Get chain ids for the pending verifications for a block. Note that this is only relevant for level 1 chains.

    Parameters

    • options: { blockId: string }
      • blockId: string

        The block ID to retrieve pending verifications for

    Returns Promise<Response<PendingVerifications>>

getPublicBlockchainAddresses

  • !This method is deprecated and should not be used! Backwards compatibility will exist for legacy chains, but will not work on new chains. listInterchainNetworks should be used instead

    Gets a list of the chain's interchain addresses

    Returns Promise<Response<PublicBlockchainAddressListResponse>>

getSmartContract

  • getSmartContract(options: { smartContractId?: undefined | string; transactionType?: undefined | string }): Promise<Response<SmartContractAtRest>>
  • Get a single smart contract by one of id or transaction type

    Parameters

    • options: { smartContractId?: undefined | string; transactionType?: undefined | string }
      • Optional smartContractId?: undefined | string

        Contract id to get, mutually exclusive with transactionType

      • Optional transactionType?: undefined | string

        Transaction id of smart contract to get, mutually exclusive with smartContractId

    Returns Promise<Response<SmartContractAtRest>>

getSmartContractLogs

  • getSmartContractLogs(options: { since?: undefined | string; smartContractId: string; tail?: undefined | number }): Promise<Response<SmartContractLogs>>
  • Get a single smart contract by one of id or transaction type

    Parameters

    • options: { since?: undefined | string; smartContractId: string; tail?: undefined | number }
      • Optional since?: undefined | string

        RFC3339 timestamp string. Returns all logs since this datetime string

      • smartContractId: string

        Contract id to get logs from

      • Optional tail?: undefined | number

        Tail, the maximum number of logs to return (unsigned integer)

    Returns Promise<Response<SmartContractLogs>>

getSmartContractObject

  • getSmartContractObject(options: { key: string; smartContractId?: undefined | string }): Promise<Response<string>>
  • Get an object from the smart contract heap. This is used for getting stateful data set by the outputs of smart contracts

    Parameters

    • options: { key: string; smartContractId?: undefined | string }
      • key: string

        Key of the object to retrieve

      • Optional smartContractId?: undefined | string

        Smart contract to get the object from

        When running from within a smart contract, this is provided via the SMART_CONTRACT_ID environment variable, and doesn't need to be explicitly provided

    Returns Promise<Response<string>>

getSmartContractSecret

  • getSmartContractSecret(options: { secretName: string }): Promise<string>
  • Reads secrets provided to a smart contract

    Note: This will only work when running within a smart contract, given that the smart contract was created/updated with secrets

    Parameters

    • options: { secretName: string }
      • secretName: string

        the name of the secret to retrieve for smart contract

    Returns Promise<string>

getStatus

getTransaction

  • Get a transaction by id

    Parameters

    • options: { transactionId: string }
      • transactionId: string

        the transaction id of the transaction to get

    Returns Promise<Response<L1DragonchainTransactionFull>>

getTransactionType

  • Gets an existing transaction type from the chain

    Parameters

    • options: { transactionType: string }
      • transactionType: string

        The name of the transaction type to get

    Returns Promise<Response<TransactionTypeResponse>>

getVerifications

  • Get verifications for a block. Note that this is only relevant for level 1 chains

    Parameters

    • options: { blockId: string; level?: undefined | number }
      • blockId: string

        The block ID to retrieve verifications for

      • Optional level?: undefined | number

        The level of verifications to retrieve (2-5). If not supplied, all levels are returned

    Returns Promise<Response<L2BlockAtRest[] | L3BlockAtRest[] | L4BlockAtRest[] | L5BlockAtRest[]> | Response<Verifications>>

listApiKeys

  • List HMAC API key IDs and their associated metadata

    Returns Promise<Response<ListAPIKeyResponse>>

listInterchainNetworks

listSmartContractObjects

  • listSmartContractObjects(options?: { prefixKey?: undefined | string; smartContractId?: undefined | string }): Promise<Response<string[]>>
  • List objects from a folder within the heap of a smart contract

    Parameters

    • Default value options: { prefixKey?: undefined | string; smartContractId?: undefined | string } = {}
      • Optional prefixKey?: undefined | string

        The folder to list from the heap. Please note this CANNOT end in a '/'

        If nothing is provided, it will list at the root of the heap

        example

        folder1

        example

        folder1/subFolder

      • Optional smartContractId?: undefined | string

        Smart contract to list the objects from

        When running from within a smart contract, this is provided via the SMART_CONTRACT_ID environment variable, and doesn't need to be explicitly provided

    Returns Promise<Response<string[]>>

listSmartContracts

  • Get all smart contracts on a chain

    Returns Promise<Response<SmartContractList>>

listTransactionTypes

publishInterchainTransaction

  • Publish an interchain transaction that's already been signed

    Parameters

    • options: { blockchain: SupportedInterchains; name: string; signedTransaction: string }
      • blockchain: SupportedInterchains

        The blockchain type to set (i.e. 'bitcoin', 'ethereum')

      • name: string

        The name of that blockchain's network to use (set when creating the network)

      • signedTransaction: string

        Signed transaction string (return from signTransaction function)

    Returns Promise<Response<PublishedInterchainTransaction>>

queryBlocks

  • Query transactions using Redisearch query-string syntax

    For more information on how to use the Redisearch query-string syntax checkout their documentation: https://oss.redislabs.com/redisearch/Query_Syntax.html

    Note that blocks have the following fields: block_id - sortable Numeric field timestamp - sortable Numeric field prev_id - sortable Numeric field

    example
    myClient.queryBlocks({redisearchQuery: '*', sortBy: 'block_id'}).then( ...do stuff )

    Parameters

    • options: { idsOnly?: undefined | false | true; limit?: undefined | number; offset?: undefined | number; redisearchQuery: string; sortAscending?: undefined | false | true; sortBy?: undefined | string }
      • Optional idsOnly?: undefined | false | true

        If true, rather than an array of block objects, it will return an array of block id strings instead

      • Optional limit?: undefined | number

        Pagination limit (default 10) Must be an integer

      • Optional offset?: undefined | number

        Pagination offset of query (default 0) Must be an integer

      • redisearchQuery: string

        Redisearch query syntax string to search with https://oss.redislabs.com/redisearch/Query_Syntax.html

        example

        word1|word2

      • Optional sortAscending?: undefined | false | true

        If sortBy is set, this sorts the results by that field in ascending order (descending if false)

      • Optional sortBy?: undefined | string

        The name of the field to sort by

    Returns Promise<Response<QueryResult<L2BlockAtRest | L3BlockAtRest | L4BlockAtRest | L5BlockAtRest | L1BlockAtRest>>>

queryTransactions

  • queryTransactions(options: { idsOnly?: undefined | false | true; limit?: undefined | number; offset?: undefined | number; redisearchQuery: string; sortAscending?: undefined | false | true; sortBy?: undefined | string; transactionType: string; verbatim?: undefined | false | true }): Promise<Response<QueryResult<L1DragonchainTransactionFull>>>
  • Query transactions using Redisearch query-string syntax

    For more information on how to use the Redisearch query-string syntax checkout their documentation: https://oss.redislabs.com/redisearch/Query_Syntax.html

    Note that transactions have the following fields: timestamp - sortable Numeric field block_id - sortable Numeric field tag - Text field

    Transaction types can also have additional custom fields if specified when creating the relevant transaction type/smart contract

    example
    myClient.queryTransactions({transactionType: 'example', redisearchQuery: 'somethingInTxnTag', sortBy: 'timestamp'}).then( ...do stuff )

    Parameters

    • options: { idsOnly?: undefined | false | true; limit?: undefined | number; offset?: undefined | number; redisearchQuery: string; sortAscending?: undefined | false | true; sortBy?: undefined | string; transactionType: string; verbatim?: undefined | false | true }
      • Optional idsOnly?: undefined | false | true

        If true, rather than an array of transaction objects, it will return an array of transaction id strings instead

      • Optional limit?: undefined | number

        Pagination limit (default 10) Must be an integer

      • Optional offset?: undefined | number

        Pagination offset of query (default 0) Must be an integer

      • redisearchQuery: string

        Redisearch query syntax string to search with https://oss.redislabs.com/redisearch/Query_Syntax.html

        example

        word1|word2

      • Optional sortAscending?: undefined | false | true

        If sortBy is set, this sorts the results by that field in ascending order (descending if false)

      • Optional sortBy?: undefined | string

        The name of the field to sort by

      • transactionType: string

        The single transaction type to query

      • Optional verbatim?: undefined | false | true

        Whether or not to use redisearch's VERBATIM (if true, no stemming occurs on the query)

    Returns Promise<Response<QueryResult<L1DragonchainTransactionFull>>>

setDefaultInterchainNetwork

signBinanceTransaction

  • Create and sign a binance transaction using your chain's interchain network

    Parameters

    • options: { amount: number; memo?: undefined | string; name: string; symbol?: undefined | string; toAddress: string }
      • amount: number

        the amount of token to send with this transaction

      • Optional memo?: undefined | string

        string of data to publish in the transaction (defaults to "")

      • name: string

        The name of the binance network to use for signing

      • Optional symbol?: undefined | string

        the exchange symbol for the token (defaults to BNB)

      • toAddress: string

        The (hex-encoded) address to send the transaction to

    Returns Promise<Response<PublicBlockchainTransactionResponse>>

signBitcoinTransaction

  • Sign a transaction for a bitcoin network on the chain

    Parameters

    • options: { changeAddress?: undefined | string; data?: undefined | string; name: string; outputs?: BitcoinTransactionOutputs[]; satoshisPerByte?: undefined | number }
      • Optional changeAddress?: undefined | string

        Change address to use for this transaction. If not supplied, this will be the source address

      • Optional data?: undefined | string

        String data to embed in the transaction as null-data output type

      • name: string

        The name of the bitcoin network to use for signing

      • Optional outputs?: BitcoinTransactionOutputs[]

        The desired bitcoin outputs to create for this transaction

      • Optional satoshisPerByte?: undefined | number

        The desired fee in satoshis/byte. Must be an integer

        If not supplied, an estimate will be automatically generated

    Returns Promise<Response<PublicBlockchainTransactionResponse>>

signEthereumTransaction

  • signEthereumTransaction(options: { data?: undefined | string; gas?: undefined | string; gasPrice?: undefined | string; name: string; nonce?: undefined | string; to: string; value: string }): Promise<Response<PublicBlockchainTransactionResponse>>
  • Create and sign an ethereum transaction using your chain's interchain network

    Parameters

    • options: { data?: undefined | string; gas?: undefined | string; gasPrice?: undefined | string; name: string; nonce?: undefined | string; to: string; value: string }
      • Optional data?: undefined | string

        The (hex-encoded) string of extra data to include with this transaction

      • Optional gas?: undefined | string

        The (hex-encoded) gas limit for this transaction. If not supplied, this will be estimated automatically

      • Optional gasPrice?: undefined | string

        The (hex-encoded) gas price in gwei to pay. If not supplied, this will be estimated automatically

      • name: string

        The name of the ethereum network to use for signing

      • Optional nonce?: undefined | string

        The (hex-encoded) nonce for this transaction. If not supplied, it will be fetched automatically

      • to: string

        The (hex-encoded) address to send the transaction to

      • value: string

        The (hex-encoded) number of wei to send with this transaction

    Returns Promise<Response<PublicBlockchainTransactionResponse>>

updateApiKey

  • Update nickname of existing HMAC API key

    Parameters

    • options: { keyId: string; nickname?: undefined | string; permissionsDocument?: PermissionsDocument }
      • keyId: string

        Key ID to modify

      • Optional nickname?: undefined | string

        New nickname to set for key

      • Optional permissionsDocument?: PermissionsDocument

        New permissions document to assign to this key

    Returns Promise<Response<GetAPIKeyResponse>>

updateBinanceInterchain

  • updateBinanceInterchain(options: { apiPort?: undefined | number; name: string; nodeURL?: undefined | string; privateKey?: undefined | string; rpcPort?: undefined | number; testnet?: undefined | false | true }): Promise<Response<BinanceInterchainNetwork>>
  • Update an existing binance wallet/network for interchain use

    Parameters

    • options: { apiPort?: undefined | number; name: string; nodeURL?: undefined | string; privateKey?: undefined | string; rpcPort?: undefined | number; testnet?: undefined | false | true }
      • Optional apiPort?: undefined | number

        The port being used to hit the API endpoints (i.e. 1169)

      • name: string

        The name of the network to update

      • Optional nodeURL?: undefined | string

        The endpoint of the binance node to use (i.e. http://my.node.address)

      • Optional privateKey?: undefined | string

        The base64 or hex encoded private key to use. Will automatically generate a random one if not provided

      • Optional rpcPort?: undefined | number

        The port being used to hit the RPC endpoints (i.e. 27147)

      • Optional testnet?: undefined | false | true

        Whether or not this is a testnet wallet/address. Defaults to True.

    Returns Promise<Response<BinanceInterchainNetwork>>

updateBitcoinInterchain

  • updateBitcoinInterchain(options: { name: string; privateKey?: undefined | string; rpcAddress?: undefined | string; rpcAuthorization?: undefined | string; testnet?: undefined | false | true; utxoScan?: undefined | false | true }): Promise<Response<BitcoinInterchainNetwork>>
  • Update an existing bitcoin wallet/network for interchain use. Will only update the provided fields

    Parameters

    • options: { name: string; privateKey?: undefined | string; rpcAddress?: undefined | string; rpcAuthorization?: undefined | string; testnet?: undefined | false | true; utxoScan?: undefined | false | true }
      • name: string

        The name of the network to update

      • Optional privateKey?: undefined | string

        The base64 encoded private key, or WIF for the desired wallet

      • Optional rpcAddress?: undefined | string

        The endpoint of the bitcoin core RPC node to use (i.e. http://my-node:8332)

      • Optional rpcAuthorization?: undefined | string

        The base64-encoded username:password for the rpc node. For example, user: a pass: b would be 'YTpi' (base64("a:b"))

      • Optional testnet?: undefined | false | true

        Whether or not this is a testnet wallet/address (not required if providing privateKey as WIF)

      • Optional utxoScan?: undefined | false | true

        Whether or not to force a utxo-rescan for the address. If using a new private key for an existing wallet with funds, this must be true to use its existing funds

    Returns Promise<Response<BitcoinInterchainNetwork>>

updateEthereumInterchain

  • updateEthereumInterchain(options: { chainId?: undefined | number; name: string; privateKey?: undefined | string; rpcAddress?: undefined | string }): Promise<Response<EthereumInterchainNetwork>>
  • Update an existing ethereum wallet/network for interchain use

    Parameters

    • options: { chainId?: undefined | number; name: string; privateKey?: undefined | string; rpcAddress?: undefined | string }
      • Optional chainId?: undefined | number

        The ethereum chain id to use. Will automatically derive this if providing a custom rpcAddress. This should be an integer. Without providing a custom rpcAddress, Dragonchain manages and supports: 1=ETH Mainnet|3=ETH Ropsten|61=ETC Mainnet

      • name: string

        The name of the network to update

      • Optional privateKey?: undefined | string

        The base64 or hex encoded private key to use. Will automatically generate a random one if not provided

      • Optional rpcAddress?: undefined | string

        The endpoint of the ethereum RPC node to use (i.e. http://my-node:8545)

    Returns Promise<Response<EthereumInterchainNetwork>>

updateSmartContract

  • updateSmartContract(options: { args?: string[]; cmd?: undefined | string; cronExpression?: undefined | string; disableSchedule?: undefined | false | true; enabled?: undefined | false | true; environmentVariables?: undefined | object; executionOrder?: SmartContractExecutionOrder; image?: undefined | string; registryCredentials?: undefined | string; scheduleIntervalInSeconds?: undefined | number; secrets?: undefined | object; smartContractId: string }): Promise<Response<SmartContractAtRest>>
  • Update an existing Smart Contract on your Dragonchain

    Note that all parameters (aside from contract id) are optional, and only supplied parameters will be updated

    Parameters

    • options: { args?: string[]; cmd?: undefined | string; cronExpression?: undefined | string; disableSchedule?: undefined | false | true; enabled?: undefined | false | true; environmentVariables?: undefined | object; executionOrder?: SmartContractExecutionOrder; image?: undefined | string; registryCredentials?: undefined | string; scheduleIntervalInSeconds?: undefined | number; secrets?: undefined | object; smartContractId: string }
      • Optional args?: string[]

        The list of arguments to use in conjunction with cmd

        example

        ['input', 'that', 'will', 'be', 'passed', 'in', 'as', 'args', 'to', 'cmd']

      • Optional cmd?: undefined | string

        The command to run in your docker container for your application

        example

        echo

      • Optional cronExpression?: undefined | string

        Schedule a smart contract to be automatically executed on a cadence via a cron expression

        Note: This is a mutually exclusive parameter with scheduleIntervalInSeconds

        example

        * * * * * This will invoke the contract automatically every minute, on the minute

      • Optional disableSchedule?: undefined | false | true

        Set true to remove the existing scheduleIntervalInSeconds or cronExpression from the contract

      • Optional enabled?: undefined | false | true

        Boolean whether or not the contract should be enabled, and able to be invoked

      • Optional environmentVariables?: undefined | object

        JSON object key-value pairs of strings for environments variables provided to the smart contract on execution

        example
        
        { MY_CUSTOM_ENV_VAR: "my_custom_env_value" }
      • Optional executionOrder?: SmartContractExecutionOrder

        The execution of the smart contract, can be serial or parallel. Will default to parallel

        If running in serial, the contract will be queued and executed in order, only one at a time

        If running in parallel, the contract will be executed as soon as possible after invocation, potentially out of order, and many at a time

      • Optional image?: undefined | string

        Docker image to use with the smart contract. Should be in the form registry/image:tag (or just image:tag if it's a docker hub image)

        example

        quay.io/coreos/awscli:latest

        example

        alpine:3.9

      • Optional registryCredentials?: undefined | string

        The basic-auth credentials necessary to pull the docker container.

        This should be a base64-encoded string of username:password for the docker registry

        example

        ZXhhbXBsZVVzZXI6ZXhhbXBsZVBhc3N3b3JkCg==

      • Optional scheduleIntervalInSeconds?: undefined | number

        Schedule a smart contract to be automatically executed every x seconds

        For example, if 10 is supplied, then this contract will be automatically invoked and create a transaction once every 10 seconds

        This value should be a whole integer, and not a decimal

        Note: This is a mutually exclusive parameter with cronExpression

      • Optional secrets?: undefined | object

        JSON object key-value pairs of strings for secrets provided to the smart contract on execution

        These are more securely stored than environment variables, and can be accessed during execution the smart contract by using the getSmartContractSecret method of the sdk

        example
        
        { MY_SECRET: "some secret special data" }
      • smartContractId: string

        Smart contract id of which to update. Should be a guid

    Returns Promise<Response<SmartContractAtRest>>