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

@wharfkit/contract

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wharfkit/contract - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

1

lib/contract.d.ts

@@ -220,2 +220,3 @@ import { ABI, APIClient, API, ABIDef, NameType, Name, PermissionLevelType, BytesType, ABISerializableObject, Action, Blob } from '@wharfkit/antelope';

action(name: any, data: ActionDataType, options?: ActionOptions): Action;
readonly(name: any, data: ActionDataType): Promise<any>;
actions(actions: ActionsArgs[], options?: ActionOptions): Action[];

@@ -222,0 +223,0 @@ ricardian(name: NameType): string;

@@ -5,5 +5,5 @@ 'use strict';

var tslib = require('tslib');
var antelope = require('@wharfkit/antelope');
var signingRequest = require('@wharfkit/signing-request');
var tslib = require('tslib');
var abicache = require('@wharfkit/abicache');

@@ -392,2 +392,25 @@

}
readonly(name, data) {
return tslib.__awaiter(this, void 0, void 0, function* () {
const action = this.action(name, data);
action.authorization = [];
const transaction = antelope.Transaction.from({
ref_block_num: 0,
ref_block_prefix: 0,
expiration: 0,
actions: [action],
});
const response = yield this.client.v1.chain.send_read_only_transaction(transaction);
const hexData = response.processed.action_traces[0].return_value_hex_data;
const returnType = this.abi.action_results.find((a) => antelope.Name.from(a.name).equals(name));
if (!returnType) {
throw new Error(`Return type for ${name} not defined in the ABI.`);
}
return antelope.Serializer.decode({
data: hexData,
type: returnType.result_type,
abi: this.abi,
});
});
}
actions(actions, options) {

@@ -394,0 +417,0 @@ return actions.map((action) => this.action(action.name, action.data, {

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

import { isInstanceOf, UInt128, UInt64, Float64, Checksum256, Checksum160, Name, Serializer, ABI, Blob, PermissionLevel, Action } from '@wharfkit/antelope';
import { isInstanceOf, UInt128, UInt64, Float64, Checksum256, Checksum160, Name, Serializer, ABI, Blob, PermissionLevel, Action, Transaction } from '@wharfkit/antelope';
import { PlaceholderAuth } from '@wharfkit/signing-request';

@@ -365,2 +365,23 @@ import { ABICache } from '@wharfkit/abicache';

}
async readonly(name, data) {
const action = this.action(name, data);
action.authorization = [];
const transaction = Transaction.from({
ref_block_num: 0,
ref_block_prefix: 0,
expiration: 0,
actions: [action],
});
const response = await this.client.v1.chain.send_read_only_transaction(transaction);
const hexData = response.processed.action_traces[0].return_value_hex_data;
const returnType = this.abi.action_results.find((a) => Name.from(a.name).equals(name));
if (!returnType) {
throw new Error(`Return type for ${name} not defined in the ABI.`);
}
return Serializer.decode({
data: hexData,
type: returnType.result_type,
abi: this.abi,
});
}
actions(actions, options) {

@@ -367,0 +388,0 @@ return actions.map((action) => this.action(action.name, action.data, {

6

package.json
{
"name": "@wharfkit/contract",
"description": "ContractKit for Wharf",
"version": "1.1.2",
"version": "1.1.3",
"homepage": "https://github.com/wharfkit/contract",

@@ -20,3 +20,3 @@ "license": "BSD-3-Clause",

"@wharfkit/abicache": "^1.2.0",
"@wharfkit/antelope": "^1.0.0",
"@wharfkit/antelope": "^1.0.4",
"@wharfkit/signing-request": "^3.1.0",

@@ -26,3 +26,3 @@ "tslib": "^2.1.0"

"resolutions": {
"@wharfkit/antelope": "^1.0.0"
"@wharfkit/antelope": "^1.0.4"
},

@@ -29,0 +29,0 @@ "devDependencies": {

@@ -12,2 +12,4 @@ import {

PermissionLevelType,
Serializer,
Transaction,
} from '@wharfkit/antelope'

@@ -118,2 +120,29 @@ import {PlaceholderAuth} from '@wharfkit/signing-request'

public async readonly(name, data: ActionDataType): Promise<any> {
// Generate action
const action = this.action(name, data)
// Remove authorizations
action.authorization = []
// Assemble readonly transaction
const transaction = Transaction.from({
ref_block_num: 0,
ref_block_prefix: 0,
expiration: 0,
actions: [action],
})
// Execute and retrieve response
const response = await this.client.v1.chain.send_read_only_transaction(transaction)
// Decode and return results
const hexData = response.processed.action_traces[0].return_value_hex_data
const returnType = this.abi.action_results.find((a) => Name.from(a.name).equals(name))
if (!returnType) {
throw new Error(`Return type for ${name} not defined in the ABI.`)
}
return Serializer.decode({
data: hexData,
type: returnType.result_type,
abi: this.abi,
})
}
public actions(actions: ActionsArgs[], options?: ActionOptions): Action[] {

@@ -120,0 +149,0 @@ return actions.map((action) =>

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