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

    Function storeGrantFile

    • Stores a grant file in IPFS via the relayer service.

      Parameters

      • grantFile: GrantFile

        The grant file to store

      • relayerUrl: string

        URL of the relayer service

      Returns Promise<string>

      Promise resolving to the IPFS URL

      This function uploads the grant file to IPFS through the relayer's upload endpoint. The returned URL can be stored on-chain as part of the permission grant, allowing anyone to retrieve the detailed permission parameters later.

      When the upload fails or relayer is unavailable

      const grantFile = createGrantFile(params);

      try {
      const ipfsUrl = await storeGrantFile(grantFile, 'https://relayer.vana.com');
      console.log(`Grant file stored at: ${ipfsUrl}`);
      // ipfsUrl: "ipfs://QmHash123..."
      } catch (error) {
      console.error('Failed to store grant file:', error);
      }