SDK Implementation Guide

Wiskers App REST API Documentation

Overview

The Wiskers API facilitates interactions with the Wiskers platform, enabling users to manage actions, authenticate, and handle referrals. See Below for the implementation guide.

Base URL

https://beta.wiskers.app/api

Endpoints

Authentication
All requests to the Wiskers App API must be authenticated with a token. This token is obtained by signing in through the /auth/signin endpoint and then used in subsequent requests.
Signing In and Token Generation
  • Endpoint: /auth/signin
  • Method: POST
  • Description:
    • Authenticates the user and generates a token for session management.
    • signature has to be of this string Wiskers login for {address}, with address being replaced by the used address.
  • Body Parameters:
    • address (String): The address of the user's account.
    • signature (String): Signature obtained from signing a the auth message..
    • refCode (String, optional): Referral code, if any.
  • Response:
    • success (Boolean): Indicates if the request was successful.
    • jwt Token to auth all future requests.

Referral Management

Get Referral Stats
  • Endpoint: /referrals/getReferralStats
  • Method: GET
  • Description: Retrieves statistics and codes related to the user's referrals.
  • Response:
    • success (Boolean): Indicates if the request was successful.
    • ownCode (String): The user's own referral code.
    • codes (Array): List of referral codes.
Create Referral Code
  • Endpoint: /referrals/createReferralCode
  • Method: POST
  • Body:
    • referralCode (String): The referral code to create.
  • Response:
    • success (Boolean): Indicates if the code was successfully created.
    • reason (String, optional): Reason for failure, if applicable.

Action Management

Delete Action
  • Endpoint: /actions/deleteAction
  • Method: POST
  • Body:
    • actionHash (String): The hash of the action to delete.
  • Response:
    • success (Boolean): Indicates if the action was successfully deleted.
    • reason (String, optional): Reason for failure, if applicable.
Rename Action
  • Endpoint: /actions/renameAction
  • Method: POST
  • Body:
    • actionHash (String): The hash of the action to rename.
    • newName (String): The new name for the action.
  • Response:
    • success (Boolean): Indicates if the action was successfully renamed.
    • reason (String, optional): Reason for failure, if applicable.
Set Action State
  • Endpoint: /actions/setActionState
  • Method: POST
  • Body:
    • actionHash (String): The hash of the action.
    • state (String): The new state of the action.
  • Response:
    • success (Boolean): Indicates if the state was successfully changed.
    • reason (String, optional): Reason for failure, if applicable.
Reveal Webhook
  • Endpoint: /actions/revealWebhook
  • Method: POST
  • Description: Reveals the webhook details for a given action.
  • Response:
    • success (Boolean): Indicates if the webhook was successfully revealed.
    • webhook (String): The webhook URL.
Request Webhook Reveal
  • Endpoint: /actions/requestWebhookReveal
  • Method: POST
  • Body:
    • actionHash (String): The hash of the action.
  • Response:
    • success (Boolean): Indicates if the request was successful.
    • actionHash (String): The hash of the action.
    • nonce (String): A nonce for additional security.
Update Action
  • Endpoint: /actions/updateAction
  • Method: POST
  • Body:
    • actionHash (String): The hash of the action.
  • Response:
    • success (Boolean): Indicates if the action was successfully updated.

Create Action

  • Endpoint: /actions/createAction
  • Method: POST
  • Description:
    • Creates a new action based on the provided parameters. The action details must adhere to the IAction interface structure.
Body Parameters:
  • action (IAction Object):
    • A instance of IAction
  • signature (signature_t Object):
    • Signature object for verifying the action.
  • chainId (Number/String):
    • Identifier for the network.
  • type (String):
    • Type of the action (e.g., 'events', 'tradingview').
  • trigger (ITrigger Object):
    • Details about the trigger for the action.
signature_t:
  • _v (BigInt):
    • The recovery byte of the signature.
  • _r (Hex):
    • The first 32 bytes of the signature.
  • _s (Hex):
    • The second 32 bytes of the signature.
