@debridge-finance/solana-utils 6.1.2 → 6.2.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.
- package/dist/browser/index.js +51 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/helpers.js +40 -0
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/spl.js +10 -3
- package/dist/cjs/spl.js.map +1 -1
- package/dist/esm/helpers.js +40 -1
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/spl.js +10 -3
- package/dist/esm/spl.js.map +1 -1
- package/dist/types/helpers.d.ts +2 -1
- package/dist/types/helpers.d.ts.map +1 -1
- package/dist/types/spl.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$1, {
|
|
1
|
+
import require$$1, { TransactionInstruction, PublicKey, SYSVAR_CLOCK_PUBKEY, MessageV0, VersionedTransaction, Transaction, SystemProgram, AddressLookupTableAccount, Keypair } from '@solana/web3.js';
|
|
2
2
|
|
|
3
3
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
|
|
@@ -6508,6 +6508,45 @@ var constants$1 = /*#__PURE__*/Object.freeze({
|
|
|
6508
6508
|
dlnDst: dlnDst$1
|
|
6509
6509
|
});
|
|
6510
6510
|
|
|
6511
|
+
var TimestampCheckKind;
|
|
6512
|
+
(function (TimestampCheckKind) {
|
|
6513
|
+
TimestampCheckKind[TimestampCheckKind["Slot"] = 0] = "Slot";
|
|
6514
|
+
TimestampCheckKind[TimestampCheckKind["EpochStartTime"] = 1] = "EpochStartTime";
|
|
6515
|
+
TimestampCheckKind[TimestampCheckKind["Epoch"] = 2] = "Epoch";
|
|
6516
|
+
TimestampCheckKind[TimestampCheckKind["LeaderScheduleEpoch"] = 3] = "LeaderScheduleEpoch";
|
|
6517
|
+
TimestampCheckKind[TimestampCheckKind["UnixTimestamp"] = 4] = "UnixTimestamp";
|
|
6518
|
+
})(TimestampCheckKind || (TimestampCheckKind = {}));
|
|
6519
|
+
var Operator;
|
|
6520
|
+
(function (Operator) {
|
|
6521
|
+
Operator[Operator["Equal"] = 0] = "Equal";
|
|
6522
|
+
Operator[Operator["NotEqual"] = 1] = "NotEqual";
|
|
6523
|
+
Operator[Operator["GreaterThan"] = 2] = "GreaterThan";
|
|
6524
|
+
Operator[Operator["LessThan"] = 3] = "LessThan";
|
|
6525
|
+
Operator[Operator["GreaterThanOrEqual"] = 4] = "GreaterThanOrEqual";
|
|
6526
|
+
Operator[Operator["LessThanOrEqual"] = 5] = "LessThanOrEqual";
|
|
6527
|
+
Operator[Operator["Contains"] = 6] = "Contains";
|
|
6528
|
+
Operator[Operator["DoesNotContain"] = 7] = "DoesNotContain";
|
|
6529
|
+
})(Operator || (Operator = {}));
|
|
6530
|
+
function setExpirationTimestampIx(expirationTimestampInSeconds) {
|
|
6531
|
+
const buffer$1 = buffer.Buffer.alloc(12);
|
|
6532
|
+
// 0f 00 00 e1071e1900000000 05
|
|
6533
|
+
buffer$1[0] = 15; // discriminator
|
|
6534
|
+
buffer$1[1] = 1; // log level
|
|
6535
|
+
buffer$1[2] = TimestampCheckKind.UnixTimestamp;
|
|
6536
|
+
buffer$1.writeBigInt64LE(expirationTimestampInSeconds, 3); // expiration timestamp
|
|
6537
|
+
buffer$1[11] = Operator.LessThanOrEqual; // operator: Equal 0, NotEqual 1,
|
|
6538
|
+
return new TransactionInstruction({
|
|
6539
|
+
programId: new PublicKey("L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95"),
|
|
6540
|
+
keys: [
|
|
6541
|
+
{
|
|
6542
|
+
pubkey: SYSVAR_CLOCK_PUBKEY,
|
|
6543
|
+
isSigner: false,
|
|
6544
|
+
isWritable: false,
|
|
6545
|
+
},
|
|
6546
|
+
],
|
|
6547
|
+
data: buffer$1,
|
|
6548
|
+
});
|
|
6549
|
+
}
|
|
6511
6550
|
function getAccountInfo(connection_1, account_1) {
|
|
6512
6551
|
return __awaiter(this, arguments, void 0, function* (connection, account, commitment = "confirmed") {
|
|
6513
6552
|
const info = yield connection.getAccountInfo(account, commitment);
|
|
@@ -6717,6 +6756,7 @@ function sendAll(connection, wallet, transactions, options) {
|
|
|
6717
6756
|
|
|
6718
6757
|
var helpers = /*#__PURE__*/Object.freeze({
|
|
6719
6758
|
__proto__: null,
|
|
6759
|
+
setExpirationTimestampIx: setExpirationTimestampIx,
|
|
6720
6760
|
getAccountInfo: getAccountInfo,
|
|
6721
6761
|
hexToBuffer: hexToBuffer,
|
|
6722
6762
|
bufferToHex: bufferToHex,
|
|
@@ -13046,15 +13086,22 @@ function getTokenInfo(connection_1, tokenAddress_1) {
|
|
|
13046
13086
|
}
|
|
13047
13087
|
}
|
|
13048
13088
|
}
|
|
13049
|
-
if (!pdaAccount || pdaAccount.lamports === 0) {
|
|
13050
|
-
return null;
|
|
13051
|
-
}
|
|
13052
13089
|
// parse token account
|
|
13053
13090
|
// mint_authority - coption(pubkey) = 36
|
|
13054
13091
|
// supply - u64 = 8
|
|
13055
13092
|
// decimals - u8
|
|
13056
13093
|
const decimalsOffset = 44;
|
|
13057
13094
|
const decimals = tokenAccount.data[decimalsOffset];
|
|
13095
|
+
if (!pdaAccount || pdaAccount.lamports === 0) {
|
|
13096
|
+
return {
|
|
13097
|
+
address: tokenAddress,
|
|
13098
|
+
decimals,
|
|
13099
|
+
name: "",
|
|
13100
|
+
symbol: "",
|
|
13101
|
+
json: "",
|
|
13102
|
+
tokenProgram: tokenAccount.owner,
|
|
13103
|
+
};
|
|
13104
|
+
}
|
|
13058
13105
|
const { name, symbol, uri } = decodeMetaplexMetadataPartial(pdaAccount.data);
|
|
13059
13106
|
return {
|
|
13060
13107
|
address: tokenAddress,
|