Skip to main content

hyperlane-decode-token-message

Use hyperlane-decode-token-message to decode a base-64-unpadded encoded Hyperlane Token Message into an object containing recipient, amount, and chainId information.

Basic syntax

To decode a Hyperlane Token Message using hyperlane-decode-token-message, use the following syntax:

(hyperlane-decode-token-message x)

Arguments

NameTypeDescription
xstringA base-64-unpadded encoded Hyperlane Token Message

Return value

The hyperlane-decode-token-message function returns an object with the following fields:

FieldTypeDescription
recipientGUARDThe recipient of the token message
amountDECIMALThe amount of tokens
chainIdSTRINGThe chain identifier

Examples

Here's an example of using hyperlane-decode-token-message to decode a Hyperlane Token Message:

pact> (hyperlane-decode-token-message "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHsABHsicHJlZCI6ICJrZXlzLWFsbCIsICJrZXlzIjpbImRhMWEzMzliZDgyZDJjMmU5MTgwNjI2YTAwZGMwNDMyNzVkZWIzYWJhYmIyN2I1NzM4YWJmNmI5ZGNlZThkYjYiXX0")
{"amount": 0.000000000000000123,"chainId": "4","recipient": KeySet {keys: [da1a339bd82d2c2e9180626a00dc043275deb3ababb27b5738abf6b9dcee8db6],pred: keys-all}}

In this example, the function decodes the provided base-64-unpadded string and returns an object containing the decoded information:

  • The amount is 0.000000000000000123
  • The chainId is "4"
  • The recipient is a KeySet with one key and a keys-all predicate