From e98d2f290d832518ed26b799202707e2bbb7dc63 Mon Sep 17 00:00:00 2001 From: Andy Haynes Date: Thu, 23 Mar 2023 11:52:50 -0700 Subject: [PATCH] fix: inline action creation methods to ensure signatures are emitted correctly in the typedef --- packages/near-api-js/src/transaction.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/near-api-js/src/transaction.ts b/packages/near-api-js/src/transaction.ts index e30019e26c..df76a78bc3 100644 --- a/packages/near-api-js/src/transaction.ts +++ b/packages/near-api-js/src/transaction.ts @@ -20,15 +20,18 @@ export { SignedTransaction, Transaction, } from '@near-js/transactions'; -import { actionCreators } from '@near-js/transactions'; -export const addKey = actionCreators.addKey; -export const createAccount = actionCreators.createAccount; -export const deleteAccount = actionCreators.deleteAccount; -export const deleteKey = actionCreators.deleteKey; -export const deployContract = actionCreators.deployContract; -export const fullAccessKey = actionCreators.fullAccessKey; -export const functionCall = actionCreators.functionCall; -export const functionCallAccessKey = actionCreators.functionCallAccessKey; -export const stake = actionCreators.stake; -export const transfer = actionCreators.transfer; +import { PublicKey } from '@near-js/crypto'; +import { AccessKey, actionCreators, stringifyJsonOrBytes } from '@near-js/transactions'; +import BN from 'bn.js'; + +export const addKey = (publicKey: PublicKey, accessKey: AccessKey) => actionCreators.addKey(publicKey, accessKey); +export const createAccount = () => actionCreators.createAccount(); +export const deleteAccount = (beneficiaryId: string) => actionCreators.deleteAccount(beneficiaryId); +export const deleteKey = (publicKey: PublicKey) => actionCreators.deleteKey(publicKey); +export const deployContract = (code: Uint8Array) => actionCreators.deployContract(code); +export const fullAccessKey = () => actionCreators.fullAccessKey(); +export const functionCall = (methodName: string, args: object | Uint8Array, gas: BN, deposit: BN, stringify?: typeof stringifyJsonOrBytes, jsContract?: boolean) => actionCreators.functionCall(methodName, args, gas, deposit, stringify, jsContract); +export const functionCallAccessKey = (receiverId: string, methodNames: string[], allowance?: BN) => actionCreators.functionCallAccessKey(receiverId, methodNames, allowance); +export const stake = (stake: BN, publicKey: PublicKey) => actionCreators.stake(stake, publicKey); +export const transfer = (deposit: BN) => actionCreators.transfer(deposit);