@lightsparkdev/lightspark-sdk 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/package.json +7 -2
  4. package/.fossa.yml +0 -6
  5. package/.prettierrc +0 -1
  6. package/.turbo/turbo-build.log +0 -19
  7. package/.turbo/turbo-lint.log +0 -3
  8. package/dist/Withdrawal-17e1c8af.d.ts +0 -1672
  9. package/dist/chunk-AGEUDR2V.js +0 -4498
  10. package/dist/chunk-N27QHRE4.js +0 -5508
  11. package/dist/client-3bba3f64.d.ts +0 -1302
  12. package/examples/node-scripts/authHelpers.ts +0 -20
  13. package/examples/node-scripts/createInvoice.ts +0 -64
  14. package/examples/node-scripts/example.ts +0 -288
  15. package/examples/node-scripts/getAccountDashboard.ts +0 -24
  16. package/examples/node-scripts/getNodeChannels.ts +0 -34
  17. package/examples/node-scripts/internalAuthHelpers.ts +0 -26
  18. package/examples/node-scripts/internal_example.ts +0 -296
  19. package/examples/node-scripts/package-lock.json +0 -887
  20. package/examples/node-scripts/package.json +0 -22
  21. package/examples/node-scripts/prettyPrintJsonForDocs.ts +0 -62
  22. package/examples/node-scripts/tsconfig.json +0 -27
  23. package/examples/oauth-example/README.md +0 -19
  24. package/examples/oauth-example/package-lock.json +0 -16071
  25. package/examples/oauth-example/package.json +0 -50
  26. package/examples/oauth-example/public/favicon.ico +0 -0
  27. package/examples/oauth-example/public/index.html +0 -43
  28. package/examples/oauth-example/public/logo192.png +0 -0
  29. package/examples/oauth-example/public/logo512.png +0 -0
  30. package/examples/oauth-example/public/manifest.json +0 -25
  31. package/examples/oauth-example/public/robots.txt +0 -3
  32. package/examples/oauth-example/src/App.css +0 -7
  33. package/examples/oauth-example/src/App.test.tsx +0 -12
  34. package/examples/oauth-example/src/App.tsx +0 -16
  35. package/examples/oauth-example/src/auth/AuthContext.ts +0 -8
  36. package/examples/oauth-example/src/auth/AuthProvider.tsx +0 -44
  37. package/examples/oauth-example/src/auth/RequireAuth.tsx +0 -19
  38. package/examples/oauth-example/src/auth/oauthProvider.ts +0 -35
  39. package/examples/oauth-example/src/components/Button.tsx +0 -39
  40. package/examples/oauth-example/src/components/CurrencyAmount.tsx +0 -117
  41. package/examples/oauth-example/src/components/Dashboard.tsx +0 -158
  42. package/examples/oauth-example/src/components/Table.tsx +0 -22
  43. package/examples/oauth-example/src/hooks/useAccountInfo.tsx +0 -31
  44. package/examples/oauth-example/src/icons/BitcoinB.tsx +0 -20
  45. package/examples/oauth-example/src/icons/Icon.tsx +0 -121
  46. package/examples/oauth-example/src/icons/Satoshi.tsx +0 -28
  47. package/examples/oauth-example/src/index.css +0 -13
  48. package/examples/oauth-example/src/index.tsx +0 -23
  49. package/examples/oauth-example/src/lightsparkclient/LightsparkClientContext.ts +0 -10
  50. package/examples/oauth-example/src/lightsparkclient/LightsparkClientProvider.tsx +0 -53
  51. package/examples/oauth-example/src/logo.svg +0 -1
  52. package/examples/oauth-example/src/pages/DashboardPage.tsx +0 -71
  53. package/examples/oauth-example/src/pages/LoginPage.tsx +0 -63
  54. package/examples/oauth-example/src/react-app-env.d.ts +0 -1
  55. package/examples/oauth-example/src/reportWebVitals.ts +0 -15
  56. package/examples/oauth-example/src/routes/index.tsx +0 -15
  57. package/examples/oauth-example/src/setupTests.ts +0 -5
  58. package/examples/oauth-example/src/utils/currency.ts +0 -483
  59. package/examples/oauth-example/tsconfig.json +0 -20
  60. package/examples/streaming-wallet-extension/.fossa.yml +0 -6
  61. package/examples/streaming-wallet-extension/README.md +0 -17
  62. package/examples/streaming-wallet-extension/craco.config.js +0 -58
  63. package/examples/streaming-wallet-extension/package-lock.json +0 -18260
  64. package/examples/streaming-wallet-extension/package.json +0 -77
  65. package/examples/streaming-wallet-extension/public/index.html +0 -24
  66. package/examples/streaming-wallet-extension/public/lightspark_full.png +0 -0
  67. package/examples/streaming-wallet-extension/public/lightspark_icon_circle.png +0 -0
  68. package/examples/streaming-wallet-extension/public/manifest.json +0 -43
  69. package/examples/streaming-wallet-extension/public/robots.txt +0 -3
  70. package/examples/streaming-wallet-extension/src/App.css +0 -53
  71. package/examples/streaming-wallet-extension/src/App.tsx +0 -425
  72. package/examples/streaming-wallet-extension/src/auth/AccountStorage.ts +0 -28
  73. package/examples/streaming-wallet-extension/src/auth/DemoAccountProvider.ts +0 -99
  74. package/examples/streaming-wallet-extension/src/auth/StreamingDemoCredentials.ts +0 -10
  75. package/examples/streaming-wallet-extension/src/background/PaymentStrategy.ts +0 -36
  76. package/examples/streaming-wallet-extension/src/background/PlaybackRange.ts +0 -31
  77. package/examples/streaming-wallet-extension/src/background/StreamingInvoiceHolder.ts +0 -33
  78. package/examples/streaming-wallet-extension/src/background/TransactionObserver.ts +0 -66
  79. package/examples/streaming-wallet-extension/src/background/VideoPlaybackRanges.ts +0 -38
  80. package/examples/streaming-wallet-extension/src/background/VideoProgressCache.ts +0 -87
  81. package/examples/streaming-wallet-extension/src/background/background.ts +0 -145
  82. package/examples/streaming-wallet-extension/src/background/messageHandling.ts +0 -185
  83. package/examples/streaming-wallet-extension/src/common/datetimes.ts +0 -28
  84. package/examples/streaming-wallet-extension/src/common/settings.ts +0 -12
  85. package/examples/streaming-wallet-extension/src/common/storage.ts +0 -8
  86. package/examples/streaming-wallet-extension/src/common/streamingTabs.ts +0 -27
  87. package/examples/streaming-wallet-extension/src/common/types.tsx +0 -23
  88. package/examples/streaming-wallet-extension/src/components/CirclePlusIcon.tsx +0 -19
  89. package/examples/streaming-wallet-extension/src/components/CurrencyAmount.tsx +0 -110
  90. package/examples/streaming-wallet-extension/src/components/CurrencyAmountRaw.tsx +0 -195
  91. package/examples/streaming-wallet-extension/src/components/LeftArrow.tsx +0 -21
  92. package/examples/streaming-wallet-extension/src/components/Loading.tsx +0 -151
  93. package/examples/streaming-wallet-extension/src/components/StreamingTransactionChip.tsx +0 -95
  94. package/examples/streaming-wallet-extension/src/components/TransactionRow.tsx +0 -93
  95. package/examples/streaming-wallet-extension/src/contentscript/content.ts +0 -123
  96. package/examples/streaming-wallet-extension/src/contentscript/lightsparkDemoDom.tsx +0 -113
  97. package/examples/streaming-wallet-extension/src/contentscript/videoElementParsers.ts +0 -92
  98. package/examples/streaming-wallet-extension/src/index.css +0 -16
  99. package/examples/streaming-wallet-extension/src/index.tsx +0 -11
  100. package/examples/streaming-wallet-extension/src/lightsparkClientProvider.tsx +0 -26
  101. package/examples/streaming-wallet-extension/src/react-app-env.d.ts +0 -1
  102. package/examples/streaming-wallet-extension/src/types/Messages.ts +0 -17
  103. package/examples/streaming-wallet-extension/tsconfig.json +0 -20
  104. package/tsconfig.json +0 -5
