Skip to content

Commit

Permalink
hot fix algo tx import
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Sramko committed Sep 21, 2021
1 parent 5982b2f commit e193f51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "1.25.10",
"version": "1.25.11",
"description": "Tatum API client allows browsers and Node.js clients to interact with Tatum API.",
"main": "dist/src/index.js",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
16 changes: 8 additions & 8 deletions src/transaction/algo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const algosdk = require('algosdk');
const base32 = require('base32.js');
import { algorandBroadcast } from 'src/blockchain';
import { TextEncoder } from 'util';
import { TATUM_API_URL } from '../constants';
import { AlgoTransaction, Currency, TransactionKMS } from '../model';
import {TextEncoder} from 'util';
import {algorandBroadcast} from '../blockchain';
import {TATUM_API_URL} from '../constants';
import {AlgoTransaction, Currency, TransactionKMS} from '../model';

/**
* PureStake Algod V2 Client
Expand All @@ -13,7 +13,7 @@ import { AlgoTransaction, Currency, TransactionKMS } from '../model';
*/
export const getAlgoClient = (testnet: boolean, provider?: string) => {
const baseServer = provider || `${process.env.TATUM_API_URL || TATUM_API_URL}/v3/algorand/node`;
const token = {'X-API-Key': `${process.env.ALGO_API_KEY}`}
const token = {'X-API-Key': `${process.env.ALGO_API_KEY}`};
const algodClient = new algosdk.Algodv2(token, baseServer, '');
return algodClient;
}
Expand Down Expand Up @@ -80,8 +80,8 @@ export const signAlgoKMSTransaction = async (tx: TransactionKMS, fromPrivateKey:
if (tx.chain !== Currency.ALGO) {
throw Error('Unsupported chain.')
}
const client = getAlgoClient(testnet, provider);
const txn = JSON.parse(tx.serializedTransaction)
const client = getAlgoClient(testnet, provider);
const txn = JSON.parse(tx.serializedTransaction);
const signedTxn = algosdk.signTransaction(txn, fromPrivateKey);
return signedTxn.blob
}
}

0 comments on commit e193f51

Please sign in to comment.