Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dfinity/rosetta-client

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/rosetta-client - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

23

lib/construction_combine.js

@@ -45,2 +45,7 @@ const assert = require("assert").strict;

const signatures_by_sig_data = new Map();
for (const sig of req.signatures) {
signatures_by_sig_data.set(sig.signing_payload.hex_bytes, sig);
}
const envelopes = [];

@@ -54,16 +59,10 @@

const transaction_signature = req.signatures.find(
(sig) =>
blobFromHex(sig.signing_payload.hex_bytes).compare(
make_sig_data(HttpCanisterUpdate_id(update))
) === 0
const transaction_signature = signatures_by_sig_data.get(
blobToHex(make_sig_data(HttpCanisterUpdate_id(update)))
);
const read_state_signature = req.signatures.find(
(sig) =>
blobFromHex(sig.signing_payload.hex_bytes).compare(
make_sig_data(
HttpReadState_representation_independent_hash(read_state)
)
) === 0
const read_state_signature = signatures_by_sig_data.get(
blobToHex(
make_sig_data(HttpReadState_representation_independent_hash(read_state))
)
);

@@ -70,0 +69,0 @@

{
"name": "@dfinity/rosetta-client",
"version": "0.4.1",
"version": "0.5.0",
"main": "./index.js",

@@ -32,3 +32,3 @@ "type": "commonjs",

"dependencies": {
"@dfinity/agent": "^0.8.1",
"@dfinity/agent": "^0.8.3",
"axios": "^0.21.1",

@@ -43,2 +43,3 @@ "cbor": "^7.0.4",

"devDependencies": {
"0x": "^4.10.2",
"node-inspect-extracted": "^1.0.5",

@@ -45,0 +46,0 @@ "patch-package": "^6.4.7",

@@ -16,2 +16,3 @@ # `@dfinity/rosetta-client`

```javascript
let { randomBytes } = require("crypto");
let { key_new, key_to_pub_key } = require("@dfinity/rosetta-client");

@@ -32,3 +33,3 @@

// 钥。
let seed = Buffer.allocUnsafe(32);
let seed = randomBytes(32);
privateKey = key_new(seed);

@@ -258,4 +259,44 @@

This package is tested against latest versions of Node.js v12/v13/v14/v15.
This package is tested against latest versions of Node.js v10/v12/v13/v14/v15.
## Common traps and pitfalls
### Working with BigInt
Because of JavaScript number type's [limit][js-max-safe-int] in integer
precision, we use `BigInt`s everywhere (amounts, fee, timestamps, etc) to
represent integers. There are things to watch out when using `BigInt`s with this
package:
由于 JavaScript 数字类型表示整数时的精度[限制][js-max-safe-int],我们在本库中凡
是涉及整数的部分均使用 `BigInt` 类型(如转账金额、交易费用、时间戳等)。使用
`BigInt` 时需要留意的要点:
```javascript
// Don't do this! Precision loss!
// 不要这样,会有精度损失!
let timestamp = BigInt(Date.now() * 1000000);
// Do this instead!
// 这样才对!
let timestamp = BigInt(Date.now()) * 1000000n;
```
Also, JavaScript's builtin `JSON` encoder/decoder won't work with the
input/output data of this package. We use [`json-bigint`][json-bigint] for JSON
encoding/decoding in this package, and if you need to work with JSON too, you
also need `json-bigint`.
另外,JavaScript 内置的 `JSON` 序列化函数不能用于本库输入/输出的数据。我们使用
[`json-bigint`][json-bigint] 库用于 JSON 序列化,如果您也需要处理 JSON 数据,您
也应当使用 `json-bigint`.
```javascript
const JSONbig = require("json-bigint")({ strict: true, useNativeBigInt: true });
JSONbig.parse(); // Use this instead of JSON.parse()
JSONbig.stringify(); // Use this instead of JSON.stringify()
```
[json-bigint]: https://www.npmjs.com/package/json-bigint
[js-max-safe-int]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
[rosetta-ts-client]: https://github.com/lunarhq/rosetta-ts-client

@@ -262,0 +303,0 @@

Sorry, the diff of this file is too big to display

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