@piprail/sdk 2.14.0 → 2.14.2
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.
- package/CHANGELOG.md +65 -0
- package/dist/{algorand-6J3IABVF.js → algorand-CSEUTWNW.js} +1 -1
- package/dist/{algorand-QU6G2DQZ.cjs → algorand-I2O24RSM.cjs} +32 -32
- package/dist/{aptos-LFTQGBBK.cjs → aptos-GA5AEYYL.cjs} +31 -31
- package/dist/{aptos-DHOMTBLZ.js → aptos-J7QGCWNW.js} +1 -1
- package/dist/{chunk-GYM46G5L.cjs → chunk-3FR22M3O.cjs} +35 -20
- package/dist/{chunk-PAMKCWVW.js → chunk-3ZWM3DKM.js} +17 -2
- package/dist/index.cjs +246 -203
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +78 -35
- package/dist/{near-YNNK7RW7.cjs → near-NDQLGI4U.cjs} +27 -27
- package/dist/{near-5PXTVQ47.js → near-YA4Y4IGC.js} +1 -1
- package/dist/{solana-HITVI3HF.js → solana-MB6G3OA5.js} +1 -1
- package/dist/{solana-N3UCNCYE.cjs → solana-OU6IUMQM.cjs} +32 -32
- package/dist/{stellar-Y3SQN7S5.cjs → stellar-RSNVOIKL.cjs} +20 -20
- package/dist/{stellar-2QT6YYKN.js → stellar-WDWSYOED.js} +1 -1
- package/dist/{sui-FV5L6WF5.js → sui-GVSFNNJX.js} +1 -1
- package/dist/{sui-4AL4E6XU.cjs → sui-MVC46BFJ.cjs} +16 -16
- package/dist/{ton-5FWDQ4QR.js → ton-EJMGM3YI.js} +1 -1
- package/dist/{ton-5HDVOTMR.cjs → ton-MYOI3U3H.cjs} +16 -16
- package/dist/{tron-TX2B4N2A.cjs → tron-42X5N4GQ.cjs} +25 -25
- package/dist/{tron-AZDY7BMQ.js → tron-VAPVMGJK.js} +1 -1
- package/dist/{xrpl-5TYDLQFS.cjs → xrpl-MGUBUNSZ.cjs} +20 -20
- package/dist/{xrpl-UJL5J7CY.js → xrpl-Q2UWPCTJ.js} +1 -1
- package/package.json +3 -2
|
@@ -71,6 +71,9 @@ var SettlementError = class extends PipRailError {
|
|
|
71
71
|
var InvalidEnvelopeError = class extends PipRailError {
|
|
72
72
|
code = "INVALID_ENVELOPE";
|
|
73
73
|
};
|
|
74
|
+
var InvalidConfigError = class extends PipRailError {
|
|
75
|
+
code = "INVALID_CONFIG";
|
|
76
|
+
};
|
|
74
77
|
var NoCompatibleAcceptError = class extends PipRailError {
|
|
75
78
|
code = "NO_COMPATIBLE_ACCEPT";
|
|
76
79
|
};
|
|
@@ -123,6 +126,11 @@ var FAMILY_TOKEN = {
|
|
|
123
126
|
};
|
|
124
127
|
function rejectForeignToken(token, family, network) {
|
|
125
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
|
+
}
|
|
126
134
|
for (const fam of Object.keys(FAMILY_TOKEN)) {
|
|
127
135
|
if (fam === family) continue;
|
|
128
136
|
if (FAMILY_TOKEN[fam].key === own.key) continue;
|
|
@@ -159,9 +167,15 @@ function expandScientific(value) {
|
|
|
159
167
|
}
|
|
160
168
|
function parseUnits(value, decimals) {
|
|
161
169
|
assertValidDecimals(decimals, "parseUnits");
|
|
162
|
-
value
|
|
170
|
+
if (typeof value !== "string") {
|
|
171
|
+
throw new InvalidConfigError(
|
|
172
|
+
`parseUnits: amount must be a decimal STRING, got ${typeof value}. Pass '0.05', not 0.05.`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
163
175
|
if (!/^\d+(\.\d+)?$/.test(value)) {
|
|
164
|
-
throw new
|
|
176
|
+
throw new InvalidConfigError(
|
|
177
|
+
`parseUnits: "${value}" is not a plain non-negative decimal amount (scientific notation like '1e3' is rejected \u2014 write the number out, e.g. '1000').`
|
|
178
|
+
);
|
|
165
179
|
}
|
|
166
180
|
const [whole, frac = ""] = value.split(".");
|
|
167
181
|
if (frac.length > decimals) {
|
|
@@ -227,6 +241,7 @@ export {
|
|
|
227
241
|
ConfirmationTimeoutError,
|
|
228
242
|
SettlementError,
|
|
229
243
|
InvalidEnvelopeError,
|
|
244
|
+
InvalidConfigError,
|
|
230
245
|
NoCompatibleAcceptError,
|
|
231
246
|
UnsupportedSchemeError,
|
|
232
247
|
NonReplayableBodyError,
|