Skip to content

Commit 1d16cf9

Browse files
authored
Merge pull request #13 from nash-io/ts/update-nash-protocol-2
Ts/update nash protocol 2
2 parents 7b98397 + 921976a commit 1d16cf9

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="5.0.35"></a>
6+
## [5.0.35](https://github.com/nash-io/api-client-typescript/compare/v5.0.33...v5.0.35) (2020-06-24)
7+
8+
9+
10+
<a name="5.0.33"></a>
11+
## [5.0.33](https://github.com/nash-io/api-client-typescript/compare/v5.0.31...v5.0.33) (2020-06-24)
12+
13+
14+
515
<a name="5.0.31"></a>
616
## [5.0.31](https://github.com/nash-io/api-client-typescript/compare/v5.0.29-pages...v5.0.31) (2020-06-23)
717

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@neon-exchange/api-client-typescript",
3-
"version": "5.0.31",
3+
"version": "5.0.35",
44
"description": "Official TypeScript client for interacting with the Nash exchange",
55
"main": "build/main/index.js",
66
"typings": "build/main/index.d.ts",
@@ -62,7 +62,7 @@
6262
"@absinthe/socket": "0.2.1",
6363
"@cityofzion/neon-js": "4.7.2",
6464
"@neon-exchange/nash-perf": "1.0.4",
65-
"@neon-exchange/nash-protocol": "3.2.27",
65+
"@neon-exchange/nash-protocol": "3.2.29",
6666
"@types/isomorphic-fetch": "0.0.35",
6767
"@types/node": "13.9.8",
6868
"@types/request": "2.48.1",

src/client/client.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ import {
221221
createSignStatesParams,
222222
createSyncStatesParams,
223223
createTimestamp,
224+
createTimestamp32,
224225
encryptSecretKey,
225226
getHKDFKeysFromPassword,
226227
getSecretKey,
@@ -775,7 +776,7 @@ export class Client {
775776
this.nashProtocolMarketData = mapMarketsForNashProtocol(this.marketData)
776777
this.assetData = await this.fetchAssetData()
777778

778-
this.currentOrderNonce = this.createTimestamp32()
779+
this.currentOrderNonce = createTimestamp32()
779780
await this.updateTradedAssetNonces()
780781
}
781782

@@ -854,7 +855,7 @@ export class Client {
854855
this.marketData = await this.fetchMarketData()
855856
this.assetData = await this.fetchAssetData()
856857
this.assetNonces = {}
857-
this.currentOrderNonce = this.createTimestamp32()
858+
this.currentOrderNonce = createTimestamp32()
858859
if (resp.data.signIn.twoFaRequired) {
859860
if (twoFaCode !== undefined) {
860861
this.account = await this.doTwoFactorLogin(twoFaCode)
@@ -2644,7 +2645,7 @@ export class Client {
26442645
)
26452646
} else {
26462647
const sendAmount = parseFloat(amount) * 1e8
2647-
const timestamp = new BigNumber(this.createTimestamp32()).toString(16)
2648+
const timestamp = new BigNumber(createTimestamp32()).toString(16)
26482649
transaction = new tx.InvocationTransaction({
26492650
script: NeonJS.default.create.script({
26502651
scriptHash: assetData.hash,
@@ -3358,7 +3359,7 @@ export class Client {
33583359
txId: prefixWith0xIfNeeded(hash)
33593360
}
33603361
case 'neo':
3361-
const timestamp = new BigNumber(this.createTimestamp32()).toString(16)
3362+
const timestamp = new BigNumber(createTimestamp32()).toString(16)
33623363
const balance = await NeonJS.api.neoscan.getBalance(
33633364
this.opts.neoScan,
33643365
childKey.address
@@ -3619,10 +3620,6 @@ export class Client {
36193620
this.assetNonces = assetNonces
36203621
}
36213622

3622-
private createTimestamp32(): number {
3623-
return Math.trunc(new Date().getTime() / 10) - 155000000000
3624-
}
3625-
36263623
private getNoncesForTrade(
36273624
marketName: string,
36283625
direction: OrderBuyOrSell

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,10 +784,10 @@
784784
node-fetch "2.6.0"
785785
semver "7.3.2"
786786

787-
"@neon-exchange/nash-protocol@^3.2.27":
788-
version "3.2.27"
789-
resolved "https://registry.yarnpkg.com/@neon-exchange/nash-protocol/-/nash-protocol-3.2.27.tgz#6c561434e7eabf04df046ad1ecfcdda1de923015"
790-
integrity sha512-clXfNWY5oAdJ0Id19DZ8CLE5IH6eI9J8xY21QM7GHJYXkqWnTtjl4Vg1vbLrgVjpMDCzcBB70Ss5iYIM+J0lzw==
787+
"@neon-exchange/nash-protocol@3.2.29":
788+
version "3.2.29"
789+
resolved "https://registry.yarnpkg.com/@neon-exchange/nash-protocol/-/nash-protocol-3.2.29.tgz#0408b5fbb77c747c3d8a3468e35408879d219873"
790+
integrity sha512-8KHDrhSKlNU5TxD7VAvw+YqjIQcnIxX+lRVXb3pnViyYAr1ZWhbPW3snjdkIQWu3fRHKhT4EQeKDckxu/uuBBQ==
791791
dependencies:
792792
bignumber.js "8.1.1"
793793
bip32 "2.0.3"

0 commit comments

Comments
 (0)