Common Objects

class common.objects.api.transaction_requests.DepositRequest(vault_id: int, stark_key: int, token_id: int, amount: int)

Deposit transaction.

Parameters
  • vault_id (int) – Vault ID in the StarkEx system.

  • stark_key (int) – Public key of the party as registered on the StarkEx contract.

  • token_id (int) – Unique token ID as registered on the StarkEx contract.

  • amount (int) – Amount of token to be deposited; required to be >= 0.

class common.objects.api.transaction_requests.MintRequest(vault_id: int, stark_key: int, token_id: int, amount: int)

Offchain Mint transaction.

Parameters
  • vault_id (int) – Vault ID in the StarkEx system, into which the token is minted.

  • stark_key (int) – Public key of the party as registered on the StarkEx contract.

  • token_id (int) – Unique token ID; must be mintable.

  • amount (int) – Amount of token to be minted; required to be >= 0.

class common.objects.api.transaction_requests.WithdrawalRequest(vault_id: int, stark_key: int, token_id: int, amount: int)

Withdrawal transaction.

Parameters
  • vault_id (int) – Vault ID in the StarkEx system.

  • stark_key (int) – Public key of the party as registered on the StarkEx contract.

  • token_id (int) – Unique token ID as registered on the StarkEx contract.

  • amount (int) – Amount of token to be withdrawn; required to be >= 0.

class common.objects.api.transaction_requests.FullWithdrawalRequest(vault_id: int, stark_key: int)

FullWithdrawal transaction.

Parameters
  • vault_id (int) – Vault ID in the StarkEx system.

  • stark_key (int) – Public key of the party as registered on the StarkEx contract.

class common.objects.api.transaction_requests.FalseFullWithdrawalRequest(vault_id: int, requester_stark_key: int)

FalseFullWithdrawal transaction.

Parameters
  • vault_id (int) – Vault ID in the StarkEx system.

  • requester_stark_key (int) – stark_key of the (malicious) user that requested the withdrawal.

class common.objects.api.transaction_requests.SettlementRequest(settlement_info: common.objects.api.transaction_requests.SettlementInfoRequest, party_a_order: common.objects.api.transaction_requests.OrderRequest, party_b_order: common.objects.api.transaction_requests.OrderRequest)

The information describing an exchange settlement.

Parameters
class common.objects.api.transaction_requests.TransferRequest(amount: int, nonce: int, sender_public_key: int, sender_vault_id: int, token: int, receiver_public_key: int, receiver_vault_id: int, expiration_timestamp: int, signature: services.starkex.gateway.objects.Signature, fee_info_user: Optional[common.objects.api.transaction_requests.FeeInfoUserRequest], fee_info_exchange: Optional[common.objects.api.transaction_requests.FeeInfoExchangeRequest])

The information describing an exchange transfer.

Parameters
  • amount (int) – The amount to transfer.

  • nonce (int) – The (single) nonce involved in the transfer.

  • sender_public_key (int) – The sender’s public key.

  • sender_vault_id (int) – The sender’s vault ID.

  • token (int) – The token to be transferred.

  • receiver_public_key (int) – The receiver’s public key.

  • receiver_vault_id (int) – The receiver’s vault ID.

  • expiration_timestamp (int) – The expiration timestamp for the transfer, in hours since the Unix epoch (Unix timstamp / 3600).

  • signature (Signature) – Signature of the party on the transfer.

  • fee_info_user (Optional[FeeInfoUserRequest]) – Fee information given and signed by the user.

  • fee_info_exchange (Optional[FeeInfoExchangeRequest]) – Fee information given by the exchange.

signature_message_hash() int

Computes the transfer object hash.

class common.objects.api.transaction_requests.ConditionalTransferRequest(amount: int, nonce: int, sender_public_key: int, sender_vault_id: int, token: int, receiver_public_key: int, receiver_vault_id: int, expiration_timestamp: int, signature: services.starkex.gateway.objects.Signature, fee_info_user: Optional[common.objects.api.transaction_requests.FeeInfoUserRequest], fee_info_exchange: Optional[common.objects.api.transaction_requests.FeeInfoExchangeRequest], fact_registry_address: str, fact: bytes)

