Options
All
  • Public
  • Public/Protected
  • All
Menu

waves-transactions

Index

Type aliases

CancellablePromise

CancellablePromise: Promise<T> & object

DataType

DataType: "integer" | "boolean" | "string" | "binary"

Option

Option: T | undefined | null

SeedTypes

SeedTypes: string | Option<string>[] | SeedsAndIndexes

Tx

long

long: number | string

Functions

alias

  • Creates and signs AliasTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed AliasTransaction as a second argument.

    Usage

    const { alias } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      alias: 'MyNewAlias',
      //timestamp: Date.now(),
      //fee: 100000,
      //chainId: 'W',
    }
    
    const signedAliasTx = alias(params, seed)

    Output

    {
      "id": "DWhcVAbj6By4HRtEceuMLRp4TUXZ1rg3TvJgZPadJnK1",
      "type": 10,
      "version": 2,
      "fee": 100000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926756,
      "proofs": [
        "5hFwgio5eVWZLVzEsdmr62QtJvTJKAkEofvcnyviAAmBMDNrzX5ZuPpXgyMDrA5drMtUYbFmbUYVzWCZNuxowUMC"
      ],
      "alias": "MyNewAlias"
    }

    Parameters

    Returns AliasTransaction

Const aliasToBytes

  • Parameters

    Returns Uint8Array

Const aliasValidation

  • Parameters

    Returns ValidationResult

Const broadcast

  • broadcast(tx: Tx, apiBase: string): Promise<any>
  • Parameters

    • tx: Tx
    • apiBase: string

    Returns Promise<any>

burn

  • Creates and signs BurnTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed BurnTransaction as a second argument.

    Usage

    const { burn } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      assetId: '4uK8i4ThRGbehENwa6MxyLtxAjAo1Rj9fduborGExarC',
      quantity: 100,
      //timestamp: Date.now(),
      //fee: 100000,
      //chainId: 'W',
    }
    
    const signedBurnTx = burn(params, seed)

    Output

    {
      "id": "548rzUHdDQwq5EfCe43Mp45QvBFwPwqMhxH25q85UWet",
      "type": 6,
      "version": 2,
      "chainId": "W",
      "fee": 100000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926582,
      "proofs": [
        "3Z8sH3Hfmye21kvL7cc4oCUZLPqdsREsDeBHNYwavmgd4wL5iQy4SEbMW9Nnak8C6QDWtjePi2g3NuxgGTfZ8Awh"
      ],
      "assetId": "4uK8i4ThRGbehENwa6MxyLtxAjAo1Rj9fduborGExarC",
      "quantity": 100
    }

    Parameters

    Returns BurnTransaction

Const burnToBytes

  • Parameters

    Returns Uint8Array

Const burnValidation

  • Parameters

    Returns ValidationResult

cancelLease

  • Creates and signs CancelLeaseTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed CancelLeaseTransaction as a second argument.

    Usage

    const { cancelLease } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      leaseId: '2fYhSNrXpyKgbtHzh5tnpvnQYuL7JpBFMBthPSGFrqqg',
      //timestamp: Date.now(),
      //fee: 100000,
      //chainId: 'W'
    }
    
    const signedCancelLeaseTx = cancelLease(params, seed)

    Output

    {
      "id": "2LBjRAviJu8B9Kjdw5D582AsLcZJu6UPsuAGCJ3QYJgw",
      "type": 9,
      "version": 2,
      "fee": 100000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926616,
      "chainId": "W",
      "proofs": [
        "3j64VHFfM3F3gL97mxmDzhX8HHcbHS8vZEuzY96vGoRURPkgaqT1AZyUD9ToWZ4HdVCi15tS7nrAcDiA4zUamj1N"
      ],
      "leaseId": "2fYhSNrXpyKgbtHzh5tnpvnQYuL7JpBFMBthPSGFrqqg"
    }

    Parameters

    Returns CancelLeaseTransaction

Const cancelLeaseToBytes

