Skip to main content

Pipeline Class

Pipeline is a custom class to sign transactions with MyAlgo Connect, check balances and send transactions (via AlgoExplorer).

tip

We recommend using this class only for more advanced users who do not wish to use the Algo Components with hard-coded onClick functions.

info

WalletConnect is now supported in all Pipeline libraries!

Note: For faster loading, the codesandbox example below imports the Pipeline class from @pipeline-ui-2/pipeline. If you have installed pipeline-ui, the class is bundled with it and can be imported like below:

import { Pipeline } from 'pipeline-ui';

Note: Pipeline.connect, Pipeline.send and Pipeline.balance are 'asyc' functions. They initally return a promise, so to get the returned data, the .then(data => doSomeThingwithData) notation must be used when calling them (if the returned data is needed.)

Use Example#

warning

The above example will send 1 micro Algo to the Headline Dev Team test account. We recommend changing the value const recipient (currently on line 5) to your preferred testing addressing before sending a transaction.

Fields/Properties#

The Pipeline class has several fields or properties that developers can use to change several settings for Pipeline.

Pipeline.main = false; //switch to testNet
FieldDefaultOptionsEffect
Pipeline.pipeConnectorstring "myAlgoWallet""myAlgoWallet" or currently any other stringSwitch between MyAlgo and WalletConnect wallets
Pipeline.maintrueBooleanSwitch between mainNet and testNet

Methods#

MethodReturnsDescription
Pipeline.init()new instance of MyAlgoMust be called once before connect or send methods
Pipeline.balance()string (balance + "Algos")Takes input string address. Pipeline.init not neccesary for use.
Pipeline.connect()string (address)Generates pop-up to sign in. Must be called before Pipeline.send
Pipeline.send()string (transaction id) Can only be called after Pipeline.init and Pipeline.connect.

Arguments#

Pipeline.balance()#

ArgumentTypeDescription
addressstringAlgorand address

Pipeline.connect()#

ArgumentTypeDescription
walletreferenceinstance of Pipeline.init() that is called once in app

Pipeline.send()#

ArgumentTypeDescription
addressstringrecipient's Algorand address
amtintegeramount to send in microAlgos
myNotestringnote
sendingAddressstringsenders's Algorand address
walletreferenceinstance of Pipeline.init() that is called once in app
indexinteger0 = Algorand, otherwise asset index number