@glamsystems/glam-sdk 1.0.14-alpha.5 → 1.1.0-alpha.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,22 +1,27 @@
1
1
  import { Connection, PublicKey } from "@solana/web3.js";
2
- export type OracleSourceName = string;
3
- export interface OnchainAssetMeta {
2
+ import { Decodable } from "./deser/base";
3
+ import { PkMap } from "./utils";
4
+ type RawAssetMeta = {
4
5
  asset: PublicKey;
5
6
  decimals: number;
6
7
  oracle: PublicKey;
7
- oracleSource: OracleSourceName;
8
+ oracleSourceOrdinal: number;
8
9
  maxAgeSeconds: number;
9
10
  priority: number;
10
- }
11
- export interface GlobalConfigAccount {
11
+ padding: number[];
12
+ };
13
+ export declare function fetchGlobalConfig(connection: Connection, address?: PublicKey): Promise<GlobalConfig>;
14
+ export declare class GlobalConfig extends Decodable {
15
+ discriminator: number[];
12
16
  admin: PublicKey;
13
17
  feeAuthority: PublicKey;
14
18
  referrer: PublicKey;
15
19
  baseFeeBps: number;
16
20
  flowFeeBps: number;
17
- assetMetas: OnchainAssetMeta[];
21
+ assetMetas: RawAssetMeta[];
22
+ static _layout: any;
23
+ static encode(data: any): Buffer;
18
24
  }
19
- export declare function normalizeOracleSource(oracleSource: unknown): OracleSourceName;
20
- export declare function decodeGlobalConfigAccount(data: Buffer): GlobalConfigAccount;
21
- export declare function fetchGlobalConfig(connection: Connection, address?: PublicKey): Promise<GlobalConfigAccount>;
22
- export declare function fetchOnchainAssetMetas(connection: Connection, address?: PublicKey): Promise<Map<string, OnchainAssetMeta>>;
25
+ export declare function getOracleName(ordinal: number): string;
26
+ export declare function fetchOnchainAssetMetas(connection: Connection, address?: PublicKey): Promise<PkMap<RawAssetMeta>>;
27
+ export {};
package/src/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export * from "./client/timelock";
7
7
  export * from "./client/cctp";
8
8
  export * from "./client/bridge";
9
9
  export * from "./client/epi";
10
+ export * from "./client/loopscale";
11
+ export * from "./client/neutral";
10
12
  export * from "./client/price";
11
13
  export * from "./deser/integrationPolicies";
12
14
  export * from "./deser/tokenAclLayouts";
@@ -12,3 +12,4 @@ export declare function getTokenAclGateListConfigPda(authority: PublicKey, seed:
12
12
  export declare function getTokenAclGateWalletEntryPda(listConfig: PublicKey, wallet: PublicKey): PublicKey;
13
13
  export declare function getTokenAclGateExtraMetasPda(mint: PublicKey): PublicKey;
14
14
  export declare function getGlobalConfigPda(): PublicKey;
15
+ export declare function getIntegrationAuthorityPda(integrationProgram: PublicKey): PublicKey;
@@ -1,11 +1,13 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
+ type PkMapKey = PublicKey | string;
2
3
  /**
3
- * A Map implementation that uses PublicKey as keys.
4
+ * A Map implementation that uses PublicKey-compatible keys.
4
5
  *
5
6
  * This class extends the standard Map and allows using PublicKey objects
6
- * as keys by converting them to base58 strings internally. This solves the
7
- * problem of PublicKey object reference equality - two PublicKey objects
8
- * with the same address would normally be considered different keys in a Map.
7
+ * or base58 strings as keys by converting them to base58 strings internally.
8
+ * This solves the problem of PublicKey object reference equality - two
9
+ * PublicKey objects with the same address would normally be considered
10
+ * different keys in a Map.
9
11
  *
10
12
  * @example
11
13
  * ```typescript
@@ -16,7 +18,7 @@ import { PublicKey } from "@solana/web3.js";
16
18
  *
17
19
  * // Create with initial entries
18
20
  * const map2 = new PkMap<string>([
19
- * [new PublicKey("11111111111111111111111111111111"), "value1"],
21
+ * ["11111111111111111111111111111111", "value1"],
20
22
  * [new PublicKey("22222222222222222222222222222222"), "value2"]
21
23
  * ]);
22
24
  *
@@ -29,34 +31,36 @@ export declare class PkMap<V> {
29
31
  private readonly _map;
30
32
  /**
31
33
  * Creates a new PkMap instance.
32
- * @param entries - Optional initial entries as [PublicKey, V] pairs
34
+ * @param entries - Optional initial entries as [PublicKey|string, V] pairs
33
35
  */
34
- constructor(entries?: readonly (readonly [PublicKey, V])[] | null);
36
+ constructor();
37
+ constructor(entries?: readonly (readonly [PkMapKey, V])[] | null);
38
+ constructor(entries?: Iterable<readonly [PkMapKey, V]> | null);
35
39
  /**
36
40
  * Associates the specified value with the specified PublicKey in this map.
37
- * @param key - The PublicKey to use as the key
41
+ * @param key - The PublicKey or base58 string to use as the key
38
42
  * @param value - The value to associate with the key
39
43
  * @returns This PkMap instance for chaining
40
44
  */
41
- set(key: PublicKey, value: V): this;
45
+ set(key: PkMapKey, value: V): this;
42
46
  /**
43
- * Returns the value associated with the specified PublicKey, or undefined if not found.
44
- * @param key - The PublicKey whose associated value is to be returned
47
+ * Returns the value associated with the specified key, or undefined if not found.
48
+ * @param key - The PublicKey or base58 string whose associated value is to be returned
45
49
  * @returns The value associated with the specified key, or undefined
46
50
  */
47
- get(key: PublicKey): V | undefined;
51
+ get(key: PkMapKey): V | undefined;
48
52
  /**
49
- * Returns true if this map contains a mapping for the specified PublicKey.
50
- * @param key - The PublicKey whose presence in this map is to be tested
53
+ * Returns true if this map contains a mapping for the specified key.
54
+ * @param key - The PublicKey or base58 string whose presence in this map is to be tested
51
55
  * @returns true if this map contains a mapping for the specified key
52
56
  */
53
- has(key: PublicKey): boolean;
57
+ has(key: PkMapKey): boolean;
54
58
  /**
55
- * Removes the mapping for the specified PublicKey from this map if present.
56
- * @param key - The PublicKey whose mapping is to be removed
59
+ * Removes the mapping for the specified key from this map if present.
60
+ * @param key - The PublicKey or base58 string whose mapping is to be removed
57
61
  * @returns true if the element was removed, false otherwise
58
62
  */
59
- delete(key: PublicKey): boolean;
63
+ delete(key: PkMapKey): boolean;
60
64
  /**
61
65
  * Returns an iterator of all PublicKey keys in this map.
62
66
  * Note: This reconstructs PublicKey objects from the stored base58 strings.
@@ -80,3 +84,4 @@ export declare class PkMap<V> {
80
84
  values(): IterableIterator<V>;
81
85
  [Symbol.iterator](): IterableIterator<[PublicKey, V]>;
82
86
  }
87
+ export {};