Gateway

class services.starkex.gateway.gateway.GatewayServiceVersion2(gateway_config: dict, storage: starkware.storage.storage.Storage)

This is the StarkEx Services HTTP gateway version2 for all external trading interactions.

async add_transaction(request)

Send a new transaction to StarkEx. This function handles all types of StarkEx transactions. Note: The transaction json must contain the object type.

Available tx types:

Parameters
  • tx_id (int) – Transaction sequence number issued by the caller.

  • tx (str) – Transaction type and the specific transaction parameters (listed below)

Returns

Transaction status (json).

Return type

str

Example for a SettlementRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "party_a_order": {
                "amount_buy": "80",
                "amount_sell": "70",
                "expiration_timestamp": 3396833,
                "nonce": 1654615998,
                "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",
                "signature": {
                    "r": "0x0",
                    "s": "0x0"
                },
                "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",
                "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",
                "type": "OrderL2Request",
                "vault_id_buy": 9223372038941819365,
                "vault_id_sell": 9223372037028654900
            },
            "party_b_order": {
                "amount_buy": "30",
                "amount_sell": "40",
                "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",
                "expiration_timestamp": 989173,
                "fee_info": {
                    "fee_limit": "7",
                    "source_vault_id": 1,
                    "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"
                },
                "nonce": 577090037,
                "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",
                "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",
                "type": "OrderL1Request",
                "vault_id_buy": 1095513148,
                "vault_id_sell": 271041745
            },
            "settlement_info": {
                "party_a_sold": "30",
                "party_b_fee_info": {
                    "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                    "destination_vault_id": 9223372038661117013,
                    "fee_taken": "1"
                },
                "party_b_sold": "40"
            },
            "type": "SettlementRequest"
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "party_a_order": {

                "amount_buy": "80",

                "amount_sell": "70",

                "expiration_timestamp": 3396833,

                "nonce": 1654615998,

                "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",

                "signature": {

                    "r": "0x0",

                    "s": "0x0"

                },

                "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",

                "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",

                "type": "OrderL2Request",

                "vault_id_buy": 9223372038941819365,

                "vault_id_sell": 9223372037028654900

            },

            "party_b_order": {

                "amount_buy": "30",

                "amount_sell": "40",

                "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",

                "expiration_timestamp": 989173,

                "fee_info": {

                    "fee_limit": "7",

                    "source_vault_id": 1,

                    "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"

                },

                "nonce": 577090037,

                "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",

                "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",

                "type": "OrderL1Request",

                "vault_id_buy": 1095513148,

                "vault_id_sell": 271041745

            },

            "settlement_info": {

                "party_a_sold": "30",

                "party_b_fee_info": {

                    "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "destination_vault_id": 9223372038661117013,

                    "fee_taken": "1"

                },

                "party_b_sold": "40"

            },

            "type": "SettlementRequest"

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "party_a_order": {

                "amount_buy": "80",

                "amount_sell": "70",

                "expiration_timestamp": 3396833,

                "nonce": 1654615998,

                "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",

                "signature": {

                    "r": "0x0",

                    "s": "0x0"

                },

                "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",

                "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",

                "type": "OrderL2Request",

                "vault_id_buy": 9223372038941819365,

                "vault_id_sell": 9223372037028654900

            },

            "party_b_order": {

                "amount_buy": "30",

                "amount_sell": "40",

                "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",

                "expiration_timestamp": 989173,

                "fee_info": {

                    "fee_limit": "7",

                    "source_vault_id": 1,

                    "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"

                },

                "nonce": 577090037,

                "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",

                "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",

                "type": "OrderL1Request",

                "vault_id_buy": 1095513148,

                "vault_id_sell": 271041745

            },

            "settlement_info": {

                "party_a_sold": "30",

                "party_b_fee_info": {

                    "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "destination_vault_id": 9223372038661117013,

                    "fee_taken": "1"

                },

                "party_b_sold": "40"

            },

            "type": "SettlementRequest"

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "party_a_order": {

                "amount_buy": "80",

                "amount_sell": "70",

                "expiration_timestamp": 3396833,

                "nonce": 1654615998,

                "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",

                "signature": {

                    "r": "0x0",

                    "s": "0x0"

                },

                "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",

                "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",

                "type": "OrderL2Request",

                "vault_id_buy": 9223372038941819365,

                "vault_id_sell": 9223372037028654900

            },

            "party_b_order": {

                "amount_buy": "30",

                "amount_sell": "40",

                "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",

                "expiration_timestamp": 989173,

                "fee_info": {

                    "fee_limit": "7",

                    "source_vault_id": 1,

                    "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"

                },

                "nonce": 577090037,

                "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",

                "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",

                "type": "OrderL1Request",

                "vault_id_buy": 1095513148,

                "vault_id_sell": 271041745

            },

            "settlement_info": {

                "party_a_sold": "30",

                "party_b_fee_info": {

                    "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "destination_vault_id": 9223372038661117013,

                    "fee_taken": "1"

                },

                "party_b_sold": "40"

            },

            "type": "SettlementRequest"

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "party_a_order": {\r\n\n                "amount_buy": "80",\r\n\n                "amount_sell": "70",\r\n\n                "expiration_timestamp": 3396833,\r\n\n                "nonce": 1654615998,\r\n\n                "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",\r\n\n                "signature": {\r\n\n                    "r": "0x0",\r\n\n                    "s": "0x0"\r\n\n                },\r\n\n                "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",\r\n\n                "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",\r\n\n                "type": "OrderL2Request",\r\n\n                "vault_id_buy": 9223372038941819365,\r\n\n                "vault_id_sell": 9223372037028654900\r\n\n            },\r\n\n            "party_b_order": {\r\n\n                "amount_buy": "30",\r\n\n                "amount_sell": "40",\r\n\n                "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",\r\n\n                "expiration_timestamp": 989173,\r\n\n                "fee_info": {\r\n\n                    "fee_limit": "7",\r\n\n                    "source_vault_id": 1,\r\n\n                    "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"\r\n\n                },\r\n\n                "nonce": 577090037,\r\n\n                "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",\r\n\n                "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",\r\n\n                "type": "OrderL1Request",\r\n\n                "vault_id_buy": 1095513148,\r\n\n                "vault_id_sell": 271041745\r\n\n            },\r\n\n            "settlement_info": {\r\n\n                "party_a_sold": "30",\r\n\n                "party_b_fee_info": {\r\n\n                    "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                    "destination_vault_id": 9223372038661117013,\r\n\n                    "fee_taken": "1"\r\n\n                },\r\n\n                "party_b_sold": "40"\r\n\n            },\r\n\n            "type": "SettlementRequest"\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a TransferRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "amount": "7106521602475165645",
            "expiration_timestamp": 2791313,
            "fee_info_exchange": {
                "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                "destination_vault_id": 9223372038661117013,
                "fee_taken": "5"
            },
            "fee_info_user": {
                "fee_limit": "15",
                "source_vault_id": 9223372037454979375,
                "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"
            },
            "nonce": 1806341205,
            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",
            "receiver_vault_id": 9223372037390833737,
            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "sender_vault_id": 9223372037733001032,
            "signature": {
                "r": "0x0",
                "s": "0x0"
            },
            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",
            "type": "TransferRequest"
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "amount": "7106521602475165645",

            "expiration_timestamp": 2791313,

            "fee_info_exchange": {

                "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                "destination_vault_id": 9223372038661117013,

                "fee_taken": "5"

            },

            "fee_info_user": {

                "fee_limit": "15",

                "source_vault_id": 9223372037454979375,

                "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"

            },

            "nonce": 1806341205,

            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

            "receiver_vault_id": 9223372037390833737,

            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "sender_vault_id": 9223372037733001032,

            "signature": {

                "r": "0x0",

                "s": "0x0"

            },

            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

            "type": "TransferRequest"

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "amount": "7106521602475165645",

            "expiration_timestamp": 2791313,

            "fee_info_exchange": {

                "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                "destination_vault_id": 9223372038661117013,

                "fee_taken": "5"

            },

            "fee_info_user": {

                "fee_limit": "15",

                "source_vault_id": 9223372037454979375,

                "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"

            },

            "nonce": 1806341205,

            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

            "receiver_vault_id": 9223372037390833737,

            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "sender_vault_id": 9223372037733001032,

            "signature": {

                "r": "0x0",

                "s": "0x0"

            },

            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

            "type": "TransferRequest"

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "amount": "7106521602475165645",

            "expiration_timestamp": 2791313,

            "fee_info_exchange": {

                "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                "destination_vault_id": 9223372038661117013,

                "fee_taken": "5"

            },

            "fee_info_user": {

                "fee_limit": "15",

                "source_vault_id": 9223372037454979375,

                "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"

            },

            "nonce": 1806341205,

            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

            "receiver_vault_id": 9223372037390833737,

            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "sender_vault_id": 9223372037733001032,

            "signature": {

                "r": "0x0",

                "s": "0x0"

            },

            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

            "type": "TransferRequest"

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "amount": "7106521602475165645",\r\n\n            "expiration_timestamp": 2791313,\r\n\n            "fee_info_exchange": {\r\n\n                "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                "destination_vault_id": 9223372038661117013,\r\n\n                "fee_taken": "5"\r\n\n            },\r\n\n            "fee_info_user": {\r\n\n                "fee_limit": "15",\r\n\n                "source_vault_id": 9223372037454979375,\r\n\n                "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"\r\n\n            },\r\n\n            "nonce": 1806341205,\r\n\n            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",\r\n\n            "receiver_vault_id": 9223372037390833737,\r\n\n            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "sender_vault_id": 9223372037733001032,\r\n\n            "signature": {\r\n\n                "r": "0x0",\r\n\n                "s": "0x0"\r\n\n            },\r\n\n            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",\r\n\n            "type": "TransferRequest"\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a ConditionalTransferRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "amount": "7106521602475165645",
            "expiration_timestamp": 2791313,
            "fact": "cd7110159df66d2b4164484d6440f7099f8492f5c20d4cde01009b0d4ab85bbf",
            "fact_registry_address": "0xCc6E2d20cC5AaFDCa329bA2d63e5ba5edD684B2F",
            "nonce": 1806341205,
            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",
            "receiver_vault_id": 9223372037390833737,
            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "sender_vault_id": 9223372037733001032,
            "signature": {
                "r": "0x0",
                "s": "0x0"
            },
            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",
            "type": "ConditionalTransferRequest"
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "amount": "7106521602475165645",

            "expiration_timestamp": 2791313,

            "fact": "cd7110159df66d2b4164484d6440f7099f8492f5c20d4cde01009b0d4ab85bbf",

            "fact_registry_address": "0xCc6E2d20cC5AaFDCa329bA2d63e5ba5edD684B2F",

            "nonce": 1806341205,

            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

            "receiver_vault_id": 9223372037390833737,

            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "sender_vault_id": 9223372037733001032,

            "signature": {

                "r": "0x0",

                "s": "0x0"

            },

            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

            "type": "ConditionalTransferRequest"

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "amount": "7106521602475165645",

            "expiration_timestamp": 2791313,

            "fact": "cd7110159df66d2b4164484d6440f7099f8492f5c20d4cde01009b0d4ab85bbf",

            "fact_registry_address": "0xCc6E2d20cC5AaFDCa329bA2d63e5ba5edD684B2F",

            "nonce": 1806341205,

            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

            "receiver_vault_id": 9223372037390833737,

            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "sender_vault_id": 9223372037733001032,

            "signature": {

                "r": "0x0",

                "s": "0x0"

            },

            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

            "type": "ConditionalTransferRequest"

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "amount": "7106521602475165645",

            "expiration_timestamp": 2791313,

            "fact": "cd7110159df66d2b4164484d6440f7099f8492f5c20d4cde01009b0d4ab85bbf",

            "fact_registry_address": "0xCc6E2d20cC5AaFDCa329bA2d63e5ba5edD684B2F",

            "nonce": 1806341205,

            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

            "receiver_vault_id": 9223372037390833737,

            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "sender_vault_id": 9223372037733001032,

            "signature": {

                "r": "0x0",

                "s": "0x0"

            },

            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

            "type": "ConditionalTransferRequest"

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "amount": "7106521602475165645",\r\n\n            "expiration_timestamp": 2791313,\r\n\n            "fact": "cd7110159df66d2b4164484d6440f7099f8492f5c20d4cde01009b0d4ab85bbf",\r\n\n            "fact_registry_address": "0xCc6E2d20cC5AaFDCa329bA2d63e5ba5edD684B2F",\r\n\n            "nonce": 1806341205,\r\n\n            "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",\r\n\n            "receiver_vault_id": 9223372037390833737,\r\n\n            "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "sender_vault_id": 9223372037733001032,\r\n\n            "signature": {\r\n\n                "r": "0x0",\r\n\n                "s": "0x0"\r\n\n            },\r\n\n            "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",\r\n\n            "type": "ConditionalTransferRequest"\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a DepositRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "amount": "4805234989534244506",
            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",
            "type": "DepositRequest",
            "vault_id": 9223372038661117013
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "amount": "4805234989534244506",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "DepositRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "amount": "4805234989534244506",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "DepositRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "amount": "4805234989534244506",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "DepositRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "amount": "4805234989534244506",\r\n\n            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",\r\n\n            "type": "DepositRequest",\r\n\n            "vault_id": 9223372038661117013\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a MintRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "amount": "1",
            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",
            "type": "MintRequest",
            "vault_id": 9223372038661117013
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "amount": "1",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "MintRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "amount": "1",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "MintRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "amount": "1",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "MintRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "amount": "1",\r\n\n            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",\r\n\n            "type": "MintRequest",\r\n\n            "vault_id": 9223372038661117013\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a WithdrawalRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "amount": "4805234989534244506",
            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",
            "type": "WithdrawalRequest",
            "vault_id": 9223372038661117013
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "amount": "4805234989534244506",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "WithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "amount": "4805234989534244506",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "WithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "amount": "4805234989534244506",

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

            "type": "WithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "amount": "4805234989534244506",\r\n\n            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",\r\n\n            "type": "WithdrawalRequest",\r\n\n            "vault_id": 9223372038661117013\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a FullWithdrawalRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "type": "FullWithdrawalRequest",
            "vault_id": 9223372038661117013
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "type": "FullWithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "type": "FullWithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "type": "FullWithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "type": "FullWithdrawalRequest",\r\n\n            "vault_id": 9223372038661117013\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a FalseFullWithdrawalRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "requester_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
            "type": "FalseFullWithdrawalRequest",
            "vault_id": 9223372038661117013
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "requester_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "type": "FalseFullWithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "requester_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "type": "FalseFullWithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "requester_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

            "type": "FalseFullWithdrawalRequest",

            "vault_id": 9223372038661117013

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "requester_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n            "type": "FalseFullWithdrawalRequest",\r\n\n            "vault_id": 9223372038661117013\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
Example for a MultiTransactionRequest

http

POST /v2/gateway/add_transaction HTTP/1.1
Host: localhost:9411
Accept: application/json

            {
        "tx": {
            "txs": [
                {
                    "amount": "4805234989534244506",
                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                    "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",
                    "type": "DepositRequest",
                    "vault_id": 9223372038661117013
                },
                {
                    "amount": "4805234989534244506",
                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                    "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",
                    "type": "WithdrawalRequest",
                    "vault_id": 9223372038661117013
                },
                {
                    "amount": "1",
                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                    "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",
                    "type": "MintRequest",
                    "vault_id": 9223372038661117013
                },
                {
                    "party_a_order": {
                        "amount_buy": "80",
                        "amount_sell": "70",
                        "expiration_timestamp": 3396833,
                        "nonce": 1654615998,
                        "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",
                        "signature": {
                            "r": "0x0",
                            "s": "0x0"
                        },
                        "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",
                        "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",
                        "type": "OrderL2Request",
                        "vault_id_buy": 9223372038941819365,
                        "vault_id_sell": 9223372037028654900
                    },
                    "party_b_order": {
                        "amount_buy": "30",
                        "amount_sell": "40",
                        "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",
                        "expiration_timestamp": 989173,
                        "fee_info": {
                            "fee_limit": "7",
                            "source_vault_id": 1,
                            "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"
                        },
                        "nonce": 577090037,
                        "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",
                        "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",
                        "type": "OrderL1Request",
                        "vault_id_buy": 1095513148,
                        "vault_id_sell": 271041745
                    },
                    "settlement_info": {
                        "party_a_sold": "30",
                        "party_b_fee_info": {
                            "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                            "destination_vault_id": 9223372038661117013,
                            "fee_taken": "1"
                        },
                        "party_b_sold": "40"
                    },
                    "type": "SettlementRequest"
                },
                {
                    "amount": "7106521602475165645",
                    "expiration_timestamp": 2791313,
                    "fee_info_exchange": {
                        "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                        "destination_vault_id": 9223372038661117013,
                        "fee_taken": "5"
                    },
                    "fee_info_user": {
                        "fee_limit": "15",
                        "source_vault_id": 9223372037454979375,
                        "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"
                    },
                    "nonce": 1806341205,
                    "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",
                    "receiver_vault_id": 9223372037390833737,
                    "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                    "sender_vault_id": 9223372037733001032,
                    "signature": {
                        "r": "0x0",
                        "s": "0x0"
                    },
                    "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",
                    "type": "TransferRequest"
                }
            ],
            "type": "MultiTransactionRequest"
        },
        "tx_id": 1234
    }

curl

curl -i -X POST https://localhost:9411/v2/gateway/add_transaction -H "Accept: application/json" --data-raw '{

        "tx": {

            "txs": [

                {

                    "amount": "4805234989534244506",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "DepositRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "amount": "4805234989534244506",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "WithdrawalRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "amount": "1",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "MintRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "party_a_order": {

                        "amount_buy": "80",

                        "amount_sell": "70",

                        "expiration_timestamp": 3396833,

                        "nonce": 1654615998,

                        "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",

                        "signature": {

                            "r": "0x0",

                            "s": "0x0"

                        },

                        "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",

                        "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",

                        "type": "OrderL2Request",

                        "vault_id_buy": 9223372038941819365,

                        "vault_id_sell": 9223372037028654900

                    },

                    "party_b_order": {

                        "amount_buy": "30",

                        "amount_sell": "40",

                        "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",

                        "expiration_timestamp": 989173,

                        "fee_info": {

                            "fee_limit": "7",

                            "source_vault_id": 1,

                            "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"

                        },

                        "nonce": 577090037,

                        "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",

                        "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",

                        "type": "OrderL1Request",

                        "vault_id_buy": 1095513148,

                        "vault_id_sell": 271041745

                    },

                    "settlement_info": {

                        "party_a_sold": "30",

                        "party_b_fee_info": {

                            "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                            "destination_vault_id": 9223372038661117013,

                            "fee_taken": "1"

                        },

                        "party_b_sold": "40"

                    },

                    "type": "SettlementRequest"

                },

                {

                    "amount": "7106521602475165645",

                    "expiration_timestamp": 2791313,

                    "fee_info_exchange": {

                        "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                        "destination_vault_id": 9223372038661117013,

                        "fee_taken": "5"

                    },

                    "fee_info_user": {

                        "fee_limit": "15",

                        "source_vault_id": 9223372037454979375,

                        "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"

                    },

                    "nonce": 1806341205,

                    "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

                    "receiver_vault_id": 9223372037390833737,

                    "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "sender_vault_id": 9223372037733001032,

                    "signature": {

                        "r": "0x0",

                        "s": "0x0"

                    },

                    "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

                    "type": "TransferRequest"

                }

            ],

            "type": "MultiTransactionRequest"

        },

        "tx_id": 1234

    }'

wget

wget -S -O- https://localhost:9411/v2/gateway/add_transaction --header="Accept: application/json" --post-data='{

        "tx": {

            "txs": [

                {

                    "amount": "4805234989534244506",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "DepositRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "amount": "4805234989534244506",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "WithdrawalRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "amount": "1",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "MintRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "party_a_order": {

                        "amount_buy": "80",

                        "amount_sell": "70",

                        "expiration_timestamp": 3396833,

                        "nonce": 1654615998,

                        "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",

                        "signature": {

                            "r": "0x0",

                            "s": "0x0"

                        },

                        "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",

                        "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",

                        "type": "OrderL2Request",

                        "vault_id_buy": 9223372038941819365,

                        "vault_id_sell": 9223372037028654900

                    },

                    "party_b_order": {

                        "amount_buy": "30",

                        "amount_sell": "40",

                        "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",

                        "expiration_timestamp": 989173,

                        "fee_info": {

                            "fee_limit": "7",

                            "source_vault_id": 1,

                            "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"

                        },

                        "nonce": 577090037,

                        "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",

                        "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",

                        "type": "OrderL1Request",

                        "vault_id_buy": 1095513148,

                        "vault_id_sell": 271041745

                    },

                    "settlement_info": {

                        "party_a_sold": "30",

                        "party_b_fee_info": {

                            "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                            "destination_vault_id": 9223372038661117013,

                            "fee_taken": "1"

                        },

                        "party_b_sold": "40"

                    },

                    "type": "SettlementRequest"

                },

                {

                    "amount": "7106521602475165645",

                    "expiration_timestamp": 2791313,

                    "fee_info_exchange": {

                        "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                        "destination_vault_id": 9223372038661117013,

                        "fee_taken": "5"

                    },

                    "fee_info_user": {

                        "fee_limit": "15",

                        "source_vault_id": 9223372037454979375,

                        "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"

                    },

                    "nonce": 1806341205,

                    "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

                    "receiver_vault_id": 9223372037390833737,

                    "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "sender_vault_id": 9223372037733001032,

                    "signature": {

                        "r": "0x0",

                        "s": "0x0"

                    },

                    "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

                    "type": "TransferRequest"

                }

            ],

            "type": "MultiTransactionRequest"

        },

        "tx_id": 1234

    }'

