Skip to content

Commit 47e7fa1

Browse files
authored
Merge pull request #1276 from blocknative/release/2.11.1
Release 2.11.1
2 parents 3b83b74 + b3f1594 commit 47e7fa1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4618
-120
lines changed

.github/ISSUE_TEMPLATE/BUG.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ assignees:
66
- taylorjdawson
77
- aaronbarnardsound
88
- Adamj1232
9-
- mahmud-bn
109
body:
1110
- type: markdown
1211
attributes:

.github/ISSUE_TEMPLATE/FEATURE.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ labels: [feature]
55
assignees:
66
- taylorjdawson
77
- aaronbarnardsound
8+
- Adamj1232
89
body:
910
- type: markdown
1011
attributes:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ dist/
44
package-lock.json
55
.rpt2_cache
66
.vscode
7-
yarn-error.log
7+
yarn-error.log
8+
.env

examples/with-sveltekit/.eslintignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Ignore files for PNPM, NPM and YARN
11+
pnpm-lock.yaml
12+
package-lock.json
13+
yarn.lock

examples/with-sveltekit/.eslintrc.cjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
5+
plugins: ['svelte3', '@typescript-eslint'],
6+
ignorePatterns: ['*.cjs'],
7+
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
8+
settings: {
9+
'svelte3/typescript': () => require('typescript')
10+
},
11+
parserOptions: {
12+
sourceType: 'module',
13+
ecmaVersion: 2020
14+
},
15+
env: {
16+
browser: true,
17+
es2017: true,
18+
node: true
19+
}
20+
};

examples/with-sveltekit/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example

examples/with-sveltekit/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Ignore files for PNPM, NPM and YARN
11+
pnpm-lock.yaml
12+
package-lock.json
13+
yarn.lock

examples/with-sveltekit/.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"useTabs": false,
3+
"tabWidth": 2,
4+
"semi": false,
5+
"singleQuote": true,
6+
"trailingComma": "none",
7+
"printWidth": 100,
8+
"pluginSearchDirs": ["."],
9+
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
10+
}

examples/with-sveltekit/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# create-svelte
2+
3+
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
4+
5+
## Creating a project
6+
7+
If you're seeing this, you've probably already done this step. Congrats!
8+
9+
```bash
10+
# create a new project in the current directory
11+
npm create svelte@latest
12+
13+
# create a new project in my-app
14+
npm create svelte@latest my-app
15+
```
16+
17+
## Developing
18+
19+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
20+
21+
```bash
22+
npm run dev
23+
24+
# or start the server and open the app in a new browser tab
25+
npm run dev -- --open
26+
```
27+
28+
## Building
29+
30+
To create a production version of your app:
31+
32+
```bash
33+
npm run build
34+
```
35+
36+
You can preview the production build with `npm run preview`.
37+
38+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

examples/with-sveltekit/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "with-sveltekit",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"dev": "vite dev",
6+
"build": "vite build",
7+
"preview": "vite preview",
8+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
9+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
10+
"lint": "prettier --check . && eslint .",
11+
"format": "prettier --write ."
12+
},
13+
"devDependencies": {
14+
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
15+
"@sveltejs/adapter-auto": "next",
16+
"@sveltejs/kit": "next",
17+
"@types/cookie": "^0.5.1",
18+
"@typescript-eslint/eslint-plugin": "^5.27.0",
19+
"@typescript-eslint/parser": "^5.27.0",
20+
"eslint": "^8.16.0",
21+
"eslint-config-prettier": "^8.3.0",
22+
"eslint-plugin-svelte3": "^4.0.0",
23+
"prettier": "^2.6.2",
24+
"prettier-plugin-svelte": "^2.7.0",
25+
"svelte": "^3.46.0",
26+
"svelte-check": "^2.7.1",
27+
"svelte-preprocess": "^4.10.6",
28+
"tslib": "^2.3.1",
29+
"typescript": "^4.7.4",
30+
"vite": "^3.1.0"
31+
},
32+
"type": "module",
33+
"dependencies": {
34+
"@fontsource/fira-mono": "^4.5.0",
35+
"@web3-onboard/walletconnect": "^2.1.2",
36+
"buffer": "^6.0.3"
37+
}
38+
}

examples/with-sveltekit/src/app.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// See https://kit.svelte.dev/docs/types#app
2+
// for information about these interfaces
3+
// and what to do when importing types
4+
declare namespace App {
5+
// interface Locals {}
6+
// interface PageData {}
7+
// interface PageError {}
8+
// interface Platform {}
9+
}