Const cancelLeaseValidation

data

  • Creates and signs DataTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed DataTransaction as a second argument.

    Usage

    const { data } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      data: [
        { key: 'integerVal', value: 1 },
        { key: 'booleanVal', value: true },
        { key: 'stringVal', value: 'hello' },
        { key: 'binaryVal', value: [1, 2, 3, 4] },
      ],
      //timestamp: Date.now(),
      //fee: 100000 + bytes.length * 100000
    }
    
    const signedDataTx = data(params, seed)

    Output

    {
      "id": "9ysRcXjwpHq46PUSamfWMnq2nUWoFS9rAnDgs4ynqRvU",
      "type": 12,
      "version": 1,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "fee": 100000,
      "timestamp": 1542716926639,
      "proofs": [
        "MbAgcTmniTasof8SuogFComQZB4fGV9UTbbKV1rTwgakb8xiDTmk47dkCKX8Y5xXAK848rSL4jJjarMLFiyifoy"
      ],
      "data": [
        {
          "type": "integer",
          "key": "integerVal",
          "value": 1
        },
        {
          "type": "boolean",
          "key": "booleanVal",
          "value": true
        },
        {
          "type": "string",
          "key": "stringVal",
          "value": "hello"
        },
        {
          "type": "binary",
          "key": "binaryVal",
          "value": "base64:AQIDBA=="
        }
      ]
    }

    Parameters

    Returns DataTransaction

Const dataToBytes

  • Parameters

    Returns Uint8Array

Const dataValidation

  • Parameters

    Returns ValidationResult

Const delay

generalValidation

  • generalValidation(params: Params, validate: ValidateFunction): ValidationResult
  • Parameters

    • params: Params
    • validate: ValidateFunction

    Returns ValidationResult

Const isOrder

  • isOrder(p: any): boolean
  • Parameters

    • p: any

    Returns boolean

issue

  • Creates and signs IssueTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed IssueTransaction as a second argument.

    Usage

    const { issue } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      name: 'SCAM TOKEN',
      description: 'Awesome token that will tokenize tokenization tokenized',
      quantity: 1000000,
      //reissuable: false
      //decimals: 8
      //timestamp: Date.now(),
      //fee: 100000000,
      //chainId: 'W'
    }
    
    const signedIssueTx = issue(params, seed)

    Output

    {
      "id": "DfUFknABSQxug8KybQGfVhctjGQduzzSyygZHK2Wz6E7",
      "type": 3,
      "version": 2,
      "decimals": 8,
      "reissuable": false,
      "fee": 100000000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926677,
      "chainId": "W",
      "proofs": [
        "65QRNNAaKVp9F6Nb9AijmGtfv9pN4zTb9QCF9jYenEVUyLs9dihktfUPVH6deU7BiW9cypbVytDwkT6vJSooYPw4"
      ],
      "name": "SCAM TOKEN",
      "description": "Awesome token that will tokenize tokenization tokenized",
      "quantity": 1000000
    }

    Parameters

    Returns IssueTransaction

Const issueToBytes

  • Parameters

    Returns Uint8Array

Const issueValidation

  • Parameters

    Returns ValidationResult

lease

  • Creates and signs LeaseTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed LeaseTransaction as a second argument.

    Usage

    const { lease } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      amount: 100,
      recipient: '3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs',
      //timestamp: Date.now(),
      //fee: 100000,
    }
    
    const signedLeaseTx = lease(params, seed)

    Output

    {
      "id": "DZqFQ6dRK4BDzMita1tQKa1q6PT3usPTmFwViMkdyi4Y",
      "type": 8,
      "version": 2,
      "fee": 100000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926694,
      "proofs": [
        "5sV8pS6ZJiRgP8miARCAiSASSm2tmoUUjwfJTYUryCkGhHHmSbyFJhEMd24RPJfCGsMSaJSVwhZkcXUL3XoMoARb"
      ],
      "amount": 100,
      "recipient": "3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs"
    }

    Parameters

    Returns LeaseTransaction

