@piprail/sdk 2.16.2 → 3.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 (33) hide show
  1. package/CHANGELOG.md +343 -0
  2. package/README.md +1 -0
  3. package/dist/{algorand-25FMBCT3.js → algorand-HL57PQHE.js} +157 -2
  4. package/dist/{algorand-Q3TUQLPK.cjs → algorand-W776EEM2.cjs} +205 -50
  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 +2929 -1444
  15. package/dist/index.d.cts +625 -13
  16. package/dist/index.d.ts +625 -13
  17. package/dist/index.js +2506 -1021
  18. package/dist/{near-OLKCMTBI.js → near-5X2CQGML.js} +197 -1
  19. package/dist/{near-5LTTDU6G.cjs → near-XSQXEIHT.cjs} +242 -46
  20. package/dist/{solana-AI2G7V33.cjs → solana-EBV6PUCU.cjs} +211 -52
  21. package/dist/{solana-HTKDRTD3.js → solana-O6Q6QILH.js} +167 -8
  22. package/dist/{stellar-E2KWEV2E.cjs → stellar-5C7FQLPS.cjs} +191 -29
  23. package/dist/{stellar-EUFZLX6J.js → stellar-YF5LOJEM.js} +163 -1
  24. package/dist/{sui-KCIITCYH.js → sui-JFQSDNSZ.js} +165 -3
  25. package/dist/{sui-Q3NJOJZS.cjs → sui-WIZEAO7E.cjs} +185 -23
  26. package/dist/{ton-J7TQWRN4.cjs → ton-AGTKLQA5.cjs} +264 -22
  27. package/dist/{ton-WH2JVQOO.js → ton-OZKFNRLT.js} +244 -2
  28. package/dist/{tron-FXBXDNEY.js → tron-HG3IOOCG.js} +283 -1
  29. package/dist/{tron-HIPMOX7S.cjs → tron-S4WX7OHY.cjs} +323 -41
  30. package/dist/{xrpl-RUOB37QH.js → xrpl-GOVHMYYK.js} +222 -5
  31. package/dist/{xrpl-SVVS445B.cjs → xrpl-YS3IXPLV.cjs} +273 -56
  32. package/package.json +12 -2
  33. package/dist/{chunk-QU25LSVS.js → chunk-5GRBEMCA.js} +44 -44
@@ -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
  };