Page MenuHomePhabricator

D15837.id46695.diff
No OneTemporary

D15837.id46695.diff

diff --git a/cashtab/extension/public/manifest.json b/cashtab/extension/public/manifest.json
--- a/cashtab/extension/public/manifest.json
+++ b/cashtab/extension/public/manifest.json
@@ -3,7 +3,7 @@
"name": "Cashtab",
"description": "A browser-integrated eCash wallet from Bitcoin ABC",
- "version": "3.14.0",
+ "version": "3.15.0",
"content_scripts": [
{
"matches": ["file://*/*", "http://*/*", "https://*/*"],
diff --git a/cashtab/package-lock.json b/cashtab/package-lock.json
--- a/cashtab/package-lock.json
+++ b/cashtab/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "cashtab",
- "version": "2.14.1",
+ "version": "2.15.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cashtab",
- "version": "2.14.1",
+ "version": "2.15.0",
"dependencies": {
"@ant-design/icons": "^5.3.0",
"@bitgo/utxo-lib": "^9.33.0",
diff --git a/cashtab/package.json b/cashtab/package.json
--- a/cashtab/package.json
+++ b/cashtab/package.json
@@ -1,6 +1,6 @@
{
"name": "cashtab",
- "version": "2.14.1",
+ "version": "2.15.0",
"private": true,
"scripts": {
"start": "node scripts/start.js",
diff --git a/cashtab/src/chronik/fixtures/mocks.js b/cashtab/src/chronik/fixtures/mocks.js
--- a/cashtab/src/chronik/fixtures/mocks.js
+++ b/cashtab/src/chronik/fixtures/mocks.js
@@ -9711,6 +9711,163 @@
},
};
+export const SlpV1Mint = {
+ tx: {
+ txid: '4b5b2a0f8bcacf6bccc7ef49e7f82a894c9c599589450eaeaf423e0f5926c38e',
+ version: 2,
+ inputs: [
+ {
+ prevOut: {
+ txid: 'aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb1',
+ outIdx: 2,
+ },
+ inputScript:
+ '473044022038242777df76cf81fea627fad7c8a4f67ddb2dd68defcdb8d45dbc7e0f90c62102206f5c9a5b79f10cb6ac93d46a084666b810d12871c02182f9097b1ac72643dab6412103771805b54969a9bea4e3eb14a82851c67592156ddb5e52d3d53677d14a40fba6',
+ value: 546,
+ sequenceNo: 4294967295,
+ token: {
+ tokenId:
+ 'aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb1',
+ tokenType: {
+ protocol: 'SLP',
+ type: 'SLP_TOKEN_TYPE_FUNGIBLE',
+ number: 1,
+ },
+ amount: '0',
+ isMintBaton: true,
+ entryIdx: 0,
+ },
+ outputScript:
+ '76a91495e79f51d4260bc0dc3ba7fb77c7be92d0fbdd1d88ac',
+ },
+ {
+ prevOut: {
+ txid: '89b922392753498ea1c6f8f29c9c9c2d7768fcaa36c34b931dbdcedf094cd283',
+ outIdx: 0,
+ },
+ inputScript:
+ '47304402206d2c4bada7e705e12f7e8e21b2bfb7a6cf0b02dcb7ffc6b21f1a866dc0e7c7a10220667c1d970506cdae180a78888cf10cf9ada6800b4db22f06a8f4ae5c40aeea16412103771805b54969a9bea4e3eb14a82851c67592156ddb5e52d3d53677d14a40fba6',
+ value: 3300,
+ sequenceNo: 4294967295,
+ outputScript:
+ '76a91495e79f51d4260bc0dc3ba7fb77c7be92d0fbdd1d88ac',
+ },
+ ],
+ outputs: [
+ {
+ value: 0,
+ outputScript:
+ '6a04534c50000101044d494e5420aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb10102080000000000000064',
+ },
+ {
+ value: 546,
+ outputScript:
+ '76a91495e79f51d4260bc0dc3ba7fb77c7be92d0fbdd1d88ac',
+ token: {
+ tokenId:
+ 'aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb1',
+ tokenType: {
+ protocol: 'SLP',
+ type: 'SLP_TOKEN_TYPE_FUNGIBLE',
+ number: 1,
+ },
+ amount: '100',
+ isMintBaton: false,
+ entryIdx: 0,
+ },
+ },
+ {
+ value: 546,
+ outputScript:
+ '76a91495e79f51d4260bc0dc3ba7fb77c7be92d0fbdd1d88ac',
+ token: {
+ tokenId:
+ 'aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb1',
+ tokenType: {
+ protocol: 'SLP',
+ type: 'SLP_TOKEN_TYPE_FUNGIBLE',
+ number: 1,
+ },
+ amount: '0',
+ isMintBaton: true,
+ entryIdx: 0,
+ },
+ spentBy: {
+ txid: 'dd9018d0037fee4094c2445b23ed9eef65d456db3f2b9c053ad39ee6505fca44',
+ outIdx: 0,
+ },
+ },
+ {
+ value: 2280,
+ outputScript:
+ '76a91495e79f51d4260bc0dc3ba7fb77c7be92d0fbdd1d88ac',
+ },
+ ],
+ lockTime: 0,
+ timeFirstSeen: 1711861819,
+ size: 472,
+ isCoinbase: false,
+ tokenEntries: [
+ {
+ tokenId:
+ 'aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb1',
+ tokenType: {
+ protocol: 'SLP',
+ type: 'SLP_TOKEN_TYPE_FUNGIBLE',
+ number: 1,
+ },
+ txType: 'MINT',
+ isInvalid: false,
+ burnSummary: '',
+ failedColorings: [],
+ actualBurnAmount: '0',
+ intentionalBurn: '0',
+ burnsMintBatons: false,
+ },
+ ],
+ tokenFailedParsings: [],
+ tokenStatus: 'TOKEN_STATUS_NORMAL',
+ block: {
+ height: 838323,
+ hash: '000000000000000011466b30b743ea02424347838273e890d6a9f1afbc16f66e',
+ timestamp: 1711868662,
+ },
+ },
+ parsed: {
+ airdropFlag: false,
+ airdropTokenId: '',
+ assumedTokenDecimals: true,
+ etokenAmount: '100',
+ incoming: true,
+ isCashtabMessage: false,
+ isEcashChatMessage: false,
+ isEncryptedMessage: false,
+ isEtokenTx: true,
+ isTokenBurn: false,
+ opReturnMessage: '',
+ replyAddress: 'ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035',
+ tokenEntries: [
+ {
+ actualBurnAmount: '0',
+ burnSummary: '',
+ burnsMintBatons: false,
+ failedColorings: [],
+ intentionalBurn: '0',
+ isInvalid: false,
+ tokenId:
+ 'aed861a31b96934b88c0252ede135cb9700d7649f69191235087a3030e553cb1',
+ tokenType: {
+ number: 1,
+ protocol: 'SLP',
+ type: 'SLP_TOKEN_TYPE_FUNGIBLE',
+ },
+ txType: 'MINT',
+ },
+ ],
+ xecAmount: 33.72,
+ },
+};
+
export const MsgFromElectrum = {
tx: {
txid: 'd0c4c5b86016b7a021470180cb4afd1f8456fcf683a19d8b061b2225abd71be4',
diff --git a/cashtab/src/chronik/fixtures/vectors.js b/cashtab/src/chronik/fixtures/vectors.js
--- a/cashtab/src/chronik/fixtures/vectors.js
+++ b/cashtab/src/chronik/fixtures/vectors.js
@@ -40,6 +40,7 @@
mockSortedFlatTxHistoryWithAllUnconfirmed,
AlpTx,
mockParseTxTokenCache,
+ SlpV1Mint,
} from './mocks';
import { mockChronikUtxos, mockOrganizedUtxosByType } from './chronikUtxos';
@@ -234,6 +235,25 @@
cachedTokens: mockParseTxTokenCache,
parsed: MsgFromEcashChat.parsed,
},
+ {
+ description: 'slp v1 mint tx',
+ tx: SlpV1Mint.tx,
+ wallet: {
+ ...mockParseTxWallet,
+ paths: new Map([
+ [
+ 1899,
+ {
+ address:
+ 'ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035',
+ hash: '95e79f51d4260bc0dc3ba7fb77c7be92d0fbdd1d',
+ },
+ ],
+ ]),
+ },
+ cachedTokens: mockParseTxTokenCache,
+ parsed: SlpV1Mint.parsed,
+ },
],
},
sortAndTrimChronikTxHistory: {
diff --git a/cashtab/src/chronik/index.js b/cashtab/src/chronik/index.js
--- a/cashtab/src/chronik/index.js
+++ b/cashtab/src/chronik/index.js
@@ -208,6 +208,7 @@
let isSlpV1 = false;
let isUnsupportedTokenTx = false;
let isGenesisTx = false;
+ let isMintTx = false;
// For now, we only support one token per tx
// Get the tokenId if this is an slpv1 tx
@@ -232,6 +233,9 @@
if (entry.txType === 'GENESIS') {
isGenesisTx = true;
}
+ if (entry.txType === 'MINT') {
+ isMintTx = true;
+ }
}
// We might lose this variable. Cashtab only supports SLP type 1 txs for now.
@@ -293,9 +297,12 @@
const thisWalletHash160 = walletHash160s[j];
if (
typeof thisInput.outputScript !== 'undefined' &&
- thisInput.outputScript.includes(thisWalletHash160)
+ thisInput.outputScript.includes(thisWalletHash160) &&
+ !isMintTx
) {
// Then this is an outgoing tx
+ // TODO not really, it could be a self-send tx like a genesis or mint tx
+ // Parse better in refactor
incoming = false;
// Break out of this for loop once you know this is an outgoing tx
break;
diff --git a/cashtab/src/components/Home/Tx.js b/cashtab/src/components/Home/Tx.js
--- a/cashtab/src/components/Home/Tx.js
+++ b/cashtab/src/components/Home/Tx.js
@@ -535,6 +535,12 @@
<AirdropReceivedTx>
<AirdropIcon />
</AirdropReceivedTx>
+ ) : data.parsed.isEtokenTx &&
+ data.tokenEntries[0]
+ .txType === 'MINT' ? (
+ <GenesisTx>
+ <GenesisIcon />
+ </GenesisTx>
) : (
<ReceivedTx>
<ReceiveIcon />
@@ -568,6 +574,12 @@
</h3>
)}
</>
+ ) : data.parsed.isEtokenTx &&
+ data.tokenEntries[0].txType ===
+ 'MINT' ? (
+ <GenesisHeader>
+ Mint
+ </GenesisHeader>
) : (
<ReceivedFromCtn>
<ReceivedHeader>

File Metadata

Mime Type
text/plain
Expires
Mon, May 12, 01:36 (3 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5777023
Default Alt Text
D15837.id46695.diff (11 KB)

Event Timeline