JSPM

@settlemint/sdk-portal

2.3.5-pr7d32f664
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6319
  • Score
    100M100P100Q122864F
  • License FSL-1.1-MIT

Portal API client module for SettleMint SDK, providing access to smart contract portal services and APIs

Package Exports

  • @settlemint/sdk-portal
  • @settlemint/sdk-portal/package.json

Readme

SettleMint logo

SettleMint SDK

https://settlemint.com
Integrate SettleMint into your application with ease.

CI status License npm stars

Documentation   •   NPM   •   Issues

Table of Contents

About

The SettleMint Smart Contract Portal SDK provides a seamless way to interact with the Smart Contract Portal Middleware API. It enables you to easily interact with your smart contracts using a REST or GraphQL API.

The SDK offers a type-safe interface for all Portal API operations, with comprehensive error handling and validation. It integrates smoothly with modern TypeScript applications while providing a simple and intuitive developer experience.

Examples

Deploy contract

/**
 * This example demonstrates how to deploy a contract.
 *
 * The process involves:
 * 1. Creating a portal client
 * 2. Deploying a forwarder contract
 * 3. Waiting for the forwarder contract deployment to be finalized
 * 4. Deploying a stablecoin factory contract
 * 5. Getting all contracts and filtering by ABI name
 *
 * This pattern is useful for applications that need to deploy smart contracts
 * in the SettleMint Portal, providing a way to track the progress of blockchain operations.
 */
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { createLogger, requestLogger } from "@settlemint/sdk-utils/logging";
import { getAddress } from "viem";
import { createPortalClient } from "../portal.js"; // Replace this path with "@settlemint/sdk-portal"
import { waitForTransactionReceipt } from "../utils/wait-for-transaction-receipt.js"; // Replace this path with "@settlemint/sdk-portal"
import type { introspection } from "./schemas/portal-env.d.ts"; // Replace this path with the generated introspection type

const env = await loadEnv(false, false);
const logger = createLogger();

const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
  introspection: introspection;
  disableMasking: true;
  scalars: {
    // Change unknown to the type you are using to store metadata
    JSON: unknown;
  };
}>(
  {
    instance: env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
    accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
  },
  {
    fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
  },
);

// Replace with the address of your private key which you use to deploy smart contracts
const FROM = getAddress("0x4B03331cF2db1497ec58CAa4AFD8b93611906960");

/**
 * Deploy a forwarder contract
 */
const deployForwarder = await portalClient.request(
  portalGraphql(`
    mutation DeployContractForwarder($from: String!) {
      DeployContractForwarder(from: $from, gasLimit: "0x3d0900") {
        transactionHash
      }
    }
  `),
  {
    from: FROM,
  },
);

/**
 * Wait for the forwarder contract deployment to be finalized
 */
const transaction = await waitForTransactionReceipt(deployForwarder.DeployContractForwarder?.transactionHash!, {
  portalGraphqlEndpoint: env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
  accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
});

/**
 * Deploy a stablecoin factory contract
 */
const deployStableCoinFactory = await portalClient.request(
  portalGraphql(`
    mutation DeployContractStableCoinFactory($from: String!, $constructorArguments: DeployContractStableCoinFactoryInput!) {
      DeployContractStableCoinFactory(from: $from, constructorArguments: $constructorArguments, gasLimit: "0x3d0900") {
        transactionHash
      }
    }
  `),
  {
    from: FROM,
    constructorArguments: {
      forwarder: getAddress(transaction?.receipt.contractAddress!),
    },
  },
);

console.log(deployStableCoinFactory?.DeployContractStableCoinFactory?.transactionHash);

const contractAddresses = await portalClient.request(
  portalGraphql(`
    query GetContracts {
        getContracts {
            count
            records {
                address
                abiName
                createdAt
            }
        }
    }
  `),
);
// Print total count
console.log(`Total contracts: ${contractAddresses.getContracts?.count}`);

// Contracts for StableCoinFactory
console.log(contractAddresses.getContracts?.records.filter((record) => record.abiName === "StableCoinFactory"));

Get pending transactions

