@adelos/sdk 0.1.1 → 0.1.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/dist/index.js CHANGED
@@ -35,9 +35,14 @@ __export(index_exports, {
35
35
  IDL: () => IDL,
36
36
  LIGHT_PROGRAM_IDS: () => LIGHT_PROGRAM_IDS,
37
37
  LightClient: () => LightClient,
38
+ MEMO_PREFIX: () => MEMO_PREFIX,
39
+ MEMO_PROGRAM_ID: () => MEMO_PROGRAM_ID,
38
40
  PROGRAM_ID: () => PROGRAM_ID,
41
+ PROGRAM_IDS: () => PROGRAM_IDS,
39
42
  REGISTRY_ACCOUNT_SIZE: () => REGISTRY_ACCOUNT_SIZE,
40
43
  REGISTRY_SEED: () => REGISTRY_SEED,
44
+ RPC_URLS: () => RPC_URLS,
45
+ STEALTH_DOMAIN: () => STEALTH_DOMAIN,
41
46
  bytesToHex: () => bytesToHex,
42
47
  computeSharedSecret: () => computeSharedSecret,
43
48
  computeSharedSecretAsRecipient: () => computeSharedSecretAsRecipient,
@@ -60,11 +65,25 @@ var import_web35 = require("@solana/web3.js");
60
65
 
61
66
  // src/constants.ts
62
67
  var import_web3 = require("@solana/web3.js");
63
- var PROGRAM_ID = new import_web3.PublicKey(
64
- "7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp"
68
+ var PROGRAM_IDS = {
69
+ devnet: new import_web3.PublicKey("7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp"),
70
+ "mainnet-beta": new import_web3.PublicKey("7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp"),
71
+ // Update when deployed to mainnet
72
+ localnet: new import_web3.PublicKey("7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp")
73
+ };
74
+ var RPC_URLS = {
75
+ devnet: (0, import_web3.clusterApiUrl)("devnet"),
76
+ "mainnet-beta": (0, import_web3.clusterApiUrl)("mainnet-beta"),
77
+ localnet: "http://localhost:8899"
78
+ };
79
+ var PROGRAM_ID = PROGRAM_IDS.devnet;
80
+ var MEMO_PROGRAM_ID = new import_web3.PublicKey(
81
+ "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"
65
82
  );
66
83
  var REGISTRY_SEED = "registry";
67
84
  var REGISTRY_ACCOUNT_SIZE = 8 + 32 + 32 + 1;
85
+ var MEMO_PREFIX = "ADLSv1:";
86
+ var STEALTH_DOMAIN = "adelos:stealth:v1";
68
87
 
69
88
  // src/utils.ts
70
89
  var import_web32 = require("@solana/web3.js");
@@ -104,75 +123,246 @@ function getDiscriminator(instructionName) {
104
123
 
105
124
  // src/idl.ts
106
125
  var IDL = {
107
- address: "7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp",
108
- metadata: {
109
- name: "adelos_registry",
110
- version: "0.1.0",
111
- spec: "0.1.0"
126
+ "address": "7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp",
127
+ "metadata": {
128
+ "name": "adelos_registry",
129
+ "version": "0.1.0",
130
+ "spec": "0.1.0",
131
+ "description": "Privacy Registry for Adelos Protocol"
112
132
  },
113
- instructions: [
133
+ "instructions": [
114
134
  {
115
- name: "register_identity",
116
- discriminator: [164, 118, 227, 177, 47, 176, 187, 248],
117
- accounts: [
118
- { name: "owner", writable: true, signer: true },
119
- { name: "registry", writable: true, pda: { seeds: [{ kind: "const", value: [114, 101, 103, 105, 115, 116, 114, 121] }, { kind: "account", path: "owner" }] } },
120
- { name: "system_program", address: "11111111111111111111111111111111" }
135
+ "name": "close_registry",
136
+ "discriminator": [
137
+ 76,
138
+ 32,
139
+ 154,
140
+ 180,
141
+ 51,
142
+ 159,
143
+ 218,
144
+ 102
121
145
  ],
122
- args: [{ name: "meta_pubkey", type: { array: ["u8", 32] } }]
146
+ "accounts": [
147
+ {
148
+ "name": "owner",
149
+ "writable": true,
150
+ "signer": true,
151
+ "relations": [
152
+ "registry"
153
+ ]
154
+ },
155
+ {
156
+ "name": "registry",
157
+ "writable": true,
158
+ "pda": {
159
+ "seeds": [
160
+ {
161
+ "kind": "const",
162
+ "value": [
163
+ 114,
164
+ 101,
165
+ 103,
166
+ 105,
167
+ 115,
168
+ 116,
169
+ 114,
170
+ 121
171
+ ]
172
+ },
173
+ {
174
+ "kind": "account",
175
+ "path": "owner"
176
+ }
177
+ ]
178
+ }
179
+ }
180
+ ],
181
+ "args": []
123
182
  },
124
183
  {
125
- name: "update_identity",
126
- discriminator: [130, 54, 88, 104, 222, 124, 238, 252],
127
- accounts: [
128
- { name: "owner", signer: true },
129
- { name: "registry", writable: true }
184
+ "name": "register_identity",
185
+ "discriminator": [
186
+ 164,
187
+ 118,
188
+ 227,
189
+ 177,
190
+ 47,
191
+ 176,
192
+ 187,
193
+ 248
130
194
  ],
131
- args: [{ name: "new_meta_pubkey", type: { array: ["u8", 32] } }]
195
+ "accounts": [
196
+ {
197
+ "name": "owner",
198
+ "writable": true,
199
+ "signer": true
200
+ },
201
+ {
202
+ "name": "registry",
203
+ "writable": true,
204
+ "pda": {
205
+ "seeds": [
206
+ {
207
+ "kind": "const",
208
+ "value": [
209
+ 114,
210
+ 101,
211
+ 103,
212
+ 105,
213
+ 115,
214
+ 116,
215
+ 114,
216
+ 121
217
+ ]
218
+ },
219
+ {
220
+ "kind": "account",
221
+ "path": "owner"
222
+ }
223
+ ]
224
+ }
225
+ },
226
+ {
227
+ "name": "system_program",
228
+ "address": "11111111111111111111111111111111"
229
+ }
230
+ ],
231
+ "args": [
232
+ {
233
+ "name": "meta_pubkey",
234
+ "type": {
235
+ "array": [
236
+ "u8",
237
+ 32
238
+ ]
239
+ }
240
+ }
241
+ ]
132
242
  },
133
243
  {
134
- name: "close_registry",
135
- discriminator: [76, 32, 154, 180, 51, 159, 218, 102],
136
- accounts: [
137
- { name: "owner", writable: true, signer: true },
138
- { name: "registry", writable: true }
244
+ "name": "update_identity",
245
+ "discriminator": [
246
+ 130,
247
+ 54,
248
+ 88,
249
+ 104,
250
+ 222,
251
+ 124,
252
+ 238,
253
+ 252
254
+ ],
255
+ "accounts": [
256
+ {
257
+ "name": "owner",
258
+ "writable": true,
259
+ "signer": true,
260
+ "relations": [
261
+ "registry"
262
+ ]
263
+ },
264
+ {
265
+ "name": "registry",
266
+ "writable": true,
267
+ "pda": {
268
+ "seeds": [
269
+ {
270
+ "kind": "const",
271
+ "value": [
272
+ 114,
273
+ 101,
274
+ 103,
275
+ 105,
276
+ 115,
277
+ 116,
278
+ 114,
279
+ 121
280
+ ]
281
+ },
282
+ {
283
+ "kind": "account",
284
+ "path": "owner"
285
+ }
286
+ ]
287
+ }
288
+ },
289
+ {
290
+ "name": "system_program",
291
+ "address": "11111111111111111111111111111111"
292
+ }
139
293
  ],
140
- args: []
294
+ "args": [
295
+ {
296
+ "name": "new_meta_pubkey",
297
+ "type": {
298
+ "array": [
299
+ "u8",
300
+ 32
301
+ ]
302
+ }
303
+ }
304
+ ]
141
305
  }
142
306
  ],
143
- accounts: [
307
+ "accounts": [
144
308
  {
145
- name: "RegistryAccount",
146
- discriminator: [113, 93, 106, 201, 100, 166, 146, 98]
309
+ "name": "RegistryAccount",
310
+ "discriminator": [
311
+ 113,
312
+ 93,
313
+ 106,
314
+ 201,
315
+ 100,
316
+ 166,
317
+ 146,
318
+ 98
319
+ ]
147
320
  }
148
321
  ],
149
- types: [
322
+ "errors": [
323
+ {
324
+ "code": 6e3,
325
+ "name": "InvalidMetaPubkey",
326
+ "msg": "Invalid meta_pubkey"
327
+ },
150
328
  {
151
- name: "RegistryAccount",
152
- type: {
153
- kind: "struct",
154
- fields: [
155
- { name: "owner", type: "pubkey" },
156
- { name: "meta_pubkey", type: { array: ["u8", 32] } },
157
- { name: "bump", type: "u8" }
329
+ "code": 6001,
330
+ "name": "Unauthorized",
331
+ "msg": "Unauthorized"
332
+ }
333
+ ],
334
+ "types": [
335
+ {
336
+ "name": "RegistryAccount",
337
+ "type": {
338
+ "kind": "struct",
339
+ "fields": [
340
+ {
341
+ "name": "owner",
342
+ "type": "pubkey"
343
+ },
344
+ {
345
+ "name": "meta_pubkey",
346
+ "type": {
347
+ "array": [
348
+ "u8",
349
+ 32
350
+ ]
351
+ }
352
+ },
353
+ {
354
+ "name": "bump",
355
+ "type": "u8"
356
+ }
158
357
  ]
159
358
  }
160
359
  }
161
- ],
162
- errors: [
163
- { code: 6e3, name: "InvalidMetaPubkey", msg: "Invalid meta_pubkey" },
164
- { code: 6001, name: "Unauthorized", msg: "Unauthorized" }
165
360
  ]
166
361
  };
167
362
 
168
363
  // src/crypto.ts
169
364
  var import_sha256 = require("@noble/hashes/sha256");
170
365
  var ed = __toESM(require("@noble/ed25519"));
171
- ed.etc.sha512Sync = (...m) => {
172
- const h = import_sha256.sha256.create();
173
- m.forEach((msg) => h.update(msg));
174
- return h.digest();
175
- };
176
366
  function generateEphemeralKeypair() {
177
367
  const secretKey = ed.utils.randomPrivateKey();
178
368
  const publicKey = ed.getPublicKey(secretKey);
@@ -190,7 +380,7 @@ async function computeSharedSecret(ephemeralSk, recipientMetaPubkey) {
190
380
  }
191
381
  function deriveStealthPubkey(metaPubkey, sharedSecret) {
192
382
  const scalarBytes = (0, import_sha256.sha256)(
193
- new Uint8Array([...sharedSecret, ...Buffer.from("adelos:stealth")])
383
+ new Uint8Array([...sharedSecret, ...Buffer.from(STEALTH_DOMAIN)])
194
384
  );
195
385
  const scalar = ed.etc.mod(
196
386
  BigInt("0x" + bytesToHex(scalarBytes)),
@@ -203,7 +393,7 @@ function deriveStealthPubkey(metaPubkey, sharedSecret) {
203
393
  }
204
394
  function recoverStealthSecretKey(metaSk, sharedSecret) {
205
395
  const scalarBytes = (0, import_sha256.sha256)(
206
- new Uint8Array([...sharedSecret, ...Buffer.from("adelos:stealth")])
396
+ new Uint8Array([...sharedSecret, ...Buffer.from(STEALTH_DOMAIN)])
207
397
  );
208
398
  const scalar = ed.etc.mod(
209
399
  BigInt("0x" + bytesToHex(scalarBytes)),
@@ -226,11 +416,11 @@ async function computeSharedSecretAsRecipient(metaSk, ephemeralPubkey) {
226
416
  }
227
417
  function generateStealthMemo(ephemeralPubkey) {
228
418
  const pubkeyHex = bytesToHex(ephemeralPubkey);
229
- return `ADLSv1:${pubkeyHex}`;
419
+ return `${MEMO_PREFIX}${pubkeyHex}`;
230
420
  }
231
421
  function parseStealthMemo(memo) {
232
- if (!memo.startsWith("ADLSv1:")) return null;
233
- const pubkeyHex = memo.slice(7);
422
+ if (!memo.startsWith(MEMO_PREFIX)) return null;
423
+ const pubkeyHex = memo.slice(MEMO_PREFIX.length);
234
424
  if (pubkeyHex.length !== 64) return null;
235
425
  try {
236
426
  return hexToBytes(pubkeyHex);
@@ -461,7 +651,7 @@ var LightClient = class _LightClient {
461
651
  );
462
652
  const memoIx = new import_web33.TransactionInstruction({
463
653
  keys: [],
464
- programId: new import_web33.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),
654
+ programId: MEMO_PROGRAM_ID,
465
655
  data: Buffer.from(memo, "utf-8")
466
656
  });
467
657
  const transaction = new import_web33.Transaction().add(transferIx).add(memoIx);
@@ -491,6 +681,10 @@ var AdelosIndexer = class _AdelosIndexer {
491
681
  }
492
682
  /**
493
683
  * Scans recent transactions for stealth transfers to a recipient
684
+ *
685
+ * IMPORTANT: We scan the Memo Program, NOT the metaPubkey!
686
+ * The metaPubkey should never appear in transactions - that's the whole point of stealth addresses.
687
+ * We scan memo program for ADLSv1: prefix, then use Trial Decryption to check if it's for us.
494
688
  *
495
689
  * @param metaSk - Recipient's meta secret key
496
690
  * @param metaPubkey - Recipient's meta public key
@@ -501,7 +695,7 @@ var AdelosIndexer = class _AdelosIndexer {
501
695
  const results = [];
502
696
  try {
503
697
  const signatures = await this.connection.getSignaturesForAddress(
504
- new import_web34.PublicKey(metaPubkey),
698
+ MEMO_PROGRAM_ID,
505
699
  { limit }
506
700
  );
507
701
  for (const sigInfo of signatures) {
@@ -510,6 +704,8 @@ var AdelosIndexer = class _AdelosIndexer {
510
704
  { maxSupportedTransactionVersion: 0 }
511
705
  );
512
706
  if (!tx) continue;
707
+ const memo = this.extractMemo(tx);
708
+ if (!memo?.startsWith(MEMO_PREFIX)) continue;
513
709
  const stealthTx = await this.parseStealthTransaction(
514
710
  tx,
515
711
  sigInfo.signature,
@@ -537,7 +733,7 @@ var AdelosIndexer = class _AdelosIndexer {
537
733
  const results = [];
538
734
  try {
539
735
  const signatures = await this.connection.getSignaturesForAddress(
540
- new import_web34.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),
736
+ MEMO_PROGRAM_ID,
541
737
  { limit: 1e3, until: since }
542
738
  );
543
739
  for (const sigInfo of signatures) {
@@ -547,7 +743,7 @@ var AdelosIndexer = class _AdelosIndexer {
547
743
  );
548
744
  if (!tx) continue;
549
745
  const memo = this.extractMemo(tx);
550
- if (!memo?.startsWith("ADLSv1:")) continue;
746
+ if (!memo?.startsWith(MEMO_PREFIX)) continue;
551
747
  const stealthTx = await this.parseStealthTransaction(
552
748
  tx,
553
749
  sigInfo.signature,
@@ -589,39 +785,49 @@ var AdelosIndexer = class _AdelosIndexer {
589
785
  return null;
590
786
  }
591
787
  /**
592
- * Parses a transaction to extract stealth transfer info
788
+ * Parses a transaction to extract stealth transfer info using Trial Decryption
789
+ *
790
+ * Trial Decryption: First compute expected stealth address, then find if it exists in tx accounts
593
791
  */
594
792
  async parseStealthTransaction(tx, signature, metaSk, metaPubkey) {
595
793
  const memo = this.extractMemo(tx);
596
794
  if (!memo) return null;
597
795
  const ephemeralPubkey = parseStealthMemo(memo);
598
796
  if (!ephemeralPubkey) return null;
599
- const preBalances = tx.meta?.preBalances || [];
600
- const postBalances = tx.meta?.postBalances || [];
601
- const accounts = tx.transaction.message.accountKeys;
602
- let stealthAddress = null;
603
- let amount = BigInt(0);
604
- let sender = null;
605
- for (let i = 0; i < accounts.length; i++) {
606
- const change = (postBalances[i] || 0) - (preBalances[i] || 0);
607
- if (change > 0) {
608
- stealthAddress = accounts[i].pubkey;
609
- amount = BigInt(change);
610
- } else if (change < 0 && i === 0) {
611
- sender = accounts[i].pubkey;
612
- }
613
- }
614
- if (!stealthAddress) return null;
615
- let isForMe = false;
797
+ let expectedStealthHex;
616
798
  try {
617
799
  const sharedSecret = await computeSharedSecretAsRecipient(
618
800
  metaSk,
619
801
  ephemeralPubkey
620
802
  );
621
803
  const expectedStealth = deriveStealthPubkey(metaPubkey, sharedSecret);
622
- isForMe = bytesToHex(expectedStealth) === bytesToHex(stealthAddress.toBytes());
804
+ expectedStealthHex = bytesToHex(expectedStealth);
623
805
  } catch (error) {
624
- console.warn("Error checking if tx is for me:", error);
806
+ console.warn("Error computing expected stealth:", error);
807
+ return null;
808
+ }
809
+ const accounts = tx.transaction.message.accountKeys;
810
+ const preBalances = tx.meta?.preBalances || [];
811
+ const postBalances = tx.meta?.postBalances || [];
812
+ let stealthIndex = -1;
813
+ for (let i = 0; i < accounts.length; i++) {
814
+ const accountHex = bytesToHex(accounts[i].pubkey.toBytes());
815
+ if (accountHex === expectedStealthHex) {
816
+ stealthIndex = i;
817
+ break;
818
+ }
819
+ }
820
+ if (stealthIndex === -1) return null;
821
+ const stealthAddress = accounts[stealthIndex].pubkey;
822
+ const change = (postBalances[stealthIndex] || 0) - (preBalances[stealthIndex] || 0);
823
+ const amount = BigInt(Math.max(change, 0));
824
+ let sender = null;
825
+ for (let i = 0; i < accounts.length; i++) {
826
+ const accChange = (postBalances[i] || 0) - (preBalances[i] || 0);
827
+ if (accChange < 0) {
828
+ sender = accounts[i].pubkey;
829
+ break;
830
+ }
625
831
  }
626
832
  return {
627
833
  signature,
@@ -631,7 +837,8 @@ var AdelosIndexer = class _AdelosIndexer {
631
837
  stealthAddress,
632
838
  amount,
633
839
  ephemeralPubkey,
634
- isForMe
840
+ isForMe: true
841
+ // If we reach here, it's definitely for us
635
842
  };
636
843
  }
637
844
  /**
@@ -685,14 +892,14 @@ var AdelosIndexer = class _AdelosIndexer {
685
892
  */
686
893
  async processWebhook(payload, metaSk, metaPubkey) {
687
894
  let memo = null;
688
- const memoProgram = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
895
+ const memoProgramStr = MEMO_PROGRAM_ID.toBase58();
689
896
  for (const ix of payload.instructions) {
690
- if (ix.programId === memoProgram) {
897
+ if (ix.programId === memoProgramStr) {
691
898
  memo = Buffer.from(ix.data, "base64").toString("utf-8");
692
899
  break;
693
900
  }
694
901
  }
695
- if (!memo?.startsWith("ADLSv1:")) return null;
902
+ if (!memo?.startsWith(MEMO_PREFIX)) return null;
696
903
  const ephemeralPubkey = parseStealthMemo(memo);
697
904
  if (!ephemeralPubkey) return null;
698
905
  let stealthAddress = null;
@@ -749,7 +956,7 @@ var AdelosIndexer = class _AdelosIndexer {
749
956
  webhookURL: webhookUrl,
750
957
  transactionTypes: ["TRANSFER"],
751
958
  accountAddresses: [
752
- "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"
959
+ MEMO_PROGRAM_ID.toBase58()
753
960
  ],
754
961
  webhookType: "enhanced"
755
962
  })
@@ -770,10 +977,11 @@ function createIndexer(config) {
770
977
  // src/index.ts
771
978
  var AdelosSDK = class {
772
979
  constructor(options = {}) {
773
- this.program = null;
774
- const rpcUrl = options.rpcUrl ?? "https://api.devnet.solana.com";
980
+ this.cluster = options.cluster ?? "devnet";
981
+ const rpcUrl = options.rpcUrl ?? RPC_URLS[this.cluster];
775
982
  this.connection = new import_web35.Connection(rpcUrl, "confirmed");
776
- this.programId = options.programId ?? PROGRAM_ID;
983
+ this.programId = PROGRAM_IDS[this.cluster];
984
+ this.heliusApiKey = options.heliusApiKey;
777
985
  }
778
986
  /**
779
987
  * Derives the registry PDA for an owner
@@ -883,7 +1091,7 @@ var AdelosSDK = class {
883
1091
  });
884
1092
  }
885
1093
  /**
886
- * Creates a register transaction (unsigned)
1094
+ * Creates a register transaction (unsigned) - Legacy format
887
1095
  */
888
1096
  async createRegisterTransaction(owner, metaPubkey) {
889
1097
  const instruction = this.createRegisterInstruction(owner, metaPubkey);
@@ -893,7 +1101,21 @@ var AdelosSDK = class {
893
1101
  return transaction;
894
1102
  }
895
1103
  /**
896
- * Creates an update transaction (unsigned)
1104
+ * Creates a register transaction (unsigned) - Versioned format (v0)
1105
+ * Recommended for modern Solana applications
1106
+ */
1107
+ async createRegisterTransactionV0(owner, metaPubkey) {
1108
+ const instruction = this.createRegisterInstruction(owner, metaPubkey);
1109
+ const { blockhash } = await this.connection.getLatestBlockhash();
1110
+ const messageV0 = new import_web35.TransactionMessage({
1111
+ payerKey: owner,
1112
+ recentBlockhash: blockhash,
1113
+ instructions: [instruction]
1114
+ }).compileToV0Message();
1115
+ return new import_web35.VersionedTransaction(messageV0);
1116
+ }
1117
+ /**
1118
+ * Creates an update transaction (unsigned) - Legacy format
897
1119
  */
898
1120
  async createUpdateTransaction(owner, newMetaPubkey) {
899
1121
  const instruction = this.createUpdateInstruction(owner, newMetaPubkey);
@@ -903,7 +1125,20 @@ var AdelosSDK = class {
903
1125
  return transaction;
904
1126
  }
905
1127
  /**
906
- * Creates a close transaction (unsigned)
1128
+ * Creates an update transaction (unsigned) - Versioned format (v0)
1129
+ */
1130
+ async createUpdateTransactionV0(owner, newMetaPubkey) {
1131
+ const instruction = this.createUpdateInstruction(owner, newMetaPubkey);
1132
+ const { blockhash } = await this.connection.getLatestBlockhash();
1133
+ const messageV0 = new import_web35.TransactionMessage({
1134
+ payerKey: owner,
1135
+ recentBlockhash: blockhash,
1136
+ instructions: [instruction]
1137
+ }).compileToV0Message();
1138
+ return new import_web35.VersionedTransaction(messageV0);
1139
+ }
1140
+ /**
1141
+ * Creates a close transaction (unsigned) - Legacy format
907
1142
  */
908
1143
  async createCloseTransaction(owner) {
909
1144
  const instruction = this.createCloseInstruction(owner);
@@ -913,7 +1148,20 @@ var AdelosSDK = class {
913
1148
  return transaction;
914
1149
  }
915
1150
  /**
916
- * Sends a signed transaction and confirms it
1151
+ * Creates a close transaction (unsigned) - Versioned format (v0)
1152
+ */
1153
+ async createCloseTransactionV0(owner) {
1154
+ const instruction = this.createCloseInstruction(owner);
1155
+ const { blockhash } = await this.connection.getLatestBlockhash();
1156
+ const messageV0 = new import_web35.TransactionMessage({
1157
+ payerKey: owner,
1158
+ recentBlockhash: blockhash,
1159
+ instructions: [instruction]
1160
+ }).compileToV0Message();
1161
+ return new import_web35.VersionedTransaction(messageV0);
1162
+ }
1163
+ /**
1164
+ * Sends a signed legacy transaction and confirms it
917
1165
  */
918
1166
  async sendAndConfirm(signedTransaction) {
919
1167
  const signature = await this.connection.sendRawTransaction(
@@ -922,6 +1170,16 @@ var AdelosSDK = class {
922
1170
  await this.connection.confirmTransaction(signature, "confirmed");
923
1171
  return signature;
924
1172
  }
1173
+ /**
1174
+ * Sends a signed versioned transaction and confirms it
1175
+ */
1176
+ async sendAndConfirmV0(signedTransaction) {
1177
+ const signature = await this.connection.sendRawTransaction(
1178
+ signedTransaction.serialize()
1179
+ );
1180
+ await this.connection.confirmTransaction(signature, "confirmed");
1181
+ return signature;
1182
+ }
925
1183
  };
926
1184
  // Annotate the CommonJS export names for ESM import in node:
927
1185
  0 && (module.exports = {
@@ -930,9 +1188,14 @@ var AdelosSDK = class {
930
1188
  IDL,
931
1189
  LIGHT_PROGRAM_IDS,
932
1190
  LightClient,
1191
+ MEMO_PREFIX,
1192
+ MEMO_PROGRAM_ID,
933
1193
  PROGRAM_ID,
1194
+ PROGRAM_IDS,
934
1195
  REGISTRY_ACCOUNT_SIZE,
935
1196
  REGISTRY_SEED,
1197
+ RPC_URLS,
1198
+ STEALTH_DOMAIN,
936
1199
  bytesToHex,
937
1200
  computeSharedSecret,
938
1201
  computeSharedSecretAsRecipient,