├── .changeset
└── config.json
├── .dockerignore
├── .fossa.yml
├── .github
├── CODEOWNERS
├── actions
│ └── yarn-nm-install
│ │ └── action.yml
└── workflows
│ ├── create-release-pr.yaml
│ ├── docs.yaml
│ ├── ensureReleasePR.mjs
│ ├── runChangeset.mjs
│ ├── runEnsureReleasePR.mjs
│ ├── test-release-sync.yaml
│ └── updatePR.mjs
├── .gitignore
├── .nvmrc
├── .prettierignore
├── .vscode
└── settings.json
├── .yarn
└── releases
│ └── yarn-4.5.0.cjs
├── .yarnrc.yml
├── LICENSE
├── README.md
├── apps
└── examples
│ ├── README.md
│ ├── nodejs-scripts
│ ├── .eslintrc.cjs
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.ts
│ ├── package.json
│ ├── src
│ │ └── lightspark-sdk
│ │ │ ├── createInvoice.ts
│ │ │ ├── createLnurlInvoice.ts
│ │ │ ├── example.ts
│ │ │ ├── expressLnurlServer.ts
│ │ │ ├── getAccountDashboard.ts
│ │ │ ├── getNodeChannels.ts
│ │ │ ├── internal_example.ts
│ │ │ ├── prettyPrintJsonForDocs.ts
│ │ │ ├── tests
│ │ │ ├── cjs-env.test.cjs
│ │ │ └── esm-env.test.ts
│ │ │ └── umaInvitations.ts
│ ├── tsconfig-test.json
│ └── tsconfig.json
│ ├── oauth-app
│ ├── .eslintrc.js
│ ├── .gitignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── index.html
│ ├── package.json
│ ├── public
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon-48x48.png
│ │ ├── favicon.ico
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.tsx
│ │ ├── Root.tsx
│ │ ├── auth
│ │ │ ├── AuthContext.ts
│ │ │ ├── AuthProvider.tsx
│ │ │ ├── RequireAuth.tsx
│ │ │ └── oauthProvider.ts
│ │ ├── components
│ │ │ ├── Dashboard.tsx
│ │ │ └── Table.tsx
│ │ ├── hooks
│ │ │ └── useAccountInfo.tsx
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── lightsparkclient
│ │ │ ├── LightsparkClientContext.ts
│ │ │ └── LightsparkClientProvider.tsx
│ │ ├── pages
│ │ │ ├── DashboardPage.tsx
│ │ │ └── LoginPage.tsx
│ │ ├── reportWebVitals.ts
│ │ └── routes.tsx
│ ├── tsconfig.json
│ └── vite.config.ts
│ ├── remote-signing-server
│ ├── .eslintrc.cjs
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── jest.config.ts
│ ├── package.json
│ ├── server.test.ts
│ ├── src
│ │ ├── index.ts
│ │ └── startServer.ts
│ ├── start.sh
│ ├── test.sh
│ ├── tsconfig-test.json
│ └── tsconfig.json
│ ├── settings.json
│ ├── ui-test-app
│ ├── .eslintrc.js
│ ├── .prettierignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── gql-codegen.yml
│ ├── index.html
│ ├── jest.config.ts
│ ├── jest
│ │ ├── setup.ts
│ │ └── setupAfterEnv.ts
│ ├── package.json
│ ├── public
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon.ico
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── Root.tsx
│ │ ├── index.tsx
│ │ ├── tests
│ │ │ ├── Banner.test.tsx
│ │ │ ├── CodeInput.test.tsx
│ │ │ ├── NumberInput.core.test.tsx
│ │ │ ├── NumberInput.test.tsx
│ │ │ ├── TextIconAligner.test.tsx
│ │ │ ├── Toasts.test.tsx
│ │ │ ├── render.tsx
│ │ │ ├── renderTypography.test.tsx
│ │ │ └── toReactNodes.test.tsx
│ │ └── types.ts
│ ├── tsconfig-test.json
│ ├── tsconfig.json
│ └── vite.config.ts
│ ├── uma-vasp-cli
│ ├── .eslintrc.cjs
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── helpers.ts
│ │ └── index.ts
│ ├── test.sh
│ └── tsconfig.json
│ └── uma-vasp
│ ├── .gitignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── Dockerfile
│ ├── README.md
│ ├── jest.config.ts
│ ├── package.json
│ ├── server.test.ts
│ ├── src
│ ├── ComplianceService.ts
│ ├── InternalLedgerService.ts
│ ├── PayerDataOptions.ts
│ ├── ReceivingVasp.ts
│ ├── SendingVasp.ts
│ ├── SendingVaspRequestCache.ts
│ ├── UmaConfig.ts
│ ├── User.ts
│ ├── UserService.ts
│ ├── currencies.ts
│ ├── demo
│ │ ├── DemoComplianceService.ts
│ │ ├── DemoInternalLedgerService.ts
│ │ ├── DemoUserService.ts
│ │ └── InMemorySendingVaspRequestCache.ts
│ ├── errors.ts
│ ├── hex.ts
│ ├── networking
│ │ ├── HttpResponse.ts
│ │ └── expressAdapters.ts
│ ├── server.ts
│ └── startServer.ts
│ ├── start.sh
│ ├── test.sh
│ ├── tsconfig-test.json
│ └── tsconfig.json
├── clean-all.sh
├── copy.bara.sky
├── package.json
├── packages
├── core
│ ├── .attw.json
│ ├── .eslintrc.cjs
│ ├── .fossa.yml
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── jest.config.ts
│ ├── package.json
│ ├── src
│ │ ├── LightsparkException.ts
│ │ ├── Logger.ts
│ │ ├── ServerEnvironment.ts
│ │ ├── auth
│ │ │ ├── AuthProvider.ts
│ │ │ ├── LightsparkAuthException.ts
│ │ │ ├── StubAuthProvider.ts
│ │ │ └── index.ts
│ │ ├── constants
│ │ │ └── index.ts
│ │ ├── crypto
│ │ │ ├── KeyOrAlias.ts
│ │ │ ├── LightsparkSigningException.ts
│ │ │ ├── NodeKeyCache.ts
│ │ │ ├── SigningKey.ts
│ │ │ ├── crypto.ts
│ │ │ ├── index.ts
│ │ │ ├── tests
│ │ │ │ └── crypto.test.ts
│ │ │ └── types.ts
│ │ ├── index.ts
│ │ ├── requester
│ │ │ ├── Query.ts
│ │ │ ├── Requester.ts
│ │ │ ├── index.ts
│ │ │ └── tests
│ │ │ │ └── Requester.test.ts
│ │ └── utils
│ │ │ ├── arrays.ts
│ │ │ ├── base64.ts
│ │ │ ├── createHash.ts
│ │ │ ├── currency.ts
│ │ │ ├── environment.ts
│ │ │ ├── errors.ts
│ │ │ ├── hex.ts
│ │ │ ├── index.ts
│ │ │ ├── localStorage.ts
│ │ │ ├── locale.ts
│ │ │ ├── localeToCurrencyCodes.ts
│ │ │ ├── numbers.ts
│ │ │ ├── pollUntil.ts
│ │ │ ├── sleep.ts
│ │ │ ├── strings.ts
│ │ │ ├── tests
│ │ │ └── currency.test.ts
│ │ │ ├── typeGuards.ts
│ │ │ └── types.ts
│ ├── tsconfig-test.json
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ └── turbo.json
├── crypto-wasm
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── crypto.cjs
│ ├── crypto.d.ts
│ ├── crypto_bg.wasm
│ ├── crypto_bg.wasm.d.ts
│ ├── jest.config.ts
│ ├── package.json
│ ├── sync.sh
│ ├── tests
│ │ └── crypto.test.ts
│ └── tsconfig-test.json
├── eslint-config
│ ├── CHANGELOG.md
│ ├── base.js
│ ├── constants
│ │ └── react-restricted-imports.js
│ ├── package.json
│ ├── react-app.js
│ └── react-lib.js
├── lightspark-cli
│ ├── .eslintrc.cjs
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── helpers.ts
│ │ └── index.ts
│ ├── test.sh
│ └── tsconfig.json
├── lightspark-sdk
│ ├── .attw.json
│ ├── .eslintrc.cjs
│ ├── .fossa.yml
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── jest.config.ts
│ ├── package.json
│ ├── src
│ │ ├── NodeKeyLoaderCache.ts
│ │ ├── SigningKeyLoader.ts
│ │ ├── auth
│ │ │ ├── AccountTokenAuthProvider.ts
│ │ │ └── index.ts
│ │ ├── client.ts
│ │ ├── env.ts
│ │ ├── graphql
│ │ │ ├── BitcoinFeeEstimate.ts
│ │ │ ├── CancelInvoice.ts
│ │ │ ├── CancelUmaInvitation.ts
│ │ │ ├── ClaimUmaInvitation.ts
│ │ │ ├── ClaimUmaInvitationWithIncentives.ts
│ │ │ ├── CreateApiToken.ts
│ │ │ ├── CreateInvoice.ts
│ │ │ ├── CreateLnurlInvoice.ts
│ │ │ ├── CreateNodeWalletAddress.ts
│ │ │ ├── CreateOffer.ts
│ │ │ ├── CreateTestModeInvoice.ts
│ │ │ ├── CreateTestModePayment.ts
│ │ │ ├── CreateUmaInvitation.ts
│ │ │ ├── CreateUmaInvitationWithIncentives.ts
│ │ │ ├── CreateUmaInvitationWithPayment.ts
│ │ │ ├── CreateUmaInvoice.ts
│ │ │ ├── CurrentAccount.ts
│ │ │ ├── DecodeInvoice.ts
│ │ │ ├── DeleteApiToken.ts
│ │ │ ├── FetchUmaInvitation.ts
│ │ │ ├── FundNode.ts
│ │ │ ├── IncomingPaymentsForInvoice.ts
│ │ │ ├── InvoiceForPaymentHash.ts
│ │ │ ├── LightningFeeEstimateForInvoice.ts
│ │ │ ├── LightningFeeEstimateForNode.ts
│ │ │ ├── MultiNodeDashboard.ts
│ │ │ ├── OutgoingPaymentsForInvoice.ts
│ │ │ ├── OutgoingPaymentsForPaymentHash.ts
│ │ │ ├── PayInvoice.ts
│ │ │ ├── PayOffer.ts
│ │ │ ├── PayUmaInvoice.ts
│ │ │ ├── PaymentRequestsForNode.ts
│ │ │ ├── RecoverNodeSigningKey.ts
│ │ │ ├── RegisterPayment.ts
│ │ │ ├── RequestWithdrawal.ts
│ │ │ ├── ScreenNode.ts
│ │ │ ├── SendPayment.ts
│ │ │ ├── SingleNodeDashboard.ts
│ │ │ ├── TransactionSubscription.ts
│ │ │ ├── TransactionsForNode.ts
│ │ │ └── WithdrawalFeeEstimate.ts
│ │ ├── helpers.ts
│ │ ├── index.ts
│ │ ├── logger.ts
│ │ ├── objects
│ │ │ ├── Account.ts
│ │ │ ├── AccountToApiTokensConnection.ts
│ │ │ ├── AccountToChannelsConnection.ts
│ │ │ ├── AccountToNodesConnection.ts
│ │ │ ├── AccountToPaymentRequestsConnection.ts
│ │ │ ├── AccountToTransactionsConnection.ts
│ │ │ ├── AccountToWalletsConnection.ts
│ │ │ ├── AccountToWithdrawalRequestsConnection.ts
│ │ │ ├── ApiToken.ts
│ │ │ ├── AuditLogActor.ts
│ │ │ ├── Balances.ts
│ │ │ ├── BitcoinNetwork.ts
│ │ │ ├── BlockchainBalance.ts
│ │ │ ├── CancelInvoiceInput.ts
│ │ │ ├── CancelInvoiceOutput.ts
│ │ │ ├── Channel.ts
│ │ │ ├── ChannelClosingTransaction.ts
│ │ │ ├── ChannelFees.ts
│ │ │ ├── ChannelOpeningTransaction.ts
│ │ │ ├── ChannelSnapshot.ts
│ │ │ ├── ChannelStatus.ts
│ │ │ ├── ChannelToTransactionsConnection.ts
│ │ │ ├── ClaimUmaInvitationInput.ts
│ │ │ ├── ClaimUmaInvitationOutput.ts
│ │ │ ├── ClaimUmaInvitationWithIncentivesInput.ts
│ │ │ ├── ClaimUmaInvitationWithIncentivesOutput.ts
│ │ │ ├── ComplianceProvider.ts
│ │ │ ├── Connection.ts
│ │ │ ├── CreateApiTokenInput.ts
│ │ │ ├── CreateApiTokenOutput.ts
│ │ │ ├── CreateInvitationWithIncentivesInput.ts
│ │ │ ├── CreateInvitationWithIncentivesOutput.ts
│ │ │ ├── CreateInvoiceInput.ts
│ │ │ ├── CreateInvoiceOutput.ts
│ │ │ ├── CreateLnurlInvoiceInput.ts
│ │ │ ├── CreateNodeWalletAddressInput.ts
│ │ │ ├── CreateNodeWalletAddressOutput.ts
│ │ │ ├── CreateOfferInput.ts
│ │ │ ├── CreateOfferOutput.ts
│ │ │ ├── CreateTestModeInvoiceInput.ts
│ │ │ ├── CreateTestModeInvoiceOutput.ts
│ │ │ ├── CreateTestModePaymentInput.ts
│ │ │ ├── CreateTestModePaymentoutput.ts
│ │ │ ├── CreateUmaInvitationInput.ts
│ │ │ ├── CreateUmaInvitationOutput.ts
│ │ │ ├── CreateUmaInvoiceInput.ts
│ │ │ ├── CurrencyAmount.ts
│ │ │ ├── CurrencyAmountInput.ts
│ │ │ ├── CurrencyUnit.ts
│ │ │ ├── DailyLiquidityForecast.ts
│ │ │ ├── DeclineToSignMessagesInput.ts
│ │ │ ├── DeclineToSignMessagesOutput.ts
│ │ │ ├── DeleteApiTokenInput.ts
│ │ │ ├── DeleteApiTokenOutput.ts
│ │ │ ├── Deposit.ts
│ │ │ ├── Entity.ts
│ │ │ ├── FailHtlcsInput.ts
│ │ │ ├── FailHtlcsOutput.ts
│ │ │ ├── FeeEstimate.ts
│ │ │ ├── FundNodeInput.ts
│ │ │ ├── FundNodeOutput.ts
│ │ │ ├── GraphNode.ts
│ │ │ ├── Hop.ts
│ │ │ ├── HtlcAttemptFailureCode.ts
│ │ │ ├── IdAndSignature.ts
│ │ │ ├── IncentivesIneligibilityReason.ts
│ │ │ ├── IncentivesStatus.ts
│ │ │ ├── IncomingPayment.ts
│ │ │ ├── IncomingPaymentAttempt.ts
│ │ │ ├── IncomingPaymentAttemptStatus.ts
│ │ │ ├── IncomingPaymentToAttemptsConnection.ts
│ │ │ ├── IncomingPaymentsForInvoiceQueryInput.ts
│ │ │ ├── IncomingPaymentsForInvoiceQueryOutput.ts
│ │ │ ├── IncomingPaymentsForPaymentHashQueryInput.ts
│ │ │ ├── IncomingPaymentsForPaymentHashQueryOutput.ts
│ │ │ ├── Invoice.ts
│ │ │ ├── InvoiceData.ts
│ │ │ ├── InvoiceForPaymentHashInput.ts
│ │ │ ├── InvoiceForPaymentHashOutput.ts
│ │ │ ├── InvoiceType.ts
│ │ │ ├── LightningFeeEstimateForInvoiceInput.ts
│ │ │ ├── LightningFeeEstimateForNodeInput.ts
│ │ │ ├── LightningFeeEstimateOutput.ts
│ │ │ ├── LightningPaymentDirection.ts
│ │ │ ├── LightningTransaction.ts
│ │ │ ├── LightsparkNode.ts
│ │ │ ├── LightsparkNodeOwner.ts
│ │ │ ├── LightsparkNodeStatus.ts
│ │ │ ├── LightsparkNodeToChannelsConnection.ts
│ │ │ ├── LightsparkNodeToDailyLiquidityForecastsConnection.ts
│ │ │ ├── LightsparkNodeWithOSK.ts
│ │ │ ├── LightsparkNodeWithRemoteSigning.ts
│ │ │ ├── MultiSigAddressValidationParameters.ts
│ │ │ ├── Node.ts
│ │ │ ├── NodeAddress.ts
│ │ │ ├── NodeAddressType.ts
│ │ │ ├── NodeToAddressesConnection.ts
│ │ │ ├── Offer.ts
│ │ │ ├── OfferData.ts
│ │ │ ├── OnChainFeeTarget.ts
│ │ │ ├── OnChainTransaction.ts
│ │ │ ├── OutgoingPayment.ts
│ │ │ ├── OutgoingPaymentAttempt.ts
│ │ │ ├── OutgoingPaymentAttemptStatus.ts
│ │ │ ├── OutgoingPaymentAttemptToHopsConnection.ts
│ │ │ ├── OutgoingPaymentForIdempotencyKeyInput.ts
│ │ │ ├── OutgoingPaymentForIdempotencyKeyOutput.ts
│ │ │ ├── OutgoingPaymentToAttemptsConnection.ts
│ │ │ ├── OutgoingPaymentsForInvoiceQueryInput.ts
│ │ │ ├── OutgoingPaymentsForInvoiceQueryOutput.ts
│ │ │ ├── OutgoingPaymentsForPaymentHashQueryInput.ts
│ │ │ ├── OutgoingPaymentsForPaymentHashQueryOutput.ts
│ │ │ ├── PageInfo.ts
│ │ │ ├── PayInvoiceInput.ts
│ │ │ ├── PayInvoiceOutput.ts
│ │ │ ├── PayOfferInput.ts
│ │ │ ├── PayOfferOutput.ts
│ │ │ ├── PayTestModeInvoiceInput.ts
│ │ │ ├── PayUmaInvoiceInput.ts
│ │ │ ├── PaymentDirection.ts
│ │ │ ├── PaymentFailureReason.ts
│ │ │ ├── PaymentRequest.ts
│ │ │ ├── PaymentRequestData.ts
│ │ │ ├── PaymentRequestStatus.ts
│ │ │ ├── Permission.ts
│ │ │ ├── PostTransactionData.ts
│ │ │ ├── RegionCode.ts
│ │ │ ├── RegisterPaymentInput.ts
│ │ │ ├── RegisterPaymentOutput.ts
│ │ │ ├── ReleaseChannelPerCommitmentSecretInput.ts
│ │ │ ├── ReleaseChannelPerCommitmentSecretOutput.ts
│ │ │ ├── ReleasePaymentPreimageInput.ts
│ │ │ ├── ReleasePaymentPreimageOutput.ts
│ │ │ ├── RemoteSigningSubEventType.ts
│ │ │ ├── RequestInitiator.ts
│ │ │ ├── RequestWithdrawalInput.ts
│ │ │ ├── RequestWithdrawalOutput.ts
│ │ │ ├── RichText.ts
│ │ │ ├── RiskRating.ts
│ │ │ ├── RoutingTransaction.ts
│ │ │ ├── RoutingTransactionFailureReason.ts
│ │ │ ├── ScreenNodeInput.ts
│ │ │ ├── ScreenNodeOutput.ts
│ │ │ ├── Secret.ts
│ │ │ ├── SendPaymentInput.ts
│ │ │ ├── SendPaymentOutput.ts
│ │ │ ├── SetInvoicePaymentHashInput.ts
│ │ │ ├── SetInvoicePaymentHashOutput.ts
│ │ │ ├── SignInvoiceInput.ts
│ │ │ ├── SignInvoiceOutput.ts
│ │ │ ├── SignMessagesInput.ts
│ │ │ ├── SignMessagesOutput.ts
│ │ │ ├── Signable.ts
│ │ │ ├── SignablePayload.ts
│ │ │ ├── SignablePayloadStatus.ts
│ │ │ ├── SingleNodeDashboard.ts
│ │ │ ├── Transaction.ts
│ │ │ ├── TransactionFailures.ts
│ │ │ ├── TransactionStatus.ts
│ │ │ ├── TransactionType.ts
│ │ │ ├── TransactionUpdate.ts
│ │ │ ├── UmaInvitation.ts
│ │ │ ├── UpdateChannelPerCommitmentPointInput.ts
│ │ │ ├── UpdateChannelPerCommitmentPointOutput.ts
│ │ │ ├── UpdateNodeSharedSecretInput.ts
│ │ │ ├── UpdateNodeSharedSecretOutput.ts
│ │ │ ├── Wallet.ts
│ │ │ ├── WalletStatus.ts
│ │ │ ├── WalletToPaymentRequestsConnection.ts
│ │ │ ├── WalletToTransactionsConnection.ts
│ │ │ ├── WalletToWithdrawalRequestsConnection.ts
│ │ │ ├── WebhookEventType.ts
│ │ │ ├── Withdrawal.ts
│ │ │ ├── WithdrawalFeeEstimateInput.ts
│ │ │ ├── WithdrawalFeeEstimateOutput.ts
│ │ │ ├── WithdrawalMode.ts
│ │ │ ├── WithdrawalRequest.ts
│ │ │ ├── WithdrawalRequestStatus.ts
│ │ │ ├── WithdrawalRequestToChannelClosingTransactionsConnection.ts
│ │ │ ├── WithdrawalRequestToChannelOpeningTransactionsConnection.ts
│ │ │ ├── WithdrawalRequestToWithdrawalsConnection.ts
│ │ │ └── index.ts
│ │ ├── tests
│ │ │ ├── generated-objects.test.ts
│ │ │ ├── integration
│ │ │ │ ├── constants.ts
│ │ │ │ └── general-regtest.test.ts
│ │ │ ├── uma-utils.test.ts
│ │ │ └── webhooks.test.ts
│ │ └── webhooks.ts
│ ├── tsconfig-test.json
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ └── turbo.json
├── oauth
│ ├── .eslintrc.cjs
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── auth
│ │ │ ├── OAuthProvider.ts
│ │ │ ├── OAuthStateHelper.ts
│ │ │ ├── OAuthTokenRequestHandler.ts
│ │ │ └── index.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ └── turbo.json
├── static
│ ├── images
│ │ └── lightspark-logo.svg
│ └── package.json
├── tsconfig
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── base.json
│ ├── package.json
│ ├── react-app.json
│ ├── react-package.json
│ └── ts-node-app.json
├── ui
│ ├── .attw.json
│ ├── .eslintrc.cjs
│ ├── .prettierignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── esbuild-svgr-plugin.ts
│ ├── jest
│ │ ├── setup.ts
│ │ └── setupAfterEnv.ts
│ ├── package.json
│ ├── src
│ │ ├── components
│ │ │ ├── Badge.tsx
│ │ │ ├── Banner
│ │ │ │ ├── Banner.tsx
│ │ │ │ └── constants.ts
│ │ │ ├── BirthdayInput.tsx
│ │ │ ├── BlockAlert.tsx
│ │ │ ├── Button.tsx
│ │ │ ├── ButtonRow.tsx
│ │ │ ├── CardForm
│ │ │ │ ├── CardForm.tsx
│ │ │ │ ├── CardFormCodeInput.tsx
│ │ │ │ └── CardFormHeadline.tsx
│ │ │ ├── CardPage.tsx
│ │ │ ├── Checkbox.tsx
│ │ │ ├── ClipboardTextField.tsx
│ │ │ ├── CodeBlock.tsx
│ │ │ ├── CodeInput
│ │ │ │ ├── CodeInput.tsx
│ │ │ │ └── SingleCodeInput.tsx
│ │ │ ├── Collapsible.tsx
│ │ │ ├── CommandKey.tsx
│ │ │ ├── ContentTable.tsx
│ │ │ ├── CopyToClipboardButton.tsx
│ │ │ ├── CurrencyAmount.tsx
│ │ │ ├── DataManagerTable
│ │ │ │ ├── BooleanFilter.tsx
│ │ │ │ ├── CurrencyFilter.tsx
│ │ │ │ ├── DataManagerTable.tsx
│ │ │ │ ├── DateFilter.tsx
│ │ │ │ ├── DateWidget.tsx
│ │ │ │ ├── EnumFilter.tsx
│ │ │ │ ├── Filter.tsx
│ │ │ │ ├── IdFilter.tsx
│ │ │ │ ├── StringFilter.tsx
│ │ │ │ ├── date_utils.ts
│ │ │ │ └── filters.ts
│ │ │ ├── Drawer.tsx
│ │ │ ├── Dropdown.tsx
│ │ │ ├── FileInput.tsx
│ │ │ ├── Flex.tsx
│ │ │ ├── GradientCardHeader.tsx
│ │ │ ├── Icon
│ │ │ │ ├── Icon.tsx
│ │ │ │ └── types.tsx
│ │ │ ├── IconWithCircleBackground.tsx
│ │ │ ├── InfoIconTooltip.tsx
│ │ │ ├── LightboxImage.tsx
│ │ │ ├── LightsparkProvider.tsx
│ │ │ ├── Loading.tsx
│ │ │ ├── Modal.tsx
│ │ │ ├── MultiToggle.tsx
│ │ │ ├── NumberInput.tsx
│ │ │ ├── PageSection
│ │ │ │ ├── PageSection.tsx
│ │ │ │ ├── PageSectionNav.tsx
│ │ │ │ └── constants.tsx
│ │ │ ├── PendingValue.tsx
│ │ │ ├── PhoneInput.tsx
│ │ │ ├── Pill.tsx
│ │ │ ├── ProgressBar.tsx
│ │ │ ├── QRCode.tsx
│ │ │ ├── QRReader
│ │ │ │ ├── QRReader.tsx
│ │ │ │ ├── hooks.ts
│ │ │ │ ├── styles.ts
│ │ │ │ ├── types.ts
│ │ │ │ └── utils.ts
│ │ │ ├── QRReaderButton.tsx
│ │ │ ├── Radio.tsx
│ │ │ ├── ReadClipboardButton.tsx
│ │ │ ├── SatoshiInput.tsx
│ │ │ ├── SatoshiInputLabel.tsx
│ │ │ ├── SecretContainer.tsx
│ │ │ ├── SecretInput.tsx
│ │ │ ├── Select.tsx
│ │ │ ├── SidePanel.tsx
│ │ │ ├── StatusIndicator.tsx
│ │ │ ├── Table
│ │ │ │ ├── Table.tsx
│ │ │ │ └── TableEmptyState.tsx
│ │ │ ├── TextArea.tsx
│ │ │ ├── TextButton.tsx
│ │ │ ├── TextIconAligner.tsx
│ │ │ ├── TextInput.tsx
│ │ │ ├── Toasts.tsx
│ │ │ ├── Toggle.tsx
│ │ │ ├── Tooltip.tsx
│ │ │ ├── UnstyledButton.tsx
│ │ │ ├── documentation
│ │ │ │ ├── AnchorLinkHeader.tsx
│ │ │ │ ├── DocsBodyParagraph.tsx
│ │ │ │ ├── DocsBodyStrongParagraph.tsx
│ │ │ │ ├── DocsHeadline.tsx
│ │ │ │ ├── Video.tsx
│ │ │ │ └── index.ts
│ │ │ ├── index.tsx
│ │ │ ├── types.ts
│ │ │ └── typography
│ │ │ │ ├── Article.tsx
│ │ │ │ ├── Body.tsx
│ │ │ │ ├── BodyStrong.tsx
│ │ │ │ ├── Code.tsx
│ │ │ │ ├── Display.tsx
│ │ │ │ ├── Headline.tsx
│ │ │ │ ├── Label.tsx
│ │ │ │ ├── LabelModerate.tsx
│ │ │ │ ├── LabelStrong.tsx
│ │ │ │ ├── Overline.tsx
│ │ │ │ ├── Title.tsx
│ │ │ │ ├── base
│ │ │ │ ├── Body.tsx
│ │ │ │ ├── BodyStrong.tsx
│ │ │ │ ├── Code.tsx
│ │ │ │ ├── Display.tsx
│ │ │ │ ├── Headline.tsx
│ │ │ │ ├── Label.tsx
│ │ │ │ ├── LabelModerate.tsx
│ │ │ │ ├── LabelStrong.tsx
│ │ │ │ ├── Overline.tsx
│ │ │ │ ├── Title.tsx
│ │ │ │ └── getPropDefaults.tsx
│ │ │ │ ├── index.tsx
│ │ │ │ ├── renderTypography.tsx
│ │ │ │ ├── types.ts
│ │ │ │ └── typographyStyles.tsx
│ │ ├── hooks
│ │ │ ├── index.tsx
│ │ │ ├── useClipboard.tsx
│ │ │ ├── useDebounce.tsx
│ │ │ ├── useDocumentTitle.tsx
│ │ │ ├── useFields.tsx
│ │ │ ├── useIsomorphicLayoutEffect.tsx
│ │ │ ├── useLiveRef.tsx
│ │ │ ├── useMaxScaleIOS.tsx
│ │ │ ├── useNumberInput
│ │ │ │ ├── types.ts
│ │ │ │ ├── useNumberInput.tsx
│ │ │ │ └── utils
│ │ │ │ │ ├── addSeparators.ts
│ │ │ │ │ ├── cleanValue.ts
│ │ │ │ │ ├── escapeRegExp.ts
│ │ │ │ │ ├── fixedDecimalValue.ts
│ │ │ │ │ ├── formatValue.ts
│ │ │ │ │ ├── getLocaleConfig.ts
│ │ │ │ │ ├── getSuffix.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── isNumber.ts
│ │ │ │ │ ├── padTrimValue.ts
│ │ │ │ │ ├── parseAbbrValue.ts
│ │ │ │ │ ├── removeInvalidChars.ts
│ │ │ │ │ ├── removeSeparators.ts
│ │ │ │ │ └── repositionCursor.ts
│ │ │ ├── useQueryParams.tsx
│ │ │ ├── useResizeObserver.tsx
│ │ │ └── useWhatChanged.tsx
│ │ ├── icons
│ │ │ ├── AI.tsx
│ │ │ ├── AnchorLink.tsx
│ │ │ ├── ApiConnection.tsx
│ │ │ ├── AppIcon.tsx
│ │ │ ├── ArrowCircle.tsx
│ │ │ ├── ArrowCircleCutout.tsx
│ │ │ ├── ArrowCircleTier1.tsx
│ │ │ ├── ArrowCircleTier2.tsx
│ │ │ ├── ArrowCircleTier3.tsx
│ │ │ ├── ArrowCornerDownRight.tsx
│ │ │ ├── ArrowDown.tsx
│ │ │ ├── ArrowLeft.tsx
│ │ │ ├── ArrowLeftCircleCutout.tsx
│ │ │ ├── ArrowRight.tsx
│ │ │ ├── ArrowUp.tsx
│ │ │ ├── ArrowUpRight.tsx
│ │ │ ├── ArrowUpRightCircleFill.tsx
│ │ │ ├── ArrowsDown.tsx
│ │ │ ├── ArrowsHorizontal.tsx
│ │ │ ├── ArrowsUp.tsx
│ │ │ ├── Bank.tsx
│ │ │ ├── BitcoinB.tsx
│ │ │ ├── BitcoinBOnRoundedSquare.tsx
│ │ │ ├── BrokenChainLink.tsx
│ │ │ ├── Calendar.tsx
│ │ │ ├── CalendarClock.tsx
│ │ │ ├── CameraCapture.tsx
│ │ │ ├── CaretRight.tsx
│ │ │ ├── CashAppBadge.tsx
│ │ │ ├── CentralArrowShareRight.tsx
│ │ │ ├── Checkmark.tsx
│ │ │ ├── CheckmarkCircle.tsx
│ │ │ ├── CheckmarkCircleTier1.tsx
│ │ │ ├── CheckmarkCircleTier2.tsx
│ │ │ ├── CheckmarkCircleTier3.tsx
│ │ │ ├── CheckmarkGreen.tsx
│ │ │ ├── Chevron.tsx
│ │ │ ├── ChevronDown.tsx
│ │ │ ├── ChevronLeft.tsx
│ │ │ ├── ChevronRight.tsx
│ │ │ ├── ChevronUp.tsx
│ │ │ ├── CircleCheck.tsx
│ │ │ ├── CircleCheckOutline.tsx
│ │ │ ├── CirclePlus.tsx
│ │ │ ├── Clock.tsx
│ │ │ ├── Close.tsx
│ │ │ ├── CloudUpload.tsx
│ │ │ ├── Code.tsx
│ │ │ ├── Contrast.tsx
│ │ │ ├── Copy.tsx
│ │ │ ├── CreditCard.tsx
│ │ │ ├── DeleteIcon.tsx
│ │ │ ├── Dollar.tsx
│ │ │ ├── DollarManrope.tsx
│ │ │ ├── DollarManropeSmall.tsx
│ │ │ ├── DotGrid1x3Horizontal.tsx
│ │ │ ├── Download.tsx
│ │ │ ├── EmailPlus.tsx
│ │ │ ├── Entity.tsx
│ │ │ ├── Envelope.tsx
│ │ │ ├── EnvelopePlus.tsx
│ │ │ ├── ExclamationPoint.tsx
│ │ │ ├── Explorer.tsx
│ │ │ ├── Eye.tsx
│ │ │ ├── EyeDropper.tsx
│ │ │ ├── Figma.tsx
│ │ │ ├── FlagUSA.tsx
│ │ │ ├── FlutterTwoTone.tsx
│ │ │ ├── FramedLetterI.tsx
│ │ │ ├── Gear.tsx
│ │ │ ├── Github.tsx
│ │ │ ├── Globe.tsx
│ │ │ ├── Globus.tsx
│ │ │ ├── GoTwoTone.tsx
│ │ │ ├── GraphQLTwoTone.tsx
│ │ │ ├── HeartOutline.tsx
│ │ │ ├── Home.tsx
│ │ │ ├── Info.tsx
│ │ │ ├── JavaScriptTwoTone.tsx
│ │ │ ├── JavaTwoTone.tsx
│ │ │ ├── KotlinTwoTone.tsx
│ │ │ ├── LightningBoltOutline.tsx
│ │ │ ├── LightningOnRoundedSquare.tsx
│ │ │ ├── Limit.tsx
│ │ │ ├── LinkIcon.tsx
│ │ │ ├── LoadingCircleLines.tsx
│ │ │ ├── LoadingSpinner.tsx
│ │ │ ├── Lock.tsx
│ │ │ ├── Lock2.tsx
│ │ │ ├── Logo.tsx
│ │ │ ├── LogoBolt.tsx
│ │ │ ├── LogoIssuance.tsx
│ │ │ ├── LogoMark.tsx
│ │ │ ├── LogoOnCircle.tsx
│ │ │ ├── Logout.tsx
│ │ │ ├── MagicWand.tsx
│ │ │ ├── MessageBubble.tsx
│ │ │ ├── Messages.tsx
│ │ │ ├── Messenger.tsx
│ │ │ ├── Minus.tsx
│ │ │ ├── Monitor.tsx
│ │ │ ├── Moon.tsx
│ │ │ ├── NodeAdd.tsx
│ │ │ ├── NonagonCheckmark.tsx
│ │ │ ├── NotEye.tsx
│ │ │ ├── Notebook.tsx
│ │ │ ├── NubankLogo.tsx
│ │ │ ├── PaperPlane.tsx
│ │ │ ├── PaperPlaneRounder.tsx
│ │ │ ├── Pencil.tsx
│ │ │ ├── Person.tsx
│ │ │ ├── PersonCircle.tsx
│ │ │ ├── PersonPlus.tsx
│ │ │ ├── PiggyBank.tsx
│ │ │ ├── Plus.tsx
│ │ │ ├── PythonTwoTone.tsx
│ │ │ ├── QRCodeIcon.tsx
│ │ │ ├── QuestionCircle.tsx
│ │ │ ├── QuestionCircleStrong.tsx
│ │ │ ├── ReactTwoTone.tsx
│ │ │ ├── ReceiptBill.tsx
│ │ │ ├── ReceiptCheck.tsx
│ │ │ ├── Recycling.tsx
│ │ │ ├── Remove.tsx
│ │ │ ├── Restart.tsx
│ │ │ ├── Roadmap.tsx
│ │ │ ├── RustTwoTone.tsx
│ │ │ ├── Satoshi.tsx
│ │ │ ├── SatoshiRounded.tsx
│ │ │ ├── Search.tsx
│ │ │ ├── SecurityKey.tsx
│ │ │ ├── Selector.tsx
│ │ │ ├── SemiCircleOverlap.tsx
│ │ │ ├── SettingsSlider.tsx
│ │ │ ├── Share.tsx
│ │ │ ├── ShieldCheck.tsx
│ │ │ ├── ShieldCheckLite.tsx
│ │ │ ├── Sidebar.tsx
│ │ │ ├── Snowflake.tsx
│ │ │ ├── Sort.tsx
│ │ │ ├── Spark.tsx
│ │ │ ├── SparklesSoft.tsx
│ │ │ ├── StackedLines.tsx
│ │ │ ├── Sun.tsx
│ │ │ ├── SwiftTwoTone.tsx
│ │ │ ├── TapSingle.tsx
│ │ │ ├── Team.tsx
│ │ │ ├── Terminal.tsx
│ │ │ ├── Trash.tsx
│ │ │ ├── Uma.tsx
│ │ │ ├── UmaBridgeLoading.tsx
│ │ │ ├── UmaBridgeLoadingTransparent.tsx
│ │ │ ├── UmaPaymentLoadingSpinner.tsx
│ │ │ ├── Upload.tsx
│ │ │ ├── Wallet.tsx
│ │ │ ├── WalletSDKIcon.tsx
│ │ │ ├── WarningSign.tsx
│ │ │ ├── WhatsApp.tsx
│ │ │ ├── Zap.tsx
│ │ │ ├── ZapLite.tsx
│ │ │ ├── central
│ │ │ │ ├── ArrowBoxRight.tsx
│ │ │ │ ├── ArrowDownLeft.tsx
│ │ │ │ ├── ArrowInbox.tsx
│ │ │ │ ├── ArrowInboxUp.tsx
│ │ │ │ ├── ArrowLeft.tsx
│ │ │ │ ├── ArrowUpDown.tsx
│ │ │ │ ├── ArrowUpRight.tsx
│ │ │ │ ├── ArrowsRepeatLeftRight.tsx
│ │ │ │ ├── Bank.tsx
│ │ │ │ ├── BarsThree.tsx
│ │ │ │ ├── Bell2.tsx
│ │ │ │ ├── Bubble5.tsx
│ │ │ │ ├── BubbleWideNotification.tsx
│ │ │ │ ├── Checkmark2.tsx
│ │ │ │ ├── Checkmark2Small.tsx
│ │ │ │ ├── ChevronBottom.tsx
│ │ │ │ ├── ChevronBottomSm.tsx
│ │ │ │ ├── ChevronBottomXs.tsx
│ │ │ │ ├── ChevronLeft.tsx
│ │ │ │ ├── ChevronLeftSm.tsx
│ │ │ │ ├── ChevronLeftXs.tsx
│ │ │ │ ├── ChevronRight.tsx
│ │ │ │ ├── ChevronRightSm.tsx
│ │ │ │ ├── ChevronRightXs.tsx
│ │ │ │ ├── ChevronTop.tsx
│ │ │ │ ├── ChevronTopSm.tsx
│ │ │ │ ├── ChevronTopXs.tsx
│ │ │ │ ├── CircleCheckFilled.tsx
│ │ │ │ ├── CircleInfo.tsx
│ │ │ │ ├── CircleInfoFilled.tsx
│ │ │ │ ├── CircleQuestionmark.tsx
│ │ │ │ ├── CircleQuestionmarkFilled.tsx
│ │ │ │ ├── CircleX.tsx
│ │ │ │ ├── CrossLarge.tsx
│ │ │ │ ├── DollarSign.tsx
│ │ │ │ ├── Email3.tsx
│ │ │ │ ├── EmailNotification.tsx
│ │ │ │ ├── EmptyStrength.tsx
│ │ │ │ ├── EyeOpen.tsx
│ │ │ │ ├── EyeSlash.tsx
│ │ │ │ ├── FingerPrint1.tsx
│ │ │ │ ├── Gift.tsx
│ │ │ │ ├── Globus.tsx
│ │ │ │ ├── Group3.tsx
│ │ │ │ ├── Key2.tsx
│ │ │ │ ├── Leading.tsx
│ │ │ │ ├── Loader.tsx
│ │ │ │ ├── Lock.tsx
│ │ │ │ ├── MagnifyingGlass.tsx
│ │ │ │ ├── MapPin.tsx
│ │ │ │ ├── MediumStrength.tsx
│ │ │ │ ├── Megaphone.tsx
│ │ │ │ ├── MinusLarge.tsx
│ │ │ │ ├── MinusSmall.tsx
│ │ │ │ ├── Passkeys.tsx
│ │ │ │ ├── Pencil.tsx
│ │ │ │ ├── People.tsx
│ │ │ │ ├── PeopleAdd.tsx
│ │ │ │ ├── PeopleCircle.tsx
│ │ │ │ ├── PeopleCircleStroke.tsx
│ │ │ │ ├── Phone.tsx
│ │ │ │ ├── PlusLarge.tsx
│ │ │ │ ├── PlusSmall.tsx
│ │ │ │ ├── QrCode.tsx
│ │ │ │ ├── ReceiptBill.tsx
│ │ │ │ ├── SettingsGear2.tsx
│ │ │ │ ├── ShapesPlusXSquareCircle.tsx
│ │ │ │ ├── ShapesPlusXSquareCircleFill.tsx
│ │ │ │ ├── ShareAndroid.tsx
│ │ │ │ ├── ShareIOS.tsx
│ │ │ │ ├── ShieldCheck.tsx
│ │ │ │ ├── SparklesSoft.tsx
│ │ │ │ ├── SquareArrowTopRight2.tsx
│ │ │ │ ├── SquareBehindSquare1.tsx
│ │ │ │ ├── StrongStrength.tsx
│ │ │ │ ├── SubscriptionTick1.tsx
│ │ │ │ ├── TrashCan.tsx
│ │ │ │ ├── TriangleExclamation.tsx
│ │ │ │ ├── TriangleExclamationFilled.tsx
│ │ │ │ ├── WeakStrength.tsx
│ │ │ │ ├── Wrench.tsx
│ │ │ │ └── index.tsx
│ │ │ ├── constants.tsx
│ │ │ ├── index.tsx
│ │ │ └── types.tsx
│ │ ├── index.ts
│ │ ├── modules.d.ts
│ │ ├── router.tsx
│ │ ├── static
│ │ │ ├── fonts.css
│ │ │ ├── fonts
│ │ │ │ └── LightsparkIcons
│ │ │ │ │ ├── LightsparkIcons.eot
│ │ │ │ │ ├── LightsparkIcons.svg
│ │ │ │ │ ├── LightsparkIcons.ttf
│ │ │ │ │ ├── LightsparkIcons.woff
│ │ │ │ │ ├── README.md
│ │ │ │ │ └── glyph-svg-src
│ │ │ │ │ ├── btc.svg
│ │ │ │ │ ├── margin-btc.svg
│ │ │ │ │ ├── margin-sats.svg
│ │ │ │ │ └── sats.svg
│ │ │ └── images
│ │ │ │ ├── Checkmark.svg
│ │ │ │ ├── FramedLogoOnCircle.svg
│ │ │ │ ├── Logo.svg
│ │ │ │ ├── LogoMark.svg
│ │ │ │ ├── RainLogo.png
│ │ │ │ ├── RotatedElipseGradient-2x.png
│ │ │ │ ├── RotatedElipseGradient.png
│ │ │ │ ├── UmaLogoQRCode.svg
│ │ │ │ └── country-flags
│ │ │ │ └── us.svg
│ │ ├── styles
│ │ │ ├── breakpoints.tsx
│ │ │ ├── colors.tsx
│ │ │ ├── common.tsx
│ │ │ ├── constants.ts
│ │ │ ├── fields.tsx
│ │ │ ├── global.tsx
│ │ │ ├── themeDefaults
│ │ │ │ ├── buttons.tsx
│ │ │ │ ├── cardForm.tsx
│ │ │ │ └── loading.tsx
│ │ │ ├── themes.tsx
│ │ │ ├── tokens
│ │ │ │ ├── spacing.tsx
│ │ │ │ └── typography.ts
│ │ │ ├── type.tsx
│ │ │ ├── typography.tsx
│ │ │ ├── utils.tsx
│ │ │ └── z-index.tsx
│ │ ├── types
│ │ │ ├── index.ts
│ │ │ └── typeGuard.tsx
│ │ └── utils
│ │ │ ├── NextLink.tsx
│ │ │ ├── countryCodesToNames.tsx
│ │ │ ├── emotion.tsx
│ │ │ ├── getGQLOperationName.tsx
│ │ │ ├── index.ts
│ │ │ ├── isReactNodeWithChildren.tsx
│ │ │ ├── locale.ts
│ │ │ ├── parseURLFragments.ts
│ │ │ ├── strings.tsx
│ │ │ ├── toReactNodes
│ │ │ ├── nodes.tsx
│ │ │ ├── setReactNodesTypography.tsx
│ │ │ ├── stringToNodes.tsx
│ │ │ └── toReactNodes.tsx
│ │ │ ├── transformGQLName.tsx
│ │ │ └── unicode.tsx
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ └── turbo.json
└── vite
│ ├── CHANGELOG.md
│ ├── index.cjs
│ └── package.json
├── start.sh
├── turbo.json
└── yarn.lock
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "public",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | **/node_modules/
3 | **/dist/
4 | Dockerfile
--------------------------------------------------------------------------------
/.fossa.yml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
3 | project:
4 | id: lightspark/js-sdk
5 | name: js-sdk
6 | url: https://github.com/lightsparkdev/js-sdk
7 |
8 | paths:
9 | exclude:
10 | - ./node_modules
11 | - ./packages
12 | - ./apps
13 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @lightsparkdev/js
--------------------------------------------------------------------------------
/.github/workflows/runEnsureReleasePR.mjs:
--------------------------------------------------------------------------------
1 | import { Octokit, App } from "octokit";
2 | import { createActionAuth } from "@octokit/auth-action";
3 | import { ensureReleasePR } from "./ensureReleasePR.mjs";
4 |
5 | const auth = createActionAuth();
6 | const authentication = await auth();
7 |
8 | const github = new Octokit({
9 | authStrategy: createActionAuth,
10 | auth: authentication,
11 | });
12 |
13 | const ref = process.env.GITHUB_REF;
14 | const pr = await ensureReleasePR({ github, ref, base: "main" });
15 | process.stdout.write(`Release PR number: ${pr.number}`);
16 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | v18
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist/
2 | build/
3 | docs/
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "prettier.prettierPath": "./node_modules/prettier/index.cjs",
3 | "eslint.workingDirectories": [
4 | { "pattern": "./apps/*/" },
5 | { "pattern": "./apps/examples/*/" },
6 | { "pattern": "./apps/private/*/" },
7 | { "pattern": "./packages/*/" },
8 | { "pattern": "./packages/private/*/" }
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/.yarnrc.yml:
--------------------------------------------------------------------------------
1 | compressionLevel: mixed
2 |
3 | enableGlobalCache: false
4 |
5 | nodeLinker: node-modules
6 |
7 | yarnPath: .yarn/releases/yarn-4.5.0.cjs
8 |
--------------------------------------------------------------------------------
/apps/examples/README.md:
--------------------------------------------------------------------------------
1 | # Lightspark example apps
2 |
3 | Please follow the [instructions](https://github.com/lightsparkdev/js-sdk#running-the-sdks-and-examples) on setting up the js-sdk workspace to run these examples locally. Additional instructions are included in the each example's README.
4 |
--------------------------------------------------------------------------------
/apps/examples/nodejs-scripts/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/base"],
3 | };
4 |
--------------------------------------------------------------------------------
/apps/examples/nodejs-scripts/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/examples/nodejs-scripts/README.md:
--------------------------------------------------------------------------------
1 | # Node Scripts
2 |
3 | These test scripts are meant to be run using the `ts-node` command. First run `yarn` to resolve workspace dependencies. Then you can run scripts! For example:
4 |
5 | ```bash
6 | yarn ts-node getWalletDashboard.ts
7 | ```
8 |
9 | If you ran this without setting any environment variables, you probably got an error! The lightspark-wallet cli (@lightsparkdev/wallet-cli) can help you get things set up!
10 |
11 | ## Other scripts
12 |
13 | Once your environment is configured, you can run other scripts in this directory using ts-node. For example:
14 |
15 | ```bash
16 | yarn ts-node getWalletDashboard.ts
17 | ```
18 |
19 | Or the full example script:
20 |
21 | ```bash
22 | yarn ts-node example.ts
23 | ```
24 |
--------------------------------------------------------------------------------
/apps/examples/nodejs-scripts/jest.config.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: "ts-jest/presets/default-esm",
4 | testEnvironment: "node",
5 | extensionsToTreatAsEsm: [".ts"],
6 | testMatch: ["**/tests/**/*.test.(ts|cjs)"],
7 | bail: 1,
8 | moduleNameMapper: {
9 | "^(\\.{1,2}/.*)\\.js$": "$1",
10 | },
11 | transform: {
12 | "^.+\\.tsx?$": [
13 | "ts-jest",
14 | {
15 | tsconfig: "tsconfig-test.json",
16 | useESM: true,
17 | },
18 | ],
19 | },
20 | };
21 |
--------------------------------------------------------------------------------
/apps/examples/nodejs-scripts/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "types": ["jest", "node"]
5 | },
6 | "include": ["src/**/*"],
7 | "exclude": ["node_modules", "dist"]
8 | }
9 |
--------------------------------------------------------------------------------
/apps/examples/nodejs-scripts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../packages/tsconfig/ts-node-app.json",
3 | "compilerOptions": {
4 | "noEmit": true
5 | },
6 | "exclude": ["**/tests", "node_modules", "dist"],
7 | "include": ["src/**/*"]
8 | }
9 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/react-app"],
3 | };
4 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/.gitignore:
--------------------------------------------------------------------------------
1 | *.local
--------------------------------------------------------------------------------
/apps/examples/oauth-app/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/android-chrome-192x192.png
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/android-chrome-512x512.png
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/favicon-16x16.png
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/favicon-32x32.png
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/favicon-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/favicon-48x48.png
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/oauth-app/public/favicon.ico
--------------------------------------------------------------------------------
/apps/examples/oauth-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | display: flex;
3 | max-width: 100%;
4 | flex-direction: column;
5 | align-items: center;
6 | position: relative;
7 | }
8 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import "./App.css";
3 | import AuthProvider from "./auth/AuthProvider";
4 | import LightsparkClientProvider from "./lightsparkclient/LightsparkClientProvider";
5 |
6 | function App(props: { children: React.ReactNode }) {
7 | return (
8 |
9 |
10 | {props.children}
11 |
12 |
13 | );
14 | }
15 |
16 | export default App;
17 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/Root.tsx:
--------------------------------------------------------------------------------
1 | import { Route, Routes as RouterRoutes } from "react-router-dom";
2 | import { Routes } from "./routes";
3 | import DashboardPage from "./pages/DashboardPage";
4 | import LoginPage from "./pages/LoginPage";
5 |
6 | export function Root() {
7 | return (
8 |
9 | } />
10 | } />
11 | } />
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/auth/AuthContext.ts:
--------------------------------------------------------------------------------
1 | interface AuthContextType {
2 | signin: (callback: VoidFunction) => void;
3 | signout: () => Promise;
4 | checkAuth: () => Promise;
5 | isAuthorized: () => boolean;
6 | }
7 |
8 | export default AuthContextType;
9 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/components/Table.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export const Table = styled.table`
4 | width: 100%;
5 | border-collapse: collapse;
6 | `;
7 |
8 | export const Th = styled.th`
9 | text-align: left;
10 | padding: 8px;
11 | border-bottom: 2px solid #ddd;
12 | color: #2196f3;
13 | `;
14 |
15 | export const Td = styled.td`
16 | text-align: left;
17 | padding: 8px;
18 | `;
19 |
20 | export const Tr = styled.tr`
21 | border-bottom: 1px solid #ddd;
22 | `;
23 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/lightsparkclient/LightsparkClientContext.ts:
--------------------------------------------------------------------------------
1 | import { type AuthProvider } from "@lightsparkdev/core";
2 | import { type LightsparkClient } from "@lightsparkdev/lightspark-sdk";
3 |
4 | interface LightsparkClientContextType {
5 | getClient: () => LightsparkClient;
6 | setAuthProvider: (provider: AuthProvider) => void;
7 | isAuthenticated: () => Promise;
8 | }
9 |
10 | export default LightsparkClientContextType;
11 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | import { type ReportHandler } from "web-vitals";
2 |
3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4 | if (onPerfEntry && onPerfEntry instanceof Function) {
5 | import("web-vitals")
6 | .then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
7 | getCLS(onPerfEntry);
8 | getFID(onPerfEntry);
9 | getFCP(onPerfEntry);
10 | getLCP(onPerfEntry);
11 | getTTFB(onPerfEntry);
12 | })
13 | .catch((err) => console.error("Error importing web-vitals", err));
14 | }
15 | };
16 |
17 | export default reportWebVitals;
18 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/src/routes.tsx:
--------------------------------------------------------------------------------
1 | export const Routes = {
2 | Base: "/",
3 | Login: "/login",
4 | Oauth: "/oauth",
5 | } as const;
6 |
7 | export type RoutesMapType = typeof Routes;
8 | export type RoutesType = (typeof Routes)[keyof typeof Routes];
9 | export type RouteNames = keyof typeof Routes;
10 |
11 | /* Keep these - see LIG-5374 */
12 | declare global {
13 | interface NewRoutes extends RoutesMapType {}
14 | }
15 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@lightsparkdev/tsconfig/react-app.json",
3 | "compilerOptions": {
4 | "baseUrl": "src",
5 | "paths": {
6 | "src/*": ["./*"]
7 | },
8 | "types": ["node", "vite/client"]
9 | },
10 | "include": ["src/**/*"],
11 | "exclude": ["node_modules"]
12 | }
13 |
--------------------------------------------------------------------------------
/apps/examples/oauth-app/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { buildConfig } from "@lightsparkdev/vite";
2 | import settings from "../settings.json";
3 |
4 | export default buildConfig({
5 | port: settings.oauthApp.port,
6 | dirname: __dirname,
7 | });
8 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/base"],
3 | };
4 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/jest.config.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: "ts-jest/presets/default-esm",
4 | testEnvironment: "node",
5 | extensionsToTreatAsEsm: [".ts"],
6 | moduleNameMapper: {
7 | "^(\\.{1,2}/.*)\\.js$": "$1",
8 | },
9 | transform: {
10 | "^.+\\.tsx?$": [
11 | "ts-jest",
12 | {
13 | tsconfig: "tsconfig-test.json",
14 | useESM: true,
15 | },
16 | ],
17 | },
18 | };
19 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/src/startServer.ts:
--------------------------------------------------------------------------------
1 | import settings from "../../settings.json" assert { type: "json" };
2 | import { app } from "./index.js";
3 |
4 | app.listen(settings.remoteSigningServer.port, () => {
5 | console.log(
6 | `Server started on http://localhost:${settings.remoteSigningServer.port}`,
7 | );
8 | });
9 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/test.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # Test secrets:
4 | RK_WEBHOOK_SECRET="39kyJO140v7fYkwHnR7jz8Y3UphqVeNYQk44Xx049ws"
5 | RK_MASTER_SEED_HEX="1a6deac8f74fb2e332677e3f4833b5e962f80d153fb368b8ee322a9caca4113d56cccd88f1c6a74e152669d8cd373fee2f27e3645d80de27640177a8c71395f8"
6 |
7 | if [ "$1" == "test" ]; then
8 | TEST_CMD="node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail"
9 | elif [ "$1" == "start" ]; then
10 | TEST_CMD="yarn start"
11 | else
12 | exit 1
13 | fi
14 |
15 | # Run tests or start test server with test secrets
16 | RK_WEBHOOK_SECRET=$RK_WEBHOOK_SECRET RK_MASTER_SEED_HEX=$RK_MASTER_SEED_HEX $TEST_CMD
17 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "types": ["jest", "node"]
5 | },
6 | "include": ["server.test.ts"],
7 | "exclude": ["node_modules"]
8 | }
9 |
--------------------------------------------------------------------------------
/apps/examples/remote-signing-server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../packages/tsconfig/ts-node-app.json",
3 | "compilerOptions": {
4 | "noEmit": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/apps/examples/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "reactWalletApp": {
3 | "port": 3100
4 | },
5 | "oauthApp": {
6 | "port": 3102
7 | },
8 | "remoteSigningServer": {
9 | "port": 3103
10 | },
11 | "umaVasp": {
12 | "port": 3104
13 | },
14 | "uiTestApp": {
15 | "port": 3105
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/.prettierignore:
--------------------------------------------------------------------------------
1 | src/generated/
2 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/gql-codegen.yml:
--------------------------------------------------------------------------------
1 | overwrite: true
2 | schema: ["../../../../sparkcore/graphql_schemas/first_party_schema.graphql"]
3 | documents: ["src/**/*.tsx"]
4 | generates:
5 | src/generated/graphql.tsx:
6 | plugins:
7 | - "typescript"
8 | - "typescript-operations"
9 | - "typescript-react-apollo"
10 | config:
11 | nonOptionalTypename: true
12 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/jest/setup.ts:
--------------------------------------------------------------------------------
1 | /* Import node libs to polyfill browser objects */
2 | import crypto from "crypto";
3 | import ResizeObserver from "resize-observer-polyfill";
4 |
5 | import { TextDecoder, TextEncoder } from "util";
6 |
7 | Object.defineProperties(global.self, {
8 | crypto: {
9 | value: {
10 | getRandomValues: (arr: NodeJS.ArrayBufferView) =>
11 | crypto.randomFillSync(arr),
12 | subtle: crypto.webcrypto.subtle,
13 | },
14 | },
15 | TextEncoder: {
16 | value: TextEncoder,
17 | },
18 | TextDecoder: {
19 | value: TextDecoder,
20 | },
21 | });
22 |
23 | global.ResizeObserver = ResizeObserver;
24 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/jest/setupAfterEnv.ts:
--------------------------------------------------------------------------------
1 | import "@testing-library/jest-dom";
2 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/ui-test-app/public/android-chrome-192x192.png
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/ui-test-app/public/android-chrome-512x512.png
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/ui-test-app/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/ui-test-app/public/favicon-16x16.png
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/ui-test-app/public/favicon-32x32.png
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/apps/examples/ui-test-app/public/favicon.ico
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/src/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 | import React from "react";
3 | import ReactDOM from "react-dom/client";
4 | import { Root } from "./Root";
5 |
6 | function init() {
7 | const root = ReactDOM.createRoot(
8 | document.getElementById("root") as HTMLElement,
9 | );
10 |
11 | root.render(
12 |
13 |
14 | ,
15 | );
16 | }
17 |
18 | init();
19 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/src/tests/render.tsx:
--------------------------------------------------------------------------------
1 | import { ThemeProvider } from "@emotion/react";
2 | import { themes } from "@lightsparkdev/ui/styles/themes";
3 | import { render as tlRender } from "@testing-library/react";
4 | import type { ReactElement, ReactNode } from "react";
5 |
6 | function Providers({ children }: { children: ReactNode }) {
7 | return {children};
8 | }
9 |
10 | export function render(renderElement: ReactElement) {
11 | return tlRender(renderElement, {
12 | wrapper: Providers,
13 | });
14 | }
15 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/src/types.ts:
--------------------------------------------------------------------------------
1 | export enum TestAppRoutes {
2 | PageOne = "/test-app-page-one",
3 | PageTwo = "/test-app-page-two",
4 | }
5 |
6 | type TestAppRoutesType = typeof TestAppRoutes;
7 |
8 | declare global {
9 | interface NewRoutes extends TestAppRoutesType {}
10 | }
11 |
12 | export {};
13 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "resolveJsonModule": true,
5 | "moduleResolution": "bundler",
6 | "types": ["jest", "@testing-library/jest-dom", "node"]
7 | },
8 | "include": ["src/**/*"],
9 | "exclude": ["node_modules"]
10 | }
11 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../packages/tsconfig/react-app.json",
3 | "compilerOptions": {
4 | "baseUrl": "src",
5 | "types": ["node", "vite/client"]
6 | },
7 | "include": ["src/**/*"],
8 | "exclude": ["**/tests", "dist", "node_modules"]
9 | }
10 |
--------------------------------------------------------------------------------
/apps/examples/ui-test-app/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { buildConfig } from "@lightsparkdev/vite";
2 | import settings from "../settings.json";
3 |
4 | export default buildConfig({
5 | port: process.env.SITE_PORT || settings.uiTestApp.port,
6 | dirname: __dirname,
7 | proxyTarget: process.env.VITE_PROXY_TARGET || undefined,
8 | });
9 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp-cli/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/base"],
3 | };
4 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp-cli/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp-cli/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Validate that there are no CLI runtime errors. We've seen this happen with misconfigured module exports for example.
4 |
5 | yarn cli help;
6 |
7 | if [ $? -eq 0 ]; then
8 | echo "Verified that the CLI can run successfully";
9 | exit 0;
10 | else
11 | echo "Error occurred";
12 | exit 1;
13 | fi
14 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp-cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../packages/tsconfig/ts-node-app.json",
3 | "compilerOptions": {
4 | "outDir": "dist",
5 | "rootDir": "src"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/.gitignore:
--------------------------------------------------------------------------------
1 | local.env
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/jest.config.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: "ts-jest/presets/default-esm",
4 | testEnvironment: "node",
5 | extensionsToTreatAsEsm: [".ts"],
6 | moduleNameMapper: {
7 | "^(\\.{1,2}/.*)\\.js$": "$1",
8 | },
9 | testTimeout: 60_000,
10 | transform: {
11 | "^.+\\.tsx?$": [
12 | "ts-jest",
13 | {
14 | tsconfig: "tsconfig-test.json",
15 | useESM: true,
16 | },
17 | ],
18 | },
19 | };
20 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/src/PayerDataOptions.ts:
--------------------------------------------------------------------------------
1 | import { CounterPartyDataOptions } from "@uma-sdk/core";
2 |
3 | export const PAYER_DATA_OPTIONS: CounterPartyDataOptions = {
4 | identifier: { mandatory: true },
5 | name: { mandatory: false },
6 | email: { mandatory: false },
7 | compliance: { mandatory: true },
8 | };
9 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/src/User.ts:
--------------------------------------------------------------------------------
1 | import { KycStatus } from "@uma-sdk/core";
2 |
3 | export type User = {
4 | id: string;
5 | umaUserName: string;
6 | emailAddress: string | undefined;
7 | name: string | undefined;
8 | kycStatus: KycStatus;
9 | };
10 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/src/UserService.ts:
--------------------------------------------------------------------------------
1 | import { Currency } from "@uma-sdk/core";
2 | import { User } from "./User.js";
3 |
4 | export default interface UserService {
5 | getCallingUserFromRequest(
6 | fullUrl: URL,
7 | headers: { [key: string]: string | string[] | undefined },
8 | ): Promise;
9 | getUserByUma(umaAddress: string): Promise;
10 | getUserById(userId: string): Promise;
11 | getCurrencyPreferencesForUser(
12 | userId: string,
13 | ): Promise;
14 | getReceivableMsatsRangeForUser(userId: string): Promise<[number, number]>;
15 | }
16 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/src/errors.ts:
--------------------------------------------------------------------------------
1 | export const errorMessage = (message: string) => {
2 | return { status: "ERROR", reason: message };
3 | };
4 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/src/hex.ts:
--------------------------------------------------------------------------------
1 | export const hexToBytes = (hex: string): Uint8Array => {
2 | const buffer = Buffer.from(hex, "hex");
3 | return new Uint8Array(buffer);
4 | };
5 |
6 | export const bytesToHex = (bytes: Uint8Array): string => {
7 | return Array.from(bytes)
8 | .map((b) => b.toString(16).padStart(2, "0"))
9 | .join("");
10 | };
11 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/src/networking/HttpResponse.ts:
--------------------------------------------------------------------------------
1 | export type HttpResponse = {
2 | httpStatus: number;
3 | data?: any;
4 | };
5 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "types": ["jest", "node"]
5 | },
6 | "include": ["src/**/*"],
7 | "exclude": ["node_modules"]
8 | }
9 |
--------------------------------------------------------------------------------
/apps/examples/uma-vasp/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../packages/tsconfig/ts-node-app.json",
3 | "compilerOptions": {
4 | "types": ["node"],
5 | "outDir": "dist"
6 | },
7 | "exclude": ["test", "node_modules", "dist"],
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/clean-all.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | yarn clean
4 | find . -type d -name "node_modules" -exec rm -rf {} +
5 | find . -type d -name ".turbo" -exec rm -rf {} +
6 | find . -type f -name "install-state.gz" -exec rm -rf {} +
--------------------------------------------------------------------------------
/packages/core/.attw.json:
--------------------------------------------------------------------------------
1 | {
2 | "profile": "node16"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/core/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/base"],
3 | };
4 |
--------------------------------------------------------------------------------
/packages/core/.fossa.yml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
3 | project:
4 | id: lightspark/js-core-sdk
5 | name: js-core-sdk
6 | url: https://github.com/lightsparkdev/js-sdk
7 |
--------------------------------------------------------------------------------
/packages/core/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/core/README.md:
--------------------------------------------------------------------------------
1 | # The Lightspark JS+TS Core package
2 |
3 | 
4 |
5 | This is the Lightspark Typescript Core package, which can be used either from a node or browser environment. The package contains core objects and utilities that are used by all Lightspark Typescript SDKs and may be useful for your project.
6 |
7 | ## Getting started
8 |
9 | To use the package, you'll need to install it from npm:
10 |
11 | ```bash
12 | $ npm install @lightsparkdev/core
13 | ```
14 |
15 | TODO
16 |
--------------------------------------------------------------------------------
/packages/core/jest.config.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: "ts-jest/presets/default-esm",
4 | testEnvironment: "node",
5 | extensionsToTreatAsEsm: [".ts"],
6 | moduleNameMapper: {
7 | "^(\\.{1,2}/.*)\\.js$": "$1",
8 | },
9 | transform: {
10 | "^.+\\.tsx?$": [
11 | "ts-jest",
12 | {
13 | tsconfig: "tsconfig-test.json",
14 | useESM: true,
15 | },
16 | ],
17 | },
18 | };
19 |
--------------------------------------------------------------------------------
/packages/core/src/LightsparkException.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | class LightsparkException extends Error {
4 | code: string;
5 | message: string;
6 | extraInfo: Record | undefined;
7 |
8 | constructor(
9 | code: string,
10 | message: string,
11 | extraInfo?: Record,
12 | ) {
13 | super(message);
14 | this.code = code;
15 | this.message = message;
16 | this.extraInfo = extraInfo;
17 | }
18 | }
19 |
20 | export default LightsparkException;
21 |
--------------------------------------------------------------------------------
/packages/core/src/ServerEnvironment.ts:
--------------------------------------------------------------------------------
1 | enum ServerEnvironment {
2 | PRODUCTION = "production",
3 | DEV = "dev",
4 | }
5 |
6 | export const apiDomainForEnvironment = (
7 | environment: ServerEnvironment,
8 | ): string => {
9 | switch (environment) {
10 | case ServerEnvironment.DEV:
11 | return "api.dev.dev.sparkinfra.net";
12 | case ServerEnvironment.PRODUCTION:
13 | return "api.lightspark.com";
14 | }
15 | };
16 |
17 | export default ServerEnvironment;
18 |
--------------------------------------------------------------------------------
/packages/core/src/auth/AuthProvider.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export type Headers = Record;
4 | export type WsConnectionParams = Record;
5 |
6 | export default interface AuthProvider {
7 | addAuthHeaders(headers: Headers): Promise;
8 | isAuthorized(): Promise;
9 | addWsConnectionParams(
10 | params: WsConnectionParams,
11 | ): Promise;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core/src/auth/LightsparkAuthException.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import LightsparkException from "../LightsparkException.js";
4 |
5 | class LightsparkAuthException extends LightsparkException {
6 | constructor(message: string, extraInfo?: Record) {
7 | super("AuthException", message, extraInfo);
8 | }
9 | }
10 |
11 | export default LightsparkAuthException;
12 |
--------------------------------------------------------------------------------
/packages/core/src/auth/StubAuthProvider.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import type AuthProvider from "./AuthProvider.js";
4 | import { type Headers, type WsConnectionParams } from "./AuthProvider.js";
5 |
6 | export default class StubAuthProvider implements AuthProvider {
7 | addAuthHeaders(headers: Headers) {
8 | return Promise.resolve(headers);
9 | }
10 | isAuthorized(): Promise {
11 | return Promise.resolve(false);
12 | }
13 | addWsConnectionParams(params: WsConnectionParams) {
14 | return Promise.resolve(params);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/auth/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export { default as AuthProvider } from "./AuthProvider.js";
4 | export { default as LightsparkAuthException } from "./LightsparkAuthException.js";
5 | export { default as StubAuthProvider } from "./StubAuthProvider.js";
6 |
--------------------------------------------------------------------------------
/packages/core/src/constants/index.ts:
--------------------------------------------------------------------------------
1 | export const ConfigKeys = {
2 | LoggingEnabled: "lightspark-logging-enabled",
3 | ConsoleToolsEnabled: "lightspark-console-tools-enabled",
4 | } as const;
5 | export type ConfigKeys = (typeof ConfigKeys)[keyof typeof ConfigKeys];
6 |
--------------------------------------------------------------------------------
/packages/core/src/crypto/KeyOrAlias.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | type OnlyKey = {
4 | key: string;
5 | alias?: never;
6 | };
7 |
8 | type OnlyAlias = {
9 | key?: never;
10 | alias: string;
11 | };
12 |
13 | export type KeyOrAliasType = OnlyKey | OnlyAlias;
14 |
15 | export const KeyOrAlias = {
16 | key: (key: string): OnlyKey => ({ key }),
17 | alias: (alias: string): OnlyAlias => ({ alias }),
18 | };
19 |
--------------------------------------------------------------------------------
/packages/core/src/crypto/LightsparkSigningException.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import LightsparkException from "../LightsparkException.js";
4 |
5 | class LightsparkSigningException extends LightsparkException {
6 | constructor(message: string, extraInfo?: Record) {
7 | super("SigningException", message, extraInfo);
8 | }
9 | }
10 |
11 | export default LightsparkSigningException;
12 |
--------------------------------------------------------------------------------
/packages/core/src/crypto/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export * from "./crypto.js";
4 | export * from "./KeyOrAlias.js";
5 | export { default as LightsparkSigningException } from "./LightsparkSigningException.js";
6 | export { default as NodeKeyCache } from "./NodeKeyCache.js";
7 | export * from "./SigningKey.js";
8 | export * from "./types.js";
9 |
--------------------------------------------------------------------------------
/packages/core/src/crypto/types.ts:
--------------------------------------------------------------------------------
1 | export enum SigningKeyType {
2 | RSASigningKey = "RSASigningKey",
3 | Secp256k1SigningKey = "Secp256k1SigningKey",
4 | }
5 |
--------------------------------------------------------------------------------
/packages/core/src/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export * from "./auth/index.js";
4 | export * from "./constants/index.js";
5 | export * from "./crypto/index.js";
6 | export { default as LightsparkException } from "./LightsparkException.js";
7 | export { Logger, LoggingLevel, logger } from "./Logger.js";
8 | export * from "./requester/index.js";
9 | export {
10 | default as ServerEnvironment,
11 | apiDomainForEnvironment,
12 | } from "./ServerEnvironment.js";
13 | export * from "./utils/index.js";
14 |
--------------------------------------------------------------------------------
/packages/core/src/requester/Query.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | type Query = {
4 | /** The string representation of the query payload for graphQL. **/
5 | queryPayload: string;
6 |
7 | /** The variables that will be passed to the query. **/
8 | variables?: { [key: string]: unknown };
9 |
10 | /**
11 | * The function that will be called to construct the object from the
12 | * response. *
13 | */
14 | constructObject: (rawData: any) => T | null; // eslint-disable-line @typescript-eslint/no-explicit-any -- LIG-3400
15 |
16 | /** The id of the node that will be used to sign the query. **/
17 | signingNodeId?: string;
18 |
19 | /** True if auth headers should be omitted for this query. **/
20 | skipAuth?: boolean;
21 | };
22 |
23 | export default Query;
24 |
--------------------------------------------------------------------------------
/packages/core/src/requester/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export { default as Query } from "./Query.js";
4 | export { default as Requester } from "./Requester.js";
5 |
--------------------------------------------------------------------------------
/packages/core/src/utils/arrays.ts:
--------------------------------------------------------------------------------
1 | export function ensureArray(value: T | T[]): T[] {
2 | return Array.isArray(value) ? value : [value];
3 | }
4 |
--------------------------------------------------------------------------------
/packages/core/src/utils/environment.ts:
--------------------------------------------------------------------------------
1 | export const isBrowser =
2 | typeof window !== "undefined" && typeof window.document !== "undefined";
3 |
4 | export const isNode =
5 | typeof process !== "undefined" &&
6 | process.versions != null &&
7 | process.versions.node != null;
8 |
9 | export const isTest = isNode && process.env.NODE_ENV === "test";
10 |
--------------------------------------------------------------------------------
/packages/core/src/utils/hex.ts:
--------------------------------------------------------------------------------
1 | export const bytesToHex = (bytes: Uint8Array): string => {
2 | return bytes.reduce((acc: string, byte: number) => {
3 | return (acc += ("0" + byte.toString(16)).slice(-2));
4 | }, "");
5 | };
6 |
7 | export const hexToBytes = (hex: string): Uint8Array => {
8 | const bytes: number[] = [];
9 |
10 | for (let c = 0; c < hex.length; c += 2) {
11 | bytes.push(parseInt(hex.substr(c, 2), 16));
12 | }
13 |
14 | return Uint8Array.from(bytes);
15 | };
16 |
--------------------------------------------------------------------------------
/packages/core/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export * from "./arrays.js";
4 | export * from "./base64.js";
5 | export * from "./createHash.js";
6 | export * from "./currency.js";
7 | export * from "./environment.js";
8 | export * from "./errors.js";
9 | export * from "./hex.js";
10 | export * from "./locale.js";
11 | export * from "./localeToCurrencyCodes.js";
12 | export * from "./localStorage.js";
13 | export * from "./numbers.js";
14 | export * from "./pollUntil.js";
15 | export * from "./sleep.js";
16 | export * from "./strings.js";
17 | export * from "./typeGuards.js";
18 | export * from "./types.js";
19 |
--------------------------------------------------------------------------------
/packages/core/src/utils/locale.ts:
--------------------------------------------------------------------------------
1 | /* locale utils for both NodeJS and browser contexts */
2 |
3 | export function getCurrentLocale() {
4 | return Intl.NumberFormat().resolvedOptions().locale;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/core/src/utils/sleep.ts:
--------------------------------------------------------------------------------
1 | export function sleep(ms: number) {
2 | return new Promise((resolve) => setTimeout(resolve, ms));
3 | }
4 |
--------------------------------------------------------------------------------
/packages/core/src/utils/strings.ts:
--------------------------------------------------------------------------------
1 | export function lsidToUUID(lsid: string) {
2 | return lsid.replace(/^[^:]+:(.*)$/, "$1");
3 | }
4 |
--------------------------------------------------------------------------------
/packages/core/src/utils/typeGuards.ts:
--------------------------------------------------------------------------------
1 | export function isUint8Array(value: unknown): value is Uint8Array {
2 | return value instanceof Uint8Array;
3 | }
4 |
5 | export function isObject(value: unknown): value is object {
6 | const type = typeof value;
7 | return value != null && (type == "object" || type == "function");
8 | }
9 |
10 | export function isRecord(value: unknown): value is Record {
11 | return (
12 | typeof value === "object" &&
13 | value !== null &&
14 | !Array.isArray(value) &&
15 | Object.prototype.toString.call(value) === "[object Object]"
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "resolveJsonModule": true,
5 | "moduleResolution": "node",
6 | "types": ["jest", "node"]
7 | },
8 | "include": ["src/**/*"],
9 | "exclude": ["node_modules"]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/core/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig/base.json",
3 | "include": ["src", "src/crypto/types.ts"],
4 | "exclude": ["**/tests", "node_modules", "dist"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/core/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "tsup";
2 |
3 | export default defineConfig({
4 | entry: ["src/index.ts", "src/utils/index.ts"],
5 | format: ["cjs", "esm"],
6 | dts: true,
7 | clean: true,
8 | });
9 |
--------------------------------------------------------------------------------
/packages/core/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["//"],
3 | "tasks": {
4 | "package:checks": {
5 | "dependsOn": ["build"]
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/crypto-wasm/crypto_bg.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/crypto-wasm/crypto_bg.wasm
--------------------------------------------------------------------------------
/packages/crypto-wasm/jest.config.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: "ts-jest/presets/default-esm",
4 | testEnvironment: "node",
5 | extensionsToTreatAsEsm: [".ts"],
6 | moduleNameMapper: {
7 | "^(\\.{1,2}/.*)\\.js$": "$1",
8 | },
9 | transform: {
10 | "^.+\\.tsx?$": [
11 | "ts-jest",
12 | {
13 | tsconfig: "tsconfig-test.json",
14 | useESM: true,
15 | },
16 | ],
17 | },
18 | };
19 |
--------------------------------------------------------------------------------
/packages/crypto-wasm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@lightsparkdev/crypto-wasm",
3 | "version": "0.1.15",
4 | "type": "module",
5 | "files": [
6 | "crypto_bg.wasm",
7 | "crypto.js",
8 | "crypto.d.ts"
9 | ],
10 | "scripts": {
11 | "sync": "./sync.sh",
12 | "test": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail"
13 | },
14 | "dependencies": {
15 | "@lightsparkdev/core": "1.4.1"
16 | },
17 | "devDependencies": {
18 | "jest": "^29.6.2",
19 | "ts-jest": "^29.1.1",
20 | "typescript": "^5.6.2"
21 | },
22 | "main": "crypto.cjs",
23 | "types": "crypto.d.ts",
24 | "engines": {
25 | "node": ">=18"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/packages/crypto-wasm/sync.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../../../../lightspark-crypto-uniffi
4 | wasm-pack build --target nodejs --out-name crypto
5 |
6 | wasm_files[0]="crypto.d.ts"
7 | wasm_files[1]="crypto.js"
8 | wasm_files[2]="crypto_bg.wasm"
9 | wasm_files[3]="crypto_bg.wasm.d.ts"
10 |
11 | destination="../webdev/js/packages/crypto-wasm/"
12 |
13 | for i in ${wasm_files[@]}; do
14 | if [ "$i" == "crypto.js" ]; then
15 | # rename for proper cjs exports:
16 | yes | cp -rf "./pkg/$i" "${destination}crypto.cjs"
17 | else
18 | yes | cp -rf "./pkg/$i" "${destination}$i"
19 | fi
20 | done
21 |
--------------------------------------------------------------------------------
/packages/crypto-wasm/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "resolveJsonModule": true,
4 | "types": ["jest", "node"],
5 | "esModuleInterop": true,
6 | "moduleResolution": "node16"
7 | },
8 | "include": ["test/**/*"],
9 | "exclude": ["node_modules"]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/eslint-config/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @lightsparkdev/eslint-config
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - 062bf8a: [js] Add engines field to all packages to indicate supported NodeJS versions
8 |
--------------------------------------------------------------------------------
/packages/eslint-config/constants/react-restricted-imports.js:
--------------------------------------------------------------------------------
1 | const restrictedImportPaths = [
2 | {
3 | importNames: ["isApolloError"],
4 | message: "Please use the import from utils/errors instead.",
5 | name: "@apollo/client",
6 | },
7 | {
8 | importNames: ["useWhatChanged"],
9 | message: "This is for use in local development only.",
10 | name: "@simbathesailor/use-what-changed",
11 | },
12 | ];
13 |
14 | module.exports = {
15 | restrictedImportPaths,
16 | };
17 |
--------------------------------------------------------------------------------
/packages/lightspark-cli/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/base"],
3 | overrides: [
4 | {
5 | files: ["**/*.ts?(x)"],
6 | excludedFiles: ["**/tests/**/*.ts?(x)"],
7 | rules: {
8 | /* Too many of these type-aware errors, turn off for now - revisit after docs migration: */
9 | "@typescript-eslint/no-unsafe-assignment": "off",
10 | "@typescript-eslint/no-unsafe-argument": "off",
11 | },
12 | },
13 | ],
14 | };
15 |
--------------------------------------------------------------------------------
/packages/lightspark-cli/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/lightspark-cli/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Validate that there are no CLI runtime errors. We've seen this happen with misconfigured module exports for example.
4 |
5 | yarn cli help;
6 |
7 | if [ $? -eq 0 ]; then
8 | echo "Verified that the CLI can run successfully";
9 | exit 0;
10 | else
11 | echo "Error occurred";
12 | exit 1;
13 | fi
14 |
--------------------------------------------------------------------------------
/packages/lightspark-cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig/ts-node-app.json",
3 | "compilerOptions": {
4 | "outDir": "dist",
5 | "rootDir": "src"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/.attw.json:
--------------------------------------------------------------------------------
1 | {
2 | "profile": "node16"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/.fossa.yml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
3 | project:
4 | id: lightspark/js-lightspark-sdk
5 | name: js-lightspark-sdk
6 | url: https://github.com/lightsparkdev/js-sdk
7 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/jest.config.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: "ts-jest/presets/default-esm",
4 | testEnvironment: "node",
5 | extensionsToTreatAsEsm: [".ts"],
6 | moduleNameMapper: {
7 | "^(\\.{1,2}/.*)\\.js$": "$1",
8 | },
9 | transform: {
10 | "^.+\\.tsx?$": [
11 | "ts-jest",
12 | {
13 | tsconfig: "tsconfig-test.json",
14 | useESM: true,
15 | },
16 | ],
17 | },
18 | };
19 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/auth/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export { default as AccountTokenAuthProvider } from "./AccountTokenAuthProvider.js";
4 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/BitcoinFeeEstimate.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as FeeEstimateFragment } from "../objects/FeeEstimate.js";
4 |
5 | export const BitcoinFeeEstimate = `
6 | query BitcoinFeeEstimate($bitcoin_network: BitcoinNetwork!) {
7 | bitcoin_fee_estimate(network: $bitcoin_network) {
8 | ...FeeEstimateFragment
9 | }
10 | }
11 |
12 | ${FeeEstimateFragment}
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CancelInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as InvoiceFragment } from "../objects/Invoice.js";
4 |
5 | export const CancelInvoice = `
6 | mutation CancelInvoice(
7 | $invoice_id: ID!
8 | ) {
9 | cancel_invoice(input: { invoice_id: $invoice_id }) {
10 | invoice {
11 | ...InvoiceFragment
12 | }
13 | }
14 | }
15 |
16 | ${InvoiceFragment}
17 | `;
18 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CancelUmaInvitation.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4 |
5 | export const CancelUmaInvitation = `
6 | mutation CancelUmaInvitation(
7 | $inviteCode: String!
8 | ) {
9 | cancel_uma_invitation(input: {
10 | invite_code: $inviteCode
11 | }) {
12 | invitation {
13 | ...UmaInvitationFragment
14 | }
15 | }
16 | }
17 |
18 | ${UmaInvitationFragment}
19 | `;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/ClaimUmaInvitation.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4 |
5 | export const ClaimUmaInvitation = `
6 | mutation ClaimUmaInvitation(
7 | $invitationCode: String!
8 | $inviteeUma: String!
9 | ) {
10 | claim_uma_invitation(input: {
11 | invitation_code: $invitationCode
12 | invitee_uma: $inviteeUma
13 | }) {
14 | invitation {
15 | ...UmaInvitationFragment
16 | }
17 | }
18 | }
19 |
20 | ${UmaInvitationFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateApiToken.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as ApiTokenFragment } from "../objects/ApiToken.js";
4 |
5 | export const CreateApiToken = `
6 | mutation CreateApiToken(
7 | $name: String!
8 | $permissions: [Permission!]!
9 | ) {
10 | create_api_token(input: {
11 | name: $name
12 | permissions: $permissions
13 | }) {
14 | api_token {
15 | ...ApiTokenFragment
16 | }
17 | client_secret
18 | }
19 | }
20 |
21 | ${ApiTokenFragment}
22 | `;
23 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const CreateInvoice = `
4 | mutation CreateInvoice(
5 | $node_id: ID!
6 | $amount_msats: Long!
7 | $memo: String
8 | $type: InvoiceType = null
9 | $expiry_secs: Int = null
10 | ) {
11 | create_invoice(input: { node_id: $node_id, amount_msats: $amount_msats, memo: $memo, invoice_type: $type, expiry_secs: $expiry_secs }) {
12 | invoice {
13 | data {
14 | encoded_payment_request
15 | }
16 | }
17 | }
18 | }
19 | `;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateLnurlInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 | import { FRAGMENT as InvoiceFragment } from "../objects/Invoice.js";
3 |
4 | export const CreateLnurlInvoice = `
5 | mutation CreateLnurlInvoice(
6 | $node_id: ID!
7 | $amount_msats: Long!
8 | $metadata_hash: String!
9 | $expiry_secs: Int = null
10 | ) {
11 | create_lnurl_invoice(input: {
12 | node_id: $node_id
13 | amount_msats: $amount_msats
14 | metadata_hash: $metadata_hash
15 | expiry_secs: $expiry_secs
16 | }) {
17 | invoice {
18 | ...InvoiceFragment
19 | }
20 | }
21 | }
22 | ${InvoiceFragment}
23 | `;
24 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateNodeWalletAddress.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const CreateNodeWalletAddress = `
4 | mutation CreateNodeWalletAddress(
5 | $node_id: ID!
6 | ) {
7 | create_node_wallet_address(input: {
8 | node_id: $node_id
9 | }) {
10 | wallet_address
11 | }
12 | }
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateOffer.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2025-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const CreateOffer = `
4 | mutation CreateOffer(
5 | $node_id: ID!
6 | $amount_msats: Long
7 | $description: String
8 | ) {
9 | create_offer(input: { node_id: $node_id, amount_msats: $amount_msats, description: $description }) {
10 | offer {
11 | encoded_offer
12 | }
13 | }
14 | }
15 | `;
16 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateTestModeInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const CreateTestModeInvoice = `
4 | mutation CreateTestModeInvoice(
5 | $local_node_id: ID!
6 | $amount_msats: Long!
7 | $memo: String
8 | $invoice_type: InvoiceType
9 | ) {
10 | create_test_mode_invoice(input: {
11 | local_node_id: $local_node_id
12 | amount_msats: $amount_msats
13 | memo: $memo
14 | invoice_type: $invoice_type
15 | }) {
16 | encoded_payment_request
17 | }
18 | }
19 | `;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateTestModePayment.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as IncomingPaymentFragment } from "../objects/IncomingPayment.js";
4 |
5 | export const CreateTestModePayment = `
6 | mutation CreateTestModePayment(
7 | $local_node_id: ID!
8 | $encoded_invoice: String!
9 | $amount_msats: Long
10 | ) {
11 | create_test_mode_payment(input: {
12 | local_node_id: $local_node_id
13 | encoded_invoice: $encoded_invoice
14 | amount_msats: $amount_msats
15 | }) {
16 | incoming_payment {
17 | ...IncomingPaymentFragment
18 | }
19 | }
20 | }
21 |
22 | ${IncomingPaymentFragment}
23 | `;
24 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateUmaInvitation.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4 |
5 | export const CreateUmaInvitation = `
6 | mutation CreateUmaInvitation(
7 | $inviterUma: String!
8 | ) {
9 | create_uma_invitation(input: {
10 | inviter_uma: $inviterUma
11 | }) {
12 | invitation {
13 | ...UmaInvitationFragment
14 | }
15 | }
16 | }
17 |
18 | ${UmaInvitationFragment}
19 | `;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateUmaInvitationWithIncentives.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4 |
5 | export const CreateUmaInvitationWithIncentives = `
6 | mutation CreateUmaInvitationWithIncentives(
7 | $inviterUma: String!
8 | $inviterPhoneHash: String!
9 | $inviterRegion: RegionCode!
10 | ) {
11 | create_uma_invitation_with_incentives(input: {
12 | inviter_uma: $inviterUma
13 | inviter_phone_hash: $inviterPhoneHash
14 | inviter_region: $inviterRegion
15 | }) {
16 | invitation {
17 | ...UmaInvitationFragment
18 | }
19 | }
20 | }
21 |
22 | ${UmaInvitationFragment}
23 | `;
24 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CreateUmaInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 | import { FRAGMENT as InvoiceFragment } from "../objects/Invoice.js";
3 |
4 | export const CreateUmaInvoice = `
5 | mutation CreateUmaInvoice(
6 | $node_id: ID!
7 | $amount_msats: Long!
8 | $metadata_hash: String!
9 | $expiry_secs: Int = null
10 | $receiver_hash: String = null
11 | ) {
12 | create_uma_invoice(input: {
13 | node_id: $node_id
14 | amount_msats: $amount_msats
15 | metadata_hash: $metadata_hash
16 | expiry_secs: $expiry_secs
17 | receiver_hash: $receiver_hash
18 | }) {
19 | invoice {
20 | ...InvoiceFragment
21 | }
22 | }
23 | }
24 | ${InvoiceFragment}
25 | `;
26 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/CurrentAccount.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as AccountFragment } from "../objects/Account.js";
4 |
5 | export const CurrentAccount = `
6 | query CurrentAccount {
7 | current_account {
8 | ...AccountFragment
9 | }
10 | }
11 |
12 | ${AccountFragment}
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/DecodeInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as InvoiceDataFragment } from "../objects/InvoiceData.js";
4 |
5 | export const DecodeInvoice = `
6 | query DecodeInvoice($encoded_payment_request: String!) {
7 | decoded_payment_request(encoded_payment_request: $encoded_payment_request) {
8 | __typename
9 | ... on InvoiceData {
10 | ...InvoiceDataFragment
11 | }
12 | }
13 | }
14 |
15 | ${InvoiceDataFragment}
16 | `;
17 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/DeleteApiToken.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const DeleteApiToken = `
4 | mutation DeleteApiToken(
5 | $api_token_id: ID!
6 | ) {
7 | delete_api_token(input: {
8 | api_token_id: $api_token_id
9 | }) {
10 | __typename
11 | }
12 | }
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/FetchUmaInvitation.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4 |
5 | export const FetchUmaInvitation = `
6 | query FetchUmaInvitation(
7 | $invitationCode: String!
8 | ) {
9 | uma_invitation_by_code(code: $invitationCode) {
10 | ...UmaInvitationFragment
11 | }
12 | }
13 |
14 | ${UmaInvitationFragment}
15 | `;
16 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/FundNode.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
4 |
5 | export const FundNode = `
6 | mutation FundNode(
7 | $node_id: ID!,
8 | $amount_sats: Long
9 | ) {
10 | fund_node(input: { node_id: $node_id, amount_sats: $amount_sats }) {
11 | amount {
12 | ...CurrencyAmountFragment
13 | }
14 | }
15 | }
16 |
17 | ${CurrencyAmountFragment}
18 | `;
19 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/IncomingPaymentsForInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as IncomingPaymentFragment } from "../objects/IncomingPayment.js";
4 |
5 | export const IncomingPaymentsForInvoice = `
6 | query IncomingPaymentsForInvoice(
7 | $invoice_id: ID!,
8 | $statuses: [TransactionStatus!]
9 | ) {
10 | incoming_payments_for_invoice(input: {
11 | invoice_id: $invoice_id
12 | statuses: $statuses
13 | }) {
14 | payments {
15 | ...IncomingPaymentFragment
16 | }
17 | }
18 | }
19 |
20 | ${IncomingPaymentFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/InvoiceForPaymentHash.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as InvoiceFragment } from "../objects/Invoice.js";
4 |
5 | export const InvoiceForPaymentHash = `
6 | query InvoiceForPaymentHash($payment_hash: Hash32!) {
7 | invoice_for_payment_hash(input: {
8 | payment_hash: $payment_hash
9 | }) {
10 | invoice {
11 | ...InvoiceFragment
12 | }
13 | }
14 | }
15 |
16 | ${InvoiceFragment}
17 | `;
18 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/LightningFeeEstimateForInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as LightningFeeEstimateFragment } from "../objects/LightningFeeEstimateOutput.js";
4 |
5 | export const LightningFeeEstimateForInvoice = `
6 | query LightningFeeEstimateForInvoice(
7 | $node_id: ID!
8 | $encoded_payment_request: String!
9 | $amount_msats: Long
10 | ) {
11 | lightning_fee_estimate_for_invoice(input: {
12 | node_id: $node_id,
13 | encoded_payment_request: $encoded_payment_request,
14 | amount_msats: $amount_msats
15 | }) {
16 | ...LightningFeeEstimateOutputFragment
17 | }
18 | }
19 |
20 | ${LightningFeeEstimateFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/LightningFeeEstimateForNode.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as LightningFeeEstimateFragment } from "../objects/LightningFeeEstimateOutput.js";
4 |
5 | export const LightningFeeEstimateForNode = `
6 | query LightningFeeEstimateForNode(
7 | $node_id: ID!
8 | $destination_node_public_key: String!
9 | $amount_msats: Long!
10 | ) {
11 | lightning_fee_estimate_for_node(input: {
12 | node_id: $node_id,
13 | destination_node_public_key: $destination_node_public_key,
14 | amount_msats: $amount_msats
15 | }) {
16 | ...LightningFeeEstimateOutputFragment
17 | }
18 | }
19 |
20 | ${LightningFeeEstimateFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/OutgoingPaymentsForInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4 |
5 | export const OutgoingPaymentsForInvoice = `
6 | query OutgoingPaymentsForInvoice(
7 | $encoded_invoice: Hash32!,
8 | $statuses: [TransactionStatus!]
9 | ) {
10 | outgoing_payments_for_invoice(input: {
11 | encoded_invoice: $encoded_invoice
12 | statuses: $statuses
13 | }) {
14 | payments {
15 | ...OutgoingPaymentFragment
16 | }
17 | }
18 | }
19 |
20 | ${OutgoingPaymentFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/OutgoingPaymentsForPaymentHash.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4 |
5 | export const OutgoingPaymentsForPaymentHash = `
6 | query OutgoingPaymentsForPaymentHash(
7 | $payment_hash: Hash32!
8 | $statuses: [TransactionStatus!]
9 | ) {
10 | outgoing_payments_for_payment_hash(input: {
11 | payment_hash: $payment_hash
12 | statuses: $statuses
13 | }) {
14 | payments {
15 | ...OutgoingPaymentFragment
16 | }
17 | }
18 | }
19 |
20 | ${OutgoingPaymentFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/PayInvoice.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4 |
5 | export const PayInvoice = `
6 | mutation PayInvoice(
7 | $node_id: ID!
8 | $encoded_invoice: String!
9 | $timeout_secs: Int!
10 | $maximum_fees_msats: Long!
11 | $amount_msats: Long
12 | ) {
13 | pay_invoice(
14 | input: {
15 | node_id: $node_id
16 | encoded_invoice: $encoded_invoice
17 | timeout_secs: $timeout_secs
18 | maximum_fees_msats: $maximum_fees_msats
19 | amount_msats: $amount_msats
20 | }
21 | ) {
22 | payment {
23 | ...OutgoingPaymentFragment
24 | }
25 | }
26 | }
27 |
28 | ${OutgoingPaymentFragment}
29 | `;
30 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/RecoverNodeSigningKey.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const RecoverNodeSigningKey = `
4 | query RecoverNodeSigningKey($nodeId: ID!) {
5 | entity(id: $nodeId) {
6 | __typename
7 | ... on LightsparkNodeWithOSK {
8 | encrypted_signing_private_key {
9 | encrypted_value
10 | cipher
11 | }
12 | }
13 | }
14 | }
15 | `;
16 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/RegisterPayment.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const RegisterPayment = `
4 | mutation RegisterPayment(
5 | $provider: ComplianceProvider!
6 | $payment_id: ID!
7 | $node_pubkey: String!
8 | $direction: PaymentDirection!
9 | ) {
10 | register_payment(input: {
11 | provider: $provider
12 | payment_id: $payment_id
13 | node_pubkey: $node_pubkey
14 | direction: $direction
15 | }) {
16 | payment {
17 | id
18 | }
19 | }
20 | }
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/RequestWithdrawal.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as WithdrawalRequestFragment } from "../objects/WithdrawalRequest.js";
4 |
5 | export const RequestWithdrawal = `
6 | mutation RequestWithdrawal(
7 | $node_id: ID!
8 | $bitcoin_address: String!
9 | $amount_sats: Long!
10 | $withdrawal_mode: WithdrawalMode!
11 | ) {
12 | request_withdrawal(input: {
13 | node_id: $node_id
14 | bitcoin_address: $bitcoin_address
15 | amount_sats: $amount_sats
16 | withdrawal_mode: $withdrawal_mode
17 | }) {
18 | request {
19 | ...WithdrawalRequestFragment
20 | }
21 | }
22 | }
23 |
24 | ${WithdrawalRequestFragment}
25 | `;
26 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/ScreenNode.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export const ScreenNode = `
4 | mutation ScreenNode(
5 | $provider: ComplianceProvider!
6 | $node_pubkey: String!
7 | ) {
8 | screen_node(input: {
9 | provider: $provider
10 | node_pubkey: $node_pubkey
11 | }) {
12 | rating
13 | }
14 | }
15 | `;
16 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/TransactionSubscription.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as TransactionUpdateFragment } from "../objects/TransactionUpdate.js";
4 |
5 | export const TransactionSubscription = `
6 | subscription TransactionSubscription(
7 | $nodeIds: [ID!]!
8 | ) {
9 | transactions(node_ids: $nodeIds) {
10 | ...TransactionUpdateFragment
11 | __typename
12 | }
13 | }
14 |
15 | ${TransactionUpdateFragment}
16 | `;
17 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/graphql/WithdrawalFeeEstimate.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { FRAGMENT as WithdrawalFeeEstimateOutputFragment } from "../objects/WithdrawalFeeEstimateOutput.js";
4 |
5 | export const WithdrawalFeeEstimate = `
6 | query WithdrawalFeeEstimate(
7 | $node_id: ID!
8 | $amount_sats: Long!
9 | $withdrawal_mode: WithdrawalMode!
10 | ) {
11 | withdrawal_fee_estimate(input: {
12 | node_id: $node_id,
13 | amount_sats: $amount_sats,
14 | withdrawal_mode: $withdrawal_mode
15 | }) {
16 | ...WithdrawalFeeEstimateOutputFragment
17 | }
18 | }
19 |
20 | ${WithdrawalFeeEstimateOutputFragment}
21 | `;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export * from "./auth/index.js";
4 | export { default as LightsparkClient } from "./client.js";
5 | export * from "./helpers.js";
6 | export * from "./objects/index.js";
7 | export * from "./webhooks.js";
8 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/logger.ts:
--------------------------------------------------------------------------------
1 | import { Logger } from "@lightsparkdev/core";
2 |
3 | export const logger = new Logger("@lightsparkdev/lightspark-sdk");
4 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/CancelInvoiceInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /**
4 | * The unique identifier of the Invoice that should be cancelled. The invoice is supposed to be
5 | * open, not settled and not expired. *
6 | */
7 | interface CancelInvoiceInput {
8 | invoiceId: string;
9 | }
10 |
11 | export const CancelInvoiceInputFromJson = (obj: any): CancelInvoiceInput => {
12 | return {
13 | invoiceId: obj["cancel_invoice_input_invoice_id"],
14 | } as CancelInvoiceInput;
15 | };
16 | export const CancelInvoiceInputToJson = (obj: CancelInvoiceInput): any => {
17 | return {
18 | cancel_invoice_input_invoice_id: obj.invoiceId,
19 | };
20 | };
21 |
22 | export default CancelInvoiceInput;
23 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/ComplianceProvider.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum identifying a type of compliance provider. **/
4 | export enum ComplianceProvider {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 |
11 | CHAINALYSIS = "CHAINALYSIS",
12 | }
13 |
14 | export default ComplianceProvider;
15 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/CreateInvoiceOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface CreateInvoiceOutput {
4 | invoiceId: string;
5 | }
6 |
7 | export const CreateInvoiceOutputFromJson = (obj: any): CreateInvoiceOutput => {
8 | return {
9 | invoiceId: obj["create_invoice_output_invoice"].id,
10 | } as CreateInvoiceOutput;
11 | };
12 | export const CreateInvoiceOutputToJson = (obj: CreateInvoiceOutput): any => {
13 | return {
14 | create_invoice_output_invoice: { id: obj.invoiceId },
15 | };
16 | };
17 |
18 | export const FRAGMENT = `
19 | fragment CreateInvoiceOutputFragment on CreateInvoiceOutput {
20 | __typename
21 | create_invoice_output_invoice: invoice {
22 | id
23 | }
24 | }`;
25 |
26 | export default CreateInvoiceOutput;
27 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/CreateNodeWalletAddressInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface CreateNodeWalletAddressInput {
4 | nodeId: string;
5 | }
6 |
7 | export const CreateNodeWalletAddressInputFromJson = (
8 | obj: any,
9 | ): CreateNodeWalletAddressInput => {
10 | return {
11 | nodeId: obj["create_node_wallet_address_input_node_id"],
12 | } as CreateNodeWalletAddressInput;
13 | };
14 | export const CreateNodeWalletAddressInputToJson = (
15 | obj: CreateNodeWalletAddressInput,
16 | ): any => {
17 | return {
18 | create_node_wallet_address_input_node_id: obj.nodeId,
19 | };
20 | };
21 |
22 | export default CreateNodeWalletAddressInput;
23 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/CreateOfferOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface CreateOfferOutput {
4 | offerId: string;
5 | }
6 |
7 | export const CreateOfferOutputFromJson = (obj: any): CreateOfferOutput => {
8 | return {
9 | offerId: obj["create_offer_output_offer"].id,
10 | } as CreateOfferOutput;
11 | };
12 | export const CreateOfferOutputToJson = (obj: CreateOfferOutput): any => {
13 | return {
14 | create_offer_output_offer: { id: obj.offerId },
15 | };
16 | };
17 |
18 | export const FRAGMENT = `
19 | fragment CreateOfferOutputFragment on CreateOfferOutput {
20 | __typename
21 | create_offer_output_offer: offer {
22 | id
23 | }
24 | }`;
25 |
26 | export default CreateOfferOutput;
27 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/CreateUmaInvitationInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface CreateUmaInvitationInput {
4 | /**
5 | * The UMA of the user creating the invitation. It will be used to identify the inviter when
6 | * receiving the invitation.
7 | **/
8 | inviterUma: string;
9 | }
10 |
11 | export const CreateUmaInvitationInputFromJson = (
12 | obj: any,
13 | ): CreateUmaInvitationInput => {
14 | return {
15 | inviterUma: obj["create_uma_invitation_input_inviter_uma"],
16 | } as CreateUmaInvitationInput;
17 | };
18 | export const CreateUmaInvitationInputToJson = (
19 | obj: CreateUmaInvitationInput,
20 | ): any => {
21 | return {
22 | create_uma_invitation_input_inviter_uma: obj.inviterUma,
23 | };
24 | };
25 |
26 | export default CreateUmaInvitationInput;
27 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/CurrencyAmountInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import CurrencyUnit from "./CurrencyUnit.js";
4 |
5 | interface CurrencyAmountInput {
6 | value: number;
7 |
8 | unit: CurrencyUnit;
9 | }
10 |
11 | export const CurrencyAmountInputFromJson = (obj: any): CurrencyAmountInput => {
12 | return {
13 | value: obj["currency_amount_input_value"],
14 | unit:
15 | CurrencyUnit[obj["currency_amount_input_unit"]] ??
16 | CurrencyUnit.FUTURE_VALUE,
17 | } as CurrencyAmountInput;
18 | };
19 | export const CurrencyAmountInputToJson = (obj: CurrencyAmountInput): any => {
20 | return {
21 | currency_amount_input_value: obj.value,
22 | currency_amount_input_unit: obj.unit,
23 | };
24 | };
25 |
26 | export default CurrencyAmountInput;
27 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/DeclineToSignMessagesInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface DeclineToSignMessagesInput {
4 | /** List of payload ids to decline to sign because validation failed. **/
5 | payloadIds: string[];
6 | }
7 |
8 | export const DeclineToSignMessagesInputFromJson = (
9 | obj: any,
10 | ): DeclineToSignMessagesInput => {
11 | return {
12 | payloadIds: obj["decline_to_sign_messages_input_payload_ids"],
13 | } as DeclineToSignMessagesInput;
14 | };
15 | export const DeclineToSignMessagesInputToJson = (
16 | obj: DeclineToSignMessagesInput,
17 | ): any => {
18 | return {
19 | decline_to_sign_messages_input_payload_ids: obj.payloadIds,
20 | };
21 | };
22 |
23 | export default DeclineToSignMessagesInput;
24 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/DeleteApiTokenInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface DeleteApiTokenInput {
4 | apiTokenId: string;
5 | }
6 |
7 | export const DeleteApiTokenInputFromJson = (obj: any): DeleteApiTokenInput => {
8 | return {
9 | apiTokenId: obj["delete_api_token_input_api_token_id"],
10 | } as DeleteApiTokenInput;
11 | };
12 | export const DeleteApiTokenInputToJson = (obj: DeleteApiTokenInput): any => {
13 | return {
14 | delete_api_token_input_api_token_id: obj.apiTokenId,
15 | };
16 | };
17 |
18 | export default DeleteApiTokenInput;
19 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/DeleteApiTokenOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface DeleteApiTokenOutput {
4 | accountId: string;
5 | }
6 |
7 | export const DeleteApiTokenOutputFromJson = (
8 | obj: any,
9 | ): DeleteApiTokenOutput => {
10 | return {
11 | accountId: obj["delete_api_token_output_account"].id,
12 | } as DeleteApiTokenOutput;
13 | };
14 | export const DeleteApiTokenOutputToJson = (obj: DeleteApiTokenOutput): any => {
15 | return {
16 | delete_api_token_output_account: { id: obj.accountId },
17 | };
18 | };
19 |
20 | export const FRAGMENT = `
21 | fragment DeleteApiTokenOutputFragment on DeleteApiTokenOutput {
22 | __typename
23 | delete_api_token_output_account: account {
24 | id
25 | }
26 | }`;
27 |
28 | export default DeleteApiTokenOutput;
29 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/FailHtlcsOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface FailHtlcsOutput {
4 | invoiceId: string;
5 | }
6 |
7 | export const FailHtlcsOutputFromJson = (obj: any): FailHtlcsOutput => {
8 | return {
9 | invoiceId: obj["fail_htlcs_output_invoice"].id,
10 | } as FailHtlcsOutput;
11 | };
12 | export const FailHtlcsOutputToJson = (obj: FailHtlcsOutput): any => {
13 | return {
14 | fail_htlcs_output_invoice: { id: obj.invoiceId },
15 | };
16 | };
17 |
18 | export const FRAGMENT = `
19 | fragment FailHtlcsOutputFragment on FailHtlcsOutput {
20 | __typename
21 | fail_htlcs_output_invoice: invoice {
22 | id
23 | }
24 | }`;
25 |
26 | export default FailHtlcsOutput;
27 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/IdAndSignature.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface IdAndSignature {
4 | /** The id of the message. **/
5 | id: string;
6 |
7 | /** The signature of the message. **/
8 | signature: string;
9 | }
10 |
11 | export const IdAndSignatureFromJson = (obj: any): IdAndSignature => {
12 | return {
13 | id: obj["id_and_signature_id"],
14 | signature: obj["id_and_signature_signature"],
15 | } as IdAndSignature;
16 | };
17 | export const IdAndSignatureToJson = (obj: IdAndSignature): any => {
18 | return {
19 | id_and_signature_id: obj.id,
20 | id_and_signature_signature: obj.signature,
21 | };
22 | };
23 |
24 | export default IdAndSignature;
25 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/IncomingPaymentAttemptStatus.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum that enumerates all potential statuses for an incoming payment attempt. **/
4 | export enum IncomingPaymentAttemptStatus {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 |
11 | ACCEPTED = "ACCEPTED",
12 |
13 | SETTLED = "SETTLED",
14 |
15 | CANCELED = "CANCELED",
16 |
17 | UNKNOWN = "UNKNOWN",
18 | }
19 |
20 | export default IncomingPaymentAttemptStatus;
21 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/InvoiceForPaymentHashInput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface InvoiceForPaymentHashInput {
4 | /** The 32-byte hash of the payment preimage for which to fetch an invoice. **/
5 | paymentHash: string;
6 | }
7 |
8 | export const InvoiceForPaymentHashInputFromJson = (
9 | obj: any,
10 | ): InvoiceForPaymentHashInput => {
11 | return {
12 | paymentHash: obj["invoice_for_payment_hash_input_payment_hash"],
13 | } as InvoiceForPaymentHashInput;
14 | };
15 | export const InvoiceForPaymentHashInputToJson = (
16 | obj: InvoiceForPaymentHashInput,
17 | ): any => {
18 | return {
19 | invoice_for_payment_hash_input_payment_hash: obj.paymentHash,
20 | };
21 | };
22 |
23 | export default InvoiceForPaymentHashInput;
24 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/InvoiceType.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum for potential invoice types. **/
4 | export enum InvoiceType {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 | /** A standard Bolt 11 invoice. **/
11 | STANDARD = "STANDARD",
12 | /** An AMP (Atomic Multi-path Payment) invoice. **/
13 | AMP = "AMP",
14 | }
15 |
16 | export default InvoiceType;
17 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/LightningPaymentDirection.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum identifying the payment direction. **/
4 | export enum LightningPaymentDirection {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 | /** A payment that is received by the node. **/
11 | INCOMING = "INCOMING",
12 | /** A payment that is sent by the node. **/
13 | OUTGOING = "OUTGOING",
14 | }
15 |
16 | export default LightningPaymentDirection;
17 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/LightsparkNodeStatus.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export enum LightsparkNodeStatus {
4 | /**
5 | * This is an enum value that represents values that could be added in the future.
6 | * Clients should support unknown values as more of them could be added without notice.
7 | */
8 | FUTURE_VALUE = "FUTURE_VALUE",
9 |
10 | CREATED = "CREATED",
11 |
12 | DEPLOYED = "DEPLOYED",
13 |
14 | STARTED = "STARTED",
15 |
16 | SYNCING = "SYNCING",
17 |
18 | READY = "READY",
19 |
20 | STOPPED = "STOPPED",
21 |
22 | TERMINATED = "TERMINATED",
23 |
24 | TERMINATING = "TERMINATING",
25 |
26 | WALLET_LOCKED = "WALLET_LOCKED",
27 |
28 | FAILED_TO_DEPLOY = "FAILED_TO_DEPLOY",
29 | }
30 |
31 | export default LightsparkNodeStatus;
32 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/NodeAddressType.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /**
4 | * This is an enum of the potential types of addresses that a node on the Lightning Network can
5 | * have. *
6 | */
7 | export enum NodeAddressType {
8 | /**
9 | * This is an enum value that represents values that could be added in the future.
10 | * Clients should support unknown values as more of them could be added without notice.
11 | */
12 | FUTURE_VALUE = "FUTURE_VALUE",
13 |
14 | IPV4 = "IPV4",
15 |
16 | IPV6 = "IPV6",
17 |
18 | TOR = "TOR",
19 | }
20 |
21 | export default NodeAddressType;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/OnChainFeeTarget.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export enum OnChainFeeTarget {
4 | /**
5 | * This is an enum value that represents values that could be added in the future.
6 | * Clients should support unknown values as more of them could be added without notice.
7 | */
8 | FUTURE_VALUE = "FUTURE_VALUE",
9 | /** Transaction expected to be confirmed within 2 blocks. **/
10 | HIGH = "HIGH",
11 | /** Transaction expected to be confirmed within 6 blocks. **/
12 | MEDIUM = "MEDIUM",
13 | /** Transaction expected to be confirmed within 18 blocks. **/
14 | LOW = "LOW",
15 | /** Transaction expected to be confirmed within 50 blocks. **/
16 | BACKGROUND = "BACKGROUND",
17 | }
18 |
19 | export default OnChainFeeTarget;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/OutgoingPaymentAttemptStatus.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum of all potential statuses of a payment attempt made from a Lightspark Node. **/
4 | export enum OutgoingPaymentAttemptStatus {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 |
11 | IN_FLIGHT = "IN_FLIGHT",
12 |
13 | SUCCEEDED = "SUCCEEDED",
14 |
15 | FAILED = "FAILED",
16 | }
17 |
18 | export default OutgoingPaymentAttemptStatus;
19 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/PayInvoiceOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface PayInvoiceOutput {
4 | /** The payment that has been sent. **/
5 | paymentId: string;
6 | }
7 |
8 | export const PayInvoiceOutputFromJson = (obj: any): PayInvoiceOutput => {
9 | return {
10 | paymentId: obj["pay_invoice_output_payment"].id,
11 | } as PayInvoiceOutput;
12 | };
13 | export const PayInvoiceOutputToJson = (obj: PayInvoiceOutput): any => {
14 | return {
15 | pay_invoice_output_payment: { id: obj.paymentId },
16 | };
17 | };
18 |
19 | export const FRAGMENT = `
20 | fragment PayInvoiceOutputFragment on PayInvoiceOutput {
21 | __typename
22 | pay_invoice_output_payment: payment {
23 | id
24 | }
25 | }`;
26 |
27 | export default PayInvoiceOutput;
28 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/PayOfferOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface PayOfferOutput {
4 | /** The payment that has been sent. **/
5 | paymentId: string;
6 | }
7 |
8 | export const PayOfferOutputFromJson = (obj: any): PayOfferOutput => {
9 | return {
10 | paymentId: obj["pay_offer_output_payment"].id,
11 | } as PayOfferOutput;
12 | };
13 | export const PayOfferOutputToJson = (obj: PayOfferOutput): any => {
14 | return {
15 | pay_offer_output_payment: { id: obj.paymentId },
16 | };
17 | };
18 |
19 | export const FRAGMENT = `
20 | fragment PayOfferOutputFragment on PayOfferOutput {
21 | __typename
22 | pay_offer_output_payment: payment {
23 | id
24 | }
25 | }`;
26 |
27 | export default PayOfferOutput;
28 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/PaymentDirection.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum indicating the direction of the payment. **/
4 | export enum PaymentDirection {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 |
11 | SENT = "SENT",
12 |
13 | RECEIVED = "RECEIVED",
14 | }
15 |
16 | export default PaymentDirection;
17 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/PaymentRequestStatus.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /**
4 | * This is an enum of the potential states that a payment request on the Lightning Network can
5 | * take. *
6 | */
7 | export enum PaymentRequestStatus {
8 | /**
9 | * This is an enum value that represents values that could be added in the future.
10 | * Clients should support unknown values as more of them could be added without notice.
11 | */
12 | FUTURE_VALUE = "FUTURE_VALUE",
13 |
14 | OPEN = "OPEN",
15 |
16 | CLOSED = "CLOSED",
17 | }
18 |
19 | export default PaymentRequestStatus;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/RequestInitiator.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export enum RequestInitiator {
4 | /**
5 | * This is an enum value that represents values that could be added in the future.
6 | * Clients should support unknown values as more of them could be added without notice.
7 | */
8 | FUTURE_VALUE = "FUTURE_VALUE",
9 |
10 | CUSTOMER = "CUSTOMER",
11 |
12 | LIGHTSPARK = "LIGHTSPARK",
13 | }
14 |
15 | export default RequestInitiator;
16 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/RichText.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface RichText {
4 | text: string;
5 | }
6 |
7 | export const RichTextFromJson = (obj: any): RichText => {
8 | return {
9 | text: obj["rich_text_text"],
10 | } as RichText;
11 | };
12 | export const RichTextToJson = (obj: RichText): any => {
13 | return {
14 | rich_text_text: obj.text,
15 | };
16 | };
17 |
18 | export const FRAGMENT = `
19 | fragment RichTextFragment on RichText {
20 | __typename
21 | rich_text_text: text
22 | }`;
23 |
24 | export default RichText;
25 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/RiskRating.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /**
4 | * This is an enum of the potential risk ratings related to a transaction made over the Lightning
5 | * Network. These risk ratings are returned from the CryptoSanctionScreeningProvider. *
6 | */
7 | export enum RiskRating {
8 | /**
9 | * This is an enum value that represents values that could be added in the future.
10 | * Clients should support unknown values as more of them could be added without notice.
11 | */
12 | FUTURE_VALUE = "FUTURE_VALUE",
13 |
14 | HIGH_RISK = "HIGH_RISK",
15 |
16 | LOW_RISK = "LOW_RISK",
17 |
18 | UNKNOWN = "UNKNOWN",
19 | }
20 |
21 | export default RiskRating;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/RoutingTransactionFailureReason.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /**
4 | * This is an enum of the potential reasons that an attempted routed transaction through a
5 | * Lightspark node may have failed. *
6 | */
7 | export enum RoutingTransactionFailureReason {
8 | /**
9 | * This is an enum value that represents values that could be added in the future.
10 | * Clients should support unknown values as more of them could be added without notice.
11 | */
12 | FUTURE_VALUE = "FUTURE_VALUE",
13 |
14 | INCOMING_LINK_FAILURE = "INCOMING_LINK_FAILURE",
15 |
16 | OUTGOING_LINK_FAILURE = "OUTGOING_LINK_FAILURE",
17 |
18 | FORWARDING_FAILURE = "FORWARDING_FAILURE",
19 | }
20 |
21 | export default RoutingTransactionFailureReason;
22 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/ScreenNodeOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import RiskRating from "./RiskRating.js";
4 |
5 | interface ScreenNodeOutput {
6 | rating: RiskRating;
7 | }
8 |
9 | export const ScreenNodeOutputFromJson = (obj: any): ScreenNodeOutput => {
10 | return {
11 | rating:
12 | RiskRating[obj["screen_node_output_rating"]] ?? RiskRating.FUTURE_VALUE,
13 | } as ScreenNodeOutput;
14 | };
15 | export const ScreenNodeOutputToJson = (obj: ScreenNodeOutput): any => {
16 | return {
17 | screen_node_output_rating: obj.rating,
18 | };
19 | };
20 |
21 | export const FRAGMENT = `
22 | fragment ScreenNodeOutputFragment on ScreenNodeOutput {
23 | __typename
24 | screen_node_output_rating: rating
25 | }`;
26 |
27 | export default ScreenNodeOutput;
28 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/Secret.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface Secret {
4 | encryptedValue: string;
5 |
6 | cipher: string;
7 | }
8 |
9 | export const SecretFromJson = (obj: any): Secret => {
10 | return {
11 | encryptedValue: obj["secret_encrypted_value"],
12 | cipher: obj["secret_cipher"],
13 | } as Secret;
14 | };
15 | export const SecretToJson = (obj: Secret): any => {
16 | return {
17 | secret_encrypted_value: obj.encryptedValue,
18 | secret_cipher: obj.cipher,
19 | };
20 | };
21 |
22 | export const FRAGMENT = `
23 | fragment SecretFragment on Secret {
24 | __typename
25 | secret_encrypted_value: encrypted_value
26 | secret_cipher: cipher
27 | }`;
28 |
29 | export default Secret;
30 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/SendPaymentOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface SendPaymentOutput {
4 | /** The payment that has been sent. **/
5 | paymentId: string;
6 | }
7 |
8 | export const SendPaymentOutputFromJson = (obj: any): SendPaymentOutput => {
9 | return {
10 | paymentId: obj["send_payment_output_payment"].id,
11 | } as SendPaymentOutput;
12 | };
13 | export const SendPaymentOutputToJson = (obj: SendPaymentOutput): any => {
14 | return {
15 | send_payment_output_payment: { id: obj.paymentId },
16 | };
17 | };
18 |
19 | export const FRAGMENT = `
20 | fragment SendPaymentOutputFragment on SendPaymentOutput {
21 | __typename
22 | send_payment_output_payment: payment {
23 | id
24 | }
25 | }`;
26 |
27 | export default SendPaymentOutput;
28 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/SignInvoiceOutput.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | interface SignInvoiceOutput {
4 | /** The signed invoice object. **/
5 | invoiceId: string;
6 | }
7 |
8 | export const SignInvoiceOutputFromJson = (obj: any): SignInvoiceOutput => {
9 | return {
10 | invoiceId: obj["sign_invoice_output_invoice"].id,
11 | } as SignInvoiceOutput;
12 | };
13 | export const SignInvoiceOutputToJson = (obj: SignInvoiceOutput): any => {
14 | return {
15 | sign_invoice_output_invoice: { id: obj.invoiceId },
16 | };
17 | };
18 |
19 | export const FRAGMENT = `
20 | fragment SignInvoiceOutputFragment on SignInvoiceOutput {
21 | __typename
22 | sign_invoice_output_invoice: invoice {
23 | id
24 | }
25 | }`;
26 |
27 | export default SignInvoiceOutput;
28 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/SignablePayloadStatus.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export enum SignablePayloadStatus {
4 | /**
5 | * This is an enum value that represents values that could be added in the future.
6 | * Clients should support unknown values as more of them could be added without notice.
7 | */
8 | FUTURE_VALUE = "FUTURE_VALUE",
9 |
10 | CREATED = "CREATED",
11 |
12 | SIGNED = "SIGNED",
13 |
14 | VALIDATION_FAILED = "VALIDATION_FAILED",
15 |
16 | INVALID_SIGNATURE = "INVALID_SIGNATURE",
17 | }
18 |
19 | export default SignablePayloadStatus;
20 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/WithdrawalMode.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum of the potential modes that your Bitcoin withdrawal can take. **/
4 | export enum WithdrawalMode {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 |
11 | WALLET_ONLY = "WALLET_ONLY",
12 |
13 | WALLET_THEN_CHANNELS = "WALLET_THEN_CHANNELS",
14 | }
15 |
16 | export default WithdrawalMode;
17 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/objects/WithdrawalRequestStatus.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | /** This is an enum of the potential statuses that a Withdrawal can take. **/
4 | export enum WithdrawalRequestStatus {
5 | /**
6 | * This is an enum value that represents values that could be added in the future.
7 | * Clients should support unknown values as more of them could be added without notice.
8 | */
9 | FUTURE_VALUE = "FUTURE_VALUE",
10 |
11 | CREATING = "CREATING",
12 |
13 | CREATED = "CREATED",
14 |
15 | FAILED = "FAILED",
16 |
17 | IN_PROGRESS = "IN_PROGRESS",
18 |
19 | SUCCESSFUL = "SUCCESSFUL",
20 |
21 | PARTIALLY_SUCCESSFUL = "PARTIALLY_SUCCESSFUL",
22 | }
23 |
24 | export default WithdrawalRequestStatus;
25 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/src/tests/integration/constants.ts:
--------------------------------------------------------------------------------
1 | export const TESTS_TIMEOUT = 60_000; //ms
2 | export const LONG_TEST_TIMEOUT = 600_0000; //ms
3 | export const DAY_IN_MS = 86400000; //ms
4 | export const INVOICE_EXPIRY = 172800; //ms
5 | export const TRANSACTION_WAIT_TIME = TESTS_TIMEOUT / 1000; //seconds
6 | export const PAGINATION_STEP = 3;
7 |
8 | export const REGTEST_SIGNING_KEY_PASSWORD = "1234!@#$";
9 | export const ENCODED_REGTEST_REQUEST_FOR_TESTS =
10 | "lnbcrt1pjj6zu2pp50qr2p79v65u9l8w3859259yj9fe5nt79hfw5k2am424440tlj09qdq0dp5jqargv4ex2ggcqzpgxqyz5vqsp5v0z0fu99jf37xcasu88evuphx9kdrpvtupdvhu329kx7k7un59zs9qyyssqegzx986rszy96te2kmxl7prlz0p8avthpwzhsz5v220uek7xxrz54svdsjpzwn04m6utj5ua9tmtktygc5xmjmjaqey9dadt33r8gxspvcg8wv";
11 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/tsconfig-test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "resolveJsonModule": true,
5 | "moduleResolution": "node",
6 | "types": ["jest", "node"]
7 | },
8 | "include": ["src/**/*"],
9 | "exclude": ["node_modules"]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig/base.json",
3 | "compilerOptions": {
4 | "exactOptionalPropertyTypes": false,
5 | /* Allow implicit any due to generated files. TODO look into resolving
6 | implicit any for generated files or move them out of the type checks */
7 | "noImplicitAny": false
8 | },
9 | "include": ["src"],
10 | "exclude": ["**/tests", "node_modules", "dist"]
11 | }
12 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "tsup";
2 |
3 | export default defineConfig({
4 | entry: ["src/index.ts", "src/env.ts", "src/objects/index.ts"],
5 | format: ["cjs", "esm"],
6 | dts: true,
7 | clean: true,
8 | })
9 |
--------------------------------------------------------------------------------
/packages/lightspark-sdk/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["//"],
3 | "tasks": {
4 | "package:checks": {
5 | "dependsOn": ["build"]
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/oauth/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/base"],
3 | };
4 |
--------------------------------------------------------------------------------
/packages/oauth/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/oauth/README.md:
--------------------------------------------------------------------------------
1 | # The Lightspark JS+TS OAuth package
2 |
3 | This is the Lightspark Typescript Oauth package, which can be used from a browser environment. It can only be used to authenticate a Lightspark administator account, not a wallet user account. See lightspark-sdk/examples/oauth-example for an example of how to use it!
4 |
5 | ** NOTE: This package is currently in unpublished beta, and is subject to change. **
6 |
7 | ## Getting started
8 |
9 | To use the package, you'll need to install it from npm:
10 |
11 | ```bash
12 | $ npm install @lightsparkdev/oauth
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/oauth/src/auth/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export { default as OAuthProvider } from "./OAuthProvider.js";
4 | export { default as OAuthStateHelper } from "./OAuthStateHelper.js";
5 | export { default as OAuthTokenRequestHandler } from "./OAuthTokenRequestHandler.js";
6 |
--------------------------------------------------------------------------------
/packages/oauth/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./auth/index.js";
2 |
--------------------------------------------------------------------------------
/packages/oauth/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig/base.json",
3 | "include": ["src"],
4 | "compilerOptions": {
5 | "exactOptionalPropertyTypes": false
6 | },
7 | "exclude": ["**/tests", "node_modules", "dist"]
8 | }
9 |
--------------------------------------------------------------------------------
/packages/oauth/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["//"],
3 | "tasks": {
4 | "package:checks": {
5 | "dependsOn": ["build"]
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/static/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@lightsparkdev/static",
3 | "version": "0.0.0",
4 | "private": true,
5 | "engines": {
6 | "node": ">=18"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/tsconfig/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @lightsparkdev/tsconfig
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - 062bf8a: [js] Add engines field to all packages to indicate supported NodeJS versions
8 |
--------------------------------------------------------------------------------
/packages/tsconfig/README.md:
--------------------------------------------------------------------------------
1 | TODO
2 |
--------------------------------------------------------------------------------
/packages/tsconfig/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "noEmit": true,
4 | "target": "ES2022",
5 | "module": "node16",
6 | "allowJs": true,
7 | "declaration": true,
8 | "sourceMap": true,
9 | "outDir": "dist",
10 | "strict": true,
11 | "noImplicitAny": true,
12 | "strictNullChecks": true,
13 | "noImplicitReturns": true,
14 | "baseUrl": "./src",
15 | "moduleResolution": "node16",
16 | "types": ["node", "jest"],
17 | "resolveJsonModule": true,
18 | "allowSyntheticDefaultImports": true,
19 | "esModuleInterop": true,
20 | "skipLibCheck": true,
21 | "forceConsistentCasingInFileNames": true,
22 | "exactOptionalPropertyTypes": true,
23 | "noFallthroughCasesInSwitch": true
24 | },
25 | "include": ["src"],
26 | "exclude": ["**/tests", "node_modules", "dist"]
27 | }
28 |
--------------------------------------------------------------------------------
/packages/tsconfig/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@lightsparkdev/tsconfig",
3 | "version": "0.0.1",
4 | "private": true,
5 | "devDependencies": {
6 | "@types/node": "^20.2.5"
7 | },
8 | "engines": {
9 | "node": ">=18"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/tsconfig/react-app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./base.json",
3 | "compilerOptions": {
4 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
5 | "moduleResolution": "bundler",
6 | "module": "esnext",
7 | "isolatedModules": true,
8 | "jsx": "react-jsx",
9 | "noEmit": true,
10 | "jsxImportSource": "@emotion/react"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/tsconfig/react-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./base.json",
3 | "compilerOptions": {
4 | "lib": ["DOM", "ESNext"],
5 | "jsx": "react-jsx",
6 | "jsxImportSource": "@emotion/react",
7 | "module": "nodenext",
8 | "moduleResolution": "nodenext",
9 | "target": "es6"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/tsconfig/ts-node-app.json:
--------------------------------------------------------------------------------
1 | {
2 | // Most ts-node options can be specified here using their programmatic names.
3 | "ts-node": {
4 | "files": true,
5 | "experimentalResolver": true,
6 | "esm": true,
7 | "compilerOptions": {
8 | "strict": false
9 | }
10 | },
11 | "compilerOptions": {
12 | "lib": ["ESNext"],
13 | "module": "nodenext",
14 | "target": "esnext",
15 | "moduleResolution": "nodenext",
16 | "strict": true,
17 | "esModuleInterop": true,
18 | "skipLibCheck": true,
19 | "resolveJsonModule": true,
20 | "forceConsistentCasingInFileNames": true,
21 | "allowSyntheticDefaultImports": true
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/packages/ui/.attw.json:
--------------------------------------------------------------------------------
1 | {
2 | "profile": "node16",
3 | "excludeEntrypoints": [
4 | "@lightsparkdev/ui/src/components",
5 | "@lightsparkdev/ui/src/components/*",
6 | "@lightsparkdev/ui/src/components/typography",
7 | "@lightsparkdev/ui/src/hooks",
8 | "@lightsparkdev/ui/src/hooks/*",
9 | "@lightsparkdev/ui/src/icons",
10 | "@lightsparkdev/ui/src/icons/*",
11 | "@lightsparkdev/ui/src/router",
12 | "@lightsparkdev/ui/src/styles/",
13 | "@lightsparkdev/ui/src/styles/*",
14 | "@lightsparkdev/ui/src/types",
15 | "@lightsparkdev/ui/src/types/*",
16 | "@lightsparkdev/ui/src/utils",
17 | "@lightsparkdev/ui/src/utils/*",
18 | "@lightsparkdev/ui/static/"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/packages/ui/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["@lightsparkdev/eslint-config/react-lib"],
3 | };
4 |
--------------------------------------------------------------------------------
/packages/ui/.prettierignore:
--------------------------------------------------------------------------------
1 | gql/generated/*
2 | gql/*.graphql
3 | dist/
4 | .tsup/
--------------------------------------------------------------------------------
/packages/ui/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["prettier-plugin-organize-imports"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/ui/README.md:
--------------------------------------------------------------------------------
1 | # Lightspark UI
2 |
3 | 
4 |
5 | This package contains React components and design system utilities from Lightspark UI.
6 |
7 | ## Getting started
8 |
9 | ```bash
10 | $ npm install @lightsparkdev/ui
11 | ```
12 |
13 | ```jsx
14 | import { LightsparkProvider, Button } from "@lightsparkdev/ui/src/components";
15 |
16 | function App() {
17 | return (
18 |
19 |
20 |
21 | );
22 | }
23 | ```
24 |
--------------------------------------------------------------------------------
/packages/ui/jest/setup.ts:
--------------------------------------------------------------------------------
1 | /* Import node libs to polyfill browser objects */
2 | import crypto from "crypto";
3 | import { TextDecoder, TextEncoder } from "util";
4 |
5 | Object.defineProperties(global.self, {
6 | crypto: {
7 | value: {
8 | getRandomValues: (arr: NodeJS.ArrayBufferView) =>
9 | crypto.randomFillSync(arr),
10 | subtle: crypto.webcrypto.subtle,
11 | },
12 | },
13 | TextEncoder: {
14 | value: TextEncoder,
15 | },
16 | TextDecoder: {
17 | value: TextDecoder,
18 | },
19 | });
20 |
--------------------------------------------------------------------------------
/packages/ui/jest/setupAfterEnv.ts:
--------------------------------------------------------------------------------
1 | import "@testing-library/jest-dom";
2 |
--------------------------------------------------------------------------------
/packages/ui/src/components/Banner/constants.ts:
--------------------------------------------------------------------------------
1 | export const bannerTimingSecs = 0.2;
2 | export const bannerTiming = `${bannerTimingSecs}s ease`;
3 |
--------------------------------------------------------------------------------
/packages/ui/src/components/CardForm/CardFormCodeInput.tsx:
--------------------------------------------------------------------------------
1 | import { css } from "@emotion/react";
2 | import {
3 | CodeInput,
4 | type OnChangeCode,
5 | type OnSubmitCode,
6 | } from "../CodeInput/CodeInput.js";
7 |
8 | const inputCSS = css``;
9 |
10 | type CardFormCodeInputProps = {
11 | onChange?: OnChangeCode;
12 | onSubmit?: OnSubmitCode;
13 | onBlur?: () => void;
14 | };
15 |
16 | export function CardFormCodeInput({
17 | onChange,
18 | onSubmit,
19 | onBlur,
20 | }: CardFormCodeInputProps) {
21 | return (
22 |
29 | );
30 | }
31 |
--------------------------------------------------------------------------------
/packages/ui/src/components/CardForm/CardFormHeadline.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 | import { type ReactNode } from "react";
3 |
4 | export type CardFormHeaderProps = {
5 | children?: ReactNode;
6 | bundle?: boolean;
7 | grow?: boolean;
8 | };
9 |
10 | export function CardFormHeader({
11 | children,
12 | bundle = false,
13 | }: CardFormHeaderProps) {
14 | if (!bundle) {
15 | return children;
16 | }
17 |
18 | return {children};
19 | }
20 |
21 | const Wrapper = styled.div<{ grow?: boolean }>`
22 | display: flex;
23 | flex-direction: column;
24 | ${({ grow }) => grow && `flex-grow: 1;`}
25 | height: 100%;
26 | justify-content: center;
27 | `;
28 |
--------------------------------------------------------------------------------
/packages/ui/src/components/Icon/types.tsx:
--------------------------------------------------------------------------------
1 | import * as centralIcons from "../../icons/central/index.js";
2 | import * as icons from "../../icons/index.js";
3 |
4 | export const iconMap = {
5 | ...icons,
6 | ...centralIcons,
7 | } as const;
8 |
9 | export type IconName = keyof typeof iconMap;
10 |
--------------------------------------------------------------------------------
/packages/ui/src/components/LightsparkProvider.tsx:
--------------------------------------------------------------------------------
1 | import { ThemeProvider } from "@emotion/react";
2 | import { GlobalStyles } from "../styles/global.js";
3 | import { themes } from "../styles/themes.js";
4 |
5 | type LightsparkProviderProps = {
6 | children: React.ReactNode;
7 | };
8 |
9 | export function LightsparkProvider({ children }: LightsparkProviderProps) {
10 | return (
11 |
12 |
13 | {children}
14 |
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/packages/ui/src/components/PageSection/constants.tsx:
--------------------------------------------------------------------------------
1 | export const pageSectionScrollOffset = 20;
2 |
--------------------------------------------------------------------------------
/packages/ui/src/components/QRReader/styles.ts:
--------------------------------------------------------------------------------
1 | export const styles = {
2 | container: {
3 | width: "100%",
4 | paddingTop: "100%",
5 | overflow: "hidden",
6 | position: "relative",
7 | },
8 | video: {
9 | top: 0,
10 | left: 0,
11 | width: "100%",
12 | height: "100%",
13 | display: "block",
14 | overflow: "hidden",
15 | position: "absolute",
16 | transform: undefined,
17 | },
18 | } as const;
19 |
--------------------------------------------------------------------------------
/packages/ui/src/components/QRReader/utils.ts:
--------------------------------------------------------------------------------
1 | export const isMediaDevicesSupported = () => {
2 | const isMediaDevicesSupported =
3 | typeof navigator !== "undefined" && !!navigator.mediaDevices;
4 |
5 | if (!isMediaDevicesSupported) {
6 | console.warn(
7 | `[ReactQRReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"`,
8 | );
9 | }
10 |
11 | return isMediaDevicesSupported;
12 | };
13 |
14 | export const isValidType = (value: unknown, name: string, type: string) => {
15 | const isValid = typeof value === type;
16 |
17 | if (!isValid) {
18 | console.warn(
19 | `[ReactQRReader]: Expected "${name}" to be a of type "${type}".`,
20 | );
21 | }
22 |
23 | return isValid;
24 | };
25 |
--------------------------------------------------------------------------------
/packages/ui/src/components/SecretInput.tsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import { TextInput, type TextInputProps } from "./TextInput.js";
3 |
4 | export type SecretInputProps = Omit<
5 | TextInputProps,
6 | "type" | "onClickIcon" | "icon"
7 | >;
8 |
9 | export function SecretInput({ ...rest }: SecretInputProps) {
10 | const [showSecret, setShowSecret] = useState(false);
11 | return (
12 | setShowSecret(!showSecret)}
16 | icon={{
17 | name: showSecret ? "NotEye" : "Eye",
18 | width: 16,
19 | }}
20 | />
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/packages/ui/src/components/UnstyledButton.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 | import styled from "@emotion/styled";
3 | import { standardFocusOutline } from "../styles/common.js";
4 |
5 | export const UnstyledButton = styled.button`
6 | ${standardFocusOutline}
7 | font-family: ${({ theme }) => theme.typography.fontFamilies.main};
8 | appearance: none;
9 | background: transparent;
10 | border: none;
11 | padding: 0;
12 | cursor: ${({ disabled }) => (disabled ? "not-allowed" : "pointer")};
13 | /* needed in Safari for some reason */
14 | font-size: 1rem;
15 | color: inherit;
16 | font-weight: inherit;
17 | `;
18 |
--------------------------------------------------------------------------------
/packages/ui/src/components/documentation/index.ts:
--------------------------------------------------------------------------------
1 | export { AnchorLinkHeader } from "./AnchorLinkHeader.js";
2 |
--------------------------------------------------------------------------------
/packages/ui/src/components/types.ts:
--------------------------------------------------------------------------------
1 | export type { CurrencyAmountArg, CurrencyMap } from "@lightsparkdev/core";
2 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Body.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 | import {
5 | toReactNodes,
6 | type ToReactNodesArgs,
7 | } from "../../utils/toReactNodes/toReactNodes.js";
8 | import { type BodyProps, getPropDefaults, StyledBody } from "./base/Body.js";
9 |
10 | export type BodyPropsWithContentNodes = BodyProps & {
11 | content?: ToReactNodesArgs;
12 | };
13 |
14 | export function Body(props: BodyPropsWithContentNodes) {
15 | const propsWithDefaults = getPropDefaults(props);
16 | let reactNodes: ReactNode = props.children || null;
17 | if (props.content) {
18 | reactNodes = toReactNodes(props.content);
19 | }
20 |
21 | return {reactNodes};
22 | }
23 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Code.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 | import {
5 | toReactNodes,
6 | type ToReactNodesArgs,
7 | } from "../../utils/toReactNodes/toReactNodes.js";
8 | import { type CodeProps, getPropDefaults, StyledCode } from "./base/Code.js";
9 |
10 | export type CodePropsWithContentNodes = CodeProps & {
11 | content?: ToReactNodesArgs;
12 | };
13 |
14 | export function Code(props: CodePropsWithContentNodes) {
15 | const propsWithDefaults = getPropDefaults(props);
16 | let reactNodes: ReactNode = props.children || null;
17 | if (props.content) {
18 | reactNodes = toReactNodes(props.content);
19 | }
20 | return {reactNodes};
21 | }
22 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Display.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 |
5 | import {
6 | toReactNodes,
7 | type ToReactNodesArgs,
8 | } from "../../utils/toReactNodes/toReactNodes.js";
9 | import {
10 | type DisplayProps,
11 | getPropDefaults,
12 | StyledDisplay,
13 | } from "./base/Display.js";
14 |
15 | export type DisplayPropsWithContentNodes = DisplayProps & {
16 | content?: ToReactNodesArgs;
17 | };
18 |
19 | export function Display(props: DisplayPropsWithContentNodes) {
20 | const propsWithDefaults = getPropDefaults(props);
21 | let reactNodes: ReactNode = props.children || null;
22 | if (props.content) {
23 | reactNodes = toReactNodes(props.content);
24 | }
25 | return {reactNodes};
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Headline.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 | import {
5 | toReactNodes,
6 | type ToReactNodesArgs,
7 | } from "../../utils/toReactNodes/toReactNodes.js";
8 | import {
9 | getPropDefaults,
10 | StyledHeadline,
11 | type HeadlineProps,
12 | } from "./base/Headline.js";
13 |
14 | export type HeadlinePropsWithContentNodes = HeadlineProps & {
15 | content?: ToReactNodesArgs;
16 | };
17 |
18 | export function Headline(props: HeadlinePropsWithContentNodes) {
19 | const propsWithDefaults = getPropDefaults(props);
20 | let reactNodes: ReactNode = props.children || null;
21 | if (props.content) {
22 | reactNodes = toReactNodes(props.content);
23 | }
24 | return {reactNodes};
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Label.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 | import {
5 | toReactNodes,
6 | type ToReactNodesArgs,
7 | } from "../../utils/toReactNodes/toReactNodes.js";
8 | import { getPropDefaults, StyledLabel, type LabelProps } from "./base/Label.js";
9 |
10 | export type LabelPropsWithContentNodes = LabelProps & {
11 | content?: ToReactNodesArgs;
12 | };
13 |
14 | export function Label(props: LabelPropsWithContentNodes) {
15 | const propsWithDefaults = getPropDefaults(props);
16 | let reactNodes: ReactNode = props.children || null;
17 | if (props.content) {
18 | reactNodes = toReactNodes(props.content);
19 | }
20 | return {reactNodes};
21 | }
22 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Overline.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 | import {
5 | toReactNodes,
6 | type ToReactNodesArgs,
7 | } from "../../utils/toReactNodes/toReactNodes.js";
8 | import {
9 | getPropDefaults,
10 | StyledOverline,
11 | type OverlineProps,
12 | } from "./base/Overline.js";
13 |
14 | export type OverlinePropsWithContentNodes = OverlineProps & {
15 | content?: ToReactNodesArgs;
16 | };
17 |
18 | export function Overline(props: OverlinePropsWithContentNodes) {
19 | const propsWithDefaults = getPropDefaults(props);
20 | let reactNodes: ReactNode = props.children || null;
21 | if (props.content) {
22 | reactNodes = toReactNodes(props.content);
23 | }
24 | return {reactNodes};
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/Title.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { type ReactNode } from "react";
4 | import {
5 | toReactNodes,
6 | type ToReactNodesArgs,
7 | } from "../../utils/toReactNodes/toReactNodes.js";
8 | import { getPropDefaults, StyledTitle, type TitleProps } from "./base/Title.js";
9 |
10 | export type TitlePropsWithContentNodes = TitleProps & {
11 | content?: ToReactNodesArgs;
12 | };
13 |
14 | export function Title(props: TitlePropsWithContentNodes) {
15 | const propsWithDefaults = getPropDefaults(props);
16 | let reactNodes: ReactNode = props.children || null;
17 | if (props.content) {
18 | reactNodes = toReactNodes(props.content);
19 | }
20 | return {reactNodes};
21 | }
22 |
--------------------------------------------------------------------------------
/packages/ui/src/components/typography/base/getPropDefaults.tsx:
--------------------------------------------------------------------------------
1 | import { stringToNodes } from "../../../utils/toReactNodes/stringToNodes.js";
2 | import { type CommonTypographyProps } from "../types.js";
3 |
4 | export function getPropDefaultsBase<
5 | T extends CommonTypographyProps,
6 | E extends Record,
7 | >(props: T, extra: E) {
8 | return {
9 | block: props.block || false,
10 | colorProp: props.color,
11 | displayProp: props.display,
12 | hideOverflow: props.hideOverflow || false,
13 | id: props.id,
14 | display: props.display,
15 | size: props.size || "Medium",
16 | textAlign: props.textAlign,
17 | onClick: props.onClick,
18 | underline: props.underline || false,
19 | children: props.children ? stringToNodes(props.children) : null,
20 | ...extra,
21 | };
22 | }
23 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/index.tsx:
--------------------------------------------------------------------------------
1 | export { useClipboard } from "./useClipboard.js";
2 | export { useDebounce } from "./useDebounce.js";
3 | export { useDocumentTitle } from "./useDocumentTitle.js";
4 | export { default as useFields } from "./useFields.js";
5 | export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
6 | export { useLiveRef } from "./useLiveRef.js";
7 | export { useMaxScaleIOS } from "./useMaxScaleIOS.js";
8 | export { useNumberInput } from "./useNumberInput/useNumberInput.js";
9 | export { useQueryParams } from "./useQueryParams.js";
10 | export { useResizeObserver } from "./useResizeObserver.js";
11 | export { useWhatChanged } from "./useWhatChanged.js";
12 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useDebounce.tsx:
--------------------------------------------------------------------------------
1 | import { type DebounceSettings } from "lodash";
2 | import { debounce } from "lodash-es";
3 | import { useEffect, useState } from "react";
4 |
5 | export function useDebounce(
6 | value: T,
7 | delay: number = 0,
8 | options?: DebounceSettings,
9 | ): T {
10 | const [current, setCurrent] = useState(value);
11 | const jsonOptions = JSON.stringify(options);
12 |
13 | useEffect(() => {
14 | const debounced = debounce(
15 | () => {
16 | setCurrent(value);
17 | },
18 | delay,
19 | options,
20 | );
21 |
22 | debounced();
23 |
24 | return () => {
25 | debounced.cancel();
26 | };
27 | /* eslint-disable-next-line react-hooks/exhaustive-deps */
28 | }, [value, delay, jsonOptions]);
29 |
30 | return current;
31 | }
32 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useDocumentTitle.tsx:
--------------------------------------------------------------------------------
1 | import { useEffect } from "react";
2 | import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
3 |
4 | export const useDocumentTitle = (defaultPrefix: string, title: string) => {
5 | useIsomorphicLayoutEffect(() => {
6 | // Sets the new document title
7 | window.document.title = `${defaultPrefix} - ${title}`;
8 | }, [title, defaultPrefix]);
9 |
10 | useEffect(() => {
11 | return () => {
12 | window.document.title = defaultPrefix;
13 | };
14 | }, [defaultPrefix]);
15 | };
16 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useIsomorphicLayoutEffect.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const useIsomorphicLayoutEffect =
4 | typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
5 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useLiveRef.tsx:
--------------------------------------------------------------------------------
1 | import { useCallback, useMemo, useRef, useState } from "react";
2 |
3 | const defaultRef = { current: null };
4 |
5 | /* For use when you need a rerender when the ref is actually assigned.
6 | Usually ref assignment does not trigger rerenders. */
7 | export function useLiveRef() {
8 | const [ready, setReady] = useState(false);
9 | const ref = useRef(null);
10 | const refCb = useCallback((node: T | null) => {
11 | if (node !== null) {
12 | ref.current = node;
13 | setReady(true);
14 | }
15 | }, []);
16 |
17 | const value = useMemo(
18 | () => [ready ? ref : defaultRef, refCb] as const,
19 | [ready, ref, refCb],
20 | );
21 |
22 | return value;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/addSeparators.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Add group separator to value eg. 1000 > 1,000
3 | */
4 | export const addSeparators = (value: string, separator = ","): string => {
5 | return value.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
6 | };
7 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/escapeRegExp.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Escape regex char
3 | *
4 | * See: https://stackoverflow.com/questions/17885855/use-dynamic-variable-string-as-regex-pattern-in-javascript
5 | */
6 | export const escapeRegExp = (stringToGoIntoTheRegex: string): string => {
7 | return stringToGoIntoTheRegex.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
8 | };
9 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/getSuffix.ts:
--------------------------------------------------------------------------------
1 | import { escapeRegExp } from "./escapeRegExp.js";
2 | type Options = {
3 | decimalSeparator?: string | undefined;
4 | groupSeparator?: string | undefined;
5 | };
6 |
7 | export const getSuffix = (
8 | value: string,
9 | { groupSeparator = ",", decimalSeparator = "." }: Options,
10 | ): string | undefined => {
11 | const suffixReg = new RegExp(
12 | `\\d([^${escapeRegExp(groupSeparator)}${escapeRegExp(
13 | decimalSeparator,
14 | )}0-9]+)`,
15 | );
16 | const suffixMatch = value.match(suffixReg);
17 | return suffixMatch ? suffixMatch[1] : undefined;
18 | };
19 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./cleanValue.js";
2 | export * from "./fixedDecimalValue.js";
3 | export * from "./formatValue.js";
4 | export * from "./getLocaleConfig.js";
5 | export * from "./getSuffix.js";
6 | export * from "./isNumber.js";
7 | export * from "./padTrimValue.js";
8 | export * from "./repositionCursor.js";
9 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/isNumber.ts:
--------------------------------------------------------------------------------
1 | export const isNumber = (input: string): boolean =>
2 | RegExp(/\d/, "gi").test(input);
3 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/padTrimValue.ts:
--------------------------------------------------------------------------------
1 | export const padTrimValue = (
2 | value: string,
3 | decimalSeparator = ".",
4 | decimalScale?: number,
5 | ): string => {
6 | if (decimalScale === undefined || value === "" || value === undefined) {
7 | return value;
8 | }
9 |
10 | if (!value.match(/\d/g)) {
11 | return "";
12 | }
13 |
14 | const [int, decimals] = value.split(decimalSeparator);
15 |
16 | if (decimalScale === 0) {
17 | return int;
18 | }
19 |
20 | let newValue = decimals || "";
21 |
22 | if (newValue.length < decimalScale) {
23 | while (newValue.length < decimalScale) {
24 | newValue += "0";
25 | }
26 | } else {
27 | newValue = newValue.slice(0, decimalScale);
28 | }
29 |
30 | return `${int}${decimalSeparator}${newValue}`;
31 | };
32 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/removeInvalidChars.ts:
--------------------------------------------------------------------------------
1 | import { escapeRegExp } from "./escapeRegExp.js";
2 |
3 | /**
4 | * Remove invalid characters
5 | */
6 | export const removeInvalidChars = (
7 | value: string,
8 | validChars: ReadonlyArray,
9 | ): string => {
10 | const chars = escapeRegExp(validChars.join(""));
11 | const reg = new RegExp(`[^\\d${chars}]`, "gi");
12 | return value.replace(reg, "");
13 | };
14 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useNumberInput/utils/removeSeparators.ts:
--------------------------------------------------------------------------------
1 | import { escapeRegExp } from "./escapeRegExp.js";
2 |
3 | /**
4 | * Remove group separator from value eg. 1,000 > 1000
5 | */
6 | export const removeSeparators = (value: string, separator = ","): string => {
7 | const reg = new RegExp(escapeRegExp(separator), "g");
8 | return value.replace(reg, "");
9 | };
10 |
--------------------------------------------------------------------------------
/packages/ui/src/hooks/useWhatChanged.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line no-restricted-imports */
2 | import { useWhatChanged } from "@simbathesailor/use-what-changed";
3 |
4 | export { useWhatChanged };
5 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowCircleTier1.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function ArrowCircleTier1() {
4 | return (
5 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowCircleTier2.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function ArrowCircleTier2() {
4 | return (
5 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowCircleTier3.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function ArrowCircleTier3() {
4 | return (
5 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowCornerDownRight.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function ArrowCornerDownRight({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowDown.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function ArrowDown({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowLeft.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function ArrowLeft({
6 | strokeWidth = "2",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowRight.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function ArrowRight({
6 | strokeWidth = "1.33333",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowUp.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function ArrowUp({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowUpRight.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function ArrowUpRight({
6 | strokeWidth = "2.5",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowsDown.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function ArrowsDown({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ArrowsUp.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function ArrowsUp({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Calendar.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Calendar({
6 | strokeWidth = "1.33333",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
26 | );
27 | }
28 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CaretRight.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function CaretRight({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CentralArrowShareRight.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function CentralArrowShareRight({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps = {}) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Checkmark.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Checkmark({
6 | strokeWidth = "2",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CheckmarkCircleTier1.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function CheckmarkCircleTier1() {
4 | return (
5 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CheckmarkCircleTier2.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function CheckmarkCircleTier2() {
4 | return (
5 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CheckmarkCircleTier3.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function CheckmarkCircleTier3() {
4 | return (
5 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CheckmarkGreen.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function CheckmarkGreen({
6 | strokeWidth = "4",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
26 | );
27 | }
28 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Chevron.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function Chevron({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ChevronDown.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function ChevronDown({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ChevronLeft.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2024, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export const ChevronLeft = ({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) => (
10 |
25 | );
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ChevronRight.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2024, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function ChevronRight() {
4 | return (
5 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/ChevronUp.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function ChevronUp({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CircleCheck.tsx:
--------------------------------------------------------------------------------
1 | import { invertStrokeColor } from "./constants.js";
2 | import { type PathProps } from "./types.js";
3 |
4 | export function CircleCheck({
5 | strokeWidth = "1.14286",
6 | strokeLinecap = "butt",
7 | strokeLinejoin = "miter",
8 | }: PathProps) {
9 | return (
10 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CircleCheckOutline.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function CircleCheckOutline({
4 | strokeWidth = "2",
5 | strokeLinecap = "butt",
6 | strokeLinejoin = "miter",
7 | }: PathProps) {
8 | return (
9 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Close.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Close({
6 | strokeWidth = "1",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/CloudUpload.tsx:
--------------------------------------------------------------------------------
1 | export function CloudUpload() {
2 | return (
3 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Code.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Code({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Envelope.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Envelope({
6 | strokeWidth = "3",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/LightningBoltOutline.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function LightningBoltOutline() {
4 | return (
5 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/LightningOnRoundedSquare.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function LightningOnRoundedSquare() {
4 | return (
5 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Logo.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023, Lightspark Group, Inc. - All Rights Reserved
2 | import LogoSvg from "../static/images/Logo.svg";
3 |
4 | export function Logo() {
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Logout.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2024, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function Logout() {
4 | return (
5 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/MessageBubble.tsx:
--------------------------------------------------------------------------------
1 | export function MessageBubble() {
2 | return (
3 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Minus.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Minus({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | }: PathProps) {
9 | return (
10 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/NodeAdd.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function NodeAdd({
6 | strokeWidth = "1",
7 | strokeLinecap = "round",
8 | }: PathProps) {
9 | return (
10 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/PaperPlane.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function PaperPlane({
6 | strokeWidth = "1",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Remove.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Remove({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | }: PathProps) {
9 | return (
10 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Roadmap.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function Roadmap({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Sidebar.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Sidebar({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Sort.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Sort({
6 | strokeWidth = "1.5",
7 | strokeLinecap = "square",
8 | }: PathProps) {
9 | return (
10 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Spark.tsx:
--------------------------------------------------------------------------------
1 | export function Spark() {
2 | return (
3 |
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/StackedLines.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "./types.js";
2 |
3 | export function StackedLines({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | }: PathProps) {
7 | return (
8 |
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Terminal.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2023, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | import { type PathProps } from "./types.js";
4 |
5 | export function Terminal({
6 | strokeWidth = "2.28571",
7 | strokeLinecap = "round",
8 | strokeLinejoin = "round",
9 | }: PathProps) {
10 | return (
11 |
26 | );
27 | }
28 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/Zap.tsx:
--------------------------------------------------------------------------------
1 | // Copyright ©, 2022, Lightspark Group, Inc. - All Rights Reserved
2 |
3 | export function Zap() {
4 | return (
5 |
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowBoxRight.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowBoxRight({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowDownLeft.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowDownLeft({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowInbox.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowInbox({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowInboxUp.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowInboxUp({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowLeft.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowLeft({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowUpDown.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowUpDown({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps = {}) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ArrowUpRight.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ArrowUpRight({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/BarsThree.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function BarsThree({
4 | strokeWidth = "2",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/Checkmark2.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function Checkmark2({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/Checkmark2Small.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function Checkmark2Small({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronBottom.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronBottom({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronBottomSm.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronBottomSm({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronBottomXs.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronBottomXs({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronLeft.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronLeft({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronLeftSm.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronLeftSm({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronLeftXs.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronLeftXs({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronRight.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronRight({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronRightSm.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronRightSm({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronRightXs.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronRightXs({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronTop.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronTop({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronTopSm.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronTopSm({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ChevronTopXs.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ChevronTopXs({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/CrossLarge.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function CrossLarge({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/Email3.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function Email3({
4 | strokeWidth = "2",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/MinusLarge.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function MinusLarge({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/MinusSmall.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function MinusSmall({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/PlusLarge.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function PlusLarge({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/PlusSmall.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function PlusSmall({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/central/ShareIOS.tsx:
--------------------------------------------------------------------------------
1 | import { type PathProps } from "../types.js";
2 |
3 | export function ShareIOS({
4 | strokeWidth = "1.5",
5 | strokeLinecap = "round",
6 | strokeLinejoin = "round",
7 | }: PathProps) {
8 | return (
9 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/constants.tsx:
--------------------------------------------------------------------------------
1 | export const invertFillColor = "invert-fill-color";
2 | export const invertStrokeColor = "invert-stroke-color";
3 |
--------------------------------------------------------------------------------
/packages/ui/src/icons/types.tsx:
--------------------------------------------------------------------------------
1 | export type PathStrokeWidth = undefined | string;
2 | /* "butt" is default when undefined https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap */
3 | export type PathLinecap = undefined | "butt" | "round" | "square";
4 | /* "miter" is default when undefined https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linejoin */
5 | export type PathLinejoin = undefined | "miter" | "round";
6 |
7 | export type PathProps = {
8 | strokeWidth?: PathStrokeWidth;
9 | strokeLinecap?: PathLinecap;
10 | strokeLinejoin?: PathLinejoin;
11 | fill?: string;
12 | };
13 |
--------------------------------------------------------------------------------
/packages/ui/src/index.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/index.ts
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: "LightsparkIcons";
3 | src: url("./fonts/LightsparkIcons/LightsparkIcons.eot?hxu0p1");
4 | src:
5 | url("./fonts/LightsparkIcons/LightsparkIcons.eot?hxu0p1#iefix")
6 | format("embedded-opentype"),
7 | url("./fonts/LightsparkIcons/LightsparkIcons.ttf?hxu0p1") format("truetype"),
8 | url("./fonts/LightsparkIcons/LightsparkIcons.woff?hxu0p1") format("woff"),
9 | url("./fonts/LightsparkIcons/LightsparkIcons.svg?hxu0p1#icomoon")
10 | format("svg");
11 | font-weight: normal;
12 | font-style: normal;
13 | font-display: block;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts/LightsparkIcons/LightsparkIcons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/static/fonts/LightsparkIcons/LightsparkIcons.eot
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts/LightsparkIcons/LightsparkIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/static/fonts/LightsparkIcons/LightsparkIcons.ttf
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts/LightsparkIcons/LightsparkIcons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/static/fonts/LightsparkIcons/LightsparkIcons.woff
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts/LightsparkIcons/README.md:
--------------------------------------------------------------------------------
1 | Generated with https://icomoon.io/app/#/select/font. When adding new glyphs from Figma be sure to first choose "Outline stroke" after right clicking the icon. Source files used for each gliph are located in the glyph-svg-src directory.
2 |
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts/LightsparkIcons/glyph-svg-src/margin-sats.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/packages/ui/src/static/fonts/LightsparkIcons/glyph-svg-src/sats.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/packages/ui/src/static/images/Checkmark.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/ui/src/static/images/FramedLogoOnCircle.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/packages/ui/src/static/images/LogoMark.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/packages/ui/src/static/images/RainLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/static/images/RainLogo.png
--------------------------------------------------------------------------------
/packages/ui/src/static/images/RotatedElipseGradient-2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/static/images/RotatedElipseGradient-2x.png
--------------------------------------------------------------------------------
/packages/ui/src/static/images/RotatedElipseGradient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightsparkdev/js-sdk/0142bdcbb97b290a54cbf1622b1530c3f400e746/packages/ui/src/static/images/RotatedElipseGradient.png
--------------------------------------------------------------------------------
/packages/ui/src/styles/constants.ts:
--------------------------------------------------------------------------------
1 | export const cssVars = {
2 | docHeight: "--doc-height",
3 | };
4 |
5 | export const headerHeightPx = 102;
6 | export const smHeaderHeightPx = 60;
7 | export const smHeaderLogoMarginLeft = "20px";
8 | export const navBorderRadiusPx = 12;
9 |
--------------------------------------------------------------------------------
/packages/ui/src/styles/themeDefaults/loading.tsx:
--------------------------------------------------------------------------------
1 | import { type IconName } from "../../components/Icon/types.js";
2 |
3 | export const loadingThemeBase = {
4 | defaultIconName: "LoadingSpinner" as IconName,
5 | kinds: {},
6 | };
7 |
8 | export type LoadingKind = keyof typeof loadingThemeBase.kinds;
9 | export type LoadingThemeKey = keyof typeof loadingThemeBase;
10 | type LoadingKindsProps = Record>;
11 |
12 | export const defaultLoadingTheme = {
13 | ...loadingThemeBase,
14 | kinds: {
15 | primary: {
16 | defaultIconName: "LoadingSpinner",
17 | },
18 | } as LoadingKindsProps,
19 | };
20 |
--------------------------------------------------------------------------------
/packages/ui/src/styles/typography.tsx:
--------------------------------------------------------------------------------
1 | import { type Theme } from "@emotion/react";
2 | import { getFontColor, type FontColorKey } from "./themes.js";
3 | import {
4 | getTypographyString,
5 | type TokenSizeKey,
6 | type TypographyTypeKey,
7 | } from "./tokens/typography.js";
8 |
9 | export const applyTypography = (
10 | theme: Theme,
11 | typographyType: TypographyTypeKey,
12 | size: TokenSizeKey,
13 | color: FontColorKey = "inherit",
14 | applyToAll = true,
15 | ) => {
16 | const selector = applyToAll ? "&, & *" : "&";
17 | return `
18 | ${selector} {
19 | ${getTypographyString(theme, typographyType, size)};
20 | color: ${getFontColor(theme, color)};
21 | }
22 | `;
23 | };
24 |
--------------------------------------------------------------------------------
/packages/ui/src/styles/z-index.tsx:
--------------------------------------------------------------------------------
1 | export const z = {
2 | card: 1,
3 | fieldError: 1,
4 | textInput: 2,
5 | select: 3,
6 | selectFocused: 4,
7 | walletActionPreviewTopGradient: 1,
8 | headerContainer: 99,
9 | smBanner: 99,
10 | headerTop: 100,
11 | navMenu: 100,
12 | smNavMenu: 100,
13 | navAction: 101,
14 | smNavAction: 100, // keep under navDropdown
15 | notificationBanner: 170,
16 | qrReaderVideo: 180,
17 | qrReaderOverlay: 181,
18 | modalOverlay: 190,
19 | modalContainer: 191,
20 | dropdown: 192,
21 | tooltip: 193,
22 | toast: 200,
23 | };
24 |
--------------------------------------------------------------------------------
/packages/ui/src/types/typeGuard.tsx:
--------------------------------------------------------------------------------
1 | import { type ReactNode, isValidElement } from "react";
2 |
3 | /* eslint-disable @typescript-eslint/no-explicit-any */
4 | // Type guard to check if a value is a ReactNode
5 | export function isReactNode(value: any): value is ReactNode {
6 | return (
7 | typeof value === "string" ||
8 | typeof value === "number" ||
9 | typeof value === "boolean" ||
10 | value === null ||
11 | value === undefined ||
12 | /* eslint-disable @typescript-eslint/no-unsafe-argument */
13 | isValidElement(value) ||
14 | (Array.isArray(value) && value.every(isReactNode))
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/emotion.tsx:
--------------------------------------------------------------------------------
1 | /* Direct component selectors only work in babel contexts. This is a util to convert the
2 | component to a string selector for convenience. See LIG-4092 for more details. */
3 | export function select(component: { toString: () => string }) {
4 | return component.toString();
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/getGQLOperationName.tsx:
--------------------------------------------------------------------------------
1 | import { Kind, type DocumentNode } from "graphql";
2 |
3 | export function getGQLOperationName(query: DocumentNode) {
4 | if (query.definitions.length === 0) {
5 | return undefined;
6 | }
7 |
8 | const definition = query.definitions[0];
9 |
10 | // Check that the definition is an operation definition,
11 | // which is expected to have a "name" property.
12 | if (definition.kind !== Kind.OPERATION_DEFINITION) {
13 | return undefined;
14 | }
15 |
16 | // At this point, it's safe to assert the type.
17 | const opDef = definition;
18 | return opDef.name?.value;
19 | }
20 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./countryCodesToNames.js";
2 | export * from "./emotion.js";
3 | export * from "./getGQLOperationName.js";
4 | export * from "./isReactNodeWithChildren.js";
5 | export * from "./locale.js";
6 | export * from "./NextLink.js";
7 | export * from "./parseURLFragments.js";
8 | export * from "./strings.js";
9 | export * from "./toReactNodes/nodes.js";
10 | export * from "./toReactNodes/setReactNodesTypography.js";
11 | export * from "./toReactNodes/stringToNodes.js";
12 | export * from "./toReactNodes/toReactNodes.js";
13 | export * from "./transformGQLName.js";
14 | export * from "./unicode.js";
15 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/isReactNodeWithChildren.tsx:
--------------------------------------------------------------------------------
1 | import { isValidElement, type ReactElement, type ReactNode } from "react";
2 |
3 | type ReactNodeWithChildren = ReactElement<{
4 | children: ReactNode;
5 | }>;
6 |
7 | export function isReactNodeWithChildren(
8 | node: unknown,
9 | ): node is ReactNodeWithChildren {
10 | return Boolean(
11 | node &&
12 | isValidElement(node) &&
13 | typeof node.props === "object" &&
14 | node.props !== null &&
15 | "children" in node.props &&
16 | node.props.children !== undefined,
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/locale.ts:
--------------------------------------------------------------------------------
1 | export function getCurrentBaseLanguage() {
2 | const userLocale = navigator.language; // e.g. "es-MX"
3 | const locale = new Intl.Locale(userLocale);
4 | return locale.language; // e.g. "es"
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/parseURLFragments.ts:
--------------------------------------------------------------------------------
1 | export function parseURLFragments(url: string) {
2 | const hash = url.slice(1);
3 | const pairs = hash.split("&"); // Split by '&' to get each key-value pair
4 |
5 | if (!hash || !pairs.length) {
6 | return null;
7 | }
8 |
9 | const params = {} as Record;
10 |
11 | pairs.forEach((pair) => {
12 | const [key, value] = pair.split("="); // Split each pair by '=' to separate keys and values
13 | params[key] = decodeURIComponent(value || ""); // Decode and assign to the params object
14 | });
15 |
16 | return params;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/toReactNodes/stringToNodes.tsx:
--------------------------------------------------------------------------------
1 | export function stringToNodes(str: string) {
2 | return str.split("\n").map((str, i, strArr) => {
3 | /* text property is a sufficient key for both strings and text nodes due to minimal impl */
4 | const key = `str-${i}-${str.substr(0, 20)}`;
5 | /* Must use spans to avoid conditional Fragment rendering errors https://bit.ly/3zkHEEM */
6 | return !str && i === strArr.length - 1 ? null : (
7 |
8 | {str.length ? str : null}
9 | {i < strArr.length - 1 ?
: null}
10 |
11 | );
12 | });
13 | }
14 |
--------------------------------------------------------------------------------
/packages/ui/src/utils/unicode.tsx:
--------------------------------------------------------------------------------
1 | export const nbsp = "\u00A0";
2 |
--------------------------------------------------------------------------------
/packages/ui/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig/react-package.json",
3 | "compilerOptions": {
4 | "rootDir": "src",
5 | "baseUrl": ".",
6 | "noErrorTruncation": true,
7 | "strict": true,
8 | "alwaysStrict": true
9 | },
10 | "include": ["src/**/*.ts", "src/**/*.tsx"],
11 | "exclude": ["**/tests", "node_modules", "dist"]
12 | }
13 |
--------------------------------------------------------------------------------
/packages/ui/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["//"],
3 | "tasks": {
4 | "package:checks": {
5 | "dependsOn": ["build"]
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/vite/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @lightsparkdev/vite
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - 062bf8a: [js] Add engines field to all packages to indicate supported NodeJS versions
8 |
--------------------------------------------------------------------------------
/packages/vite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@lightsparkdev/vite",
3 | "version": "0.0.1",
4 | "private": true,
5 | "main": "./index.cjs",
6 | "type": "module",
7 | "dependencies": {
8 | "rollup-plugin-visualizer": "^5.12.0",
9 | "vite": "^5.1.6",
10 | "vite-plugin-svgr": "^3.2.0"
11 | },
12 | "engines": {
13 | "node": ">=18"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------