mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-06 03:38:24 +00:00
New: show receiver address in SEND transactions
This commit is contained in:
@@ -33,7 +33,13 @@ jobs:
|
||||
# Codepush build will continue only if version changed from previous commit
|
||||
- name: Detect version change
|
||||
run: |
|
||||
echo "IS_VERSION_CHANGED=true" >> $GITHUB_ENV
|
||||
if [ "${{ env.PREV_JS_VERSION }}" != "${{ env.CURRENT_JS_VERSION }}" ]; then
|
||||
echo "IS_VERSION_CHANGED=true" >> $GITHUB_ENV
|
||||
echo "Detected version change"
|
||||
else
|
||||
echo "IS_VERSION_CHANGED=false" >> $GITHUB_ENV
|
||||
echo "No version change, skipping further processing"
|
||||
fi
|
||||
|
||||
# Fetch native app versionName and versionCode from app/build.gradle
|
||||
- name: Get Android native version
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "minibits_wallet",
|
||||
"version": "0.0.8-alpha.5",
|
||||
"version": "0.0.8-alpha.6",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android:clean": "cd android && ./gradlew clean",
|
||||
|
||||
@@ -77,6 +77,7 @@ const en = {
|
||||
lightningFee: "Lightning network fee",
|
||||
memoFromSender: "Memo from sender",
|
||||
sentFrom: "Sent from",
|
||||
sentTo: "Sent to",
|
||||
type: "Type",
|
||||
status: "Status",
|
||||
balanceAfter: "Balance after this transaction",
|
||||
|
||||
@@ -95,8 +95,10 @@ import {
|
||||
self.publicRelay = publicRelay
|
||||
log.info('setPublicRelay', publicRelay)
|
||||
},
|
||||
setLastPendingReceivedCheck() {
|
||||
self.lastPendingReceivedCheck = Math.floor(Date.now() / 1000)
|
||||
setLastPendingReceivedCheck() {
|
||||
const ts: number = Math.floor(Date.now() / 1000)
|
||||
log.trace('Timestamp', {ts}, 'setLastPendingReceivedCheck')
|
||||
self.lastPendingReceivedCheck = ts
|
||||
},
|
||||
addReceivedEventId(id: string) {
|
||||
self.receivedEventIds.push(id)
|
||||
|
||||
@@ -49,6 +49,7 @@ export const TransactionModel = types
|
||||
fee: types.maybe(types.maybeNull(types.integer)),
|
||||
data: types.string,
|
||||
sentFrom: types.maybe(types.maybeNull(types.string)),
|
||||
sentTo: types.maybe(types.maybeNull(types.string)),
|
||||
memo: types.maybe(types.maybeNull(types.string)),
|
||||
balanceAfter: types.maybe(types.maybeNull(types.integer)),
|
||||
noteToSelf: types.maybe(types.maybeNull(types.string)),
|
||||
|
||||
@@ -220,6 +220,15 @@ export const TransactionsStoreModel = types
|
||||
log.trace('Transaction sentFrom updated in TransactionsStore')
|
||||
}
|
||||
}),
|
||||
updateSentTo: flow(function* updateSentTo(id: number, sentTo: string) { //
|
||||
|
||||
yield Database.updateSentToAsync(id, sentTo)
|
||||
const transactionInstance = self.findById(id)
|
||||
if (transactionInstance) {
|
||||
transactionInstance.sentTo = sentTo
|
||||
log.trace('Transaction sentTo updated in TransactionsStore')
|
||||
}
|
||||
}),
|
||||
removeAllTransactions() {
|
||||
self.transactions.clear()
|
||||
log.info('Removed all transactions from TransactionsStore')
|
||||
|
||||
@@ -526,11 +526,18 @@ export const SendScreen: FC<WalletStackScreenProps<'Send'>> = observer(
|
||||
updated[2].sentToRelays = relaysToShareTo
|
||||
updated[2].sentEvent = sentEvent
|
||||
|
||||
await transactionsStore.updateStatus(
|
||||
await transactionsStore.updateStatus( // status does not change, just add event and relay info to tx.data
|
||||
transactionId,
|
||||
TransactionStatus.PENDING,
|
||||
JSON.stringify(updated)
|
||||
)
|
||||
|
||||
const txupdate = await transactionsStore.updateSentTo( // set contact to send to to the tx, could be elsewhere //
|
||||
transactionId,
|
||||
contactToSendTo?.name+MINIBITS_NIP05_DOMAIN
|
||||
)
|
||||
|
||||
log.trace('sentTo tx', txupdate, 'sendAsNostrDM')
|
||||
} else {
|
||||
setInfo('Relay could not confirm that the message has been published')
|
||||
}
|
||||
|
||||
@@ -417,10 +417,12 @@ const ReceiveInfoBlock = function (props: {
|
||||
label="tranDetailScreen.memoFromSender"
|
||||
value={transaction.memo as string}
|
||||
/>
|
||||
<TranItem
|
||||
label="tranDetailScreen.sentFrom"
|
||||
value={transaction.sentFrom as string}
|
||||
/>
|
||||
{transaction.sentFrom && (
|
||||
<TranItem
|
||||
label="tranDetailScreen.sentFrom"
|
||||
value={transaction.sentFrom as string}
|
||||
/>
|
||||
)}
|
||||
<TranItem
|
||||
label="tranDetailScreen.type"
|
||||
value={transaction.type as string}
|
||||
@@ -708,7 +710,7 @@ const SendInfoBlock = function (props: {
|
||||
}) {
|
||||
const {transaction, isDataParsable, copyToken, copyAuditTrail, colorScheme} = props
|
||||
const labelColor = useThemeColor('textDim')
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
@@ -724,6 +726,12 @@ const SendInfoBlock = function (props: {
|
||||
label="tranDetailScreen.memoToReceiver"
|
||||
value={transaction.memo as string}
|
||||
/>
|
||||
{transaction.sentTo && (
|
||||
<TranItem
|
||||
label="tranDetailScreen.sentTo"
|
||||
value={transaction.sentTo as string}
|
||||
/>
|
||||
)}
|
||||
<TranItem
|
||||
label="tranDetailScreen.type"
|
||||
value={transaction.type as string}
|
||||
|
||||
+42
-3
@@ -19,7 +19,7 @@ import { Contact, ContactType } from '../models/Contact'
|
||||
|
||||
let _db: QuickSQLiteConnection
|
||||
|
||||
const _dbVersion = 3 // Update this if db changes require migrations
|
||||
const _dbVersion = 4 // Update this if db changes require migrations
|
||||
|
||||
const getInstance = function () {
|
||||
if (!_db) {
|
||||
@@ -56,6 +56,7 @@ const _createOrUpdateSchema = function (db: QuickSQLiteConnection) {
|
||||
fee INTEGER,
|
||||
data TEXT,
|
||||
sentFrom TEXT,
|
||||
sentTo TEXT,
|
||||
memo TEXT,
|
||||
balanceAfter INTEGER,
|
||||
noteToSelf TEXT,
|
||||
@@ -158,6 +159,16 @@ const _runMigrations = function (db: QuickSQLiteConnection) {
|
||||
}
|
||||
|
||||
|
||||
if (currentVersion < 4) {
|
||||
migrationQueries.push([
|
||||
`ALTER TABLE transactions
|
||||
ADD COLUMN sentTo TEXT`,
|
||||
])
|
||||
|
||||
log.info(`Prepared database migrations from ${currentVersion} -> 4`)
|
||||
}
|
||||
|
||||
|
||||
// Update db version as a part of migration sqls
|
||||
migrationQueries.push([
|
||||
`INSERT OR REPLACE INTO dbversion (id, version, createdAt)
|
||||
@@ -591,7 +602,7 @@ const updateSentFromAsync = async function (id: number, sentFrom: string) {
|
||||
|
||||
const db = getInstance()
|
||||
await db.executeAsync(query, params)
|
||||
// DO NOT log to Sentry
|
||||
|
||||
log.trace('Transaction sentFrom updated', {sentFrom}, 'updateSentFromAsync')
|
||||
|
||||
const updatedTx = getTransactionById(id as number)
|
||||
@@ -604,7 +615,34 @@ const updateSentFromAsync = async function (id: number, sentFrom: string) {
|
||||
e.message,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const updateSentToAsync = async function (id: number, sentTo: string) {
|
||||
try {
|
||||
const query = `
|
||||
UPDATE transactions
|
||||
SET sentTo = ?
|
||||
WHERE id = ?
|
||||
`
|
||||
const params = [sentTo, id]
|
||||
|
||||
const db = getInstance()
|
||||
await db.executeAsync(query, params)
|
||||
|
||||
log.trace('Transaction sentTo updated', {sentTo}, 'updateSentToAsync')
|
||||
|
||||
const updatedTx = getTransactionById(id as number)
|
||||
|
||||
return updatedTx as TransactionRecord
|
||||
} catch (e: any) {
|
||||
throw new AppError(
|
||||
Err.DATABASE_ERROR,
|
||||
'Could not update transaction sentTo in database',
|
||||
e.message,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/* const cleanTransactionData = async function (transactionIds: number[]) {
|
||||
try {
|
||||
@@ -891,6 +929,7 @@ export const Database = {
|
||||
updateReceivedAmountAsync,
|
||||
updateNoteAsync,
|
||||
updateSentFromAsync,
|
||||
updateSentToAsync,
|
||||
getTransactionsAsync,
|
||||
getPendingAmount,
|
||||
addOrUpdateProof,
|
||||
|
||||
@@ -124,7 +124,7 @@ const checkPendingReceived = async function () {
|
||||
since: lastPendingReceivedCheck || 0
|
||||
}]
|
||||
|
||||
log.trace('Starting subscription...', filter, 'checkPendingReceived')
|
||||
log.trace('Creating subscription...', filter, 'checkPendingReceived')
|
||||
|
||||
const pool = NostrClient.getRelayPool()
|
||||
const sub = pool.sub(NostrClient.getMinibitsRelays(), filter)
|
||||
@@ -132,14 +132,17 @@ const checkPendingReceived = async function () {
|
||||
let events: NostrEvent[] = []
|
||||
let result: {status: TransactionStatus, message: string} | undefined = undefined
|
||||
|
||||
sub.on('event', (event: NostrEvent) => {
|
||||
contactsStore.setLastPendingReceivedCheck() // conservative choice where to put it
|
||||
sub.on('event', (event: NostrEvent) => {
|
||||
events.push(event)
|
||||
})
|
||||
|
||||
sub.on('eose', async () => {
|
||||
log.trace(`Got ${events.length} receive events`, [], 'checkPendingReceived')
|
||||
|
||||
if(events.length > 0) {
|
||||
contactsStore.setLastPendingReceivedCheck() // listen for changes from last tx to get potentially lost events during past checks
|
||||
}
|
||||
|
||||
let receivedTxCount: number = 0
|
||||
let errorTxCount: number = 0
|
||||
let errors: string[] = []
|
||||
@@ -208,7 +211,7 @@ const checkPendingReceived = async function () {
|
||||
}
|
||||
}
|
||||
|
||||
sub.unsub()
|
||||
// sub.unsub()
|
||||
|
||||
if(receivedTxCount > 0) {
|
||||
result = {
|
||||
|
||||
Reference in New Issue
Block a user