@symmetry-hq/temp-v3-sdk 0.0.59 → 0.0.60

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.
@@ -7,6 +7,7 @@ export declare const MINT_SEED: Buffer;
7
7
  export declare const RENT_PAYER_SEED: Buffer;
8
8
  export declare const BOUNTY_VAULT_SEED: Buffer;
9
9
  export declare const REBALANCE_INTENT_SEED: Buffer;
10
+ export declare const TOKEN_METADATA_PROGRAM_ID: PublicKey;
10
11
  export declare function serializeString(input: string): Uint8Array;
11
12
  export declare function getRandomSeed(): number[];
12
13
  export declare function getBasketTokenMintPda(basketId: number): PublicKey;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REBALANCE_INTENT_SEED = exports.BOUNTY_VAULT_SEED = exports.RENT_PAYER_SEED = exports.MINT_SEED = exports.BASKET_SEED = exports.WITHDRAW_BASKET_FEES_SEED = exports.BASKET_FEES_SEED = exports.GLOBAL_CONFIG_SEED = void 0;
3
+ exports.TOKEN_METADATA_PROGRAM_ID = exports.REBALANCE_INTENT_SEED = exports.BOUNTY_VAULT_SEED = exports.RENT_PAYER_SEED = exports.MINT_SEED = exports.BASKET_SEED = exports.WITHDRAW_BASKET_FEES_SEED = exports.BASKET_FEES_SEED = exports.GLOBAL_CONFIG_SEED = void 0;
4
4
  exports.serializeString = serializeString;
5
5
  exports.getRandomSeed = getRandomSeed;
6
6
  exports.getBasketTokenMintPda = getBasketTokenMintPda;
@@ -18,7 +18,6 @@ exports.getLookupTableInfoAccount = getLookupTableInfoAccount;
18
18
  exports.getAta = getAta;
19
19
  const uuid_1 = require("uuid");
20
20
  const anchor_1 = require("@coral-xyz/anchor");
21
- const js_1 = require("@metaplex-foundation/js");
22
21
  const spl_token_1 = require("@solana/spl-token");
23
22
  const web3_js_1 = require("@solana/web3.js");
24
23
  const constants_1 = require("../constants");
@@ -30,6 +29,7 @@ exports.MINT_SEED = Buffer.from("mint");
30
29
  exports.RENT_PAYER_SEED = Buffer.from("rent_payer");
31
30
  exports.BOUNTY_VAULT_SEED = Buffer.from("bounty_vault");
32
31
  exports.REBALANCE_INTENT_SEED = Buffer.from("rebalance_intent");
32
+ exports.TOKEN_METADATA_PROGRAM_ID = new web3_js_1.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
33
33
  function serializeString(input) {
34
34
  const utf8 = new TextEncoder().encode(input);
35
35
  const length = utf8.length;
@@ -101,8 +101,11 @@ function getRebalanceIntentPda(basket, owner) {
101
101
  ], constants_1.BASKETS_V3_PROGRAM_ID)[0];
102
102
  }
103
103
  function getMetadataAccount(tokenMint) {
104
- const metaplex = js_1.Metaplex.make(new web3_js_1.Connection("https://api.devnet.solana.com"));
105
- return metaplex.nfts().pdas().metadata({ mint: tokenMint });
104
+ return web3_js_1.PublicKey.findProgramAddressSync([
105
+ Buffer.from("metadata"),
106
+ exports.TOKEN_METADATA_PROGRAM_ID.toBuffer(),
107
+ tokenMint.toBuffer(),
108
+ ], exports.TOKEN_METADATA_PROGRAM_ID)[0];
106
109
  }
107
110
  function getLookupTableAccount(creator, slot) {
108
111
  const ixAndPubkey = web3_js_1.AddressLookupTableProgram.createLookupTable({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symmetry-hq/temp-v3-sdk",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "description": "Symmetry V3 SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -19,7 +19,6 @@
19
19
  "dependencies": {
20
20
  "@coral-xyz/anchor": "^0.31.1",
21
21
  "@coral-xyz/borsh": "^0.31.1",
22
- "@metaplex-foundation/js": "^0.20.1",
23
22
  "@pythnetwork/hermes-client": "^2.1.0",
24
23
  "@solana/spl-token": "^0.4.14",
25
24
  "@solana/web3.js": "^1.98.4",
@@ -1,9 +1,8 @@
1
1
  import { parse, v4 } from 'uuid';
2
2
 
3
3
  import { BN } from '@coral-xyz/anchor';
4
- import { Metaplex } from '@metaplex-foundation/js';
5
4
  import { getAssociatedTokenAddressSync } from '@solana/spl-token';
6
- import { AddressLookupTableProgram, Connection, PublicKey } from '@solana/web3.js';
5
+ import { AddressLookupTableProgram, PublicKey } from '@solana/web3.js';
7
6
 
8
7
  import { BASKETS_V3_PROGRAM_ID } from '../constants';
9
8
 
@@ -15,6 +14,7 @@ export const MINT_SEED = Buffer.from("mint");
15
14
  export const RENT_PAYER_SEED = Buffer.from("rent_payer");
16
15
  export const BOUNTY_VAULT_SEED = Buffer.from("bounty_vault");
17
16
  export const REBALANCE_INTENT_SEED = Buffer.from("rebalance_intent");
17
+ export const TOKEN_METADATA_PROGRAM_ID = new PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
18
18
 
19
19
  export function serializeString(input: string): Uint8Array {
20
20
  const utf8 = new TextEncoder().encode(input);
@@ -112,8 +112,14 @@ export function getRebalanceIntentPda(
112
112
  export function getMetadataAccount(
113
113
  tokenMint: PublicKey
114
114
  ): PublicKey {
115
- const metaplex = Metaplex.make(new Connection("https://api.devnet.solana.com"));
116
- return metaplex.nfts().pdas().metadata({ mint: tokenMint });
115
+ return PublicKey.findProgramAddressSync(
116
+ [
117
+ Buffer.from("metadata"),
118
+ TOKEN_METADATA_PROGRAM_ID.toBuffer(),
119
+ tokenMint.toBuffer(),
120
+ ],
121
+ TOKEN_METADATA_PROGRAM_ID
122
+ )[0];
117
123
  }
118
124
 
119
125
  export function getLookupTableAccount(