From 2886003a835ce8ff98ef464852972ec1b964ed16 Mon Sep 17 00:00:00 2001 From: daoka Date: Tue, 5 Jan 2021 19:27:07 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=200.10.0.4=20capable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/AnnounceCreateApostille.ts | 6 +- examples/AnnounceUpdateApostille.ts | 8 +- examples/ApostilleAssignOwners.ts | 11 +- examples/ApostilleWithMetadata.ts | 5 +- examples/AuditApostille.ts | 2 +- package-lock.json | 184 ++++++++++++++++-------- package.json | 5 +- src/model/ApostilleTransaction.ts | 24 +++- test/model/ApostilleTransaction.spec.ts | 9 ++ tsconfig.json | 3 +- 10 files changed, 174 insertions(+), 83 deletions(-) diff --git a/examples/AnnounceCreateApostille.ts b/examples/AnnounceCreateApostille.ts index 9366e9c..e50bb82 100644 --- a/examples/AnnounceCreateApostille.ts +++ b/examples/AnnounceCreateApostille.ts @@ -12,11 +12,12 @@ const account = Account.createFromPrivateKey(ownerKey, networkType); const apiEndpoint = 'https://sym-test.opening-line.jp:3001'; const generationHash = '6C1B92391CCB41C96478471C2634C111D9E989DECD66130C0430B5B8D20117CD'; -const feeMultiplier = 100; +const feeMultiplier = 1000; const repositoryFactory = new RepositoryFactoryHttp( apiEndpoint, { generationHash, networkType } ); +const epochAdjustment = 1573430400; const apostilleTransaction = ApostilleTransaction.createFromData( data, @@ -26,7 +27,8 @@ const apostilleTransaction = ApostilleTransaction.createFromData( networkType, generationHash, feeMultiplier, - apiEndpoint + apiEndpoint, + epochAdjustment, ); apostilleTransaction.singedTransactionAndAnnounceType().then((info) => { diff --git a/examples/AnnounceUpdateApostille.ts b/examples/AnnounceUpdateApostille.ts index e48c82f..fdec322 100644 --- a/examples/AnnounceUpdateApostille.ts +++ b/examples/AnnounceUpdateApostille.ts @@ -7,7 +7,7 @@ const networkType = NetworkType.TEST_NET; const data = 'Hello World!!'; -const apostilleAccountKey = 'D9CCB105BDD459432EC7E0A36195F764B210A4ED3BBEEB32BA87D9435C239C09'; +const apostilleAccountKey = 'DABCF0362900EE64F17187EAEDF43793EF48F6796846B7595F7F6E7E77A6F001'; const apostilleAccount = Account.createFromPrivateKey(apostilleAccountKey, networkType); const ownerKey = '3E04C96EBAE99124A1D388B05EBD007AA06CB917E09CA08F5859B3ADC49A148D'; @@ -19,7 +19,8 @@ const repositoryFactory = new RepositoryFactoryHttp( apiEndpoint, { generationHash, networkType } ); -const feeMultiplier = 100; +const feeMultiplier = 1000; +const epochAdjustment = 1573430400; const apostilleTx = ApostilleTransaction.updateFromData( data, @@ -29,7 +30,8 @@ const apostilleTx = ApostilleTransaction.updateFromData( networkType, generationHash, feeMultiplier, - apiEndpoint + apiEndpoint, + epochAdjustment, ); apostilleTx.singedTransactionAndAnnounceType().then((info) => { diff --git a/examples/ApostilleAssignOwners.ts b/examples/ApostilleAssignOwners.ts index 79c4e88..998e2f9 100644 --- a/examples/ApostilleAssignOwners.ts +++ b/examples/ApostilleAssignOwners.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import { NetworkType, Account, RepositoryFactoryHttp, Address, HashLockTransaction, Deadline, NetworkCurrencyPublic, UInt64, TransactionService } from 'symbol-sdk'; +import { NetworkType, Account, RepositoryFactoryHttp, Address, HashLockTransaction, Deadline, UInt64, TransactionService, Currency } from 'symbol-sdk'; import { IApostilleOptions, ApostilleTransaction } from '../src/model'; import { HashingType } from '../src/utils/hash'; @@ -15,7 +15,9 @@ const owner2 = Address.createFromRawAddress('TBCCZ3HXPZLPQBEY6LZ2A3NE6WL5DHKZOMW const apiEndpoint = 'https://sym-test.opening-line.jp:3001'; const generationHash = '6C1B92391CCB41C96478471C2634C111D9E989DECD66130C0430B5B8D20117CD'; -const feeMultiplier = 400; +const feeMultiplier = 1000; +const epochAdjustment = 1573430400; + const repositoryFactory = new RepositoryFactoryHttp( apiEndpoint, { generationHash, networkType } @@ -40,6 +42,7 @@ const apostilleTransaction = ApostilleTransaction.createFromData( generationHash, feeMultiplier, apiEndpoint, + epochAdjustment, option ); @@ -47,8 +50,8 @@ apostilleTransaction.singedTransactionAndAnnounceType().then((info) => { const signedTx = info.signedTransaction; console.log(signedTx.hash); const hashLockTx = HashLockTransaction.create( - Deadline.create(), - NetworkCurrencyPublic.createRelative(10), + Deadline.create(epochAdjustment), + Currency.PUBLIC.createRelative(10), UInt64.fromUint(480), signedTx, networkType, diff --git a/examples/ApostilleWithMetadata.ts b/examples/ApostilleWithMetadata.ts index 5cf8db0..47d6be4 100644 --- a/examples/ApostilleWithMetadata.ts +++ b/examples/ApostilleWithMetadata.ts @@ -12,7 +12,9 @@ const account = Account.createFromPrivateKey(singerKey, networkType); const apiEndpoint = 'https://sym-test.opening-line.jp:3001'; const generationHash = '6C1B92391CCB41C96478471C2634C111D9E989DECD66130C0430B5B8D20117CD'; -const feeMultiplier = 100; +const feeMultiplier = 1000; +const epochAdjustment = 1573430400; + const repositoryFactory = new RepositoryFactoryHttp( apiEndpoint, { generationHash, networkType } @@ -37,6 +39,7 @@ const apostilleTransaction = ApostilleTransaction.createFromData( generationHash, feeMultiplier, apiEndpoint, + epochAdjustment, option ); diff --git a/examples/AuditApostille.ts b/examples/AuditApostille.ts index c8fe4ca..abba86a 100644 --- a/examples/AuditApostille.ts +++ b/examples/AuditApostille.ts @@ -2,7 +2,7 @@ import { AuditService } from '../src/service'; const data = 'Hello World!'; -const txHash = 'E4736F00707FC818A606274CACF03C32BA6F437CFE55551BC6CF00C920B8DA9C'; +const txHash = 'CC0987CA2939DF9DB3C9A7A951DDE86B695FD7F09DF68EB6A152616D5DF202F4'; const apiEndpoint = 'https://sym-test.opening-line.jp:3001'; AuditService.audit(data, txHash, apiEndpoint).then((result) => { diff --git a/package-lock.json b/package-lock.json index b97f397..8e5dc1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-apostille-v2", - "version": "0.2.4", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -617,6 +617,11 @@ "chalk": "^3.0.0" } }, + "@js-joda/core": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@js-joda/core/-/core-3.2.0.tgz", + "integrity": "sha512-PMqgJ0sw5B7FKb2d5bWYIoxjri+QlW/Pys7+Rw82jSH0QN3rB05jZ/VrrsUdh1w4+i2kw9JOejXGq/KhDOX7Kg==" + }, "@sinonjs/commons": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", @@ -907,6 +912,7 @@ "version": "6.12.3", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", + "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1027,6 +1033,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, "requires": { "safer-buffer": "~2.1.0" } @@ -1034,7 +1041,8 @@ "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true }, "assign-symbols": { "version": "1.0.0", @@ -1051,7 +1059,8 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "atob": { "version": "2.1.2", @@ -1062,12 +1071,14 @@ "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true }, "aws4": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", - "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" + "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==", + "dev": true }, "babel-jest": { "version": "25.5.1", @@ -1203,6 +1214,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, "requires": { "tweetnacl": "^0.14.3" }, @@ -1210,7 +1222,8 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true } } }, @@ -1331,12 +1344,13 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true }, "catbuffer-typescript": { - "version": "0.0.22", - "resolved": "https://registry.npmjs.org/catbuffer-typescript/-/catbuffer-typescript-0.0.22.tgz", - "integrity": "sha512-Wip3kJFnXrsMRF+4yJSE/F+aEqrTYLPPXdNuVftHNl9oFaKwQ9si8oI2ruSu53QIR+/ohOlY4QYtOagRpHnrFg==" + "version": "0.0.25", + "resolved": "https://registry.npmjs.org/catbuffer-typescript/-/catbuffer-typescript-0.0.25.tgz", + "integrity": "sha512-ju+46OuI/f9dpvzS6S/oDfLFdT/kDWilKXBe3e4DXGy9bZFtEfmxXBmNyUy4a36JlHKoDDZMq15D+0k+rDWNSg==" }, "chalk": { "version": "3.0.0", @@ -1429,6 +1443,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -1483,7 +1498,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cross-spawn": { "version": "6.0.5", @@ -1547,6 +1563,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -1648,7 +1665,8 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "detect-newline": { "version": "3.1.0", @@ -1689,6 +1707,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -2408,7 +2427,8 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extend-shallow": { "version": "3.0.2", @@ -2499,17 +2519,20 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -2591,12 +2614,14 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true }, "form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -2685,6 +2710,7 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -2734,12 +2760,14 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true }, "har-validator": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "dev": true, "requires": { "ajv": "^6.5.5", "har-schema": "^2.0.0" @@ -2859,6 +2887,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -2974,9 +3003,9 @@ "dev": true }, "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" }, "is-callable": { "version": "1.2.0", @@ -3132,7 +3161,8 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "is-windows": { "version": "1.0.2", @@ -3171,7 +3201,8 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true }, "istanbul-lib-coverage": { "version": "3.0.0", @@ -3723,11 +3754,6 @@ "supports-color": "^7.0.0" } }, - "js-joda": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/js-joda/-/js-joda-1.11.0.tgz", - "integrity": "sha512-/HJpRhwP2fPyuSsCaZuoVJuaSIt8tUXykV4wOMRXrFk7RP9h9VWaFdS9YHKdMepxb/3TdXpL6IhfC9L0sqYVBw==" - }, "js-md5": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.7.3.tgz", @@ -3772,7 +3798,8 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true }, "jsdom": { "version": "15.2.1", @@ -3836,12 +3863,14 @@ "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -3852,7 +3881,8 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "json5": { "version": "2.1.3", @@ -3867,6 +3897,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -3949,7 +3980,8 @@ "lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "dev": true }, "lodash.memoize": { "version": "4.1.2", @@ -4028,9 +4060,9 @@ "integrity": "sha1-grjbrnXieneFOItz+ddyXQ9vMyY=" }, "merkletreejs": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/merkletreejs/-/merkletreejs-0.1.11.tgz", - "integrity": "sha512-nJN3VIHeIAyB/PjO5Dj/Y0SEK7CGCCLD2IbV4el2kUIwlOtX3GOr5MwVO4EU+0AXvoDnJ0nmaLe5O86uIjWz/Q==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/merkletreejs/-/merkletreejs-0.2.12.tgz", + "integrity": "sha512-2w8t/s0Io+qwbG/M8gokb0c9MkTnPtnseJFnMFxd153MwMIaLUzBP9bB4uZYxwOu0wesk5QbuEp/86lO+dlb6A==", "requires": { "buffer-reverse": "^1.0.1", "crypto-js": "^3.1.9-1", @@ -4059,12 +4091,14 @@ "mime-db": { "version": "1.44.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true }, "mime-types": { "version": "2.1.27", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, "requires": { "mime-db": "1.44.0" } @@ -4243,7 +4277,8 @@ "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -4484,7 +4519,8 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true }, "picomatch": { "version": "2.2.2", @@ -4571,7 +4607,8 @@ "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true }, "pump": { "version": "3.0.0", @@ -4586,12 +4623,14 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true }, "react-is": { "version": "16.13.1", @@ -4684,6 +4723,7 @@ "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "dev": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -4711,6 +4751,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", + "dev": true, "requires": { "lodash": "^4.17.19" } @@ -4719,6 +4760,7 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", + "dev": true, "requires": { "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", @@ -4827,7 +4869,8 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "sane": { "version": "4.1.0", @@ -5323,6 +5366,7 @@ "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -5338,7 +5382,8 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true } } }, @@ -5372,7 +5417,8 @@ "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true }, "string-length": { "version": "3.1.0", @@ -5493,37 +5539,44 @@ } }, "symbol-openapi-typescript-fetch-client": { - "version": "0.10.0-3", - "resolved": "https://registry.npmjs.org/symbol-openapi-typescript-fetch-client/-/symbol-openapi-typescript-fetch-client-0.10.0-3.tgz", - "integrity": "sha512-cdRz7Nc/m2i7CC8wHtj//z5RxOKEKhS4l+fFQvh7YUlYcUPaHbgcq4RMXSZPmMJ4PnzocnqWpVKjMj5cTYgrPA==" + "version": "0.10.5-1", + "resolved": "https://registry.npmjs.org/symbol-openapi-typescript-fetch-client/-/symbol-openapi-typescript-fetch-client-0.10.5-1.tgz", + "integrity": "sha512-LS+Ka7hF+IaxinJjvnykKK05wUySXTeYFv1GOjEgj+vXQxewK/TtWrlx9baCeGs6198GJ2f1nYmykflAlLt9OQ==" }, "symbol-sdk": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/symbol-sdk/-/symbol-sdk-0.21.0.tgz", - "integrity": "sha512-YFJ1PcVlFSivZe8RUOOGJJvXN2uleNTZB8ma6VONdz+obyI8QMAzdt4c6niyGTr76Md6dRQVJ/uaq+MpbJtDQg==", + "version": "0.22.2", + "resolved": "https://registry.npmjs.org/symbol-sdk/-/symbol-sdk-0.22.2.tgz", + "integrity": "sha512-NQWP3fBtDNfqwU7wEB46fUt7sqckyjjVTjldDpK6Y9KE1sLvYFoM81OrKNnn3MjaZMe65lY0MytyRSSiMEqR/w==", "requires": { + "@js-joda/core": "^3.2.0", "bluebird": "^3.7.2", - "catbuffer-typescript": "0.0.22", + "catbuffer-typescript": "0.0.25", "crypto-js": "^4.0.0", "diff": "^4.0.2", - "futoin-hkdf": "^1.3.1", - "js-joda": "^1.6.2", + "futoin-hkdf": "^1.3.2", "js-sha256": "^0.9.0", "js-sha3": "^0.8.0", "js-sha512": "^0.8.0", "long": "^4.0.0", - "merkletreejs": "^0.1.7", + "merkletreejs": "^0.2.9", "minimist": "^1.2.5", "node-fetch": "^2.6.0", - "request": "^2.88.0", - "request-promise-native": "^1.0.5", "ripemd160": "^2.0.2", - "rxjs": "^6.5.3", - "rxjs-compat": "^6.5.3", - "symbol-openapi-typescript-fetch-client": "0.10.0-3", + "rxjs": "^6.6.3", + "rxjs-compat": "^6.6.3", + "symbol-openapi-typescript-fetch-client": "0.10.5-1", "tweetnacl": "^1.0.3", - "utf8": "^3.0.0", - "ws": "^7.2.3" + "ws": "^7.3.1" + }, + "dependencies": { + "rxjs": { + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", + "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", + "requires": { + "tslib": "^1.9.0" + } + } } }, "symbol-tree": { @@ -5680,6 +5733,7 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, "requires": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -5764,6 +5818,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, "requires": { "safe-buffer": "^5.0.1" } @@ -5865,6 +5920,7 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, "requires": { "punycode": "^2.1.0" } @@ -5894,7 +5950,8 @@ "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true }, "v8-compile-cache": { "version": "2.1.1", @@ -5935,6 +5992,7 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", diff --git a/package.json b/package.json index d6b7177..8b1a208 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-apostille-v2", - "version": "0.3.0", + "version": "0.3.1", "description": "Symbol blockchain notarization and timestamp service", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -20,7 +20,8 @@ "js-sha256": "^0.9.0", "js-sha3": "^0.8.0", "rxjs": "^6.5.3", - "symbol-sdk": "^0.21.0" + "symbol-sdk": "^0.22.2", + "utf8": "^3.0.0" }, "devDependencies": { "@types/jest": "^25.2.3", diff --git a/src/model/ApostilleTransaction.ts b/src/model/ApostilleTransaction.ts index 34d4bad..682b6ce 100644 --- a/src/model/ApostilleTransaction.ts +++ b/src/model/ApostilleTransaction.ts @@ -44,7 +44,8 @@ export class ApostilleTransaction { networkType: NetworkType, generationHashSeed: string, feeMultiplier: number, - apiEndpoint?: string, + apiEndpoint: string, + epochAdjustment: number, options?: IApostilleOptions, ) { const hashFunc = HashFunctionCreator.create(hashingType); @@ -59,6 +60,7 @@ export class ApostilleTransaction { networkType, generationHashSeed, feeMultiplier, + epochAdjustment, options, ); return apostilleTransaction; @@ -74,6 +76,7 @@ export class ApostilleTransaction { * @param generationHashSeed * @param feeMultiplier * @param apiEndpoint + * @param epochAdjustment * @param options */ public static createFromHashedData( @@ -85,6 +88,7 @@ export class ApostilleTransaction { generationHashSeed: string, feeMultiplier: number, apiEndpoint: string, + epochAdjustment: number, options?: IApostilleOptions, ) { const hashFunc = HashFunctionCreator.create(hashingType); @@ -99,6 +103,7 @@ export class ApostilleTransaction { networkType, generationHashSeed, feeMultiplier, + epochAdjustment, options, ); return apostilleTransaction; @@ -114,6 +119,7 @@ export class ApostilleTransaction { * @param generationHashSeed * @param feeMultiplier * @param apiEndpoint + * @param epochAdjustment */ public static updateFromData( data: DataView, @@ -124,6 +130,7 @@ export class ApostilleTransaction { generationHashSeed: string, feeMultiplier: number, apiEndpoint: string, + epochAdjustment: number, ) { const hashFunc = HashFunctionCreator.create(hashingType); const apostilleMessage = hashFunc.createApostilleTransactionMessage( @@ -137,6 +144,7 @@ export class ApostilleTransaction { networkType, generationHashSeed, feeMultiplier, + epochAdjustment, ); return apostilleTransaction; } @@ -151,6 +159,7 @@ export class ApostilleTransaction { * @param generationHashSeed * @param feeMultiplier * @param apiEndpoint + * @param epochAdjustment */ public static updateFromHashedData( hashedData: string, @@ -161,6 +170,7 @@ export class ApostilleTransaction { generationHashSeed: string, feeMultiplier: number, apiEndpoint: string, + epochAdjustment: number, ) { const hashFunc = HashFunctionCreator.create(hashingType); const apostilleMessage = hashFunc.createApostilleTransactionMessageFromHashedData( @@ -174,6 +184,7 @@ export class ApostilleTransaction { networkType, generationHashSeed, feeMultiplier, + epochAdjustment, ); return apostilleTransaction; } @@ -185,6 +196,7 @@ export class ApostilleTransaction { private readonly networkType: NetworkType, private readonly generationHashSeed: string, private readonly feeMultiplier: number, + private readonly epochAdjustment: number, private readonly options?: IApostilleOptions, ) { this.createCoreTransaction(); @@ -219,7 +231,7 @@ export class ApostilleTransaction { private createCoreTransaction() { const tx = TransferTransaction.create( - Deadline.create(), + Deadline.create(this.epochAdjustment), this.apostilleAccount.publicAccount.address, [], PlainMessage.create(this.apostilleMessage), @@ -237,7 +249,7 @@ export class ApostilleTransaction { approvalNum = this.options.assignOwners.length - 1; } const tx = MultisigAccountModificationTransaction.create( - Deadline.create(), + Deadline.create(this.epochAdjustment), approvalNum, approvalNum, this.options.assignOwners, @@ -253,7 +265,7 @@ export class ApostilleTransaction { const txs: AccountMetadataTransaction[] = []; Object.entries(this.options.metadata).forEach(([k, v]) => { const tx = AccountMetadataTransaction.create( - Deadline.create(), + Deadline.create(this.epochAdjustment), this.apostilleAccount.publicAccount.address, MetadataKeyHelper.keyToKeyId(k), v.length, @@ -302,7 +314,7 @@ export class ApostilleTransaction { private createCompleteTransaction(innerTxs: InnerTransaction[]) { const signerCount = this.getSignerCount(); const tx = AggregateTransaction.createComplete( - Deadline.create(), + Deadline.create(this.epochAdjustment), innerTxs, this.networkType, [] @@ -313,7 +325,7 @@ export class ApostilleTransaction { private createBondedTransaction(innerTxs: InnerTransaction[]) { const singerCount = this.getSignerCount(); const tx = AggregateTransaction.createBonded( - Deadline.create(), + Deadline.create(this.epochAdjustment), innerTxs, this.networkType, [] diff --git a/test/model/ApostilleTransaction.spec.ts b/test/model/ApostilleTransaction.spec.ts index af2cae6..20963d9 100644 --- a/test/model/ApostilleTransaction.spec.ts +++ b/test/model/ApostilleTransaction.spec.ts @@ -12,6 +12,8 @@ const owner2 = Address.createFromRawAddress('TAXM7E-K6UF7I-YPSIAH-7BB6KX-SKE2Q5- const owner3 = Address.createFromRawAddress('TATJFR-D5ENAN-2QD7J4-WKATCB-4T2ZRA-6POK42-SCI') const message = 'fe4e5459831CF9E29E3BFDE4CBA65C21EDEA5319A8E7CBE49F332AAF563D8C908EA1CC273DE337962081B0301F789CAFF9B6003C5BD94DF5F20B63FDF1399640514FA2CC00'; const feeMultiplier = 100; +const epochAdjustment = 1573430400; + const apiEndpoint = 'https://sym-test963.opening-line.jp:3001'; const generationHashSeed = '1DFB2FAA9E7F054168B0C5FCB84F4DEB62CC2B4D317D861F3168D161F54EA78B'; @@ -26,6 +28,7 @@ describe('Should create apostille transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, ); expect(transaction.coreTransaction).toBeDefined(); @@ -45,6 +48,7 @@ describe('Should create apostille transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, ); expect(transaction.coreTransaction).toBeDefined(); @@ -69,6 +73,7 @@ describe('Should create apostille transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, options ); @@ -99,6 +104,7 @@ describe('Should create apostille transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, options ); @@ -129,6 +135,7 @@ describe('Should create apostille transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, options ); @@ -157,6 +164,7 @@ describe('Should create update transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, ); expect(transaction.coreTransaction).toBeDefined(); expect(transaction.assignOwnerShipTransaction).toBeUndefined(); @@ -175,6 +183,7 @@ describe('Should create update transaction', () => { generationHashSeed, feeMultiplier, apiEndpoint, + epochAdjustment, ); expect(transaction.coreTransaction).toBeDefined(); expect(transaction.assignOwnerShipTransaction).toBeUndefined(); diff --git a/tsconfig.json b/tsconfig.json index 0c31ce9..2e7e4e0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,7 +30,8 @@ ], "allowSyntheticDefaultImports": true, "esModuleInterop": true, - "skipLibCheck": true + "skipLibCheck": true, + "noUnusedLocals": false, }, "files": [ "index.ts"