Const leaseToBytes

  • Parameters

    Returns Uint8Array

Const leaseValidation

  • Parameters

    Returns ValidationResult

massTransfer

  • Creates and signs MassTransferTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed MassTransferTransaction as a second argument.

    Usage

    const { massTransfer } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      transfers: [
        {
          amount: 100,
          recipient: '3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs',
        },
        {
          amount: 200,
          recipient: '3PPnqZznWJbPG2Z1Y35w8tZzskiq5AMfUXr',
        },
      ],
      //timestamp: Date.now(),
      //fee: 100000 + transfers.length * 50000,
    }
    
    const signedMassTransferTx = massTransfer(params, seed)

    Output

    {
      "id": "35uNumuZsWNcXRSemRDzTTaeYyhQL9CVPCkNL4hJcqAU",
      "type": 11,
      "version": 1,
      "fee": 200000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926707,
      "proofs": [
        "5HRHX7fEh8dWcHiN8oXRGrhvZ69NdqS5LByFGoSD5TfU31mAB931fqVaKqL7jmTvZEf6aYMPLELsmUnKNVMwMr1X"
      ],
      "transfers": [
        {
          "amount": 100,
          "recipient": "3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs"
        },
        {
          "amount": 200,
          "recipient": "3PPnqZznWJbPG2Z1Y35w8tZzskiq5AMfUXr"
        }
      ]
    }

    Parameters

    Returns MassTransferTransaction

Const massTransferToBytes

Const massTransferValidation

order

  • Creates and signs Order.

    You can use this function with multiple seeds. In this case it will sign order accordingly and will add one proof per seed. Also you can use already signed Order as a second agrument.

    Usage

    const { order } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      amount: 100000000, //1 waves
      price: 10, //for 0.00000010 BTC
      priceAsset: '8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS',
      matcherPublicKey: '7kPFrHDiGw1rCm7LPszuECwWYL3dMf6iMifLRDJQZMzy',
      orderType: 'buy'
    }
    
    
    const signedOrder = order(params, seed)

    Output

    {
      "id": "47YGqHdHtNPjcjE69E9EX9aD9bpC8PRKr4kp5AcZKHFq",
      "orderType": "buy",
      "assetPair": {
        "priceAsset": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
      },
      "price": 10,
      "amount": 100000000,
      "timestamp": 1540898977249,
      "expiration": 1542626977249,
      "matcherFee": 300000,
      "matcherPublicKey": "7kPFrHDiGw1rCm7LPszuECwWYL3dMf6iMifLRDJQZMzy",
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "proofs": [
        "4MbaDLkx9ezV1DrcGRfXRfnMBtYLaeLYBe6YGqkkuq1Pe6U9Qc5Cv7Fy1zYyGatbg47U5j374iAQFbLLZiYBChgU"
      ]
    }

    Parameters

    Returns Order

Const orderToBytes

  • orderToBytes(ord: Order): Uint8Array
  • Parameters

    Returns Uint8Array

Const orderValidation

  • orderValidation(ord: Order): ValidationResult
  • Parameters

    Returns ValidationResult

raiseValidationErrors

  • raiseValidationErrors(...result: ValidationResult[]): void
  • Parameters

    • Rest ...result: ValidationResult[]

    Returns void

reissue

  • Creates and signs ReissueTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed ReissueTransaction as a second argument.

    Usage

    const { reissue } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      quantity: 10000,
      assetId: '3toqCSpAHShatE75UFKxqymuWFr8nxuxD7UcLjdxVFLx',
      reissuable: false,
      //timestamp: Date.now(),
      //fee: 100000000,
      //chainId: 'W'
    }
    
    const signedReissueTx = reissue(params, seed)

    Output

    {
      "id": "7HR6PGb2eP1bDs1AQ3fVXrNAKU6Ay57pwUPLW2aLUBP4",
      "type": 5,
      "version": 2,
      "chainId": "W",
      "fee": 100000000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926734,
      "proofs": [
        "8kuyzXRnMyVxoCwDZr5MspPq89YBJEnUgZ3NFSMqA2mUQP6cseXy6ncJoRDVfNw8vhuen8u5z8popPLQXbhA31U"
      ],
      "quantity": 10000,
      "assetId": "3toqCSpAHShatE75UFKxqymuWFr8nxuxD7UcLjdxVFLx",
      "reissuable": false
    }

    Parameters

    Returns ReissueTransaction

