@piprail/sdk 1.25.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +4 -4
  3. package/dist/{algorand-677ILBQS.js → algorand-GSFVZTBF.js} +10 -18
  4. package/dist/{algorand-ZJ53VCTN.cjs → algorand-HZS43N4P.cjs} +23 -31
  5. package/dist/{aptos-3TSKTI4D.js → aptos-RIL56C7L.js} +10 -18
  6. package/dist/{aptos-XIIHPAOO.cjs → aptos-TRCCJRZA.cjs} +22 -30
  7. package/dist/{chunk-L6WQRHEZ.js → chunk-7XK22JSQ.js} +14 -1
  8. package/dist/{chunk-U35MG4TF.cjs → chunk-JG6KRAW6.cjs} +15 -2
  9. package/dist/index.cjs +282 -197
  10. package/dist/index.d.cts +40 -32
  11. package/dist/index.d.ts +40 -32
  12. package/dist/index.js +176 -91
  13. package/dist/{near-MG256A3E.cjs → near-DI2I3MAV.cjs} +24 -32
  14. package/dist/{near-TWA4PYOD.js → near-MTYBCUYM.js} +10 -18
  15. package/dist/{solana-KWNRY5NR.js → solana-E4MD6JJ6.js} +20 -12
  16. package/dist/{solana-UEMHFQH5.cjs → solana-TLHL2KNY.cjs} +46 -38
  17. package/dist/{stellar-SCRRPCEA.cjs → stellar-FW6C6FBE.cjs} +28 -38
  18. package/dist/{stellar-YB7JXKK4.js → stellar-U5NCRIOJ.js} +12 -22
  19. package/dist/{sui-LFT65OGU.cjs → sui-47C2KEZI.cjs} +23 -31
  20. package/dist/{sui-IODKU2MA.js → sui-Y53M4GUM.js} +10 -18
  21. package/dist/{ton-QN5GTOCS.js → ton-5ZPT5PSP.js} +20 -13
  22. package/dist/{ton-RAYJFKJC.cjs → ton-MMPKWT6N.cjs} +30 -23
  23. package/dist/{tron-KX4VWS7V.cjs → tron-JOT4STIG.cjs} +33 -38
  24. package/dist/{tron-QSNCDYRB.js → tron-WYS4X2I5.js} +14 -19
  25. package/dist/{xrpl-ECHK3GIX.js → xrpl-2MZEOIFY.js} +11 -19
  26. package/dist/{xrpl-GXUFDXHU.cjs → xrpl-PECT4IMX.cjs} +27 -35
  27. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -4878,44 +4878,42 @@ type PipRailEvent = {
4878
4878
  reason: string;
4879
4879
  };
4880
4880
  /**
4881
- * Wallet for the chosen chain family (the `chain` selector routes; each driver
4882
- * validates its own key format):
4883
- * - EVM → `{ privateKey }` (0x… hex) or a viem `{ walletClient }`
4884
- * - Tron `{ privateKey }` (32-byte hex secp256k1, like EVM)
4885
- * - Sui `{ privateKey }` (suiprivkey1 bech32) or a ready `{ keypair }`
4886
- * - Solana `{ secretKey }` (Uint8Array | base58) or `{ signer }`
4887
- * - TON `{ mnemonic }` (24 words) or a ready `{ keyPair }`
4888
- * - Stellar `{ secret }` (S… seed) or a ready `{ keypair }`
4889
- * - XRPL `{ seed }` (s… seed) or a ready `{ wallet }`
4890
- * - NEAR `{ accountId, privateKey }` (privateKey = ed25519:… secret)
4891
- * - Aptos `{ privateKey }` (AIP-80 `ed25519-priv-0x…` / raw `0x…` hex) or `{ account }`
4892
- * - Algorand→ `{ mnemonic }` (25 words) or a ready `{ account }`
4881
+ * Wallet for the chosen chain family. **One field, every chain: `{ key }`** the
4882
+ * chain's secret as a string (the `chain` selector routes; each driver validates the
4883
+ * format). NEAR also needs `{ accountId }`. What `key` is, per chain:
4884
+ * - EVM / Tron a 0x… hex private key (secp256k1)
4885
+ * - Sui a `suiprivkey1…` bech32 secret
4886
+ * - Aptos an AIP-80 `ed25519-priv-0x…` (or raw `0x…`) secret
4887
+ * - Solana a base58 secret key (or a `Uint8Array`)
4888
+ * - TON a 24-word mnemonic (optional `version: 'v4' | 'v5r1'`, default v4)
4889
+ * - Algorand → a 25-word mnemonic
4890
+ * - Stellar an `S…` secret seed
4891
+ * - XRPL an `s…` secret seed
4892
+ * - NEAR → `{ accountId, key }`, where `key` is an `ed25519:…` secret
4893
+ *
4894
+ * Advanced (bring your own native signer object — type-specific): EVM `{ walletClient }`,
4895
+ * Solana `{ signer }`, TON `{ keyPair }`, Stellar/Sui `{ keypair }`, XRPL `{ wallet }`,
4896
+ * Aptos/Algorand `{ account }`.
4893
4897
  */
