@debridge-finance/solana-utils 6.1.3 → 6.2.1

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.
@@ -1,4 +1,4 @@
1
- import require$$1, { MessageV0, VersionedTransaction, Transaction, PublicKey, TransactionInstruction, SystemProgram, AddressLookupTableAccount, Keypair } from '@solana/web3.js';
1
+ import require$$1, { PublicKey, TransactionInstruction, SystemProgram, SYSVAR_CLOCK_PUBKEY, MessageV0, VersionedTransaction, Transaction, 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,74 @@ 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 setReplayProtectionIx(signer, rentPayer, actionId) {
6531
+ const program = new PublicKey("protXwJ7BfnbjZE96XAj3pUraU7CvybUyfv7nupuq1s");
6532
+ // sha256("global:create_action_marker").slice(0, 8)
6533
+ const discriminator = buffer.Buffer.from("22687fc7aef422a8", "hex");
6534
+ /// PublicKey.findProgramAddressSync([Buffer.from([115,116,97,116,101])], program)[0];
6535
+ const state = new PublicKey("EmJmEEg9C8jkiMwuFNz5HXwqjFN9bZ75Aff8PhDzd5mU");
6536
+ const marker = PublicKey.findProgramAddressSync([
6537
+ buffer.Buffer.from([
6538
+ 97, 99, 116, 105, 111, 110, 95, 109, 97, 114, 107, 101, 114,
6539
+ ]),
6540
+ actionId,
6541
+ ], program)[0];
6542
+ /// PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], program)[0];
6543
+ const eventAuth = new PublicKey("DuTnXqhYQ36q9GE183jB5Tm1CCNmsfLWGqMPEXkSXGgH");
6544
+ const ix = new TransactionInstruction({
6545
+ programId: program,
6546
+ keys: [
6547
+ { isSigner: true, isWritable: true, pubkey: rentPayer }, // rent payer
6548
+ { isSigner: true, isWritable: false, pubkey: signer }, // signer
6549
+ { isSigner: false, isWritable: false, pubkey: state }, // state
6550
+ { isSigner: false, isWritable: true, pubkey: marker }, // action marker
6551
+ { isSigner: false, isWritable: false, pubkey: SystemProgram.programId }, // system program
6552
+ { isSigner: false, isWritable: false, pubkey: eventAuth }, // event authority
6553
+ { isSigner: false, isWritable: false, pubkey: program }, // program
6554
+ ],
6555
+ data: buffer.Buffer.concat([discriminator, actionId]),
6556
+ });
6557
+ return ix;
6558
+ }
6559
+ function setExpirationTimestampIx(expirationTimestampInSeconds) {
6560
+ const buffer$1 = buffer.Buffer.alloc(12);
6561
+ // 0f 00 00 e1071e1900000000 05
6562
+ buffer$1[0] = 15; // discriminator
6563
+ buffer$1[1] = 1; // log level
6564
+ buffer$1[2] = TimestampCheckKind.UnixTimestamp;
6565
+ buffer$1.writeBigInt64LE(expirationTimestampInSeconds, 3); // expiration timestamp
6566
+ buffer$1[11] = Operator.LessThanOrEqual; // operator: Equal 0, NotEqual 1,
6567
+ return new TransactionInstruction({
6568
+ programId: new PublicKey("L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95"),
6569
+ keys: [
6570
+ {
6571
+ pubkey: SYSVAR_CLOCK_PUBKEY,
6572
+ isSigner: false,
6573
+ isWritable: false,
6574
+ },
6575
+ ],
6576
+ data: buffer$1,
6577
+ });
6578
+ }
6511
6579
  function getAccountInfo(connection_1, account_1) {
6512
6580
  return __awaiter(this, arguments, void 0, function* (connection, account, commitment = "confirmed") {
6513
6581
  const info = yield connection.getAccountInfo(account, commitment);
@@ -6717,6 +6785,8 @@ function sendAll(connection, wallet, transactions, options) {
6717
6785
 
6718
6786
  var helpers = /*#__PURE__*/Object.freeze({
6719
6787
  __proto__: null,
6788
+ setReplayProtectionIx: setReplayProtectionIx,
6789
+ setExpirationTimestampIx: setExpirationTimestampIx,
6720
6790
  getAccountInfo: getAccountInfo,
6721
6791
  hexToBuffer: hexToBuffer,
6722
6792
  bufferToHex: bufferToHex,