The information describing an exchange conditional transfer.

Parameters
  • amount (int) – The amount to transfer.

  • nonce (int) – The (single) nonce involved in the transfer.

  • sender_public_key (int) – The sender’s public key.

  • sender_vault_id (int) – The sender’s vault ID.

  • token (int) – The token to be transferred.

  • receiver_public_key (int) – The receiver’s public key.

  • receiver_vault_id (int) – The receiver’s vault ID.

  • expiration_timestamp (int) – The expiration timestamp for the transfer, in hours since the Unix epoch (Unix timstamp / 3600).

  • signature (Signature) – Signature of the party on the transfer.

  • fact_registry_address (str) – The address of the fact registry smart contract. Should be checksummed according to Web3.isChecksumAddress.

  • fact (bytes) – The fact that should appear in the fact registry as a condition to the transfer. A 32 bytes blob.

class common.objects.api.transaction_requests.SettlementInfoRequest(party_a_sold: int, party_b_sold: int, party_a_fee_info: Optional[common.objects.api.transaction_requests.FeeInfoExchangeRequest], party_b_fee_info: Optional[common.objects.api.transaction_requests.FeeInfoExchangeRequest])

The information describing a settlement excluding the parties taking part in it.

Parameters
  • party_a_sold (int) – Amount of token A to be transferred from party_a to party_b.

  • party_b_sold (int) – Amount of token B to be transferred from party_b to party_a.

  • party_a_fee_info (Optional[FeeInfoExchangeRequest]) – The exchange fee info for party a.

  • party_b_fee_info (Optional[FeeInfoExchangeRequest]) – The exchange fee info for party b.

class services.starkex.gateway.objects.OrderTypeObsolete(value)

An enumeration.

SETTLEMENT = 0
TRANSFER = 1
class common.objects.api.transaction_requests.OrderRequest(order_type: services.starkex.gateway.objects.OrderTypeObsolete, nonce: int, amount_sell: int, amount_buy: int, token_sell: int, token_buy: int, vault_id_sell: int, vault_id_buy: int, expiration_timestamp: int, fee_info: Optional[common.objects.api.transaction_requests.FeeInfoUserRequest])

Order.

Parameters
  • order_type (OrderTypeObsolete) – order type.

  • nonce (int) – Unique nonce issued by the caller.

  • amount_sell (int) – Amount to sell from sold token.

  • amount_buy (int) – Amount to buy from bought token.

  • token_sell (int) – Unique token ID of token to sell as registered on the StarkEx contract.

  • token_buy (int) – Unique token ID of token to buy as registered on the StarkEx contract.

  • vault_id_sell (int) – Vault ID holding party’s sold token.

  • vault_id_buy (int) – Vault ID holding party’s bought token.

  • expiration_timestamp (int) – The expiration timestamp of the order, in hours since the Unix epoch (Unix timstamp / 3600).

  • fee_info (Optional[FeeInfoUserRequest]) – The fee information given by the party.

signature_message_hash() int

Computes the order object hash.

class services.starkex.gateway.objects.Signature(r: int, w: Optional[int] = None, s: Optional[int] = None)

Represents a STARK-friendly ECDSA signature.

Parameters
  • r (int) – 1st ECDSA signature component. See TBD for further details.

  • s (int) – 2nd ECDSA signature component. See TBD for further details.

class common.objects.api.transaction_requests.FeeInfoUserRequest(token_id: int, fee_limit: int, source_vault_id: int)

The Fee information provided and signed by the user: The token ID of the fee, the fee limit, and the vault ID of the vault from which the fee can be taken. The fee limit is proportional to the user’s signed buy amount - i.e., for every one token_buy received by the party, the fee taken amount is limited to (fee_limit/amount_buy).

class common.objects.api.transaction_requests.FeeInfoExchangeRequest(fee_taken: int, destination_vault_id: int, destination_stark_key: int)

The Fee information provided by the exchange: The actual taken fee amount, the vault ID of the vault to which the fee will be transferred, and the stark key associated with said vault.