@lightsparkdev/lightspark-sdk 0.1.6 → 0.2.0

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 (123) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -1
  3. package/dist/{Withdrawal-17e1c8af.d.ts → Withdrawal-ebb4865c.d.ts} +393 -377
  4. package/dist/{chunk-N27QHRE4.js → chunk-XFOVS6EY.js} +56 -40
  5. package/dist/index.cjs +25 -9
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/objects/index.cjs +24 -8
  9. package/dist/objects/index.d.ts +1 -1
  10. package/dist/objects/index.js +1 -1
  11. package/package.json +7 -2
  12. package/src/client.ts +0 -1
  13. package/src/objects/Account.ts +2 -2
  14. package/src/objects/Entity.ts +10 -2
  15. package/src/objects/Invoice.ts +1 -1
  16. package/src/objects/InvoiceData.ts +10 -1
  17. package/src/objects/LightningTransaction.ts +1 -1
  18. package/src/objects/LightsparkNodeStatus.ts +2 -0
  19. package/src/objects/OutgoingPayment.ts +1 -1
  20. package/src/objects/PaymentRequest.ts +1 -1
  21. package/src/objects/PaymentRequestData.ts +1 -1
  22. package/src/objects/Transaction.ts +1 -1
  23. package/src/objects/WebhookEventType.ts +10 -0
  24. package/src/objects/WithdrawalRequest.ts +12 -0
  25. package/.fossa.yml +0 -6
  26. package/.prettierrc +0 -1
  27. package/.turbo/turbo-build.log +0 -19
  28. package/.turbo/turbo-lint.log +0 -3
  29. package/dist/chunk-AGEUDR2V.js +0 -4498
  30. package/dist/client-3bba3f64.d.ts +0 -1302
  31. package/examples/node-scripts/authHelpers.ts +0 -20
  32. package/examples/node-scripts/createInvoice.ts +0 -64
  33. package/examples/node-scripts/example.ts +0 -288
  34. package/examples/node-scripts/getAccountDashboard.ts +0 -24
  35. package/examples/node-scripts/getNodeChannels.ts +0 -34
  36. package/examples/node-scripts/internalAuthHelpers.ts +0 -26
  37. package/examples/node-scripts/internal_example.ts +0 -296
  38. package/examples/node-scripts/package-lock.json +0 -887
  39. package/examples/node-scripts/package.json +0 -22
  40. package/examples/node-scripts/prettyPrintJsonForDocs.ts +0 -62
  41. package/examples/node-scripts/tsconfig.json +0 -27
  42. package/examples/oauth-example/README.md +0 -19
  43. package/examples/oauth-example/package-lock.json +0 -16071
  44. package/examples/oauth-example/package.json +0 -50
  45. package/examples/oauth-example/public/favicon.ico +0 -0
  46. package/examples/oauth-example/public/index.html +0 -43
  47. package/examples/oauth-example/public/logo192.png +0 -0
  48. package/examples/oauth-example/public/logo512.png +0 -0
  49. package/examples/oauth-example/public/manifest.json +0 -25
  50. package/examples/oauth-example/public/robots.txt +0 -3
  51. package/examples/oauth-example/src/App.css +0 -7
  52. package/examples/oauth-example/src/App.test.tsx +0 -12
  53. package/examples/oauth-example/src/App.tsx +0 -16
  54. package/examples/oauth-example/src/auth/AuthContext.ts +0 -8
  55. package/examples/oauth-example/src/auth/AuthProvider.tsx +0 -44
  56. package/examples/oauth-example/src/auth/RequireAuth.tsx +0 -19
  57. package/examples/oauth-example/src/auth/oauthProvider.ts +0 -35
  58. package/examples/oauth-example/src/components/Button.tsx +0 -39
  59. package/examples/oauth-example/src/components/CurrencyAmount.tsx +0 -117
  60. package/examples/oauth-example/src/components/Dashboard.tsx +0 -158
  61. package/examples/oauth-example/src/components/Table.tsx +0 -22
  62. package/examples/oauth-example/src/hooks/useAccountInfo.tsx +0 -31
  63. package/examples/oauth-example/src/icons/BitcoinB.tsx +0 -20
  64. package/examples/oauth-example/src/icons/Icon.tsx +0 -121
  65. package/examples/oauth-example/src/icons/Satoshi.tsx +0 -28
  66. package/examples/oauth-example/src/index.css +0 -13
  67. package/examples/oauth-example/src/index.tsx +0 -23
  68. package/examples/oauth-example/src/lightsparkclient/LightsparkClientContext.ts +0 -10
  69. package/examples/oauth-example/src/lightsparkclient/LightsparkClientProvider.tsx +0 -53
  70. package/examples/oauth-example/src/logo.svg +0 -1
  71. package/examples/oauth-example/src/pages/DashboardPage.tsx +0 -71
  72. package/examples/oauth-example/src/pages/LoginPage.tsx +0 -63
  73. package/examples/oauth-example/src/react-app-env.d.ts +0 -1
  74. package/examples/oauth-example/src/reportWebVitals.ts +0 -15
  75. package/examples/oauth-example/src/routes/index.tsx +0 -15
  76. package/examples/oauth-example/src/setupTests.ts +0 -5
  77. package/examples/oauth-example/src/utils/currency.ts +0 -483
  78. package/examples/oauth-example/tsconfig.json +0 -20
  79. package/examples/streaming-wallet-extension/.fossa.yml +0 -6
  80. package/examples/streaming-wallet-extension/README.md +0 -17
  81. package/examples/streaming-wallet-extension/craco.config.js +0 -58
  82. package/examples/streaming-wallet-extension/package-lock.json +0 -18260
  83. package/examples/streaming-wallet-extension/package.json +0 -77
  84. package/examples/streaming-wallet-extension/public/index.html +0 -24
  85. package/examples/streaming-wallet-extension/public/lightspark_full.png +0 -0
  86. package/examples/streaming-wallet-extension/public/lightspark_icon_circle.png +0 -0
  87. package/examples/streaming-wallet-extension/public/manifest.json +0 -43
  88. package/examples/streaming-wallet-extension/public/robots.txt +0 -3
  89. package/examples/streaming-wallet-extension/src/App.css +0 -53
  90. package/examples/streaming-wallet-extension/src/App.tsx +0 -425
  91. package/examples/streaming-wallet-extension/src/auth/AccountStorage.ts +0 -28
  92. package/examples/streaming-wallet-extension/src/auth/DemoAccountProvider.ts +0 -99
  93. package/examples/streaming-wallet-extension/src/auth/StreamingDemoCredentials.ts +0 -10
  94. package/examples/streaming-wallet-extension/src/background/PaymentStrategy.ts +0 -36
  95. package/examples/streaming-wallet-extension/src/background/PlaybackRange.ts +0 -31
  96. package/examples/streaming-wallet-extension/src/background/StreamingInvoiceHolder.ts +0 -33
  97. package/examples/streaming-wallet-extension/src/background/TransactionObserver.ts +0 -66
  98. package/examples/streaming-wallet-extension/src/background/VideoPlaybackRanges.ts +0 -38
  99. package/examples/streaming-wallet-extension/src/background/VideoProgressCache.ts +0 -87
  100. package/examples/streaming-wallet-extension/src/background/background.ts +0 -145
  101. package/examples/streaming-wallet-extension/src/background/messageHandling.ts +0 -185
  102. package/examples/streaming-wallet-extension/src/common/datetimes.ts +0 -28
  103. package/examples/streaming-wallet-extension/src/common/settings.ts +0 -12
  104. package/examples/streaming-wallet-extension/src/common/storage.ts +0 -8
  105. package/examples/streaming-wallet-extension/src/common/streamingTabs.ts +0 -27
  106. package/examples/streaming-wallet-extension/src/common/types.tsx +0 -23
  107. package/examples/streaming-wallet-extension/src/components/CirclePlusIcon.tsx +0 -19
  108. package/examples/streaming-wallet-extension/src/components/CurrencyAmount.tsx +0 -110
  109. package/examples/streaming-wallet-extension/src/components/CurrencyAmountRaw.tsx +0 -195
  110. package/examples/streaming-wallet-extension/src/components/LeftArrow.tsx +0 -21
  111. package/examples/streaming-wallet-extension/src/components/Loading.tsx +0 -151
  112. package/examples/streaming-wallet-extension/src/components/StreamingTransactionChip.tsx +0 -95
  113. package/examples/streaming-wallet-extension/src/components/TransactionRow.tsx +0 -93
  114. package/examples/streaming-wallet-extension/src/contentscript/content.ts +0 -123
  115. package/examples/streaming-wallet-extension/src/contentscript/lightsparkDemoDom.tsx +0 -113
  116. package/examples/streaming-wallet-extension/src/contentscript/videoElementParsers.ts +0 -92
  117. package/examples/streaming-wallet-extension/src/index.css +0 -16
  118. package/examples/streaming-wallet-extension/src/index.tsx +0 -11
  119. package/examples/streaming-wallet-extension/src/lightsparkClientProvider.tsx +0 -26
  120. package/examples/streaming-wallet-extension/src/react-app-env.d.ts +0 -1
  121. package/examples/streaming-wallet-extension/src/types/Messages.ts +0 -17
  122. package/examples/streaming-wallet-extension/tsconfig.json +0 -20
  123. 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.