httpie

echo '{

        "tx": {

            "txs": [

                {

                    "amount": "4805234989534244506",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "DepositRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "amount": "4805234989534244506",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "WithdrawalRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "amount": "1",

                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",

                    "type": "MintRequest",

                    "vault_id": 9223372038661117013

                },

                {

                    "party_a_order": {

                        "amount_buy": "80",

                        "amount_sell": "70",

                        "expiration_timestamp": 3396833,

                        "nonce": 1654615998,

                        "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",

                        "signature": {

                            "r": "0x0",

                            "s": "0x0"

                        },

                        "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",

                        "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",

                        "type": "OrderL2Request",

                        "vault_id_buy": 9223372038941819365,

                        "vault_id_sell": 9223372037028654900

                    },

                    "party_b_order": {

                        "amount_buy": "30",

                        "amount_sell": "40",

                        "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",

                        "expiration_timestamp": 989173,

                        "fee_info": {

                            "fee_limit": "7",

                            "source_vault_id": 1,

                            "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"

                        },

                        "nonce": 577090037,

                        "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",

                        "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",

                        "type": "OrderL1Request",

                        "vault_id_buy": 1095513148,

                        "vault_id_sell": 271041745

                    },

                    "settlement_info": {

                        "party_a_sold": "30",

                        "party_b_fee_info": {

                            "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                            "destination_vault_id": 9223372038661117013,

                            "fee_taken": "1"

                        },

                        "party_b_sold": "40"

                    },

                    "type": "SettlementRequest"

                },

                {

                    "amount": "7106521602475165645",

                    "expiration_timestamp": 2791313,

                    "fee_info_exchange": {

                        "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                        "destination_vault_id": 9223372038661117013,

                        "fee_taken": "5"

                    },

                    "fee_info_user": {

                        "fee_limit": "15",

                        "source_vault_id": 9223372037454979375,

                        "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"

                    },

                    "nonce": 1806341205,

                    "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",

                    "receiver_vault_id": 9223372037390833737,

                    "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",

                    "sender_vault_id": 9223372037733001032,

                    "signature": {

                        "r": "0x0",

                        "s": "0x0"

                    },

                    "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",

                    "type": "TransferRequest"

                }

            ],

            "type": "MultiTransactionRequest"

        },

        "tx_id": 1234

    }' | http POST https://localhost:9411/v2/gateway/add_transaction Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/add_transaction', headers={'Accept': 'application/json'}, data='{\r\n\n        "tx": {\r\n\n            "txs": [\r\n\n                {\r\n\n                    "amount": "4805234989534244506",\r\n\n                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                    "token_id": "0x3d0ea808d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",\r\n\n                    "type": "DepositRequest",\r\n\n                    "vault_id": 9223372038661117013\r\n\n                },\r\n\n                {\r\n\n                    "amount": "4805234989534244506",\r\n\n                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                    "token_id": "0x7a1d5008d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",\r\n\n                    "type": "WithdrawalRequest",\r\n\n                    "vault_id": 9223372038661117013\r\n\n                },\r\n\n                {\r\n\n                    "amount": "1",\r\n\n                    "stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                    "token_id": "0x400f43a8d723104f77383c13458a748e9bb17bca3f2c9bf9c6316b950f24455",\r\n\n                    "type": "MintRequest",\r\n\n                    "vault_id": 9223372038661117013\r\n\n                },\r\n\n                {\r\n\n                    "party_a_order": {\r\n\n                        "amount_buy": "80",\r\n\n                        "amount_sell": "70",\r\n\n                        "expiration_timestamp": 3396833,\r\n\n                        "nonce": 1654615998,\r\n\n                        "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",\r\n\n                        "signature": {\r\n\n                            "r": "0x0",\r\n\n                            "s": "0x0"\r\n\n                        },\r\n\n                        "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",\r\n\n                        "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",\r\n\n                        "type": "OrderL2Request",\r\n\n                        "vault_id_buy": 9223372038941819365,\r\n\n                        "vault_id_sell": 9223372037028654900\r\n\n                    },\r\n\n                    "party_b_order": {\r\n\n                        "amount_buy": "30",\r\n\n                        "amount_sell": "40",\r\n\n                        "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",\r\n\n                        "expiration_timestamp": 989173,\r\n\n                        "fee_info": {\r\n\n                            "fee_limit": "7",\r\n\n                            "source_vault_id": 1,\r\n\n                            "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"\r\n\n                        },\r\n\n                        "nonce": 577090037,\r\n\n                        "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",\r\n\n                        "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",\r\n\n                        "type": "OrderL1Request",\r\n\n                        "vault_id_buy": 1095513148,\r\n\n                        "vault_id_sell": 271041745\r\n\n                    },\r\n\n                    "settlement_info": {\r\n\n                        "party_a_sold": "30",\r\n\n                        "party_b_fee_info": {\r\n\n                            "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                            "destination_vault_id": 9223372038661117013,\r\n\n                            "fee_taken": "1"\r\n\n                        },\r\n\n                        "party_b_sold": "40"\r\n\n                    },\r\n\n                    "type": "SettlementRequest"\r\n\n                },\r\n\n                {\r\n\n                    "amount": "7106521602475165645",\r\n\n                    "expiration_timestamp": 2791313,\r\n\n                    "fee_info_exchange": {\r\n\n                        "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                        "destination_vault_id": 9223372038661117013,\r\n\n                        "fee_taken": "5"\r\n\n                    },\r\n\n                    "fee_info_user": {\r\n\n                        "fee_limit": "15",\r\n\n                        "source_vault_id": 9223372037454979375,\r\n\n                        "token_id": "0x23a77118133287637ebdcd9e87a1613e443df789558867f5ba91faf7a024204"\r\n\n                    },\r\n\n                    "nonce": 1806341205,\r\n\n                    "receiver_public_key": "0x4d2b9de1beb37117d41e602eece328bff7b118e820865d6e005b86051ef1922",\r\n\n                    "receiver_vault_id": 9223372037390833737,\r\n\n                    "sender_public_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",\r\n\n                    "sender_vault_id": 9223372037733001032,\r\n\n                    "signature": {\r\n\n                        "r": "0x0",\r\n\n                        "s": "0x0"\r\n\n                    },\r\n\n                    "token": "0xff18e042af9fc385776e9add84f39e71545a137a1d50068d723104f77383c1",\r\n\n                    "type": "TransferRequest"\r\n\n                }\r\n\n            ],\r\n\n            "type": "MultiTransactionRequest"\r\n\n        },\r\n\n        "tx_id": 1234\r\n\n    }')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "TRANSACTION_PENDING"}
