MCPcopy Create free account
hub / github.com/ccxt/ccxt / postActionRequest

Method postActionRequest

js/src/pacifica.js:3204–3248  ·  view source on GitHub ↗
(operationType, sigPayload, params)

Source from the content-addressed store, hash-verified

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}

Callers 14

createOrderRequestMethod · 0.95
cancelOrderRequestMethod · 0.95
editOrderRequestMethod · 0.95
setMarginModeMethod · 0.95
setLeverageMethod · 0.95
withdrawMethod · 0.95
transferMethod · 0.95
bindAgentWalletMethod · 0.95
createApiKeyMethod · 0.95
revokeApiKeyMethod · 0.95
fetchApiKeysMethod · 0.95

Calls 10

signMessageMethod · 0.95
handleOptionMethod · 0.45
safeBoolMethod · 0.45
safeIntegerMethod · 0.45
millisecondsMethod · 0.45
handleOptionAndParamsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected