Wallets

Wallets are secure containers for managing digital assets. Fystack offers different wallet types to suit your needs, including standard wallets and MPC (Multi-Party Computation) wallets.


POST/wallets

Create a wallet

To create a new wallet, send a POST request to the /wallets endpoint with the required parameters.

Required parameters

  • Name
    workspace_id
    Type
    string
    Description

    The UUID of the workspace where the wallet will be created. Must be a valid UUID.

  • Name
    name
    Type
    string
    Description

    A descriptive name for the wallet.

  • Name
    wallet_type
    Type
    string
    Description

    The type of wallet to create. Must be either standard or mpc.

Response

  • Name
    success
    Type
    boolean
    Description

    Indicates whether the request was successful.

  • Name
    message
    Type
    string
    Description

    A message describing the result of the operation.

  • Name
    code
    Type
    integer
    Description

    A numeric code indicating the result status (0 for success).

  • Name
    data
    Type
    object
    Description

    Contains the wallet details.

  • Name
    wallet_id
    Type
    string
    Description

    The UUID of the newly created wallet.

  • Name
    status
    Type
    string
    Description

    The current status of the wallet creation process.

Request

POST
/wallets
import { FystackSDK, Environment } from "@fystack/sdk"
const sdk = new FystackSDK({
credentials: apiCredentials,
environment: Environment.Sandbox,
logger: true
})
const apiCredentials = {
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET
}
await sdk.createWallet({
name: 'MPC wallet 1',
walletType: WalletType.MPC
})

Response

{
  "success": true,
  "message": "success",
  "code": 0,
  "data": {
    "wallet_id": "c2b71329-34c9-45aa-89d3-ddde8b15dec5",
    "status": "pending"
  }
}

Wallet creation status

When you create a wallet, the process happens asynchronously. The initial response will include a status field with one of the following values:

  • pending: The wallet creation process has started but is not yet complete.
  • success: The wallet has been successfully created.
  • error: There was an error creating the wallet.

For standard wallet types, the status will be success immediately after creation.

For mpc wallet types, the creation process may take longer as it involves secure key generation across multiple parties.

GET/wallets

List all wallets

This endpoint allows you to retrieve a paginated list of all wallets in your workspace.

Optional parameters

  • Name
    workspace_id
    Type
    string
    Description

    Filter wallets by workspace ID.

  • Name
    wallet_type
    Type
    string
    Description

    Filter wallets by type.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of wallets returned.

  • Name
    offset
    Type
    integer
    Description

    Number of wallets to skip before starting to return results.

Request

curl -X GET https://api.fystack.com/v1/wallets \
  -H "Authorization: Bearer {token}" \
  -G \
  -d workspace_id=123e4567-e89b-12d3-a456-426614174000

Response

{
  "wallets": [
    {
      "id": "7f89a112-3b8f-4eeb-9e0f-124c76bfb2e0",
      "workspace_id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "MPC wallet",
      "wallet_type": "standard",
      "status": "success",
      "created_at": "2023-01-01T12:00:00Z"
    },
    {
      "id": "8a91b223-4c9f-5ffc-0f1g-235787cfc3f1",
      "workspace_id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Standard wallet",
      "wallet_type": "standard",
      "status": "success",
      "created_at": "2023-01-02T14:30:00Z"
    }
  ],
  "pagination": {
    "total": 2,
    "limit": 10,
    "offset": 0
  }
}

Wallet types

Fystack supports the following wallet types:

  • Standard Wallet: A traditional wallet with a single private key.
  • MPC Wallet: A wallet that uses Multi-Party Computation to distribute the private key across multiple parties, enhancing security.

Choose the wallet type that best suits your security requirements and use case.