waves_logo Docs
  • Overview
    Overview
  • How-to Guides
    • Reading Blockchain Data
      Reading Blockchain Data
    • Creating & Broadcasting Transactions
      Creating & Broadcasting Transactions
    • Tokenization
      Tokenization
    • Airdrop
      Airdrop
    • Payments
      Payments
    • Exchange Tokens
      Exchange Tokens
    • Simple Voting
      Simple Voting
    • List as argument
      List as argument
    How-to Guides
  • Waves Smart Contracts
    Waves Smart Contracts
  • dApp
    • Creating & Launching dApp
      Creating & Launching dApp
    dApp
  • Smart Account
    • Creating smart account
      Creating smart account
    • Creating and deploying a script manually
      Creating and deploying a script manually
    • Video tutorials
      • Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
        Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
      • Waves Smart Account with multisignature
        Waves Smart Account with multisignature
      • Waves Smart Account with escrow service
        Waves Smart Account with escrow service
      • Creating multisignature account via Waves IDE tools
        Creating multisignature account via Waves IDE tools
      • Creating multisignature account via Waves Client
        Creating multisignature account via Waves Client
      • Waves console explained
        Waves console explained
      Video tutorials
    Smart Account
  • Smart Asset
    Smart Asset
  • Developer Tools
    • Waves IDE
      Waves IDE
    • Visual Studio Code Extension
      Visual Studio Code Extension
    • Surfboard
      Surfboard
    • Ride REPL
      Ride REPL
    Developer Tools
  • Signer ◆
    Signer ◆
  • Waves API
    • Data Service API
      Data Service API
    • Node REST API
      Node REST API
    • Node gRPC Server
      Node gRPC Server
    • Blockchain Updates
      Blockchain Updates
    Waves API
  • Client Libraries
    • Waves C#
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Waves C#
    • Gowaves
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Gowaves
    • WavesJ
      • Install SDK
        Install SDK
      WavesJ
    • Ts-lib-crypto
      • Install SDK
        Install SDK
      Ts-lib-crypto
    • Waves-PHP
      • Install SDK
        Install SDK
      Waves-PHP
    • PyWaves-CE
      • Install SDK
        Install SDK
      PyWaves-CE
    • Waves-rust
      • Install SDK
        Install SDK
      Waves-rust
    Client Libraries
      • English
      • Русский
      On this page
        • Prerequisites
        • Ride Code
        • Script invocation
        • Learn more
      waves_logo Docs

          # List as Argument of Callable Function

          # Prerequisites

          • The dApp script uses Standard library version 4 or higher.
          • List elements are of one of the following types:
            • Boolean
            • ByteVector
            • Int
            • String

          Nested lists are not allowed as arguments to a callable function (unlike function without annotation).

          # Ride Code

          The list argument is specified as follows:

          arg_name: List[elem_type]
          

          Example script:

          {-# STDLIB_VERSION 8 #-}
          {-# CONTENT_TYPE DAPP #-}
          {-# SCRIPT_TYPE ACCOUNT #-}
          
          @Callable(i)
          func join(strings: List[String]) = {
             [
                StringEntry(toBase58String(i.caller.bytes), strings[0] + "_" + strings[1] + "_" + strings[2])
             ]
          }
          

          # Script invocation

          You can create and send an Invoke Script transaction using client libraries.

          # JavaScript

          const { invokeScript, broadcast } = require('@waves/waves-transactions');
          
          // Testnet node
          // For Mainnet, use defalut
          const nodeUrl = 'https://nodes-testnet.wavesnodes.com'; 
          const seed = 'insert your seed here';
          
            // Invocation parameters
          const invParams = {
            dApp: "3MyptFjRHW4CTPNQKdF8mu3izsZEPEdzm8s",
            payment: [],
            call: {
              function: 'join',
              args: [
                {
                  type: 'list',
                  value: [
                    { type: 'string', value: 'alpha' },
                    { type: 'string', value: 'beta' },
                    { type: 'string', value: 'gamma' }
                  ]
                }
              ]
            },
            chainId: 'T' // For Mainnet, set 'W' or omit
          };
          
          // Create and sign Invoke Script transaction
          const invokeTx = invokeScript(invParams, seed); 
          
          broadcast(invokeTx,nodeUrl).then(resp => console.log(resp));
          console.log('Tx ID: ' + invokeTx.id);
          

          💡 Use Signer to invoke your script on behalf a range of users.

          # Python

          import pywaves as pw
          
          // Testnet node; omit for Mainnet
          pw.setNode('https://nodes-testnet.wavesnodes.com/', chain='testnet')
          
          my_address = pw.Address(seed = 'insert your seed here')
          my_address.invokeScript(
            '3MyptFjRHW4CTPNQKdF8mu3izsZEPEdzm8s',
            'join',
            [{"type": "list", "value": [
              { "type": "string", "value": "alpha" },
              { "type": "string", "value": "beta" },
              { "type": "string", "value": "gamma" }
             ]}], [])
          

          # Learn more

          • Callable Function
          • Data type: List
          • List Functions
          • How to Create and Launch dApp
          Simple Voting
          Waves Smart Contracts
          Simple Voting
          Waves Smart Contracts