@@ -1,22 +0,0 @@
1
- {
2
- "name": "@lightsparkdev/node-scripts",
3
- "version": "1.0.0",
4
- "description": "Example node scripts for the lightspark js sdk",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "type": "module",
10
- "author": "",
11
- "license": "ISC",
12
- "devDependencies": {
13
- "ts-node": "^10.9.1",
14
- "typescript": "^4.9.5"
15
- },
16
- "dependencies": {
17
- "@lightsparkdev/core": "file:../../../core",
18
- "@lightsparkdev/lightspark-sdk": "file:../..",
19
- "commander": "^10.0.0",
20
- "dayjs": "^1.11.7"
21
- }
22
- }
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ts-node
2
- // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
-
4
- import {
5
- AccountTokenAuthProvider,
6
- BitcoinNetwork,
7
- LightsparkClient,
8
- } from "@lightsparkdev/lightspark-sdk";
9
-
10
- import { getCredentialsFromEnvOrThrow } from "./authHelpers.js";
11
-
12
- const credentials = getCredentialsFromEnvOrThrow();
13
- const client = new LightsparkClient(
14
- new AccountTokenAuthProvider(
15
- credentials.apiTokenClientId,
16
- credentials.apiTokenClientSecret
17
- ),
18
- "api.dev.dev.sparkinfra.net"
19
- );
20
-
21
- const makeRequest = async () => {
22
- // Replace this function's contents with whatever type you want to fetch.
23
- return await client
24
- .getCurrentAccount()
25
- .then((account) => account.getChannels(client, BitcoinNetwork.REGTEST));
26
- };
27
-
28
- const oneLineAmounts = (initialJson: string) => {
29
- const regex = RegExp(
30
- /\{\n\s+"value": (\d+),\n\s+"unit": "(\w+)"\n\s*\}(,?)/g
31
- );
32
- return initialJson.replace(regex, (match, p1, p2, p3) => {
33
- return `{ "value": ${p1}, "unit": "${p2}" }${p3}`;
34
- });
35
- };
36
-
37
- const shortenStrings = (initialJson: string) => {
38
- const regex = RegExp(/"([\w\+\/\=]{35,})"/g);
39
- return initialJson.replace(regex, (match, p1) => {
40
- return `"${p1.substring(0, 7)}...${p1.substring(p1.length - 7)}"`;
41
- });
42
- };
43
-
44
- const camelCaseKeys = (initialJson: string) => {
45
- const regex = RegExp(/"(\w+)":/g);
46
- return initialJson.replace(regex, (match, p1) => {
47
- return match.replace(
48
- p1,
49
- p1.replace(/([A-Z])/g, (g) => `_${g[0].toLowerCase()}`)
50
- );
51
- });
52
- };
53
-
54
- // TODO(Jeremy): It would be good to also fix the fact that JS generates nested entities like
55
- // `"desitnation_id": "blah"` instead of `"destination": { "id": "blah"}`.
56
- makeRequest().then((result) => {
57
- console.log(
58
- camelCaseKeys(
59
- shortenStrings(oneLineAmounts(JSON.stringify(result, null, 2)))
60
- )
61
- );
62
- });
@@ -1,27 +0,0 @@
1
- {
2
- // Most ts-node options can be specified here using their programmatic names.
3
- "ts-node": {
4
- // It is faster to skip typechecking.
5
- // Remove if you want ts-node to do typechecking.
6
- "transpileOnly": true,
7
-
8
- "files": true,
9
- "experimentalResolver": true,
10
- "esm": true,
11
-
12
- "compilerOptions": {
13
- "lib": ["ESNext"],
14
- "module": "Node16",
15
- "target": "ESNext",
16
-
17
- "strict": false,
18
- "esModuleInterop": true,
19
- "skipLibCheck": true,
20
- "forceConsistentCasingInFileNames": true,
21
- "moduleResolution": "node16"
22
- }
23
- },
24
- "compilerOptions": {
25
- // typescript options here
26
- }
27
- }
@@ -1,19 +0,0 @@
1
- # Lightspark React OAuth Example
2
-
3
- This example demonstrates how to use the OAuth to authenticate via the Lightspark JS SDK. See the `src/auth` directory for the most relevant code. The LoginPage uses the `useAuth` hook to handle the OAuth flow and redirects to the DashboardPage when the user is authenticated.
4
-
5
- ## Available Scripts
6
-
7
- In the project directory, you can run:
8
-
9
- ### `npm start`
10
-
11
- Runs the app in the development mode.
12
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
-
14
- The page will reload if you make edits.
15
- You will also see any lint errors in the console.
16
-
17
- ### `npm run pull-sdk`
18
-
19
- Updates the Lightspark JS SDK used by the example to the latest version built locally from your current repo.