/**
 * This example demonstrates how to get the number of pending transactions.
 *
 * The process involves:
 * 1. Creating a portal client
 * 2. Making a GraphQL query to get the number of pending transactions
 *
 * This pattern is useful for applications that need to monitor the status of pending transactions
 * in the SettleMint Portal, providing a way to track the progress of blockchain operations.
 */
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { createLogger, requestLogger } from "@settlemint/sdk-utils/logging";
import { createPortalClient } from "../portal.js"; // Replace this path with "@settlemint/sdk-portal"
import type { introspection } from "./schemas/portal-env.d.ts"; // Replace this path with the generated introspection type

const env = await loadEnv(false, false);
const logger = createLogger();

const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
  introspection: introspection;
  disableMasking: true;
  scalars: {
    // Change unknown to the type you are using to store metadata
    JSON: unknown;
  };
}>(
  {
    instance: env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
    accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
  },
  {
    fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
  },
);

// Making GraphQL queries
const query = portalGraphql(`
  query GetPendingTransactions {
    getPendingTransactions {
      count
    }
  }
`);

const result = await portalClient.request(query);
console.log(`There are ${result.getPendingTransactions?.count} pending transactions`);

Monitoring alerting

/**
 * This example demonstrates how to implement real-time transaction monitoring and alerting.
 *
 * The process involves:
 * 1. Creating a WebSocket subscription to monitor all blockchain transactions
 * 2. Setting up custom handlers for different monitoring scenarios
 * 3. Processing transactions in real-time as they are confirmed
 * 4. Implementing specific monitoring functions for addresses, events, and failures
 * 5. Triggering alerts based on predefined conditions
 *
 * This pattern is useful for applications that need to:
 * - Detect suspicious activities for security purposes
 * - Track high-value transfers or specific contract interactions
 * - Monitor for failed transactions that require attention
 * - Implement compliance reporting and audit trails
 * - Build automated workflows that respond to on-chain events
 * - Provide real-time notifications to stakeholders
 */

import type { FormattedExecutionResult } from "graphql";
import { type Transaction, type WebsocketClientOptions, getWebsocketClient } from "../portal.js"; // Replace this path with "@settlemint/sdk-portal"

/**
 * Handlers for different monitoring scenarios
 * You can implement your own handlers
 */
export type AlertHandlers = {
  onAddressActivity: (transaction: Transaction, addresses: string[]) => void;
  onEvent: (transaction: Transaction, eventNames: string[]) => void;
  onFailure: (transaction: Transaction) => void;
};

/**
 * Monitors all blockchain transactions by subscribing to transaction updates via GraphQL.
 * This function continuously logs all transaction receipts as they are received.
 *
 * @param options - Configuration options for connecting to the Portal API
 * @param handlers - Optional handlers for different monitoring scenarios
 * @throws Error if the subscription fails
 *
 * @example
 * import { monitorAllTransactions } from "@settlemint/sdk-portal";
 *
 * monitorAllTransactions({
 *   portalGraphqlEndpoint: "https://example.settlemint.com/graphql",
 *   accessToken: "your-access-token"
 * }, {
 *   onAddressActivity: (tx, address) => {
 *     console.log(`Address ${address} was involved in transaction ${tx.transactionHash}`);
 *   },
 *   onEvent: (tx, eventName) => {
 *     console.log(`Event ${eventName} detected in transaction ${tx.transactionHash}`);
 *   },
 *   onFailure: (tx, reason) => {
 *     console.log(`Transaction ${tx.transactionHash} failed: ${reason}`);
 *   }
 * });
 */
export function monitorAllTransactions(options: WebsocketClientOptions, handlers: AlertHandlers) {
  const wsClient = getWebsocketClient(options);

  const subscription = wsClient.iterate<{
    getProcessedTransactions: {
      records: Transaction[];
    };
  }>({
    query: `subscription getProcessedTransactions {
      getProcessedTransactions(pageSize: 1) {
        records {
          receipt {
            transactionHash
            to
            status
            from
            type
            revertReason
            revertReasonDecoded
            logs
            events
            contractAddress
          }
          transactionHash
          from
          createdAt
          address
          functionName
          isContract
        }
      }
    }`,
  });

  // Start the monitoring process
  processSubscription(subscription, handlers);

  return subscription;
}

/**
 * Internal helper to process the subscription stream
 */
