(operationType, sigPayload, params)
| 3202 | return signatureBase58; |
| 3203 | } |
| 3204 | postActionRequest(operationType, sigPayload, params) { |
| 3205 | this.checkRequiredCredentials(); // check credentials every post action |
| 3206 | if (operationType === 'undefined') { |
| 3207 | throw new ArgumentsRequired(this.id + ' action: ' + operationType + ' postActionRequest() requires "operationType"'); |
| 3208 | } |
| 3209 | if (!this.isSandboxModeEnabled) { // At this stage, building codes are mostly only on the mainnet. |
| 3210 | const useBuilder = this.handleOption('postActionRequest', 'builderFee', true); |
| 3211 | let builderCode = undefined; |
| 3212 | if (useBuilder) { |
| 3213 | builderCode = this.handleOption('postActionRequest', 'builderCode'); |
| 3214 | } |
| 3215 | if (builderCode !== undefined) { |
| 3216 | const isOperationSupportBuilder = this.safeBool(this.options['builderSupportOperations'], operationType, false); |
| 3217 | if (isOperationSupportBuilder) { |
| 3218 | sigPayload['builder_code'] = builderCode; |
| 3219 | } |
| 3220 | } |
| 3221 | } |
| 3222 | let expiryWindow = undefined; |
| 3223 | [expiryWindow, params] = this.handleOptionAndParams2(params, 'postActionRequest', 'expiryWindow', 'expiry_window', 5000); |
| 3224 | const timestamp = this.safeInteger(params, 'timestamp', this.milliseconds()); |
| 3225 | const signatureHeader = { |
| 3226 | 'timestamp': timestamp, |
| 3227 | 'expiry_window': expiryWindow, |
| 3228 | 'type': operationType, |
| 3229 | }; |
| 3230 | const signature = this.signMessage(signatureHeader, sigPayload, this.privateKey); |
| 3231 | const finalHeaders = {}; |
| 3232 | let agentAddress = undefined; |
| 3233 | [agentAddress, params] = this.handleOptionAndParams(params, 'postActionRequest', 'agentAddress'); |
| 3234 | let originAddress = undefined; |
| 3235 | [originAddress, params] = this.handleOriginAndSingleAddress('postActionRequest', params); |
| 3236 | if (originAddress === undefined) { |
| 3237 | throw new ArgumentsRequired(this.id + ' action: ' + operationType + ' postActionRequest() requires "originAddress" in params or "walletAddress" in requiredCredentials'); |
| 3238 | } |
| 3239 | finalHeaders['account'] = originAddress; |
| 3240 | if (agentAddress !== undefined) { |
| 3241 | finalHeaders['agent_wallet'] = agentAddress; |
| 3242 | } |
| 3243 | finalHeaders['signature'] = signature; |
| 3244 | finalHeaders['timestamp'] = this.safeInteger(signatureHeader, 'timestamp'); |
| 3245 | finalHeaders['expiry_window'] = this.safeInteger(signatureHeader, 'expiry_window'); |
| 3246 | const request = this.extend(finalHeaders, sigPayload); |
| 3247 | return request; |
| 3248 | } |
| 3249 | } |
no test coverage detected