Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client.agent() : expression uncallable #1436

Open
Karimium0 opened this issue May 6, 2024 · 0 comments
Open

Client.agent() : expression uncallable #1436

Karimium0 opened this issue May 6, 2024 · 0 comments

Comments

@Karimium0
Copy link

Upon trying to do an easy task of letting the user use a delegation and access the space to upload, i tried following the docs. However there seem to be an issue with the examples provided in the docs.

import * as Delegation from '@ucanto/core/delegation';
import * as Client from '@web3-storage/w3up-client';
const client = await Client.create();

            const apiUrl = `/api/w3up-delegation/${client.agent().did()}`;
            console.log('apiurl', apiUrl);
            const response = await fetch(apiUrl);
            const data = await response.arrayBuffer();

            const delegation = await Delegation.extract(new Uint8Array(data));
            if (!delegation.ok) {
              throw new Error('Failed to extract delegation', { cause: delegation.error });
            }

            const space = await client.addSpace(delegation.ok);
            client.setCurrentSpace(space.did());

            const cid = await client.uploadFile(file);
i get this error as a result : This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
  Type 'Agent<Service>' has no call signatures.ts. 

and of course even despite removing the () following agent, the delegation extraction just fails.
I still have no idea how i can work around this to make the users upload directly to my space using my generated delegation..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant