Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaaash committed Mar 9, 2022
1 parent 06ddb54 commit c66f4a7
Show file tree
Hide file tree
Showing 87 changed files with 477 additions and 422 deletions.
12 changes: 6 additions & 6 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solana/pay",
"version": "0.1.3",
"version": "0.2.0",
"author": "Solana Maintainers <[email protected]>",
"repository": "https://github.com/solana-labs/solana-pay",
"license": "Apache-2.0",
Expand All @@ -23,7 +23,7 @@
},
"scripts": {
"clean": "shx rm -rf lib/*",
"build": "yarn clean && tsc -p tsconfig.json && npx tsc-esm -p tsconfig.json && tsc -p tsconfig.cjs.json",
"build": "yarn clean && tsc -p tsconfig.json && tsc-esm -p tsconfig.json && tsc -p tsconfig.cjs.json",
"postbuild": "echo '{\"type\":\"commonjs\"}' | npx json > lib/cjs/package.json && echo '{\"type\":\"module\"} ' | npx json > lib/esm/package.json",
"example": "node --experimental-specifier-resolution=node --loader ts-node/esm example/index.ts",
"example:merchant": "node --experimental-specifier-resolution=node --loader ts-node/esm example/payment-flow-merchant/main.ts",
Expand All @@ -50,8 +50,8 @@
"@types/jest": "^27.4.0",
"@types/node": "^16.11.14",
"@types/prettier": "^2.4.2",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
Expand All @@ -60,10 +60,10 @@
"prettier": "^2.5.1",
"shx": "^0.3.3",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"ts-node": "^10.7.0",
"tsc-esm": "^1.0.4",
"tslib": "^2.3.1",
"typedoc": "^0.22.10",
"typedoc": "^0.22.13",
"typescript": "^4.5.4",
"typescript-esm": "^2.0.0"
}
Expand Down
136 changes: 75 additions & 61 deletions core/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -894,84 +894,84 @@
dependencies:
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@^5.9.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz#2809052b85911ced9c54a60dac10e515e9114497"
integrity sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==
dependencies:
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/type-utils" "5.13.0"
"@typescript-eslint/utils" "5.13.0"
"@typescript-eslint/eslint-plugin@^5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.14.0.tgz#5119b67152356231a0e24b998035288a9cd21335"
integrity sha512-ir0wYI4FfFUDfLcuwKzIH7sMVA+db7WYen47iRSaCGl+HMAZI9fpBwfDo45ZALD3A45ZGyHWDNLhbg8tZrMX4w==
dependencies:
"@typescript-eslint/scope-manager" "5.14.0"
"@typescript-eslint/type-utils" "5.14.0"
"@typescript-eslint/utils" "5.14.0"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
regexpp "^3.2.0"
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/parser@^5.9.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.13.0.tgz#0394ed8f2f849273c0bf4b811994d177112ced5c"
integrity sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==
"@typescript-eslint/parser@^5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.14.0.tgz#7c79f898aa3cff0ceee6f1d34eeed0f034fb9ef3"
integrity sha512-aHJN8/FuIy1Zvqk4U/gcO/fxeMKyoSv/rS46UXMXOJKVsLQ+iYPuXNbpbH7cBLcpSbmyyFbwrniLx5+kutu1pw==
dependencies:
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/typescript-estree" "5.13.0"
"@typescript-eslint/scope-manager" "5.14.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/typescript-estree" "5.14.0"
debug "^4.3.2"

"@typescript-eslint/scope-manager@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz#cf6aff61ca497cb19f0397eea8444a58f46156b6"
integrity sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==
"@typescript-eslint/scope-manager@5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.14.0.tgz#ea518962b42db8ed0a55152ea959c218cb53ca7b"
integrity sha512-LazdcMlGnv+xUc5R4qIlqH0OWARyl2kaP8pVCS39qSL3Pd1F7mI10DbdXeARcE62sVQE4fHNvEqMWsypWO+yEw==
dependencies:
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/visitor-keys" "5.13.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/visitor-keys" "5.14.0"

"@typescript-eslint/type-utils@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz#b0efd45c85b7bab1125c97b752cab3a86c7b615d"
integrity sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==
"@typescript-eslint/type-utils@5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.14.0.tgz#711f08105860b12988454e91df433567205a8f0b"
integrity sha512-d4PTJxsqaUpv8iERTDSQBKUCV7Q5yyXjqXUl3XF7Sd9ogNLuKLkxz82qxokqQ4jXdTPZudWpmNtr/JjbbvUixw==
dependencies:
"@typescript-eslint/utils" "5.13.0"
"@typescript-eslint/utils" "5.14.0"
debug "^4.3.2"
tsutils "^3.21.0"

"@typescript-eslint/types@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.13.0.tgz#da1de4ae905b1b9ff682cab0bed6b2e3be9c04e5"
integrity sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==
"@typescript-eslint/types@5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.14.0.tgz#96317cf116cea4befabc0defef371a1013f8ab11"
integrity sha512-BR6Y9eE9360LNnW3eEUqAg6HxS9Q35kSIs4rp4vNHRdfg0s+/PgHgskvu5DFTM7G5VKAVjuyaN476LCPrdA7Mw==

"@typescript-eslint/typescript-estree@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz#b37c07b748ff030a3e93d87c842714e020b78141"
integrity sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==
"@typescript-eslint/typescript-estree@5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.14.0.tgz#78b7f7385d5b6f2748aacea5c9b7f6ae62058314"
integrity sha512-QGnxvROrCVtLQ1724GLTHBTR0lZVu13izOp9njRvMkCBgWX26PKvmMP8k82nmXBRD3DQcFFq2oj3cKDwr0FaUA==
dependencies:
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/visitor-keys" "5.13.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/visitor-keys" "5.14.0"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/utils@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.13.0.tgz#2328feca700eb02837298339a2e49c46b41bd0af"
integrity sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==
"@typescript-eslint/utils@5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.14.0.tgz#6c8bc4f384298cbbb32b3629ba7415f9f80dc8c4"
integrity sha512-EHwlII5mvUA0UsKYnVzySb/5EE/t03duUTweVy8Zqt3UQXBrpEVY144OTceFKaOe4xQXZJrkptCf7PjEBeGK4w==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/typescript-estree" "5.13.0"
"@typescript-eslint/scope-manager" "5.14.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/typescript-estree" "5.14.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"

"@typescript-eslint/visitor-keys@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz#f45ff55bcce16403b221ac9240fbeeae4764f0fd"
integrity sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==
"@typescript-eslint/visitor-keys@5.14.0":
version "5.14.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.14.0.tgz#1927005b3434ccd0d3ae1b2ecf60e65943c36986"
integrity sha512-yL0XxfzR94UEkjBqyymMLgCBdojzEuy/eim7N9/RIcTNxpJudAcqsU8eRyfzBbcEzGoPWfdM3AGak3cN08WOIw==
dependencies:
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/types" "5.14.0"
eslint-visitor-keys "^3.0.0"

JSONStream@^1.3.5:
Expand Down Expand Up @@ -1280,6 +1280,13 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"

brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
dependencies:
balanced-match "^1.0.0"

braces@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
Expand Down Expand Up @@ -3285,7 +3292,7 @@ map-stream@~0.1.0:
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
integrity sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=

marked@^4.0.10:
marked@^4.0.12:
version "4.0.12"
resolved "https://registry.yarnpkg.com/marked/-/marked-4.0.12.tgz#2262a4e6fd1afd2f13557726238b69a48b982f7d"
integrity sha512-hgibXWrEDNBWgGiK18j/4lkS6ihTe9sxtV4Q1OQppb/0zzyPSzoFANBa5MfsG/zgsWklmNnhm0XACZOH/0HBiQ==
Expand Down Expand Up @@ -3342,6 +3349,13 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimatch@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b"
integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==
dependencies:
brace-expansion "^2.0.1"

minimist@^1.2.3, minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
Expand Down Expand Up @@ -3821,7 +3835,7 @@ shelljs@^0.8.5:
interpret "^1.0.0"
rechoir "^0.6.2"

shiki@^0.10.0:
shiki@^0.10.1:
version "0.10.1"
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.10.1.tgz#6f9a16205a823b56c072d0f1a0bcd0f2646bef14"
integrity sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==
Expand Down Expand Up @@ -4131,10 +4145,10 @@ ts-jest@^27.1.2:
semver "7.x"
yargs-parser "20.x"

ts-node@^10.4.0:
version "10.6.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.6.0.tgz#c3f4195d5173ce3affdc8f2fd2e9a7ac8de5376a"
integrity sha512-CJen6+dfOXolxudBQXnVjRVvYTmTWbyz7cn+xq2XTsvnaXbHqr4gXSCNbS2Jj8yTZMuGwUoBESLaOkLascVVvg==
ts-node@^10.7.0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5"
integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==
dependencies:
"@cspotcode/source-map-support" "0.7.0"
"@tsconfig/node10" "^1.0.7"
Expand Down Expand Up @@ -4216,16 +4230,16 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

typedoc@^0.22.10:
version "0.22.12"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.12.tgz#52a8bb0e77458dcbab35fb89e24b80160ba6558d"
integrity sha512-FcyC+YuaOpr3rB9QwA1IHOi9KnU2m50sPJW5vcNRPCIdecp+3bFkh7Rq5hBU1Fyn29UR2h4h/H7twZHWDhL0sw==
typedoc@^0.22.13:
version "0.22.13"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.13.tgz#d061f8f0fb7c9d686e48814f245bddeea4564e66"
integrity sha512-NHNI7Dr6JHa/I3+c62gdRNXBIyX7P33O9TafGLd07ur3MqzcKgwTvpg18EtvCLHJyfeSthAtCLpM7WkStUmDuQ==
dependencies:
glob "^7.2.0"
lunr "^2.3.9"
marked "^4.0.10"
minimatch "^3.0.4"
shiki "^0.10.0"
marked "^4.0.12"
minimatch "^5.0.1"
shiki "^0.10.1"

