@debridge-finance/solana-utils 6.2.1 → 6.2.3
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/dist/browser/index.js +25 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/crypto.js +2 -2
- package/dist/cjs/crypto.js.map +1 -1
- package/dist/cjs/helpers.js +22 -0
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/spl.js +3 -0
- package/dist/cjs/spl.js.map +1 -1
- package/dist/esm/crypto.js +3 -3
- package/dist/esm/crypto.js.map +1 -1
- package/dist/esm/helpers.js +20 -0
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/spl.js +3 -0
- package/dist/esm/spl.js.map +1 -1
- package/dist/types/helpers.d.ts +7 -0
- package/dist/types/helpers.d.ts.map +1 -1
- package/dist/types/spl.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -6508,6 +6508,25 @@ var constants$1 = /*#__PURE__*/Object.freeze({
|
|
|
6508
6508
|
dlnDst: dlnDst$1
|
|
6509
6509
|
});
|
|
6510
6510
|
|
|
6511
|
+
/**
|
|
6512
|
+
* Losslessly converts a numeric value (up to uint256) into a BN.
|
|
6513
|
+
* Supports numbers, decimal strings, 0x-prefixed hex strings, byte arrays,
|
|
6514
|
+
* Buffers and BN instances.
|
|
6515
|
+
*/
|
|
6516
|
+
function toBN(value) {
|
|
6517
|
+
if (value === undefined || value === null)
|
|
6518
|
+
return new BN(0);
|
|
6519
|
+
if (BN.isBN(value))
|
|
6520
|
+
return value;
|
|
6521
|
+
if (typeof value === "string") {
|
|
6522
|
+
if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
6523
|
+
const hex = value.slice(2);
|
|
6524
|
+
return hex ? new BN(hex, "hex") : new BN(0);
|
|
6525
|
+
}
|
|
6526
|
+
return new BN(value, 10);
|
|
6527
|
+
}
|
|
6528
|
+
return new BN(value);
|
|
6529
|
+
}
|
|
6511
6530
|
var TimestampCheckKind;
|
|
6512
6531
|
(function (TimestampCheckKind) {
|
|
6513
6532
|
TimestampCheckKind[TimestampCheckKind["Slot"] = 0] = "Slot";
|
|
@@ -6785,6 +6804,7 @@ function sendAll(connection, wallet, transactions, options) {
|
|
|
6785
6804
|
|
|
6786
6805
|
var helpers = /*#__PURE__*/Object.freeze({
|
|
6787
6806
|
__proto__: null,
|
|
6807
|
+
toBN: toBN,
|
|
6788
6808
|
setReplayProtectionIx: setReplayProtectionIx,
|
|
6789
6809
|
setExpirationTimestampIx: setExpirationTimestampIx,
|
|
6790
6810
|
getAccountInfo: getAccountInfo,
|
|
@@ -7042,7 +7062,7 @@ function getShortcutFromAutoParams(params) {
|
|
|
7042
7062
|
return isBuffer(shortcut) ? shortcut : hexToBuffer(shortcut);
|
|
7043
7063
|
}
|
|
7044
7064
|
else {
|
|
7045
|
-
const flags = BigInt(
|
|
7065
|
+
const flags = BigInt(toBN((_b = params.autoParams) === null || _b === void 0 ? void 0 : _b.flags).toString());
|
|
7046
7066
|
const data = (_c = params.autoParams) === null || _c === void 0 ? void 0 : _c.data;
|
|
7047
7067
|
if (!data)
|
|
7048
7068
|
return hashExternalCallBytes(data);
|
|
@@ -7102,7 +7122,7 @@ function hashSubmissionIdRaw(params) {
|
|
|
7102
7122
|
: new PublicKey(params.autoParams.fallbackAddress).toBuffer();
|
|
7103
7123
|
packData = packData.concat([
|
|
7104
7124
|
new BN(((_a = params === null || params === void 0 ? void 0 : params.autoParams) === null || _a === void 0 ? void 0 : _a.executionFee) || 0).toArray("be", 32),
|
|
7105
|
-
|
|
7125
|
+
toBN((_b = params.autoParams) === null || _b === void 0 ? void 0 : _b.flags).toArray("be", 32),
|
|
7106
7126
|
hashExternalCallBytes(fallback),
|
|
7107
7127
|
shortcut,
|
|
7108
7128
|
hashExternalCallBytes(params.autoParams.nativeSender),
|
|
@@ -13151,6 +13171,9 @@ function getTokenInfo(connection_1, tokenAddress_1) {
|
|
|
13151
13171
|
TOKEN_PROGRAM_CACHE.del(tokenAddressStr);
|
|
13152
13172
|
}
|
|
13153
13173
|
return res;
|
|
13174
|
+
}, (error) => {
|
|
13175
|
+
TOKEN_PROGRAM_CACHE.del(tokenAddressStr);
|
|
13176
|
+
throw error;
|
|
13154
13177
|
});
|
|
13155
13178
|
TOKEN_PROGRAM_CACHE.set(tokenAddressStr, wrapped);
|
|
13156
13179
|
return wrapped;
|