Skip to content

Commit

Permalink
fix transfer erc20 BSC token
Browse files Browse the repository at this point in the history
add GAMEE token
fix broken algo link
  • Loading branch information
Samuel Sramko committed Sep 29, 2021
1 parent 0f24df4 commit 00129a7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 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.26.4",
"version": "1.26.5",
"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
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export const CONTRACT_ADDRESSES = {
[Currency.B2U_BSC.toString()]: '0x02926e6e2898e9235fdddde3f51c3b644af8c403',
[Currency.BUSD.toString()]: '0x4fabb145d64652a948d72533023f6e7a623c7c53',
[Currency.BETH.toString()]: '0x2170ed0880ac9a755fd29b2688956bd959f933f8',
[Currency.GAMEE.toString()]: '0xcf32822ff397ef82425153a9dcb726e5ff61dca7',
[Currency.BBTC.toString()]: '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c',
[Currency.BADA.toString()]: '0x3ee2200efb3400fabb9aacf31297cbdd1d435d47',
[Currency.RMD.toString()]: '0x02888e65324a98219c26f292e7cd3e52ef39c5c2',
Expand Down Expand Up @@ -218,6 +219,7 @@ export const CONTRACT_DECIMALS = {
[Currency.USDC_BSC.toString()]: 18,
[Currency.B2U_BSC.toString()]: 18,
[Currency.BETH.toString()]: 18,
[Currency.GAMEE.toString()]: 18,
[Currency.BBTC.toString()]: 18,
[Currency.BADA.toString()]: 18,
[Currency.WBNB.toString()]: 18,
Expand Down
2 changes: 2 additions & 0 deletions src/model/request/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum Currency {
BUSD_BSC = 'BUSD_BSC',
B2U_BSC = 'B2U_BSC',
BETH = 'BETH',
GAMEE = 'GAMEE',
BBTC = 'BBTC',
BADA = 'BADA',
RMD = 'RMD',
Expand Down Expand Up @@ -94,6 +95,7 @@ export const ERC20_CURRENCIES = [

export const BEP20_CURRENCIES = [
Currency.BETH.toString(),
Currency.GAMEE.toString(),
Currency.BBTC.toString(),
Currency.RMD.toString(),
Currency.USDC_BSC.toString(),
Expand Down
4 changes: 2 additions & 2 deletions src/model/request/TransferErc20.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Type} from 'class-transformer';
import {IsIn, IsNotEmpty, IsNumberString, IsOptional, Length, Matches, Max, MaxLength, Min, ValidateIf, ValidateNested} from 'class-validator';
import {Currency, ETH_BASED_CURRENCIES, MATIC_BASED_CURRENCIES} from './Currency';
import {BSC_BASED_CURRENCIES, Currency, ETH_BASED_CURRENCIES, MATIC_BASED_CURRENCIES} from './Currency';
import {Fee} from './Fee';
import {PrivateKeyOrSignatureId} from './PrivateKeyOrSignatureId';

Expand All @@ -21,7 +21,7 @@ export class TransferErc20 extends PrivateKeyOrSignatureId {

@ValidateIf(o => !o.contractAddress)
@IsNotEmpty()
@IsIn([...ETH_BASED_CURRENCIES, ...MATIC_BASED_CURRENCIES, Currency.XDC, Currency.ONE])
@IsIn([...ETH_BASED_CURRENCIES, ...MATIC_BASED_CURRENCIES, Currency.XDC, Currency.ONE, ...BSC_BASED_CURRENCIES])
public currency?: Currency;

@ValidateIf(o => !o.currency)
Expand Down
15 changes: 7 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,9 +13,8 @@ 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 algodClient = new algosdk.Algodv2(token, baseServer, '');
return algodClient;
const token = {'X-API-Key': `${process.env.ALGO_API_KEY}`};
return new algosdk.Algodv2(token, baseServer, '');
}

/**
Expand Down Expand Up @@ -85,4 +84,4 @@ export const signAlgoKMSTransaction = async (tx: TransactionKMS, fromPrivateKey:
const secretKey = new Uint8Array(decoder.write(fromPrivateKey).buf);
const signedTxn = algosdk.signTransaction(txn, secretKey);
return signedTxn.blob
}
}
2 changes: 2 additions & 0 deletions src/wallet/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ export const generateAddressFromXPub = (currency: Currency, testnet: boolean, xp
case Currency.USDC_MATIC:
case Currency.LATOKEN:
case Currency.BETH:
case Currency.GAMEE:
case Currency.BUSD:
case Currency.USDC_BSC:
case Currency.B2U_BSC:
Expand Down Expand Up @@ -804,6 +805,7 @@ export const generatePrivateKeyFromMnemonic = (currency: Currency, testnet: bool
case Currency.MATIC_ETH:
case Currency.BSC:
case Currency.BETH:
case Currency.GAMEE:
case Currency.BBTC:
case Currency.BADA:
case Currency.WBNB:
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export const generateWallet = (currency: Currency, testnet: boolean, mnemonic?:
case Currency.ETH:
case Currency.BSC:
case Currency.BETH:
case Currency.GAMEE:
case Currency.CAKE:
case Currency.MATIC_ETH:
case Currency.HAG:
Expand Down

0 comments on commit 00129a7

Please sign in to comment.