Structure the API Call

Structuring The Raw Signing request for Vaults

In your vaults, you can sign RAW messages via the Create Transaction API endpoint for a natively supported or unsupported asset.

  1. To sign RAW messages for a natively supported asset, you need to use assetIdand source account id under the payload. For your reference, please use the following code:
const res = await signer.createTransaction({
      assetId: 'BTC_TEST',
      note: 'raw signing test',
      source: {
        type: PeerType.VAULT_ACCOUNT,
        id: "vaultAccountId", //12
      },
      operation: TransactionOperation.RAW,
      extraParameters: {
        rawMessageData: {
          messages: [
            {
              content,
              bip44AddressIndex: 0, // Optional if non default derivation is required
	            bip44change: 0, // Optional if non default derivation is required
            },
          ],
        },
      },
    },{ ncw: { walletId } });
  1. To sign RAW messages for an unsupported asset, you need to use derivationPath and algorithm under the payload. For your reference, please use the following code:
const res = await signer.createTransaction(
  {
    note: "raw signing test",
    operation: TransactionOperation.RAW,
    extraParameters: {
      rawMessageData: {
        messages: [
          {
            content: "<your_content_to_sign>",
            derivationPath: [44, 0, 0, 0, 0],
          },
        ],
        algorithm: "MPC_ECDSA_SECP256K1" / "MPC_EDDSA_ED25519",
      },
    },
  },
  { ncw: { walletId } }
);

Structuring The Raw Signing request for Embedded Wallets

In your embedded wallets, you can sign RAW messages via the Create Transaction API endpoint for a natively supported or unsupported asset.

  1. To sign RAW messages for a natively supported asset, you need to use assetIdand source account id under the payload. For your reference, please use the following code:
const res = await signer.createTransaction({
      assetId: 'BTC_TEST',
      note: 'raw signing test',
      source: {
        type: PeerType.END_USER_WALLET,
        walletId,
        id: "walletaccountId",
      },
      operation: TransactionOperation.RAW,
      extraParameters: {
        rawMessageData: {
          messages: [
            {
              content
            },
          ],
        },
      },
    },{ ncw: { walletId } });


📘

rawMessageData object:

See here for more details on how to construct therawMessageData object

📘

About messages

You can aggregate a maximum of 127 messages for Raw Signing