4894
4898
  type WalletInput = {
4895
- privateKey: string;
4899
+ key: string;
4900
+ version?: 'v4' | 'v5r1';
4896
4901
  } | {
4897
- walletClient: unknown;
4902
+ accountId: string;
4903
+ key: string;
4898
4904
  } | {
4899
- secretKey: Uint8Array | string;
4905
+ walletClient: unknown;
4900
4906
  } | {
4901
4907
  signer: unknown;
4902
- } | {
4903
- mnemonic: string | string[];
4904
- version?: 'v4' | 'v5r1';
4905
4908
  } | {
4906
4909
  keyPair: unknown;
4907
4910
  version?: 'v4' | 'v5r1';
4908
- } | {
4909
- secret: string;
4910
4911
  } | {
4911
4912
  keypair: unknown;
4912
- } | {
4913
- seed: string;
4914
4913
  } | {
4915
4914
  wallet: unknown;
4916
4915
  } | {
4917
- accountId: string;
4918
- privateKey: string;
4916
+ account: unknown;
4919
4917
  };
4920
4918
  /**
4921
4919
  * A priced payment requirement — what `client.quote(url)` returns and what an
@@ -5228,6 +5226,15 @@ declare class PipRailClient {
5228
5226
  private readonly ledger;
5229
5227
  private bound?;
5230
5228
  constructor(opts: PipRailClientOptions);
5229
+ /**
5230
+ * Fail LOUDLY at construction on a malformed amount cap — a security boundary
5231
+ * must never silently half-arm, and a misconfigured cap is a programmer error
5232
+ * (→ `TypeError`, no new SDK code). Each cap (`maxAmount` / `maxTotal` /
5233
+ * `windowTotal`) must be a non-negative decimal STRING (the same grammar
5234
+ * {@link floorUnits} accepts), so a typo like `'0.01abc'` fails fast here instead
5235
+ * of lazily throwing a raw `floorUnits` error out of the never-throw read methods.
5236
+ */
5237
+ private assertPolicyAmountCaps;
5231
5238
  /**
5232
5239
  * Fail LOUDLY at construction on a misconfigured time policy — a security
5233
5240
  * boundary must never silently half-arm. Two invariants (a misconfiguration is
@@ -5540,8 +5547,8 @@ declare function fetchAcross(clients: PipRailClient[], url: string, init?: Reque
5540
5547
  * `'solana'|'ton'|'tron'|'near'|'sui'|'aptos'|'algorand'|'stellar'|'xrpl'`); the
5541
5548
  * VALUE is that family's {@link WalletInput}:
5542
5549
  *
5543
- * base/bnb/… → { privateKey } solana → { secretKey } ton/algorand → { mnemonic }
5544
- * stellar { secret } xrpl { seed } near { accountId, privateKey }
5550
+ * every chain → { key } · near → { accountId, key }
5551
+ * (`key` is that chain's secret string see {@link WalletInput} for the per-chain format)
5545
5552
  *
5546
5553
  * One key per family — this map is how a single buyer carries the keys for every
5547
5554
  * chain it's willing to pay on. (For a CUSTOM EVM chain configured by a viem
@@ -5588,9 +5595,9 @@ declare class MultiChainPayer implements PayingClient {
5588
5595
  * ```ts
5589
5596
  * const payer = MultiChainPayer.fromWallets({
5590
5597
  * wallets: {
5591
- * base: { privateKey: process.env.EVM_KEY! },
5592
- * solana: { secretKey: process.env.SOLANA_SECRET! },
5593
- * xrpl: { seed: process.env.XRPL_SEED! },
5598
+ * base: { key: process.env.EVM_KEY! },
5599
+ * solana: { key: process.env.SOLANA_SECRET! },
5600
+ * xrpl: { key: process.env.XRPL_SEED! },
5594
5601
  * },
5595
5602
  * policy: { maxAmount: '1.00', maxTotal: '20.00', tokens: ['USDC', 'USDT'] },
5596
5603
  * })
@@ -5952,7 +5959,8 @@ interface ManifestInput {
5952
5959
  * Optional ownership proofs — each a signature of the BARE ORIGIN STRING by a
5953
5960
  * `payTo` key (EVM: eip191 hex). A trust badge on indexes that verify it
5954
5961
  * (x402scan: `recoverMessageAddress(origin, sig) === payTo`); never required to
5955
- * be listed. Produce one with the driver's `signMessage(wallet, origin)`.
5962
+ * be listed. Produce one via `client.discoverySigner()`, then `signer.signMessage(origin)`
5963
+ * (single-arg — it signs the bare origin string).
5956
5964
  */