async get_first_unused_tx_id(request)

Gets the next transaction id that all of its predecessors exist in the system. If no ids exist in the system - then 0 will be returned.

While most of the time this implies the next tx_id used should be the returned value, this is not guaranteed, since while this value is returned, some new transaction may be written, rendering the returned response irrelevant.

Returns

The next consecutive tx_id, all of its predecessors exist in our system.

Return type

int

Example

http

GET /v2/gateway/testing/get_first_unused_tx_id HTTP/1.1
Host: localhost:9411
Accept: application/json

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 8

5678

curl

curl -i -X GET https://localhost:9411/v2/gateway/testing/get_first_unused_tx_id -H "Accept: application/json" --data-raw 'HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 8



5678'

wget

wget -S -O- https://localhost:9411/v2/gateway/testing/get_first_unused_tx_id --header="Accept: application/json" --body-data='HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 8



5678'

httpie

echo 'HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 8



5678' | http https://localhost:9411/v2/gateway/testing/get_first_unused_tx_id Accept:application/json

python-requests

requests.get('https://localhost:9411/v2/gateway/testing/get_first_unused_tx_id', headers={'Accept': 'application/json'}, data='HTTP/1.1 200 OK\r\n\nContent-Type: text/plain; charset=utf-8\r\n\nContent-Length: 8\r\n\n\r\n\n5678')
async get_stark_dex_address(request)

