Granite Upgrade Activates in08d:14h:57m:56s
Warp Messages

Building Warp Messages

Building Messages

Build unsigned Warp messages for signing and broadcasting.

RegisterL1ValidatorMessage

Methods

MethodParametersReturnsDescription
fromValuesnodeID: string, publicKey: string, signature: stringRegisterL1ValidatorMessageBuild from values
toHex-stringConvert to hex

Example

import { RegisterL1ValidatorMessage } from "@avalanche-sdk/interchain/warp";

const msg = RegisterL1ValidatorMessage.fromValues(
  "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
  "0x...",
  "0x..."
);

const hex = msg.toHex();

L1ValidatorWeightMessage

Methods

MethodParametersReturnsDescription
fromValuesnodeID: string, weight: bigint, startTime: bigintL1ValidatorWeightMessageBuild from values
toHex-stringConvert to hex

Example

import { L1ValidatorWeightMessage } from "@avalanche-sdk/interchain/warp";

const msg = L1ValidatorWeightMessage.fromValues(
  "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
  4n,
  41n
);

const hex = msg.toHex();

AddressedCall

Build AddressedCall payload from a message.

Methods

MethodParametersReturnsDescription
fromValuessourceAddress: Address, payload: stringAddressedCallBuild from values
toHex-stringConvert to hex

Example

import {
  AddressedCall,
  L1ValidatorWeightMessage,
} from "@avalanche-sdk/interchain/warp";

const msg = L1ValidatorWeightMessage.fromValues(
  "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
  4n,
  41n
);

const addressedCall = AddressedCall.fromValues(
  "0x35F884853114D298D7aA8607f4e7e0DB52205f07",
  msg.toHex()
);

WarpUnsignedMessage

Build unsigned Warp message from AddressedCall.

Methods

MethodParametersReturnsDescription
fromValuesnetworkID: number, sourceChainID: string, addressedCallPayload: stringWarpUnsignedMessageBuild from values
toHex-stringConvert to hex

Example

import {
  AddressedCall,
  L1ValidatorWeightMessage,
  WarpUnsignedMessage,
} from "@avalanche-sdk/interchain/warp";

// Build message
const msg = L1ValidatorWeightMessage.fromValues(
  "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
  4n,
  41n
);

// Build AddressedCall
const addressedCall = AddressedCall.fromValues(
  "0x35F884853114D298D7aA8607f4e7e0DB52205f07",
  msg.toHex()
);

// Build unsigned Warp message
const warpUnsignedMsg = WarpUnsignedMessage.fromValues(
  1,
  "251q44yFiimeVSHaQbBk69TzoeYqKu9VagGtLVqo92LphUxjmR",
  addressedCall.toHex()
);

const hex = warpUnsignedMsg.toHex();

Is this guide helpful?