async function processSubscription(
  subscription: AsyncIterable<
    FormattedExecutionResult<
      {
        getProcessedTransactions: {
          records: Transaction[];
        };
      },
      unknown
    >
  >,
  handlers: AlertHandlers,
) {
  (async () => {
    for await (const result of subscription) {
      if (result?.data?.getProcessedTransactions?.records) {
        const records = result.data.getProcessedTransactions.records;
        const transaction = records.at(-1);

        if (transaction) {
          processTransaction(transaction, handlers);
        }
      }
    }
  })();
}

/**
 * Process a single transaction with the configured handlers
 */
function processTransaction(transaction: Transaction, handlers: AlertHandlers) {
  // Monitor specific addresses (example addresses)
  handlers.onAddressActivity(transaction, ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e"]);

  // Monitor for specific events
  handlers.onEvent(transaction, ["Transfer", "Approval"]);

  // Monitor for failed transactions
  handlers.onFailure(transaction);
}

/**
 * Monitors transactions from or to specific addresses.
 *
 * @param transaction - The transaction to check
 * @param addresses - The addresses to monitor
 *
 * @example
 * import { monitorSpecificAddresses } from "@settlemint/sdk-portal";
 *
 * monitorSpecificAddresses(transaction, ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e"]);
 */
export function monitorSpecificAddresses(transaction: Transaction, addresses: string[]) {
  const { from, address } = transaction;
  const { to } = transaction.receipt;
  const isInvolved = addresses.some((address) => [from, to].includes(address));

  if (isInvolved) {
    notify(`[ADDRESS] Address ${address} was involved in transaction ${transaction.transactionHash}`);
  }
}

/**
 * Monitors transactions for specific contract events.
 *
 * @param transaction - The transaction to check
 * @param eventNames - The event names to monitor
 *
 * @example
 * import { monitorContractEvents } from "@settlemint/sdk-portal";
 *
 * monitorContractEvents(transaction, ["Transfer", "Approval"]);
 */
export function monitorContractEvents(transaction: Transaction, eventNames: string[]) {
  const events = transaction.receipt.events;

  const eventDetected = events.find((event) => eventNames.includes(event.eventName));
  if (eventDetected) {
    notify(`[EVENT] Event ${eventDetected.eventName} detected in transaction ${transaction.transactionHash}`);
  }
}

/**
 * Monitors for failed transactions that require attention.
 *
 * @param transaction - The transaction to check
 *
 * @example
 * import { monitorFailedTransactions } from "@settlemint/sdk-portal";
 *
 * monitorFailedTransactions(transaction, "Unknown reason");
 */
export function monitorFailedTransactions(transaction: Transaction) {
  const status = transaction.receipt?.status;

  if (status === "Reverted") {
    const reason = transaction.receipt.revertReasonDecoded;
    notify(`[FAILED] Transaction ${transaction.transactionHash} failed: ${reason}`);
  }
}

const notify = (message: string) => {
  console.log(message);
};

/**
 * Example usage - monitoring specific on-chain activity
 */
export function runMonitoringExample() {
  // Basic usage
  monitorAllTransactions(
    {
      portalGraphqlEndpoint: "https://example.settlemint.com/graphql",
      accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
    },
    {
      onAddressActivity: monitorSpecificAddresses,
      onEvent: monitorContractEvents,
      onFailure: monitorFailedTransactions,
    },
  );
}

runMonitoringExample();

Send transaction using hd wallet

/**
 * This example demonstrates how to send a transaction using an HD wallet.
 *
 * The process involves:
 * 1. Creating a wallet for a user using the HD private key
 * 2. Setting up a pincode for wallet verification
 * 3. Handling the wallet verification challenge
 * 4. Sending a transaction to the blockchain
 *
 * This pattern is useful for applications that need to manage multiple user wallets
 * derived from a single HD wallet, providing a secure and scalable approach to
 * blockchain interactions in enterprise applications.
 */
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { createLogger, requestLogger } from "@settlemint/sdk-utils/logging";
import type { Address } from "viem";
import { createPortalClient } from "../portal.js"; // Replace this path with "@settlemint/sdk-portal"
import { handleWalletVerificationChallenge } from "../utils/wallet-verification-challenge.js"; // Replace this path with "@settlemint/sdk-portal"
import type { introspection } from "./schemas/portal-env.js"; // Replace this path with the generated introspection type

const env = await loadEnv(false, false);
const logger = createLogger();

const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
  introspection: introspection;
  disableMasking: true;
  scalars: {
    // Change unknown to the type you are using to store metadata
    JSON: unknown;
  };
}>(
  {
    instance: env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
    accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
  },
  {
    fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
  },
);

