New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@injectivelabs/chain-consumer

Package Overview
Dependencies
Maintainers
9
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@injectivelabs/chain-consumer - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

4

dist/composers/AuthzComposer.d.ts
import { MsgGrant, MsgRevoke } from '@injectivelabs/chain-api/cosmos/authz/v1beta1/tx_pb';
import { ComposerResponse } from '@injectivelabs/ts-types';
export declare class AuthzComposer {
static grant({ grantee, granter, messageType, expiryInSeconds, }: {
static grant({ grantee, granter, messageType, expiryInYears, }: {
messageType: string;
grantee: string;
granter: string;
expiryInSeconds?: number;
expiryInYears?: number;
}): ComposerResponse<MsgGrant, MsgGrant.AsObject>;

@@ -10,0 +10,0 @@ static revoke({ grantee, granter, messageType, }: {

@@ -9,11 +9,15 @@ "use strict";

const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
const SECONDS_IN_A_YEAR = utils_1.SECONDS_IN_A_DAY.times(365).toNumber();
class AuthzComposer {
static grant({ grantee, granter, messageType, expiryInSeconds = SECONDS_IN_A_YEAR, }) {
var _a;
const now = Math.round(new Date().getTime() / 1000);
static grant({ grantee, granter, messageType, expiryInYears = 5, }) {
var _a, _b;
const dateNow = new Date();
const expiration = new Date(dateNow.getFullYear() + expiryInYears, dateNow.getMonth(), dateNow.getDate());
const timestamp = new timestamp_pb_1.Timestamp();
timestamp.setSeconds(now + expiryInSeconds);
timestamp.setSeconds(expiration.getTime() / 1000);
const genericAuthorization = new authz_pb_1.GenericAuthorization();
genericAuthorization.setMsg(messageType);
const genericAuthorizationType = '/cosmos.authz.v1beta1.GenericAuthorization';
const authorization = new any_pb_1.Any();
authorization.setTypeUrl(messageType);
authorization.setTypeUrl(genericAuthorizationType);
authorization.setValue(genericAuthorization.getMsg());
const grant = new authz_pb_1.Grant();

@@ -28,3 +32,6 @@ grant.setExpiration(timestamp);

const web3GatewayMessage = (0, utils_1.getWeb3GatewayMessage)(message.toObject(), type);
const web3GatewayMessageWithAuthorizationType = Object.assign(Object.assign({}, web3GatewayMessage), { grant: Object.assign(Object.assign({}, web3GatewayMessage.grant), { authorization: Object.assign(Object.assign({}, (_a = web3GatewayMessage.grant) === null || _a === void 0 ? void 0 : _a.authorization), { '@type': messageType }) }) });
const web3GatewayMessageWithAuthorizationType = Object.assign(Object.assign({}, web3GatewayMessage), { grant: Object.assign(Object.assign({}, web3GatewayMessage.grant), { authorization: {
msg: (_b = (_a = web3GatewayMessage.grant) === null || _a === void 0 ? void 0 : _a.authorization) === null || _b === void 0 ? void 0 : _b.value,
'@type': genericAuthorizationType,
}, expiration: timestamp.toDate() }) });
return {

@@ -31,0 +38,0 @@ web3GatewayMessage: web3GatewayMessageWithAuthorizationType,

{
"name": "@injectivelabs/chain-consumer",
"description": "Interacting with our Chain API made easy. Can be reused throughout Injective's projects.",
"version": "0.5.2",
"version": "0.5.3",
"license": "MIT",

@@ -43,3 +43,3 @@ "main": "dist/index.js",

},
"gitHead": "f48197edab51376ff6178a88c98a8f65d15c2356"
"gitHead": "6f18c3025d24b5517c2876bebc39eb203445f0cc"
}

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc