Socket
Socket
Sign inDemoInstall

@terra-money/terra.js

Package Overview
Dependencies
55
Maintainers
5
Versions
230
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.19 to 0.4.20

35

dist/client/lcd/api/TxAPI.d.ts
import { BaseAPI } from './BaseAPI';
import { Msg, StdTx, StdSignMsg, StdFee, Coins, TxInfo, Numeric } from '../../../core';
import { LCDClient } from '../LCDClient';
import { Event, TxLog } from '../../../core';
import { Event, EventsByType, TxLog } from '../../../core';
/** Transaction broadcasting modes */

@@ -21,3 +21,3 @@ export declare enum Broadcast {

gas_used: number;
events: Event;
events: EventsByType;
code?: number;

@@ -30,6 +30,6 @@ }

raw_log: string;
logs: TxLog[];
logs: TxLog.Data[];
gas_wanted: string;
gas_used: string;
events: Event;
events: Event[];
code?: number;

@@ -55,2 +55,24 @@ }

}
export interface TxSearchResult {
total_count: number;
count: number;
page_number: number;
page_total: number;
limit: number;
txs: TxInfo[];
}
export declare namespace TxSearchResult {
interface Data {
total_count: string;
count: string;
page_number: string;
page_total: string;
limit: string;
txs: TxInfo.Data[];
}
}
export interface TxSearchOptions {
page: number;
limit: number;
}
export declare class TxAPI extends BaseAPI {

@@ -119,2 +141,7 @@ lcd: LCDClient;

broadcastAsync(tx: StdTx): Promise<AsyncTxBroadcastResult>;
/**
* Search for transactions based on event attributes.
* @param options
*/
search(options: Partial<TxSearchOptions> | {}): Promise<TxSearchResult>;
}

43

dist/client/lcd/api/TxAPI.js

@@ -67,2 +67,3 @@ "use strict";

var hash_1 = require("../../../util/hash");
var core_2 = require("../../../core");
/** Transaction broadcasting modes */

@@ -263,12 +264,14 @@ var Broadcast;

return __generator(this, function (_a) {
return [2 /*return*/, this._broadcast(tx, Broadcast.BLOCK).then(function (d) { return ({
height: Number.parseInt(d.height),
txhash: d.txhash,
logs: d.logs,
raw_log: d.raw_log,
gas_wanted: Number.parseInt(d.gas_wanted),
gas_used: Number.parseInt(d.gas_used),
events: d.events,
code: d.code,
}); })];
return [2 /*return*/, this._broadcast(tx, Broadcast.BLOCK).then(function (d) {
return {
height: Number.parseInt(d.height),
txhash: d.txhash,
logs: d.logs.map(function (l) { return core_2.TxLog.fromData(l); }),
raw_log: d.raw_log,
gas_wanted: Number.parseInt(d.gas_wanted),
gas_used: Number.parseInt(d.gas_used),
events: core_2.EventsByType.parse(d.events),
code: d.code,
};
})];
});

@@ -290,3 +293,3 @@ });

txhash: d.txhash,
logs: d.logs,
logs: d.logs.map(function (l) { return core_2.TxLog.fromData(l); }),
raw_log: d.raw_log,

@@ -312,2 +315,20 @@ code: d.code,

};
/**
* Search for transactions based on event attributes.
* @param options
*/
TxAPI.prototype.search = function (options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.c.getRaw("/txs", options).then(function (d) { return ({
total_count: Number.parseInt(d.total_count),
count: Number.parseInt(d.count),
page_number: Number.parseInt(d.page_number),
page_total: Number.parseInt(d.page_total),
limit: Number.parseInt(d.limit),
txs: d.txs.map(function (txdata) { return core_1.TxInfo.fromData(txdata); }),
}); })];
});
});
};
return TxAPI;

@@ -314,0 +335,0 @@ }(BaseAPI_1.BaseAPI));

@@ -27,3 +27,2 @@ import { BaseAPI } from './BaseAPI';

