@piprail/sdk 2.16.2 → 3.1.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 (37) hide show
  1. package/CHANGELOG.md +448 -0
  2. package/README.md +1 -0
  3. package/dist/{algorand-Q3TUQLPK.cjs → algorand-4FTTEV7X.cjs} +212 -51
  4. package/dist/{algorand-25FMBCT3.js → algorand-KJ5XHSMT.js} +164 -3
  5. package/dist/{aptos-VBJONBFY.cjs → aptos-5QBXJ6NV.cjs} +255 -39
  6. package/dist/{aptos-SBV6SGDP.js → aptos-H5VLH2QL.js} +217 -1
  7. package/dist/{chunk-QONQSZHJ.cjs → chunk-6XTNI2OQ.cjs} +44 -44
  8. package/dist/{chunk-OXEFPLZA.cjs → chunk-6ZRAIQXF.cjs} +4 -4
  9. package/dist/chunk-GVCGUSTE.js +30 -0
  10. package/dist/{chunk-V2IJ5HUW.cjs → chunk-MZAJQYM3.cjs} +1 -0
  11. package/dist/chunk-MZXVXC3C.cjs +30 -0
  12. package/dist/{chunk-2CX7XRZK.js → chunk-TZDVZCTC.js} +1 -0
  13. package/dist/{chunk-C52H5TYB.js → chunk-YXBQKBDH.js} +2 -2
  14. package/dist/index.cjs +2906 -1262
  15. package/dist/index.d.cts +679 -21
  16. package/dist/index.d.ts +679 -21
  17. package/dist/index.js +2678 -1034
  18. package/dist/{ledger-Crc1bZox.d.cts → ledger-DkHUORUe.d.cts} +7 -0
  19. package/dist/{ledger-Crc1bZox.d.ts → ledger-DkHUORUe.d.ts} +7 -0
  20. package/dist/{near-OLKCMTBI.js → near-5X2CQGML.js} +197 -1
  21. package/dist/{near-5LTTDU6G.cjs → near-XSQXEIHT.cjs} +242 -46
  22. package/dist/node.d.cts +2 -2
  23. package/dist/node.d.ts +2 -2
  24. package/dist/{solana-AI2G7V33.cjs → solana-TIEJV742.cjs} +218 -53
  25. package/dist/{solana-HTKDRTD3.js → solana-WRXL54MR.js} +174 -9
  26. package/dist/{stellar-E2KWEV2E.cjs → stellar-5GMZJBTA.cjs} +200 -30
  27. package/dist/{stellar-EUFZLX6J.js → stellar-YQLOIFDD.js} +172 -2
  28. package/dist/{sui-KCIITCYH.js → sui-JFQSDNSZ.js} +165 -3
  29. package/dist/{sui-Q3NJOJZS.cjs → sui-WIZEAO7E.cjs} +185 -23
  30. package/dist/{ton-J7TQWRN4.cjs → ton-AGTKLQA5.cjs} +264 -22
  31. package/dist/{ton-WH2JVQOO.js → ton-OZKFNRLT.js} +244 -2
  32. package/dist/{tron-FXBXDNEY.js → tron-HG3IOOCG.js} +283 -1
  33. package/dist/{tron-HIPMOX7S.cjs → tron-S4WX7OHY.cjs} +323 -41
  34. package/dist/{xrpl-RUOB37QH.js → xrpl-5K444RGX.js} +238 -6
  35. package/dist/{xrpl-SVVS445B.cjs → xrpl-G2FKFXRI.cjs} +289 -57
  36. package/package.json +12 -2
  37. package/dist/{chunk-QU25LSVS.js → chunk-5GRBEMCA.js} +44 -44
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@piprail/sdk",
3
- "version": "2.16.2",
4
- "description": "Accept x402 crypto payments across 29 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
3
+ "version": "3.1.0",
4
+ "description": "Accept x402 crypto payments across 30 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, 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",
@@ -93,6 +93,8 @@
93
93
  "@solana/spl-token": "^0.4.0",
94
94
  "@solana/web3.js": "^1.95.0",
95
95
  "@stellar/stellar-sdk": ">=13 <16",
96
+ "@ston-fi/api": "^0",
97
+ "@ston-fi/sdk": ">=2 <3",
96
98
  "@ton/core": ">=0.59 <1",
97
99
  "@ton/crypto": ">=3 <4",
98
100
  "@ton/ton": ">=15 <17",
@@ -146,6 +148,12 @@
146
148
  },
147
149
  "borsh": {
148
150
  "optional": true
151
+ },
152
+ "@ston-fi/sdk": {
153
+ "optional": true
154
+ },
155
+ "@ston-fi/api": {
156
+ "optional": true
149
157
  }
150
158
  },