IAction:
  • targetContract (Address):
    • The contract address the action targets.
  • nonce (Number):
    • A unique number to prevent replay attacks.
  • creator (Address):
    • The address of the action's creator.
  • assetIn (Address):
    • The asset address involved in the action.
  • amountIn (BigInt):
    • The amount of the asset involved.
  • runLimit (BigInt):
    • The run limit of the action.
  • payload (Any):
    • Additional payload relevant to the action.
ITrigger:
  • method (String):
    • The method to be triggered, either "events" or "tradingview".
  • options (ITriggerOptions, optional):
    • Additional options for the trigger.
ITriggerOptions Interface:
  • contracts (Address[]):
    • Array of contract addresses involved in the trigger.
  • unconfirmed (Boolean):
    • Flag to include unconfirmed transactions.
  • topic (String):
    • Event topic, e.g., "Transfer(address,address,uint256)".
  • inputs (Object[]):
    • Array of objects representing arguments in the event, each with indexed, internalType, name, and type properties.
  • values (Object):
    • Object containing raw values for the inputs, e.g., {address: "0x...0"}.
  • filter (Object):
    • Advanced filtering options using logical and comparison operators.
Chaining Filters:
  • and Operator:
    • Combines multiple filters where all conditions must be met.
    • Example: { "and": [ { "eq": ["value", "1000"] }, { "gt": ["amount", "500"] } ] }
  • or Operator:
    • Combines multiple filters where at least one condition must be met.
    • Example: { "or": [ { "lt": ["value", "1000"] }, { "in": ["address", ["0x123...", "0x456..."]] } ] }
Using Comparison Operators:
  • eq (Equal): Checks if a value is equal to the specified value.
    • Example: { "eq": ["value", "1000"] }
  • ne (Not Equal): Checks if a value is not equal to the specified value.
    • Example: { "ne": ["address", "0x...325"] }
  • lt (Less Than): Checks if a value is less than the specified number.
    • Example: { "lt": ["amount", "50"] }
  • gt (Greater Than): Checks if a value is greater than the specified number.
    • Example: { "gt": ["price", "500000"] }
  • lte (Less Than or Equal): Checks if a value is less than or equal to the specified number.
    • Example: { "lte": ["value", "100"] }
  • gte (Greater Than or Equal): Checks if a value is greater than or equal to the specified number.
    • Example: { "gte": ["value", "100"] }
    For further details about applying filters, please check https://docs.moralis.io/streams-api/evm/streams-configuration/filter-streams
Example of ITriggerOptions:
{
type: "events",
contracts: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
unconfirmed: false,
topic: "Transfer(address,address,uint256)",
inputs: [
{ indexed: true, internalType: "address", name: "from", type: "address" },
{ indexed: true, internalType: "address", name: "to", type: "address" },
{ indexed: false, internalType: "uint256", name: "value", type: "uint256" }
],
values: { to: "0x0000000000000000000000000000000000000000" },
filter: {
{ "eq": ["to", "0x0000000000000000000000000000000000000000"] },
}
}
Payload Encoding:
  • For uniswapv2 type actions:
    • Encode with:
      encodeAbiParameters(
      [
      { name: 'assetOut', type: 'address' },// asset to buy with assetIn
      { name: 'slippage', type: 'uint16' }, // slippage 100_00 = 100%
      { name: 'amountInPercent', type: 'bool' } // boolean, true = amount is in percent, 100_00 = 100%
      ],
      [assetOut, slippage, precision]
      );
  • For uniswapv3 type actions:
    • Encode with:
      encodeAbiParameters(
      [
      { name: 'assetOut', type: 'address' }, // asset to buy with assetIn
      { name: 'slippage', type: 'uint16' }, // slippage 100_00 = 100%
      { name: 'amountInPercent', type: 'bool' }, // boolean, true = amount is in percent, 100_00 = 100%
      { name: 'poolFee', type: 'uint24' } // selected poolFee for univ3
      ],
      [assetOut, slippage, precision, poolFee]
      );
Responses:
  • Success:
    • success: true
    • type: Type of the created action (if applicable).
    • actionHash: Hash of the created action (if applicable).
    • trigger: Details of the trigger for the created action (if applicable).
    • webhook: Webhook URL (if applicable for the action type).
  • Failure:
    • success: false
    • error: Specific error message explaining the reason for failure.
Last modified 2mo ago