Sign Message

Sign Message Widgets and Modals


Get Method Widgets and Modals

To use the widgets in React components you need to import the Widget component:

import { Widget } from '@paytweed/frontend-sdk-react'

Every widget has an optional parameter called settings.

NameTypeRequiredDefaultDescription

fullScreen

Boolean

true

Should widget be shown fullscreen

hideMenu

Boolean

true

Deprecated

preventClose

Boolean

true

Hides close button

You can provide them to the widget like this:

<Widget settings={{hideMenu: false}}>

Sign message

Description

Sign on a message sent from another party. A widget will be shown to the user with the message itself, the user will be able to approve or cancel the signage. Use /n at the beginning of a new line.

Parameters

NameTypeRequiredDefaultDescription

blockchainId

String

✔️

Blockchain ID

message

String

✔️

Message to sign

Return type

Promise<string>

Usage Example

const App = () => {
  return <Widget.Wallet.SignMessage blockchainId='tezos' message={'hello tweed'} />
}

Post Method Widgets and Modals

Mutation Parameters

NameTypeRequiredDefaultDescription

widget parameters

Widget parameters

Usage Example

const [sendCoin] = hooks.useSendCoinToUser({
  callbacks: {
    onSuccess: () => {
      console.log('Success')
    },
    onError: () => {
      console.log('Error')
    },
    settings: {
      preventClose: true,
    },
  },
})

Sign message

Description

Sign message mutation allows you to sign a message with your wallet. The message will be signed with the private key of the wallet. The signature can be verified by anyone with the public key of the wallet.

Callback Parameters

NameTypeRequiredDefaultDescription

blockchainId

string

✔️

Blockchain id

message

string

✔️

Message to sign

Usage Example

const [signMessage] = hooks.useSignMessage({
  callbacks: {
    onSuccess: ({ result }) => {
      console.log(result)
    },
    onError: () => {
      console.log('Error')
    },
  },
})

signMessage({
  blockchainId: 'ethereum',
  message: 'Hello world',
})

Last updated