Skip to content

Commit

Permalink
bug(#86): Location asserts sending decimals instead of hex
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Dec 27, 2023
1 parent 9f0bcb4 commit 56cbeae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helium/react-native-sdk",
"version": "3.0.2",
"version": "3.0.3",
"description": "Helium React Native SDK",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
Expand Down
14 changes: 11 additions & 3 deletions src/Onboarding/useOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const useOnboarding = ({ baseUrl }: { baseUrl: string }) => {

let location: string | undefined
if (lat && lng && lat !== 0 && lng !== 0) {
location = new BN(getH3Location(lat, lng), 'hex').toString()
location = getH3Location(lat, lng)
}
const details = await solana.getHotspotDetails({
address: hotspotAddress,
Expand Down Expand Up @@ -390,19 +390,27 @@ const useOnboarding = ({ baseUrl }: { baseUrl: string }) => {

const solResponses = await Promise.all(
networkDetails.map(({ elevation, gain, nextLocation, hotspotType }) => {
const location = new BN(nextLocation, 'hex').toString()
return onboardingClient.updateMetadata({
type: hotspotType,
solanaAddress,
hotspotAddress: gateway,
location,
location: nextLocation,
elevation,
gain,
payer,
})
})
)

const fails = solResponses.filter((s) => !s.success)
if (fails.length > 0) {
throw new Error(
`Update metadata requests failed: ${fails
.map((f) => f.errorMessage)
.join(', ')}`
)
}

solanaTransactions = solResponses
.flatMap((r) => r.data?.solanaTransactions || [])
.map((txn) => Buffer.from(txn))
Expand Down

0 comments on commit 56cbeae

Please sign in to comment.