@piprail/sdk 1.1.1 → 1.3.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.
@@ -11,7 +11,7 @@ var _chunkCQREG5LEcjs = require('./chunk-CQREG5LE.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkNK64H3RMcjs = require('./chunk-NK64H3RM.cjs');
14
+ var _chunkYJPWIK5Lcjs = require('./chunk-YJPWIK5L.cjs');
15
15
 
16
16
  // src/drivers/xrpl/index.ts
17
17
  var _xrpl = require('xrpl');
@@ -93,17 +93,17 @@ async function payXrpl(params) {
93
93
  const code = res.engine_result;
94
94
  if (code.startsWith("tes")) return _nullishCoalesce(_optionalChain([res, 'access', _ => _.tx_json, 'optionalAccess', _2 => _2.hash]), () => ( signed.hash));
95
95
  const recipientMsg = recipientNotReadyMessage(code);
96
- if (recipientMsg) throw new (0, _chunkNK64H3RMcjs.RecipientNotReadyError)(recipientMsg, { cause: makeEngineError(res) });
96
+ if (recipientMsg) throw new (0, _chunkYJPWIK5Lcjs.RecipientNotReadyError)(recipientMsg, { cause: makeEngineError(res) });
97
97
  if (isAffordabilityCode(code)) {
98
- throw new (0, _chunkNK64H3RMcjs.InsufficientFundsError)(
98
+ throw new (0, _chunkYJPWIK5Lcjs.InsufficientFundsError)(
99
99
  `XRPL payment rejected: the sender can't cover it \u2014 balance or the 1 XRP base reserve. (XRPL: ${code})`,
100
100
  { cause: makeEngineError(res) }
101
101
  );
102
102
  }
103
103
  throw makeEngineError(res);
104
104
  } catch (err) {
105
- if (err instanceof _chunkNK64H3RMcjs.InsufficientFundsError || err instanceof _chunkNK64H3RMcjs.RecipientNotReadyError) throw err;
106
- throw _nullishCoalesce(_chunkNK64H3RMcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
105
+ if (err instanceof _chunkYJPWIK5Lcjs.InsufficientFundsError || err instanceof _chunkYJPWIK5Lcjs.RecipientNotReadyError) throw err;
106
+ throw _nullishCoalesce(_chunkYJPWIK5Lcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
107
107
  }
108
108
  }
109
109
  function amountForAccept(accept) {
@@ -228,7 +228,7 @@ function deliveredBaseUnits(delivered, want, decimals) {
228
228
  return null;
229
229
  }
230
230
  try {
231
- return _chunkNK64H3RMcjs.floorUnits.call(void 0, delivered.value, decimals);
231
+ return _chunkYJPWIK5Lcjs.floorUnits.call(void 0, delivered.value, decimals);
232
232
  } catch (e3) {
233
233
  return null;
234
234
  }
@@ -252,22 +252,22 @@ function rpcFailed(nonce) {
252
252
 
253
253
  function assertXrplWallet(wallet, network) {
254
254
  if (typeof wallet !== "object" || wallet === null) {
255
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
255
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
256
256
  `chain ${network} is XRPL; wallet must be { seed } (s\u2026 seed) or { wallet }.`
257
257
  );
258
258
  }
259
259
  if ("privateKey" in wallet || "walletClient" in wallet) {
260
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
260
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
261
261
  `chain ${network} is XRPL; an EVM wallet can't be used \u2014 pass { seed } (s\u2026 seed) or { wallet }.`
262
262
  );
263
263
  }
264
264
  if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "keypair" in wallet) {
265
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
265
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
266
266
  `chain ${network} is XRPL; that looks like a Solana/TON/Stellar wallet \u2014 pass { seed } (s\u2026 seed) or { wallet }.`
267
267
  );
268
268
  }
269
269
  if (!("seed" in wallet) && !("wallet" in wallet)) {
270
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
270
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
271
271
  `chain ${network} is XRPL; wallet must be { seed } (s\u2026 seed) or { wallet }.`
272
272
  );
273
273
  }
@@ -277,11 +277,11 @@ function resolveXrplWallet(config) {
277
277
  if (config.wallet) return config.wallet;
278
278
  if (config.seed) {
279
279
  if (!_xrpl.isValidSecret.call(void 0, config.seed)) {
280
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)("XRPL wallet { seed } is not a valid s\u2026 secret seed.");
280
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)("XRPL wallet { seed } is not a valid s\u2026 secret seed.");
281
281
  }
282
282
  return _xrpl.Wallet.fromSeed(config.seed);
283
283
  }
284
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)("XRPL wallet needs { seed } (s\u2026 seed) or { wallet }.");
284
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)("XRPL wallet needs { seed } (s\u2026 seed) or { wallet }.");
285
285
  }
286
286
 
287
287
  // src/drivers/xrpl/index.ts
