Vana SDK - v2.2.2
    Preparing search index...

    Function createAndStoreGrant

    • Creates a grant file and stores it in IPFS.

      Parameters

      • params: GrantPermissionParams

        The permission parameters to create the grant from. Obtain from user input or application configuration.

      • relayerUrl: string

        The URL of the relayer service for IPFS storage. Obtain from SDK configuration or environment.

      Returns Promise<{ grantFile: GrantFile; grantUrl: string }>

      Promise resolving to an object containing the grant file and its IPFS URL

      Combines grant creation, validation, and IPFS storage in a single operation. The grant is stored immutably on IPFS and can be referenced by its URL in on-chain permission records.

      When grant parameters are invalid. Check error message for specific validation failures.

      When IPFS storage fails. Retry with exponential backoff or check relayer status.

      const { grantFile, grantUrl } = await createAndStoreGrant(
      {
      grantee: applicationAddress,
      operation: 'data_processing',
      parameters: { dataTypes: ['medical', 'financial'] }
      },
      'https://relayer.vana.org'
      );

      console.log('Grant stored at:', grantUrl);