Decentralized Trading Platform API

Documentation for Blockparty Decentralized Trading Platform GraphQL API

API Endpoints

COMING SOON

Queries

admittedBroker

Response

Returns a Boolean!

Arguments

Name Description

account - String!

Example

Query
query admittedBroker($account: String!) {
  admittedBroker(account: $account)
}

Variables

{"account": "abc123"}

Response

{"data": {"admittedBroker": true}}

admittedBrokers

Response

Returns an AdmittedBrokerList!

Arguments

Name Description

first - Int

Default = 10

skip - Int

Default = 0

where - AdmittedBrokerFilter

orderBy - AdmittedBrokerOrderBy

ordering - Ordering

Example

Query
query admittedBrokers(
  $first: Int,
  $skip: Int,
  $where: AdmittedBrokerFilter,
  $orderBy: AdmittedBrokerOrderBy,
  $ordering: Ordering
) {
  admittedBrokers(
    first: $first,
    skip: $skip,
    where: $where,
    orderBy: $orderBy,
    ordering: $ordering
  ) {
    numEntries
    cursor
    entries {
      ...BrokerAdmissionFragment
    }
  }
}

Variables

{
  "first": 10,
  "skip": 0,
  "where": AdmittedBrokerFilter,
  "orderBy": "ACCOUNT",
  "ordering": "ASC"
}

Response

{
  "data": {
    "admittedBrokers": {
      "numEntries": UInt64,
      "cursor": UInt64,
      "entries": [BrokerAdmission]
    }
  }
}

coreEvents

Response

Returns a CoreEventList!

Arguments

Name Description

first - Int

Default = 10

skip - Int

Default = 0

where - CoreEventFilter

orderBy - CoreEventOrderBy

ordering - Ordering

Example

Query
query coreEvents(
  $first: Int,
  $skip: Int,
  $where: CoreEventFilter,
  $orderBy: CoreEventOrderBy,
  $ordering: Ordering
) {
  coreEvents(
    first: $first,
    skip: $skip,
    where: $where,
    orderBy: $orderBy,
    ordering: $ordering
  ) {
    numEntries
    cursor
    entries {
      ... on SwapMadeCoreEvent {
        ...SwapMadeCoreEventFragment
      }
      ... on SwapTakenCoreEvent {
        ...SwapTakenCoreEventFragment
      }
      ... on SwapDroppedCoreEvent {
        ...SwapDroppedCoreEventFragment
      }
      ... on SwapCurrencyAmendedCoreEvent {
        ...SwapCurrencyAmendedCoreEventFragment
      }
      ... on SwapBrokeredCoreEvent {
        ...SwapBrokeredCoreEventFragment
      }
      ... on BrokeredSwapJoinedCoreEvent {
        ...BrokeredSwapJoinedCoreEventFragment
      }
      ... on BrokeredSwapUnjoinedCoreEvent {
        ...BrokeredSwapUnjoinedCoreEventFragment
      }
      ... on BrokeredSwapDroppedCoreEvent {
        ...BrokeredSwapDroppedCoreEventFragment
      }
      ... on DepositedTreasuryEvent {
        ...DepositedTreasuryEventFragment
      }
      ... on WithdrawnTreasuryEvent {
        ...WithdrawnTreasuryEventFragment
      }
      ... on BookedTreasuryEvent {
        ...BookedTreasuryEventFragment
      }
      ... on SpentTreasuryEvent {
        ...SpentTreasuryEventFragment
      }
    }
  }
}

Variables

{
  "first": 10,
  "skip": 0,
  "where": CoreEventFilter,
  "orderBy": "BLOCK_TIME",
  "ordering": "ASC"
}

Response

{
  "data": {
    "coreEvents": {
      "numEntries": UInt64,
      "cursor": UInt64,
      "entries": [SwapMadeCoreEvent]
    }
  }
}

swap

Response

Returns a Swap

Arguments

Name Description

id - UInt256!

Example

