zksync-sdk / zksync-python

Python 3.8 SDK for zkSync
MIT License
116 stars 64 forks source link

fix for ZSDK-77, Serialize big integers as strings: amounts, fees and ratio #42

Closed vyastrebovvareger closed 2 years ago

vyastrebovvareger commented 2 years ago

Dumped Json request with this changes:

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "tx_submit",
    "params": [
        {
            "type": "Swap",
            "submitterId": 36357,
            "submitterAddress": "0x995A8B7F96cB837533b79775b6209696D51f435C",
            "feeToken": 0,
            "fee": "29600000000000",
            "nonce": 4694,
            "signature": {
                "pubKey": "c5f281dbaed050c711bef0e48f74cc32046f82d0f814fb891f2da81c5f5f512b",
                "signature": "3b9c4d802f08b42c1724ed1675abf7e96316349fea6bbd1ffbac48a17e3f3eae0ca8712b5321c4dbf4f6c04ba55157aabfc1382e81774c5d63c38b2223409e00"
            },
            "amounts": [
                "1000000",
                "700000000000000"
            ],
            "orders": [
                {
                    "accountId": 36357,
                    "recipient": "0x995A8B7F96cB837533b79775b6209696D51f435C",
                    "nonce": 4694,
                    "tokenSell": 1,
                    "tokenBuy": 0,
                    "amount": "1000000",
                    "ratio": [
                        "3",
                        "2000000000"
                    ],
                    "validFrom": 0,
                    "validUntil": 4294967295,
                    "signature": {
                        "pubKey": "c5f281dbaed050c711bef0e48f74cc32046f82d0f814fb891f2da81c5f5f512b",
                        "signature": "0139813b5c11a8a46f3b63905519fb0c112065949b70828ac0fb5a0274c07e9ba2e6da16ca51be213e88eebc1df4d88bdeb3d75aafc14216d044919cb40bd203"
                    },
                    "ethSignature": {
                        "type": "EthereumSignature",
                        "signature": "0x6fa2a11f4dad64cc54e53e65f0d4fe365412919b3f74bcc3692174bd6d084d3a5b523cf6a397edd007981b6ca60cdaa7fb32763063ed45787b0a86795d8330cc1c"
                    }
                },
                {
                    "accountId": 182280,
                    "recipient": "0x800455Ca06265D0Cf742086663a527D7c08049Fc",
                    "nonce": 534,
                    "tokenSell": 0,
                    "tokenBuy": 1,
                    "amount": "700000000000000",
                    "ratio": [
                        "2500000000",
                        "3"
                    ],
                    "validFrom": 0,
                    "validUntil": 4294967295,
                    "signature": {
                        "pubKey": "4aba48964e109b2dea104ab757156267723eb6d2a3c707a951ef6c86ab535b93",
                        "signature": "6639b8208b03220ef196facd14804d9b77d4c46f78701a8425c03fd461c6248684a4acfafee5f203a16691617a047cd409bff7618440617ee1a5e04067c6ab01"
                    },
                    "ethSignature": {
                        "type": "EthereumSignature",
                        "signature": "0x553ba8ea004334780215ed4d42df2347b1decb235a60413906f0d317b0a73e3763556a4b505aa822071c20e885dc1369a6d1a5c232381b56203d02492d377eb71c"
                    }
                }
            ]
        },
        [
            {
                "type": "EthereumSignature",
                "signature": "0x834afd3b00c6b9c676ab16d12316dddfc6ed6fefacc11884e085c91a16a83a0f01cf4a0a744187209e53207ab092a2deb25a0088e240a203ff85f36059572d1d1c"
            },
            {
                "type": "EthereumSignature",
                "signature": "0x6fa2a11f4dad64cc54e53e65f0d4fe365412919b3f74bcc3692174bd6d084d3a5b523cf6a397edd007981b6ca60cdaa7fb32763063ed45787b0a86795d8330cc1c"
            },
            {
                "type": "EthereumSignature",
                "signature": "0x553ba8ea004334780215ed4d42df2347b1decb235a60413906f0d317b0a73e3763556a4b505aa822071c20e885dc1369a6d1a5c232381b56203d02492d377eb71c"
            }
        ],
        false
    ]
}
StanislavBreadless commented 2 years ago

@vyastrebovvareger please make the CI pass and merge it rightaway