Vana SDK - v3.5.0
    Preparing search index...

    Function createEscrowGatewayClient

    • Creates a client for the gateway escrow endpoints.

      Parameters

      • baseUrl: string

        Base URL of the DP RPC gateway (e.g. "https://dp.vana.org"). Trailing slashes are trimmed.

      Returns EscrowGatewayClient

      import {
      createEscrowGatewayClient,
      genericPaymentDomain,
      GENERIC_PAYMENT_TYPES,
      } from "@opendatalabs/vana-sdk/node";

      const escrow = createEscrowGatewayClient("https://dp.vana.org");

      // 1. Submit your deposit tx hash after broadcasting depositNative on-chain
      const deposit = await escrow.submitDeposit({ txHash: "0xabc…" });

      // 2. Force-sync and read the updated balance
      const { balances } = await escrow.syncEscrowBalance("0xpayerAddress");

      // 3. Sign and authorize a grant payment
      const sig = await walletClient.signTypedData({
      domain: genericPaymentDomain(1480, "0xEscrowContract"),
      types: GENERIC_PAYMENT_TYPES,
      primaryType: "GenericPayment",
      message: {
      payerAddress: "0xpayerAddress",
      opType: "grant",
      opId: "0xgrantId",
      asset: "0x0000000000000000000000000000000000000000",
      amount: 1000000000000000000n,
      paymentNonce: 1n,
      },
      });
      const result = await escrow.payForOp({
      payerAddress: "0xpayerAddress",
      opType: "grant",
      opId: "0xgrantId",
      asset: "0x0000000000000000000000000000000000000000",
      amount: "1000000000000000000",
      paymentNonce: "1",
      signature: sig,
      });