1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

make sure we increment a number when working with nonces (#1781)

This commit is contained in:
Bogdan Fazakas 2023-10-24 16:22:08 +03:00 committed by GitHub
parent 1bc5a39fda
commit 01248ff9a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ export class Provider {
signal?: AbortSignal, signal?: AbortSignal,
providerEndpoints?: any, providerEndpoints?: any,
serviceEndpoints?: ServiceEndpoint[] serviceEndpoints?: ServiceEndpoint[]
): Promise<string> { ): Promise<number> {
if (!providerEndpoints) { if (!providerEndpoints) {
providerEndpoints = await this.getEndpoints(providerUri) providerEndpoints = await this.getEndpoints(providerUri)
} }
@ -102,7 +102,7 @@ export class Provider {
}) })
const { nonce } = await response.json() const { nonce } = await response.json()
console.log(`[getNonce] Consumer: ${consumerAddress} nonce: ${nonce}`) console.log(`[getNonce] Consumer: ${consumerAddress} nonce: ${nonce}`)
const sanitizedNonce = !nonce || nonce === null ? '0' : nonce const sanitizedNonce = !nonce || nonce === null ? 0 : Number(nonce)
return sanitizedNonce return sanitizedNonce
} catch (e) { } catch (e) {
LoggerInstance.error(e) LoggerInstance.error(e)