Spaces:
Runtime error

polyflow / polywrapgpt /examples.md
DaoAdvocate
add: base
3c4778e
|
Raw History Blame Contribute Delete
1.8 kB

A newer version of the Gradio SDK is available: 6.33.0

Upgrade

This is a sample integration of Polywrap. We can see how we can invoke wrappers using the

This is an example of how you can answer given each input.

You will get a prompt like the following Prompt_input-0:

Prompt_input-0: "I want to register juan.eth as a domain and set this as a content hash Qmasjdhaisud923847923"

For this input the steps you have to look at the schema.graphql which is located in src/schema.graphql inside the ens repo.

The first part you have to investigate before creating an output for this prompt:

# These are the inputs needed for executing the invokation
registerDomain(
    domain: String! # This should be equal to "juan.eth"
    registrarAddress: String!
    owner: String!
    connection: Ethereum_Connection  #Ignore because it doesnt have an exclamation mark
    txOptions: TxOptions #Ignore because it doesnt have an exclamation mark
  ): Ethereum_TxResponse!

After researching the schema.graphql you should then prepare an invokation that looks like the one below with the same structure, but with the mapping of the variables that were researched in the previous step.

    const result = await ownerClient.invoke<string>({
        uri: fsUri,
        method: "registerDomain",
        args: {
          domain: customTld,
          owner,
          registrarAddress,
          connection: {
            networkNameOrChainId: network
          }
        }
      });
  

The output that we will be looking for:

    const result = await ownerClient.invoke<string>({
        uri: fsUri,
        method: "registerDomain",
        args: {
          domain: "juan.eth",
          owner,
          registrarAddress,
          connection: {
            networkNameOrChainId: network
          }
        }
      });