Get the StarkEx contract address. This is the address used for registering keys and tokens, and performing onchain deposits and withdrawals.

Returns

On-chain StarkEx contract address.

Return type

str

Example

http

GET /v2/gateway/testing/get_stark_dex_address HTTP/1.1
Host: localhost:9411
Accept: application/json

curl

curl -i -X GET https://localhost:9411/v2/gateway/testing/get_stark_dex_address -H "Accept: application/json"

wget

wget -S -O- https://localhost:9411/v2/gateway/testing/get_stark_dex_address --header="Accept: application/json"

httpie

http https://localhost:9411/v2/gateway/testing/get_stark_dex_address Accept:application/json

python-requests

requests.get('https://localhost:9411/v2/gateway/testing/get_stark_dex_address', headers={'Accept': 'application/json'})

response

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 44

"0x8013A6840804aA0DC68f544cBa0a9baF1bE2315A"
async get_time_spent_by_oldest_unaccepted_tx_in_system(request)

Returns the time (in seconds) that the tx_id following the last tx_id accepted on-chain has spent in the system. Returns -1 if no such tx_id exists.

For example, if the last accepted transaction was with tx id 100, this function will return the time spent in the system of transaction with tx id 101, in case this transaction exists and -1 otherwise.

Returns

Time spent in the system of the next tx id which was not accepted onchain.

