Skip to content

Commit 33ec37f

Browse files
Merge pull request #105 from virtualeconomy/develop
Release v0.2.8
2 parents 9119e43 + 9d27219 commit 33ec37f

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@virtualeconomy/js-vsys",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
44
"description": "The official JavaScript SDK for VSYS APIs",
55
"keywords": [
66
"vsys",
@@ -21,13 +21,19 @@
2121
"author": "",
2222
"license": "ISC",
2323
"dependencies": {
24+
"@elusiv/sdk": "^0.1.18",
25+
"@noble/ed25519": "^2.0.0",
2426
"axlsign": "^1.0.0",
27+
"big-integer": "^1.6.51",
2528
"bignumber.js": "^9.0.2",
29+
"blake2b": "^2.1.4",
2630
"blakejs": "^1.1.1",
2731
"bn.js": "^5.2.1",
2832
"bs58": "^5.0.0",
2933
"buffer": "^6.0.3",
34+
"codechain-primitives": "^1.0.4",
3035
"crypto-js": "^4.1.1",
36+
"curve25519-js": "^0.0.4",
3137
"js-sha256": "^0.9.0",
3238
"js-sha512": "^0.8.0",
3339
"keccak256": "^1.0.6",

src/contract/sys_ctrt.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,22 @@ export class SysCtrt extends ctrt.BaseTokCtrt {
221221
}
222222

223223
/**
224-
* getInt64Bytes converts Big Integer into 8-byte array
224+
* getInt64Bits converts Big Integer into 8-byte array
225225
* @param {BigInt} x - integer to be converted
226226
* @returns {Buffer} 8 Byte array
227227
*/
228-
async getInt64Bytes(x) {
228+
getInt64Bits(x) {
229229
const bytes = Buffer.alloc(8);
230230
bytes.writeBigInt64BE(x);
231231
return bytes;
232232
}
233233

234234
/**
235-
* getInt16Bytes converts Short Integer into 2-byte array
235+
* getInt16Bits converts Short Integer into 2-byte array
236236
* @param {number} x - integer to be converted
237237
* @returns {Buffer} 2 Byte array
238238
*/
239-
async getInt16Bytes(x) {
239+
getInt16Bits(x) {
240240
const bytes = Buffer.alloc(2);
241241
bytes.writeInt16BE(x);
242242
return bytes;
@@ -252,22 +252,22 @@ export class SysCtrt extends ctrt.BaseTokCtrt {
252252
* @param {string} attachment - encoded attachment from transaction info
253253
* @returns {string} generated transaction ID
254254
*/
255-
async generateTxID(
255+
generateTxID(
256256
timestamp,
257257
amount,
258258
fee,
259259
feeScale,
260260
recipient,
261261
attachment
262262
) {
263-
const timestampBytes = getInt64Bytes(BigInt(timestamp.toString()))
264-
const amountBytes = getInt64Bytes(BigInt(amount.toString()))
265-
const feeBytes = getInt64Bytes(BigInt(fee.toString()))
266-
const feeScaleBytes = getInt16Bytes(feeScale)
263+
const timestampBytes = this.getInt64Bits(BigInt(timestamp.toString()))
264+
const amountBytes = this.getInt64Bits(BigInt(amount.toString()))
265+
const feeBytes = this.getInt64Bits(BigInt(fee.toString()))
266+
const feeScaleBytes = this.getInt16Bits(feeScale)
267267
const recipientBytesArr = base58.decode(recipient)
268268

269269
const attachmentBytes = base58.decode(attachment)
270-
const lenBytes = getInt16Bytes(attachmentBytes.length)
270+
const lenBytes = this.getInt16Bits(attachmentBytes.length)
271271

272272
const toSign = Buffer.concat([Uint8Array.from([2]), timestampBytes, amountBytes, feeBytes, feeScaleBytes, recipientBytesArr, lenBytes, attachmentBytes])
273273

0 commit comments

Comments
 (0)