@@ -353,7 +353,7 @@ function makeXrplNetwork(preset, rpcUrl) {
353
353
  const info = preset.tokens[token.toUpperCase()];
354
354
  if (!info) {
355
355
  const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
356
- throw new (0, _chunkNK64H3RMcjs.UnknownTokenError)(
356
+ throw new (0, _chunkYJPWIK5Lcjs.UnknownTokenError)(
357
357
  `token "${token}" isn't built in for XRPL (known: ${known}). Pass { issuer, currencyHex, decimals } for a custom IOU, or use 'native'.`
358
358
  );
359
359
  }
@@ -363,10 +363,10 @@ function makeXrplNetwork(preset, rpcUrl) {
363
363
  symbol: info.symbol
364
364
  };
365
365
  }
366
- _chunkNK64H3RMcjs.rejectForeignToken.call(void 0, token, "xrpl", network);
366
+ _chunkYJPWIK5Lcjs.rejectForeignToken.call(void 0, token, "xrpl", network);
367
367
  const t = token;
368
368
  if (!t.issuer || !t.currencyHex || typeof t.decimals !== "number") {
369
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
369
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
370
370
  `chain ${network} is XRPL; a custom token must be { issuer, currencyHex, decimals }.`
371
371
  );
372
372
  }
@@ -387,12 +387,12 @@ function makeXrplNetwork(preset, rpcUrl) {
387
387
  },
388
388
  assertValidPayTo(payTo) {
389
389
  if (payTo.startsWith("0x")) {
390
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
390
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
391
391
  `chain ${network} is XRPL, but payTo "${payTo}" looks like an EVM address.`
392
392
  );
393
393
  }
394
394
  if (!_xrpl.isValidClassicAddress.call(void 0, payTo)) {
395
- throw new (0, _chunkNK64H3RMcjs.WrongFamilyError)(
395
+ throw new (0, _chunkYJPWIK5Lcjs.WrongFamilyError)(
396
396
  `chain ${network} is XRPL, but payTo "${payTo}" is not a valid XRPL account (r\u2026).`
397
397
  );
398
398
  }
@@ -415,14 +415,14 @@ function makeXrplNetwork(preset, rpcUrl) {
415
415
  }
416
416
  await _chunkCQREG5LEcjs.delay.call(void 0, 1500);
417
417
  }
418
- throw new (0, _chunkNK64H3RMcjs.ConfirmationTimeoutError)(`XRPL tx ${ref} not validated on-ledger in time.`);
418
+ throw new (0, _chunkYJPWIK5Lcjs.ConfirmationTimeoutError)(`XRPL tx ${ref} not validated on-ledger in time.`);
419
419
  },
420
420
  async estimateCost() {
421
421
  try {
422
422
  const drops = await payClient.feeDrops();
423
423
  const n = Number(drops);
424
424
  const fee = BigInt(Number.isFinite(n) && n > 12 ? Math.ceil(n) : 12);
425
- return _chunkNK64H3RMcjs.nativeCost.call(void 0, {
425
+ return _chunkYJPWIK5Lcjs.nativeCost.call(void 0, {
426
426
  symbol: XRP_SYMBOL,
427
427
  decimals: XRP_DECIMALS,
428
428
  fee,
@@ -430,7 +430,7 @@ function makeXrplNetwork(preset, rpcUrl) {
430
430
  detail: `network fee ${fee} drops`
431
431
  });
432
432
  } catch (e5) {
433
- return _chunkNK64H3RMcjs.nativeCost.call(void 0, {
433
+ return _chunkYJPWIK5Lcjs.nativeCost.call(void 0, {
434
434
  symbol: XRP_SYMBOL,
435
435
  decimals: XRP_DECIMALS,
436
436
  fee: 12n,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@piprail/sdk",
3
- "version": "1.1.1",
4
- "description": "Accept x402 crypto payments across 24 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
3
+ "version": "1.3.0",
4
+ "description": "Accept x402 crypto payments across 27 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -78,6 +78,7 @@
78
78
  "node": ">=20"
79
79
  },
80
80
  "peerDependencies": {
81
+ "@aptos-labs/ts-sdk": ">=2 <8",
81
82
  "@mysten/sui": ">=2 <3",
82
83
  "@solana/spl-token": "^0.4.0",
83
84
  "@solana/web3.js": "^1.95.0",
@@ -92,6 +93,9 @@
92
93
  "xrpl": ">=4 <5"
93
94
  },
94
95
  "peerDependenciesMeta": {
96
+ "@aptos-labs/ts-sdk": {
97
+ "optional": true
98
+ },
95
99
  "@solana/web3.js": {
96
100
  "optional": true
97
101
  },
@@ -127,6 +131,7 @@
127
131
  }
128
132
  },
129
133
  "devDependencies": {
134
+ "@aptos-labs/ts-sdk": "^7.1.0",
130
135
  "@mysten/sui": "^2.17.0",
131
136
  "@solana/spl-token": "^0.4.14",
132
137
  "@solana/web3.js": "^1.98.4",