151
159
  "devDependencies": {
@@ -154,6 +162,8 @@
154
162
  "@solana/spl-token": "^0.4.14",
155
163
  "@solana/web3.js": "^1.98.4",
156
164
  "@stellar/stellar-sdk": "^15.1.0",
165
+ "@ston-fi/api": "^0.32.0",
166
+ "@ston-fi/sdk": "^2.7.0",
157
167
  "@ton/core": "^0.63.1",
158
168
  "@ton/crypto": "^3.3.0",
159
169
  "@ton/ton": "^16.2.4",
@@ -99,49 +99,6 @@ var UnsupportedNetworkError = class extends PipRailError {
99
99
  code = "UNSUPPORTED_NETWORK";
100
100
  };
101
101
 
102
- // src/drivers/shared.ts
103
- var FAMILY_LABEL = {
104
- evm: "EVM",
105
- solana: "Solana",
106
- ton: "TON",
107
- stellar: "Stellar",
108
- xrpl: "XRPL",
109
- tron: "Tron",
110
- sui: "Sui",
111
- near: "NEAR",
112
- aptos: "Aptos",
113
- algorand: "Algorand"
114
- };
115
- var FAMILY_TOKEN = {
116
- evm: { key: "address", shape: "{ address }", hint: "{ address, decimals }" },
117
- solana: { key: "mint", shape: "{ mint }", hint: "{ mint, decimals }" },
118
- ton: { key: "master", shape: "{ master }", hint: "{ master, decimals }" },
119
- stellar: { key: "code", shape: "{ issuer, code }", hint: "{ issuer, code, decimals }" },
120
- xrpl: { key: "currencyHex", shape: "{ issuer, currencyHex }", hint: "{ issuer, currencyHex, decimals }" },
121
- tron: { key: "address", shape: "{ address }", hint: "{ address, decimals }" },
122
- sui: { key: "coinType", shape: "{ coinType }", hint: "{ coinType, decimals }" },
123
- near: { key: "contractId", shape: "{ contractId }", hint: "{ contractId, decimals }" },
124
- aptos: { key: "metadata", shape: "{ metadata }", hint: "{ metadata, decimals }" },
125
- algorand: { key: "assetId", shape: "{ assetId }", hint: "{ assetId, decimals }" }
126
- };
127
- function rejectForeignToken(token, family, network) {
128
- const own = FAMILY_TOKEN[family];
129
- if (typeof token !== "object" || token === null) {
130
- throw new InvalidConfigError(
131
- `token must be the string 'native', a built-in symbol, or an object (${own.shape} \u2014 pass ${own.hint}); got ${token === null ? "null" : typeof token}.`
132
- );
133
- }
134
- for (const fam of Object.keys(FAMILY_TOKEN)) {
135
- if (fam === family) continue;
136
- if (FAMILY_TOKEN[fam].key === own.key) continue;
137
- if (FAMILY_TOKEN[fam].key in token) {
138
- throw new WrongFamilyError(
139
- `chain ${network} is ${FAMILY_LABEL[family]}; a ${FAMILY_LABEL[fam]} ${FAMILY_TOKEN[fam].shape} token can't be used \u2014 pass ${own.hint}.`
140
- );
141
- }
142
- }
143
- }
144
-
145
102
  // src/util/units.ts
146
103
  var MAX_DECIMALS = 100;
147
104
  function assertValidDecimals(decimals, fn) {
@@ -205,6 +162,49 @@ function formatUnits(value, decimals) {
205
162
  return `${negative ? "-" : ""}${whole}${frac ? `.${frac}` : ""}`;
206
163
  }
207
164
 
165
+ // src/drivers/shared.ts
166
+ var FAMILY_LABEL = {
167
+ evm: "EVM",
168
+ solana: "Solana",
169
+ ton: "TON",
170
+ stellar: "Stellar",
171
+ xrpl: "XRPL",
172
+ tron: "Tron",
173
+ sui: "Sui",
174
+ near: "NEAR",
175
+ aptos: "Aptos",
176
+ algorand: "Algorand"
177
+ };
178
+ var FAMILY_TOKEN = {
179
+ evm: { key: "address", shape: "{ address }", hint: "{ address, decimals }" },
180
+ solana: { key: "mint", shape: "{ mint }", hint: "{ mint, decimals }" },
181
+ ton: { key: "master", shape: "{ master }", hint: "{ master, decimals }" },
182
+ stellar: { key: "code", shape: "{ issuer, code }", hint: "{ issuer, code, decimals }" },
183
+ xrpl: { key: "currencyHex", shape: "{ issuer, currencyHex }", hint: "{ issuer, currencyHex, decimals }" },
184
+ tron: { key: "address", shape: "{ address }", hint: "{ address, decimals }" },
185
+ sui: { key: "coinType", shape: "{ coinType }", hint: "{ coinType, decimals }" },
186
+ near: { key: "contractId", shape: "{ contractId }", hint: "{ contractId, decimals }" },
187
+ aptos: { key: "metadata", shape: "{ metadata }", hint: "{ metadata, decimals }" },
188
+ algorand: { key: "assetId", shape: "{ assetId }", hint: "{ assetId, decimals }" }
189
+ };
190
+ function rejectForeignToken(token, family, network) {
191
+ const own = FAMILY_TOKEN[family];
192
+ if (typeof token !== "object" || token === null) {
193
+ throw new InvalidConfigError(
194
+ `token must be the string 'native', a built-in symbol, or an object (${own.shape} \u2014 pass ${own.hint}); got ${token === null ? "null" : typeof token}.`
195
+ );
196
+ }
197
+ for (const fam of Object.keys(FAMILY_TOKEN)) {
198
+ if (fam === family) continue;
199
+ if (FAMILY_TOKEN[fam].key === own.key) continue;
200
+ if (FAMILY_TOKEN[fam].key in token) {
201
+ throw new WrongFamilyError(
202
+ `chain ${network} is ${FAMILY_LABEL[family]}; a ${FAMILY_LABEL[fam]} ${FAMILY_TOKEN[fam].shape} token can't be used \u2014 pass ${own.hint}.`
203
+ );
204
+ }
205
+ }
206
+ }
207
+
208
208
  // src/util/cost.ts
209
209
  function nativeCost(opts) {
210
210
  return {
@@ -251,10 +251,10 @@ export {
251
251
  MissingDriverError,
252
252
  UnsupportedNetworkError,
253
253
  assertNoLegacyWalletKey,
254
- rejectForeignToken,
255
254
  MAX_DECIMALS,
256
255
  parseUnits,
257
256
  floorUnits,
258
257
  formatUnits,
258
+ rejectForeignToken,
259
259
  nativeCost
260
260
  };