{"_id":"@buildonspark/lightning-mpp-sdk","_rev":"7-7b90fae60d2db389148ed391aedaf6e1","name":"@buildonspark/lightning-mpp-sdk","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"@buildonspark/lightning-mpp-sdk","version":"0.1.0","_id":"@buildonspark/lightning-mpp-sdk@0.1.0","maintainers":[{"name":"jeremyatlightspark","email":"jeremy@lightspark.com"},{"name":"mgorven.ls","email":"mgorven@lightspark.com"},{"name":"coreymartin","email":"coreyn.martin@gmail.com"},{"name":"cpartee6","email":"cpartee6@gmail.com"},{"name":"ch-brian","email":"chiangbri@gmail.com"},{"name":"brett.ls","email":"brett@lightspark.com"},{"name":"lightsparkmax","email":"max@lightspark.com"}],"dist":{"shasum":"1612e13fdb00c3e88c210c3bc52ab27747518a7e","tarball":"https://registry.npmjs.org/@buildonspark/lightning-mpp-sdk/-/lightning-mpp-sdk-0.1.0.tgz","fileCount":51,"integrity":"sha512-mKq0mfBpBCEewqnVB6o5EL/2VBoSnk6HpSquGKVVXIg4Ze1KHwdTxiflhxvnaTxzVMUiD2miZ/rbkDFAqP1HWg==","signatures":[{"sig":"MEUCIQDT2ImnYj0kucbhDX/cfwd9L2d1zIuJ1K8U2YBh47ei8wIgHAFkBKU+dyXo6N5c2aT2bQcEBgatE3tfD5lml2sjDkg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":154826},"type":"module","exports":{".":{"ts":"./src/index.ts","types":"./dist/index.d.ts","default":"./dist/index.js"},"./client":{"ts":"./src/client/index.ts","types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./server":{"ts":"./src/server/index.ts","types":"./dist/server/index.d.ts","default":"./dist/server/index.js"}},"gitHead":"630772383145c7e879359c3bf73100d96eca8916","scripts":{"test":"node --import tsx/esm --test src/__tests__/charge.test.ts src/__tests__/session.test.ts","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"npx tsc --noEmit","example:client":"npx tsx examples/client.ts","example:server":"npx tsx examples/server.ts","example:client-session":"npx tsx examples/client-session.ts","example:server-session":"npx tsx examples/server-session.ts"},"_npmUser":{"name":"coreymartin","email":"coreyn.martin@gmail.com"},"_npmVersion":"10.2.3","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@noble/hashes":"^2.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","mppx":"^0.3.15","viem":"^2.46.2","typescript":"^5.9.3","@types/node":"^25.4.0","@buildonspark/spark-sdk":"^0.7.1"},"peerDependencies":{"mppx":"^0.3.15","@buildonspark/spark-sdk":"^0.7.1"},"_npmOperationalInternal":{"tmp":"tmp/lightning-mpp-sdk_0.1.0_1773678111092_0.7803582774904863","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@buildonspark/lightning-mpp-sdk","version":"0.1.1","_id":"@buildonspark/lightning-mpp-sdk@0.1.1","maintainers":[{"name":"jeremyatlightspark","email":"jeremy@lightspark.com"},{"name":"mgorven.ls","email":"mgorven@lightspark.com"},{"name":"coreymartin","email":"coreyn.martin@gmail.com"},{"name":"cpartee6","email":"cpartee6@gmail.com"},{"name":"ch-brian","email":"chiangbri@gmail.com"},{"name":"brett.ls","email":"brett@lightspark.com"},{"name":"lightsparkmax","email":"max@lightspark.com"}],"dist":{"shasum":"c43c5d9174c42c3229f9bcf460a9e4a28b0a961a","tarball":"https://registry.npmjs.org/@buildonspark/lightning-mpp-sdk/-/lightning-mpp-sdk-0.1.1.tgz","fileCount":51,"integrity":"sha512-fJqYEzRHDleH6zzI0Edu+IKxIMuQw58raPsiChLzq24EZjXIU8/ON6X6eBBhMi7E6uCPmpgQ+ET185dkMfYw/g==","signatures":[{"sig":"MEUCIQCpFoAAa+R6nRTUAZkkQQ8rE5KYoPlDhIJ3D6gdmCCmjAIgD3ElgaV8T4ks227tDRcEkVOt4tbBx80fBRskyS2EhZk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":154826},"type":"module","exports":{".":{"ts":"./src/index.ts","types":"./dist/index.d.ts","default":"./dist/index.js"},"./client":{"ts":"./src/client/index.ts","types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./server":{"ts":"./src/server/index.ts","types":"./dist/server/index.d.ts","default":"./dist/server/index.js"}},"gitHead":"025e29db2afc15850341e9033687c3cb6d7a3174","scripts":{"test":"node --import tsx/esm --test src/__tests__/charge.test.ts src/__tests__/session.test.ts","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"npx tsc --noEmit","example:client":"npx tsx examples/client.ts","example:server":"npx tsx examples/server.ts","example:client-session":"npx tsx examples/client-session.ts","example:server-session":"npx tsx examples/server-session.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5aca6ff4-b799-4845-8f7d-12e3e8ceedc2"}},"_npmVersion":"11.9.0","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@noble/hashes":"^2.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","mppx":"^0.3.15","viem":"^2.46.2","typescript":"^5.9.3","@types/node":"^25.4.0","@buildonspark/spark-sdk":"^0.7.1"},"peerDependencies":{"mppx":"^0.3.15","@buildonspark/spark-sdk":"^0.7.1"},"_npmOperationalInternal":{"tmp":"tmp/lightning-mpp-sdk_0.1.1_1773767828096_0.0950828030222699","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@buildonspark/lightning-mpp-sdk","version":"0.1.2","_id":"@buildonspark/lightning-mpp-sdk@0.1.2","maintainers":[{"name":"jeremyatlightspark","email":"jeremy@lightspark.com"},{"name":"mgorven.ls","email":"mgorven@lightspark.com"},{"name":"coreymartin","email":"coreyn.martin@gmail.com"},{"name":"cpartee6","email":"cpartee6@gmail.com"},{"name":"ch-brian","email":"chiangbri@gmail.com"},{"name":"brett.ls","email":"brett@lightspark.com"},{"name":"lightsparkmax","email":"max@lightspark.com"}],"dist":{"shasum":"1eef6df2e3a960a5ea7ffabb5ad4d3224f176378","tarball":"https://registry.npmjs.org/@buildonspark/lightning-mpp-sdk/-/lightning-mpp-sdk-0.1.2.tgz","fileCount":51,"integrity":"sha512-uYeh9jBmjASmoODSrTXKFKhqX1zfsOB2R1Hwgnp6+ZTfpRyEPstvBKb9CM/D3hPmU/JATJb1qUy9UKBQaeH3xQ==","signatures":[{"sig":"MEQCICtz6K6JrCzuhNbNnQJF0Tr7Z6fWYMPQoKGJkIV3DBuIAiBJBr2C5gypdyQ7e8JhZc/ATqT0PnJdt5W4GfKo43TAAA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":154864},"type":"module","exports":{".":{"ts":"./src/index.ts","types":"./dist/index.d.ts","default":"./dist/index.js"},"./client":{"ts":"./src/client/index.ts","types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./server":{"ts":"./src/server/index.ts","types":"./dist/server/index.d.ts","default":"./dist/server/index.js"}},"gitHead":"cfd8f9ac2cb3f4650eba98dc135549810bae2e55","scripts":{"test":"node --import tsx/esm --test src/__tests__/charge.test.ts src/__tests__/session.test.ts","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"npx tsc --noEmit","example:client":"npx tsx examples/client.ts","example:server":"npx tsx examples/server.ts","example:client-session":"npx tsx examples/client-session.ts","example:server-session":"npx tsx examples/server-session.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5aca6ff4-b799-4845-8f7d-12e3e8ceedc2"}},"_npmVersion":"11.9.0","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@noble/hashes":"^2.0.1","light-bolt11-decoder":"^3.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","mppx":"^0.3.15","viem":"^2.46.2","typescript":"^5.9.3","@types/node":"^25.4.0","@buildonspark/spark-sdk":"^0.7.1"},"peerDependencies":{"mppx":"^0.3.15","@buildonspark/spark-sdk":"^0.7.1"},"_npmOperationalInternal":{"tmp":"tmp/lightning-mpp-sdk_0.1.2_1773777280462_0.5328625995123173","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@buildonspark/lightning-mpp-sdk","version":"0.1.3","_id":"@buildonspark/lightning-mpp-sdk@0.1.3","maintainers":[{"name":"jeremyatlightspark","email":"jeremy@lightspark.com"},{"name":"mgorven.ls","email":"mgorven@lightspark.com"},{"name":"coreymartin","email":"coreyn.martin@gmail.com"},{"name":"cpartee6","email":"cpartee6@gmail.com"},{"name":"ch-brian","email":"chiangbri@gmail.com"},{"name":"brett.ls","email":"brett@lightspark.com"},{"name":"lightsparkmax","email":"max@lightspark.com"}],"homepage":"https://github.com/buildonspark/lightning-mpp-sdk#readme","bugs":{"url":"https://github.com/buildonspark/lightning-mpp-sdk/issues"},"dist":{"shasum":"7c899e8fd4bdbace7ed615fe2cf6a1c2795a3f8a","tarball":"https://registry.npmjs.org/@buildonspark/lightning-mpp-sdk/-/lightning-mpp-sdk-0.1.3.tgz","fileCount":52,"integrity":"sha512-g9Yg0hLR++4eeCUuW6ZOAN171lHQ74q7w2jPJz7tSsOo7JRr3K32ptl7wCoN/lTToZv3XySHt7KbEugyH7mADQ==","signatures":[{"sig":"MEUCIQC//4PTePPAVNE1ZXe6oScpOJZ2J98UkidAcRPZLZHnZwIgWbtt/TvX4yVJO0vnZ+4t35G6tMm/RrfL9BB4GdiYFJ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@buildonspark%2flightning-mpp-sdk@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":161788},"type":"module","exports":{".":{"ts":"./src/index.ts","types":"./dist/index.d.ts","default":"./dist/index.js"},"./client":{"ts":"./src/client/index.ts","types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./server":{"ts":"./src/server/index.ts","types":"./dist/server/index.d.ts","default":"./dist/server/index.js"}},"gitHead":"3e47603ad312f7ed356129cb1a1118652b40ac0f","scripts":{"test":"node --import tsx/esm --test src/__tests__/charge.test.ts src/__tests__/session.test.ts","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"npx tsc --noEmit","example:client":"npx tsx examples/client.ts","example:server":"npx tsx examples/server.ts","example:client-session":"npx tsx examples/client-session.ts","example:server-session":"npx tsx examples/server-session.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5aca6ff4-b799-4845-8f7d-12e3e8ceedc2"}},"repository":{"url":"git+https://github.com/buildonspark/lightning-mpp-sdk.git","type":"git","directory":"sdk"},"_npmVersion":"11.9.0","description":"<p align=\"center\">   <img src=\"./assets/banner.png\" alt=\"@buildonspark/lightning-mpp-sdk\" width=\"800\"> </p>","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@noble/hashes":"^2.0.1","light-bolt11-decoder":"^3.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","mppx":"^0.3.15","viem":"^2.46.2","typescript":"^5.9.3","@types/node":"^25.4.0","@buildonspark/spark-sdk":"^0.7.1"},"peerDependencies":{"mppx":"^0.3.15","@buildonspark/spark-sdk":"^0.7.1"},"_npmOperationalInternal":{"tmp":"tmp/lightning-mpp-sdk_0.1.3_1773811664550_0.06313967921615848","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@buildonspark/lightning-mpp-sdk","version":"0.1.4","_id":"@buildonspark/lightning-mpp-sdk@0.1.4","maintainers":[{"name":"jeremyatlightspark","email":"jeremy@lightspark.com"},{"name":"mgorven.ls","email":"mgorven@lightspark.com"},{"name":"coreymartin","email":"coreyn.martin@gmail.com"},{"name":"cpartee6","email":"cpartee6@gmail.com"},{"name":"ch-brian","email":"chiangbri@gmail.com"},{"name":"brett.ls","email":"brett@lightspark.com"},{"name":"lightsparkmax","email":"max@lightspark.com"}],"homepage":"https://github.com/buildonspark/lightning-mpp-sdk#readme","bugs":{"url":"https://github.com/buildonspark/lightning-mpp-sdk/issues"},"dist":{"shasum":"f70f6d4a5c7cfecbcd33b5f4e465d34a27dcf0c3","tarball":"https://registry.npmjs.org/@buildonspark/lightning-mpp-sdk/-/lightning-mpp-sdk-0.1.4.tgz","fileCount":52,"integrity":"sha512-8WnI3QF2obCsVSOTUJWTQWfTThmDO+1ugQQCZ7VueMBXU8M6gu4gNGgmSI0+IzmPy7EHWALJOcvKkZlap7YglA==","signatures":[{"sig":"MEUCIEU0pVZqlHdZa8mW+oJ62rTYiAvfjnKnBceqNNdYHBjbAiEA70ptS3lfI6jl5+git2QRbgZgqE4oI6tp7mJVk8BPwCA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@buildonspark%2flightning-mpp-sdk@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":161856},"type":"module","exports":{".":{"ts":"./src/index.ts","types":"./dist/index.d.ts","default":"./dist/index.js"},"./client":{"ts":"./src/client/index.ts","types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./server":{"ts":"./src/server/index.ts","types":"./dist/server/index.d.ts","default":"./dist/server/index.js"}},"gitHead":"64b98e3a4b40fa280ec0edfed2cb978b8bb7a234","scripts":{"test":"node --import tsx/esm --test src/__tests__/charge.test.ts src/__tests__/session.test.ts","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"npx tsc --noEmit","example:client":"npx tsx examples/client.ts","example:server":"npx tsx examples/server.ts","example:client-session":"npx tsx examples/client-session.ts","example:server-session":"npx tsx examples/server-session.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5aca6ff4-b799-4845-8f7d-12e3e8ceedc2"}},"repository":{"url":"git+https://github.com/buildonspark/lightning-mpp-sdk.git","type":"git","directory":"sdk"},"_npmVersion":"11.9.0","description":"<p align=\"center\">   <img src=\"https://raw.githubusercontent.com/buildonspark/lightning-mpp-sdk/main/assets/banner.png\" alt=\"@buildonspark/lightning-mpp-sdk\" width=\"800\"> </p>","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@noble/hashes":"^2.0.1","light-bolt11-decoder":"^3.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","mppx":"^0.3.15","viem":"^2.46.2","typescript":"^5.9.3","@types/node":"^25.4.0","@buildonspark/spark-sdk":"^0.7.1"},"peerDependencies":{"mppx":"^0.3.15","@buildonspark/spark-sdk":"^0.7.1"},"_npmOperationalInternal":{"tmp":"tmp/lightning-mpp-sdk_0.1.4_1773859746661_0.2528452862355841","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-03-16T16:21:50.971Z","modified":"2026-09-03T18:21:09.100Z","0.1.0":"2026-03-16T16:21:51.231Z","0.1.1":"2026-03-17T17:17:08.248Z","0.1.2":"2026-03-17T19:54:40.648Z","0.1.3":"2026-03-18T05:27:44.690Z","0.1.4":"2026-03-18T18:49:06.828Z"},"bugs":{"url":"https://github.com/buildonspark/lightning-mpp-sdk/issues"},"homepage":"https://github.com/buildonspark/lightning-mpp-sdk#readme","repository":{"url":"git+https://github.com/buildonspark/lightning-mpp-sdk.git","type":"git","directory":"sdk"},"description":"<p align=\"center\">   <img src=\"https://raw.githubusercontent.com/buildonspark/lightning-mpp-sdk/main/assets/banner.png\" alt=\"@buildonspark/lightning-mpp-sdk\" width=\"800\"> </p>","maintainers":[{"email":"jeremy@lightspark.com","name":"jeremyatlightspark"},{"email":"kph@lightspark.com","name":"kph"},{"email":"mgorven@lightspark.com","name":"mgorven.ls"},{"email":"coreyn.martin@gmail.com","name":"coreymartin"},{"email":"cpartee6@gmail.com","name":"cpartee6"},{"email":"chiangbri@gmail.com","name":"ch-brian"},{"email":"max@lightspark.com","name":"lightsparkmax"}],"readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/buildonspark/lightning-mpp-sdk/main/assets/banner.png\" alt=\"@buildonspark/lightning-mpp-sdk\" width=\"800\">\n</p>\n\n# lightning-mppx\n\nA Lightning Network payment method for [MPP](https://mpp.dev).\n\n> **Note for Lightning developers:** In the Lightning Network, \"MPP\" refers to [Multi-Path Payments](https://bitcoinops.org/en/topics/multipath-payments/) (BOLT #4). This is unrelated - [MPP](https://mpp.dev) here stands for **Machine Payments Protocol**, an open HTTP payment standard.\n\n[MPP](https://mpp.dev) (Machine Payments Protocol) is an open protocol that lets any HTTP API accept payments using the standard `402 Payment Required` flow. `@buildonspark/lightning-mpp-sdk` extends the [`mppx`](https://github.com/tempoxyz/mpp) SDK with Lightning Network support via [Spark](https://spark.money), sitting alongside built-in methods like [Stripe](https://stripe.com) and [Tempo](https://tempo.xyz).\n\nThe protocol supports two intents - **charge** for one-time payments and **session** for prepaid metered access - defined in implementation-agnostic [IETF-style specifications](https://paymentauth.org) that any Lightning node or wallet can implement.\n\n## Why Lightning\n\nMPP is payment-method agnostic by design - the right payment method depends on the context. Lightning brings something unique to the table.\n\n**No one controls it.** Bitcoin is an open network. Anyone can run a node, verify transactions, and move money without depending on a third party. A payment layer for the open internet should be just as open as the network it runs on.\n\n**Private by default.** Lightning payments are onion-routed. When an agent pays for an API call, the only parties who know are the payer and the payee.\n\n**Unmatched network effects.** Bitcoin has more liquidity than all stablecoins combined by an order of magnitude. Cash App, Coinbase, Binance, Strike, Kraken, and most major fintechs already support Lightning.\n\n## How it works\n\n1. Client requests a resource.\n2. Server returns `402 Payment Required` with a fresh [BOLT11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) invoice.\n3. Client pays the invoice over the Lightning Network.\n4. Client retries with the payment preimage as proof.\n5. Server verifies `sha256(preimage) == paymentHash` locally and returns the resource with a receipt.\n\nNo external payment processor. No polling. No webhooks. The preimage _is_ the proof of payment.\n\n## Getting started\n\n### Installation\n\n```bash\nnpm install @buildonspark/lightning-mpp-sdk mppx\n```\n\n### Server\n\nUses the Web-standard `Request`/`Response` API - works with Node.js, Cloudflare Workers, Next.js, and any other runtime.\n\n```ts\nimport { Mppx, spark } from '@buildonspark/lightning-mpp-sdk/server'\n\nconst mppx = Mppx.create({\n  methods: [spark.charge({ mnemonic: process.env.MNEMONIC! })],\n  secretKey: process.env.MPP_SECRET_KEY!,\n})\n\nexport async function handler(request: Request): Promise<Response> {\n  const result = await mppx.charge({\n    amount: '100',\n    currency: 'sat',\n    description: 'Premium API access',\n  })(request)\n\n  if (result.status === 402) return result.challenge\n\n  return result.withReceipt(Response.json({ data: '...' }))\n}\n```\n\n### Client\n\nThe MPP client intercepts 402 responses automatically - paying invoices and retrying with credentials before returning the final response to your code.\n\n```ts\nimport { Mppx, spark } from '@buildonspark/lightning-mpp-sdk/client'\n\nconst method = spark.charge({ mnemonic: process.env.MNEMONIC! })\nconst mppx = Mppx.create({ polyfill: false, methods: [method] })\n\ntry {\n  const response = await mppx.fetch('https://api.example.com/weather')\n  console.log(await response.json())\n} finally {\n  await method.cleanup()\n}\n```\n\nOr patch `globalThis.fetch` so all requests are payment-aware:\n\n```ts\nimport { Mppx, spark } from '@buildonspark/lightning-mpp-sdk/client'\n\nMppx.create({ methods: [spark.charge({ mnemonic: process.env.MNEMONIC! })] })\n\nconst response = await fetch('https://api.example.com/weather')\n```\n## Configuration\n\n### Server - `spark.charge()`\n\n| Parameter  | Type                                     | Required | Default     |\n| ---------- | ---------------------------------------- | -------- | ----------- |\n| `mnemonic` | `string`                                 | Yes      |             |\n| `network`  | `'mainnet'` \\| `'regtest'` \\| `'signet'` | No       | `'mainnet'` |\n\n### Server - `mppx.charge()`\n\n| Parameter     | Type     | Required | Default |\n| ------------- | -------- | -------- | ------- |\n| `amount`      | `string` | Yes      |                                       |\n| `currency`    | `string` | No       | `'sat'`                               |\n| `description` | `string` | No       |                                       |\n\n### Client - `spark.charge()`\n\n| Parameter    | Type                                     | Required | Default     |\n| ------------ | ---------------------------------------- | -------- | ----------- |\n| `mnemonic`   | `string`                                 | Yes      |             |\n| `network`    | `'mainnet'` \\| `'regtest'` \\| `'signet'` | No       | `'mainnet'` |\n| `maxFeeSats` | `number`                                 | No       | `100`       |\n\n## Examples\n\nThe `examples/` directory contains a weather API demo - a server that charges 100 sats per request and a client that pays automatically. Both run on regtest using Spark wallets.\n\n```bash\n# Terminal 1\nnpm run example:server\n\n# Terminal 2\nnpm run example:client\n```\n\n## Wallet funding\n\nOn **mainnet**, fund your client wallet by depositing sats via Spark, Lightning, or L1:\n\n```ts\nimport { SparkWallet } from '@buildonspark/spark-sdk'\n\nconst { wallet } = await SparkWallet.initialize({ mnemonicOrSeed: mnemonic })\n\n// Spark\nconsole.log(await wallet.getSparkAddress())\n// sprt1pqqqqq2yuzewtxcnuswt8xnz6gdwmspk5ln3gl4wfar4stc7qa9xscvflqe\n\n// L1 (Bitcoin on-chain)\nconsole.log(await wallet.getStaticDepositAddress())\n// bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\n```\n\nFor Lightning, generate a deposit invoice with `wallet.createLightningInvoice({ amountSats, memo })`.\n\nOn **regtest**, use the [Spark faucet](https://docs.spark.money/tools/faucet).\n\n## Specifications\n\nThe Lightning payment method is defined in two IETF-formatted specifications within the [HTTP Payment Authentication](https://paymentauth.org) framework:\n\n- [`draft-lightning-charge-00`](https://paymentauth.org/draft-lightning-charge-00.html) - One-time BOLT11 invoice payments\n- [`draft-lightning-session-00`](https://paymentauth.org/draft-lightning-session-00.html) - Prepaid sessions with per-unit billing and refund on close\n\n## License\n\nMIT\n","readmeFilename":"README.md"}