Const reissueToBytes

  • Parameters

    Returns Uint8Array

Const reissueValidation

  • Parameters

    Returns ValidationResult

Const serialize

  • serialize(obj: Tx | Order): Uint8Array
  • Parameters

    Returns Uint8Array

setAssetScript

Const setAssetScriptToBytes

Const setAssetScriptValidation

setScript

  • Creates and signs SetScriptTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed SetScriptTransaction as a second argument.

    Usage

    const { setScript } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    const params = {
      script: 'AQa3b8tH', //true
      //timestamp: Date.now(),
      //fee: 100000,
      //chainId: 'W'
    }
    
    const signedSetScriptTx = setScript(params, seed)

    Output

    {
      "id": "3L4sr1dDwMsevcebSMeDqqcRGzXe6emcKS8Rj5QCzBFX",
      "type": 13,
      "version": 1,
      "fee": 1000000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926767,
      "chainId": "W",
      "proofs": [
        "43NxBX1vtjxYUA89tupNTu9pjTPhtrGqMFg9ytapFDtAGegCnhFkMcsnKHtzpTxAk34v1VmzuoLC5McSdn2KU5N5"
      ],
      "script": "base64:AQa3b8tH"
    }

    Parameters

    Returns SetScriptTransaction

Const setScriptToBytes

Const setScriptValidation

  • Parameters

    Returns ValidationResult

Const signTx

  • Parameters

    Returns Tx

transfer

  • Creates and signs TransferTransaction.

    You can use this function with multiple seeds. In this case it will sign transaction accordingly and will add one proof per seed. Also you can use already signed TransferTransaction as a second argument.

    Usage

    const { transfer } = require('waves-transactions')
    
    const seed = 'b716885e9ba64442b4f1263c8e2d8671e98b800c60ec4dc2a27c83e5f9002b18'
    
    //Transfering 1 WAVES
    const params = {
      amount: 100000000,
      recipient: '3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs',
      //feeAssetId: undefined
      //assetId: undefined
      //attachment: undefined
      //timestamp: Date.now(),
      //fee: 100000,
    }
    
    const signedTransferTx = transfer(params, seed)

    Output

    {
      "id": "8oH5RKNJzqbAWVbqqcb9nwDoCb3osZiouLXJMzj65n6g",
      "type": 4,
      "version": 2,
      "fee": 100000,
      "senderPublicKey": "G62H1XE5rnaCgCCURV5pWwQHzWezZB7VkkVgqthdKgkj",
      "timestamp": 1542716926744,
      "proofs": [
        "MxK7z1Lm9EYqrWwDLJ6hEtqc3dXt2XUgMrd9pBoF5zJGWDBaYboe1EcncfQZxx18WrxkT4pA4QMhBTvbFT32eB1"
      ],
      "amount": 100000000,
      "recipient": "3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs"
    }

    Parameters

    Returns TransferTransaction

Const transferToBytes

Const transferValidation

txToJson

  • txToJson(value: Tx): string | undefined
  • Parameters

    • value: Tx

    Returns string | undefined

Const waitForTx

  • waitForTx(txId: string, timeout: number, apiBase: string): Promise<Tx>
  • Parameters

    • txId: string
    • timeout: number
    • apiBase: string

    Returns Promise<Tx>

Object literals

Const txTypeMap

txTypeMap: object

__computed

__computed: object

serialize

sign

Generated using TypeDoc