mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 11:18:24 +00:00
Support the update of mint URL if it had to be changed by mint operator
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "minibits_wallet",
|
||||
"version": "0.1.8-beta.30",
|
||||
"version": "0.1.8-beta.31",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android:clean": "cd android && ./gradlew clean",
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ import {withSetPropAction} from './helpers/withSetPropAction'
|
||||
import type {GetInfoResponse, MintKeys, MintKeyset} from '@cashu/cashu-ts'
|
||||
import {colors, getRandomIconColor} from '../theme'
|
||||
import { log, MintClient } from '../services'
|
||||
import { MINIBITS_MINT_URL } from '@env'
|
||||
|
||||
import AppError, { Err } from '../utils/AppError'
|
||||
import { MintUnit } from '../services/wallet/currency'
|
||||
@@ -54,7 +53,7 @@ export type MintProofsCounter = {
|
||||
*/
|
||||
export const MintModel = types
|
||||
.model('Mint', {
|
||||
id: types.optional(types.identifier, generateId(8)),
|
||||
id: types.optional(types.string, () => generateId(8)),
|
||||
mintUrl: types.string,
|
||||
hostname: types.maybe(types.string),
|
||||
shortname: types.maybe(types.string),
|
||||
|
||||
@@ -8,7 +8,7 @@ import {PaymentRequestsStoreModel} from './PaymentRequestsStore'
|
||||
import {ProofsStoreModel} from './ProofsStore'
|
||||
import {RelaysStoreModel} from './RelaysStore'
|
||||
|
||||
export const rootStoreModelVersion = 15 // Update this if model changes require migrations defined in setupRootStore.ts
|
||||
export const rootStoreModelVersion = 16 // Update this if model changes require migrations defined in setupRootStore.ts
|
||||
|
||||
/**
|
||||
* A RootStore model.
|
||||
|
||||
@@ -265,13 +265,14 @@ async function _runMigrations(rootStore: RootStore) {
|
||||
}
|
||||
}
|
||||
|
||||
if(currentVersion < 15) {
|
||||
log.trace(`Starting rootStore migrations from version v${currentVersion} -> v15`)
|
||||
if(currentVersion < 16) {
|
||||
log.trace(`Starting rootStore migrations from version v${currentVersion} -> v16`)
|
||||
try {
|
||||
|
||||
for (const mint of mintsStore.allMints) {
|
||||
try {
|
||||
mint.setId()
|
||||
mint.setId()
|
||||
log.trace('[_runMigrations]', {id: mint.id, mintUrl: mint.mintUrl})
|
||||
} catch (e: any) {
|
||||
log.warn('[_runMigrations]', e.message)
|
||||
continue
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createContext, useContext, useEffect, useState } from "react"
|
||||
// import { setReactotronRootStore } from "../../services/reactotron"
|
||||
import { RootStore, RootStoreModel } from "../RootStore"
|
||||
import { RootStoreModel } from "../RootStore"
|
||||
import type { RootStore } from "../RootStore"
|
||||
import { setupRootStore } from "./setupRootStore"
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
export * from "./RootStore"
|
||||
export * from "./helpers/setupRootStore"
|
||||
export * from "./helpers/getRootStore"
|
||||
export * from "./helpers/useStores"
|
||||
export * from "./helpers/setupRootStore"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ const customSentryTransport: transportFunctionType = props => {
|
||||
// Log to Sentry only if user setting is switched on
|
||||
if (!userSettingsStore.isLoggerOn) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (props.level.text === 'error') {
|
||||
// Capture error log
|
||||
|
||||
+4
-1
@@ -2,6 +2,7 @@ import { showMessage } from "react-native-flash-message"
|
||||
import { colors, spacing, useThemeColor } from "../theme"
|
||||
import QuickCrypto from 'react-native-quick-crypto'
|
||||
import { fromByteArray } from "react-native-quick-base64"
|
||||
import { log } from "../services/logService"
|
||||
|
||||
/**
|
||||
* sleep statement.
|
||||
@@ -65,7 +66,9 @@ export const generateId = function (lengthInBytes: number) {
|
||||
const random = QuickCrypto.randomBytes(lengthInBytes)
|
||||
const uint8Array = new Uint8Array(random)
|
||||
|
||||
return Buffer.from(uint8Array).toString('hex')
|
||||
const id: string = Buffer.from(uint8Array).toString('hex')
|
||||
log.trace('[generateId]', {id})
|
||||
return id
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user