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 and AlgoSigner are now supported in all Pipeline libraries!

info

Pipeline Class now supports ASA creation / NFT minting and smart contract deployment and interaction!

Use in browser (NEW!)

<button onclick="connect()">TEST</button>

<script src="https://unpkg.com/@pipeline-ui-2/pipeline@1.3.4/dist/index.js"></script>

<script>
const Pipeline = window.pipeline
const wallet = Pipeline.init()
function connect(){
Pipeline.connect(wallet).then(data => {
console.log(data)
})
}
</script>

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.)

info

The following example is experiencing issues in codesandbox due to incompatability with some nodJS functions. If errors are encountered, try forking the linked gihub repo which will work without issues in VSCode or gitpod.

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

info

We have add a sizeable number of new smart contract methods to the Pipeline class. Documentation for these new methods will be coming soon! In the meantime, these new methods have all been implemented in the Pipeline-UI react library and documented in the AlgoComponents tab.

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.
Pipeline.createAsa()string (transaction id) Should 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

Pipeline.createAsa()

ArgumentTypeDescription
asaObject objectobject containing parameters for the creation of an asset creation transaction

asaObject Fields

KeyTypeDefault value
creatorstringempty string
notestringempty string
amountinteger1
decimalsinteger0
deafultFrozenbooleanfalse
managerstringundefined
clawbackstringundefined
reservestringundefined
freezestringundefined
assetNamestringempty string
assetUnitstringassetName
assetURLstringundefined
assetMetadataHashstringundefined