Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove all related to SPT tokens in pali (including get minted spt method) #661

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions source/pages/Home/Panel/components/Transactions/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ export const TransactionsList = ({

const getTxType = (tx: any, isTxSent: boolean) => {
if (isBitcoinBased) {
if (tx.tokenType === 'SPTAssetActivate') {
return 'SPT creation';
}

if (tx.tokenType === 'SPTAssetSend') {
return 'SPT mint';
}

if (tx.tokenType === 'SPTAssetUpdate') {
return 'SPT update';
}

return 'Transaction';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ export const useTransactionsListConfig = (

const getTxType = (tx: any, isTxSent: boolean) => {
if (isBitcoinBased) {
if (tx.tokenType === 'SPTAssetActivate') {
return 'SPT creation';
}

if (tx.tokenType === 'SPTAssetSend') {
return 'SPT mint';
}

if (tx.tokenType === 'SPTAssetUpdate') {
return 'SPT update';
}

return 'Transaction';
}

Expand Down
4 changes: 1 addition & 3 deletions source/pages/Send/SendSys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,7 @@ export const SendSys = () => {
<p>{item?.symbol}</p>

<small>
{isNFT(item.assetGuid)
? 'NFT'
: 'SPT'}
{isNFT(item.assetGuid) && 'NFT'}
</small>
</button>
</Menu.Item>
Expand Down
49 changes: 4 additions & 45 deletions source/scripts/ContentScript/inject/paliProviderSyscoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class PaliInpageProviderSys extends BaseProvider {
public readonly version: number = 2;
public networkVersion: string | null;
public chainId: string | null;

constructor(maxEventListeners = 100, wallet = 'pali-v2') {
super('syscoin', maxEventListeners, wallet);
this._sys = this._getSysAPI();
Expand Down Expand Up @@ -250,16 +251,19 @@ export class PaliInpageProviderSys extends BaseProvider {
private _handleActiveBlockExplorer(blockExplorerURL: string | null) {
this._sysState.blockExplorerURL = blockExplorerURL;
}

private _handleIsBitcoinBased({
isBitcoinBased,
}: {
isBitcoinBased: boolean;
}) {
this._sysState.isBitcoinBased = isBitcoinBased;
}

private _handleIsTestnet({ isTestnet }: { isTestnet: boolean }) {
this._sysState.isTestnet = isTestnet;
}

private async _isSyscoinChain(): Promise<boolean> {
let checkExplorer = false;
try {
Expand Down Expand Up @@ -324,51 +328,6 @@ export class PaliInpageProviderSys extends BaseProvider {
const validated = _isNFT(guid);
return validated;
},
/**
* Get the minted tokens by the current connected Xpub on UTXO chain.
*
* @returns Promise send back tokens data
*/
getUserMintedTokens: async () => {
const account = await this.request({ method: 'wallet_getAccount' });
if (account) {
const { transactions } = account as any;

const filteredTxs = transactions?.filter(
(tx: any) => tx.tokenType === 'SPTAssetActivate'
);

const allTokens = [];

for (const txs of filteredTxs) {
for (const tokens of txs.tokenTransfers) {
if (tokens) {
allTokens.push(tokens);
}
}
}

const txs = await Promise.all(
allTokens.map(async (t: any) => {
const assetInfo = await getAsset(
this._sysState.blockExplorerURL,
t.token
);
const formattedAssetInfo = {
...assetInfo,
symbol: Buffer.from(
String(assetInfo.symbol),
'base64'
).toString('utf-8'),
};
if (formattedAssetInfo.assetGuid) return formattedAssetInfo;
})
);

return txs.filter((item) => item !== undefined);
}
return [];
},
/**
* Get held assets by current connected account on UTXO chain.
*
Expand Down
Loading