/**
 * First create a wallet using the HD private key, this needs to be done for every user that is using your app
 */
const wallet = await portalClient.request(
  portalGraphql(`
    mutation createUserWallet($keyVaultId: String!, $name: String!) {
      createWallet(keyVaultId: $keyVaultId, walletInfo: { name: $name }) {
        address
      }
    }
  `),
  {
    keyVaultId: env.SETTLEMINT_HD_PRIVATE_KEY!,
    name: "My Wallet",
  },
);

/**
 * Set a pincode for the wallet, this is used to verify the wallet when the user is sending a transaction to the chain
 */
const pincodeVerification = await portalClient.request(
  portalGraphql(`
    mutation setPinCode($address: String!, $pincode: String!) {
      createWalletVerification(
        userWalletAddress: $address
        verificationInfo: {pincode: {name: "PINCODE", pincode: $pincode}}
      ) {
        id
        name
        parameters
        verificationType
      }
    }
    `),
  {
    address: wallet.createWallet?.address!,
    pincode: "123456",
  },
);

/**
 * Generate a challenge response for the pincode verification
 */
const challengeResponse = await handleWalletVerificationChallenge({
  portalClient,
  portalGraphql,
  verificationId: pincodeVerification.createWalletVerification?.id!,
  userWalletAddress: wallet.createWallet?.address! as Address,
  code: "123456",
  verificationType: "pincode",
});

/**
 * Send a transaction to the chain
 * This is a sample of how to send a transaction to the chain using the portal client and the asset tokenization kit
 * The challenge response is generated using the handleWalletVerificationChallenge function, this is used to verifiy wallet access
 * @see https://github.com/settlemint/asset-tokenization-kit
 */
const result = await portalClient.request(
  portalGraphql(`
    mutation StableCoinFactoryCreate(
      $challengeResponse: String!
      $verificationId: String
      $address: String!
      $from: String!
      $input: StableCoinFactoryCreateInput!
    ) {
      StableCoinFactoryCreate(
        challengeResponse: $challengeResponse
        verificationId: $verificationId
        address: $address
        from: $from
        input: $input
      ) {
        transactionHash
      }
    }
  `),
  {
    challengeResponse: challengeResponse.challengeResponse,
    verificationId: pincodeVerification.createWalletVerification?.id!,
    address: "0x5e771e1417100000000000000000000000000004",
    from: wallet.createWallet?.address!,
    input: {
      name: "Test Coin",
      symbol: "TEST",
      decimals: 18,
      collateralLivenessSeconds: 3_600,
    },
  },
);

// Log the transaction hash
console.log("Transaction hash:", result.StableCoinFactoryCreate?.transactionHash);

API Reference

Functions

createPortalClient()

createPortalClient<Setup>(options, clientOptions?): object

Defined in: sdk/portal/src/portal.ts:72

Creates a Portal GraphQL client with the provided configuration.

Type Parameters
Type Parameter
Setup extends AbstractSetupSchema
Parameters
Parameter Type Description
options { accessToken?: string; cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; instance: string; } Configuration options for the Portal client
options.accessToken? string -
options.cache? "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" -
options.instance? string -
clientOptions? RequestConfig Additional GraphQL client configuration options
Returns

object

An object containing the configured GraphQL client and graphql helper function

Name Type Defined in
client GraphQLClient sdk/portal/src/portal.ts:76
graphql initGraphQLTada<Setup> sdk/portal/src/portal.ts:77
Throws

If the provided options fail validation

Example
import { createPortalClient } from "@settlemint/sdk-portal";
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { createLogger, requestLogger } from "@settlemint/sdk-utils/logging";
import type { introspection } from "@schemas/portal-env";