Query
query swap($id: UInt256!) {
  swap(id: $id) {
    id
    dex {
      ...DEXFragment
    }
    transaction {
      ...TransactionFragment
    }
    event {
      ... on SwapMadeCoreEvent {
        ...SwapMadeCoreEventFragment
      }
      ... on SwapTakenCoreEvent {
        ...SwapTakenCoreEventFragment
      }
      ... on SwapDroppedCoreEvent {
        ...SwapDroppedCoreEventFragment
      }
      ... on SwapCurrencyAmendedCoreEvent {
        ...SwapCurrencyAmendedCoreEventFragment
      }
      ... on SwapBrokeredCoreEvent {
        ...SwapBrokeredCoreEventFragment
      }
      ... on BrokeredSwapJoinedCoreEvent {
        ...BrokeredSwapJoinedCoreEventFragment
      }
      ... on BrokeredSwapUnjoinedCoreEvent {
        ...BrokeredSwapUnjoinedCoreEventFragment
      }
      ... on BrokeredSwapDroppedCoreEvent {
        ...BrokeredSwapDroppedCoreEventFragment
      }
    }
    status
    escrow
    expiration
    broker
    isLastVersion
    lastVersion {
      ...SwapFragment
    }
    nextVersion {
      ...SwapFragment
    }
    previousVersion {
      ...SwapFragment
    }
    versions {
      ...SwapFragment
    }
    sideA {
      ...SwapSideFragment
    }
    sideB {
      ...SwapSideFragment
    }
    accessList {
      ...SwapAccessItemFragment
    }
    joinedSide
    expired
  }
}

Variables

{"id": UInt256}

Response

{
  "data": {
    "swap": {
      "id": UInt256,
      "dex": DEX,
      "transaction": Transaction,
      "event": SwapMadeCoreEvent,
      "status": "OPEN",
      "escrow": false,
      "expiration": UInt256,
      "broker": "xyz789",
      "isLastVersion": false,
      "lastVersion": Swap,
      "nextVersion": Swap,
      "previousVersion": Swap,
      "versions": [Swap],
      "sideA": SwapSide,
      "sideB": SwapSide,
      "accessList": [SwapAccessItem],
      "joinedSide": "A",
      "expired": true
    }
  }
}

swaps

Response

Returns a SwapList!

Arguments

Name Description

first - Int

Default = 10

skip - Int

Default = 0

where - SwapFilter

orderBy - SwapOrderBy

ordering - Ordering

Example

Query
query swaps(
  $first: Int,
  $skip: Int,
  $where: SwapFilter,
  $orderBy: SwapOrderBy,
  $ordering: Ordering
) {
  swaps(
    first: $first,
    skip: $skip,
    where: $where,
    orderBy: $orderBy,
    ordering: $ordering
  ) {
    numEntries
    cursor
    entries {
      ...SwapFragment
    }
  }
}

Variables

{
  "first": 10,
  "skip": 0,
  "where": SwapFilter,
  "orderBy": "ID",
  "ordering": "ASC"
}

Response

{
  "data": {
    "swaps": {
      "numEntries": UInt64,
      "cursor": UInt64,
      "entries": [Swap]
    }
  }
}

transaction

Response

Returns a Transaction

Arguments

Name Description

hash - String!

Example

Query
query transaction($hash: String!) {
  transaction(hash: $hash) {
    hash
    address
    blockNum
    index
    blockTime
    confirmations
    events {
      ... on SwapMadeCoreEvent {
        ...SwapMadeCoreEventFragment
      }
      ... on SwapTakenCoreEvent {
        ...SwapTakenCoreEventFragment
      }
      ... on SwapDroppedCoreEvent {
        ...SwapDroppedCoreEventFragment
      }
      ... on SwapCurrencyAmendedCoreEvent {
        ...SwapCurrencyAmendedCoreEventFragment
      }
      ... on SwapBrokeredCoreEvent {
        ...SwapBrokeredCoreEventFragment
      }
      ... on BrokeredSwapJoinedCoreEvent {
        ...BrokeredSwapJoinedCoreEventFragment
      }
      ... on BrokeredSwapUnjoinedCoreEvent {
        ...BrokeredSwapUnjoinedCoreEventFragment
      }
      ... on BrokeredSwapDroppedCoreEvent {
        ...BrokeredSwapDroppedCoreEventFragment
      }
      ... on DepositedTreasuryEvent {
        ...DepositedTreasuryEventFragment
      }
      ... on WithdrawnTreasuryEvent {
        ...WithdrawnTreasuryEventFragment
      }
      ... on BookedTreasuryEvent {
        ...BookedTreasuryEventFragment
      }
      ... on SpentTreasuryEvent {
        ...SpentTreasuryEventFragment
      }
    }
    swap {
      ...SwapFragment
    }
  }
}

