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/starter/create-react-app-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter/src/index.css
|
body {
background: #222222;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter/src/setupTests.ts
|
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter/src/reportWebVitals.ts
|
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/create-react-app-starter/src/react-app-env.d.ts
|
/// <reference types="react-scripts" />
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/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/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/next.config.js
|
/* eslint-disable @typescript-eslint/no-var-requires */
const withAntdLess = require('next-plugin-antd-less');
const { PHASE_PRODUCTION_BUILD } = require('next/constants');
const COLORS = {
GREY: '#303030',
PURPLE: '#512da8',
};
module.exports = function (phase, { defaultConfig }) {
// See https://github.com/SolidZORO/next-plugin-antd-less
const config = withAntdLess({
// Note this produces an unnecessary warning:
// 'The root value has an unexpected property, modifyVars'
// See https://github.com/SolidZORO/next-plugin-antd-less/issues/105
modifyVars: {
'@background': COLORS.GREY,
'@primary-color': COLORS.PURPLE,
},
basePath: phase === PHASE_PRODUCTION_BUILD ? '/wallet-adapter/example' : '',
});
return config;
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/next-env.d.ts
|
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/.prettierignore
|
/.next
/.swc
/lib
/node_modules
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/.editorconfig
|
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/package.json
|
{
"name": "@solana/wallet-adapter-example",
"version": "0.18.36",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"public",
"src",
".editorconfig",
".eslintrc.json",
".gitignore",
".prettierignore",
".prettierrc",
"LICENSE",
"next.config.js",
"next-env.d.ts",
"package.json",
"README.md",
"tsconfig.json"
],
"engines": {
"node": ">=18"
},
"scripts": {
"build": "tsc --build --verbose && next build",
"clean": "shx rm -rf .next .swc lib",
"dev": "NODE_OPTIONS='--inspect' next dev",
"start": "next start",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint && next lint",
"export": "next export"
},
"dependencies": {
"@ant-design/icons": "^4.8.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.5",
"@noble/curves": "^1.1.0",
"@solana/wallet-adapter-ant-design": "workspace:^",
"@solana/wallet-adapter-base": "workspace:^",
"@solana/wallet-adapter-material-ui": "workspace:^",
"@solana/wallet-adapter-react": "workspace:^",
"@solana/wallet-adapter-react-ui": "workspace:^",
"@solana/wallet-adapter-wallets": "workspace:^",
"@solana/wallet-standard-features": "^1.1.0",
"@solana/wallet-standard-util": "^1.1.0",
"@solana/web3.js": "^1.77.3",
"antd": "^4.24.10",
"bs58": "^4.0.1",
"next": "^12.3.4",
"notistack": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/bs58": "^4.0.1",
"@types/node-fetch": "^2.6.4",
"@types/react": "^18.2.13",
"@types/react-dom": "^18.2.6",
"eslint": "8.22.0",
"eslint-config-next": "^12.3.4",
"next-plugin-antd-less": "^1.8.0",
"prettier": "^2.8.8",
"shx": "^0.3.4",
"typescript": "~4.7.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/.prettierrc
|
{
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "package.json"],
"compilerOptions": {
"outDir": "lib",
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"exclude": ["node_modules"]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/.eslintrc.json
|
{
"extends": "next/core-web-vitals"
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/public/vercel.svg
|
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/styles/globals.css
|
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
background-color: #303030;
color: #FFFFFF;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/SignTransaction.tsx
|
import { Button } from '@mui/material';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import { PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
import bs58 from 'bs58';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const SignTransaction: FC = () => {
const { connection } = useConnection();
const { publicKey, signTransaction } = useWallet();
const notify = useNotify();
const onClick = useCallback(async () => {
try {
if (!publicKey) throw new Error('Wallet not connected!');
if (!signTransaction) throw new Error('Wallet does not support transaction signing!');
const { blockhash } = await connection.getLatestBlockhash();
let transaction = new Transaction({
feePayer: publicKey,
recentBlockhash: blockhash,
}).add(
new TransactionInstruction({
data: Buffer.from('Hello, from the Solana Wallet Adapter example app!'),
keys: [],
programId: new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'),
})
);
transaction = await signTransaction(transaction);
if (!transaction.signature) throw new Error('Transaction not signed!');
const signature = bs58.encode(transaction.signature);
notify('info', `Transaction signed: ${signature}`);
if (!transaction.verifySignatures()) throw new Error(`Transaction signature invalid! ${signature}`);
notify('success', `Transaction signature valid! ${signature}`);
} catch (error: any) {
notify('error', `Transaction signing failed! ${error?.message}`);
}
}, [publicKey, signTransaction, connection, notify]);
return (
<Button variant="contained" color="secondary" onClick={onClick} disabled={!publicKey || !signTransaction}>
Sign Transaction
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/notify.tsx
|
import {
// FIXME(https://github.com/mui/material-ui/issues/35233)
Launch as LaunchIcon,
} from '@mui/icons-material';
import { Link } from '@mui/material';
import { styled } from '@mui/material/styles';
import type { VariantType } from 'notistack';
import { useSnackbar } from 'notistack';
import React, { useCallback } from 'react';
const Notification = styled('span')(() => ({
display: 'flex',
alignItems: 'center',
}));
const StyledLink = styled(Link)(() => ({
color: '#ffffff',
display: 'flex',
alignItems: 'center',
marginLeft: 16,
textDecoration: 'underline',
'&:hover': {
color: '#000000',
},
}));
const StyledLaunchIcon = styled(LaunchIcon)(() => ({
fontSize: 20,
marginLeft: 8,
}));
export function useNotify() {
const { enqueueSnackbar } = useSnackbar();
return useCallback(
(variant: VariantType, message: string, signature?: string) => {
enqueueSnackbar(
<Notification>
{message}
{signature && (
<StyledLink href={`https://explorer.solana.com/tx/${signature}?cluster=devnet`} target="_blank">
Transaction
<StyledLaunchIcon />
</StyledLink>
)}
</Notification>,
{ variant }
);
},
[enqueueSnackbar]
);
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/SendLegacyTransaction.tsx
|
import { Button } from '@mui/material';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import type { TransactionSignature } from '@solana/web3.js';
import { PublicKey, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const SendLegacyTransaction: FC = () => {
const { connection } = useConnection();
const { publicKey, sendTransaction, wallet } = useWallet();
const notify = useNotify();
const supportedTransactionVersions = wallet?.adapter.supportedTransactionVersions;
const onClick = useCallback(async () => {
let signature: TransactionSignature | undefined = undefined;
try {
if (!publicKey) throw new Error('Wallet not connected!');
if (!supportedTransactionVersions) throw new Error("Wallet doesn't support versioned transactions!");
if (!supportedTransactionVersions.has('legacy'))
throw new Error("Wallet doesn't support legacy transactions!");
const {
context: { slot: minContextSlot },
value: { blockhash, lastValidBlockHeight },
} = await connection.getLatestBlockhashAndContext();
const message = new TransactionMessage({
payerKey: publicKey,
recentBlockhash: blockhash,
instructions: [
{
data: Buffer.from('Hello, from the Solana Wallet Adapter example app!'),
keys: [],
programId: new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'),
},
],
});
const transaction = new VersionedTransaction(message.compileToLegacyMessage());
signature = await sendTransaction(transaction, connection, { minContextSlot });
notify('info', 'Transaction sent:', signature);
await connection.confirmTransaction({ blockhash, lastValidBlockHeight, signature });
notify('success', 'Transaction successful!', signature);
} catch (error: any) {
notify('error', `Transaction failed! ${error?.message}`, signature);
}
}, [publicKey, supportedTransactionVersions, connection, sendTransaction, notify]);
return (
<Button
variant="contained"
color="secondary"
onClick={onClick}
disabled={!publicKey || !supportedTransactionVersions?.has('legacy')}
>
Send Legacy Transaction (devnet)
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/SendV0Transaction.tsx
|
import { Button } from '@mui/material';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import type { TransactionSignature } from '@solana/web3.js';
import { PublicKey, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const SendV0Transaction: FC = () => {
const { connection } = useConnection();
const { publicKey, sendTransaction, wallet } = useWallet();
const notify = useNotify();
const supportedTransactionVersions = wallet?.adapter.supportedTransactionVersions;
const onClick = useCallback(async () => {
let signature: TransactionSignature | undefined = undefined;
try {
if (!publicKey) throw new Error('Wallet not connected!');
if (!supportedTransactionVersions) throw new Error("Wallet doesn't support versioned transactions!");
if (!supportedTransactionVersions.has(0)) throw new Error("Wallet doesn't support v0 transactions!");
/**
* This lookup table only exists on devnet and can be replaced as
* needed. To create and manage a lookup table, use the `solana
* address-lookup-table` commands.
*/
const { value: lookupTable } = await connection.getAddressLookupTable(
new PublicKey('F3MfgEJe1TApJiA14nN2m4uAH4EBVrqdBnHeGeSXvQ7B')
);
if (!lookupTable) throw new Error("Address lookup table wasn't found!");
const {
context: { slot: minContextSlot },
value: { blockhash, lastValidBlockHeight },
} = await connection.getLatestBlockhashAndContext();
const message = new TransactionMessage({
payerKey: publicKey,
recentBlockhash: blockhash,
instructions: [
{
data: Buffer.from('Hello, from the Solana Wallet Adapter example app!'),
keys: lookupTable.state.addresses.map((pubkey, index) => ({
pubkey,
isWritable: index % 2 == 0,
isSigner: false,
})),
programId: new PublicKey('Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo'),
},
],
});
const transaction = new VersionedTransaction(message.compileToV0Message([lookupTable]));
signature = await sendTransaction(transaction, connection, { minContextSlot });
notify('info', 'Transaction sent:', signature);
await connection.confirmTransaction({ blockhash, lastValidBlockHeight, signature });
notify('success', 'Transaction successful!', signature);
} catch (error: any) {
notify('error', `Transaction failed! ${error?.message}`, signature);
}
}, [publicKey, supportedTransactionVersions, connection, sendTransaction, notify]);
return (
<Button
variant="contained"
color="secondary"
onClick={onClick}
disabled={!publicKey || !supportedTransactionVersions?.has(0)}
>
Send V0 Transaction using Address Lookup Table (devnet)
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/ContextProvider.tsx
|
import { createTheme, StyledEngineProvider, ThemeProvider } from '@mui/material';
import { deepPurple, pink } from '@mui/material/colors';
import { WalletModalProvider as AntDesignWalletModalProvider } from '@solana/wallet-adapter-ant-design';
import type { Adapter, WalletError } from '@solana/wallet-adapter-base';
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { WalletDialogProvider as MaterialUIWalletDialogProvider } from '@solana/wallet-adapter-material-ui';
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react';
import { WalletModalProvider as ReactUIWalletModalProvider } from '@solana/wallet-adapter-react-ui';
import { UnsafeBurnerWalletAdapter } from '@solana/wallet-adapter-wallets';
import { type SolanaSignInInput } from '@solana/wallet-standard-features';
import { verifySignIn } from '@solana/wallet-standard-util';
import { clusterApiUrl } from '@solana/web3.js';
import { SnackbarProvider, useSnackbar } from 'notistack';
import type { FC, ReactNode } from 'react';
import React, { useCallback, useMemo } from 'react';
import { AutoConnectProvider, useAutoConnect } from './AutoConnectProvider';
const theme = createTheme({
palette: {
mode: 'dark',
primary: {
main: deepPurple[700],
},
secondary: {
main: pink[700],
},
},
components: {
MuiButtonBase: {
styleOverrides: {
root: {
justifyContent: 'flex-start',
},
},
},
MuiButton: {
styleOverrides: {
root: {
textTransform: 'none',
padding: '12px 16px',
},
startIcon: {
marginRight: 8,
},
endIcon: {
marginLeft: 8,
},
},
},
},
});
const WalletContextProvider: FC<{ children: ReactNode }> = ({ children }) => {
const { autoConnect } = useAutoConnect();
// Can be set to 'devnet', 'testnet', or 'mainnet-beta'
const network = WalletAdapterNetwork.Devnet;
// You can also provide a custom RPC endpoint
const endpoint = useMemo(() => clusterApiUrl(network), [network]);
const wallets = useMemo(
() => [
/**
* Wallets that implement either of these standards will be available automatically.
*
* - Solana Mobile Stack Mobile Wallet Adapter Protocol
* (https://github.com/solana-mobile/mobile-wallet-adapter)
* - Solana Wallet Standard
* (https://github.com/solana-labs/wallet-standard)
*
* If you wish to support a wallet that supports neither of those standards,
* instantiate its legacy wallet adapter here. Common legacy adapters can be found
* in the npm package `@solana/wallet-adapter-wallets`.
*/
new UnsafeBurnerWalletAdapter(),
],
// eslint-disable-next-line react-hooks/exhaustive-deps
[network]
);
const { enqueueSnackbar } = useSnackbar();
const onError = useCallback(
(error: WalletError, adapter?: Adapter) => {
enqueueSnackbar(error.message ? `${error.name}: ${error.message}` : error.name, { variant: 'error' });
console.error(error, adapter);
},
[enqueueSnackbar]
);
const autoSignIn = useCallback(async (adapter: Adapter) => {
if (!('signIn' in adapter)) return true;
const input: SolanaSignInInput = {
domain: window.location.host,
address: adapter.publicKey ? adapter.publicKey.toBase58() : undefined,
statement: 'Please sign in.',
};
const output = await adapter.signIn(input);
if (!verifySignIn(input, output)) throw new Error('Sign In verification failed!');
return false;
}, []);
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} onError={onError} autoConnect={autoConnect && autoSignIn}>
<MaterialUIWalletDialogProvider>
<AntDesignWalletModalProvider>
<ReactUIWalletModalProvider>{children}</ReactUIWalletModalProvider>
</AntDesignWalletModalProvider>
</MaterialUIWalletDialogProvider>
</WalletProvider>
</ConnectionProvider>
);
};
export const ContextProvider: FC<{ children: ReactNode }> = ({ children }) => {
return (
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<SnackbarProvider>
<AutoConnectProvider>
<WalletContextProvider>{children}</WalletContextProvider>
</AutoConnectProvider>
</SnackbarProvider>
</ThemeProvider>
</StyledEngineProvider>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/SendTransaction.tsx
|
import { Button } from '@mui/material';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import type { TransactionSignature } from '@solana/web3.js';
import { PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const SendTransaction: FC = () => {
const { connection } = useConnection();
const { publicKey, sendTransaction } = useWallet();
const notify = useNotify();
const onClick = useCallback(async () => {
let signature: TransactionSignature | undefined = undefined;
try {
if (!publicKey) throw new Error('Wallet not connected!');
const {
context: { slot: minContextSlot },
value: { blockhash, lastValidBlockHeight },
} = await connection.getLatestBlockhashAndContext();
const transaction = new Transaction({
feePayer: publicKey,
recentBlockhash: blockhash,
}).add(
new TransactionInstruction({
data: Buffer.from('Hello, from the Solana Wallet Adapter example app!'),
keys: [],
programId: new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'),
})
);
signature = await sendTransaction(transaction, connection, { minContextSlot });
notify('info', 'Transaction sent:', signature);
await connection.confirmTransaction({ blockhash, lastValidBlockHeight, signature });
notify('success', 'Transaction successful!', signature);
} catch (error: any) {
notify('error', `Transaction failed! ${error?.message}`, signature);
}
}, [publicKey, connection, sendTransaction, notify]);
return (
<Button variant="contained" color="secondary" onClick={onClick} disabled={!publicKey}>
Send Transaction (devnet)
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/SignMessage.tsx
|
import { Button } from '@mui/material';
import { ed25519 } from '@noble/curves/ed25519';
import { useWallet } from '@solana/wallet-adapter-react';
import bs58 from 'bs58';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const SignMessage: FC = () => {
const { publicKey, signMessage } = useWallet();
const notify = useNotify();
const onClick = useCallback(async () => {
try {
if (!publicKey) throw new Error('Wallet not connected!');
if (!signMessage) throw new Error('Wallet does not support message signing!');
const message = new TextEncoder().encode(
`${
window.location.host
} wants you to sign in with your Solana account:\n${publicKey.toBase58()}\n\nPlease sign in.`
);
const signature = await signMessage(message);
if (!ed25519.verify(signature, message, publicKey.toBytes())) throw new Error('Message signature invalid!');
notify('success', `Message signature: ${bs58.encode(signature)}`);
} catch (error: any) {
notify('error', `Sign Message failed: ${error?.message}`);
}
}, [publicKey, signMessage, notify]);
return (
<Button variant="contained" color="secondary" onClick={onClick} disabled={!publicKey || !signMessage}>
Sign Message
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/RequestAirdrop.tsx
|
import { Button } from '@mui/material';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import type { TransactionSignature } from '@solana/web3.js';
import { LAMPORTS_PER_SOL } from '@solana/web3.js';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const RequestAirdrop: FC = () => {
const { connection } = useConnection();
const { publicKey } = useWallet();
const notify = useNotify();
const onClick = useCallback(async () => {
let signature: TransactionSignature | undefined = undefined;
try {
if (!publicKey) throw new Error('Wallet not connected!');
signature = await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL);
notify('info', 'Airdrop requested:', signature);
await connection.confirmTransaction(signature, 'processed');
notify('success', 'Airdrop successful!', signature);
} catch (error: any) {
notify('error', `Airdrop failed! ${error?.message}`, signature);
}
}, [publicKey, connection, notify]);
return (
<Button variant="contained" color="secondary" onClick={onClick} disabled={!publicKey}>
Request Airdrop
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/AutoConnectProvider.tsx
|
import { useLocalStorage } from '@solana/wallet-adapter-react';
import type { FC, ReactNode } from 'react';
import React, { createContext, useContext } from 'react';
export interface AutoConnectContextState {
autoConnect: boolean;
setAutoConnect(autoConnect: boolean): void;
}
export const AutoConnectContext = createContext<AutoConnectContextState>({} as AutoConnectContextState);
export function useAutoConnect(): AutoConnectContextState {
return useContext(AutoConnectContext);
}
export const AutoConnectProvider: FC<{ children: ReactNode }> = ({ children }) => {
const [autoConnect, setAutoConnect] = useLocalStorage('autoConnect', true);
return (
<AutoConnectContext.Provider value={{ autoConnect, setAutoConnect }}>{children}</AutoConnectContext.Provider>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/components/SignIn.tsx
|
import { Button } from '@mui/material';
import { useWallet } from '@solana/wallet-adapter-react';
import type { SolanaSignInInput } from '@solana/wallet-standard-features';
import { verifySignIn } from '@solana/wallet-standard-util';
import bs58 from 'bs58';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useNotify } from './notify';
export const SignIn: FC = () => {
const { signIn, publicKey } = useWallet();
const notify = useNotify();
const onClick = useCallback(async () => {
try {
if (!signIn) throw new Error('Wallet does not support Sign In With Solana!');
const input: SolanaSignInInput = {
domain: window.location.host,
address: publicKey ? publicKey.toBase58() : undefined,
statement: 'Please sign in.',
};
const output = await signIn(input);
if (!verifySignIn(input, output)) throw new Error('Sign In verification failed!');
notify('success', `Message signature: ${bs58.encode(output.signature)}`);
} catch (error: any) {
notify('error', `Sign In failed: ${error?.message}`);
}
}, [signIn, publicKey, notify]);
return (
<Button variant="contained" color="secondary" onClick={onClick} disabled={!signIn}>
Sign In
</Button>
);
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/pages/index.tsx
|
import { FormControlLabel, Switch, Table, TableBody, TableCell, TableHead, TableRow, Tooltip } from '@mui/material';
import type { NextPage } from 'next';
import dynamic from 'next/dynamic';
import React from 'react';
import pkg from '../../package.json';
import { useAutoConnect } from '../components/AutoConnectProvider';
const AntDesignWalletConnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-ant-design')).WalletConnectButton,
{ ssr: false }
);
const AntDesignWalletDisconnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-ant-design')).WalletDisconnectButton,
{ ssr: false }
);
const AntDesignWalletMultiButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-ant-design')).WalletMultiButton,
{ ssr: false }
);
const AntDesignWalletModalButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-ant-design')).WalletModalButton,
{ ssr: false }
);
const MaterialUIWalletConnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-material-ui')).WalletConnectButton,
{ ssr: false }
);
const MaterialUIWalletDisconnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-material-ui')).WalletDisconnectButton,
{ ssr: false }
);
const MaterialUIWalletDialogButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-material-ui')).WalletDialogButton,
{ ssr: false }
);
const MaterialUIWalletMultiButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-material-ui')).WalletMultiButton,
{ ssr: false }
);
const ReactUIWalletConnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-react-ui')).WalletConnectButton,
{ ssr: false }
);
const ReactUIWalletDisconnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-react-ui')).WalletDisconnectButton,
{ ssr: false }
);
const ReactUIWalletMultiButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-react-ui')).WalletMultiButton,
{ ssr: false }
);
const ReactUIWalletModalButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-react-ui')).WalletModalButton,
{ ssr: false }
);
const RequestAirdropDynamic = dynamic(async () => (await import('../components/RequestAirdrop')).RequestAirdrop, {
ssr: false,
});
const SendLegacyTransactionDynamic = dynamic(
async () => (await import('../components/SendLegacyTransaction')).SendLegacyTransaction,
{ ssr: false }
);
const SendTransactionDynamic = dynamic(async () => (await import('../components/SendTransaction')).SendTransaction, {
ssr: false,
});
const SendV0TransactionDynamic = dynamic(
async () => (await import('../components/SendV0Transaction')).SendV0Transaction,
{ ssr: false }
);
const SignInDynamic = dynamic(async () => (await import('../components/SignIn')).SignIn, { ssr: false });
const SignMessageDynamic = dynamic(async () => (await import('../components/SignMessage')).SignMessage, { ssr: false });
const SignTransactionDynamic = dynamic(async () => (await import('../components/SignTransaction')).SignTransaction, {
ssr: false,
});
const Index: NextPage = () => {
const { autoConnect, setAutoConnect } = useAutoConnect();
return (
<>
<Table>
<TableHead>
<TableRow>
<TableCell width={240}>Component</TableCell>
<TableCell width={240}>Material UI</TableCell>
<TableCell width={240}>Ant Design</TableCell>
<TableCell width={240}>React UI</TableCell>
<TableCell></TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Connect Button</TableCell>
<TableCell>
<MaterialUIWalletConnectButtonDynamic />
</TableCell>
<TableCell>
<AntDesignWalletConnectButtonDynamic />
</TableCell>
<TableCell>
<ReactUIWalletConnectButtonDynamic />
</TableCell>
<TableCell></TableCell>
</TableRow>
<TableRow>
<TableCell>Disconnect Button</TableCell>
<TableCell>
<MaterialUIWalletDisconnectButtonDynamic />
</TableCell>
<TableCell>
<AntDesignWalletDisconnectButtonDynamic />
</TableCell>
<TableCell>
<ReactUIWalletDisconnectButtonDynamic />
</TableCell>
<TableCell></TableCell>
</TableRow>
<TableRow>
<TableCell>Dialog/Modal Button</TableCell>
<TableCell>
<MaterialUIWalletDialogButtonDynamic />
</TableCell>
<TableCell>
<AntDesignWalletModalButtonDynamic />
</TableCell>
<TableCell>
<ReactUIWalletModalButtonDynamic />
</TableCell>
<TableCell></TableCell>
</TableRow>
<TableRow>
<TableCell>Multi Button</TableCell>
<TableCell>
<MaterialUIWalletMultiButtonDynamic />
</TableCell>
<TableCell>
<AntDesignWalletMultiButtonDynamic />
</TableCell>
<TableCell>
<ReactUIWalletMultiButtonDynamic />
</TableCell>
<TableCell></TableCell>
</TableRow>
</TableBody>
</Table>
<br />
<br />
<Table>
<TableHead>
<TableRow>
<TableCell width={240}>Example v{pkg.version}</TableCell>
<TableCell width={240}></TableCell>
<TableCell width={240}></TableCell>
<TableCell width={240}></TableCell>
<TableCell></TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>
<Tooltip title="Only runs if the wallet is ready to connect" placement="left">
<FormControlLabel
control={
<Switch
name="autoConnect"
color="secondary"
checked={autoConnect}
onChange={(event, checked) => setAutoConnect(checked)}
/>
}
label="AutoConnect"
/>
</Tooltip>
</TableCell>
<TableCell>
<RequestAirdropDynamic />
</TableCell>
<TableCell>
<SignTransactionDynamic />
</TableCell>
<TableCell>
<SignMessageDynamic />
</TableCell>
<TableCell>
<SignInDynamic />
</TableCell>
</TableRow>
<TableRow>
<TableCell></TableCell>
<TableCell>
<SendTransactionDynamic />
</TableCell>
<TableCell>
<SendLegacyTransactionDynamic />
</TableCell>
<TableCell>
<SendV0TransactionDynamic />
</TableCell>
<TableCell></TableCell>
</TableRow>
</TableBody>
</Table>
</>
);
};
export default Index;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/example/src/pages/_app.tsx
|
import type { AppProps } from 'next/app';
import Head from 'next/head';
import type { FC } from 'react';
import React from 'react';
import { ContextProvider } from '../components/ContextProvider';
// Use require instead of import since order matters
require('antd/dist/antd.dark.less');
require('@solana/wallet-adapter-ant-design/styles.css');
require('@solana/wallet-adapter-react-ui/styles.css');
require('../styles/globals.css');
const App: FC<AppProps> = ({ Component, pageProps }) => {
return (
<>
<Head>
<title>@solana/wallet-adapter Example</title>
</Head>
<ContextProvider>
<Component {...pageProps} />
</ContextProvider>
</>
);
};
export default App;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/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/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/.prettierignore
|
/.parcel-cache
/dist
/lib
/node_modules
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/.editorconfig
|
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/package.json
|
{
"name": "@solana/wallet-adapter-react-ui-starter",
"version": "0.9.33",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"src",
".editorconfig",
".env",
".gitignore",
".prettierignore",
".prettierrc",
"LICENSE",
"package.json",
"tsconfig.json"
],
"scripts": {
"build": "tsc --build --verbose && parcel build src/index.html",
"clean": "shx mkdir -p .parcel-cache dist lib && shx rm -rf .parcel-cache dist lib",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint",
"start": "parcel src/index.html"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^",
"@solana/wallet-adapter-react": "workspace:^",
"@solana/wallet-adapter-react-ui": "workspace:^",
"@solana/wallet-adapter-wallets": "workspace:^",
"@solana/web3.js": "^1.77.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.13",
"@types/react-dom": "^18.2.6",
"parcel": "^2.9.2",
"prettier": "^2.8.8",
"process": "^0.11.10",
"shx": "^0.3.4",
"typescript": "~4.7.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/.prettierrc
|
{
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib",
"noEmit": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/src/index.tsx
|
import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { App } from './App';
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
createRoot(document.getElementById('app')!).render(
<StrictMode>
<App />
</StrictMode>
);
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/src/App.tsx
|
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react';
import { WalletModalProvider, WalletMultiButton } from '@solana/wallet-adapter-react-ui';
import { UnsafeBurnerWalletAdapter } from '@solana/wallet-adapter-wallets';
import { clusterApiUrl } from '@solana/web3.js';
import type { FC, ReactNode } from 'react';
import React, { useMemo } from 'react';
export const App: FC = () => {
return (
<Context>
<Content />
</Context>
);
};
const Context: FC<{ children: ReactNode }> = ({ children }) => {
// The network can be set to 'devnet', 'testnet', or 'mainnet-beta'.
const network = WalletAdapterNetwork.Devnet;
// You can also provide a custom RPC endpoint.
const endpoint = useMemo(() => clusterApiUrl(network), [network]);
const wallets = useMemo(
() => [
/**
* Wallets that implement either of these standards will be available automatically.
*
* - Solana Mobile Stack Mobile Wallet Adapter Protocol
* (https://github.com/solana-mobile/mobile-wallet-adapter)
* - Solana Wallet Standard
* (https://github.com/solana-labs/wallet-standard)
*
* If you wish to support a wallet that supports neither of those standards,
* instantiate its legacy wallet adapter here. Common legacy adapters can be found
* in the npm package `@solana/wallet-adapter-wallets`.
*/
new UnsafeBurnerWalletAdapter(),
],
// eslint-disable-next-line react-hooks/exhaustive-deps
[network]
);
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>{children}</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
);
};
const Content: FC = () => {
return <WalletMultiButton />;
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/src/index.html
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WalletAdapter Starter</title>
<link rel="stylesheet" href="index.css" />
<!-- Default styles that can be overridden by your app -->
<link rel="stylesheet" href="npm:@solana/wallet-adapter-react-ui/styles.css" />
</head>
<body>
<div id="app"></div>
<script type="module" src="index.tsx"></script>
</body>
</html>
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/src/reset.css
|
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
margin: 0;
}
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
list-style: none;
}
/* Set core root defaults */
html:focus-within {
scroll-behavior: smooth;
}
/* Set core body defaults */
body {
min-height: 100vh;
text-rendering: optimizeSpeed;
line-height: 1.5;
}
/* A elements that don't have a class get default styles */
a:not([class]) {
text-decoration-skip-ink: auto;
}
/* Make images easier to work with */
img,
picture {
max-width: 100%;
display: block;
}
/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
font: inherit;
}
/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
html:focus-within {
scroll-behavior: auto;
}
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/react-ui-starter/src/index.css
|
@import './reset.css';
html, body {
background-color: #303030;
color: #FFFFFF;
}
#app {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/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/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/next.config.js
|
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
};
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/next-env.d.ts
|
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/.prettierignore
|
/.next
/.swc
/lib
/node_modules
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/.editorconfig
|
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/package.json
|
{
"name": "@solana/wallet-adapter-nextjs-starter",
"version": "0.8.32",
"author": "Solana Maintainers <maintainers@solana.foundation>",
"repository": "https://github.com/anza-xyz/wallet-adapter",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"files": [
"public",
"src",
".editorconfig",
".eslintrc.json",
".gitignore",
".prettierignore",
".prettierrc",
"LICENSE",
"next.config.js",
"next-env.d.ts",
"package.json",
"README.md",
"tsconfig.json"
],
"engines": {
"node": ">=18"
},
"scripts": {
"build": "tsc --build --verbose && next build",
"clean": "shx rm -rf .next .swc lib",
"dev": "NODE_OPTIONS='--inspect' next dev",
"start": "next start",
"lint": "prettier --check 'src/{*,**/*}.{ts,tsx,js,jsx,json}' && eslint && next lint"
},
"dependencies": {
"@solana/wallet-adapter-base": "workspace:^",
"@solana/wallet-adapter-react": "workspace:^",
"@solana/wallet-adapter-react-ui": "workspace:^",
"@solana/wallet-adapter-wallets": "workspace:^",
"next": "^12.3.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node-fetch": "^2.6.4",
"@types/react": "^18.2.13",
"@types/react-dom": "^18.2.6",
"eslint": "8.22.0",
"eslint-config-next": "^12.3.4",
"prettier": "^2.8.8",
"shx": "^0.3.4",
"typescript": "~4.7.4"
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/.prettierrc
|
{
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/tsconfig.json
|
{
"extends": "../../../tsconfig.root.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"outDir": "lib",
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"exclude": ["node_modules"]
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/.eslintrc.json
|
{
"extends": "next/core-web-vitals"
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/public/vercel.svg
|
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src/styles/globals.css
|
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src/styles/Home.module.css
|
.container {
padding: 0 2rem;
}
.main {
min-height: 100vh;
padding: 4rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.footer {
display: flex;
flex: 1;
padding: 2rem 0;
border-top: 1px solid #eaeaea;
justify-content: center;
align-items: center;
}
.footer a {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.title a {
color: #0070f3;
text-decoration: none;
}
.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}
.title {
margin: 0;
line-height: 1.15;
font-size: 4rem;
}
.title,
.description {
text-align: center;
}
.walletButtons {
margin-top: 1.5rem;
display: flex;
gap: 2rem;
}
.description {
margin: 4rem 0;
line-height: 1.5;
font-size: 1.5rem;
}
.code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}
.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 800px;
}
.card {
margin: 1rem;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;
max-width: 300px;
}
.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}
.card h2 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}
.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}
.logo {
height: 1em;
margin-left: 0.5rem;
}
@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src/pages/index.tsx
|
import type { NextPage } from 'next';
import dynamic from 'next/dynamic';
import Head from 'next/head';
import Image from 'next/image';
import React from 'react';
import styles from '../styles/Home.module.css';
const WalletDisconnectButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-react-ui')).WalletDisconnectButton,
{ ssr: false }
);
const WalletMultiButtonDynamic = dynamic(
async () => (await import('@solana/wallet-adapter-react-ui')).WalletMultiButton,
{ ssr: false }
);
const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
<div className={styles.walletButtons}>
<WalletMultiButtonDynamic />
<WalletDisconnectButtonDynamic />
</div>
<p className={styles.description}>
Get started by editing <code className={styles.code}>pages/index.tsx</code>
</p>
<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h2>Documentation →</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>
<a href="https://nextjs.org/learn" className={styles.card}>
<h2>Learn →</h2>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>
<a href="https://github.com/vercel/next.js/tree/master/examples" className={styles.card}>
<h2>Examples →</h2>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h2>Deploy →</h2>
<p>Instantly deploy your Next.js site to a public URL with Vercel.</p>
</a>
</div>
</main>
<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<span className={styles.logo}>
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</span>
</a>
</footer>
</div>
);
};
export default Home;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src/pages/_app.tsx
|
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react';
import { WalletModalProvider } from '@solana/wallet-adapter-react-ui';
import { UnsafeBurnerWalletAdapter } from '@solana/wallet-adapter-wallets';
import { clusterApiUrl } from '@solana/web3.js';
import type { AppProps } from 'next/app';
import type { FC } from 'react';
import React, { useMemo } from 'react';
// Use require instead of import since order matters
require('@solana/wallet-adapter-react-ui/styles.css');
require('../styles/globals.css');
const App: FC<AppProps> = ({ Component, pageProps }) => {
// Can be set to 'devnet', 'testnet', or 'mainnet-beta'
const network = WalletAdapterNetwork.Devnet;
// You can also provide a custom RPC endpoint
const endpoint = useMemo(() => clusterApiUrl(network), [network]);
const wallets = useMemo(
() => [
/**
* Wallets that implement either of these standards will be available automatically.
*
* - Solana Mobile Stack Mobile Wallet Adapter Protocol
* (https://github.com/solana-mobile/mobile-wallet-adapter)
* - Solana Wallet Standard
* (https://github.com/solana-labs/wallet-standard)
*
* If you wish to support a wallet that supports neither of those standards,
* instantiate its legacy wallet adapter here. Common legacy adapters can be found
* in the npm package `@solana/wallet-adapter-wallets`.
*/
new UnsafeBurnerWalletAdapter(),
],
// eslint-disable-next-line react-hooks/exhaustive-deps
[network]
);
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>
<Component {...pageProps} />
</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
);
};
export default App;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src/pages
|
solana_public_repos/anza-xyz/wallet-adapter/packages/starter/nextjs-starter/src/pages/api/hello.ts
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next';
type Data = {
name: string;
};
export default function handler(req: NextApiRequest, res: NextApiResponse<Data>) {
res.status(200).json({ name: 'John Doe' });
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/nufi/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/nufi/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/nufi/package.json
|
{
"name": "@solana/wallet-adapter-nufi",
"version": "0.1.17",
"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/nufi/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/nufi/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/nufi
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/nufi/src/adapter.ts
|
import type { EventEmitter, SendTransactionOptions, WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
isVersionedTransaction,
scopePollingDetectionStrategy,
WalletAccountError,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSendTransactionError,
WalletSignMessageError,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type {
Connection,
Transaction,
TransactionSignature,
TransactionVersion,
VersionedTransaction,
} from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface NufiWalletEvents {
connect(): void;
disconnect(): void;
}
interface NufiWallet extends EventEmitter<NufiWalletEvents> {
isNufi?: boolean;
publicKey?: { toBytes(): Uint8Array };
isConnected: boolean;
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
signAndSendTransaction<T extends Transaction | VersionedTransaction>(
transaction: T
): Promise<{ signature: TransactionSignature }>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
connect(): Promise<void>;
disconnect(): Promise<void>;
}
interface NufiWindow extends Window {
nufiSolana?: NufiWallet;
}
declare const window: NufiWindow;
export interface NufiWalletAdapterConfig {}
export const NufiWalletName = 'NuFi' as WalletName<'NuFi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E2LjY2MDggMTcuOTI5OSAxMy44NjQ4QzE3Ljk3OSAxMy43Mjc0IDE4LjEwNzQgMTMuNjMyNyAxOC4yNTMzIDEzLjYzMjdIMjEuMDU5NEMyMS4yNzI1IDEzLjYzMjcgMjEuNDMxNyAxMy44MjkxIDIxLjM3OTQgMTQuMDM1N0MyMC4yMTk1IDE4LjYyMTIgMTYuMDY2IDIyLjAxNDUgMTEuMTIgMjIuMDE0NUM2LjE3MzkxIDIyLjAxNDUgMi4wMjA0MiAxOC42MjEyIDAuODYwNDY4IDE0LjAzNTdDMC44MDgyMTMgMTMuODI5MSAwLjk2NzQzNCAxMy42MzI3IDEuMTgwNTIgMTMuNjMyN0gzLjk4NjU5WiIgZmlsbD0iI0M2RkYwMCIvPgo8cGF0aCBkPSJNOS4yNTQ5OSA5LjIzMjE4QzkuMDY5ODMgOS4yMzIxOCA4LjkxOTcyIDkuMzgyMjkgOC45MTk3MiA5LjU2NzQ2VjEzLjI5NzRDOC45MTk3MiAxMy40ODI1IDkuMDY5ODMgMTMuNjMyNyA5LjI1NDk5IDEzLjYzMjdIMTIuOTg0OUMxMy4xNzAxIDEzLjYzMjcgMTMuMzIwMiAxMy40ODI1IDEzLjMyMDIgMTMuMjk3NFY5LjU2NzQ2QzEzLjMyMDIgOS4zODIyOSAxMy4xNzAxIDkuMjMyMTggMTIuOTg0OSA5LjIzMjE4SDkuMjU0OTlaIiBmaWxsPSIjQzZGRjAwIi8+Cjwvc3ZnPgo=';
supportedTransactionVersions: ReadonlySet<TransactionVersion> = new Set(['legacy', 0]);
private _connecting = false;
private _wallet: NufiWallet | null = null;
private _publicKey: PublicKey | null = null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: NufiWalletAdapterConfig = {}) {
super();
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.nufiSolana?.isNufi) {
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.nufiSolana!;
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<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;
const { signature } = await wallet.signAndSendTransaction(transaction);
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 | VersionedTransaction>(transaction: T): Promise<T> {
try {
const wallet = this._wallet;
if (!wallet) throw new WalletNotConnectedError();
try {
return (await wallet.signTransaction(transaction)) || 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)) || 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/nufi
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/nufi/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/bitkeep/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/bitkeep/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/bitkeep/package.json
|
{
"name": "@solana/wallet-adapter-bitkeep",
"version": "0.3.20",
"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/bitkeep/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/bitkeep/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/bitkeep
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/bitkeep/src/adapter.ts
|
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseMessageSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletDisconnectionError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface BitgetWallet {
isBitKeep?: boolean;
connect(): Promise<void>;
disconnect(): Promise<void>;
getAccount(): Promise<string>;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
}
interface BitgetWindow extends Window {
bitkeep?: {
solana?: BitgetWallet;
};
}
declare const window: BitgetWindow;
export interface BitgetWalletAdapterConfig {}
export const BitgetWalletName = 'Bitget' as WalletName<'Bitget'>;
export class BitgetWalletAdapter extends BaseMessageSignerWalletAdapter {
name = BitgetWalletName;
url = 'https://web3.bitget.com';
icon =
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIHdpZHRoPSIyNTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxmaWx0ZXIgaWQ9ImEiIGNvbG9yLWludGVycG9sYXRpb24tZmlsdGVycz0ic1JHQiIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBoZWlnaHQ9IjQ1MS40MzEiIHd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jU3LTEzLjYxNy0xOTkuNjkwNCAyOC43NDgzLTM0LjE1NTcgNDcuOTYwMSAxNDEuODQ1NCAxMzUuODM1OSAxOTAuNjkxNCAxMjAuNzc2MSA0OC44NDctMTUuMDU5OS02Ni42MDktNDYuMjIxNzgtNDUuODI0LTc1LjQ1OTMgMjAuNzg1LTI5LjIzNzYgMTM3LjQxNSAyNC4yODIyNCA1NC44MjMtNzQuMDY1MXoiIGZpbGw9IiM0ZDk0ZmYiLz48L2c+PHBhdGggY2xpcC1ydWxlPSJldmVub2RkIiBkPSJtOTMuMTg5IDE1Mi44MzZoNDMuNDg1bC00OS40NjU0LTQ5Ljc4NSA1MC4xMDE0LTQ5Ljc4NDcgMTMuNjQ1LTEzLjI2NjNoLTQ1LjEzNmwtNTcuNDgzMSA1Ny43NzczYy0yLjkwMSAyLjkxMTctMi44ODYxIDcuNjI0Ny4wMjk3IDEwLjUyMTd6bTI2LjE0MS00OS42NjhoLS4zMzVsLjMzMS0uMDA0em0wIDAgNDkuNDYxIDQ5Ljc4MS01MC4xMDEgNDkuNzg1LTEzLjY0NSAxMy4yNjZoNDUuMTM1bDU3LjQ4NC01Ny43NzRjMi45MDEtMi45MTIgMi44ODYtNy42MjQtLjAzLTEwLjUyMWwtNDQuODIzLTQ0LjUzN3oiIGZpbGw9IiMwMDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: BitgetWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: BitgetWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.bitkeep?.solana?.isBitKeep) {
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.bitkeep!.solana!;
let account: string;
try {
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);
}
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 {
const { signature } = await wallet.signMessage(message);
return signature;
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);
}
} catch (error: any) {
this.emit('error', error);
throw error;
}
}
}
/**
* @deprecated Use 'BitgetWalletName' instead."
*/
export const BitKeepWalletName = BitgetWalletName;
/**
* @deprecated Use 'BitgetWalletAdapterConfig' instead."
*/
export type BitKeepWalletAdapterConfig = BitgetWalletAdapterConfig;
/**
* @deprecated Use 'BitgetWalletAdapter' instead."
*/
export const BitKeepWalletAdapter = BitgetWalletAdapter;
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/bitkeep
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/bitkeep/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/ledger/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/ledger/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/ledger/package.json
|
{
"name": "@solana/wallet-adapter-ledger",
"version": "0.9.25",
"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": {
"@ledgerhq/devices": "6.27.1",
"@ledgerhq/hw-transport": "6.27.1",
"@ledgerhq/hw-transport-webhid": "6.27.1",
"@solana/wallet-adapter-base": "workspace:^",
"buffer": "^6.0.3"
},
"devDependencies": {
"@solana/web3.js": "^1.77.3",
"@types/w3c-web-hid": "^1.0.3",
"shx": "^0.3.4"
},
"overrides": {
"@ledgerhq/devices": {
"buffer": "npm:buffer@^6.0.3"
},
"@ledgerhq/hw-transport": {
"buffer": "npm:buffer@^6.0.3"
},
"@ledgerhq/hw-transport-webhid": {
"buffer": "npm:buffer@^6.0.3"
}
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/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/ledger/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/ledger
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/src/adapter.ts
|
import type { default as Transport } from '@ledgerhq/hw-transport';
import type { default as TransportWebHID } from '@ledgerhq/hw-transport-webhid';
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseSignerWalletAdapter,
WalletConnectionError,
WalletDisconnectedError,
WalletDisconnectionError,
WalletLoadError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { PublicKey, Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
import './polyfills/index.js';
import { getDerivationPath, getPublicKey, signTransaction } from './util.js';
export interface LedgerWalletAdapterConfig {
derivationPath?: Buffer;
}
export const LedgerWalletName = 'Ledger' as WalletName<'Ledger'>;
export class LedgerWalletAdapter extends BaseSignerWalletAdapter {
name = LedgerWalletName;
url = 'https://ledger.com';
icon =
'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMzUgMzUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiI+PHBhdGggZD0ibTIzLjU4OCAwaC0xNnYyMS41ODNoMjEuNnYtMTZhNS41ODUgNS41ODUgMCAwIDAgLTUuNi01LjU4M3oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDUuNzM5KSIvPjxwYXRoIGQ9Im04LjM0MiAwaC0yLjc1N2E1LjU4NSA1LjU4NSAwIDAgMCAtNS41ODUgNS41ODV2Mi43NTdoOC4zNDJ6Ii8+PHBhdGggZD0ibTAgNy41OWg4LjM0MnY4LjM0MmgtOC4zNDJ6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDUuNzM5KSIvPjxwYXRoIGQ9Im0xNS4xOCAyMy40NTFoMi43NTdhNS41ODUgNS41ODUgMCAwIDAgNS41ODUtNS42di0yLjY3MWgtOC4zNDJ6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMS40NzggMTEuNDc4KSIvPjxwYXRoIGQ9Im03LjU5IDE1LjE4aDguMzQydjguMzQyaC04LjM0MnoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDUuNzM5IDExLjQ3OCkiLz48cGF0aCBkPSJtMCAxNS4xOHYyLjc1N2E1LjU4NSA1LjU4NSAwIDAgMCA1LjU4NSA1LjU4NWgyLjc1N3YtOC4zNDJ6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDExLjQ3OCkiLz48L2c+PC9zdmc+';
supportedTransactionVersions: ReadonlySet<TransactionVersion> = new Set(['legacy', 0]);
private _derivationPath: Buffer;
private _connecting: boolean;
private _transport: Transport | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' ||
typeof document === 'undefined' ||
typeof navigator === 'undefined' ||
!navigator.hid
? WalletReadyState.Unsupported
: WalletReadyState.Loadable;
constructor(config: LedgerWalletAdapterConfig = {}) {
super();
this._derivationPath = config.derivationPath || getDerivationPath(0, 0);
this._connecting = false;
this._transport = null;
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 TransportWebHIDClass: typeof TransportWebHID;
try {
TransportWebHIDClass = (await import('@ledgerhq/hw-transport-webhid')).default;
} catch (error: any) {
throw new WalletLoadError(error?.message, error);
}
let transport: Transport;
try {
transport = await TransportWebHIDClass.create();
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);
}
let publicKey: PublicKey;
try {
publicKey = await getPublicKey(transport, this._derivationPath);
} catch (error: any) {
throw new WalletPublicKeyError(error?.message, error);
}
transport.on('disconnect', this._disconnected);
this._transport = transport;
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 transport = this._transport;
if (transport) {
transport.off('disconnect', this._disconnected);
this._transport = null;
this._publicKey = null;
try {
await transport.close();
} 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 transport = this._transport;
const publicKey = this._publicKey;
if (!transport || !publicKey) throw new WalletNotConnectedError();
try {
const signature = await signTransaction(transport, transaction, this._derivationPath);
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 _disconnected = () => {
const transport = this._transport;
if (transport) {
transport.off('disconnect', this._disconnected);
this._transport = null;
this._publicKey = null;
this.emit('error', new WalletDisconnectedError());
this.emit('disconnect');
}
};
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/src/util.ts
|
import type { default as Transport } from '@ledgerhq/hw-transport';
import { StatusCodes, TransportStatusError } from '@ledgerhq/hw-transport';
import { isVersionedTransaction } from '@solana/wallet-adapter-base';
import type { Transaction, VersionedTransaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
import './polyfills/index.js';
export function getDerivationPath(account?: number, change?: number): Buffer {
const length = account !== undefined ? (change === undefined ? 3 : 4) : 2;
const derivationPath = Buffer.alloc(1 + length * 4);
let offset = derivationPath.writeUInt8(length, 0);
offset = derivationPath.writeUInt32BE(harden(44), offset); // Using BIP44
offset = derivationPath.writeUInt32BE(harden(501), offset); // Solana's BIP44 path
if (account !== undefined) {
offset = derivationPath.writeUInt32BE(harden(account), offset);
if (change !== undefined) {
derivationPath.writeUInt32BE(harden(change), offset);
}
}
return derivationPath;
}
const BIP32_HARDENED_BIT = (1 << 31) >>> 0;
function harden(n: number): number {
return (n | BIP32_HARDENED_BIT) >>> 0;
}
const INS_GET_PUBKEY = 0x05;
const INS_SIGN_MESSAGE = 0x06;
const P1_NON_CONFIRM = 0x00;
const P1_CONFIRM = 0x01;
const P2_EXTEND = 0x01;
const P2_MORE = 0x02;
const MAX_PAYLOAD = 255;
const LEDGER_CLA = 0xe0;
/** @internal */
export async function getPublicKey(transport: Transport, derivationPath: Buffer): Promise<PublicKey> {
const bytes = await send(transport, INS_GET_PUBKEY, P1_NON_CONFIRM, derivationPath);
return new PublicKey(bytes);
}
/** @internal */
export async function signTransaction(
transport: Transport,
transaction: Transaction | VersionedTransaction,
derivationPath: Buffer
): Promise<Buffer> {
const paths = Buffer.alloc(1);
paths.writeUInt8(1, 0);
const message = isVersionedTransaction(transaction)
? transaction.message.serialize()
: transaction.serializeMessage();
const data = Buffer.concat([paths, derivationPath, message]);
return await send(transport, INS_SIGN_MESSAGE, P1_CONFIRM, data);
}
async function send(transport: Transport, instruction: number, p1: number, data: Buffer): Promise<Buffer> {
let p2 = 0;
let offset = 0;
if (data.length > MAX_PAYLOAD) {
while (data.length - offset > MAX_PAYLOAD) {
const buffer = data.slice(offset, offset + MAX_PAYLOAD);
const response = await transport.send(LEDGER_CLA, instruction, p1, p2 | P2_MORE, buffer);
// @ts-ignore -- TransportStatusError is a constructor Function, not a Class
if (response.length !== 2) throw new TransportStatusError(StatusCodes.INCORRECT_DATA);
p2 |= P2_EXTEND;
offset += MAX_PAYLOAD;
}
}
const buffer = data.slice(offset);
const response = await transport.send(LEDGER_CLA, instruction, p1, p2, buffer);
return response.slice(0, response.length - 2);
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/src/index.ts
|
export * from './adapter.js';
export { getDerivationPath } from './util.js';
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/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/ledger/src
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/ledger/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/sky/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/sky/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/sky/package.json
|
{
"name": "@solana/wallet-adapter-sky",
"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/sky/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/sky/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/sky
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/sky/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 SkyWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface SkyWallet extends EventEmitter<SkyWalletEvents> {
isSkyWallet?: 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 SkyWalletWindow extends Window {
skySolana?: SkyWallet;
}
declare const window: SkyWalletWindow;
export interface SkyWalletAdapterConfig {}
export const SkyWalletName = 'SKY Wallet' as WalletName<'SKY Wallet'>;
export class SkyWalletAdapter extends BaseMessageSignerWalletAdapter {
name = SkyWalletName;
url = 'https://getsky.app';
icon =
'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDY2IDY2IiB3aWR0aD0iNjQiIGhlaWdodD0iNjQiPjxkZWZzPjxpbWFnZSAgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiBpZD0iaW1nMSIgaHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFFQUFBQUJBQ0FZQUFBQ3FhWEhlQUFBQUFYTlNSMElCMmNrc2Z3QUFFWGhKUkVGVWVKekZXd2x3RlZVVy9ZRUVRaEx5MTdCbGcwaEVrYzJFZ0d5akFoWUtLb2lvaUN3aUlpaWlvcWdnaTRBb0lBNmhCQUVabGtFREptSGZ3aFlNUzFCUjJVVUUwUUZucG5TbVpzWlNTNjJwS2JsenprdS84TkxwL2dSSndxODYxZjI3KzNmM3ZlOHU1OTczdnNkVGhaOTkrL1pGQXgwT0hEZ3c4cU9QUGxyd3lTZWZGSHo2NmFkSGdYOGRQbnhZamg0OVdvcGp4NDc5RXpnQ2JENSsvUGc4NEZFZ0M2aFZsZTlZcVorZE8zZDZkdTNhbGZEKysrL2ZzM2Z2M29VUS9PakJnd2QvZ09BWERoMDZKT0ZBaFJ3NWNrUXJReUQ0aFJNblRuei8yV2VmSFFMZUJPNEVBamgzdGNVcy95a29LUEJzMjdZdEZRcDR1YWlvNkFRRXZ3REJC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UROa2pIOW1xTDdmeXhyS0lQRzYzc05uTUZHcXRMS29TQzBIUXBGRGtGbGFOQlFrVTNZdjNCZVQrVzJSRHlsN3k4dkZOY3h3amNRVVZmYmZrdTYyTzEzRG52TUFSWUFod0F6a0VwUDNPMnhnU08vUVQ4QmVmM0FXOEREd0xwWE1kWWxlLzRmLzRNQmw2a1JRUjRBQUFBQUVsRlRrU3VRbUNDIi8+PC9kZWZzPjxzdHlsZT48L3N0eWxlPjx1c2UgIGhyZWY9IiNpbWcxIiB4PSIxIiB5PSIxIi8+PC9zdmc+';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: SkyWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: SkyWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.skySolana?.isSkyWallet) {
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.skySolana!;
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/sky
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/sky/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/hyperpay/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/hyperpay/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/hyperpay/package.json
|
{
"name": "@solana/wallet-adapter-hyperpay",
"version": "0.1.14",
"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/hyperpay/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/hyperpay/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/hyperpay
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/hyperpay/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 HyperPayWalletEvents {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
}
interface HyperPayWallet extends EventEmitter<HyperPayWalletEvents> {
isHyperPay?: 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 HyperPayWindow extends Window {
hyperPay?: {
solana?: HyperPayWallet;
};
}
declare const window: HyperPayWindow;
export interface HyperPayWalletAdapterConfig {}
export const HyperPayWalletName = 'HyperPay' as WalletName<'HyperPay'>;
export class HyperPayWalletAdapter extends BaseMessageSignerWalletAdapter {
name = HyperPayWalletName;
url = 'https://hyperpay.io';
icon =
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNTIwcHgiIGhlaWdodD0iNTIwcHgiIHZpZXdCb3g9IjAgMCA1MjAgNTIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPHRpdGxlPkh5cGVyUGF5PC90aXRsZT4KICAgIDxnIGlkPSLpobXpnaItMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0zMyIgZmlsbD0iIzFBNzJGRSIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgPHBhdGggZD0iTTI2MCwwIEM0MDMuNTIsMCA1MjAsMTE1Ljk0MTI1NSA1MjAsMjU5LjY1Mjg3IEM1MjAsNDAzLjM2NDQ4NiA0MDMuNTIsNTIwIDI2MCw1MjAgQzExNi40OCw1MjAgMCw0MDQuMDU4NzQ1IDAsMjYwLjM0NzEzIEMwLDExNi42MzU1MTQgMTE2LjQ4LDAgMjYwLDAgWiBNMTIzLjQ2Mzk4NSwxMjIuNjQ3NzM3IEwxMjMuNDEzMzMz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1MDUgNDQyLjM0NjY2NywyMDkuOTU1OTQxIEM0NDIuMzQ2NjY3LDEzMS42NTU1NDEgMzU3LjA2NjY2NywxMjMuMzQwNDU0IDMyNS4xNzMzMzMsMTIzLjM0MDQ1NCBDMjkzLjI4LDEyMy4zNDA0NTQgMTIzLjQxMzMzMywxMjIuNjQ3NTMgMTIzLjQxMzMzMywxMjIuNjQ3NTMgWiIgaWQ9IuW9oueKtue7k+WQiCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: HyperPayWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: HyperPayWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.hyperPay?.solana?.isHyperPay) {
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.hyperPay!.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/hyperpay
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/hyperpay/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/safepal/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/safepal/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/safepal/package.json
|
{
"name": "@solana/wallet-adapter-safepal",
"version": "0.5.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/safepal/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/safepal/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/safepal
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/safepal/src/adapter.ts
|
import type { WalletName } from '@solana/wallet-adapter-base';
import {
BaseSignerWalletAdapter,
scopePollingDetectionStrategy,
WalletAccountError,
WalletNotConnectedError,
WalletNotReadyError,
WalletPublicKeyError,
WalletReadyState,
WalletSignTransactionError,
} from '@solana/wallet-adapter-base';
import type { Transaction } from '@solana/web3.js';
import { PublicKey } from '@solana/web3.js';
interface SafePalWallet {
isSafePalWallet?: boolean;
getAccount(): Promise<string>;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
}
interface SafePalWalletWindow extends Window {
safepal?: SafePalWallet;
}
declare const window: SafePalWalletWindow;
export interface SafePalWalletAdapterConfig {}
export const SafePalWalletName = 'SafePal' as WalletName<'SafePal'>;
export class SafePalWalletAdapter extends BaseSignerWalletAdapter {
name = SafePalWalletName;
url = 'https://safepal.io';
icon =
'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIHdpZHRoPSIyNTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJtMjU2IDEyOGMwIDcwLjY5Mzg3My01Ny4zMDc5MzMgMTI4LTEyOCAxMjgtNzAuNjkyMDY2NyAwLTEyOC01Ny4zMDYxMjctMTI4LTEyOCAwLTcwLjY5MjA2NjcgNTcuMzA3OTMzMy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MTU1OCA2LjcxODY5NjMgMTMuOTgyOTQ0bC40MTE1NTY2LjQzOTIwOXYtMzQuNDg0MTczaC0yNi42Mzc4MjMydi02NS42NDY0OTh6bTUyLjU1MjYtLjQ5OTE2NjIgNDcuMjgxNzcyIDE0LjYzMzkxMDZ2NjUuNzU2NDE3OGgtMjcuNzU4MDM3djI4LjQ3NTc1MWwtLjI4NTQ4OS4zNTQyMDZjLTEuMzU1MjUgMS42MzQ0NTUtNy41NjM1NzUgOC42MjI2NTUtMTkuMjIwNDY1IDE0LjU5NDkxNnptMTkuNTIzNzM1IDI3LjA3NzUwMzN2MzMuODAyMDIyMWg4LjI1MDQ2N3YtMzEuMjU0NDY0eiIgZmlsbD0iI2ZmZiIvPjwvZz48L3N2Zz4=';
readonly supportedTransactionVersions = null;
private _connecting: boolean;
private _wallet: SafePalWallet | null;
private _publicKey: PublicKey | null;
private _readyState: WalletReadyState =
typeof window === 'undefined' || typeof document === 'undefined'
? WalletReadyState.Unsupported
: WalletReadyState.NotDetected;
constructor(config: SafePalWalletAdapterConfig = {}) {
super();
this._connecting = false;
this._wallet = null;
this._publicKey = null;
if (this._readyState !== WalletReadyState.Unsupported) {
scopePollingDetectionStrategy(() => {
if (window.safepal?.isSafePalWallet) {
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.safepal!;
let account: string;
try {
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);
}
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) {
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;
} 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;
}
}
}
| 0
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/safepal
|
solana_public_repos/anza-xyz/wallet-adapter/packages/wallets/safepal/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/torus/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/torus/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.