// import { InjectedAlgorandSigner, Signer } from "arbundles"; // import BigNumber from "bignumber.js"; // import { CurrencyConfig, Tx } from "../../common/types" // import BaseWebCurrency from "../currency" // import * as algosdk from "algosdk"; // import axios from "axios"; // import MyAlgoConnect from "@randlabs/myalgo-connect"; // export default class AlgorandConfig extends BaseWebCurrency { // private signer: InjectedAlgorandSigner; // protected apiURL? = "https://node.testnet.algoexplorerapi.io"; // protected indexerURL? = "https://algoindexer.testnet.algoexplorerapi.io"; // constructor(config: CurrencyConfig) { // super(config); // this.base = ["microAlgos", 1e6] // } // async getTx(txId: string): Promise { // const endpoint = `${this.indexerURL}/v2/transactions/${txId}`; // const response = await axios.get(endpoint); // const latestBlockHeight = new BigNumber(await this.getCurrentHeight()).toNumber(); // const txBlockHeight = new BigNumber(response.data.transaction["confirmed-round"]); // const tx: Tx = { // from: response.data.transaction["sender"], // to: response.data.transaction["payment-transaction"].receiver, // amount: new BigNumber(response.data.transaction["payment-transaction"].amount), // blockHeight: txBlockHeight, // pending: false, // confirmed: latestBlockHeight - txBlockHeight.toNumber() >= this.minConfirm // } // return tx; // } // ownerToAddress(_owner: any): string { // return algosdk.encodeAddress(_owner); // } // async sign(data: Uint8Array): Promise { // const s = this.getSigner(); // const signed = await s.sign(data); // return signed; // } // getSigner(): Signer { // if (!this.signer) { // this.signer = new InjectedAlgorandSigner(); // } // return this.signer // } // async verify(pub: any, data: Uint8Array, signature: Uint8Array): Promise { // return InjectedAlgorandSigner.verify(pub, data, signature) // } // async getCurrentHeight(): Promise { // // "last-round" = blockheight // const endpoint = `${this.apiURL}/v2/transactions/params`; // const response = await axios.get(endpoint); // return new BigNumber(await response.data["last-round"]); // } // async getFee(_amount: BigNumber.Value, _to?: string): Promise { // const endpoint = `${this.apiURL}/v2/transactions/params`; // const response = await axios.get(endpoint); // return new BigNumber(response.data["min-fee"]); // } // async sendTx(data: any): Promise { // const endpoint = `${this.apiURL}/v2/transactions`; // const response = await axios.post(endpoint, data); // return response.data["txId"]; // return TX id // } // async createTx(amount: BigNumber.Value, to: string, _fee?: string): Promise<{ txId: string | undefined; tx: any; }> { // const endpoint = `${this.apiURL}/v2/transactions/params`; // const response = await axios.get(endpoint); // const params = await response.data; // console.log(params); // const unsigned = algosdk.makePaymentTxnWithSuggestedParamsFromObject({ // from: this._address, // to: to, // amount: new BigNumber(amount).toNumber(), // note: undefined, // suggestedParams: { // fee: params["fee"], // firstRound: params["last-round"], // flatFee: false, // genesisHash: params["genesis-hash"], // genesisID: params["genesis-id"], // lastRound: (params["last-round"] + 1000) // } // }); // const s = this.getSigner(); // const signed = await s.sign(unsigned.toByte()); // return { tx: signed, txId: undefined } // } // public async getPublicKey(): Promise { // const pub = algosdk.decodeAddress(this._address); // return Buffer.from(pub.publicKey); // } // pruneBalanceTransactions(_txIds: string[]): Promise { // throw new Error("Method not implemented."); // } // public async ready(): Promise { // const myAlgoWallet = new MyAlgoConnect(); // const accounts = await myAlgoWallet.connect(); // const addresses = accounts.map(account => account.address); // this._address = addresses[0]; // this.providerInstance = myAlgoWallet; // } // }