max_contract_msg_size: number;
gas_multiplier: number;
}

@@ -35,3 +34,2 @@ export declare namespace WasmParams {

max_contract_msg_size: string;
gas_multiplier: string;
}

@@ -38,0 +36,0 @@ }

@@ -106,3 +106,2 @@ "use strict";

max_contract_msg_size: Number.parseInt(d.max_contract_msg_size),
gas_multiplier: Number.parseInt(d.gas_multiplier),
});

@@ -109,0 +108,0 @@ })];

@@ -104,3 +104,2 @@ import { DistributionParamChange, DistributionParamChanges } from '../distribution/params';

maxcontractmsgsize: (((string: string, radix?: number | undefined) => number) | ((c: number) => string))[];
gasmultiplier: (((string: string, radix?: number | undefined) => number) | ((c: number) => string))[];
};

@@ -107,0 +106,0 @@ treasury: {

@@ -16,3 +16,2 @@ import { JSONSerializable } from '../util/json';

timestamp: string;
events?: Event[] | undefined;
code?: number | undefined;

@@ -29,9 +28,12 @@ /**

* @param timestamp time of inclusion
* @param events events
* @param code error code
*/
constructor(height: number, txhash: string, raw_log: string, logs: TxLog[] | undefined, gas_wanted: number, gas_used: number, tx: StdTx, timestamp: string, events?: Event[] | undefined, code?: number | undefined);
constructor(height: number, txhash: string, raw_log: string, logs: TxLog[] | undefined, gas_wanted: number, gas_used: number, tx: StdTx, timestamp: string, code?: number | undefined);
static fromData(data: TxInfo.Data): TxInfo;
toData(): TxInfo.Data;
}
export interface EventKV {
key: string;
value: string;
}
export interface Event {

@@ -41,12 +43,27 @@ type: string;

}
export interface EventKV {
key: string;
value: string;
export interface EventsByType {
[type: string]: {
[key: string]: string[];
};
}
export interface TxLog {
export declare namespace EventsByType {
type Data = Event[];
function parse(eventData: Event[]): EventsByType;
}
export declare class TxLog extends JSONSerializable<TxLog.Data> {
msg_index: number;
success: boolean;
log: string;
events: Event[];
private _eventData;
events: EventsByType;
constructor(msg_index: number, log: string, _eventData: Event[]);
static fromData(data: TxLog.Data): TxLog;
toData(): TxLog.Data;
}
export declare namespace TxLog {
interface Data {
msg_index: number;
log: string;
events: Event[];
}
}
export declare namespace TxInfo {

@@ -57,3 +74,3 @@ interface Data {

raw_log: string;
logs?: TxLog[];
logs?: TxLog.Data[];
gas_wanted: string;

@@ -63,5 +80,4 @@ gas_used: string;

timestamp: string;
events?: Event[];
code?: number;
}
}

@@ -27,3 +27,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TxInfo = void 0;
exports.TxLog = exports.EventsByType = exports.TxInfo = void 0;
var json_1 = require("../util/json");

@@ -47,6 +47,5 @@ var StdTx_1 = require("./StdTx");

* @param timestamp time of inclusion
* @param events events
* @param code error code
*/
function TxInfo(height, txhash, raw_log, logs, gas_wanted, gas_used, tx, timestamp, events, code) {
function TxInfo(height, txhash, raw_log, logs, gas_wanted, gas_used, tx, timestamp, code) {
var _this = _super.call(this) || this;

@@ -61,3 +60,2 @@ _this.height = height;

_this.timestamp = timestamp;
_this.events = events;
_this.code = code;

@@ -67,3 +65,3 @@ return _this;

TxInfo.fromData = function (data) {
return new TxInfo(Number.parseInt(data.height), data.txhash, data.raw_log, data.logs, Number.parseInt(data.gas_wanted), Number.parseInt(data.gas_used), StdTx_1.StdTx.fromData(data.tx), data.timestamp, data.events, data.code);
return new TxInfo(Number.parseInt(data.height), data.txhash, data.raw_log, data.logs && data.logs.map(function (log) { return TxLog.fromData(log); }), Number.parseInt(data.gas_wanted), Number.parseInt(data.gas_used), StdTx_1.StdTx.fromData(data.tx), data.timestamp, data.code);
};

@@ -81,7 +79,4 @@ TxInfo.prototype.toData = function () {

if (this.logs) {
data = __assign(__assign({}, data), { logs: this.logs });
data = __assign(__assign({}, data), { logs: this.logs.map(function (log) { return log.toData(); }) });
}
if (this.events) {
data = __assign(__assign({}, data), { events: this.events });
}
if (this.code) {

@@ -95,2 +90,46 @@ data = __assign(__assign({}, data), { code: this.code });

exports.TxInfo = TxInfo;
var EventsByType;
(function (EventsByType) {
function parse(eventData) {
var events = {};
eventData.forEach(function (ev) {
ev.attributes.forEach(function (attr) {
if (!(ev.type in events)) {
events[ev.type] = {};
}
if (!(attr.key in events[ev.type])) {
events[ev.type][attr.key] = [];
}
events[ev.type][attr.key].push(attr.value);
});
});
return events;
}
EventsByType.parse = parse;
})(EventsByType = exports.EventsByType || (exports.EventsByType = {}));
var TxLog = /** @class */ (function (_super) {
__extends(TxLog, _super);
function TxLog(msg_index, log, _eventData) {
var _this = _super.call(this) || this;
_this.msg_index = msg_index;
_this.log = log;
_this._eventData = _eventData;
_this.events = EventsByType.parse(_eventData);
return _this;
}
TxLog.fromData = function (data) {
var msg_index = data.msg_index, log = data.log, events = data.events;
return new TxLog(msg_index, log, events);
};
TxLog.prototype.toData = function () {
var _a = this, msg_index = _a.msg_index, log = _a.log;
return {
msg_index: msg_index,
log: log,
events: this._eventData,
};
};
return TxLog;
}(json_1.JSONSerializable));
exports.TxLog = TxLog;
//# sourceMappingURL=TxInfo.js.map

@@ -5,6 +5,5 @@ import { ParamChange } from '..';

declare type MaxContractMsgSize = ParamChange.Type<'wasm', 'maxcontractmsgsize', number>;
declare type GasMultiplier = ParamChange.Type<'wasm', 'gasmultiplier', number>;
export declare type WasmParamChange = MaxContractSize | MaxContractGas | MaxContractMsgSize | GasMultiplier;
export declare type WasmParamChange = MaxContractSize | MaxContractGas | MaxContractMsgSize;
export declare namespace WasmParamChange {
type Data = ParamChange.Data.Type<MaxContractSize> | ParamChange.Data.Type<MaxContractGas> | ParamChange.Data.Type<MaxContractMsgSize> | ParamChange.Data.Type<GasMultiplier>;
type Data = ParamChange.Data.Type<MaxContractSize> | ParamChange.Data.Type<MaxContractGas> | ParamChange.Data.Type<MaxContractMsgSize>;
}

@@ -16,3 +15,2 @@ export interface WasmParamChanges {

maxcontractmsgsize?: number;
gasmultiplier?: number;
};

@@ -26,3 +24,2 @@ }

maxcontractmsgsize: (((string: string, radix?: number | undefined) => number) | ((c: number) => string))[];
gasmultiplier: (((string: string, radix?: number | undefined) => number) | ((c: number) => string))[];
};

@@ -29,0 +26,0 @@ };

@@ -12,3 +12,2 @@ "use strict";

maxcontractmsgsize: [convert_1.Convert.toNumber, convert_1.Convert.toFixed],
gasmultiplier: [convert_1.Convert.toNumber, convert_1.Convert.toFixed],
},

@@ -15,0 +14,0 @@ };

{
"version": "0.4.19",
"version": "0.4.20",
"license": "MIT",

@@ -75,2 +75,2 @@ "main": "dist/index.js",

}
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc