@terra-money/terra.js
Advanced tools
Comparing version 0.4.16 to 0.4.17
@@ -137,9 +137,11 @@ "use strict"; | ||
.get("/distribution/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
base_proposer_reward: new core_1.Dec(d.base_proposer_reward), | ||
community_tax: new core_1.Dec(d.community_tax), | ||
bonus_proposer_reward: new core_1.Dec(d.bonus_proposer_reward), | ||
withdraw_addr_enabled: d.withdraw_addr_enabled, | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
base_proposer_reward: new core_1.Dec(d.base_proposer_reward), | ||
community_tax: new core_1.Dec(d.community_tax), | ||
bonus_proposer_reward: new core_1.Dec(d.bonus_proposer_reward), | ||
withdraw_addr_enabled: d.withdraw_addr_enabled, | ||
}); | ||
})]; | ||
}); | ||
@@ -146,0 +148,0 @@ }); |
@@ -133,9 +133,11 @@ "use strict"; | ||
.get("/gov/proposals/" + proposalId + "/tally") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
yes: new core_1.Int(d.yes), | ||
no: new core_1.Int(d.no), | ||
no_with_veto: new core_1.Int(d.no_with_veto), | ||
abstain: new core_1.Int(d.abstain), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
yes: new core_1.Int(d.yes), | ||
no: new core_1.Int(d.no), | ||
no_with_veto: new core_1.Int(d.no_with_veto), | ||
abstain: new core_1.Int(d.abstain), | ||
}); | ||
})]; | ||
}); | ||
@@ -150,7 +152,9 @@ }); | ||
.get("/gov/parameters/deposit") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
max_deposit_period: Number.parseInt(d.max_deposit_period), | ||
min_deposit: core_1.Coins.fromData(d.min_deposit), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
max_deposit_period: Number.parseInt(d.max_deposit_period), | ||
min_deposit: core_1.Coins.fromData(d.min_deposit), | ||
}); | ||
})]; | ||
}); | ||
@@ -165,4 +169,8 @@ }); | ||
.get("/gov/parameters/voting") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ voting_period: Number.parseInt(d.voting_period) }); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
voting_period: Number.parseInt(d.voting_period), | ||
}); | ||
})]; | ||
}); | ||
@@ -177,8 +185,10 @@ }); | ||
.get("/gov/parameters/tallying") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
quorum: new core_1.Dec(d.quorum), | ||
veto: new core_1.Dec(d.veto), | ||
threshold: new core_1.Dec(d.threshold), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
quorum: new core_1.Dec(d.quorum), | ||
veto: new core_1.Dec(d.veto), | ||
threshold: new core_1.Dec(d.threshold), | ||
}); | ||
})]; | ||
}); | ||
@@ -185,0 +195,0 @@ }); |
@@ -100,10 +100,12 @@ "use strict"; | ||
.get("/market/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
pool_recovery_period: Number.parseInt(d.pool_recovery_period), | ||
base_pool: new core_1.Dec(d.base_pool), | ||
min_spread: new core_1.Dec(d.min_spread), | ||
tobin_tax: new core_1.Dec(d.tobin_tax), | ||
illiquid_tobin_tax_list: convert_1.Convert.toTaxRateArray(d.illiquid_tobin_tax_list), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
pool_recovery_period: Number.parseInt(d.pool_recovery_period), | ||
base_pool: new core_1.Dec(d.base_pool), | ||
min_spread: new core_1.Dec(d.min_spread), | ||
tobin_tax: new core_1.Dec(d.tobin_tax), | ||
illiquid_tobin_tax_list: convert_1.Convert.toTaxRateArray(d.illiquid_tobin_tax_list), | ||
}); | ||
})]; | ||
}); | ||
@@ -110,0 +112,0 @@ }); |
import { BaseAPI } from './BaseAPI'; | ||
import { ValAddress, Denom, ExchangeRateVote, Coin, Coins, ExchangeRatePrevote, AccAddress, Dec, AggregateExchangeRatePrevote, AggregateExchangeRateVote } from '../../../core'; | ||
declare type OracleWhitelist = { | ||
name: Denom; | ||
tobin_tax: Dec; | ||
}[]; | ||
export interface OracleParams { | ||
@@ -12,4 +16,7 @@ /** Number of blocks that define the period over which new votes must be submitted for the exchange rate of LUNA. */ | ||
reward_distribution_window: number; | ||
/** List of active denominations that must be voted on. */ | ||
whitelist: Denom[]; | ||
/** List of active denominations that must be voted on. | ||
* @returns String[] on Columbus-3 | ||
* @returns { name: String, tobin_tax: String }[] on Columbus-4 or later | ||
*/ | ||
whitelist: Denom[] | OracleWhitelist; | ||
/** Percetange of stake slashed once per slash window. */ | ||
@@ -28,3 +35,3 @@ slash_fraction: Dec; | ||
reward_distribution_window: string; | ||
whitelist: Denom[]; | ||
whitelist: Denom[] | OracleWhitelist; | ||
slash_fraction: string; | ||
@@ -91,1 +98,2 @@ slash_window: string; | ||
} | ||
export {}; |
@@ -230,13 +230,17 @@ "use strict"; | ||
.get("/oracle/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
vote_period: Number.parseInt(d.vote_period), | ||
vote_threshold: new core_1.Dec(d.vote_threshold), | ||
reward_band: new core_1.Dec(d.reward_band), | ||
reward_distribution_window: Number.parseInt(d.reward_distribution_window), | ||
whitelist: d.whitelist, | ||
slash_fraction: new core_1.Dec(d.slash_fraction), | ||
slash_window: Number.parseInt(d.slash_window), | ||
min_valid_per_window: new core_1.Dec(d.min_valid_per_window), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
vote_period: Number.parseInt(d.vote_period), | ||
vote_threshold: new core_1.Dec(d.vote_threshold), | ||
reward_band: new core_1.Dec(d.reward_band), | ||
reward_distribution_window: Number.parseInt(d.reward_distribution_window), | ||
whitelist: Array.isArray(d) && d.length && typeof d[0] === 'string' | ||
? d.whitelist | ||
: d.whitelist, | ||
slash_fraction: new core_1.Dec(d.slash_fraction), | ||
slash_window: Number.parseInt(d.slash_window), | ||
min_valid_per_window: new core_1.Dec(d.min_valid_per_window), | ||
}); | ||
})]; | ||
}); | ||
@@ -243,0 +247,0 @@ }); |
@@ -96,11 +96,13 @@ "use strict"; | ||
.get("/slashing/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
max_evidence_age: Number.parseInt(d.max_evidence_age), | ||
signed_blocks_window: Number.parseInt(d.signed_blocks_window), | ||
min_signed_per_window: new core_1.Dec(d.min_signed_per_window), | ||
downtime_jail_duration: Number.parseInt(d.downtime_jail_duration), | ||
slash_fraction_double_sign: new core_1.Dec(d.slash_fraction_double_sign), | ||
slash_fraction_downtime: new core_1.Dec(d.slash_fraction_downtime), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
max_evidence_age: Number.parseInt(d.max_evidence_age), | ||
signed_blocks_window: Number.parseInt(d.signed_blocks_window), | ||
min_signed_per_window: new core_1.Dec(d.min_signed_per_window), | ||
downtime_jail_duration: Number.parseInt(d.downtime_jail_duration), | ||
slash_fraction_double_sign: new core_1.Dec(d.slash_fraction_double_sign), | ||
slash_fraction_downtime: new core_1.Dec(d.slash_fraction_downtime), | ||
}); | ||
})]; | ||
}); | ||
@@ -107,0 +109,0 @@ }); |
@@ -219,7 +219,9 @@ "use strict"; | ||
.get("/staking/pool") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
bonded_tokens: new core_1.Coin(Denom_1.Denom.LUNA, d.bonded_tokens), | ||
not_bonded_tokens: new core_1.Coin(Denom_1.Denom.LUNA, d.not_bonded_tokens), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
bonded_tokens: new core_1.Coin(Denom_1.Denom.LUNA, d.bonded_tokens), | ||
not_bonded_tokens: new core_1.Coin(Denom_1.Denom.LUNA, d.not_bonded_tokens), | ||
}); | ||
})]; | ||
}); | ||
@@ -236,9 +238,11 @@ }); | ||
.get("/staking/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
unbonding_time: Number.parseInt(d.unbonding_time), | ||
max_validators: d.max_validators, | ||
max_entries: d.max_entries, | ||
bond_denom: d.bond_denom, | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
unbonding_time: Number.parseInt(d.unbonding_time), | ||
max_validators: d.max_validators, | ||
max_entries: d.max_entries, | ||
bond_denom: d.bond_denom, | ||
}); | ||
})]; | ||
}); | ||
@@ -245,0 +249,0 @@ }); |
@@ -129,12 +129,14 @@ "use strict"; | ||
.get("/treasury/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
tax_policy: core_1.PolicyConstraints.fromData(d.tax_policy), | ||
reward_policy: core_1.PolicyConstraints.fromData(d.reward_policy), | ||
mining_increment: new core_1.Dec(d.mining_increment), | ||
seigniorage_burden_target: new core_1.Dec(d.seigniorage_burden_target), | ||
window_long: Number.parseInt(d.window_long), | ||
window_short: Number.parseInt(d.window_short), | ||
window_probation: Number.parseInt(d.window_probation), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
tax_policy: core_1.PolicyConstraints.fromData(d.tax_policy), | ||
reward_policy: core_1.PolicyConstraints.fromData(d.reward_policy), | ||
mining_increment: new core_1.Dec(d.mining_increment), | ||
seigniorage_burden_target: new core_1.Dec(d.seigniorage_burden_target), | ||
window_long: Number.parseInt(d.window_long), | ||
window_short: Number.parseInt(d.window_short), | ||
window_probation: Number.parseInt(d.window_probation), | ||
}); | ||
})]; | ||
}); | ||
@@ -141,0 +143,0 @@ }); |
@@ -206,4 +206,6 @@ "use strict"; | ||
.post("/txs/estimate_fee", data) | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return new core_1.StdFee(Number.parseInt(d.gas), core_1.Coins.fromData(d.fees)); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return new core_1.StdFee(Number.parseInt(d.gas), core_1.Coins.fromData(d.fees)); | ||
})]; | ||
}); | ||
@@ -210,0 +212,0 @@ }); |
@@ -71,10 +71,12 @@ "use strict"; | ||
.get("/wasm/contracts/" + contractAddress) | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
code_id: Number.parseInt(d.code_id), | ||
address: d.address, | ||
owner: d.owner, | ||
init_msg: JSON.parse(Buffer.from(d.init_msg, 'base64').toString()), | ||
migratable: d.migratable, | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
code_id: Number.parseInt(d.code_id), | ||
address: d.address, | ||
owner: d.owner, | ||
init_msg: JSON.parse(Buffer.from(d.init_msg, 'base64').toString()), | ||
migratable: d.migratable, | ||
}); | ||
})]; | ||
}); | ||
@@ -99,9 +101,11 @@ }); | ||
.get("/wasm/parameters") | ||
.then(function (d) { return d.result; }) | ||
.then(function (d) { return ({ | ||
max_contract_size: Number.parseInt(d.max_contract_size), | ||
max_contract_gas: Number.parseInt(d.max_contract_gas), | ||
max_contract_msg_size: Number.parseInt(d.max_contract_msg_size), | ||
gas_multiplier: Number.parseInt(d.gas_multiplier), | ||
}); })]; | ||
.then(function (_a) { | ||
var d = _a.result; | ||
return ({ | ||
max_contract_size: Number.parseInt(d.max_contract_size), | ||
max_contract_gas: Number.parseInt(d.max_contract_gas), | ||
max_contract_msg_size: Number.parseInt(d.max_contract_msg_size), | ||
gas_multiplier: Number.parseInt(d.gas_multiplier), | ||
}); | ||
})]; | ||
}); | ||
@@ -108,0 +112,0 @@ }); |
@@ -9,2 +9,3 @@ import { DistributionParamChange, DistributionParamChanges } from '../distribution/params'; | ||
import { WasmParamChange, WasmParamChanges } from '../wasm/params'; | ||
import { MintParamChange, MintParamChanges } from '../mint/params'; | ||
/** | ||
@@ -78,8 +79,24 @@ * Example object: | ||
* }, | ||
* mint: { | ||
* MintDenom: 'uluna', | ||
* InflationRateChange: "0.000000000000000000", | ||
* InflationMax: "0.200000000000000000", | ||
* InflationMin: "0.070000000000000000", | ||
* GoalBonded: "0.670000000000000000", | ||
* BlocksPerYear: 6311520 | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
export declare type ParamChanges = DistributionParamChanges & GovParamChanges & MarketParamChanges & OracleParamChanges & SlashingParamChanges & StakingParamChanges & TreasuryParamChanges & WasmParamChanges; | ||
export declare type ParamChanges = DistributionParamChanges & GovParamChanges & MarketParamChanges & OracleParamChanges & SlashingParamChanges & StakingParamChanges & TreasuryParamChanges & WasmParamChanges & MintParamChanges; | ||
export declare namespace ParamChanges { | ||
const ConversionTable: { | ||
mint: { | ||
MintDenom: ((c: any) => any)[]; | ||
InflationRateChange: (((c: import("decimal.js").default.Value) => import("..").Dec) | ((c: any) => string))[]; | ||
InflationMax: (((c: import("decimal.js").default.Value) => import("..").Dec) | ((c: any) => string))[]; | ||
InflationMin: (((c: import("decimal.js").default.Value) => import("..").Dec) | ((c: any) => string))[]; | ||
GoalBonded: (((c: import("decimal.js").default.Value) => import("..").Dec) | ((c: any) => string))[]; | ||
BlocksPerYear: (((string: string, radix?: number | undefined) => number) | ((c: number) => string))[]; | ||
}; | ||
wasm: { | ||
@@ -145,3 +162,3 @@ maxcontractsize: (((string: string, radix?: number | undefined) => number) | ((c: number) => string))[]; | ||
} | ||
export declare type ParamChange = DistributionParamChange | GovParamChange | MarketParamChange | OracleParamChange | SlashingParamChange | StakingParamChange | TreasuryParamChange | WasmParamChange; | ||
export declare type ParamChange = DistributionParamChange | GovParamChange | MarketParamChange | OracleParamChange | SlashingParamChange | StakingParamChange | TreasuryParamChange | WasmParamChange | MintParamChange; | ||
export declare namespace ParamChange { | ||
@@ -153,3 +170,3 @@ type Type<S extends string, K extends string, T> = { | ||
}; | ||
type Data = DistributionParamChange.Data | GovParamChange.Data | MarketParamChange.Data | OracleParamChange.Data | SlashingParamChange.Data | StakingParamChange.Data | TreasuryParamChange.Data | WasmParamChange.Data; | ||
type Data = DistributionParamChange.Data | GovParamChange.Data | MarketParamChange.Data | OracleParamChange.Data | SlashingParamChange.Data | StakingParamChange.Data | TreasuryParamChange.Data | WasmParamChange.Data | MintParamChange.Data; | ||
namespace Data { | ||
@@ -156,0 +173,0 @@ type Type<P extends ParamChange.Type<any, any, any>> = Pick<P, 'subspace' | 'key'> & { |
@@ -23,5 +23,6 @@ "use strict"; | ||
var params_8 = require("../wasm/params"); | ||
var params_9 = require("../mint/params"); | ||
var ParamChanges; | ||
(function (ParamChanges) { | ||
ParamChanges.ConversionTable = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, params_1.DistributionParamChanges.ConversionTable), params_2.GovParamChanges.ConversionTable), params_3.MarketParamChanges.ConversionTable), params_4.OracleParamChanges.ConversionTable), params_5.SlashingParamChanges.ConversionTable), params_6.StakingParamChanges.ConversionTable), params_7.TreasuryParamChanges.ConversionTable), params_8.WasmParamChanges.ConversionTable); | ||
ParamChanges.ConversionTable = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, params_1.DistributionParamChanges.ConversionTable), params_2.GovParamChanges.ConversionTable), params_3.MarketParamChanges.ConversionTable), params_4.OracleParamChanges.ConversionTable), params_5.SlashingParamChanges.ConversionTable), params_6.StakingParamChanges.ConversionTable), params_7.TreasuryParamChanges.ConversionTable), params_8.WasmParamChanges.ConversionTable), params_9.MintParamChanges.ConversionTable); | ||
function fromData(data) { | ||
@@ -28,0 +29,0 @@ var result = {}; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.hashAmino = void 0; | ||
var SHA256_1 = __importDefault(require("crypto-js/SHA256")); | ||
var sha256_1 = __importDefault(require("crypto-js/sha256")); | ||
var enc_base64_1 = __importDefault(require("crypto-js/enc-base64")); | ||
@@ -24,5 +24,5 @@ /* | ||
function hashAmino(txData) { | ||
return SHA256_1.default(enc_base64_1.default.parse(txData)).toString().toUpperCase(); | ||
return sha256_1.default(enc_base64_1.default.parse(txData)).toString().toUpperCase(); | ||
} | ||
exports.hashAmino = hashAmino; | ||
//# sourceMappingURL=hash.js.map |
{ | ||
"version": "0.4.16", | ||
"version": "0.4.17", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"browser": "dist/bundle.js", | ||
"files": [ | ||
@@ -69,3 +70,3 @@ "dist" | ||
"bip39": "^3.0.2", | ||
"crypto-js": "^4", | ||
"crypto-js": "3.3.0", | ||
"decimal.js": "^10.2.0", | ||
@@ -72,0 +73,0 @@ "post-message-stream": "^3.0.0", |
@@ -142,2 +142,16 @@ <p> </p> | ||
## Terra.js on React Native environment | ||
Setup a React Native App and install ```node-libs-react-native``` package. Following instructions were extracted from https://github.com/parshap/node-libs-react-native | ||
You need to register Node.js native modules by: | ||
```js | ||
require('node-libs-react-native/globals') | ||
``` | ||
Add resolver configuration to metro.config.js | ||
```js | ||
resolver: { | ||
extraNodeModules: require('node-libs-react-native'), | ||
}, | ||
``` | ||
## License | ||
@@ -144,0 +158,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
358
171
4806019
16044
+ Addedcrypto-js@3.3.0(transitive)
- Removedcrypto-js@4.2.0(transitive)
Updatedcrypto-js@3.3.0