Skip to main content
Substrate based chains like Polkadot, Kusama and Polymesh support the following signature kinds:

SignerPayload

Signs a generic signer payload. Note: converting the generic signer payload to a signable extrinsic requires fetching metadata from the targeted blockchain. Therefore it’s tied to a specific network rather than the blockchain kind.
FieldDescriptionType - Optional
networkA supported Substrate network.String
kindSignerPayloadString
payloadThe unsigned signer payload formatted as JSON or a serialized hex-encoded buffer as shown below.String or SignerPayloadJson

Hex String

{
  "network": "Polymesh",
  "kind": "SignerPayload",
  "payload": "0x0403007f87d29a4746b8e59e347c0598ad811a10c3cd8735d49cf96b75973864c8c98b0475000400386d0f0019000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423eb3b9c09f232a12c50f40e023a01f0b86d679b84748cc289534d96861ef611c67"
}

Typescript Example with polkadot{.js}

First install the polkadot{.js} SDK. You can find the full documentation here: https://polkadot.js.org/docs/ Here a code sample to generate a signature via the Dfns TypeScript SDK:
import { ApiPromise, HttpProvider } from '@polkadot/api'
import { EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/v4/Extrinsic'

const walletId = 'wa-6lbfv-9esgj-xxxxxxxxxxxxxxxx'
const wallet = await dfnsClient.wallets.getWallet({ walletId })

const httpProvider = new HttpProvider(process.env.POLKADOT_NODE_URL!)
const api = await ApiPromise.create({
  provider: httpProvider,
  signer: senderWallet,
  noInitWarn: true,
})

const transaction = api.tx.balances.transferKeepAlive('5EwvHZHrKd9WYc3LByzMZW5cmxJt9VMsfYiKg5jCJb8UBfbC', 10000)
const signerPayload: any = transaction.registry.createTypeUnsafe('SignerPayload', [
  transaction,
  { version: EXTRINSIC_VERSION },
])

const res = await dfnsClient.wallets.generateSignature({
  walletId,
  body: {
    kind: 'SignerPayload',
    message: signerPayload.toHex(),
  },
})

SignerPayloadJson

Please refer to the original Polkadot definition for more details: SignerPayloadJson. Note that additional fields will be rejected.
FieldDescriptionType - Optional
addressss58-encoded address of the sending account.String
blockHashThe hash of the checkpoint block, hex encoded.String
blockNumberThe checkpoint block number, hex encoded.String
eraThe number of blocks after the checkpoint for which a transaction is valid, hex encoded.String
genesisHashThe genesis hash of the chain, hex encoded.String
metadataHashThe metadataHash for the CheckMetadataHash SignedExtension, hex encoded.String (optional)
modeflag indicating whether to verify the metadata hash or not.Integer (optional)
methodThe encoded method with arguments, hex encoded.String
nonceThe nonce for the transaction, hex encoded.String
tipThe tip to increase transaction priority, hex encoded.String
versionThe version of the extrinsic.Integer
specVersionThe current spec version for the runtime, hex encoded.String
transactionVersionThe current transaction version for the runtime, hex encoded.String
signedExtensionsThe applicable signed extensions for this runtime.Array<String>
{
  "network": "Polymesh",
  "kind": "SignerPayload",
  "payload": {
    "address": "5H5tTnmLUqRgvTZvTwCdBKYjKLBm2gkp7u38Q9UUdJa8m6rX",
    "blockHash": "0x2ace05e703aa50b48c0ccccfc8b424f7aab9a1e2c424ed12e45d20b1e8ffd0d6",
    "blockNumber": "0x00000000",
    "era": "0x00",
    "genesisHash": "0x2ace05e703aa50b48c0ccccfc8b424f7aab9a1e2c424ed12e45d20b1e8ffd0d6",
    "method": "0x07141f3da32e72ac6eb6cb40d9e757594363a617b2c3964a2b6ec6895c6648f48d500000",
    "nonce": "0x00000000",
    "tip": "0x00000000000000000000000000000000",
    "version": 4,
    "specVersion": "0x006adb7a",
    "transactionVersion": "0x00000007",
    "signedExtensions": []
  }
}
I