48 lines
944 B
JavaScript
48 lines
944 B
JavaScript
|
/**
|
||
|
@license
|
||
|
Copyright (c) 2024 trading_peter
|
||
|
This program is available under Apache License Version 2.0
|
||
|
*/
|
||
|
|
||
|
import '@tp/tp-button/tp-button.js';
|
||
|
import { LitElement, html, css } from 'lit';
|
||
|
import { WalletNotConnectedError, WalletNotReadyError, WalletReadyState } from '@solana/wallet-adapter-base';
|
||
|
import { Store } from '@tp/tp-store/store.js';
|
||
|
import { SolanaWalletHandler } from './wallet-mixin.js';
|
||
|
|
||
|
class TpElement extends Store(LitElement) {
|
||
|
static get styles() {
|
||
|
return [
|
||
|
css`
|
||
|
:host {
|
||
|
display: block;
|
||
|
}
|
||
|
`
|
||
|
];
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
const { } = this;
|
||
|
|
||
|
return html`
|
||
|
<tp-button @click=${this.connect}>Connect</tp-button>
|
||
|
`;
|
||
|
}
|
||
|
|
||
|
static get properties() {
|
||
|
return { };
|
||
|
}
|
||
|
|
||
|
constructor() {
|
||
|
super();
|
||
|
|
||
|
this.handler = new SolanaWalletHandler();
|
||
|
}
|
||
|
|
||
|
async connect() {
|
||
|
this.handler.connect();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
window.customElements.define('tp-solana-connect', TpElement);
|