@near-js/transactions
Advanced tools
Comparing version 1.1.2 to 1.2.0
/// <reference types="node" /> | ||
import { PublicKey } from '@near-js/crypto'; | ||
import BN from 'bn.js'; | ||
import { AccessKey, Action } from './actions'; | ||
@@ -19,3 +18,3 @@ import { DelegateAction } from './delegate'; | ||
*/ | ||
declare function functionCallAccessKey(receiverId: string, methodNames: string[], allowance?: BN): AccessKey; | ||
declare function functionCallAccessKey(receiverId: string, methodNames: string[], allowance?: bigint): AccessKey; | ||
/** | ||
@@ -49,3 +48,3 @@ * Creates a new action for creating a new NEAR account. | ||
*/ | ||
declare function functionCall(methodName: string, args: Uint8Array | object, gas?: BN, deposit?: BN, stringify?: typeof stringifyJsonOrBytes, jsContract?: boolean): Action; | ||
declare function functionCall(methodName: string, args: Uint8Array | object, gas?: bigint, deposit?: bigint, stringify?: typeof stringifyJsonOrBytes, jsContract?: boolean): Action; | ||
/** | ||
@@ -56,3 +55,3 @@ * Creates a new action for transferring funds, optionally specifying a deposit amount. | ||
*/ | ||
declare function transfer(deposit?: BN): Action; | ||
declare function transfer(deposit?: bigint): Action; | ||
/** | ||
@@ -64,3 +63,3 @@ * Creates a new action for staking tokens, specifying the stake amount and public key. | ||
*/ | ||
declare function stake(stake: BN, publicKey: PublicKey): Action; | ||
declare function stake(stake: bigint, publicKey: PublicKey): Action; | ||
/** | ||
@@ -91,3 +90,3 @@ * Creates a new action for adding a public key with a specified access key. | ||
*/ | ||
declare function signedDelegate({ delegateAction, signature }: { | ||
declare function signedDelegate({ delegateAction, signature, }: { | ||
delegateAction: DelegateAction; | ||
@@ -94,0 +93,0 @@ signature: Signature; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.actionCreators = exports.stringifyJsonOrBytes = void 0; | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
const actions_1 = require("./actions"); | ||
@@ -18,3 +14,3 @@ /** | ||
fullAccess: new actions_1.FullAccessPermission({}), | ||
}) | ||
}), | ||
}); | ||
@@ -33,4 +29,8 @@ } | ||
permission: new actions_1.AccessKeyPermission({ | ||
functionCall: new actions_1.FunctionCallPermission({ receiverId, allowance, methodNames }), | ||
}) | ||
functionCall: new actions_1.FunctionCallPermission({ | ||
receiverId, | ||
allowance, | ||
methodNames, | ||
}), | ||
}), | ||
}); | ||
@@ -74,5 +74,7 @@ } | ||
*/ | ||
function functionCall(methodName, args, gas = new bn_js_1.default(0), deposit = new bn_js_1.default(0), stringify = stringifyJsonOrBytes, jsContract = false) { | ||
function functionCall(methodName, args, gas = BigInt(0), deposit = BigInt(0), stringify = stringifyJsonOrBytes, jsContract = false) { | ||
if (jsContract) { | ||
return new actions_1.Action({ functionCall: new actions_1.FunctionCall({ methodName, args, gas, deposit }) }); | ||
return new actions_1.Action({ | ||
functionCall: new actions_1.FunctionCall({ methodName, args, gas, deposit }), | ||
}); | ||
} | ||
@@ -93,3 +95,3 @@ return new actions_1.Action({ | ||
*/ | ||
function transfer(deposit = new bn_js_1.default(0)) { | ||
function transfer(deposit = BigInt(0)) { | ||
return new actions_1.Action({ transfer: new actions_1.Transfer({ deposit }) }); | ||
@@ -103,3 +105,3 @@ } | ||
*/ | ||
function stake(stake = new bn_js_1.default(0), publicKey) { | ||
function stake(stake = BigInt(0), publicKey) { | ||
return new actions_1.Action({ stake: new actions_1.Stake({ stake, publicKey }) }); | ||
@@ -138,4 +140,6 @@ } | ||
*/ | ||
function signedDelegate({ delegateAction, signature }) { | ||
return new actions_1.Action({ signedDelegate: new actions_1.SignedDelegate({ delegateAction, signature }) }); | ||
function signedDelegate({ delegateAction, signature, }) { | ||
return new actions_1.Action({ | ||
signedDelegate: new actions_1.SignedDelegate({ delegateAction, signature }), | ||
}); | ||
} | ||
@@ -142,0 +146,0 @@ exports.actionCreators = { |
import { PublicKey } from '@near-js/crypto'; | ||
import { Assignable } from '@near-js/types'; | ||
import BN from 'bn.js'; | ||
import { DelegateAction } from './delegate'; | ||
@@ -11,3 +10,3 @@ import { Signature } from './signature'; | ||
export declare class FunctionCallPermission extends Assignable { | ||
allowance?: BN; | ||
allowance?: bigint; | ||
receiverId: string; | ||
@@ -23,3 +22,3 @@ methodNames: string[]; | ||
export declare class AccessKey extends Assignable { | ||
nonce: BN; | ||
nonce: bigint; | ||
permission: AccessKeyPermission; | ||
@@ -37,10 +36,10 @@ } | ||
args: Uint8Array; | ||
gas: BN; | ||
deposit: BN; | ||
gas: bigint; | ||
deposit: bigint; | ||
} | ||
export declare class Transfer extends IAction { | ||
deposit: BN; | ||
deposit: bigint; | ||
} | ||
export declare class Stake extends IAction { | ||
stake: BN; | ||
stake: bigint; | ||
publicKey: PublicKey; | ||
@@ -47,0 +46,0 @@ } |
import { PublicKey } from '@near-js/crypto'; | ||
import BN from 'bn.js'; | ||
import { Action } from './actions'; | ||
@@ -15,3 +14,3 @@ import { Transaction } from './schema'; | ||
*/ | ||
export declare function createTransaction(signerId: string, publicKey: PublicKey, receiverId: string, nonce: BN | string | number, actions: Action[], blockHash: Uint8Array): Transaction; | ||
export declare function createTransaction(signerId: string, publicKey: PublicKey, receiverId: string, nonce: bigint | string | number, actions: Action[], blockHash: Uint8Array): Transaction; | ||
//# sourceMappingURL=create_transaction.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createTransaction = void 0; | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
const schema_1 = require("./schema"); | ||
@@ -20,4 +16,12 @@ /** | ||
function createTransaction(signerId, publicKey, receiverId, nonce, actions, blockHash) { | ||
return new schema_1.Transaction({ signerId, publicKey, nonce: new bn_js_1.default(nonce), receiverId, actions, blockHash }); | ||
const txNonce = typeof nonce === 'bigint' ? nonce : BigInt(nonce); | ||
return new schema_1.Transaction({ | ||
signerId, | ||
publicKey, | ||
nonce: txNonce, | ||
receiverId, | ||
actions, | ||
blockHash, | ||
}); | ||
} | ||
exports.createTransaction = createTransaction; |
import { PublicKey } from '@near-js/crypto'; | ||
import { Assignable } from '@near-js/types'; | ||
import BN from 'bn.js'; | ||
import { Action } from './actions'; | ||
@@ -9,4 +8,4 @@ export declare class DelegateAction extends Assignable { | ||
actions: Array<Action>; | ||
nonce: BN; | ||
maxBlockHeight: BN; | ||
nonce: bigint; | ||
maxBlockHeight: bigint; | ||
publicKey: PublicKey; | ||
@@ -13,0 +12,0 @@ } |
import { PublicKey } from '@near-js/crypto'; | ||
import { Assignable } from '@near-js/types'; | ||
import { Schema } from 'borsh'; | ||
import BN from 'bn.js'; | ||
import { Action, SignedDelegate } from './actions'; | ||
@@ -39,3 +38,3 @@ import { DelegateAction } from './delegate'; | ||
publicKey: PublicKey; | ||
nonce: BN; | ||
nonce: bigint; | ||
receiverId: string; | ||
@@ -42,0 +41,0 @@ actions: Action[]; |
import { Signer } from '@near-js/signers'; | ||
import BN from 'bn.js'; | ||
import { Action, SignedDelegate } from './actions'; | ||
@@ -18,3 +17,3 @@ import type { DelegateAction } from './delegate'; | ||
export declare function signTransaction(transaction: Transaction, signer: Signer, accountId?: string, networkId?: string): Promise<[Uint8Array, SignedTransaction]>; | ||
export declare function signTransaction(receiverId: string, nonce: BN, actions: Action[], blockHash: Uint8Array, signer: Signer, accountId?: string, networkId?: string): Promise<[Uint8Array, SignedTransaction]>; | ||
export declare function signTransaction(receiverId: string, nonce: bigint, actions: Action[], blockHash: Uint8Array, signer: Signer, accountId?: string, networkId?: string): Promise<[Uint8Array, SignedTransaction]>; | ||
/** | ||
@@ -21,0 +20,0 @@ * Sign a delegate action |
{ | ||
"name": "@near-js/transactions", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Functions and data types for transactions on NEAR", | ||
@@ -10,9 +10,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"bn.js": "5.2.1", | ||
"borsh": "1.0.0", | ||
"@noble/hashes": "1.3.3", | ||
"@near-js/crypto": "1.2.1", | ||
"@near-js/signers": "0.1.1", | ||
"@near-js/types": "0.0.4", | ||
"@near-js/utils": "0.1.0" | ||
"@near-js/crypto": "1.2.2", | ||
"@near-js/signers": "0.1.2", | ||
"@near-js/types": "0.1.0", | ||
"@near-js/utils": "0.2.0" | ||
}, | ||
@@ -24,3 +23,3 @@ "devDependencies": { | ||
"typescript": "4.9.4", | ||
"@near-js/keystores": "0.0.9" | ||
"@near-js/keystores": "0.0.10" | ||
}, | ||
@@ -27,0 +26,0 @@ "files": [ |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
1011
51354
+ Added@near-js/crypto@1.2.2(transitive)
+ Added@near-js/keystores@0.0.10(transitive)
+ Added@near-js/signers@0.1.2(transitive)
+ Added@near-js/types@0.1.0(transitive)
+ Added@near-js/utils@0.2.0(transitive)
- Removedbn.js@5.2.1
- Removed@near-js/crypto@1.2.1(transitive)
- Removed@near-js/keystores@0.0.9(transitive)
- Removed@near-js/signers@0.1.1(transitive)
- Removed@near-js/types@0.0.4(transitive)
- Removed@near-js/utils@0.1.0(transitive)
- Removedbn.js@5.2.1(transitive)
Updated@near-js/crypto@1.2.2
Updated@near-js/signers@0.1.2
Updated@near-js/types@0.1.0
Updated@near-js/utils@0.2.0