For the complete documentation index, see llms.txt. This page is also available as Markdown.

Creating Client Instance

Once you have installed the Polywrap JS client, the next step is to create a new Polywrap client instance.

Project Structure

services/
   ├── client.js        # Web3APIClient Integration
   ├── query.js         # Query function calls 
   └── mutation.js      # Mutation function calls

Client JS

.services/client.js

# Import client-js
import { Web3ApiClient } from '@web3api/client-js';
# Import tezos-plugin-js
import { tezosPlugin } from "@web3api/tezos-plugin-js"

# Export the wrapper URI where in this case QmY... is the IPFS Hash
export const TEZOS_WRAPPER_URI = 'w3://ipfs/QmYSJ3dHJuNWygFtBThKHNB7Na1mSq7uSCLYE4991CQkZY'
export const TEZOS_PLUGIN_JS = 'w3://ens/tezos.web3api.eth'

export const TezosConnections = {
 ghostnet: {
   provider: "https://rpc.ghost.tzstats.com",
   supportedTLDs: ['ith']
 },
 mainnet: {
   provider: "https://rpc.tzstats.com",
   supportedTLDs: ['tez']
 },
}

export const client = new Web3ApiClient({
 plugins: [
   {
     uri: TEZOS_PLUGIN_JS,
     plugin: tezosPlugin({
       networks: {
         mainnet: {
             provider: "https://rpc.tzstats.com"
         }, 
         ghostnet: {
             provider: "https://rpc.ghost.tzstats.com",
         }
       },
       defaultNetwork: "ghostnet"
     })
   }
 ]
})

Queries

.services/query.js

Mutations

.services/mutation.js

Last updated