Return type

int

Example

http

GET /get_time_spent_by_oldest_unaccepted_tx_in_system HTTP/1.1
Host: localhost:9411
Accept: application/json

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 8

120

curl

curl -i -X GET https://localhost:9411/get_time_spent_by_oldest_unaccepted_tx_in_system -H "Accept: application/json" --data-raw 'HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 8



120'

wget

wget -S -O- https://localhost:9411/get_time_spent_by_oldest_unaccepted_tx_in_system --header="Accept: application/json" --body-data='HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 8



120'

httpie

echo 'HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 8



120' | http https://localhost:9411/get_time_spent_by_oldest_unaccepted_tx_in_system Accept:application/json

python-requests

requests.get('https://localhost:9411/get_time_spent_by_oldest_unaccepted_tx_in_system', headers={'Accept': 'application/json'}, data='HTTP/1.1 200 OK\r\n\nContent-Type: text/plain; charset=utf-8\r\n\nContent-Length: 8\r\n\n\r\n\n120')
async get_transaction(request)

Get specific transaction’s information.

Parameters

tx_id (int) – Transaction ID to query.

Returns

Information of the queried transaction (json).

Return type

str

Example

http

GET /v2/gateway/get_transaction?tx_id=1234 HTTP/1.1
Host: localhost:9411
Accept: application/json

curl

curl -i -X GET 'https://localhost:9411/v2/gateway/get_transaction?tx_id=1234' -H "Accept: application/json"

wget

wget -S -O- 'https://localhost:9411/v2/gateway/get_transaction?tx_id=1234' --header="Accept: application/json"

httpie

http 'https://localhost:9411/v2/gateway/get_transaction?tx_id=1234' Accept:application/json

python-requests

requests.get('https://localhost:9411/v2/gateway/get_transaction?tx_id=1234', headers={'Accept': 'application/json'})

response

HTTP/1.1 200 OK
Content-Type: application/json

    {
        "party_a_order": {
            "amount_buy": "80",
            "amount_sell": "70",
            "expiration_timestamp": 3396833,
            "nonce": 1654615998,
            "public_key": "0x19c78df8f4ff31e78de58575487ce1eaf19922ad9b8a714e61a441c12e0c8b2",
            "signature": {
                "r": "0x0",
                "s": "0x0"
            },
            "token_buy": "0x22222222222222222222222222222222222222222222222222222222222222",
            "token_sell": "0x11111111111111111111111111111111111111111111111111111111111111",
            "type": "OrderL2Request",
            "vault_id_buy": 9223372038941819365,
            "vault_id_sell": 9223372037028654900
        },
        "party_b_order": {
            "amount_buy": "30",
            "amount_sell": "40",
            "eth_address": "0xa9eb20c9A09F5eD00BE849049a554A60CCe4fC27",
            "expiration_timestamp": 989173,
            "fee_info": {
                "fee_limit": "7",
                "source_vault_id": 1,
                "token_id": "0x22222222222222222222222222222222222222222222222222222222222222"
            },
            "nonce": 577090037,
            "token_buy": "0x11111111111111111111111111111111111111111111111111111111111111",
            "token_sell": "0x22222222222222222222222222222222222222222222222222222222222222",
            "type": "OrderL1Request",
            "vault_id_buy": 1095513148,
            "vault_id_sell": 271041745
        },
        "settlement_info": {
            "party_a_sold": "30",
            "party_b_fee_info": {
                "destination_stark_key": "0x6f25e2a5a92118719c78df48f4ff31e78de58575487ce1eaf19922ad9b8a714",
                "destination_vault_id": 9223372038661117013,
                "fee_taken": "1"
            },
            "party_b_sold": "40"
        },
        "type": "SettlementRequest"
    }
async mark_transaction_for_replacement(request)

Marks the transaction specified in request as needing replacement. This means that when a transaction is processed, we will request a replacement transaction from the customer. Note:

  • This does not guarantee that a transaction will be replaced, since it may already have been processed.

  • All future attempts to process this transaction will result in a replacement request even if a replacement was already provided.

  • This marking will hold for the given tx_id even if no transaction exists at the time of marking.

  • This marking is irrevocable.

Returns

Success/failure message of the marking. Success does not imply that the original transaction has been prevented from being processed.

Return type

str

Example

http

POST /v2/gateway/mark_transaction_for_replacement?tx_id=1 HTTP/1.1
Host: localhost:9411
Accept: application/plain

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 38

"transaction 1 marked for replacement"

curl

curl -i -X POST 'https://localhost:9411/v2/gateway/mark_transaction_for_replacement?tx_id=1' -H "Accept: application/plain" --data-raw 'HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 38



"transaction 1 marked for replacement"'

wget

wget -S -O- 'https://localhost:9411/v2/gateway/mark_transaction_for_replacement?tx_id=1' --header="Accept: application/plain" --post-data='HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 38



"transaction 1 marked for replacement"'

httpie

echo 'HTTP/1.1 200 OK

Content-Type: text/plain; charset=utf-8

Content-Length: 38



"transaction 1 marked for replacement"' | http POST 'https://localhost:9411/v2/gateway/mark_transaction_for_replacement?tx_id=1' Accept:application/plain

python-requests

requests.post('https://localhost:9411/v2/gateway/mark_transaction_for_replacement?tx_id=1', headers={'Accept': 'application/plain'}, data='HTTP/1.1 200 OK\r\n\nContent-Type: text/plain; charset=utf-8\r\n\nContent-Length: 38\r\n\n\r\n\n"transaction 1 marked for replacement"')
async set_alternative_endpoint_config(request)

Updates the alternative-transaction endpoint configuration. This type of request is allowed only in setups that support dynamically configuring the endpoint for alternative transactions.

Note: The updated configuration will be used by the alternative-transaction mechanism only if dynamic configuration is enabled.

The dynamic configuration request class: AlternativeEndpointSettingRequest

Returns

A message stating if the configuration request is accepted or rejected.

Return type

str

Example

http

POST /v2/gateway/set_alternative_endpoint_config HTTP/1.1
Host: localhost:9411
Accept: application/json

{
    "bearer_token": "123-456-789",
    "client_certificate": null,
    "client_key": null,
    "failure_description_url": null,
    "server_certificate": null,
    "url": "https://sample-alternative-tx-endpoint"
}

curl

curl -i -X POST https://localhost:9411/v2/gateway/set_alternative_endpoint_config -H "Accept: application/json" --data-raw '{

    "bearer_token": "123-456-789",

    "client_certificate": null,

    "client_key": null,

    "failure_description_url": null,

    "server_certificate": null,

    "url": "https://sample-alternative-tx-endpoint"

}'

wget

wget -S -O- https://localhost:9411/v2/gateway/set_alternative_endpoint_config --header="Accept: application/json" --post-data='{

    "bearer_token": "123-456-789",

    "client_certificate": null,

    "client_key": null,

    "failure_description_url": null,

    "server_certificate": null,

    "url": "https://sample-alternative-tx-endpoint"

}'

httpie

echo '{

    "bearer_token": "123-456-789",

    "client_certificate": null,

    "client_key": null,

    "failure_description_url": null,

    "server_certificate": null,

    "url": "https://sample-alternative-tx-endpoint"

}' | http POST https://localhost:9411/v2/gateway/set_alternative_endpoint_config Accept:application/json

python-requests

requests.post('https://localhost:9411/v2/gateway/set_alternative_endpoint_config', headers={'Accept': 'application/json'}, data='{\r\n\n    "bearer_token": "123-456-789",\r\n\n    "client_certificate": null,\r\n\n    "client_key": null,\r\n\n    "failure_description_url": null,\r\n\n    "server_certificate": null,\r\n\n    "url": "https://sample-alternative-tx-endpoint"\r\n\n}')

response

HTTP/1.1 200 OK
Content-Type: application/json

{"Alternative Strategy config is set"}