Socket
Socket
Sign inDemoInstall

@randlabs/myalgo-connect

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@randlabs/myalgo-connect

[![npm version](https://badge.fury.io/js/@randlabs%2Fmyalgo-connect.svg)](https://badge.fury.io/js/@randlabs%2Fmyalgo-connect) [![Website shields.io](https://img.shields.io/website-up-down-green-red/http/shields.io.svg)](https://connect.myalgo.com/) [![Di


Version published
Maintainers
3
Created
Source

MyAlgo Connect

npm version Website shields.io Discord Twitter

myalgo-logo

Overview

MyAlgo Connect is a Javascript library developed by Rand Labs to securely sign transactions with My Algo

Installation

The package can be installed via npm:

npm i @randlabs/myalgo-connect

or imported in the HTML

<script src="./myalgo.min.js"></script>

Find the browser minified version in our github releases

API Usage

Quick start

import MyAlgoConnect from '@randlabs/myalgo-connect';
const myAlgoWallet = new MyAlgoConnect();

Connect to My Algo

/*Warning: Browser will block pop-up if user doesn't trigger myAlgoWallet.connect() with a button interation */
async function connectToMyAlgo() {
  try {
    const accounts = await myAlgoWallet.connect();
    const addresses = accounts.map(account => account.address);
    
  } catch (err) {
    console.error(err);
  }
}
<button onclick="connectToMyAlgo()">Connect!</button>

Sign transaction

import algosdk from 'algosdk';
const algodClient = new algosdk.Algodv2('', 'https://node.algoexplorerapi.io/', 443);

/*Warning: Browser will block pop-up if user doesn't trigger myAlgoWallet.connect() with a button interation */
async function signTransaction (from, to, amount, suggestedParams) {
  try {
    const txn = algosdk.makePaymentTxnWithSuggestedParams({ suggestedParams, from, to, amount });
    const signedTxn = await myAlgoWallet.signTransaction(txn.toByte());  
    const response = await algodClient.sendRawTransaction(signedTxn.blob).do();
    console.log(response)
  } catch(err) {
    console.error(err); 
  }
};

Documentation

Documentation for this package is available here: https://connect.myalgo.com/. An example of an integration with MyAlgo Connect: https://github.com/randlabs/myalgo-connect-test

See LICENSE file.

FAQs

Package last updated on 28 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc