Tezos Polywrap
  • What is Polywrap?
  • Using Tezos Polywrap
    • Getting Started
    • Deployments
    • Tezos Core Plugin
      • Queries
      • Mutations
    • Tezos Domains Wrapper
      • JS Plugin
      • Mutation JS
      • Query JS
    • Harbinger Wrapper
      • JS Plugin
    • Hic et Nunc Wrapper
    • QuipuSwap Wrapper
      • JS Plugin
  • Creating Wrappers
    • Environment Setup
    • Test Environment
    • Writing a Wrapper
    • Adding Query Functions
    • Writing Tests
    • Deploying a Wrapper
  • integration
    • Installing Polywrap JS Client
    • Creating Client Instance
Powered by GitBook
On this page
  • Import Plugins
  • Temple Wallet Connection
  • Commit Domain Name
  • Buy Domain
  1. Using Tezos Polywrap
  2. Tezos Domains Wrapper

Mutation JS

PreviousJS PluginNextQuery JS

Last updated 3 years ago

Import Plugins

import { client, TEZOS_DOMAINS_WRAPPER_URI, TEZOS_PLUGIN_JS } from "./client"

Temple Wallet Connection

Create a new connection to using our Tezos Polywrap JS Plugin and parse the desired Tezos network as an argument.

export const connectTempleWallet = (network) => {
 return client.query({
   uri: TEZOS_PLUGIN_JS,
   query: `
       mutation {
         connectTempleWallet(
             appName: "polydomains",
             network: $network,
             connection: $connection
         )
       },
   `,
   variables: {
       network,
       connection: {
         network
       }
   }
 })
}

Commit Domain Name

Commits a user-defined domain name to the Tezos blockchain using the commitDomain function:

export const commitDomain = (network, payload) => {
 const { commitParams } = payload
 return client.query({
   uri: TEZOS_DOMAINS_WRAPPER_URI,
   query: `
       mutation {
         commit (
             network: $network,
             params: $params
         )
       },
   `,
   variables: {
       network,
       params: commitParams
   }
 })
}

Buy Domain

Initiates a payment to buy a user-defined Tezos domain name that has previously been committed to the Tezos blockchain.

export const buyDomain = (network, payload) => {
 const { buyParams, sendParams } = payload
 return client.query({
   uri: TEZOS_DOMAINS_WRAPPER_URI,
   query: `
       mutation {
         buy (
           network: $network,
           params: $params,
           sendParams: $sendParams
         )
       },
   `,
   variables: {
       network,
       params: {
         label: buyParams.label,
         owner: buyParams.owner,
         address: buyParams.owner,
         nonce: buyParams.nonce,
         duration: buyParams.duration,
         data: JSON.stringify(buyParams.metadata)
       },
       sendParams: sendParams
   }
 })

Temple Wallet