@debridge-finance/solana-utils 6.2.0 → 6.2.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.
@@ -1,4 +1,4 @@
1
- import require$$1, { TransactionInstruction, PublicKey, SYSVAR_CLOCK_PUBKEY, MessageV0, VersionedTransaction, Transaction, 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
 
@@ -6527,6 +6527,35 @@ var Operator;
6527
6527
  Operator[Operator["Contains"] = 6] = "Contains";
6528
6528
  Operator[Operator["DoesNotContain"] = 7] = "DoesNotContain";
6529
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
+ }
6530
6559
  function setExpirationTimestampIx(expirationTimestampInSeconds) {
6531
6560
  const buffer$1 = buffer.Buffer.alloc(12);
6532
6561
  // 0f 00 00 e1071e1900000000 05
@@ -6756,6 +6785,7 @@ function sendAll(connection, wallet, transactions, options) {
6756
6785
 
6757
6786
  var helpers = /*#__PURE__*/Object.freeze({
6758
6787
  __proto__: null,
6788
+ setReplayProtectionIx: setReplayProtectionIx,
6759
6789
  setExpirationTimestampIx: setExpirationTimestampIx,
6760
6790
  getAccountInfo: getAccountInfo,
6761
6791
  hexToBuffer: hexToBuffer,
@@ -13121,6 +13151,9 @@ function getTokenInfo(connection_1, tokenAddress_1) {
13121
13151
  TOKEN_PROGRAM_CACHE.del(tokenAddressStr);
13122
13152
  }
13123
13153
  return res;
13154
+ }, (error) => {
13155
+ TOKEN_PROGRAM_CACHE.del(tokenAddressStr);
13156
+ throw error;
13124
13157
  });
13125
13158
  TOKEN_PROGRAM_CACHE.set(tokenAddressStr, wrapped);
13126
13159
  return wrapped;