Socket
Socket
Sign inDemoInstall

@near-js/transactions

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@near-js/transactions - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

22

lib/actions.d.ts

@@ -18,4 +18,4 @@ import { PublicKey } from '@near-js/crypto';

export declare class AccessKeyPermission extends Enum {
functionCall: FunctionCallPermission;
fullAccess: FullAccessPermission;
functionCall?: FunctionCallPermission;
fullAccess?: FullAccessPermission;
}

@@ -64,12 +64,12 @@ export declare class AccessKey extends Assignable {

export declare class Action extends Enum {
createAccount: CreateAccount;
deployContract: DeployContract;
functionCall: FunctionCall;
transfer: Transfer;
stake: Stake;
addKey: AddKey;
deleteKey: DeleteKey;
deleteAccount: DeleteAccount;
signedDelegate: SignedDelegate;
createAccount?: CreateAccount;
deployContract?: DeployContract;
functionCall?: FunctionCall;
transfer?: Transfer;
stake?: Stake;
addKey?: AddKey;
deleteKey?: DeleteKey;
deleteAccount?: DeleteAccount;
signedDelegate?: SignedDelegate;
}
export {};
import { PublicKey } from '@near-js/crypto';
import { Assignable } from '@near-js/types';
import BN from 'bn.js';
import { IAction } from './actions';
import { Action } from './actions';
export declare class DelegateAction extends Assignable {
senderId: string;
receiverId: string;
actions: Array<IAction>;
actions: Array<Action>;
nonce: BN;

@@ -10,0 +10,0 @@ maxBlockHeight: BN;

@@ -5,2 +5,4 @@ "use strict";

const types_1 = require("@near-js/types");
const action_creators_1 = require("./action_creators");
const { addKey, createAccount, deleteAccount, deleteKey, deployContract, functionCall, stake, transfer, } = action_creators_1.actionCreators;
class DelegateAction extends types_1.Assignable {

@@ -22,3 +24,47 @@ }

receiverId,
actions,
actions: actions.map((a) => {
// @ts-expect-error type workaround
if (!a.type && !a.params) {
return a;
}
// @ts-expect-error type workaround
switch (a.type) {
case 'AddKey': {
// @ts-expect-error type workaround
const { publicKey, accessKey } = a.params;
return addKey(publicKey, accessKey);
}
case 'CreateAccount': {
// @ts-expect-error type workaround
return createAccount(a.params.createAccount);
}
case 'DeleteAccount': {
// @ts-expect-error type workaround
return deleteAccount(a.params.deleteAccount);
}
case 'DeleteKey': {
// @ts-expect-error type workaround
return deleteKey(a.params.publicKey);
}
case 'DeployContract': {
// @ts-expect-error type workaround
return deployContract(a.params.code);
}
case 'FunctionCall': {
// @ts-expect-error type workaround
const { methodName, args, gas, deposit } = a.params;
return functionCall(methodName, args, gas, deposit);
}
case 'Stake': {
// @ts-expect-error type workaround
return stake(a.params.stake, a.params.publicKey);
}
case 'Transfer': {
// @ts-expect-error type workaround
const { deposit } = a.params;
return transfer(deposit);
}
}
throw new Error('Unrecognized action');
}),
nonce,

@@ -25,0 +71,0 @@ maxBlockHeight,

{
"name": "@near-js/transactions",
"version": "0.1.1",
"version": "0.2.0",
"description": "Functions and data types for transactions on NEAR",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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