I’m trying to execute the following series of actions in an orderly fashion.
When current user clicks the ‘SELL’ button, the following occurs. All these actions need to happen at the click of the ‘SELL’ button.
A fresh timestamp gets generated using the following command:
TimeStamp = Current date/time:extract UNIX
Concatenate the following two strings together (note String 2 is the TimeStamp from step 1):
String 1 = ‘symbol=VETUSDT&side=SELL&type=MARKET&quantity=1&recvWindow=60000000×tamp=’
String 2 = TimeStamp
String 3 = String 1 + String 2
Generate a SHA-256 encryption of the following two items:
Item 1 = ‘symbol=VETUSDT&side=SELL&type=MARKET&quantity=1&recvWindow=60000000×tamp=TimeStamp’ (or String 3 from above)
Item 2 = ‘NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j’ (This is the Static Secret Key)
Output = SHA-256 Encryption of (Item 1, Item 2)
*** For this, I use a plugin called ‘Base64, Hash & HMAC Encryptor’
Perform an API Call (*** For this, I use the API Connector) and pass in the TimeStamp and Output from Step 3:
Someone smarter than I may weigh in, but can you create multiple custom events (or api endpoints, if you prefer doing this all in the api), each with 1 of your steps, where once each one is finished, it calls the next event? That way, you’ll be sure each step is done before the next one.
Schedule API Workflow. This runs it in the background, giving control of the page back to the user without waiting for it to finish. The page would rely on some database update to know any results.
API Connector to your own app endpoint. This runs the workflow, and shows Bubble’s progress bar while it runs, then optionally accepts a result from the workflow when it has one.
I have this server script, which generates the correct timestamp, but something is off with the signature as the API returns the signature is not valid error
This is one of the canonical use cases of Bubble’s Custom Events and Custom Event Triggering. Each event triggers the next event in the chain. Thereby guaranteeing consecutive execution. Even scheduling API calls does not provide as strong guarantees of consecutive execution. If you have every played around with Javascript’s setTimeout you’ll understand why.