Variables

{"hash": "xyz789"}

Response

{
  "data": {
    "transaction": {
      "hash": "xyz789",
      "address": "xyz789",
      "blockNum": UInt64,
      "index": UInt32,
      "blockTime": "10:15:30Z",
      "confirmations": UInt64,
      "events": [SwapMadeCoreEvent],
      "swap": Swap
    }
  }
}

transactions

Response

Returns a TransactionList!

Arguments

Name Description

first - Int

Default = 10

skip - Int

Default = 0

where - TransactionFilter

orderBy - TransactionOrderBy

ordering - Ordering

Example

Query
query transactions(
  $first: Int,
  $skip: Int,
  $where: TransactionFilter,
  $orderBy: TransactionOrderBy,
  $ordering: Ordering
) {
  transactions(
    first: $first,
    skip: $skip,
    where: $where,
    orderBy: $orderBy,
    ordering: $ordering
  ) {
    numEntries
    cursor
    entries {
      ...TransactionFragment
    }
  }
}

Variables

{
  "first": 10,
  "skip": 0,
  "where": TransactionFilter,
  "orderBy": "CONFIRMATIONS",
  "ordering": "ASC"
}

Response

{
  "data": {
    "transactions": {
      "numEntries": UInt64,
      "cursor": UInt64,
      "entries": [Transaction]
    }
  }
}

Types

AdmittedBrokerFilter

Fields

Input Field Description

account - String

enabled - Boolean

Example

{"account": "xyz789", "enabled": false}

AdmittedBrokerList

Fields

Field Name Description

numEntries - UInt64!

cursor - UInt64

entries - [BrokerAdmission!]!

Example

{
  "numEntries": UInt64,
  "cursor": UInt64,
  "entries": [BrokerAdmission]
}

AdmittedBrokerOrderBy

Values

Enum Value Description

ACCOUNT

Example

"ACCOUNT"

AssetType

Values

Enum Value Description

ERC1155

ERC721

ERC20

CURRENCY

Example

"ERC1155"

BookedTreasuryEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

dex - DEX!

receiver - String!

value - UInt256!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "dex": DEX,
  "receiver": "abc123",
  "value": UInt256
}

Boolean

Description

The Boolean scalar type represents true or false.

BrokerAdmission

Fields

Field Name Description

account - String!

enabled - Boolean!

Example

{"account": "xyz789", "enabled": false}

BrokeredSwapDroppedCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap
}

BrokeredSwapJoinedCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

seqNum - UInt256!

sender - String!

side - Side!

status - SwapStatus!

tokenIDs - [UInt256!]!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap,
  "seqNum": UInt256,
  "sender": "abc123",
  "side": "A",
  "status": "OPEN",
  "tokenIDs": [UInt256]
}

BrokeredSwapUnjoinedCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

seqNum - UInt256!

sender - String!

side - Side!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap,
  "seqNum": UInt256,
  "sender": "abc123",
  "side": "A"
}

ComponentToken

Fields

Field Name Description

tokenID - UInt256

amount - UInt256!

Example

{
  "tokenID": UInt256,
  "amount": UInt256
}

CoreEventFilter

Fields

Input Field Description

dex - String

swap - UInt256

transaction - String

Example

{
  "dex": "xyz789",
  "swap": UInt256,
  "transaction": "xyz789"
}

CoreEventList

Fields

Field Name Description

numEntries - UInt64!

cursor - UInt64

entries - [CoreEvent!]!

Example

