ChainJet
  • Introduction
  • Quickstart
  • Campaigns
  • Automations
  • Formatting inputs
    • Formatting Text
    • Formatting Numbers
  • Templates
  • Credentials
  • Integrations
    • Discord
    • OpenAI
    • Telegram Custom Bot
    • Lens Protocol 🌿
      • 🤖ChainJetBot
        • Translate a post to any language and publish it with a comment
        • Send a post by DM
        • Add a user to a Lens list
        • Share post on Discord
    • Mirror
    • POAP
    • XMTP
  • Tutorials
    • Automate messages to all users who claim your POAP
    • Export ALL of your Lens followers to Notion
    • Add Notion Database Item for Every New Lens Follower.
    • Add New POAP Holders to Your Notion Database
    • Translate a Lens post to any language
    • Create Discord commands
    • Telegram notification for new address transactions
    • Get Discord notifications for new Smart Contract events
  • Support and Community
    • 🌐WebSite
    • 👥Discord
    • 📧Email
    • 🐦Twitter
    • 🌼Hey
    • ⚫GitHub
    • 🗞️Newsletter
Powered by GitBook
On this page

Was this helpful?

  1. Formatting inputs

Formatting Numbers

Allows you to change a given number. In the following examples, we assume the output “trigger.amount” is 123456.78.

formatNumber(number, language = ‘en’)

Converts a number into a given language. If the language is not specified, English will be used by default.

Description
Formula
Result

Returns the number formatted in English

{{formatNumber(trigger.amount)}}

123,456.78

Returns the number formatted in English

{{formatNumber(trigger.amount, 'en')}}

123,456.78

Returns the number formatted in Spanish

{{formatNumber(trigger.amount, 'es')}}

123.456,78

round(number, decimals)

It allows you to round any number to a certain number of decimals.

Decription
Formula
Result

Returns the number rounded with zero decimals.

{{round(trigger.amount, 0)}}

123457

This function is useful for correctly displaying the value of tokens. On Ethereum and Ethereum-compatible blockchains, numbers are stored as integers, and they have a field specifying how many decimals the token has.

For tokens with, for example, 18 decimals, you first need to divide it by 1e18 and then round it to the number of decimals you want. In these equations, we will use three decimals:

{{round(177700150841340163 / 1e18, 3)}}

{{round(trigger.totalSupply / 1e18, 3)}}

*You can check in the contract of each token the number of decimals a token has and modify the equation shown accordingly.

PreviousFormatting TextNextTemplates

Last updated 2 years ago

Was this helpful?