@terra-money/terra.js
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -10,2 +10,6 @@ <p> </p> | ||
<br/> | ||
![diagram](./img/terrajs-diagram.png) | ||
<div align="center"> | ||
@@ -82,3 +86,3 @@ <h3> | ||
<div align="center"> | ||
<sub><em>Empowering the innovation of money.</em></sub> | ||
<sub><em>Powering the innovation of money.</em></sub> | ||
</div> |
@@ -34,5 +34,5 @@ import { APIRequester } from '../APIRequester'; | ||
const acct = await auth.accountInfo(mk.accAddress); | ||
expect((<Account>acct).address).toBe(''); | ||
expect((acct as Account).address).toBe(''); | ||
}); | ||
}); | ||
}); |
@@ -10,5 +10,3 @@ import { APIRequester } from '../APIRequester'; | ||
it('account exists', async () => { | ||
const coins = await bank.balance( | ||
'terra1ax7xtll5v6u6vdnymxa4k4648w80zhkggl0u24' | ||
); | ||
await bank.balance('terra1ax7xtll5v6u6vdnymxa4k4648w80zhkggl0u24'); | ||
}); | ||
@@ -15,0 +13,0 @@ |
@@ -90,3 +90,3 @@ import { BaseAPI } from './BaseAPI'; | ||
let rewards: Rewards['rewards'] = {}; | ||
const rewards: Rewards['rewards'] = {}; | ||
for (const reward of rewardsData.rewards) { | ||
@@ -93,0 +93,0 @@ rewards[reward.validator_address] = Coins.fromData(reward.reward); |
@@ -42,3 +42,3 @@ import { Coin, Dec, Numeric, Denom } from '../../../core'; | ||
public async swapRate(offerCoin: Coin, askDenom: Denom): Promise<Coin> { | ||
let params = { | ||
const params = { | ||
offer_coin: offerCoin.toString(), | ||
@@ -45,0 +45,0 @@ ask_denom: askDenom, |
@@ -65,3 +65,3 @@ import { BaseAPI } from './BaseAPI'; | ||
if (validator !== undefined && denom !== undefined) { | ||
let vote = await this.c.get<ExchangeRateVote.Data>( | ||
const vote = await this.c.get<ExchangeRateVote.Data>( | ||
`/oracle/denoms/${denom}/votes/${validator}` | ||
@@ -71,3 +71,3 @@ ); | ||
} else if (validator !== undefined) { | ||
let votes = await this.c.get<ExchangeRateVote.Data[]>( | ||
const votes = await this.c.get<ExchangeRateVote.Data[]>( | ||
`/oracle/voters/${validator}/votes` | ||
@@ -77,3 +77,3 @@ ); | ||
} else if (denom !== undefined) { | ||
let votes = await this.c.get<ExchangeRateVote.Data[]>( | ||
const votes = await this.c.get<ExchangeRateVote.Data[]>( | ||
`/oracle/denoms/${denom}/votes` | ||
@@ -99,3 +99,3 @@ ); | ||
if (validator !== undefined && denom !== undefined) { | ||
let prevote = await this.c.get<ExchangeRatePrevote.Data>( | ||
const prevote = await this.c.get<ExchangeRatePrevote.Data>( | ||
`/oracle/denoms/${denom}/prevotes/${validator}` | ||
@@ -105,3 +105,3 @@ ); | ||
} else if (validator !== undefined) { | ||
let prevotes = await this.c.get<ExchangeRatePrevote.Data[]>( | ||
const prevotes = await this.c.get<ExchangeRatePrevote.Data[]>( | ||
`/oracle/voters/${validator}/prevotes` | ||
@@ -111,3 +111,3 @@ ); | ||
} else if (denom !== undefined) { | ||
let prevotes = await this.c.get<ExchangeRatePrevote.Data[]>( | ||
const prevotes = await this.c.get<ExchangeRatePrevote.Data[]>( | ||
`/oracle/denoms/${denom}/prevotes` | ||
@@ -114,0 +114,0 @@ ); |
@@ -6,3 +6,2 @@ import { | ||
Coin, | ||
Coins, | ||
} from '../../../core'; | ||
@@ -159,3 +158,3 @@ import { BaseAPI } from './BaseAPI'; | ||
): Promise<Redelegation[]> { | ||
let params = { | ||
const params = { | ||
delegator, | ||
@@ -193,3 +192,3 @@ validator_from: validatorSrc, | ||
*/ | ||
public async validator(validator: ValAddress) { | ||
public async validator(validator: ValAddress): Promise<Validator> { | ||
return this.c | ||
@@ -196,0 +195,0 @@ .get<Validator.Data>(`/staking/validators/${validator}`) |
@@ -1,2 +0,2 @@ | ||
import { Denom, Coins, Coin } from '../../../core'; | ||
import { Coins } from '../../../core'; | ||
import { BaseAPI } from './BaseAPI'; | ||
@@ -3,0 +3,0 @@ |
@@ -24,3 +24,3 @@ import { BaseAPI } from './BaseAPI'; | ||
public async validatorSet(height?: number): Promise<ValidatorSet> { | ||
let url = | ||
const url = | ||
height !== undefined | ||
@@ -37,5 +37,5 @@ ? `/validatorsets/${height}` | ||
public async block(height?: number): Promise<BlockInfo> { | ||
let url = height !== undefined ? `/blocks/${height}` : `/blocks/latest`; | ||
const url = height !== undefined ? `/blocks/${height}` : `/blocks/latest`; | ||
return this.c.getRaw<BlockInfo>(url); | ||
} | ||
} |
@@ -107,3 +107,6 @@ import { BaseAPI } from './BaseAPI'; | ||
const data = { | ||
tx: tx instanceof StdSignMsg ? tx.toStdTx().toData() : tx.toData(), | ||
tx: | ||
tx instanceof StdSignMsg | ||
? tx.toStdTx().toData().value | ||
: tx.toData().value, | ||
gas_prices: gasPrices && new Coins(gasPrices).toData(), | ||
@@ -110,0 +113,0 @@ gas_adjustment: gasAdjustment && gasAdjustment.toString(), |
@@ -5,3 +5,3 @@ import { LCDClient } from './LCDClient'; | ||
it('runs', async () => { | ||
const terra = new LCDClient({ | ||
new LCDClient({ | ||
chainID: 'columbus-3', | ||
@@ -8,0 +8,0 @@ URL: 'https://lcd.terra.dev', |
@@ -1,5 +0,5 @@ | ||
import { MsgSwap, Coin, StdFee } from '../../core'; | ||
import { MnemonicKey } from '../../key'; | ||
import { LCDClient } from './LCDClient'; | ||
import { TreasuryAPI, Broadcast } from './api'; | ||
// import { MsgSwap, Coin, StdFee } from '../../core'; | ||
// import { MnemonicKey } from '../../key'; | ||
// import { LCDClient } from './LCDClient'; | ||
// import { TreasuryAPI, Broadcast } from './api'; | ||
@@ -6,0 +6,0 @@ describe('Wallet', () => { |
@@ -7,3 +7,3 @@ const data = require('./Redelegation.data.json'); | ||
data.forEach((redelgExample: Redelegation.Data) => { | ||
const redelg = Redelegation.fromData(redelgExample); | ||
Redelegation.fromData(redelgExample); | ||
// expect(redelg.toData()).toMatchObject(redelgExample); | ||
@@ -10,0 +10,0 @@ // JavaScript's Date does not preserve ns precision |
@@ -7,3 +7,3 @@ const data = require('./UnbondingDelegation.data.json'); | ||
data.forEach((udelgExample: UnbondingDelegation.Data) => { | ||
const udelg = UnbondingDelegation.fromData(udelgExample); | ||
UnbondingDelegation.fromData(udelgExample); | ||
// expect(udelg.toData()).toMatchObject(udelgExample); | ||
@@ -10,0 +10,0 @@ // JavaScript's Date does not preserve ns precision |
@@ -132,3 +132,3 @@ import { MnemonicKey } from './MnemonicKey'; | ||
it('txid', () => { | ||
const stdTx = new StdTx( | ||
new StdTx( | ||
[ | ||
@@ -135,0 +135,0 @@ new MsgSend( |
import SHA256 from 'crypto-js/sha256'; | ||
import CryptoJS from 'crypto-js'; | ||
function byteArrayToWordArray(ba: Uint8Array) { | ||
function byteArrayToWordArray(ba: Uint8Array): CryptoJS.LibWordArray { | ||
const wa: number[] = []; | ||
@@ -6,0 +6,0 @@ for (let i = 0; i < ba.length; i += 1) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 12 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
87
1
1
5374984
158
153767