{
  "numEntries": UInt64,
  "cursor": UInt64,
  "entries": [SwapMadeCoreEvent]
}

CoreEventOrderBy

Values

Enum Value Description

BLOCK_TIME

Example

"BLOCK_TIME"

CoreEventType

Values

Enum Value Description

SwapMade

SwapTaken

SwapDropped

SwapCurrencyAmended

SwapBrokered

BrokeredSwapJoined

BrokeredSwapUnjoined

BrokeredSwapDropped

Deposited

Withdrawn

Booked

Spent

AllBrokersAdmission

BrokerAdmission

AllTradingAccountsAdmission

TradingAccountAdmission

AssetTypeAdmission

AssetContractAdmission

NFTAdmission

Example

"SwapMade"

CurrencyComponent

Fields

Field Name Description

assetType - AssetType!

swap - Swap!

amount - UInt256!

Example

{
  "assetType": "ERC1155",
  "swap": Swap,
  "amount": UInt256
}

DEX

Fields

Field Name Description

name - String!

version - String!

address - String!

Example

{
  "name": "abc123",
  "version": "abc123",
  "address": "abc123"
}

DepositedTreasuryEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

dex - DEX!

account - String!

value - UInt256!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "dex": DEX,
  "account": "abc123",
  "value": UInt256
}

ERC1155Component

Fields

Field Name Description

assetType - AssetType!

swap - Swap!

tokenAddress - String!

tokens - [ComponentToken!]!

collectionOffer - Boolean!

Example

{
  "assetType": "ERC1155",
  "swap": Swap,
  "tokenAddress": "xyz789",
  "tokens": [ComponentToken],
  "collectionOffer": true
}

ERC20Component

Fields

Field Name Description

assetType - AssetType!

swap - Swap!

tokenAddress - String!

amount - UInt256!

Example

{
  "assetType": "ERC1155",
  "swap": Swap,
  "tokenAddress": "xyz789",
  "amount": UInt256
}

ERC721Component

Fields

Field Name Description

assetType - AssetType!

swap - Swap!

tokenAddress - String!

tokenID - UInt256

collectionOffer - Boolean!

Example

{
  "assetType": "ERC1155",
  "swap": Swap,
  "tokenAddress": "xyz789",
  "tokenID": UInt256,
  "collectionOffer": false
}

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example

123

Int256

Example

Int256

Ordering

Values

Enum Value Description

ASC

DESC

Example

"ASC"

Side

Values

Enum Value Description

A

B

BOTH

NEITHER

Example

"A"

SpentTreasuryEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

dex - DEX!

spender - String!

value - UInt256!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "dex": DEX,
  "spender": "abc123",
  "value": UInt256
}

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example

"abc123"

Swap

Fields

Field Name Description

id - UInt256!

dex - DEX!

transaction - Transaction!

event - CoreSwapEvent!

status - SwapStatus!

escrow - Boolean!

expiration - UInt256

broker - String

isLastVersion - Boolean!

lastVersion - Swap!

nextVersion - Swap

previousVersion - Swap

versions - [Swap!]!

sideA - SwapSide!

sideB - SwapSide!

accessList - [SwapAccessItem!]

joinedSide - Side!

expired - Boolean!

Example

{
  "id": UInt256,
  "dex": DEX,
  "transaction": Transaction,
  "event": SwapMadeCoreEvent,
  "status": "OPEN",
  "escrow": true,
  "expiration": UInt256,
  "broker": "xyz789",
  "isLastVersion": true,
  "lastVersion": Swap,
  "nextVersion": Swap,
  "previousVersion": Swap,
  "versions": [Swap],
  "sideA": SwapSide,
  "sideB": SwapSide,
  "accessList": [SwapAccessItem],
  "joinedSide": "A",
  "expired": false
}

SwapAccessItem

Fields

Field Name Description

swap - Swap!

side - String!

account - String!

Example

{
  "swap": Swap,
  "side": "xyz789",
  "account": "xyz789"
}

SwapBrokeredCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap
}

SwapComponent

Example

ERC1155Component

SwapCurrencyAmendedCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

seqNum - UInt256!

side - Side!

previous - UInt256!

