Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit

Permalink
build: remove node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
xstelea committed Sep 4, 2023
1 parent 5cb695c commit 1f9e0cd
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 21 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ ROLA is intended for use in the server backend portion of a Full Stack dApp. It

## Getting started

`npm install @radixdlt/rola`
`npm install @radixdlt/rola isomorphic-fetch`

## How to use

```typescript
import 'isomorphic-fetch'
import { Rola, NetworkId, SignedChallenge } from '@radixdlt/rola'

const { verifySignedChallenge } = Rola({
Expand Down
28 changes: 24 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"eslint-config-alloy": "^5.1.2",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.3",
"isomorphic-fetch": "^3.0.0",
"jest": "^29.6.4",
"jest-environment-jsdom": "^29.6.4",
"prettier": "^3.0.3",
Expand All @@ -86,8 +87,7 @@
"@radixdlt/radix-dapp-toolkit": "0.6.1",
"@radixdlt/radix-engine-toolkit": "0.3.0",
"elliptic": "^6.5.4",
"neverthrow": "^6.0.0",
"node-fetch": "^2.7.0"
"neverthrow": "^6.0.0"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions setup-tests.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'isomorphic-fetch'
import { TextEncoder, TextDecoder } from 'util'
global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder
11 changes: 0 additions & 11 deletions src/fetch-polyfill.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/rola.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Rola', () => {
},
] satisfies SignedChallenge[]) {
const result = await verifySignedChallenge(proof)
if (result.isErr()) throw result.error
if (result.isErr()) throw result.error.jsError
}
})
})
6 changes: 4 additions & 2 deletions src/rola.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './fetch-polyfill'
import { ResultAsync, err, errAsync, ok } from 'neverthrow'
import { createSignatureMessage } from './helpers/create-signature-message'
import { verifyProofFactory } from './helpers/verify-proof'
Expand Down Expand Up @@ -57,7 +56,10 @@ export const Rola = (input: RolaInput) => {
const queryLedger = () =>
gatewayService
.getEntityOwnerKeys(signedChallenge.address)
.mapErr(() => ({ reason: 'couldNotVerifyPublicKeyOnLedger' }))
.mapErr((jsError) => ({
reason: 'couldNotVerifyPublicKeyOnLedger',
jsError,
}))
.map((ownerKeys) => ({
ownerKeysMatchesProvidedPublicKey: ownerKeys
.toUpperCase()
Expand Down

0 comments on commit 1f9e0cd

Please sign in to comment.