typescript-esm@^2.0.0:
version "2.0.0"
Expand Down
1 change: 1 addition & 0 deletions point-of-sale/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.next
6 changes: 5 additions & 1 deletion point-of-sale/keypair.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
[122,237,93,254,70,126,181,48,51,167,169,110,126,207,75,253,10,163,171,76,87,166,237,52,224,179,153,16,38,4,182,232,3,248,133,68,7,238,87,159,104,254,57,166,177,183,249,81,164,169,103,167,177,202,225,41,155,230,87,31,207,184,115,214]
[
122, 237, 93, 254, 70, 126, 181, 48, 51, 167, 169, 110, 126, 207, 75, 253, 10, 163, 171, 76, 87, 166, 237, 52, 224,
179, 153, 16, 38, 4, 182, 232, 3, 248, 133, 68, 7, 238, 87, 159, 104, 254, 57, 166, 177, 183, 249, 81, 164, 169,
103, 167, 177, 202, 225, 41, 155, 230, 87, 31, 207, 184, 115, 214
]
9 changes: 4 additions & 5 deletions point-of-sale/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @type {import('next').NextConfig} */

const nextConfig = {
reactStrictMode: true,
async redirects() {
Expand All @@ -17,10 +16,10 @@ const nextConfig = {
type: 'query',
key: 'label',
},
]
}
]
}
],
},
];
},
};

module.exports = nextConfig;
2 changes: 1 addition & 1 deletion point-of-sale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@solana/wallet-adapter-torus": "^0.11.11",
"@solana/web3.js": "^1.36.0",
"bignumber.js": "^9.0.2",
"bs58": "^4.0.1",
"bs58": "^5.0.0",
"cache-manager": "^3.6.0",
"clsx": "^1.1.1",
"color-interpolate": "^1.0.5",
Expand Down
34 changes: 17 additions & 17 deletions point-of-sale/postcss.config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"plugins": [
"postcss-flexbugs-fixes",
"postcss-nesting",
[
"postcss-preset-env",
{
"autoprefixer": {
"flexbox": "no-2009"
},
"stage": 3,
"features": {
"custom-properties": false,
"nesting-rules": true
}
}
"plugins": [
"postcss-flexbugs-fixes",
"postcss-nesting",
[
"postcss-preset-env",
{
"autoprefixer": {
"flexbox": "no-2009"
},
"stage": 3,
"features": {
"custom-properties": false,
"nesting-rules": true
}
}
]
]
]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';
import React, { FC } from 'react';
import { useMediaQuery } from 'react-responsive';
import Link from 'next/link';
import { useLinkWithQuery } from '../../hooks/useLinkWithQuery';
import { ActivityIcon } from '../images/ActivityIcon';
import css from './TransactionsLink.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Confirmations, Digits } from '../../types';

export interface ConfigProviderProps {
children: ReactNode;
baseUrl: string;
baseURL: string;
link?: URL;
recipient: PublicKey;
label: string;
Expand All @@ -20,7 +20,7 @@ export interface ConfigProviderProps {

export const ConfigProvider: FC<ConfigProviderProps> = ({
children,
baseUrl,
baseURL,
link,
recipient,
label,
Expand All @@ -35,7 +35,7 @@ export const ConfigProvider: FC<ConfigProviderProps> = ({
return (
<ConfigContext.Provider
value={{
baseUrl,
baseURL,
link,
recipient,
label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ export const PaymentProvider: FC<PaymentProviderProps> = ({ children }) => {
setSignature(undefined);
setStatus(PaymentStatus.New);
setConfirmations(0);
navigate('/new', { replace: true });
navigate('/new', true);
}, [navigate]);

const generate = useCallback(() => {
if (status === PaymentStatus.New && !reference) {
setReference(Keypair.generate().publicKey);
setStatus(PaymentStatus.Pending);
navigate('/pending', { replace: false });
navigate('/pending');
}
}, [status, reference, navigate]);

Expand Down Expand Up @@ -149,7 +149,7 @@ export const PaymentProvider: FC<PaymentProviderProps> = ({ children }) => {
clearInterval(interval);
setSignature(signature.signature);
setStatus(PaymentStatus.Confirmed);
navigate('/confirmed', { replace: true });
navigate('/confirmed', true);
}
} catch (error: any) {
// If the RPC node doesn't have the transaction signature yet, try again
Expand Down
Loading

0 comments on commit c66f4a7

Please sign in to comment.