Function claimOrder

  • Claims specified open order for settlement. [IMPORTANT] Set ApprovalForAll before calling this function.

    Parameters

    • __namedParameters: {
          chainId: CHAIN_IDS;
          userAddress: `0x${string}`;
          id: string;
          options?: DefaultOptions & {
              gasLimit?: bigint;
              gasPriceLimit?: bigint;
          } & {
              useSubgraph?: boolean;
          };
      }
      • chainId: CHAIN_IDS
      • userAddress: `0x${string}`
      • id: string
      • Optional options?: DefaultOptions & {
            gasLimit?: bigint;
            gasPriceLimit?: bigint;
        } & {
            useSubgraph?: boolean;
        }

    Returns Promise<{
        transaction: Transaction;
        result: CurrencyFlow;
    }>

    Promise resolving to the transaction object representing the claim action with the result of the order.

    Throws

    Throws an error if no open orders are found for the specified user.

    Example

    import { getOpenOrders, claimOrders } from '@clober/v2-sdk'

    const openOrders = await getOpenOrders({
    chainId: 421614,
    userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0'
    })
    const transaction = await claimOrders({
    chainId: 421614,
    userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
    id: openOrders.map((order) => order.id)
    })