const env = await loadEnv(false, false);
const logger = createLogger();

const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
  introspection: introspection;
  disableMasking: true;
  scalars: {
    // Change unknown to the type you are using to store metadata
    JSON: unknown;
  };
}>(
  {
    instance: env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
    accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
  },
  {
    fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
  },
);

// Making GraphQL queries
const query = portalGraphql(`
  query GetPendingTransactions {
    getPendingTransactions {
      count
    }
  }
`);

const result = await portalClient.request(query);

getWebsocketClient()

getWebsocketClient(options): Client

Defined in: sdk/portal/src/utils/websocket-client.ts:30

Creates a GraphQL WebSocket client for the Portal API

Parameters
Parameter Type Description
options WebsocketClientOptions The options for the client
Returns

Client

The GraphQL WebSocket client

Example
import { getWebsocketClient } from "@settlemint/sdk-portal";

const client = getWebsocketClient({
  portalGraphqlEndpoint: "https://portal.settlemint.com/graphql",
  accessToken: "your-access-token",
});

handleWalletVerificationChallenge()

handleWalletVerificationChallenge<Setup>(options): Promise<{ challengeResponse: string; verificationId?: string; }>

Defined in: sdk/portal/src/utils/wallet-verification-challenge.ts:103

Handles a wallet verification challenge by generating an appropriate response

Type Parameters
Type Parameter
Setup extends AbstractSetupSchema
Parameters
Parameter Type Description
options HandleWalletVerificationChallengeOptions<Setup> The options for handling the wallet verification challenge
Returns

Promise<{ challengeResponse: string; verificationId?: string; }>

Promise resolving to an object containing the challenge response and optionally the verification ID

Throws

If the challenge cannot be created or is invalid

Example
import { createPortalClient } from "@settlemint/sdk-portal";
import { handleWalletVerificationChallenge } from "@settlemint/sdk-portal";

const { client, graphql } = createPortalClient({
  instance: "https://portal.example.com/graphql",
  accessToken: "your-access-token"
});

const result = await handleWalletVerificationChallenge({
  portalClient: client,
  portalGraphql: graphql,
  verificationId: "verification-123",
  userWalletAddress: "0x123...",
  code: "123456",
  verificationType: "otp"
});

waitForTransactionReceipt()

waitForTransactionReceipt(transactionHash, options): Promise<Transaction>

Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:80

Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL. This function polls until the transaction is confirmed or the timeout is reached.

Parameters
Parameter Type Description
transactionHash string The hash of the transaction to wait for
options WaitForTransactionReceiptOptions Configuration options for the waiting process
Returns

Promise<Transaction>

The transaction details including receipt information when the transaction is confirmed

Throws

Error if the transaction receipt cannot be retrieved within the specified timeout

Example
import { waitForTransactionReceipt } from "@settlemint/sdk-portal";

const transaction = await waitForTransactionReceipt("0x123...", {
  portalGraphqlEndpoint: "https://example.settlemint.com/graphql",
  accessToken: "your-access-token",
  timeout: 30000 // 30 seconds timeout
});

Interfaces

HandleWalletVerificationChallengeOptions<Setup>

Defined in: sdk/portal/src/utils/wallet-verification-challenge.ts:64

Options for handling a wallet verification challenge

Type Parameters
Type Parameter
Setup extends AbstractSetupSchema
Properties
Property Type Description Defined in
code string | number The verification code provided by the user sdk/portal/src/utils/wallet-verification-challenge.ts:74
portalClient GraphQLClient The portal client instance sdk/portal/src/utils/wallet-verification-challenge.ts:66
portalGraphql initGraphQLTada<Setup> The GraphQL query builder sdk/portal/src/utils/wallet-verification-challenge.ts:68
userWalletAddress `0x${string}` The wallet address to verify sdk/portal/src/utils/wallet-verification-challenge.ts:72
verificationId string The ID of the verification challenge sdk/portal/src/utils/wallet-verification-challenge.ts:70
verificationType "otp" | "secret-code" | "pincode" The type of verification being performed sdk/portal/src/utils/wallet-verification-challenge.ts:76

Transaction

Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:34

Represents the structure of a blockchain transaction with its receipt