examples/with-sveltekit/src/app.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6+
<meta name="viewport" content="width=device-width" />
7+
%sveltekit.head%
8+
</head>
9+
<body>
10+
<div>%sveltekit.body%</div>
11+
</body>
12+
</html>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import Onboard from '@web3-onboard/core'
2+
import type { OnboardAPI } from '@web3-onboard/core'
3+
import injectedWalletsModule from '@web3-onboard/injected-wallets'
4+
import walletConnectModule from '@web3-onboard/walletconnect'
5+
6+
const injected = injectedWalletsModule()
7+
const walletConnect = walletConnectModule()
8+
9+
const wallets = [injected, walletConnect]
10+
11+
const INFURA_ID = ''
12+
13+
const chains = [
14+
{
15+
id: 1,
16+
token: 'ETH',
17+
label: 'Ethereum Mainnet',
18+
rpcUrl: `https://mainnet.infura.io/v3/${INFURA_ID}`
19+
},
20+
{
21+
id: 137,
22+
token: 'MATIC',
23+
label: 'Matic Mainnet',
24+
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
25+
}
26+
]
27+
28+
const appMetadata = {
29+
name: 'Web3-Onboard Svelte Demo',
30+
icon: '<svg />',
31+
logo: '<svg />',
32+
description: 'Demo using Onboard',
33+
recommendedInjectedWallets: [
34+
{ name: 'Coinbase', url: 'https://wallet.coinbase.com/' },
35+
{ name: 'MetaMask', url: 'https://metamask.io' }
36+
]
37+
}
38+
let onboard
39+
40+
if (!onboard) {
41+
onboard = Onboard({
42+
wallets,
43+
chains,
44+
appMetadata
45+
})
46+
}
47+
48+
export default onboard as OnboardAPI
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<script lang="ts">
2+
import onboard from '$lib/web3-onboard'
3+
4+
// Subscribe to wallet updates
5+
const wallets$ = onboard.state.select('wallets')
6+
7+
// The first wallet in the array of connected wallets
8+
$: connectedAccount = $wallets$?.[0]?.accounts?.[0]
9+
10+
const connect = async () => {
11+
await onboard.connectWallet()
12+
}
13+
14+
const disconnect = () => {
15+
onboard.disconnectWallet({ label: $wallets$?.[0]?.label })
16+
}
17+
18+
const trunc = (address: string) =>
19+
address ? address.slice(0, 6) + '...' + address.slice(-6) : null
20+
</script>
21+
22+
<main class="main">
23+
<h1>Welcome to this demo of Web3-Onboard + SvelteKit!</h1>
24+
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
25+
{#if connectedAccount}
26+
<div class="wallet">
27+
<div>
28+
<div>0x518a...7c9017</div>
29+
<div>Connected Wallet: Metamask</div>
30+
</div>
31+
<button on:click={disconnect}>Disconnect</button>
32+
</div>
33+
{:else}
34+
<div>
35+
<button on:click={connect}>Connect</button>
36+
</div>
37+
{/if}
38+
</main>
39+
40+
<style>
41+
.main {
42+
display: flex;
43+
flex-flow: column;
44+
align-items: center;
45+
justify-items: center;
46+
text-align: center;
47+
height: 100vh;
48+
}
49+
</style>
1.53 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import adapter from '@sveltejs/adapter-auto';
2+
import preprocess from 'svelte-preprocess';
3+
4+
/** @type {import('@sveltejs/kit').Config} */
5+
const config = {
6+
// Consult https://github.com/sveltejs/svelte-preprocess
7+
// for more information about preprocessors
8+
preprocess: preprocess(),
9+
10+
kit: {
11+
adapter: adapter()
12+
}
13+
};
14+
15+
export default config;

examples/with-sveltekit/tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "./.svelte-kit/tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"resolveJsonModule": true,
9+
"skipLibCheck": true,
10+
"sourceMap": true,
11+
"strict": true
12+
}
13+
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
14+
//
15+
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
16+
// from the referenced tsconfig.json - TypeScript does not merge them in
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { sveltekit } from '@sveltejs/kit/vite'
2+
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
3+
import type { UserConfig } from 'vite'
4+
5+
const config: UserConfig = {
6+
plugins: [sveltekit()],
7+
optimizeDeps: {
8+
esbuildOptions: {
9+
// Node.js global to browser globalThis
10+
define: {
11+
global: 'globalThis'
12+
},
13+
// Enable esbuild polyfill plugins
14+
plugins: [
15+
NodeGlobalsPolyfillPlugin({
16+
buffer: true
17+
})
18+
]
19+
}
20+
}
21+
}
22+
23+
export default config

0 commit comments

Comments
 (0)