Skip to content

Commit 5d83dfa

Browse files
committed
use nash protocol createTimestamp32
1 parent e52e254 commit 5d83dfa

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

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)