value - UInt256!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap,
  "seqNum": UInt256,
  "side": "A",
  "previous": UInt256,
  "value": UInt256
}

SwapDroppedCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap
}

SwapFilter

Fields

Input Field Description

status - SwapStatus

status_in - [SwapStatus!]

broker - String

broker_like - String

brokerCanJoin - String

sideASender - String

sideASender_like - String

sideBSender - String

sideBSender_like - String

eitherSideSender - String

eitherSideSender_like - String

accountCanJoin - String

accessList_empty - Boolean

accessList_has - String

accessList_empty_or_has - String

expired - Boolean

Example

{
  "status": "OPEN",
  "status_in": ["OPEN"],
  "broker": "xyz789",
  "broker_like": "abc123",
  "brokerCanJoin": "abc123",
  "sideASender": "xyz789",
  "sideASender_like": "abc123",
  "sideBSender": "abc123",
  "sideBSender_like": "xyz789",
  "eitherSideSender": "abc123",
  "eitherSideSender_like": "abc123",
  "accountCanJoin": "xyz789",
  "accessList_empty": true,
  "accessList_has": "abc123",
  "accessList_empty_or_has": "abc123",
  "expired": true
}

SwapList

Fields

Field Name Description

numEntries - UInt64!

cursor - UInt64

entries - [Swap!]!

Example

{
  "numEntries": UInt64,
  "cursor": UInt64,
  "entries": [Swap]
}

SwapMadeCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

maker - String!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap,
  "maker": "xyz789"
}

SwapOrderBy

Values

Enum Value Description

ID

STATUS

Example

"ID"

SwapSide

Fields

Field Name Description

sender - String

brokerFee - Int256

components - [SwapComponent!]!

collectionOffer - Boolean!

complete - Boolean!

Example

{
  "sender": "xyz789",
  "brokerFee": Int256,
  "components": [ERC1155Component],
  "collectionOffer": false,
  "complete": true
}

SwapStatus

Values

Enum Value Description

OPEN

CLOSED

DROPPED

BROKERED

JOINED

BROKERED_DROPPED

EXPIRED

Example

"OPEN"

SwapTakenCoreEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

swap - Swap!

seqNum - UInt256!

taker - String!

tokenIDs - [UInt256!]!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "swap": Swap,
  "seqNum": UInt256,
  "taker": "abc123",
  "tokenIDs": [UInt256]
}

Time

Example

"10:15:30Z"

Transaction

Fields

Field Name Description

hash - String!

address - String!

blockNum - UInt64!

index - UInt32!

blockTime - Time!

confirmations - UInt64!

events - [CoreEvent!]

swap - Swap

Example

{
  "hash": "abc123",
  "address": "abc123",
  "blockNum": UInt64,
  "index": UInt32,
  "blockTime": "10:15:30Z",
  "confirmations": UInt64,
  "events": [SwapMadeCoreEvent],
  "swap": Swap
}

TransactionFilter

Fields

Input Field Description

hash - String

address - String

block - UInt64

minConfirmations - UInt64

dex - String

swap - String

Example

{
  "hash": "abc123",
  "address": "abc123",
  "block": UInt64,
  "minConfirmations": UInt64,
  "dex": "xyz789",
  "swap": "xyz789"
}

TransactionList

Fields

Field Name Description

numEntries - UInt64!

cursor - UInt64

entries - [Transaction!]!

Example

{
  "numEntries": UInt64,
  "cursor": UInt64,
  "entries": [Transaction]
}

TransactionOrderBy

Values

Enum Value Description

CONFIRMATIONS

BLOCK

SWAP

CREATED_AT

Example

"CONFIRMATIONS"

UInt256

Example

UInt256

UInt32

Example

UInt32

UInt64

Example

UInt64

WithdrawnTreasuryEvent

Fields

Field Name Description

type - CoreEventType!

transaction - Transaction!

dex - DEX!

account - String!

value - UInt256!

Example

{
  "type": "SwapMade",
  "transaction": Transaction,
  "dex": DEX,
  "account": "xyz789",
  "value": UInt256
}