tradeExchangeTokens

Trade tokens on a bancor style exchange.

Usage

visionWeb.transactionBuilder.tradeExchangeTokens(
  exchangeID,
  tokenId,
  tokenAmountSold,
  tokenAmountExpected,
  ownerAddress,
  options
);

Parameters

ParameterDescriptionTypeDefault
exchangeIdnon-negative integer exchange id.number-
tokenIdToken id.number | string-
tokenAmountSoldAmount of token actually sold.number-
tokenAmountExpectedAmount of token expected.number-
ownerAddressOwner account address.stringDefault account address
optionsDescriptions are below.object-

options parameters

ParameterDescriptionTypeDefault
permissionIdThe permission Id,optional, for multi-signature use.number-

Returns

Object.

Example

visionWeb.transactionBuilder.tradeExchangeTokens(1,"1000001",1000,1000);
> {
    "visible": false,
    "txID": "33ee92c191bf00f4b06daccc5c3adb85c33f9b997fcf8822b4ec93ae0927cef8",
    "raw_data": {
        "contract": [
            {
                "parameter": {
                    "value": {
                        "exchange_id": 1,
                        "token_id": "31303030303031",
                        "expected": 1000,
                        "owner_address": "4653cd48c2723cb985679f4e44d99c64d22d89f41d",
                        "quant": 1000
                    },
                    "type_url": "type.googleapis.com/protocol.ExchangeTransactionContract"
                },
                "type": "ExchangeTransactionContract"
            }
        ],
        "ref_block_bytes": "c778",
        "ref_block_hash": "db086b31f0f10f69",
        "expiration": 1608469779000,
        "timestamp": 1608469720479
    },
    "raw_data_hex": "0a024a572208e75bcd33afa55f3340b8a49482e82e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a154653cd48c2723cb985679f4e44d99c64d22d89f41d1215462d7a77f8bef6fe225bf5e353dd6a380f588a1496180a709fdb9082e82e"
}