Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randlabs/myalgo-connect
Browser package to bring access to MyAlgo Wallet accounts to dApps
https://github.com/randlabs/myalgo-connect
Last synced: 3 months ago
JSON representation
Browser package to bring access to MyAlgo Wallet accounts to dApps
- Host: GitHub
- URL: https://github.com/randlabs/myalgo-connect
- Owner: randlabs
- License: apache-2.0
- Created: 2020-09-25T19:57:43.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-28T13:22:29.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T06:44:04.725Z (7 months ago)
- Language: JavaScript
- Homepage: https://connect.myalgo.com/
- Size: 486 KB
- Stars: 60
- Watchers: 15
- Forks: 30
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-algorand - MyAlgo Connect - Web Wallet and JS library for signing transactions in the browser (Wallets)
README
# 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/)
[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.com/channels/491256308461207573/817420411502329896)
[![Twitter](https://badgen.net/badge/icon/twitter?icon=twitter&label)](https://twitter.com/myalgo_)![myalgo-logo](brand-kit/my-algo.png)
* [Overview](#Overview)
* [Installation](#Installation)
* [API Usage](#API-Usage)
* [Quick start](#Quick-start)
* [Connect to My Algo](#Connect-to-My-Algo)
* [Sign transaction](#Sign-transaction)
* [Documentation](#Documentation)
* [Copyright and License](#Copyright-and-License)## Overview
MyAlgo Connect is a Javascript library developed by Rand Labs to securely sign transactions with [My Algo](https://wallet.myalgo.com)
## Installation
The package can be installed via npm:
```sh
npm i @randlabs/myalgo-connect
```or imported in the HTML
```html
```
Find the browser minified version in our github [releases](https://github.com/randlabs/myalgo-connect/releases)
## API Usage
### Quick start
```js
import MyAlgoConnect from '@randlabs/myalgo-connect';
const myAlgoWallet = new MyAlgoConnect();
```### Connect to My Algo
```js
/*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);
}
}
``````html
Connect!
```### Sign transaction
```js
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: . An example of an integration with MyAlgo Connect:
## Copyright and License
See [LICENSE](LICENSE.md) file.