Properties
Property Type Description Defined in
address string The contract address involved in the transaction sdk/portal/src/utils/wait-for-transaction-receipt.ts:43
createdAt string Timestamp when the transaction was created sdk/portal/src/utils/wait-for-transaction-receipt.ts:41
from string The sender address (duplicate of receipt.from) sdk/portal/src/utils/wait-for-transaction-receipt.ts:39
functionName string The name of the function called in the transaction sdk/portal/src/utils/wait-for-transaction-receipt.ts:45
isContract boolean Whether the transaction is a contract deployment sdk/portal/src/utils/wait-for-transaction-receipt.ts:47
transactionHash string The hash of the transaction (duplicate of receipt.transactionHash) sdk/portal/src/utils/wait-for-transaction-receipt.ts:37

TransactionEvent

Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:8

Represents an event emitted during a transaction execution

Properties
Property Type Description Defined in
args Record<string, unknown> The arguments emitted by the event sdk/portal/src/utils/wait-for-transaction-receipt.ts:12
eventName string The name of the event that was emitted sdk/portal/src/utils/wait-for-transaction-receipt.ts:10
topics `0x${string}`[] Indexed event parameters used for filtering and searching sdk/portal/src/utils/wait-for-transaction-receipt.ts:14

TransactionReceipt

Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:20

Represents the structure of a blockchain transaction receipt

Extends
  • TransactionReceipt<string, number, "Success" | "Reverted">
Properties
Property Type Description Overrides Defined in
contractAddress `0x${string}` The address of the contract deployed in the transaction TransactionReceiptViem.contractAddress sdk/portal/src/utils/wait-for-transaction-receipt.ts:28
events TransactionEvent[] Array of events emitted during the transaction - sdk/portal/src/utils/wait-for-transaction-receipt.ts:26
revertReason string The raw reason for transaction reversion, if applicable - sdk/portal/src/utils/wait-for-transaction-receipt.ts:22
revertReasonDecoded string Human-readable version of the revert reason - sdk/portal/src/utils/wait-for-transaction-receipt.ts:24

WaitForTransactionReceiptOptions

Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:57

Options for waiting for a transaction receipt

Extends
Properties
Property Type Description Inherited from Defined in
accessToken? string The access token for authentication with the Portal API WebsocketClientOptions.accessToken sdk/portal/src/utils/websocket-client.ts:14
portalGraphqlEndpoint string The GraphQL endpoint URL for the Portal API WebsocketClientOptions.portalGraphqlEndpoint sdk/portal/src/utils/websocket-client.ts:10
timeout? number Optional timeout in milliseconds before the operation fails - sdk/portal/src/utils/wait-for-transaction-receipt.ts:59

WebsocketClientOptions

Defined in: sdk/portal/src/utils/websocket-client.ts:6

Options for the GraphQL WebSocket client

Extended by
Properties
Property Type Description Defined in
accessToken? string The access token for authentication with the Portal API sdk/portal/src/utils/websocket-client.ts:14
portalGraphqlEndpoint string The GraphQL endpoint URL for the Portal API sdk/portal/src/utils/websocket-client.ts:10

Type Aliases

ClientOptions

ClientOptions = z.infer<*typeof* ClientOptionsSchema>

Defined in: sdk/portal/src/portal.ts:25

Type representing the validated client options.


RequestConfig

RequestConfig = ConstructorParameters<*typeof* GraphQLClient>[1]

Defined in: sdk/portal/src/portal.ts:11

Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.

Variables

ClientOptionsSchema

const ClientOptionsSchema: ZodObject<{ accessToken: ZodOptional<ZodString>; cache: ZodOptional<ZodEnum<{ default: "default"; force-cache: "force-cache"; no-cache: "no-cache"; no-store: "no-store"; only-if-cached: "only-if-cached"; reload: "reload"; }>>; instance: ZodUnion<readonly [ZodString, ZodString]>; }, $strip>

Defined in: sdk/portal/src/portal.ts:16

Schema for validating Portal client configuration options.

Contributing

We welcome contributions from the community! Please check out our Contributing guide to learn how you can help improve the SettleMint SDK through bug reports, feature requests, documentation updates, or code contributions.

License

The SettleMint SDK is released under the FSL Software License. See the LICENSE file for more details.