repo_id
stringclasses 563
values | file_path
stringlengths 40
166
| content
stringlengths 1
2.94M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/xdefi/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/xdefi
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/xdefi/src/adapter.ts
|
import type { EventEmitter, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { SendOptions, Transaction, TransactionSignature } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface XDEFIWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface XDEFIWallet extends EventEmitter<XDEFIWalletEvents> {
isXDEFI?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signAndSendTransaction(
transaction: Transaction,
options?: SendOptions
): Promise<{ signature: TransactionSignature }>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface XDEFIWalletWindow extends Window {
xfi?: {
solana?: XDEFIWallet;
};
}
declare const window: XDEFIWalletWindow;
export interface XDEFIWalletAdapterConfig {}
export const XDEFIWalletName = 'XDEFI' as WalletName<'XDEFI'>;
export class XDEFIWalletAdapter extends BaseMessageSignerWalletAdapter {
name = XDEFIWal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jM1ODkgNy4wMDg1NyAxOS4zNTg5QzcuNDA1NzEgMTkuMzU4OSA3LjgyMjg2IDE5LjM1ODkgOC4yNTcxNCAxOS4zMjVDMTMuODM3MSAxOS4wMTcyIDE2LjkwMjkgMTYuNjExNiAxNy45NzE0IDE1LjU4MzhMMTYuNzggMTQuODc1MVoiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0xOS4wMiAxNi4yMTkyQzE4LjMxMjEgMTcuMTM4NyAxNy40NDA4IDE3LjkyMzMgMTYuNDQ4NiAxOC41MzQ1QzEyLjk1MTUgMjAuNzY1IDguNTAyODkgMjEuMDUzIDUuMzg4NiAyMC44OTc4TDUuMzIyODkgMjIuMTk5NEM1Ljg0NTc1IDIyLjIyNDggNi4zNDg2MSAyMi4yMzYxIDYuODM3MTggMjIuMjM2MUMxNS42MiAyMi4yMzYxIDE5LjE2ODYgMTguMjgzMiAyMC4xNiAxNi44NzE0TDE5LjAxNzIgMTYuMjA3OSIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTE4LjY4NTcgMTEuMjkyMkMxOS4yNjggMTEuMjkyMiAxOS43NCAxMC44MjU3IDE5Ljc0IDEwLjI1MDNDMTkuNzQgOS42NzQ4OSAxOS4yNjggOS4yMDg0MiAxOC42ODU3IDkuMjA4NDJDMTguMTAzNCA5LjIwODQyIDE3LjYzMTQgOS42NzQ4OSAxNy42MzE0IDEwLjI1MDNDMTcuNjMxNCAxMC44MjU3IDE4LjEwMzQgMTEuMjkyMiAxOC42ODU3IDExLjI5MjJaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: XDEFIWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: XDEFIWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.xfi?.solana?.isXDEFI) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.xfi!.solana!;
if (!wallet.isConnected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/xdefi
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/xdefi/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/package.json
|
{
"name": "@solana/wallet-adapter-tokenpocket",
"version": "0.4.19",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/src/adapter.ts
|
import type { EventEmitter, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface TokenPocketWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface TokenPocketWallet extends EventEmitter<TokenPocketWalletEvents> {
isTokenPocket?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface TokenPocketWindow extends Window {
solana?: TokenPocketWallet;
}
declare const window: TokenPocketWindow;
export interface TokenPocketWalletAdapterConfig {}
export const TokenPocketWalletName = 'TokenPocket' as WalletName<'TokenPocket'>;
export class TokenPocketWalletAdapter extends BaseMessageSignerWalletAdapter {
name = TokenPocketWalletName;
url = 'https://tokenpocket.pro';
icon =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjEyMCIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGc+CjxwYXRoIGQ9Ik0xMDQxLjUyIDBILTI3VjEwMjRIMTA0MS41MlYwWiIgZmlsbD0iIzI5ODBGRSIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDA4XzIyNSkiPgo8cGF0aCBkPSJNNDA2Ljc5NiA0MzguNjQzSDQwNi45MjdDNDA2Ljc5NiA0MzcuODU3IDQwNi43OTYgNDM2Ljk0IDQwNi43OTYgNDM2LjE1NFY0MzguNjQzWiIgZmlsbD0iIzI5QUVGRiIvPgo8cGF0aCBkPSJNNjY3LjYwMiA0NjMuNTMzSDUyMy4yNDlWNzI0LjA3NkM1MjMuMjQ5ID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dG9wIHN0b3AtY29sb3I9IndoaXRlIi8+CjxzdG9wIG9mZnNldD0iMC45NjY3IiBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwLjMyMzMiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwLjMiLz4KPC9saW5lYXJHcmFkaWVudD4KPGNsaXBQYXRoIGlkPSJjbGlwMF80MDhfMjI1Ij4KPHJlY3Qgd2lkdGg9IjcyOC40NDgiIGhlaWdodD0iNDcwIiBmaWxsPSJ3aGl0ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTY4IDI3NykiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: TokenPocketWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: TokenPocketWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.solana?.isTokenPocket) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.solana!;
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('disconnect');
}
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/tokenpocket/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/package.json
|
{
"name": "@solana/wallet-adapter-krystal",
"version": "0.1.12",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/src/adapter.ts
|
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletDisconnectionError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface KrystalWallet {
isConnected(): boolean;
connect(): Promise<string[]>;
disconnect(): Promise<void>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
}
interface KrystalWindow extends Window {
krystal?: {
solana?: KrystalWallet;
};
}
declare const window: KrystalWindow;
export interface KrystalWalletAdapterConfig {}
export const KrystalWalletName = 'Krystal' as WalletName<'Krystal'>;
export class KrystalWalletAdapter extends BaseMessageSignerWalletAdapter {
name = KrystalWalletName;
url = 'https://krystal.app';
icon =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDUxMiA1MTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3Lncz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DQyMy41OTUgMjc4LjQwNiA0MTkuNTYzTDI3Ni4yNDcgMzAyLjgwOFpNMjkyLjI5NiAzMDQuMDM2QzI5Mi4xNTMgMjk2LjM2OSAzMDEuNTYzIDI5Mi41OTEgMzA2Ljc2MiAyOTguMjI4TDM4MS43NjUgMzc5LjU2QzM4Ni4yMTggMzg0LjM4OCAzODMuNTk5IDM5Mi4yMyAzNzcuMTM5IDM5My40MTRMMzAzLjkgNDA2LjgzM0MyOTguODQxIDQwNy43NiAyOTQuMTU3IDQwMy45MyAyOTQuMDYxIDM5OC43ODdMMjkyLjI5NiAzMDQuMDM2WiIgZmlsbD0iIzFERTlCNiIvPgo8L3N2Zz4K';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: KrystalWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: KrystalWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.krystal?.solana) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected();
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.krystal!.solana!;
let account: string;
try {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
account = (await wallet.connect())[0]!;
} catch (error: any) {
throw new WalletAccountError(error?.message, error);
}
let publicKey: PublicKey;
try {
publicKey = new PublicKey(account);
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return (await wallet.signTransaction(transaction)) as T;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return (await wallet.signAllTransactions(transactions)) as T[];
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/krystal/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/package.json
|
{
"name": "@solana/wallet-adapter-trust",
"version": "0.1.13",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/src/adapter.ts
|
import type { EventEmitter, SendTransactionOptions, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSendTransactionError,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Connection, SendOptions, Transaction, TransactionSignature } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface TrustWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface TrustWallet extends EventEmitter<TrustWalletEvents> {
isTrust?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signAndSendTransaction(
transaction: Transaction,
options?: SendOptions
): Promise<{ signature: TransactionSignature }>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface TrustWindow extends Window {
trustwallet?: {
solana?: TrustWallet;
};
}
declare const window: TrustWindow;
export interface TrustWalletAdapterConfig {}
export const TrustWalletName = 'Trust' as WalletName<'Trust'>;
export class TrustWalletAdapter extends BaseMessageSignerWalletAdapter {
name = TrustWalletName;
url = 'https://trustwallet.com';
icon =
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIG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M4LDMwLjA4LTQ0LjIzLDMwLjA4cy00Ni4yNy0xMi4wNi00Ni4yNy0zMS42NWgtLjAzWiIvPjxwYXRoIGNsYXNzPSJjbHMtMiIgZD0ibTExODEuNjIsMjU5LjR2LTI4LjU1aC03OC4zNXYyOC41NmgyMy4zOHY2My4yMmgzMS41OHYtNjMuMjRoMjMuMzlaIi8+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJtODE3LjA4LDI1OS40di0yOC41NWgtNzguMzV2MjguNTZoMjMuMzh2NjMuMjJoMzEuNTh2LTYzLjI0aDIzLjM4WiIvPjwvc3ZnPg==';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: TrustWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: TrustWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.trustwallet?.solana?.isTrust) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.trustwallet!.solana!;
if (!wallet.isConnected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async sendTransaction(
transaction: Transaction,
connection: Connection,
options: SendTransactionOptions = {}
): Promise<TransactionSignature> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signers, ...sendOptions } = options;
transaction = await this.prepareTransaction(transaction, connection, sendOptions);
signers?.length && transaction.partialSign(...signers);
sendOptions.preflightCommitment = sendOptions.preflightCommitment || connection.commitment;
const { signature } = await wallet.signAndSendTransaction(transaction, sendOptions);
return signature;
} catch (error: any) {
if (error instanceof WalletError) throw error;
throw new WalletSendTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trust/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets/package.json
|
{
"name": "@solana/wallet-adapter-wallets",
"version": "0.19.32",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-alpha": "workspace:^",
"@solana/wallet-adapter-avana": "workspace:^",
"@solana/wallet-adapter-bitkeep": "workspace:^",
"@solana/wallet-adapter-bitpie": "workspace:^",
"@solana/wallet-adapter-clover": "workspace:^",
"@solana/wallet-adapter-coin98": "workspace:^",
"@solana/wallet-adapter-coinbase": "workspace:^",
"@solana/wallet-adapter-coinhub": "workspace:^",
"@solana/wallet-adapter-fractal": "workspace:^",
"@solana/wallet-adapter-huobi": "workspace:^",
"@solana/wallet-adapter-hyperpay": "workspace:^",
"@solana/wallet-adapter-keystone": "workspace:^",
"@solana/wallet-adapter-krystal": "workspace:^",
"@solana/wallet-adapter-ledger": "workspace:^",
"@solana/wallet-adapter-mathwallet": "workspace:^",
"@solana/wallet-adapter-neko": "workspace:^",
"@solana/wallet-adapter-nightly": "workspace:^",
"@solana/wallet-adapter-nufi": "workspace:^",
"@solana/wallet-adapter-onto": "workspace:^",
"@solana/wallet-adapter-particle": "workspace:^",
"@solana/wallet-adapter-phantom": "workspace:^",
"@solana/wallet-adapter-safepal": "workspace:^",
"@solana/wallet-adapter-saifu": "workspace:^",
"@solana/wallet-adapter-salmon": "workspace:^",
"@solana/wallet-adapter-sky": "workspace:^",
"@solana/wallet-adapter-solflare": "workspace:^",
"@solana/wallet-adapter-solong": "workspace:^",
"@solana/wallet-adapter-spot": "workspace:^",
"@solana/wallet-adapter-tokenary": "workspace:^",
"@solana/wallet-adapter-tokenpocket": "workspace:^",
"@solana/wallet-adapter-torus": "workspace:^",
"@solana/wallet-adapter-trezor": "workspace:^",
"@solana/wallet-adapter-trust": "workspace:^",
"@solana/wallet-adapter-unsafe-burner": "workspace:^",
"@solana/wallet-adapter-walletconnect": "workspace:^",
"@solana/wallet-adapter-xdefi": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/wallets/src/index.ts
|
export * from '@solana/wallet-adapter-alpha';
export * from '@solana/wallet-adapter-avana';
export * from '@solana/wallet-adapter-bitkeep';
export * from '@solana/wallet-adapter-bitpie';
export * from '@solana/wallet-adapter-clover';
export * from '@solana/wallet-adapter-coin98';
export * from '@solana/wallet-adapter-coinbase';
export * from '@solana/wallet-adapter-coinhub';
export * from '@solana/wallet-adapter-fractal';
export * from '@solana/wallet-adapter-huobi';
export * from '@solana/wallet-adapter-hyperpay';
export * from '@solana/wallet-adapter-keystone';
export * from '@solana/wallet-adapter-krystal';
export * from '@solana/wallet-adapter-ledger';
export * from '@solana/wallet-adapter-mathwallet';
export * from '@solana/wallet-adapter-neko';
export * from '@solana/wallet-adapter-nightly';
export * from '@solana/wallet-adapter-nufi';
export * from '@solana/wallet-adapter-onto';
export * from '@solana/wallet-adapter-particle';
export * from '@solana/wallet-adapter-phantom';
export * from '@solana/wallet-adapter-safepal';
export * from '@solana/wallet-adapter-saifu';
export * from '@solana/wallet-adapter-salmon';
export * from '@solana/wallet-adapter-sky';
export * from '@solana/wallet-adapter-solflare';
export * from '@solana/wallet-adapter-solong';
export * from '@solana/wallet-adapter-spot';
export * from '@solana/wallet-adapter-tokenary';
export * from '@solana/wallet-adapter-tokenpocket';
export * from '@solana/wallet-adapter-torus';
export * from '@solana/wallet-adapter-trezor';
export * from '@solana/wallet-adapter-trust';
export * from '@solana/wallet-adapter-unsafe-burner';
export * from '@solana/wallet-adapter-walletconnect';
export * from '@solana/wallet-adapter-xdefi';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/package.json
|
{
"name": "@solana/wallet-adapter-avana",
"version": "0.1.13",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/src/adapter.ts
|
import type { EventEmitter, SendTransactionOptions, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSendTransactionError,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Connection, SendOptions, Transaction, TransactionSignature } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface AvanaWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface AvanaWallet extends EventEmitter<AvanaWalletEvents> {
isAvana?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signAndSendTransaction(
transaction: Transaction,
options?: SendOptions
): Promise<{ signature: TransactionSignature }>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface AvanaWindow extends Window {
avana?: {
solana?: AvanaWallet;
};
}
declare const window: AvanaWindow;
export interface AvanaWalletAdapterConfig {}
export const AvanaWalletName = 'Avana' as WalletName<'Avana'>;
export class AvanaWalletAdapter extends BaseMessageSignerWalletAdapter {
name = AvanaWalletName;
url = 'https://www.avanawallet.com';
icon =
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNi4yLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyODkuNzg3ODEgMjg5Ljc4NzgxIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyODkuNzg3ODEgMjg5Ljc4NzgxIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9IiMxQzFDMUMiIGQ9Ik0yMTguNDM5MDEsMjg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EuMjEzMTcsMjI4Ljc4NjI1LDIzNS43ODEyMiwyMTcuMDQ1MzN6Ii8+DQo8L3N2Zz4NCg==';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: AvanaWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: AvanaWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.avana?.solana?.isAvana) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.avana!.solana!;
if (!wallet.isConnected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async sendTransaction(
transaction: Transaction,
connection: Connection,
options: SendTransactionOptions = {}
): Promise<TransactionSignature> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signers, ...sendOptions } = options;
transaction = await this.prepareTransaction(transaction, connection, sendOptions);
signers?.length && transaction.partialSign(...signers);
sendOptions.preflightCommitment = sendOptions.preflightCommitment || connection.commitment;
const { signature } = await wallet.signAndSendTransaction(transaction, sendOptions);
return signature;
} catch (error: any) {
if (error instanceof WalletError) throw error;
throw new WalletSendTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/avana/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/package.json
|
{
"name": "@solana/wallet-adapter-neko",
"version": "0.2.12",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/src/adapter.ts
|
import type { EventEmitter, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface NekoWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface NekoWallet extends EventEmitter<NekoWalletEvents> {
isNeko?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface NekoWalletWindow extends Window {
neko?: NekoWallet;
}
declare const window: NekoWalletWindow;
export interface NekoWalletAdapterConfig {}
export const NekoWalletName = 'Neko' as WalletName<'Neko'>;
export class NekoWalletAdapter extends BaseMessageSignerWalletAdapter {
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hMcmFzUnpxVk9nYTM3OEZRcHZIOWFielQKR2doTk5LRHhiNWdPZ3R4dnlqTStlRGdBdXVBdzc2aFFlNEZPcFM3b3JrcHltdkNZVTJNN0pvRm5tb0ZPcFU3cnJreEN5cDVPdFdtSAo1TEkzMnBsVHg1N1VYWjhrZFBGUUIzVHEzQTU0ckROZHpEdWgzOHFlUy9Yb2pPNUtxV1kra2ZKUmVxQmJlQ2FkOHRYWUFHZXppK2RTCkFSb2JXR3QyYWlnVnJOTUQyY1F6cDFPaEdvTm5qL3BIYnh4S1VYcmxUZDJWbE5XYmFSTFppZmJBTlBKWG44S1FiUTJkZVN1VHplcXUKY1R4bHM1bUp0NGRnWkVmbnpyeHo2bWNXZWovcTRzVzMzbms3c0pOSy9SOXZRRFNYcURYRjdRQUFBQ1YwUlZoMFpHRjBaVHBqY21WaApkR1VBTWpBeU1pMHdOaTB5T0ZRd05Eb3lNRG96T0Nzd01qb3dNSmVEK2JFQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNakl0Ck1EWXRNamhVTURRNk1qQTZNemdyTURJNk1ERG0za0VOQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: NekoWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: NekoWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.neko?.isNeko) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.neko!;
if (!wallet.isConnected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/neko/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/package.json
|
{
"name": "@solana/wallet-adapter-mathwallet",
"version": "0.9.18",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/src/adapter.ts
|
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletDisconnectedError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface MathWallet {
isMathWallet?: boolean;
getAccount(): Promise<string>;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
}
interface MathWalletWindow extends Window {
solana?: MathWallet;
}
declare const window: MathWalletWindow;
export interface MathWalletAdapterConfig {}
export const MathWalletName = 'MathWallet' as WalletName<'MathWallet'>;
export class MathWalletAdapter extends BaseSignerWalletAdapter {
name = MathWalletName;
url = 'https://mathwallet.org';
icon =
'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJtMCAwaDEyOHYxMjhoLTEyOHoiIG9wYWNpdHk9IjAiLz48cGF0aCBkPSJtOTAuODQ3MDA4NiA1Ny43NjEwMDIzYy0yLjI3NzAzNjMtMi4yNzcwMzYzLTIuMjc3MDM2My01Ljk2ODg0MTYgMC04LjI0NTg3NzggMi4yNzcwMzYyLTIuMjc3MDM2MyA1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2NiAyLjI3NzAzNjIgMi4yNzcwMzY2IDUuOTY4ODQxNSAwIDguMjQ1ODc3OC0yLjI3NzAzNjMgMi4yNzcwMzYyLTUuOTY4ODQxNiAyLjI3NzAzNjItOC4yNDU4Nzc4IDB6bS0xOS41ODM5NTk4IDE5LjU4Mzk1OTdjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMzAuOTIyMDQyMi0xMC4zMDczNDcyYy0xLjcwNzc3OC0xLjcwNzc3NzItMS43MDc3NzgtNC40NzY2MzEyIDAtNi4xODQ0MDg0IDEuNzA3Nzc3LTEuNzA3Nzc3MiA0LjQ3NjYzMS0xLjcwNzc3NzIgNi4xODQ0MDggMHMxLjcwNzc3N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MwNzM0NzMgMTAuMzA3MzQ3M2MtMi4yNzcwMzYyLTIuMjc3MDM2My0yLjI3NzAzNjItNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2My0yLjI3NzAzNjMgNS45Njg4NDE2LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjMgMi4yNzcwMzYyIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYyIDIuMjc3MDM2Mi01Ljk2ODg0MTUgMi4yNzcwMzYyLTguMjQ1ODc3OCAweiIvPjwvZz48L3N2Zz4=';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: MathWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: MathWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.solana?.isMathWallet) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.solana!;
let account: string;
try {
// @TODO: handle if popup is blocked
account = await wallet.getAccount();
} catch (error: any) {
throw new WalletAccountError(error?.message, error);
}
let publicKey: PublicKey;
try {
publicKey = new PublicKey(account);
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
window.addEventListener('message', this._messaged);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
if (this._wallet) {
window.removeEventListener('message', this._messaged);
this._wallet = null;
this._publicKey = null;
}
this.emit('disconnect');
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _messaged = (event: MessageEvent) => {
const data = event.data;
if (data && data.origin === 'mathwallet_internal' && data.type === 'lockStatusChanged' && !data.payload) {
this._disconnected();
}
};
private _disconnected = () => {
if (this._wallet) {
window.removeEventListener('message', this._messaged);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/mathwallet/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/package.json
|
{
"name": "@solana/wallet-adapter-solflare",
"version": "0.6.28",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^",
"@solana/wallet-standard-chains": "^1.1.0",
"@solflare-wallet/metamask-sdk": "^1.0.2",
"@solflare-wallet/sdk": "^1.3.0",
"@wallet-standard/wallet": "^1.0.1"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src/adapter.ts
|
import type { WalletAdapterNetwork, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
WalletConfigError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletError,
WalletLoadError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSendTransactionError,
WalletSignMessageError,
WalletSignTransactionError,
isIosAndRedirectable,
isVersionedTransaction,
scopePollingDetectionStrategy,
type SendTransactionOptions,
} from '@solana/wallet-adapter-base';
import type { Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
import { PublicKey, type Connection, type TransactionSignature } from '@solana/web3.js';
import type { default as Solflare } from '@solflare-wallet/sdk';
import { detectAndRegisterSolflareMetaMaskWallet } from './metamask/detect.js';
interface SolflareWindow extends Window {
solflare?: {
isSolflare?: boolean;
};
SolflareApp?: unknown;
}
declare const window: SolflareWindow;
export interface SolflareWalletAdapterConfig {
network?: WalletAdapterNetwork;
}
export const SolflareWalletName = 'Solflare' as WalletName<'Solflare'>;
export class SolflareWalletAdapter extends BaseMessageSignerWalletAdapter {
name = SolflareWalletName;
url = 'https://solflare.com';
icon =
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgNTAgNTAiIHdpZHRoPSI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk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MTggMi4wMzQ3YzIuMTQyMSAxLjYxMDkgNS4yMjk3LjI0MTcgNS40NTYxLTIuNDI0M2wuNzI0MS04LjU1OTk4Yy4wNDU3LS41NDA4LjUyNjUtLjk0MjU3IDEuMDczOS0uODk3Mzd6bS0yMy4xODczMyAyMC40Mzk2NWMuNTI1MDQgMCAuOTUwNjcuNDIxLjk1MDY3Ljk0MDNzLS40MjU2My45NDAzLS45NTA2Ny45NDAzYy0uNTI1MDQxIDAtLjk1MDY3LS40MjEtLjk1MDY3LS45NDAzcy40MjU2MjktLjk0MDMuOTUwNjctLjk0MDN6bTQ3LjY3OTczLS45NTQ3Yy41MjUgMCAuOTUwNy40MjEuOTUwNy45NDAzcy0uNDI1Ny45NDAyLS45NTA3Ljk0MDItLjk1MDctLjQyMDktLjk1MDctLjk0MDIuNDI1Ny0uOTQwMy45NTA3LS45NDAzem0tMjQuNjI5Ni0yMi40Nzk3Yy41MjUgMCAuOTUwNi40MjA5NzMuOTUwNi45NDAyNyAwIC41MTkzLS40MjU2Ljk0MDI3LS45NTA2Ljk0MDI3LS41MjUxIDAtLjk1MDctLjQyMDk3LS45NTA3LS45NDAyNyAwLS41MTkyOTcuNDI1Ni0uOTQwMjcuOTUwNy0uOTQwMjd6IiBmaWxsPSJ1cmwoI2IpIi8+PHBhdGggZD0ibTI0LjU3MSAzMi43NzkyYzQuOTU5NiAwIDguOTgwMi0zLjk3NjUgOC45ODAyLTguODgxOSAwLTQuOTA1My00LjAyMDYtOC44ODE5LTguOTgwMi04Ljg4MTlzLTguOTgwMiAzLjk3NjYtOC45ODAyIDguODgxOWMwIDQuOTA1NCA0LjAyMDYgOC44ODE5IDguOTgwMiA4Ljg4MTl6IiBmaWxsPSJ1cmwoI2MpIi8+PC9zdmc+';
supportedTransactionVersions: ReadonlySet<TransactionVersion> = new Set(['legacy', 0]);
private _connecting: boolean;
private _wallet: Solflare | null;
private _publicKey: PublicKey | null;
private _config: SolflareWalletAdapterConfig;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.Loadable;
constructor(config: SolflareWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._publicKey = null;
this._wallet = null;
this._config = config;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.solflare?.isSolflare || window.SolflareApp) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
detectAndRegisterSolflareMetaMaskWallet();
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.connected;
}
get readyState() {
return this._readyState;
}
async autoConnect(): Promise<void> {
// Skip autoconnect in the Loadable state on iOS
// We can't redirect to a universal link without user input
if (!(this.readyState === WalletReadyState.Loadable && isIosAndRedirectable())) {
await this.connect();
}
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Loadable && this._readyState !== WalletReadyState.Installed)
throw new WalletNotReadyError();
// redirect to the Solflare /browse universal link
// this will open the current URL in the Solflare in-wallet browser
if (this.readyState === WalletReadyState.Loadable && isIosAndRedirectable()) {
const url = encodeURIComponent(window.location.href);
const ref = encodeURIComponent(window.location.origin);
window.location.href = `https://solflare.com/ul/v1/browse/${url}?ref=${ref}`;
return;
}
let SolflareClass: typeof Solflare;
try {
SolflareClass = (await import('@solflare-wallet/sdk')).default;
} catch (error: any) {
throw new WalletLoadError(error?.message, error);
}
let wallet: Solflare;
try {
wallet = new SolflareClass({ network: this._config.network });
} catch (error: any) {
throw new WalletConfigError(error?.message, error);
}
this._connecting = true;
if (!wallet.connected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletConnectionError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
wallet.on('accountChanged', this._accountChanged);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
wallet.off('accountChanged', this._accountChanged);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async sendTransaction<T extends Transaction | VersionedTransaction>(
transaction: T,
connection: Connection,
options: SendTransactionOptions = {}
): Promise<TransactionSignature> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signers, ...sendOptions } = options;
if (isVersionedTransaction(transaction)) {
signers?.length && transaction.sign(signers);
} else {
transaction = (await this.prepareTransaction(transaction, connection, sendOptions)) as T;
signers?.length && (transaction as Transaction).partialSign(...signers);
}
sendOptions.preflightCommitment = sendOptions.preflightCommitment || connection.commitment;
return await wallet.signAndSendTransaction(transaction, sendOptions);
} catch (error: any) {
if (error instanceof WalletError) throw error;
throw new WalletSendTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return await wallet.signMessage(message, 'utf8');
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
private _accountChanged = (newPublicKey?: PublicKey) => {
if (!newPublicKey) return;
const publicKey = this._publicKey;
if (!publicKey) return;
try {
newPublicKey = new PublicKey(newPublicKey.toBytes());
} catch (error: any) {
this.emit('error', new WalletPublicKeyError(error?.message, error));
return;
}
if (publicKey.equals(newPublicKey)) return;
this._publicKey = newPublicKey;
this.emit('connect', newPublicKey);
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src/metamask/wallet.ts
|
import { WalletNotConnectedError } from '@solana/wallet-adapter-base';
import { SOLANA_DEVNET_CHAIN, SOLANA_MAINNET_CHAIN, SOLANA_TESTNET_CHAIN } from '@solana/wallet-standard-chains';
import {
SolanaSignAndSendTransaction,
type SolanaSignAndSendTransactionFeature,
type SolanaSignAndSendTransactionMethod,
SolanaSignMessage,
type SolanaSignMessageFeature,
type SolanaSignMessageMethod,
SolanaSignTransaction,
type SolanaSignTransactionFeature,
type SolanaSignTransactionMethod,
} from '@solana/wallet-standard-features';
import type { default as SolflareMetaMask } from '@solflare-wallet/metamask-sdk';
import type { Wallet } from '@wallet-standard/base';
import {
StandardConnect,
type StandardConnectFeature,
type StandardConnectMethod,
StandardDisconnect,
type StandardDisconnectFeature,
type StandardDisconnectMethod,
StandardEvents,
type StandardEventsChangeProperties,
type StandardEventsFeature,
type StandardEventsListeners,
type StandardEventsNames,
type StandardEventsOnMethod,
} from '@wallet-standard/features';
import { icon } from './icon.js';
export class SolflareMetaMaskWallet implements Wallet {
readonly #listeners: { [E in StandardEventsNames]?: StandardEventsListeners[E][] } = {};
readonly #version = '1.0.0' as const;
readonly #name = 'MetaMask' as const;
readonly #icon = icon;
#solflareMetaMask: SolflareMetaMask | null = null;
get version() {
return this.#version;
}
get name() {
return this.#name;
}
get icon() {
return this.#icon;
}
get chains() {
return [SOLANA_MAINNET_CHAIN, SOLANA_DEVNET_CHAIN, SOLANA_TESTNET_CHAIN] as const;
}
get features(): StandardConnectFeature &
StandardDisconnectFeature &
StandardEventsFeature &
SolanaSignAndSendTransactionFeature &
SolanaSignTransactionFeature &
SolanaSignMessageFeature {
return {
[StandardConnect]: {
version: '1.0.0',
connect: this.#connect,
},
[StandardDisconnect]: {
version: '1.0.0',
disconnect: this.#disconnect,
},
[StandardEvents]: {
version: '1.0.0',
on: this.#on,
},
[SolanaSignAndSendTransaction]: {
version: '1.0.0',
supportedTransactionVersions: ['legacy', 0],
signAndSendTransaction: this.#signAndSendTransaction,
},
[SolanaSignTransaction]: {
version: '1.0.0',
supportedTransactionVersions: ['legacy', 0],
signTransaction: this.#signTransaction,
},
[SolanaSignMessage]: {
version: '1.0.0',
signMessage: this.#signMessage,
},
};
}
get accounts() {
return this.#solflareMetaMask ? this.#solflareMetaMask.standardAccounts : [];
}
#on: StandardEventsOnMethod = (event, listener) => {
this.#listeners[event]?.push(listener) || (this.#listeners[event] = [listener]);
return (): void => this.#off(event, listener);
};
#emit<E extends StandardEventsNames>(event: E, ...args: Parameters<StandardEventsListeners[E]>): void {
// eslint-disable-next-line prefer-spread
this.#listeners[event]?.forEach((listener) => listener.apply(null, args));
}
#off<E extends StandardEventsNames>(event: E, listener: StandardEventsListeners[E]): void {
this.#listeners[event] = this.#listeners[event]?.filter((existingListener) => listener !== existingListener);
}
#connect: StandardConnectMethod = async () => {
if (!this.#solflareMetaMask) {
let SolflareMetaMaskClass: typeof SolflareMetaMask;
try {
SolflareMetaMaskClass = (await import('@solflare-wallet/metamask-sdk')).default;
} catch (error: any) {
throw new Error('Unable to load Solflare MetaMask SDK');
}
this.#solflareMetaMask = new SolflareMetaMaskClass();
this.#solflareMetaMask.on('standard_change', (properties: StandardEventsChangeProperties) =>
this.#emit('change', properties)
);
}
if (!this.accounts.length) {
await this.#solflareMetaMask.connect();
}
return { accounts: this.accounts };
};
#disconnect: StandardDisconnectMethod = async () => {
if (!this.#solflareMetaMask) return;
await this.#solflareMetaMask.disconnect();
};
#signAndSendTransaction: SolanaSignAndSendTransactionMethod = async (...inputs) => {
if (!this.#solflareMetaMask) throw new WalletNotConnectedError();
return await this.#solflareMetaMask.standardSignAndSendTransaction(...inputs);
};
#signTransaction: SolanaSignTransactionMethod = async (...inputs) => {
if (!this.#solflareMetaMask) throw new WalletNotConnectedError();
return await this.#solflareMetaMask.standardSignTransaction(...inputs);
};
#signMessage: SolanaSignMessageMethod = async (...inputs) => {
if (!this.#solflareMetaMask) throw new WalletNotConnectedError();
return await this.#solflareMetaMask.standardSignMessage(...inputs);
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src/metamask/detect.ts
|
import { registerWallet } from '@wallet-standard/wallet';
import { SolflareMetaMaskWallet } from './wallet.js';
let registered = false;
function register() {
if (registered) return;
registerWallet(new SolflareMetaMaskWallet());
registered = true;
}
/** @internal */
export async function detectAndRegisterSolflareMetaMaskWallet(): Promise<void> {
const id = 'solflare-detect-metamask';
function postMessage() {
window.postMessage(
{
target: 'metamask-contentscript',
data: {
name: 'metamask-provider',
data: {
id,
jsonrpc: '2.0',
method: 'wallet_getSnaps',
},
},
},
window.location.origin
);
}
function onMessage(event: MessageEvent) {
const message = event.data;
if (message?.target === 'metamask-inpage' && message.data?.name === 'metamask-provider') {
if (message.data.data?.id === id) {
window.removeEventListener('message', onMessage);
if (!message.data.data.error) {
register();
}
} else {
postMessage();
}
}
}
window.addEventListener('message', onMessage);
window.setTimeout(() => window.removeEventListener('message', onMessage), 5000);
postMessage();
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/solflare/src/metamask/icon.ts
|
import type { WalletIcon } from '@wallet-standard/base';
/** @internal */
export const icon: WalletIcon =
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjMxIiB2aWV3Qm94PSIwIDAgMzEgMzEiIHdpZHRoPSIzMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjIwLjI1IiB4Mj0iMjYuNTcxIiB5MT0iMjcuMTczIiB5Mj0iMTkuODU4Ij48c3RvcCBvZmZzZXQ9Ii4wOCIgc3RvcC1jb2xvcj0iIzk5NDVmZiIvPjxzdG9wIG9mZnNldD0iLjMiIHN0b3AtY29sb3I9IiM4NzUyZjMiLz48c3RvcCBvZmZzZXQ9Ii41IiBzdG9wLWNvbG9yPSIjNTQ5N2Q1Ii8+PHN0b3Agb2Zmc2V0PSIuNiIgc3RvcC1jb2xvcj0iIzQzYjRjYSIvPjxzdG9wIG9mZnNldD0iLjcyIiBzdG9wLWNvbG9yPSIjMjhlMGI5Ii8+PHN0b3Agb2Zmc2V0PSIuOTciIHN0b3AtY29sb3I9IiMxOWZiOWIiLz48L2xpbmVhckdyYWRpZW50PjxnIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iLjA5NCI+PHBhdGggZD0ibTI2LjEwOSAzLjY0My05LjM2OSA2Ljk1OSAxLjczMy00LjEwNSA3LjYzNy0yLjg1M3oiIG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A0LS4xMDEuMDY5bC0xLjMxIDEuMzY4Yy0uMDIuMDIxLS4wMzQuMDQ3LS4wMzkuMDc2cy0uMDAxLjA1OC4wMS4wODQuMDMxLjA0OS4wNTYuMDY1LjA1NC4wMjQuMDgzLjAyNHoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4=' as const;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/package.json
|
{
"name": "@solana/wallet-adapter-unsafe-burner",
"version": "0.1.7",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@noble/curves": "^1.1.0",
"@solana/wallet-adapter-base": "workspace:^",
"@solana/wallet-standard-features": "^1.1.0",
"@solana/wallet-standard-util": "^1.1.0"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/src/adapter.ts
|
import { ed25519 } from '@noble/curves/ed25519';
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseSignInMessageSignerWalletAdapter,
isVersionedTransaction,
WalletNotConnectedError,
WalletReadyState,
} from '@solana/wallet-adapter-base';
import { type SolanaSignInInput, type SolanaSignInOutput } from '@solana/wallet-standard-features';
import { createSignInMessage } from '@solana/wallet-standard-util';
import type { Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
import { Keypair } from '@solana/web3.js';
export const UnsafeBurnerWalletName = 'Burner Wallet' as WalletName<'Burner Wallet'>;
/**
* This burner wallet adapter is unsafe to use and is only included to provide an easy way for applications to test
* Wallet Adapter without using a third-party wallet.
*/
export class UnsafeBurnerWalletAdapter extends BaseSignInMessageSignerWalletAdapter {
name = UnsafeBurnerWalletName;
url = 'https://github.com/anza-xyz/wallet-adapter#usage';
icon =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iMzAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zNCAxMC42djIuN2wtOS41IDE2LjVoLTQuNmw2LTEwLjVhMi4xIDIuMSAwIDEgMCAyLTMuNGw0LjgtOC4zYTQgNCAwIDAgMSAxLjMgM1ptLTQuMyAxOS4xaC0uNmw0LjktOC40djQuMmMwIDIuMy0yIDQuMy00LjMgNC4zWm0yLTI4LjRjLS4zLS44LTEtMS4zLTItMS4zaC0xLjlsLTIuNCA0LjNIMzBsMS43LTNabS0zIDVoLTQuNkwxMC42IDI5LjhoNC43TDI4LjggNi40Wk0xOC43IDBoNC42bC0yLjUgNC4zaC00LjZMMTguNiAwWk0xNSA2LjRoNC42TDYgMjkuOEg0LjJjLS44IDAtMS43LS4zLTIuNC0uOEwxNSA2LjRaTTE0IDBIOS40TDcgNC4zaDQuNkwxNCAwWm0tMy42IDYuNEg1LjdMMCAxNi4ydjhMMTAuMyA2LjRaTTQuMyAwaC40TDAgOC4ydi00QzAgMiAxLjkgMCA0LjMgMFoiIGZpbGw9IiM5OTQ1RkYiLz48L3N2Zz4=';
supportedTransactionVersions: ReadonlySet<TransactionVersion> = new Set(['legacy', 0]);
/**
* Storing a keypair locally like this is not safe because any application using this adapter could retrieve the
* secret key, and because the keypair will be lost any time the wallet is disconnected or the window is refreshed.
*/
private _keypair: Keypair | null = null;
constructor() {
super();
console.warn(
'Your application is presently configured to use the `UnsafeBurnerWalletAdapter`. ' +
'Find and remove it, then replace it with a list of adapters for ' +
'wallets you would like your application to support. See ' +
'https://github.com/anza-xyz/wallet-adapter#usage for an example.'
);
}
get connecting() {
return false;
}
get publicKey() {
return this._keypair && this._keypair.publicKey;
}
get readyState() {
return WalletReadyState.Loadable;
}
async connect(): Promise<void> {
this._keypair = new Keypair();
this.emit('connect', this._keypair.publicKey);
}
async disconnect(): Promise<void> {
this._keypair = null;
this.emit('disconnect');
}
async signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T> {
if (!this._keypair) throw new WalletNotConnectedError();
if (isVersionedTransaction(transaction)) {
transaction.sign([this._keypair]);
} else {
transaction.partialSign(this._keypair);
}
return transaction;
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
if (!this._keypair) throw new WalletNotConnectedError();
return ed25519.sign(message, this._keypair.secretKey.slice(0, 32));
}
async signIn(input: SolanaSignInInput = {}): Promise<SolanaSignInOutput> {
const { publicKey, secretKey } = (this._keypair ||= new Keypair());
const domain = input.domain || window.location.host;
const address = input.address || publicKey.toBase58();
const signedMessage = createSignInMessage({
...input,
domain,
address,
});
const signature = ed25519.sign(signedMessage, secretKey.slice(0, 32));
this.emit('connect', publicKey);
return {
account: {
address,
publicKey: publicKey.toBytes(),
chains: [],
features: [],
},
signedMessage,
signature,
};
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/unsafe-burner/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/package.json
|
{
"name": "@solana/wallet-adapter-alpha",
"version": "0.1.10",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/src/adapter.ts
|
import type { EventEmitter, SendTransactionOptions, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSendTransactionError,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Connection, SendOptions, Transaction, TransactionSignature } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface AlphaWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface AlphaWallet extends EventEmitter<AlphaWalletEvents> {
isAlpha?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signAndSendTransaction(
transaction: Transaction,
options?: SendOptions
): Promise<{ signature: TransactionSignature }>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface AlphaWindow extends Window {
alpha?: AlphaWallet;
}
declare const window: AlphaWindow;
export interface AlphaWalletAdapterConfig {}
export const AlphaWalletName = 'Alpha' as WalletName<'Alpha'>;
export class AlphaWalletAdapter extends BaseMessageSignerWalletAdapter {
name = AlphaWalletName;
url = 'https://github.com/alphabatem/alpha-wallet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IzNy4xNTMsLjMwMS0zNTUuNzMsLjQ1MSw1OS44MjQtMTQ2LjYwNCwxMTkuNjQ4LTI5My4yMDcsMTc5LjQ3MS00MzkuODExWiIvPjxwYXRoIGNsYXNzPSJuIiBkPSJNNjcxLjkyOCw1MTcuNTMyYy0zNC4xMTQsNy41MjktNjguMjI5LDE1LjA1OC0xMDIuMzQzLDIyLjU4Nyw0Ny45NDcsMTA0LjUxNiw5NS44OTQsMjA5LjAzMSwxNDMuODQxLDMxMy41NDctNjcuNDk2LC4wODktMTM0Ljk5MSwuMTc3LTIwMi40ODcsLjI2NiwxNS4wNDksMzQuMTgzLDMwLjA5OSw2OC4zNjcsNDUuMTQ4LDEwMi41NSwxMDUuMTE1LC4xMjYsMjEwLjIzLC4yNTMsMzE1LjM0NSwuMzc5LTY2LjUwMi0xNDYuNDQzLTEzMy4wMDMtMjkyLjg4Ni0xOTkuNTA1LTQzOS4zMjlaIi8+PC9nPjwvZz48L2c+PC9zdmc+';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: AlphaWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: AlphaWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.alpha?.isAlpha) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.alpha!;
if (!wallet.isConnected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async sendTransaction(
transaction: Transaction,
connection: Connection,
options: SendTransactionOptions = {}
): Promise<TransactionSignature> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signers, ...sendOptions } = options;
transaction = await this.prepareTransaction(transaction, connection, sendOptions);
signers?.length && transaction.partialSign(...signers);
sendOptions.preflightCommitment = sendOptions.preflightCommitment || connection.commitment;
const { signature } = await wallet.signAndSendTransaction(transaction, sendOptions);
return signature;
} catch (error: any) {
if (error instanceof WalletError) throw error;
throw new WalletSendTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/alpha/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/package.json
|
{
"name": "@solana/wallet-adapter-particle",
"version": "0.1.12",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@particle-network/solana-wallet": "^1.3.2",
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@metamask/eth-sig-util": "^7.0.1",
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/src/adapter.ts
|
import type { ParticleNetwork, SolanaWallet } from '@particle-network/solana-wallet';
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
WalletAccountError,
WalletConfigError,
WalletDisconnectionError,
WalletLoadError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
export interface ParticleAdapterConfig {
config?: ConstructorParameters<typeof ParticleNetwork>[0];
login?: Parameters<SolanaWallet['connect']>[0];
}
export const ParticleName = 'Particle' as WalletName<'Particle'>;
export class ParticleAdapter extends BaseMessageSignerWalletAdapter {
name = ParticleName;
url = 'https://particle.network';
icon =
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTQwIiBoZWlnaHQ9IjE0MCIgdmlld0JveD0iMCAwIDE0MCAxNDAiPjxkZWZzPjxmaWx0ZXIgaWQ9ImEiIHg9IjAiIHk9IjAiIHdpZHRoPSIxNDAiIGhlaWdodD0iMTQwIiBmaWx0ZXJVbml0cz0idXNlclNwYWNlT25Vc2UiPjxmZUltYWdlIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiIHdpZHRoPSIxNDAiIGhlaWdodD0iMTQwIiByZXN1bHQ9ImltYWdlIiB4bGluazpocmVmPSJkYXRhOmltYWdlL3N2Zyt4bWw7YmFzZTY0LFBITjJaeUI0Yld4dWN6MGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TUM5emRtY2lJSGh0Ykc1ek9uaHNhVzVyUFNKb2RIUndPaTh2ZDNkM0xuY3pMbTl5Wnk4eE9UazVMM2hzYVc1cklpQjNhV1IwYUQwaU1UUXdJaUJvWldsbmFIUTlJakUwTUNJZ2RtbGxkMEp2ZUQwaU1DQXdJREUwTUNBeE5EQWlQZ29nSUR4a1pXWnpQZ29nSUNBZ1BITjBlV3hsUGdvZ0lDQWdJQ0F1WTJ4ekxURWdld29nSUNBZ0lDQWdJR1pwYkd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uNjQ3IDEuMzYxIDIuMTI1IDIuMTI1IDAgMCAwIDEuMzQ5IDIuNjczem0tNS4yIDEuMjUyYTIuMDg4IDIuMDg4IDAgMCAwIDIuOTM0LS40NjkgMi4xMzMgMi4xMzMgMCAwIDAtLjQ2NS0yLjk2MiAyLjA4OCAyLjA4OCAwIDAgMC0yLjkzNC40NjkgMi4xMzMgMi4xMzMgMCAwIDAgLjQ3IDIuOTYyem0tNS4zMjQtLjQzYTIuMDg4IDIuMDg4IDAgMCAwIDIuOTM0LjQ2OSAyLjEzMyAyLjEzMyAwIDAgMCAuNDY1LTIuOTYyIDIuMDg4IDIuMDg4IDAgMCAwLTIuOTM0LS40NjkgMi4xMzMgMi4xMzMgMCAwIDAtLjQ2IDIuOTYyem0tNC45MzItMi4wN2EyLjEgMi4xIDAgMCAwIDIuNjQ3IDEuMzYxIDIuMTI1IDIuMTI1IDAgMCAwIDEuMzQ5LTIuNjcyIDIuMSAyLjEgMCAwIDAtMi42NDctMS4zNjEgMi4xMjQgMi4xMjQgMCAwIDAtMS4zNDQgMi42NzJ6bS00LjA1Ny0zLjUwN2EyLjEgMi4xIDAgMSAwIDIuMS0yLjEyIDIuMTExIDIuMTExIDAgMCAwLTIuMDk1IDIuMTJ6IiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: SolanaWallet | null;
private _publicKey: PublicKey | null;
private _config: ParticleAdapterConfig;
private _readyState: WalletReadyState =
typeof window === 'undefined' ? WalletReadyState.Unsupported : WalletReadyState.Loadable;
private _particle: ParticleNetwork | null = null;
constructor(config: ParticleAdapterConfig = {}) {
super();
this._connecting = false;
this._publicKey = null;
this._wallet = null;
this._config = {
config: {
projectId: '',
clientKey: '',
appId: '',
...config.config,
chainId: config.config?.chainId ?? 101,
chainName: config.config?.chainName ?? 'solana',
},
login: config.login,
};
}
get particle(): ParticleNetwork | null {
return this._particle;
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Loadable) throw new WalletNotReadyError();
this._connecting = true;
let ParticleClass: typeof ParticleNetwork;
let WalletClass: typeof SolanaWallet;
try {
({ ParticleNetwork: ParticleClass, SolanaWallet: WalletClass } = await import(
'@particle-network/solana-wallet'
));
} catch (error: any) {
throw new WalletLoadError(error?.message, error);
}
let particle: ParticleNetwork;
try {
particle = new ParticleClass(this._config.config);
if (!particle.auth.isLogin()) {
await particle.auth.login(this._config.login);
}
} catch (error: any) {
throw new WalletConfigError(error?.message, error);
}
let wallet: SolanaWallet;
try {
wallet = new WalletClass(particle.auth);
} catch (error: any) {
throw new WalletConfigError(error?.message, error);
}
const account = wallet.publicKey;
if (!account) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(account.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
this._particle = particle;
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return await wallet.signMessage(message);
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/particle/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/package.json
|
{
"name": "@solana/wallet-adapter-saifu",
"version": "0.1.15",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/src/adapter.ts
|
import type { EventEmitter, SendTransactionOptions, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSendTransactionError,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Connection, SendOptions, Transaction, TransactionSignature } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface SaifuWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface SaifuWallet extends EventEmitter<SaifuWalletEvents> {
isSaifu?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signAndSendTransaction?(
transaction: Transaction,
options?: SendOptions
): Promise<{ signature: TransactionSignature }>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface SolanaWindow extends Window {
saifu?: SaifuWallet;
}
declare const window: SolanaWindow;
export interface SaifuWalletAdapterConfig {}
export const SaifuWalletName = 'Saifu' as WalletName<'Saifu'>;
export class SaifuWalletAdapter extends BaseMessageSignerWalletAdapter {
name = SaifuWalletName;
url = 'https://saifuwallet.com';
icon =
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNTQxcHgiIGhlaWdodD0iNTQxcHgiIHZpZXdCb3g9IjAgMCA1NDEgNTQxIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPHRpdGxlPkFydGJvYXJkIENvcHkgOTwvdGl0bGU+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjEuNzk5ODcyMTYlIiB5MT0iMCUiIHgyPSI5OC4zOTcxMDUxJSIgeTI9Ijk3Ljk5MDI5MSUiIGlkPSJsaW5lYXJHcmFkaWVudC0xIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0ZCOTIzQyIgb2Zmc2V0PSIwJSI+PC9zdG9wP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4IDI5OS43OTU5NDIsMjkzLjA3NDI5NyBDMjk1Ljc2NzA3MiwyOTYuMjc1ODY2IDI4OS42NjQxOTgsMzAwLjQ2Mzg4NSAyODYuMjMzOTkxLDMwMi4zODA5NjggQzI4Mi44MDM3ODUsMzA0LjI5ODA4MyAyNzUuODc1MDEzLDMwNy40NTc3NTEgMjcwLjgzNjc0NCwzMDkuNDAyNDgzIEMyNjUuNzk4NDc1LDMxMS4zNDcyNDYgMjU3LjI0ODQ1NywzMTQuMDkwNTk0IDI1MS44MzY3NDQsMzE1LjQ5ODgyNyBDMjQ2LjQyNTAwMSwzMTYuOTA3MDYxIDIzNi41OTcyNDIsMzE4LjkxNDY5IDIyOS45OTcyMzYsMzE5Ljk2MDI4NCBDMjIzLjM5NzIzLDMyMS4wMDU4NDYgMjEyLjUxOTc4OCwzMjIuMzM3NjY0IDIwNS44MjUxNDcsMzIyLjkxOTg0OCBDMTk5LjEzMDUwNiwzMjMuNTAyMDYyIDE3OS4xMDU0OTcsMzIzLjkyNjY4NCAxNjEuMzI1MTQ3LDMyMy44NjM0MjEgWiIgaWQ9IlNoYXBlIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: SaifuWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: SaifuWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.saifu) {
this._readyState = WalletReadyState.Installed;
this.emit('readyStateChange', this._readyState);
return true;
}
return false;
});
}
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get connected() {
return !!this._wallet?.isConnected;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Installed) throw new WalletNotReadyError();
this._connecting = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const wallet = window.saifu!;
if (!wallet.isConnected) {
try {
await wallet.connect();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
}
if (!wallet.publicKey) throw new WalletAccountError();
let publicKey: PublicKey;
try {
publicKey = new PublicKey(wallet.publicKey.toBytes());
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('disconnect', this._disconnected);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
try {
await wallet.disconnect();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
}
this.emit('disconnect');
}
async sendTransaction(
transaction: Transaction,
connection: Connection,
options: SendTransactionOptions = {}
): Promise<TransactionSignature> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
if (wallet.signAndSendTransaction) {
try {
const { signers, ...sendOptions } = options;
transaction = await this.prepareTransaction(transaction, connection, sendOptions);
signers?.length && transaction.partialSign(...signers);
sendOptions.preflightCommitment = sendOptions.preflightCommitment || connection.commitment;
const { signature } = await wallet.signAndSendTransaction(transaction, sendOptions);
return signature;
} catch (error: any) {
if (error instanceof WalletError) throw error;
throw new WalletSendTransactionError(error?.message, error);
}
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
return await super.sendTransaction(transaction, connection, options);
}
async signTransaction<T extends Transaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signTransaction(transaction)) as T) || transaction;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signAllTransactions<T extends Transaction>(transactions: T[]): Promise<T[]> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return ((await wallet.signAllTransactions(transactions)) as T[]) || transactions;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
async signMessage(message: Uint8Array): Promise<Uint8Array> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _disconnected = () => {
const wallet = this._wallet;
if (wallet) {
wallet.off('disconnect', this._disconnected);
this._wallet = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/saifu/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types",
"skipLibCheck": true
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/package.json
|
{
"name": "@solana/wallet-adapter-trezor",
"version": "0.1.2",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"src",
"LICENSE"
],
"engines": {
"node": ">=18"
},
"type": "module",
"sideEffects": false,
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts"
},
"scripts": {
"build": "tsc --build --verbose && pnpm run package",
"clean": "shx mkdir -p lib && shx rm -rf lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"package": "shx mkdir -p lib/cjs && shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.77.3"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^",
"@trezor/connect-web": "^9.2.1",
"buffer": "^6.0.3"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"shx": "^0.3.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/tsconfig.cjs.json
|
{
"extends": "../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs",
"skipLibCheck": true
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"references": [
{
"path": "./tsconfig.cjs.json"
},
{
"path": "./tsconfig.esm.json"
}
]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/src/adapter.ts
|
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseSignerWalletAdapter,
WalletAccountError,
WalletConfigError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletLoadError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignTransactionError,
isVersionedTransaction,
} from '@solana/wallet-adapter-base';
import type { Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
import type {
DeviceEventMessage,
SolanaPublicKey,
SolanaSignedTransaction,
Success,
TrezorConnect,
Unsuccessful,
} from '@trezor/connect-web';
import './polyfills/index.js';
export interface TrezorWalletAdapterConfig {
derivationPath?: string;
connectUrl?: string;
}
export const TrezorWalletName = 'Trezor' as WalletName<'Trezor'>;
export class TrezorWalletAdapter extends BaseSignerWalletAdapter {
name = TrezorWalletName;
url = 'https://trezor.io';
icon =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTA4IiBoZWlnaHQ9IjEwOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Ik01NCAwYzI5LjgyNCAwIDU0IDI0LjE3NiA1NCA1NHMtMjQuMTc2IDU0LTU0IDU0UzAgODMuODI0IDAgNTQgMjQuMTc2IDAgNTQgMHoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNzUuMjUgMzMuMzA1Qzc1LjI1IDIyLjIwNSA2NS42NjIgMTMgNTQgMTNjLTExLjY3MiAwLTIxLjI1OCA5LjIxMi0yMS4yNTggMjAuMzA1djYuNDlIMjR2NDYuNjgzTDUzLjk5IDEwMC41IDg0IDg2LjQ3NXYtNDYuNDdoLTguNzQ1bC0uMDA3LTYuNjk4LjAwMi0uMDAyem0tMzEuNjcgMGMwLTUuMjMyIDQuNTg1LTkuNDIgMTAuNDE4LTkuNDIgNS44MzUgMCAxMC40MTcgNC4xODggMTAuNDE3IDkuNDJ2Ni40OUg0My41OHYtNi40OXptMjguMzM1IDQ1LjYzN0w1My45OSA4Ny4zMmwtMTcuOTItOC4zNzJWNTAuODloMzUuODQ1djI4LjA1MnoiIGZpbGw9IiMxNzE3MTciLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMCAwaDEwOHYxMDhIMHoiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=';
supportedTransactionVersions: ReadonlySet<TransactionVersion> = new Set(['legacy', 0]);
private _derivationPath: string;
private _wallet: TrezorConnect | null;
private _connectUrl: string | undefined;
private _connecting: boolean;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.Loadable;
constructor(config: TrezorWalletAdapterConfig = {}) {
super();
this._derivationPath = config.derivationPath || `m/44'/501'/0'/0'`;
this._wallet = null;
this._connectUrl = config.connectUrl?.replace(/\/*$/, '/');
this._connecting = false;
this._publicKey = null;
}
get publicKey() {
return this._publicKey;
}
get connecting() {
return this._connecting;
}
get readyState() {
return this._readyState;
}
async connect(): Promise<void> {
try {
if (this.connected || this.connecting) return;
if (this._readyState !== WalletReadyState.Loadable) throw new WalletNotReadyError();
this._connecting = true;
let wallet: TrezorConnect;
try {
const { default: TrezorConnect } = await import('@trezor/connect-web');
// @ts-expect-error // HACK: TrezorConnect.default is undefined.
wallet = TrezorConnect.default as TrezorConnect;
} catch (error: any) {
throw new WalletLoadError(error?.message, error);
}
try {
await wallet.init({
manifest: {
email: 'gabriel.kerekes@vacuumlabs.com',
appUrl: window.location.href,
},
lazyLoad: true,
...(this._connectUrl
? {
connectSrc: this._connectUrl,
iframeSrc: this._connectUrl,
}
: {}),
});
} catch (error: any) {
throw new WalletConfigError(error?.message, error);
}
let result: Unsuccessful | Success<SolanaPublicKey>;
try {
result = await wallet.solanaGetPublicKey({ path: this._derivationPath });
} catch (error: any) {
throw new WalletAccountError(error?.message, error);
}
if (!result.success) {
throw new WalletAccountError(result.payload?.error, result.payload);
}
let publicKey: PublicKey;
try {
publicKey = new PublicKey(Buffer.from(result.payload.publicKey, 'hex'));
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
wallet.on('DEVICE_EVENT', this._onDeviceEvent);
this._wallet = wallet;
this._publicKey = publicKey;
this.emit('connect', publicKey);
} catch (error: any) {
this.emit('error', error);
throw error;
} finally {
this._connecting = false;
}
}
async disconnect(): Promise<void> {
const wallet = this._wallet;
if (wallet) {
this._wallet = null;
this._publicKey = null;
try {
wallet.off('DEVICE_EVENT', this._onDeviceEvent);
await wallet.dispose();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
this.emit('disconnect');
}
}
async signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
const publicKey = this._publicKey;
if (!wallet || !publicKey) throw new WalletNotConnectedError();
const serializedTransaction = isVersionedTransaction(transaction)
? transaction.message.serialize()
: transaction.serializeMessage();
let result: Unsuccessful | Success<SolanaSignedTransaction>;
try {
result = await wallet.solanaSignTransaction({
path: this._derivationPath,
serializedTx: Buffer.from(serializedTransaction).toString('hex'),
});
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
if (!result.success) {
throw new WalletSignTransactionError(result.payload?.error, result.payload);
}
try {
const signature = Buffer.from(result.payload.signature, 'hex');
transaction.addSignature(publicKey, signature);
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
return transaction;
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
private _onDeviceEvent = (event: DeviceEventMessage) => {
if (event.type === 'device-disconnect') {
this._disconnected();
}
};
private _disconnected = async () => {
const wallet = this._wallet;
if (wallet) {
this._wallet = null;
this._publicKey = null;
try {
wallet.off('DEVICE_EVENT', this._onDeviceEvent);
wallet.dispose();
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/src/index.ts
|
export * from './adapter.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/src/polyfills/Buffer.ts
|
import { Buffer } from 'buffer';
if (typeof window !== 'undefined' && window.Buffer === undefined) {
(window as any).Buffer = Buffer;
}
export {};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/trezor/src/polyfills/index.ts
|
import './Buffer.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/phantom/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/phantom/tsconfig.esm.json
|
{
"extends": "../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/esm",
"declarationDir": "lib/types"
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.