@tarnadas/near-api-js
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -105,6 +105,2 @@ /// <reference types="node" /> | ||
state(): Promise<AccountView>; | ||
/** @hidden */ | ||
private printLogsAndFailures; | ||
/** @hidden */ | ||
private printLogs; | ||
/** | ||
@@ -111,0 +107,0 @@ * Create a signed transaction which can be broadcast to the network |
@@ -22,2 +22,3 @@ "use strict"; | ||
const errors_1 = require("./utils/errors"); | ||
const logging_1 = require("./utils/logging"); | ||
const rpc_errors_1 = require("./utils/rpc_errors"); | ||
@@ -65,22 +66,2 @@ const constants_1 = require("./constants"); | ||
} | ||
/** @hidden */ | ||
printLogsAndFailures(contractId, results) { | ||
if (!process.env['NEAR_NO_LOGS']) { | ||
for (const result of results) { | ||
console.log(`Receipt${result.receiptIds.length > 1 ? 's' : ''}: ${result.receiptIds.join(', ')}`); | ||
this.printLogs(contractId, result.logs, '\t'); | ||
if (result.failure) { | ||
console.warn(`\tFailure [${contractId}]: ${result.failure}`); | ||
} | ||
} | ||
} | ||
} | ||
/** @hidden */ | ||
printLogs(contractId, logs, prefix = '') { | ||
if (!process.env['NEAR_NO_LOGS']) { | ||
for (const log of logs) { | ||
console.log(`${prefix}Log [${contractId}]: ${log}`); | ||
} | ||
} | ||
} | ||
/** | ||
@@ -137,15 +118,3 @@ * Create a signed transaction which can be broadcast to the network | ||
} | ||
const flatLogs = [result.transaction_outcome, ...result.receipts_outcome].reduce((acc, it) => { | ||
if (it.outcome.logs.length || | ||
(typeof it.outcome.status === 'object' && typeof it.outcome.status.Failure === 'object')) { | ||
return acc.concat({ | ||
'receiptIds': it.outcome.receipt_ids, | ||
'logs': it.outcome.logs, | ||
'failure': typeof it.outcome.status.Failure != 'undefined' ? (0, rpc_errors_1.parseRpcError)(it.outcome.status.Failure) : null | ||
}); | ||
} | ||
else | ||
return acc; | ||
}, []); | ||
this.printLogsAndFailures(signedTx.transaction.receiverId, flatLogs); | ||
(0, logging_1.printTxOutcomeLogsAndFailures)({ contractId: signedTx.transaction.receiverId, outcome: result }); | ||
// Should be falsy if result.status.Failure is null | ||
@@ -401,3 +370,3 @@ if (!returnError && typeof result.status === 'object' && typeof result.status.Failure === 'object' && result.status.Failure !== null) { | ||
if (result.logs) { | ||
this.printLogs(contractId, result.logs); | ||
(0, logging_1.printTxOutcomeLogs)({ contractId, logs: result.logs }); | ||
} | ||
@@ -404,0 +373,0 @@ return result.result && result.result.length > 0 && parse(Buffer.from(result.result)); |
{ | ||
"name": "@tarnadas/near-api-js", | ||
"description": "JavaScript library to interact with NEAR Protocol via RPC API", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"repository": { | ||
@@ -10,5 +10,5 @@ "type": "git", | ||
"homepage": "https://github.com/near/near-api-js", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"main": "lib/index.js", | ||
"browser": "lib/browser-index.js", | ||
"types": "lib/index.d.ts", | ||
"dependencies": { | ||
@@ -25,3 +25,2 @@ "@aws-crypto/sha256-browser": "^2.0.2", | ||
"text-encoding-utf-8": "^1.0.2", | ||
"tsup": "^6.2.3", | ||
"tweetnacl": "^1.0.1" | ||
@@ -55,3 +54,3 @@ }, | ||
"dev": "pnpm compile -w", | ||
"build": "tsup src/index.ts --format esm,cjs --dts", | ||
"build": "pnpm compile && pnpm browserify", | ||
"test": "jest test", | ||
@@ -58,0 +57,0 @@ "lint": "concurrently \"pnpm:lint:*(!fix)\"", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
11
19
8
1170362
81
25084
- Removedtsup@^6.2.3
- Removed@esbuild/android-arm@0.17.19(transitive)
- Removed@esbuild/android-arm64@0.17.19(transitive)
- Removed@esbuild/android-x64@0.17.19(transitive)
- Removed@esbuild/darwin-arm64@0.17.19(transitive)
- Removed@esbuild/darwin-x64@0.17.19(transitive)
- Removed@esbuild/freebsd-arm64@0.17.19(transitive)
- Removed@esbuild/freebsd-x64@0.17.19(transitive)
- Removed@esbuild/linux-arm@0.17.19(transitive)
- Removed@esbuild/linux-arm64@0.17.19(transitive)
- Removed@esbuild/linux-ia32@0.17.19(transitive)
- Removed@esbuild/linux-loong64@0.17.19(transitive)
- Removed@esbuild/linux-mips64el@0.17.19(transitive)
- Removed@esbuild/linux-ppc64@0.17.19(transitive)
- Removed@esbuild/linux-riscv64@0.17.19(transitive)
- Removed@esbuild/linux-s390x@0.17.19(transitive)
- Removed@esbuild/linux-x64@0.17.19(transitive)
- Removed@esbuild/netbsd-x64@0.17.19(transitive)
- Removed@esbuild/openbsd-x64@0.17.19(transitive)
- Removed@esbuild/sunos-x64@0.17.19(transitive)
- Removed@esbuild/win32-arm64@0.17.19(transitive)
- Removed@esbuild/win32-ia32@0.17.19(transitive)
- Removed@esbuild/win32-x64@0.17.19(transitive)
- Removed@isaacs/cliui@8.0.2(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removed@pkgjs/parseargs@0.11.0(transitive)
- Removedansi-regex@5.0.16.1.0(transitive)
- Removedansi-styles@4.3.06.2.1(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedanymatch@3.1.3(transitive)
- Removedarray-union@2.1.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbinary-extensions@2.3.0(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedbraces@3.0.3(transitive)
- Removedbundle-require@4.2.1(transitive)
- Removedcac@6.7.14(transitive)
- Removedchokidar@3.6.0(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcommander@4.1.1(transitive)
- Removedcross-spawn@7.0.6(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddir-glob@3.0.1(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@8.0.09.2.2(transitive)
- Removedesbuild@0.17.19(transitive)
- Removedexeca@5.1.1(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.17.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedforeground-child@3.3.0(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedglob@10.4.5(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedglobby@11.1.0(transitive)
- Removedhuman-signals@2.1.0(transitive)
- Removedignore@5.3.2(transitive)
- Removedis-binary-path@2.1.0(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjackspeak@3.4.3(transitive)
- Removedjoycon@3.1.1(transitive)
- Removedlilconfig@2.1.0(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedload-tsconfig@0.2.5(transitive)
- Removedlodash.sortby@4.7.0(transitive)
- Removedlru-cache@10.4.3(transitive)
- Removedmerge-stream@2.0.0(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedminimatch@9.0.5(transitive)
- Removedminipass@7.1.2(transitive)
- Removedms@2.1.3(transitive)
- Removedmz@2.7.0(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removednpm-run-path@4.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonetime@5.1.2(transitive)
- Removedpackage-json-from-dist@1.0.1(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpath-scurry@1.11.1(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedpirates@4.0.6(transitive)
- Removedpostcss-load-config@3.1.4(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedreaddirp@3.6.0(transitive)
- Removedresolve-from@5.0.0(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrollup@3.29.5(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@3.0.74.1.0(transitive)
- Removedslash@3.0.0(transitive)
- Removedsource-map@0.8.0-beta.0(transitive)
- Removedstring-width@4.2.35.1.2(transitive)
- Removedstrip-ansi@6.0.17.1.0(transitive)
- Removedstrip-final-newline@2.0.0(transitive)
- Removedsucrase@3.35.0(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedtr46@1.0.1(transitive)
- Removedtree-kill@1.2.2(transitive)
- Removedts-interface-checker@0.1.13(transitive)
- Removedtsup@6.7.0(transitive)
- Removedwebidl-conversions@4.0.2(transitive)
- Removedwhatwg-url@7.1.0(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwrap-ansi@7.0.08.1.0(transitive)
- Removedyaml@1.10.2(transitive)