Skip to content

Commit f88b80e

Browse files
authored
Merge pull request #21 from nash-io/ts/tfi
tfi updates
2 parents 2710aae + b247a0c commit f88b80e

File tree

7 files changed

+19
-118
lines changed

7 files changed

+19
-118
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
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.1.1"></a>
6+
## [5.1.1](https://github.com/nash-io/api-client-typescript/compare/v5.0.35...v5.1.1) (2020-07-09)
7+
8+
9+
510
<a name="5.0.35"></a>
611
## [5.0.35](https://github.com/nash-io/api-client-typescript/compare/v5.0.33...v5.0.35) (2020-06-24)
712

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.35",
3+
"version": "5.1.1",
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.29",
65+
"@neon-exchange/nash-protocol": "3.3.3",
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 & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ import {
113113
GET_ASSETS_NONCES_QUERY,
114114
AssetsNoncesData
115115
} from '../queries/nonces'
116-
import {
117-
GET_ORDERS_FOR_MOVEMENT_QUERY,
118-
OrdersForMovementData
119-
} from '../queries/movement/getOrdersForMovementQuery'
120116

121117
import {
122118
checkMandatoryParams,
@@ -212,7 +208,6 @@ import {
212208
createCancelOrderParams,
213209
createGetAssetsNoncesParams,
214210
createGetMovementParams,
215-
createGetOrdersForMovementParams,
216211
createListMovementsParams,
217212
createPlaceLimitOrderParams,
218213
createPlaceMarketOrderParams,
@@ -1617,36 +1612,6 @@ export class Client {
16171612
return result.data.listMovements
16181613
}
16191614

1620-
/**
1621-
* List all orders for a given movement
1622-
*
1623-
* @returns
1624-
*
1625-
* Example
1626-
* ```
1627-
* const getOrdersForMovementData = await nash.getOrdersForMovement(unit)
1628-
* console.log(getOrdersForMovementData)
1629-
* ```
1630-
*/
1631-
public async getOrdersForMovement(
1632-
asset: string
1633-
): Promise<OrdersForMovementData> {
1634-
checkMandatoryParams({ asset, Type: 'string' })
1635-
const getOrdersForMovementParams = createGetOrdersForMovementParams(asset)
1636-
const signedPayload = await this.signPayload(getOrdersForMovementParams)
1637-
const result = await this.gql.query<{
1638-
getOrdersForMovement: OrdersForMovementData
1639-
}>({
1640-
query: GET_ORDERS_FOR_MOVEMENT_QUERY,
1641-
variables: {
1642-
payload: signedPayload.payload,
1643-
signature: signedPayload.signature
1644-
}
1645-
})
1646-
1647-
return result.data.getOrdersForMovement
1648-
}
1649-
16501615
/**
16511616
* List all current asset nonces
16521617
*
@@ -3121,37 +3086,7 @@ export class Client {
31213086
}
31223087
}
31233088

3124-
while (true) {
3125-
try {
3126-
await prepareAMovement()
3127-
break
3128-
} catch (e) {
3129-
if (!e.message.startsWith('GraphQL error: ')) {
3130-
throw e
3131-
}
3132-
const blockchainError = e.message.slice(
3133-
'GraphQL error: '.length
3134-
) as BlockchainError
3135-
switch (blockchainError) {
3136-
case BlockchainError.MISSING_SIGNATURES:
3137-
case BlockchainError.BLOCKCHAIN_BALANCE_OUT_OF_SYNC:
3138-
// console.log('sync states and retry in 15 seconds')
3139-
await this.getSignAndSyncStates(true)
3140-
await sleep(15000)
3141-
break
3142-
case BlockchainError.WAITING_FOR_BALANCE_SYNC:
3143-
// console.log('waiting for balance sync, retrying in 15 seconds')
3144-
await sleep(15000)
3145-
break
3146-
case BlockchainError.MOVEMENT_ALREADY_IN_PROGRESS:
3147-
// console.log('movement in progress, retrying in 15 seconds')
3148-
await sleep(15000)
3149-
break
3150-
default:
3151-
throw e
3152-
}
3153-
}
3154-
}
3089+
await prepareAMovement()
31553090

31563091
let signedAddMovementPayload: PayloadSignature
31573092
let addMovementResult: GQLResp<{
@@ -3175,7 +3110,10 @@ export class Client {
31753110
})
31763111
),
31773112
digests: preparedMovement.transactionElements.map(
3178-
({ digest: digest }) => ({ digest })
3113+
({ blockchain: txBlockchain, digest: digest }) => ({
3114+
blockchain: txBlockchain,
3115+
digest
3116+
})
31793117
),
31803118
timestamp: new Date().getTime()
31813119
},
@@ -3212,18 +3150,6 @@ export class Client {
32123150
await sleep(15000)
32133151
await prepareAMovement()
32143152
break
3215-
case BlockchainError.MOVEMENT_ALREADY_IN_PROGRESS:
3216-
case BlockchainError.WAITING_FOR_BALANCE_SYNC:
3217-
// console.log('waiting for balance sync, retrying in 15 seconds')
3218-
await sleep(15000)
3219-
break
3220-
case BlockchainError.MISSING_SIGNATURES:
3221-
case BlockchainError.BLOCKCHAIN_BALANCE_OUT_OF_SYNC:
3222-
// console.log('sync states and retry in 15 seconds')
3223-
await this.getSignAndSyncStates(true)
3224-
await prepareAMovement()
3225-
await sleep(15000)
3226-
break
32273153
default:
32283154
throw e
32293155
}

src/client/processSchema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import { UPDATED_TICKERS } from '../subscriptions/updatedTickers'
4343
import { UPDATED_CANDLES } from '../subscriptions/updatedCandles'
4444
import { DH_FIIL_POOL } from '../mutations/dhFillPool'
4545
import { GET_ASSETS_NONCES_QUERY } from '../queries/nonces/getAssetsNonces'
46-
import { GET_ORDERS_FOR_MOVEMENT_QUERY } from '../queries/movement/getOrdersForMovementQuery'
4746
import { SYNC_STATES_MUTATION } from '../mutations/stateSyncing/syncStatesMutation'
4847
import { SIGN_STATES_MUTATION } from '../mutations/stateSyncing/signStatesMutation'
4948
import { COMPLETE_PAYLOAD_SIGNATURE } from '../mutations/mpc/completeSignature'
@@ -85,7 +84,6 @@ const queries = {
8584
UPDATED_CANDLES,
8685
DH_FIIL_POOL,
8786
GET_ASSETS_NONCES_QUERY,
88-
GET_ORDERS_FOR_MOVEMENT_QUERY,
8987
SYNC_STATES_MUTATION,
9088
SIGN_STATES_MUTATION,
9189
COMPLETE_PAYLOAD_SIGNATURE,

src/mutations/movements/prepareMovement.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from '@neon-exchange/nash-protocol'
66

77
import { ClientSignedState } from '../stateSyncing/fragments'
8-
import { CurrencyAmount, Signature } from '../../types'
8+
import { CurrencyAmount, Signature, Blockchain } from '../../types'
99

1010
export const PREPARE_MOVEMENT_MUTATION = gql`
1111
mutation prepareMovement(
@@ -19,6 +19,7 @@ export const PREPARE_MOVEMENT_MUTATION = gql`
1919
}
2020
nonce
2121
transactionElements {
22+
blockchain
2223
digest
2324
}
2425
fees {
@@ -30,6 +31,7 @@ export const PREPARE_MOVEMENT_MUTATION = gql`
3031
`
3132

3233
export interface TransactionElement {
34+
blockchain: Blockchain
3335
digest: string
3436
}
3537

src/queries/movement/getOrdersForMovementQuery.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

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.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==
787+
"@neon-exchange/nash-protocol@3.3.3":
788+
version "3.3.3"
789+
resolved "https://registry.yarnpkg.com/@neon-exchange/nash-protocol/-/nash-protocol-3.3.3.tgz#29417e09b1bd6e18f8f8b51a4bf29c4d68fae6d9"
790+
integrity sha512-eVBH6OeOD81aBW4QsJ39AC+P2hh4HBv1bV8LJ9AG3Ty1fsnmEumL1umuhtg66rjmJdg/VIdv0yyoeew/kRq7oQ==
791791
dependencies:
792792
bignumber.js "8.1.1"
793793
bip32 "2.0.3"

0 commit comments

Comments
 (0)