5957
5965
  ownershipProofs?: string[];
5958
5966
  /** OpenAPI `info.title`. Default 'PipRail x402 resources'. */
@@ -6171,8 +6179,8 @@ interface ExactRailOption {
6171
6179
  * discovers it automatically (e.g. PayAI). Ignored on EVM. */
6172
6180
  feePayer?: string;
6173
6181
  };
6174
- /** Required for `settle: 'self'` — the gas-paying relayer wallet: EVM `{ privateKey }` /
6175
- * `{ walletClient }`, or Solana `{ secretKey }` / `{ signer }`. (Distinct from `payTo`, the
6182
+ /** Required for `settle: 'self'` — the gas-paying relayer wallet: a `{ key }` (or a
6183
+ * bring-your-own EVM `{ walletClient }` / Solana `{ signer }`). (Distinct from `payTo`, the
6176
6184
  * receive address — on Solana they MUST be different keys, a scheme MUST-rule.) */
6177
6185
  relayer?: unknown;
6178
6186
  /** Which exact transfer method to advertise (EVM). `'auto'` (default) uses EIP-3009 when the
package/dist/index.d.ts CHANGED
@@ -4878,44 +4878,42 @@ type PipRailEvent = {
4878
4878
  reason: string;
4879
4879
  };
4880
4880
  /**
4881
- * Wallet for the chosen chain family (the `chain` selector routes; each driver
4882
- * validates its own key format):
4883
- * - EVM → `{ privateKey }` (0x… hex) or a viem `{ walletClient }`
4884
- * - Tron `{ privateKey }` (32-byte hex secp256k1, like EVM)
4885
- * - Sui `{ privateKey }` (suiprivkey1 bech32) or a ready `{ keypair }`
4886
- * - Solana `{ secretKey }` (Uint8Array | base58) or `{ signer }`
4887
- * - TON `{ mnemonic }` (24 words) or a ready `{ keyPair }`
4888
- * - Stellar `{ secret }` (S… seed) or a ready `{ keypair }`
4889
- * - XRPL `{ seed }` (s… seed) or a ready `{ wallet }`
4890
- * - NEAR `{ accountId, privateKey }` (privateKey = ed25519:… secret)
4891
- * - Aptos `{ privateKey }` (AIP-80 `ed25519-priv-0x…` / raw `0x…` hex) or `{ account }`
4892
- * - Algorand→ `{ mnemonic }` (25 words) or a ready `{ account }`
4881
+ * Wallet for the chosen chain family. **One field, every chain: `{ key }`** the
4882
+ * chain's secret as a string (the `chain` selector routes; each driver validates the
4883
+ * format). NEAR also needs `{ accountId }`. What `key` is, per chain:
4884
+ * - EVM / Tron a 0x… hex private key (secp256k1)
4885
+ * - Sui a `suiprivkey1…` bech32 secret
4886
+ * - Aptos an AIP-80 `ed25519-priv-0x…` (or raw `0x…`) secret
4887
+ * - Solana a base58 secret key (or a `Uint8Array`)
4888
+ * - TON a 24-word mnemonic (optional `version: 'v4' | 'v5r1'`, default v4)
4889
+ * - Algorand → a 25-word mnemonic
4890
+ * - Stellar an `S…` secret seed
4891
+ * - XRPL an `s…` secret seed
4892
+ * - NEAR → `{ accountId, key }`, where `key` is an `ed25519:…` secret
4893
+ *
4894
+ * Advanced (bring your own native signer object — type-specific): EVM `{ walletClient }`,
4895
+ * Solana `{ signer }`, TON `{ keyPair }`, Stellar/Sui `{ keypair }`, XRPL `{ wallet }`,
4896
+ * Aptos/Algorand `{ account }`.
4893
4897
  */
4894
4898
  type WalletInput = {
4895
- privateKey: string;
4899
+ key: string;
4900
+ version?: 'v4' | 'v5r1';
4896
4901
  } | {
4897
- walletClient: unknown;
4902
+ accountId: string;
4903
+ key: string;
4898
4904
  } | {
4899
- secretKey: Uint8Array | string;
4905
+ walletClient: unknown;
4900
4906
  } | {
4901
4907
  signer: unknown;
4902
- } | {
4903
- mnemonic: string | string[];
4904
- version?: 'v4' | 'v5r1';
4905
4908
  } | {
4906
4909
  keyPair: unknown;
4907
4910
  version?: 'v4' | 'v5r1';
4908
- } | {
4909
- secret: string;
4910
4911
  } | {
4911
4912
  keypair: unknown;
4912
- } | {
4913
- seed: string;
4914
4913
  } | {
4915
4914
  wallet: unknown;
4916
4915
  } | {
4917
- accountId: string;
4918
- privateKey: string;
4916
+ account: unknown;
4919
4917
  };
4920
4918
  /**
4921
4919
  * A priced payment requirement — what `client.quote(url)` returns and what an
@@ -5228,6 +5226,15 @@ declare class PipRailClient {
5228
5226
  private readonly ledger;
5229
5227
  private bound?;
5230
5228
  constructor(opts: PipRailClientOptions);
5229
+ /**
5230
+ * Fail LOUDLY at construction on a malformed amount cap — a security boundary
5231
+ * must never silently half-arm, and a misconfigured cap is a programmer error
5232
+ * (→ `TypeError`, no new SDK code). Each cap (`maxAmount` / `maxTotal` /
5233
+ * `windowTotal`) must be a non-negative decimal STRING (the same grammar
5234
+ * {@link floorUnits} accepts), so a typo like `'0.01abc'` fails fast here instead
5235
+ * of lazily throwing a raw `floorUnits` error out of the never-throw read methods.
5236
+ */
5237
+ private assertPolicyAmountCaps;
5231
5238
  /**
5232
5239
  * Fail LOUDLY at construction on a misconfigured time policy — a security
5233
5240
  * boundary must never silently half-arm. Two invariants (a misconfiguration is
@@ -5540,8 +5547,8 @@ declare function fetchAcross(clients: PipRailClient[], url: string, init?: Reque
5540
5547
  * `'solana'|'ton'|'tron'|'near'|'sui'|'aptos'|'algorand'|'stellar'|'xrpl'`); the
5541
5548
  * VALUE is that family's {@link WalletInput}:
5542
5549
  *
5543
- * base/bnb/… → { privateKey } solana → { secretKey } ton/algorand → { mnemonic }
5544
- * stellar { secret } xrpl { seed } near { accountId, privateKey }
5550
+ * every chain → { key } · near → { accountId, key }
5551
+ * (`key` is that chain's secret string see {@link WalletInput} for the per-chain format)
5545
5552
  *
5546
5553
  * One key per family — this map is how a single buyer carries the keys for every
5547
5554
  * chain it's willing to pay on. (For a CUSTOM EVM chain configured by a viem
@@ -5588,9 +5595,9 @@ declare class MultiChainPayer implements PayingClient {
5588
5595
  * ```ts
5589
5596
  * const payer = MultiChainPayer.fromWallets({
5590
5597
  * wallets: {
5591
- * base: { privateKey: process.env.EVM_KEY! },
5592
- * solana: { secretKey: process.env.SOLANA_SECRET! },
5593
- * xrpl: { seed: process.env.XRPL_SEED! },
5598
+ * base: { key: process.env.EVM_KEY! },
5599
+ * solana: { key: process.env.SOLANA_SECRET! },
5600
+ * xrpl: { key: process.env.XRPL_SEED! },
5594
5601
  * },
5595
5602
  * policy: { maxAmount: '1.00', maxTotal: '20.00', tokens: ['USDC', 'USDT'] },
5596
5603
  * })
@@ -5952,7 +5959,8 @@ interface ManifestInput {
5952
5959
  * Optional ownership proofs — each a signature of the BARE ORIGIN STRING by a
5953
5960
  * `payTo` key (EVM: eip191 hex). A trust badge on indexes that verify it
5954
5961
  * (x402scan: `recoverMessageAddress(origin, sig) === payTo`); never required to
5955
- * be listed. Produce one with the driver's `signMessage(wallet, origin)`.
5962
+ * be listed. Produce one via `client.discoverySigner()`, then `signer.signMessage(origin)`
5963
+ * (single-arg — it signs the bare origin string).
5956
5964
  */
5957
5965
  ownershipProofs?: string[];
5958
5966
  /** OpenAPI `info.title`. Default 'PipRail x402 resources'. */
@@ -6171,8 +6179,8 @@ interface ExactRailOption {
6171
6179
  * discovers it automatically (e.g. PayAI). Ignored on EVM. */
6172
6180
  feePayer?: string;
6173
6181
  };
6174
- /** Required for `settle: 'self'` — the gas-paying relayer wallet: EVM `{ privateKey }` /
6175
- * `{ walletClient }`, or Solana `{ secretKey }` / `{ signer }`. (Distinct from `payTo`, the
6182
+ /** Required for `settle: 'self'` — the gas-paying relayer wallet: a `{ key }` (or a
6183
+ * bring-your-own EVM `{ walletClient }` / Solana `{ signer }`). (Distinct from `payTo`, the
6176
6184
  * receive address — on Solana they MUST be different keys, a scheme MUST-rule.) */
6177
6185
  relayer?: unknown;
6178
6186
  /** Which exact transfer method to advertise (EVM). `'auto'` (default) uses EIP-3009 when the