@piprail/sdk 1.25.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +4 -4
  3. package/dist/{algorand-677ILBQS.js → algorand-RJ4DRWHV.js} +10 -18
  4. package/dist/{algorand-ZJ53VCTN.cjs → algorand-RUDF55XY.cjs} +23 -31
  5. package/dist/{aptos-XIIHPAOO.cjs → aptos-PESRG2EQ.cjs} +22 -30
  6. package/dist/{aptos-3TSKTI4D.js → aptos-SMEQXIYJ.js} +10 -18
  7. package/dist/{chunk-L6WQRHEZ.js → chunk-47VEOHZN.js} +13 -0
  8. package/dist/{chunk-U35MG4TF.cjs → chunk-DKQXW454.cjs} +14 -1
  9. package/dist/index.cjs +108 -100
  10. package/dist/index.d.cts +31 -32
  11. package/dist/index.d.ts +31 -32
  12. package/dist/index.js +27 -19
  13. package/dist/{near-TWA4PYOD.js → near-CHE7B2CY.js} +10 -18
  14. package/dist/{near-MG256A3E.cjs → near-VWBV3SUW.cjs} +24 -32
  15. package/dist/{solana-KWNRY5NR.js → solana-DTO2R3AT.js} +7 -10
  16. package/dist/{solana-UEMHFQH5.cjs → solana-OIHRPGX2.cjs} +33 -36
  17. package/dist/{stellar-SCRRPCEA.cjs → stellar-AF7PYMMF.cjs} +27 -37
  18. package/dist/{stellar-YB7JXKK4.js → stellar-T5VONOEO.js} +11 -21
  19. package/dist/{sui-LFT65OGU.cjs → sui-3TF5XVRT.cjs} +23 -31
  20. package/dist/{sui-IODKU2MA.js → sui-J53NYMVL.js} +10 -18
  21. package/dist/{ton-QN5GTOCS.js → ton-CPK57L2O.js} +9 -12
  22. package/dist/{ton-RAYJFKJC.cjs → ton-ZEI7YUK7.cjs} +20 -23
  23. package/dist/{tron-KX4VWS7V.cjs → tron-5B3Q4SMF.cjs} +30 -38
  24. package/dist/{tron-QSNCDYRB.js → tron-LZRCDRZC.js} +11 -19
  25. package/dist/{xrpl-ECHK3GIX.js → xrpl-AH4FFC2C.js} +11 -19
  26. package/dist/{xrpl-GXUFDXHU.cjs → xrpl-BL4QXOVN.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
@@ -5540,8 +5538,8 @@ declare function fetchAcross(clients: PipRailClient[], url: string, init?: Reque
5540
5538
  * `'solana'|'ton'|'tron'|'near'|'sui'|'aptos'|'algorand'|'stellar'|'xrpl'`); the
5541
5539
  * VALUE is that family's {@link WalletInput}:
5542
5540
  *
5543
- * base/bnb/… → { privateKey } solana → { secretKey } ton/algorand → { mnemonic }
5544
- * stellar { secret } xrpl { seed } near { accountId, privateKey }
5541
+ * every chain → { key } · near → { accountId, key }
5542
+ * (`key` is that chain's secret string see {@link WalletInput} for the per-chain format)
5545
5543
  *
5546
5544
  * One key per family — this map is how a single buyer carries the keys for every
5547
5545
  * chain it's willing to pay on. (For a CUSTOM EVM chain configured by a viem
@@ -5588,9 +5586,9 @@ declare class MultiChainPayer implements PayingClient {
5588
5586
  * ```ts
5589
5587
  * const payer = MultiChainPayer.fromWallets({
5590
5588
  * wallets: {
5591
- * base: { privateKey: process.env.EVM_KEY! },
5592
- * solana: { secretKey: process.env.SOLANA_SECRET! },
5593
- * xrpl: { seed: process.env.XRPL_SEED! },
5589
+ * base: { key: process.env.EVM_KEY! },
5590
+ * solana: { key: process.env.SOLANA_SECRET! },
5591
+ * xrpl: { key: process.env.XRPL_SEED! },
5594
5592
  * },
5595
5593
  * policy: { maxAmount: '1.00', maxTotal: '20.00', tokens: ['USDC', 'USDT'] },
5596
5594
  * })
@@ -5952,7 +5950,8 @@ interface ManifestInput {
5952
5950
  * Optional ownership proofs — each a signature of the BARE ORIGIN STRING by a
5953
5951
  * `payTo` key (EVM: eip191 hex). A trust badge on indexes that verify it
5954
5952
  * (x402scan: `recoverMessageAddress(origin, sig) === payTo`); never required to
5955
- * be listed. Produce one with the driver's `signMessage(wallet, origin)`.
5953
+ * be listed. Produce one via `client.discoverySigner()`, then `signer.signMessage(origin)`
5954
+ * (single-arg — it signs the bare origin string).
5956
5955
  */
5957
5956
  ownershipProofs?: string[];
5958
5957
  /** OpenAPI `info.title`. Default 'PipRail x402 resources'. */
@@ -6171,8 +6170,8 @@ interface ExactRailOption {
6171
6170
  * discovers it automatically (e.g. PayAI). Ignored on EVM. */
6172
6171
  feePayer?: string;
6173
6172
  };
6174
- /** Required for `settle: 'self'` — the gas-paying relayer wallet: EVM `{ privateKey }` /
6175
- * `{ walletClient }`, or Solana `{ secretKey }` / `{ signer }`. (Distinct from `payTo`, the
6173
+ /** Required for `settle: 'self'` — the gas-paying relayer wallet: a `{ key }` (or a
6174
+ * bring-your-own EVM `{ walletClient }` / Solana `{ signer }`). (Distinct from `payTo`, the
6176
6175
  * receive address — on Solana they MUST be different keys, a scheme MUST-rule.) */
6177
6176
  relayer?: unknown;
6178
6177
  /** 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
@@ -5540,8 +5538,8 @@ declare function fetchAcross(clients: PipRailClient[], url: string, init?: Reque
5540
5538
  * `'solana'|'ton'|'tron'|'near'|'sui'|'aptos'|'algorand'|'stellar'|'xrpl'`); the
5541
5539
  * VALUE is that family's {@link WalletInput}:
5542
5540
  *
5543
- * base/bnb/… → { privateKey } solana → { secretKey } ton/algorand → { mnemonic }
5544
- * stellar { secret } xrpl { seed } near { accountId, privateKey }
5541
+ * every chain → { key } · near → { accountId, key }
5542
+ * (`key` is that chain's secret string see {@link WalletInput} for the per-chain format)
5545
5543
  *
5546
5544
  * One key per family — this map is how a single buyer carries the keys for every
5547
5545
  * chain it's willing to pay on. (For a CUSTOM EVM chain configured by a viem
@@ -5588,9 +5586,9 @@ declare class MultiChainPayer implements PayingClient {
5588
5586
  * ```ts
5589
5587
  * const payer = MultiChainPayer.fromWallets({
5590
5588
  * wallets: {
5591
- * base: { privateKey: process.env.EVM_KEY! },
5592
- * solana: { secretKey: process.env.SOLANA_SECRET! },
5593
- * xrpl: { seed: process.env.XRPL_SEED! },
5589
+ * base: { key: process.env.EVM_KEY! },
5590
+ * solana: { key: process.env.SOLANA_SECRET! },
5591
+ * xrpl: { key: process.env.XRPL_SEED! },
5594
5592
  * },
5595
5593
  * policy: { maxAmount: '1.00', maxTotal: '20.00', tokens: ['USDC', 'USDT'] },
5596
5594
  * })
@@ -5952,7 +5950,8 @@ interface ManifestInput {
5952
5950
  * Optional ownership proofs — each a signature of the BARE ORIGIN STRING by a
5953
5951
  * `payTo` key (EVM: eip191 hex). A trust badge on indexes that verify it
5954
5952
  * (x402scan: `recoverMessageAddress(origin, sig) === payTo`); never required to
5955
- * be listed. Produce one with the driver's `signMessage(wallet, origin)`.
5953
+ * be listed. Produce one via `client.discoverySigner()`, then `signer.signMessage(origin)`
5954
+ * (single-arg — it signs the bare origin string).
5956
5955
  */
5957
5956
  ownershipProofs?: string[];
5958
5957
  /** OpenAPI `info.title`. Default 'PipRail x402 resources'. */
@@ -6171,8 +6170,8 @@ interface ExactRailOption {
6171
6170
  * discovers it automatically (e.g. PayAI). Ignored on EVM. */
6172
6171
  feePayer?: string;
6173
6172
  };
6174
- /** Required for `settle: 'self'` — the gas-paying relayer wallet: EVM `{ privateKey }` /
6175
- * `{ walletClient }`, or Solana `{ secretKey }` / `{ signer }`. (Distinct from `payTo`, the
6173
+ /** Required for `settle: 'self'` — the gas-paying relayer wallet: a `{ key }` (or a
6174
+ * bring-your-own EVM `{ walletClient }` / Solana `{ signer }`). (Distinct from `payTo`, the
6176
6175
  * receive address — on Solana they MUST be different keys, a scheme MUST-rule.) */
6177
6176
  relayer?: unknown;
6178
6177
  /** Which exact transfer method to advertise (EVM). `'auto'` (default) uses EIP-3009 when the
package/dist/index.js CHANGED
@@ -17,13 +17,14 @@ import {
17
17
  WalletRequiredError,
18
18
  WrongChainError,
19
19
  WrongFamilyError,
20
+ assertNoLegacyWalletKey,
20
21
  floorUnits,
21
22
  formatUnits,
22
23
  nativeCost,
23
24
  parseUnits,
24
25
  rejectForeignToken,
25
26
  toInsufficientFundsError
26
- } from "./chunk-L6WQRHEZ.js";
27
+ } from "./chunk-47VEOHZN.js";
27
28
 
28
29
  // src/drivers/registry.ts
29
30
  var byFamily = /* @__PURE__ */ new Map();
@@ -319,8 +320,9 @@ import {
319
320
  } from "viem";
320
321
  import { privateKeyToAccount } from "viem/accounts";
321
322
  function createWalletAdapter(config, resolved) {
322
- if ("privateKey" in config) {
323
- const account = privateKeyToAccount(config.privateKey);
323
+ assertNoLegacyWalletKey(config, "EVM");
324
+ if ("key" in config) {
325
+ const account = privateKeyToAccount(config.key);
324
326
  const transport = http(resolved.rpcUrl);
325
327
  const walletClient = createWalletClient({ account, chain: resolved.chain, transport });
326
328
  return { account, walletClient };
@@ -328,7 +330,7 @@ function createWalletAdapter(config, resolved) {
328
330
  const wc = config.walletClient;
329
331
  if (!wc.account) {
330
332
  throw new WrongFamilyError(
331
- "chain is EVM; the provided walletClient has no attached account. Use `createWalletClient({ account, chain, transport })`, or pass { privateKey }."
333
+ "chain is EVM; the provided walletClient has no attached account. Use `createWalletClient({ account, chain, transport })`, or pass { key }."
332
334
  );
333
335
  }
334
336
  if (wc.chain && wc.chain.id !== resolved.chainId) {
@@ -1595,9 +1597,15 @@ function makeEvmNetwork(resolved) {
1595
1597
  }
1596
1598
  },
1597
1599
  bindWallet(wallet) {
1598
- if (typeof wallet !== "object" || wallet === null || !("privateKey" in wallet) && !("walletClient" in wallet)) {
1600
+ if (typeof wallet !== "object" || wallet === null) {
1599
1601
  throw new WrongFamilyError(
1600
- `chain ${network} is EVM; wallet must be { privateKey } or { walletClient }.`
1602
+ `chain ${network} is EVM; wallet must be { key } (0x\u2026 hex) or { walletClient }.`
1603
+ );
1604
+ }
1605
+ assertNoLegacyWalletKey(wallet, "EVM");
1606
+ if (!("key" in wallet) && !("walletClient" in wallet)) {
1607
+ throw new WrongFamilyError(
1608
+ `chain ${network} is EVM; wallet must be { key } (0x\u2026 hex) or { walletClient }.`
1601
1609
  );
1602
1610
  }
1603
1611
  return { _native: createWalletAdapter(wallet, resolved) };
@@ -1793,7 +1801,7 @@ var loaders = {
1793
1801
  solana: async () => {
1794
1802
  let mod;
1795
1803
  try {
1796
- mod = await import("./solana-KWNRY5NR.js");
1804
+ mod = await import("./solana-DTO2R3AT.js");
1797
1805
  } catch (cause) {
1798
1806
  throw new MissingDriverError(
1799
1807
  `Solana selected, but its packages aren't installed. Run: npm install @solana/web3.js @solana/spl-token bs58`,
@@ -1805,7 +1813,7 @@ var loaders = {
1805
1813
  ton: async () => {
1806
1814
  let mod;
1807
1815
  try {
1808
- mod = await import("./ton-QN5GTOCS.js");
1816
+ mod = await import("./ton-CPK57L2O.js");
1809
1817
  } catch (cause) {
1810
1818
  throw new MissingDriverError(
1811
1819
  `TON selected, but its packages aren't installed. Run: npm install @ton/ton @ton/core @ton/crypto`,
@@ -1817,7 +1825,7 @@ var loaders = {
1817
1825
  stellar: async () => {
1818
1826
  let mod;
1819
1827
  try {
1820
- mod = await import("./stellar-YB7JXKK4.js");
1828
+ mod = await import("./stellar-T5VONOEO.js");
1821
1829
  } catch (cause) {
1822
1830
  throw new MissingDriverError(
1823
1831
  `Stellar selected, but its package isn't installed. Run: npm install @stellar/stellar-sdk`,
@@ -1829,7 +1837,7 @@ var loaders = {
1829
1837
  xrpl: async () => {
1830
1838
  let mod;
1831
1839
  try {
1832
- mod = await import("./xrpl-ECHK3GIX.js");
1840
+ mod = await import("./xrpl-AH4FFC2C.js");
1833
1841
  } catch (cause) {
1834
1842
  throw new MissingDriverError(
1835
1843
  `XRPL selected, but its package isn't installed. Run: npm install xrpl`,
@@ -1841,7 +1849,7 @@ var loaders = {
1841
1849
  tron: async () => {
1842
1850
  let mod;
1843
1851
  try {
1844
- mod = await import("./tron-QSNCDYRB.js");
1852
+ mod = await import("./tron-LZRCDRZC.js");
1845
1853
  } catch (cause) {
1846
1854
  throw new MissingDriverError(
1847
1855
  `Tron selected, but its package isn't installed. Run: npm install tronweb`,
@@ -1853,7 +1861,7 @@ var loaders = {
1853
1861
  sui: async () => {
1854
1862
  let mod;
1855
1863
  try {
1856
- mod = await import("./sui-IODKU2MA.js");
1864
+ mod = await import("./sui-J53NYMVL.js");
1857
1865
  } catch (cause) {
1858
1866
  throw new MissingDriverError(
1859
1867
  `Sui selected, but its package isn't installed. Run: npm install @mysten/sui`,
@@ -1865,7 +1873,7 @@ var loaders = {
1865
1873
  near: async () => {
1866
1874
  let mod;
1867
1875
  try {
1868
- mod = await import("./near-TWA4PYOD.js");
1876
+ mod = await import("./near-CHE7B2CY.js");
1869
1877
  } catch (cause) {
1870
1878
  throw new MissingDriverError(
1871
1879
  `NEAR selected, but its package isn't installed. Run: npm install near-api-js`,
@@ -1877,7 +1885,7 @@ var loaders = {
1877
1885
  aptos: async () => {
1878
1886
  let mod;
1879
1887
  try {
1880
- mod = await import("./aptos-3TSKTI4D.js");
1888
+ mod = await import("./aptos-SMEQXIYJ.js");
1881
1889
  } catch (cause) {
1882
1890
  throw new MissingDriverError(
1883
1891
  `Aptos selected, but its package isn't installed. Run: npm install @aptos-labs/ts-sdk`,
@@ -1889,7 +1897,7 @@ var loaders = {
1889
1897
  algorand: async () => {
1890
1898
  let mod;
1891
1899
  try {
1892
- mod = await import("./algorand-677ILBQS.js");
1900
+ mod = await import("./algorand-RJ4DRWHV.js");
1893
1901
  } catch (cause) {
1894
1902
  throw new MissingDriverError(
1895
1903
  `Algorand selected, but its package isn't installed. Run: npm install algosdk`,
@@ -3669,9 +3677,9 @@ var MultiChainPayer = class _MultiChainPayer {
3669
3677
  * ```ts
3670
3678
  * const payer = MultiChainPayer.fromWallets({
3671
3679
  * wallets: {
3672
- * base: { privateKey: process.env.EVM_KEY! },
3673
- * solana: { secretKey: process.env.SOLANA_SECRET! },
3674
- * xrpl: { seed: process.env.XRPL_SEED! },
3680
+ * base: { key: process.env.EVM_KEY! },
3681
+ * solana: { key: process.env.SOLANA_SECRET! },
3682
+ * xrpl: { key: process.env.XRPL_SEED! },
3675
3683
  * },
3676
3684
  * policy: { maxAmount: '1.00', maxTotal: '20.00', tokens: ['USDC', 'USDT'] },
3677
3685
  * })
@@ -4649,7 +4657,7 @@ function createPaymentGate(options) {
4649
4657
  if (settle === "self") {
4650
4658
  if (cfg.relayer === void 0) {
4651
4659
  throw new Error(
4652
- "requirePayment: exact `settle: 'self'` needs a `relayer` wallet (the gas-paying key that broadcasts the settle), e.g. exact: { settle: 'self', relayer: { privateKey } }."
4660
+ "requirePayment: exact `settle: 'self'` needs a `relayer` wallet (the gas-paying key that broadcasts the settle), e.g. exact: { settle: 'self', relayer: { key } }."
4653
4661
  );
4654
4662
  }
4655
4663
  relayer = net.bindWallet(cfg.relayer);
@@ -4,10 +4,11 @@ import {
4
4
  RecipientNotReadyError,
5
5
  UnknownTokenError,
6
6
  WrongFamilyError,
7
+ assertNoLegacyWalletKey,
7
8
  nativeCost,
8
9
  rejectForeignToken,
9
10
  toInsufficientFundsError
10
- } from "./chunk-L6WQRHEZ.js";
11
+ } from "./chunk-47VEOHZN.js";
11
12
 
12
13
  // src/drivers/near/index.ts
13
14
  import { JsonRpcProvider, Account, actions } from "near-api-js";
@@ -217,35 +218,26 @@ import { KeyPairSigner } from "near-api-js";
217
218
  function assertNearWallet(wallet, network) {
218
219
  if (typeof wallet !== "object" || wallet === null) {
219
220
  throw new WrongFamilyError(
220
- `chain ${network} is NEAR; wallet must be { accountId, privateKey } (privateKey = ed25519:\u2026).`
221
+ `chain ${network} is NEAR; wallet must be { accountId, key } (key = ed25519:\u2026).`
221
222
  );
222
223
  }
223
- if ("walletClient" in wallet) {
224
+ assertNoLegacyWalletKey(wallet, "NEAR");
225
+ if (!("accountId" in wallet) || !("key" in wallet)) {
224
226
  throw new WrongFamilyError(
225
- `chain ${network} is NEAR; a viem { walletClient } can't be used \u2014 pass { accountId, privateKey }.`
226
- );
227
- }
228
- if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "seed" in wallet || "keypair" in wallet) {
229
- throw new WrongFamilyError(
230
- `chain ${network} is NEAR; that looks like another family's wallet \u2014 pass { accountId, privateKey }.`
231
- );
232
- }
233
- if (!("accountId" in wallet) || !("privateKey" in wallet)) {
234
- throw new WrongFamilyError(
235
- `chain ${network} is NEAR; wallet must be { accountId, privateKey } (privateKey = ed25519:\u2026).`
227
+ `chain ${network} is NEAR; wallet must be { accountId, key } (key = ed25519:\u2026).`
236
228
  );
237
229
  }
238
230
  return wallet;
239
231
  }
240
232
  function resolveNearWallet(config) {
241
- if (!config.accountId || !config.privateKey) {
242
- throw new WrongFamilyError("NEAR wallet needs { accountId, privateKey } (privateKey = ed25519:\u2026).");
233
+ if (!config.accountId || !config.key) {
234
+ throw new WrongFamilyError("NEAR wallet needs { accountId, key } (key = ed25519:\u2026).");
243
235
  }
244
236
  let signer;
245
237
  try {
246
- signer = KeyPairSigner.fromSecretKey(config.privateKey);
238
+ signer = KeyPairSigner.fromSecretKey(config.key);
247
239
  } catch (cause) {
248
- throw new WrongFamilyError("NEAR wallet { privateKey } is not a valid ed25519:\u2026 secret key.", {
240
+ throw new WrongFamilyError("NEAR wallet { key } is not a valid ed25519:\u2026 secret key.", {
249
241
  cause
250
242
  });
251
243
  }
@@ -7,7 +7,8 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.cjs');
10
+
11
+ var _chunkDKQXW454cjs = require('./chunk-DKQXW454.cjs');
11
12
 
12
13
  // src/drivers/near/index.ts
13
14
  var _nearapijs = require('near-api-js');
@@ -53,18 +54,18 @@ async function payNear(params) {
53
54
  return res.hash;
54
55
  } catch (err) {
55
56
  if (isNearRegistrationError(err)) {
56
- throw new (0, _chunkU35MG4TFcjs.RecipientNotReadyError)(
57
+ throw new (0, _chunkDKQXW454cjs.RecipientNotReadyError)(
57
58
  `NEAR recipient ${accept.payTo} isn't registered on token ${accept.asset} (NEP-145 storage_deposit) \u2014 register it once (\u22480.00125 NEAR) before it can receive. (NEAR: not registered)`,
58
59
  { cause: err }
59
60
  );
60
61
  }
61
62
  if (isNearAffordability(err)) {
62
- throw new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
63
+ throw new (0, _chunkDKQXW454cjs.InsufficientFundsError)(
63
64
  err instanceof Error ? err.message : "Insufficient NEAR balance for the payment.",
64
65
  { cause: err }
65
66
  );
66
67
  }
67
- throw _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
68
+ throw _nullishCoalesce(_chunkDKQXW454cjs.toInsufficientFundsError.call(void 0, err), () => ( err));
68
69
  }
69
70
  }
70
71
  async function payNearNative(params) {
@@ -74,12 +75,12 @@ async function payNearNative(params) {
74
75
  return res.hash;
75
76
  } catch (err) {
76
77
  if (isNearAffordability(err)) {
77
- throw new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
78
+ throw new (0, _chunkDKQXW454cjs.InsufficientFundsError)(
78
79
  err instanceof Error ? err.message : "Insufficient NEAR balance for the payment.",
79
80
  { cause: err }
80
81
  );
81
82
  }
82
- throw _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
83
+ throw _nullishCoalesce(_chunkDKQXW454cjs.toInsufficientFundsError.call(void 0, err), () => ( err));
83
84
  }
84
85
  }
85
86
  function isNearRegistrationError(err) {
@@ -216,36 +217,27 @@ function txNotFound(hash) {
216
217
 
217
218
  function assertNearWallet(wallet, network) {
218
219
  if (typeof wallet !== "object" || wallet === null) {
219
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
220
- `chain ${network} is NEAR; wallet must be { accountId, privateKey } (privateKey = ed25519:\u2026).`
221
- );
222
- }
223
- if ("walletClient" in wallet) {
224
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
225
- `chain ${network} is NEAR; a viem { walletClient } can't be used \u2014 pass { accountId, privateKey }.`
226
- );
227
- }
228
- if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "seed" in wallet || "keypair" in wallet) {
229
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
230
- `chain ${network} is NEAR; that looks like another family's wallet \u2014 pass { accountId, privateKey }.`
220
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)(
221
+ `chain ${network} is NEAR; wallet must be { accountId, key } (key = ed25519:\u2026).`
231
222
  );
232
223
  }
233
- if (!("accountId" in wallet) || !("privateKey" in wallet)) {
234
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
235
- `chain ${network} is NEAR; wallet must be { accountId, privateKey } (privateKey = ed25519:\u2026).`
224
+ _chunkDKQXW454cjs.assertNoLegacyWalletKey.call(void 0, wallet, "NEAR");
225
+ if (!("accountId" in wallet) || !("key" in wallet)) {
226
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)(
227
+ `chain ${network} is NEAR; wallet must be { accountId, key } (key = ed25519:\u2026).`
236
228
  );
237
229
  }
238
230
  return wallet;
239
231
  }
240
232
  function resolveNearWallet(config) {
241
- if (!config.accountId || !config.privateKey) {
242
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)("NEAR wallet needs { accountId, privateKey } (privateKey = ed25519:\u2026).");
233
+ if (!config.accountId || !config.key) {
234
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)("NEAR wallet needs { accountId, key } (key = ed25519:\u2026).");
243
235
  }
244
236
  let signer;
245
237
  try {
246
- signer = _nearapijs.KeyPairSigner.fromSecretKey(config.privateKey);
238
+ signer = _nearapijs.KeyPairSigner.fromSecretKey(config.key);
247
239
  } catch (cause) {
248
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)("NEAR wallet { privateKey } is not a valid ed25519:\u2026 secret key.", {
240
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)("NEAR wallet { key } is not a valid ed25519:\u2026 secret key.", {
249
241
  cause
250
242
  });
251
243
  }
@@ -312,16 +304,16 @@ function makeNearNetwork(preset, rpcUrl) {
312
304
  const info = preset.tokens[token.toUpperCase()];
313
305
  if (!info) {
314
306
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
315
- throw new (0, _chunkU35MG4TFcjs.UnknownTokenError)(
307
+ throw new (0, _chunkDKQXW454cjs.UnknownTokenError)(
316
308
  `token "${token}" isn't built in for NEAR (known: ${known}). Pass { contractId, decimals } for a custom NEP-141.`
317
309
  );
318
310
  }
319
311
  return { asset: info.contractId, decimals: info.decimals, symbol: info.symbol };
320
312
  }
321
- _chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "near", network);
313
+ _chunkDKQXW454cjs.rejectForeignToken.call(void 0, token, "near", network);
322
314
  const t = token;
323
315
  if (!t.contractId || typeof t.decimals !== "number") {
324
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
316
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)(
325
317
  `chain ${network} is NEAR; a custom token must be { contractId, decimals }.`
326
318
  );
327
319
  }
@@ -340,12 +332,12 @@ function makeNearNetwork(preset, rpcUrl) {
340
332
  },
341
333
  assertValidPayTo(payTo) {
342
334
  if (payTo.startsWith("0x")) {
343
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
335
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)(
344
336
  `chain ${network} is NEAR, but payTo "${payTo}" looks like an EVM/Sui 0x address.`
345
337
  );
346
338
  }
347
339
  if (!isValidNearAccountId(payTo)) {
348
- throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
340
+ throw new (0, _chunkDKQXW454cjs.WrongFamilyError)(
349
341
  `chain ${network} is NEAR, but payTo "${payTo}" is not a valid NEAR account id.`
350
342
  );
351
343
  }
@@ -389,10 +381,10 @@ function makeNearNetwork(preset, rpcUrl) {
389
381
  if (tx && tx.success) return { height: "0" };
390
382
  } catch (e7) {
391
383
  }
392
- throw new (0, _chunkU35MG4TFcjs.ConfirmationTimeoutError)(`NEAR tx ${hash} not confirmed in time.`);
384
+ throw new (0, _chunkDKQXW454cjs.ConfirmationTimeoutError)(`NEAR tx ${hash} not confirmed in time.`);
393
385
  },
394
386
  async estimateCost() {
395
- return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
387
+ return _chunkDKQXW454cjs.nativeCost.call(void 0, {
396
388
  symbol: "NEAR",
397
389
  decimals: NEAR_DECIMALS,
398
390
  fee: 1500000000000000000000n,
@@ -4,10 +4,11 @@ import {
4
4
  UnknownTokenError,
5
5
  UnsupportedSchemeError,
6
6
  WrongFamilyError,
7
+ assertNoLegacyWalletKey,
7
8
  nativeCost,
8
9
  rejectForeignToken,
9
10
  toInsufficientFundsError
10
- } from "./chunk-L6WQRHEZ.js";
11
+ } from "./chunk-47VEOHZN.js";
11
12
 
12
13
  // src/drivers/solana/index.ts
13
14
  import { Connection, PublicKey as PublicKey3 } from "@solana/web3.js";
@@ -511,24 +512,20 @@ import bs582 from "bs58";
511
512
  function toKeypair(wallet, network) {
512
513
  if (typeof wallet !== "object" || wallet === null) {
513
514
  throw new WrongFamilyError(
514
- `chain ${network} is Solana; wallet must be { secretKey } or { signer }.`
515
- );
516
- }
517
- if ("privateKey" in wallet || "walletClient" in wallet) {
518
- throw new WrongFamilyError(
519
- `chain ${network} is Solana; an EVM wallet can't be used \u2014 pass { secretKey } or { signer }.`
515
+ `chain ${network} is Solana; wallet must be { key } (base58 secret) or { signer }.`
520
516
  );
521
517
  }
518
+ assertNoLegacyWalletKey(wallet, "Solana");
522
519
  if ("signer" in wallet) {
523
520
  return wallet.signer;
524
521
  }
525
- if ("secretKey" in wallet) {
526
- const sk = wallet.secretKey;
522
+ if ("key" in wallet) {
523
+ const sk = wallet.key;
527
524
  const bytes = typeof sk === "string" ? bs582.decode(sk) : sk;
528
525
  return Keypair3.fromSecretKey(bytes);
529
526
  }
530
527
  throw new WrongFamilyError(
531
- `chain ${network} is Solana; wallet must be { secretKey } or { signer }.`
528
+ `chain ${network} is Solana; wallet must be { key } (base58 secret) or { signer }.`
532
529
  );
533
530
  }
534
531