Update Sollet Extension

This commit is contained in:
jhlx 2021-08-06 10:02:57 +08:00
parent c887be818c
commit ec9bc85750
4 changed files with 46 additions and 35 deletions

View File

@ -1,7 +1,7 @@
{
"name": "Sollet",
"description": "Solana SPL Token Wallet",
"version": "0.3.0",
"version": "0.3.1",
"browser_action": {
"default_popup": "index.html",
"default_title": "Open the popup"
@ -14,14 +14,20 @@
},
"background": {
"persistent": true,
"scripts": ["background.js"]
"scripts": [
"background.js"
]
},
"permissions": [
"storage"
],
"content_scripts": [
{
"matches": ["file://*/*", "http://*/*", "https://*/*"],
"matches": [
"file://*/*",
"http://*/*",
"https://*/*"
],
"js": [
"contentscript.js"
],
@ -29,7 +35,8 @@
"all_frames": true
}
],
"web_accessible_resources": ["script.js"],
"web_accessible_resources": [
"script.js"
],
"content_security_policy": "script-src 'self' 'sha256-ek+jXksbUr00x+EdLLqiv69t8hATh5rPjHVvVVGA9ms='; object-src 'self'"
}
}

View File

@ -70,21 +70,23 @@ export default function NavigationFrame({ children }) {
return (
<>
<AppBar position="static">
<div
style={{
textAlign: 'center',
background: '#fafafa',
color: 'black',
paddingLeft: '24px',
paddingRight: '24px',
fontSize: '14px',
}}
>
<Typography>
Beware of sites attempting to impersonate sollet.io or other DeFi
services.
</Typography>
</div>
{!isExtension && (
<div
style={{
textAlign: 'center',
background: '#fafafa',
color: 'black',
paddingLeft: '24px',
paddingRight: '24px',
fontSize: '14px',
}}
>
<Typography>
Beware of sites attempting to impersonate sollet.io or other DeFi
services.
</Typography>
</div>
)}
<Toolbar>
<Typography variant="h6" className={classes.title} component="h1">
{isExtensionWidth ? 'Sollet' : 'Solana SPL Token Wallet'}

View File

@ -10,7 +10,6 @@ import SwapHoriz from '@material-ui/icons/SwapHoriz';
import PopupState, { bindTrigger, bindPopover } from 'material-ui-popup-state';
import Swap from '@project-serum/swap-ui';
import { Provider } from '@project-serum/anchor';
import { Connection, TransactionSignature } from '@solana/web3.js';
import { TokenListContainer } from '@solana/spl-token-registry';
import { useTokenInfos } from '../utils/tokens/names';
import { useSendTransaction } from '../utils/notifications';
@ -22,9 +21,9 @@ import DialogForm from './DialogForm';
export default function SwapButton({ size }) {
const isExtensionWidth = useIsExtensionWidth();
if (isExtensionWidth) {
return <SwapButtonDialog />;
return <SwapButtonDialog size={size} />;
} else {
return <SwapButtonPopover />;
return <SwapButtonPopover size={size} />;
}
}
@ -119,9 +118,9 @@ function SwapButtonPopover({ size }) {
class NotifyingProvider extends Provider {
constructor(
connection: Connection,
wallet: Wallet,
sendTransaction: (Promise<TransactionSignature>, Function) => void,
connection,
wallet,
sendTransaction,
) {
super(connection, wallet, {
commitment: 'recent',
@ -130,10 +129,10 @@ class NotifyingProvider extends Provider {
}
async send(
tx: Transaction,
signers?: Array<Signer | undefined>,
opts?: ConfirmOptions,
): Promise<TransactionSignature> {
tx,
signers,
opts,
) {
return new Promise((onSuccess, onError) => {
this.sendTransaction(super.send(tx, signers, opts), {
onSuccess,
@ -143,11 +142,11 @@ class NotifyingProvider extends Provider {
}
async sendAll(
txs: Array<{ tx: Transaction, signers: Array<Signer | undefined> }>,
opts?: ConfirmOptions,
): Promise<Array<TransactionSignature>> {
txs,
opts,
) {
return new Promise(async (resolve, onError) => {
let txSigs: Array<TransactionSignature> = [];
let txSigs = [];
for (const tx of txs) {
txSigs.push(
await new Promise((onSuccess) => {

View File

@ -117,6 +117,7 @@ const toInstruction = async (
);
} else if (programId.equals(RAYDIUM_STAKE_PROGRAM_ID)) {
console.log('[' + index + '] Handled as raydium stake instruction');
// @ts-ignore
const decodedInstruction = decodeStakeInstruction(decoded);
return await handleRayStakeInstruction(
connection,
@ -126,6 +127,7 @@ const toInstruction = async (
);
} else if (programId.equals(RAYDIUM_LP_PROGRAM_ID)) {
console.log('[' + index + '] Handled as raydium lp instruction');
// @ts-ignore
const decodedInstruction = decodeLpInstruction(decoded);
return await handleRayLpInstruction(
connection,
@ -135,6 +137,7 @@ const toInstruction = async (
);
} else if (programId.equals(MANGO_PROGRAM_ID) || programId.equals(MANGO_PROGRAM_ID_V2)) {
console.log('[' + index + '] Handled as mango markets instruction');
// @ts-ignore
let decodedInstruction = decodeMangoInstruction(decoded);
return await handleMangoInstruction(
connection,