@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.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/{Withdrawal-17e1c8af.d.ts → Withdrawal-ebb4865c.d.ts} +393 -377
- package/dist/{chunk-N27QHRE4.js → chunk-XFOVS6EY.js} +56 -40
- package/dist/index.cjs +25 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/objects/index.cjs +24 -8
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +1 -1
- package/package.json +7 -2
- package/src/client.ts +0 -1
- package/src/objects/Account.ts +2 -2
- package/src/objects/Entity.ts +10 -2
- package/src/objects/Invoice.ts +1 -1
- package/src/objects/InvoiceData.ts +10 -1
- package/src/objects/LightningTransaction.ts +1 -1
- package/src/objects/LightsparkNodeStatus.ts +2 -0
- package/src/objects/OutgoingPayment.ts +1 -1
- package/src/objects/PaymentRequest.ts +1 -1
- package/src/objects/PaymentRequestData.ts +1 -1
- package/src/objects/Transaction.ts +1 -1
- package/src/objects/WebhookEventType.ts +10 -0
- package/src/objects/WithdrawalRequest.ts +12 -0
- package/.fossa.yml +0 -6
- package/.prettierrc +0 -1
- package/.turbo/turbo-build.log +0 -19
- package/.turbo/turbo-lint.log +0 -3
- package/dist/chunk-AGEUDR2V.js +0 -4498
- package/dist/client-3bba3f64.d.ts +0 -1302
- package/examples/node-scripts/authHelpers.ts +0 -20
- package/examples/node-scripts/createInvoice.ts +0 -64
- package/examples/node-scripts/example.ts +0 -288
- package/examples/node-scripts/getAccountDashboard.ts +0 -24
- package/examples/node-scripts/getNodeChannels.ts +0 -34
- package/examples/node-scripts/internalAuthHelpers.ts +0 -26
- package/examples/node-scripts/internal_example.ts +0 -296
- package/examples/node-scripts/package-lock.json +0 -887
- package/examples/node-scripts/package.json +0 -22
- package/examples/node-scripts/prettyPrintJsonForDocs.ts +0 -62
- package/examples/node-scripts/tsconfig.json +0 -27
- package/examples/oauth-example/README.md +0 -19
- package/examples/oauth-example/package-lock.json +0 -16071
- package/examples/oauth-example/package.json +0 -50
- package/examples/oauth-example/public/favicon.ico +0 -0
- package/examples/oauth-example/public/index.html +0 -43
- package/examples/oauth-example/public/logo192.png +0 -0
- package/examples/oauth-example/public/logo512.png +0 -0
- package/examples/oauth-example/public/manifest.json +0 -25
- package/examples/oauth-example/public/robots.txt +0 -3
- package/examples/oauth-example/src/App.css +0 -7
- package/examples/oauth-example/src/App.test.tsx +0 -12
- package/examples/oauth-example/src/App.tsx +0 -16
- package/examples/oauth-example/src/auth/AuthContext.ts +0 -8
- package/examples/oauth-example/src/auth/AuthProvider.tsx +0 -44
- package/examples/oauth-example/src/auth/RequireAuth.tsx +0 -19
- package/examples/oauth-example/src/auth/oauthProvider.ts +0 -35
- package/examples/oauth-example/src/components/Button.tsx +0 -39
- package/examples/oauth-example/src/components/CurrencyAmount.tsx +0 -117
- package/examples/oauth-example/src/components/Dashboard.tsx +0 -158
- package/examples/oauth-example/src/components/Table.tsx +0 -22
- package/examples/oauth-example/src/hooks/useAccountInfo.tsx +0 -31
- package/examples/oauth-example/src/icons/BitcoinB.tsx +0 -20
- package/examples/oauth-example/src/icons/Icon.tsx +0 -121
- package/examples/oauth-example/src/icons/Satoshi.tsx +0 -28
- package/examples/oauth-example/src/index.css +0 -13
- package/examples/oauth-example/src/index.tsx +0 -23
- package/examples/oauth-example/src/lightsparkclient/LightsparkClientContext.ts +0 -10
- package/examples/oauth-example/src/lightsparkclient/LightsparkClientProvider.tsx +0 -53
- package/examples/oauth-example/src/logo.svg +0 -1
- package/examples/oauth-example/src/pages/DashboardPage.tsx +0 -71
- package/examples/oauth-example/src/pages/LoginPage.tsx +0 -63
- package/examples/oauth-example/src/react-app-env.d.ts +0 -1
- package/examples/oauth-example/src/reportWebVitals.ts +0 -15
- package/examples/oauth-example/src/routes/index.tsx +0 -15
- package/examples/oauth-example/src/setupTests.ts +0 -5
- package/examples/oauth-example/src/utils/currency.ts +0 -483
- package/examples/oauth-example/tsconfig.json +0 -20
- package/examples/streaming-wallet-extension/.fossa.yml +0 -6
- package/examples/streaming-wallet-extension/README.md +0 -17
- package/examples/streaming-wallet-extension/craco.config.js +0 -58
- package/examples/streaming-wallet-extension/package-lock.json +0 -18260
- package/examples/streaming-wallet-extension/package.json +0 -77
- package/examples/streaming-wallet-extension/public/index.html +0 -24
- package/examples/streaming-wallet-extension/public/lightspark_full.png +0 -0
- package/examples/streaming-wallet-extension/public/lightspark_icon_circle.png +0 -0
- package/examples/streaming-wallet-extension/public/manifest.json +0 -43
- package/examples/streaming-wallet-extension/public/robots.txt +0 -3
- package/examples/streaming-wallet-extension/src/App.css +0 -53
- package/examples/streaming-wallet-extension/src/App.tsx +0 -425
- package/examples/streaming-wallet-extension/src/auth/AccountStorage.ts +0 -28
- package/examples/streaming-wallet-extension/src/auth/DemoAccountProvider.ts +0 -99
- package/examples/streaming-wallet-extension/src/auth/StreamingDemoCredentials.ts +0 -10
- package/examples/streaming-wallet-extension/src/background/PaymentStrategy.ts +0 -36
- package/examples/streaming-wallet-extension/src/background/PlaybackRange.ts +0 -31
- package/examples/streaming-wallet-extension/src/background/StreamingInvoiceHolder.ts +0 -33
- package/examples/streaming-wallet-extension/src/background/TransactionObserver.ts +0 -66
- package/examples/streaming-wallet-extension/src/background/VideoPlaybackRanges.ts +0 -38
- package/examples/streaming-wallet-extension/src/background/VideoProgressCache.ts +0 -87
- package/examples/streaming-wallet-extension/src/background/background.ts +0 -145
- package/examples/streaming-wallet-extension/src/background/messageHandling.ts +0 -185
- package/examples/streaming-wallet-extension/src/common/datetimes.ts +0 -28
- package/examples/streaming-wallet-extension/src/common/settings.ts +0 -12
- package/examples/streaming-wallet-extension/src/common/storage.ts +0 -8
- package/examples/streaming-wallet-extension/src/common/streamingTabs.ts +0 -27
- package/examples/streaming-wallet-extension/src/common/types.tsx +0 -23
- package/examples/streaming-wallet-extension/src/components/CirclePlusIcon.tsx +0 -19
- package/examples/streaming-wallet-extension/src/components/CurrencyAmount.tsx +0 -110
- package/examples/streaming-wallet-extension/src/components/CurrencyAmountRaw.tsx +0 -195
- package/examples/streaming-wallet-extension/src/components/LeftArrow.tsx +0 -21
- package/examples/streaming-wallet-extension/src/components/Loading.tsx +0 -151
- package/examples/streaming-wallet-extension/src/components/StreamingTransactionChip.tsx +0 -95
- package/examples/streaming-wallet-extension/src/components/TransactionRow.tsx +0 -93
- package/examples/streaming-wallet-extension/src/contentscript/content.ts +0 -123
- package/examples/streaming-wallet-extension/src/contentscript/lightsparkDemoDom.tsx +0 -113
- package/examples/streaming-wallet-extension/src/contentscript/videoElementParsers.ts +0 -92
- package/examples/streaming-wallet-extension/src/index.css +0 -16
- package/examples/streaming-wallet-extension/src/index.tsx +0 -11
- package/examples/streaming-wallet-extension/src/lightsparkClientProvider.tsx +0 -26
- package/examples/streaming-wallet-extension/src/react-app-env.d.ts +0 -1
- package/examples/streaming-wallet-extension/src/types/Messages.ts +0 -17
- package/examples/streaming-wallet-extension/tsconfig.json +0 -20
- 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.
|