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

@gnosis.pm/safe-apps-sdk

Package Overview
Dependencies
Maintainers
5
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gnosis.pm/safe-apps-sdk - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

8

dist/package.json
{
"name": "@gnosis.pm/safe-apps-sdk",
"version": "2.1.0",
"version": "2.2.0",
"description": "SDK developed to integrate third-party apps with Safe-Multisig app.",

@@ -27,4 +27,3 @@ "main": "dist/src/index.js",

"dependencies": {
"semver": "^7.3.2",
"web3-core": "^1.3.0"
"semver": "^7.3.2"
},

@@ -41,5 +40,2 @@ "devDependencies": {

},
"peerDependencies": {
"web3-core": "^1.3.0"
},
"husky": {

@@ -46,0 +42,0 @@ "hooks": {

@@ -1,4 +0,2 @@

import { TransactionConfig, PastLogsOptions } from 'web3-core';
import { Communicator, Log, BlockTransactionString, BlockTransactionObject, Web3TransactionObject, Web3TransactionReceiptObject } from '../types';
declare type BlockNumberArg = number | 'earliest' | 'latest' | 'pending';
import { BlockNumberArg, Communicator, Log, BlockTransactionString, BlockTransactionObject, Web3TransactionObject, TransactionConfig, Web3TransactionReceiptObject, PastLogsOptions } from '../types';
declare class Eth {

@@ -5,0 +3,0 @@ #private;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {

@@ -73,3 +64,3 @@ if (!privateMap.has(receiver)) {

buildRequest({ call, formatters }) {
return (params) => __awaiter(this, void 0, void 0, function* () {
return async (params) => {
if (formatters && Array.isArray(params)) {

@@ -86,3 +77,3 @@ formatters.forEach((formatter, i) => {

};
const response = yield __classPrivateFieldGet(this, _communicator).send(methods_1.METHODS.rpcCall, payload);
const response = await __classPrivateFieldGet(this, _communicator).send(methods_1.METHODS.rpcCall, payload);
if (!response.success) {

@@ -92,3 +83,3 @@ throw new Error(response.error);

return response.data;
});
};
}

@@ -95,0 +86,0 @@ }

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {

@@ -45,25 +36,19 @@ if (!privateMap.has(receiver)) {

}
bootstrap() {
return __awaiter(this, void 0, void 0, function* () {
const { txServiceUrl } = yield this.getEnvInfo();
this.txs.setTxServiceUrl(txServiceUrl);
});
async bootstrap() {
const { txServiceUrl } = await this.getEnvInfo();
this.txs.setTxServiceUrl(txServiceUrl);
}
getEnvInfo() {
return __awaiter(this, void 0, void 0, function* () {
const response = yield __classPrivateFieldGet(this, _communicator).send(communication_1.METHODS.getEnvInfo, undefined);
if (!response.success) {
throw new Error(response.error);
}
return response.data;
});
async getEnvInfo() {
const response = await __classPrivateFieldGet(this, _communicator).send(communication_1.METHODS.getEnvInfo, undefined);
if (!response.success) {
throw new Error(response.error);
}
return response.data;
}
getSafeInfo() {
return __awaiter(this, void 0, void 0, function* () {
const response = yield __classPrivateFieldGet(this, _communicator).send(communication_1.METHODS.getSafeInfo, undefined);
if (!response.success) {
throw new Error(response.error);
}
return response.data;
});
async getSafeInfo() {
const response = await __classPrivateFieldGet(this, _communicator).send(communication_1.METHODS.getSafeInfo, undefined);
if (!response.success) {
throw new Error(response.error);
}
return response.data;
}

@@ -70,0 +55,0 @@ }

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {

@@ -34,41 +25,37 @@ if (!privateMap.has(receiver)) {

}
getBySafeTxHash(safeTxHash) {
return __awaiter(this, void 0, void 0, function* () {
if (!__classPrivateFieldGet(this, _txServiceUrl)) {
throw new Error("ENV information hasn't been synced yet or there was an error during the process");
async getBySafeTxHash(safeTxHash) {
if (!__classPrivateFieldGet(this, _txServiceUrl)) {
throw new Error("ENV information hasn't been synced yet or there was an error during the process");
}
const controller = new AbortController();
const options = {
method: 'GET',
signal: controller.signal,
};
setTimeout(() => controller.abort(), 10000);
try {
const res = await fetch(`${__classPrivateFieldGet(this, _txServiceUrl)}/transactions/${safeTxHash}`, options);
if (res.status !== 200) {
throw new Error("Failed to get the transaction. Either safeTxHash is incorrect or transaction hasn't been indexed by the service yet");
}
const controller = new AbortController();
const options = {
method: 'GET',
signal: controller.signal,
};
setTimeout(() => controller.abort(), 10000);
try {
const res = yield fetch(`${__classPrivateFieldGet(this, _txServiceUrl)}/transactions/${safeTxHash}`, options);
if (res.status !== 200) {
throw new Error("Failed to get the transaction. Either safeTxHash is incorrect or transaction hasn't been indexed by the service yet");
}
const json = yield res.json();
return json;
}
catch (err) {
throw err;
}
});
const json = await res.json();
return json;
}
catch (err) {
throw err;
}
}
send({ txs, params }) {
return __awaiter(this, void 0, void 0, function* () {
if (!txs || !txs.length) {
throw new Error('No transactions were passed');
}
const messagePayload = {
txs,
params,
};
const response = yield __classPrivateFieldGet(this, _communicator).send(methods_1.METHODS.sendTransactions, messagePayload);
if (!response.success) {
throw new Error(response.error);
}
return response.data;
});
async send({ txs, params }) {
if (!txs || !txs.length) {
throw new Error('No transactions were passed');
}
const messagePayload = {
txs,
params,
};
const response = await __classPrivateFieldGet(this, _communicator).send(methods_1.METHODS.sendTransactions, messagePayload);
if (!response.success) {
throw new Error(response.error);
}
return response.data;
}

@@ -75,0 +62,0 @@ setTxServiceUrl(url) {

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -28,5 +19,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

describe('SDK.txs.send', () => {
test('Should throw an error when passing an empty array', () => __awaiter(void 0, void 0, void 0, function* () {
yield expect(sdkInstance.txs.send({ txs: [] })).rejects.toEqual(new Error('No transactions were passed'));
}));
test('Should throw an error when passing an empty array', async () => {
await expect(sdkInstance.txs.send({ txs: [] })).rejects.toEqual(new Error('No transactions were passed'));
});
test('Should call window.parent.postMessage when passing array of TXs', () => {

@@ -33,0 +24,0 @@ const txs = [{ to: 'address', value: '0', data: '0x' }];

@@ -221,1 +221,17 @@ import { METHODS } from './communication/methods';

}
export declare type BlockNumberArg = number | 'earliest' | 'latest' | 'pending';
export interface TransactionConfig {
from?: string | number;
to?: string;
value?: number | string;
gas?: number | string;
gasPrice?: number | string;
data?: string;
nonce?: number;
}
export interface PastLogsOptions {
fromBlock?: BlockNumberArg;
toBlock?: BlockNumberArg;
address?: string;
topics?: Array<string | string[] | null>;
}
{
"name": "@gnosis.pm/safe-apps-sdk",
"version": "2.1.0",
"version": "2.2.0",
"description": "SDK developed to integrate third-party apps with Safe-Multisig app.",

@@ -27,4 +27,3 @@ "main": "dist/src/index.js",

"dependencies": {
"semver": "^7.3.2",
"web3-core": "^1.3.0"
"semver": "^7.3.2"
},

@@ -41,5 +40,2 @@ "devDependencies": {

},
"peerDependencies": {
"web3-core": "^1.3.0"
},
"husky": {

@@ -46,0 +42,0 @@ "hooks": {

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc